Skip to content

Commit 58b7f63

Browse files
committed
#2: changed module structure to build with ngc
1 parent baa4b6d commit 58b7f63

File tree

15 files changed

+312
-102
lines changed

15 files changed

+312
-102
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Node
22
node_modules/*
33
npm-debug.log
4+
*.ngsummary.json
5+
dist/*
6+
!dist/package.json
47

58
# TypeScript
69
*.js

dist/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "abp-ng2-module",
3+
"version": "1.0.0",
4+
"description": "AspNet Boilerplate Angular Module",
5+
"main": "bundles/abp-ng2-module.umd.js",
6+
"module": "index.js",
7+
"typings": "index.d.ts",
8+
"scripts": {},
9+
"keywords": [
10+
"angular",
11+
"angular2"
12+
],
13+
"author": {
14+
"name": "Halil İbrahim Kalkan",
15+
"email": "hi_kalkan@yahoo.com"
16+
},
17+
"license": "MIT",
18+
"repository": {
19+
"type": "git",
20+
"url": "https://github.com/aspnetboilerplate/abp-ng2-module"
21+
},
22+
"bugs": {
23+
"url": "https://github.com/aspnetboilerplate/abp-ng2-module/issues"
24+
},
25+
"peerDependencies": {
26+
"@angular/core": "^4.0.0",
27+
"@angular/http": "^4.0.0",
28+
"abp-web-resources": "^1.3.0"
29+
}
30+
}

index.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
export * from './src/abp.module';
2-
export * from './src/session/abp-session.service';
3-
export * from './src/auth/permission-checker.service';
4-
export * from './src/features/feature-checker.service';
5-
export * from './src/localization/localization.service';
6-
export * from './src/settings/setting.service';
7-
export * from './src/notify/notify.service';
8-
export * from './src/message/message.service';
9-
export * from './src/log/log.service';
10-
export * from './src/multi-tenancy/abp-multi-tenancy.service';
11-
export * from './src/auth/token.service';
12-
export * from './src/utils/utils.service';
13-
export * from './src/abpHttp';
14-
export * from './src/abp-user-configuration.service';
1+
/**
2+
* @module
3+
* @description
4+
* Entry point for all public APIs of the Angular Module
5+
*/
6+
export * from './src/index';

package.json

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,47 @@
11
{
22
"name": "abp-ng2-module",
33
"version": "1.0.0",
4+
"description": "AspNet Boilerplate Angular Module",
5+
"main": "dist/bundles/abp-ng2-module.umd.js",
6+
"module": "dist/index.js",
47
"scripts": {
5-
"lint": "tslint src/**/*.ts",
6-
"test": "tsc --skipLibCheck && karma start",
7-
"prepublish": "tsc --skipLibCheck",
8-
"tsc": "tsc --skipLibCheck",
9-
"typings": "typings"
10-
},
11-
"repository": {
12-
"type": "git",
13-
"url": "https://github.com/aspnetboilerplate/abp-ng2-module"
14-
},
15-
"author": {
16-
"name": "Halil İbrahim Kalkan",
17-
"email": "hi_kalkan@yahoo.com"
8+
"cleanup": "rimraf dist/bundles dist/src dist/index.d.ts dist/index.metadata.json dist/index.js dist/index.js.map dist/LICENSE dist/README.md",
9+
"bundling": "rollup -c",
10+
"minify": "uglifyjs dist/bundles/abp-ng2-module.umd.js --screw-ie8 --compress --mangle --comments --output dist/bundles/abp-ng2-module.umd.min.js",
11+
"copy": "copyfiles LICENSE README.md dist",
12+
"build": "npm run cleanup && ngc && npm run bundling && npm run minify && npm run copy",
13+
"publish-to-npm": "cd dist && npm publish"
1814
},
1915
"keywords": [
2016
"angular",
2117
"angular2"
2218
],
23-
"license": "MIT",
19+
"author": {
20+
"name": "Halil İbrahim Kalkan",
21+
"email": "hi_kalkan@yahoo.com"
22+
},
23+
"license": "MIT",
24+
"repository": {
25+
"type": "git",
26+
"url": "https://github.com/aspnetboilerplate/abp-ng2-module"
27+
},
2428
"bugs": {
2529
"url": "https://github.com/aspnetboilerplate/abp-ng2-module/issues"
2630
},
27-
"main": "./dist/index.js",
28-
"typings": "./dist/index.d.ts",
2931
"dependencies": {
3032
"@angular/core": "^4.0.0",
3133
"@angular/http": "^4.0.0",
32-
"abp-web-resources": "^1.2.1"
34+
"abp-web-resources": "^1.3.0"
3335
},
3436
"devDependencies": {
35-
"codelyzer": "~2.0.0-beta.4",
36-
"rxjs": "^5.2.0",
37-
"tslint": "^4.3.0",
37+
"@angular/compiler": "^4.0.0",
38+
"@angular/compiler-cli": "^4.0.0",
39+
"copyfiles": "^1.0.0",
40+
"rimraf": "^2.5.4",
41+
"rollup": "^0.37.0",
3842
"typescript": "^2.2.2",
39-
"typings": "^1.0.4",
43+
"uglify-js": "^2.7.5",
44+
"rxjs": "^5.2.0",
4045
"zone.js": "^0.8.5"
41-
},
42-
"engines": {
43-
"node": ">=0.8.0"
4446
}
4547
}

src/abp.module.ngfactory.ts

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/**
2+
* @fileoverview This file is generated by the Angular template compiler.
3+
* Do not edit.
4+
* @suppress {suspiciousCode,uselessCode,missingProperties}
5+
*/
6+
/* tslint:disable */
7+
8+
9+
import * as import0 from '@angular/core';
10+
import * as import1 from './abp.module';
11+
import * as import2 from '@angular/http';
12+
import * as import3 from './message/message.service';
13+
import * as import4 from './log/log.service';
14+
import * as import5 from './abpHttp';
15+
import * as import6 from './session/abp-session.service';
16+
import * as import7 from './auth/permission-checker.service';
17+
import * as import8 from './features/feature-checker.service';
18+
import * as import9 from './localization/localization.service';
19+
import * as import10 from './settings/setting.service';
20+
import * as import11 from './notify/notify.service';
21+
import * as import12 from './multi-tenancy/abp-multi-tenancy.service';
22+
import * as import13 from './abp-user-configuration.service';
23+
import * as import14 from './auth/token.service';
24+
import * as import15 from './utils/utils.service';
25+
class AbpModuleInjector extends import0.ɵNgModuleInjector<import1.AbpModule> {
26+
_HttpModule_0:import2.HttpModule;
27+
_JsonpModule_1:import2.JsonpModule;
28+
_AbpModule_2:import1.AbpModule;
29+
__BrowserXhr_3:import2.BrowserXhr;
30+
__ResponseOptions_4:import2.BaseResponseOptions;
31+
__XSRFStrategy_5:any;
32+
__XHRBackend_6:import2.XHRBackend;
33+
__RequestOptions_7:import2.BaseRequestOptions;
34+
__MessageService_8:import3.MessageService;
35+
__LogService_9:import4.LogService;
36+
__AbpHttpConfiguration_10:import5.AbpHttpConfiguration;
37+
__Http_11:any;
38+
__ɵg_12:import2.ɵg;
39+
__JSONPBackend_13:import2.ɵa;
40+
__Jsonp_14:any;
41+
__AbpSessionService_15:import6.AbpSessionService;
42+
__PermissionCheckerService_16:import7.PermissionCheckerService;
43+
__FeatureCheckerService_17:import8.FeatureCheckerService;
44+
__LocalizationService_18:import9.LocalizationService;
45+
__SettingService_19:import10.SettingService;
46+
__NotifyService_20:import11.NotifyService;
47+
__AbpMultiTenancyService_21:import12.AbpMultiTenancyService;
48+
__AbpUserConfigurationService_22:import13.AbpUserConfigurationService;
49+
__TokenService_23:import14.TokenService;
50+
__UtilsService_24:import15.UtilsService;
51+
constructor(parent:import0.Injector) {
52+
super(parent,([] as any[]),([] as any[]));
53+
}
54+
get _BrowserXhr_3():import2.BrowserXhr {
55+
if ((this.__BrowserXhr_3 == null)) { (this.__BrowserXhr_3 = new import2.BrowserXhr()); }
56+
return this.__BrowserXhr_3;
57+
}
58+
get _ResponseOptions_4():import2.BaseResponseOptions {
59+
if ((this.__ResponseOptions_4 == null)) { (this.__ResponseOptions_4 = new import2.BaseResponseOptions()); }
60+
return this.__ResponseOptions_4;
61+
}
62+
get _XSRFStrategy_5():any {
63+
if ((this.__XSRFStrategy_5 == null)) { (this.__XSRFStrategy_5 = import2.ɵb()); }
64+
return this.__XSRFStrategy_5;
65+
}
66+
get _XHRBackend_6():import2.XHRBackend {
67+
if ((this.__XHRBackend_6 == null)) { (this.__XHRBackend_6 = new import2.XHRBackend(this._BrowserXhr_3,this._ResponseOptions_4,this._XSRFStrategy_5)); }
68+
return this.__XHRBackend_6;
69+
}
70+
get _RequestOptions_7():import2.BaseRequestOptions {
71+
if ((this.__RequestOptions_7 == null)) { (this.__RequestOptions_7 = new import2.BaseRequestOptions()); }
72+
return this.__RequestOptions_7;
73+
}
74+
get _MessageService_8():import3.MessageService {
75+
if ((this.__MessageService_8 == null)) { (this.__MessageService_8 = new import3.MessageService()); }
76+
return this.__MessageService_8;
77+
}
78+
get _LogService_9():import4.LogService {
79+
if ((this.__LogService_9 == null)) { (this.__LogService_9 = new import4.LogService()); }
80+
return this.__LogService_9;
81+
}
82+
get _AbpHttpConfiguration_10():import5.AbpHttpConfiguration {
83+
if ((this.__AbpHttpConfiguration_10 == null)) { (this.__AbpHttpConfiguration_10 = new import5.AbpHttpConfiguration(this._MessageService_8,this._LogService_9)); }
84+
return this.__AbpHttpConfiguration_10;
85+
}
86+
get _Http_11():any {
87+
if ((this.__Http_11 == null)) { (this.__Http_11 = import1.abpHttpFactory(this._XHRBackend_6,this._RequestOptions_7,this._AbpHttpConfiguration_10)); }
88+
return this.__Http_11;
89+
}
90+
get _ɵg_12():import2.ɵg {
91+
if ((this.__ɵg_12 == null)) { (this.__ɵg_12 = new import2.ɵg()); }
92+
return this.__ɵg_12;
93+
}
94+
get _JSONPBackend_13():import2.ɵa {
95+
if ((this.__JSONPBackend_13 == null)) { (this.__JSONPBackend_13 = new import2.ɵa(this._ɵg_12,this._ResponseOptions_4)); }
96+
return this.__JSONPBackend_13;
97+
}
98+
get _Jsonp_14():any {
99+
if ((this.__Jsonp_14 == null)) { (this.__Jsonp_14 = import2.ɵd(this._JSONPBackend_13,this._RequestOptions_7)); }
100+
return this.__Jsonp_14;
101+
}
102+
get _AbpSessionService_15():import6.AbpSessionService {
103+
if ((this.__AbpSessionService_15 == null)) { (this.__AbpSessionService_15 = new import6.AbpSessionService()); }
104+
return this.__AbpSessionService_15;
105+
}
106+
get _PermissionCheckerService_16():import7.PermissionCheckerService {
107+
if ((this.__PermissionCheckerService_16 == null)) { (this.__PermissionCheckerService_16 = new import7.PermissionCheckerService()); }
108+
return this.__PermissionCheckerService_16;
109+
}
110+
get _FeatureCheckerService_17():import8.FeatureCheckerService {
111+
if ((this.__FeatureCheckerService_17 == null)) { (this.__FeatureCheckerService_17 = new import8.FeatureCheckerService()); }
112+
return this.__FeatureCheckerService_17;
113+
}
114+
get _LocalizationService_18():import9.LocalizationService {
115+
if ((this.__LocalizationService_18 == null)) { (this.__LocalizationService_18 = new import9.LocalizationService()); }
116+
return this.__LocalizationService_18;
117+
}
118+
get _SettingService_19():import10.SettingService {
119+
if ((this.__SettingService_19 == null)) { (this.__SettingService_19 = new import10.SettingService()); }
120+
return this.__SettingService_19;
121+
}
122+
get _NotifyService_20():import11.NotifyService {
123+
if ((this.__NotifyService_20 == null)) { (this.__NotifyService_20 = new import11.NotifyService()); }
124+
return this.__NotifyService_20;
125+
}
126+
get _AbpMultiTenancyService_21():import12.AbpMultiTenancyService {
127+
if ((this.__AbpMultiTenancyService_21 == null)) { (this.__AbpMultiTenancyService_21 = new import12.AbpMultiTenancyService()); }
128+
return this.__AbpMultiTenancyService_21;
129+
}
130+
get _AbpUserConfigurationService_22():import13.AbpUserConfigurationService {
131+
if ((this.__AbpUserConfigurationService_22 == null)) { (this.__AbpUserConfigurationService_22 = new import13.AbpUserConfigurationService(this._Http_11)); }
132+
return this.__AbpUserConfigurationService_22;
133+
}
134+
get _TokenService_23():import14.TokenService {
135+
if ((this.__TokenService_23 == null)) { (this.__TokenService_23 = new import14.TokenService()); }
136+
return this.__TokenService_23;
137+
}
138+
get _UtilsService_24():import15.UtilsService {
139+
if ((this.__UtilsService_24 == null)) { (this.__UtilsService_24 = new import15.UtilsService()); }
140+
return this.__UtilsService_24;
141+
}
142+
createInternal():import1.AbpModule {
143+
this._HttpModule_0 = new import2.HttpModule();
144+
this._JsonpModule_1 = new import2.JsonpModule();
145+
this._AbpModule_2 = new import1.AbpModule();
146+
return this._AbpModule_2;
147+
}
148+
getInternal(token:any,notFoundResult:any):any {
149+
if ((token === import2.HttpModule)) { return this._HttpModule_0; }
150+
if ((token === import2.JsonpModule)) { return this._JsonpModule_1; }
151+
if ((token === import1.AbpModule)) { return this._AbpModule_2; }
152+
if ((token === import2.BrowserXhr)) { return this._BrowserXhr_3; }
153+
if ((token === import2.ResponseOptions)) { return this._ResponseOptions_4; }
154+
if ((token === import2.XSRFStrategy)) { return this._XSRFStrategy_5; }
155+
if ((token === import2.XHRBackend)) { return this._XHRBackend_6; }
156+
if ((token === import2.RequestOptions)) { return this._RequestOptions_7; }
157+
if ((token === import3.MessageService)) { return this._MessageService_8; }
158+
if ((token === import4.LogService)) { return this._LogService_9; }
159+
if ((token === import5.AbpHttpConfiguration)) { return this._AbpHttpConfiguration_10; }
160+
if ((token === import2.Http)) { return this._Http_11; }
161+
if ((token === import2.ɵg)) { return this._ɵg_12; }
162+
if ((token === import2.JSONPBackend)) { return this._JSONPBackend_13; }
163+
if ((token === import2.Jsonp)) { return this._Jsonp_14; }
164+
if ((token === import6.AbpSessionService)) { return this._AbpSessionService_15; }
165+
if ((token === import7.PermissionCheckerService)) { return this._PermissionCheckerService_16; }
166+
if ((token === import8.FeatureCheckerService)) { return this._FeatureCheckerService_17; }
167+
if ((token === import9.LocalizationService)) { return this._LocalizationService_18; }
168+
if ((token === import10.SettingService)) { return this._SettingService_19; }
169+
if ((token === import11.NotifyService)) { return this._NotifyService_20; }
170+
if ((token === import12.AbpMultiTenancyService)) { return this._AbpMultiTenancyService_21; }
171+
if ((token === import13.AbpUserConfigurationService)) { return this._AbpUserConfigurationService_22; }
172+
if ((token === import14.TokenService)) { return this._TokenService_23; }
173+
if ((token === import15.UtilsService)) { return this._UtilsService_24; }
174+
return notFoundResult;
175+
}
176+
destroyInternal():void {
177+
}
178+
}
179+
export const AbpModuleNgFactory:import0.NgModuleFactory<import1.AbpModule> = new import0.NgModuleFactory<any>(AbpModuleInjector,import1.AbpModule);
180+
//# sourceMappingURL=data:application/json;base64,eyJmaWxlIjoiRDovUmVwb3NpdG9yaWVzL0dpdGh1Yi9hYnAtbmcyLW1vZHVsZS9zcmMvYWJwLm1vZHVsZS5uZ2ZhY3RvcnkudHMiLCJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJuZzovLy9EOi9SZXBvc2l0b3JpZXMvR2l0aHViL2FicC1uZzItbW9kdWxlL3NyYy9hYnAubW9kdWxlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIiAiXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9

src/abpHttp.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class AbpHttpConfiguration {
161161
return new Response(newResponse);
162162
}
163163

164-
getAbpAjaxResponseOrNull(response: Response): IAjaxResponse {
164+
getAbpAjaxResponseOrNull(response: Response): IAjaxResponse | null {
165165
var contentType = response.headers.get('Content-Type');
166166
if (!contentType) {
167167
this._logService.warn('Content-Type is not sent!');
@@ -275,27 +275,27 @@ export class AbpHttp extends Http {
275275

276276
protected addAcceptLanguageHeader(options: RequestOptionsArgs) {
277277
let cookieLangValue = this._utilsService.getCookieValue("Abp.Localization.CultureName");
278-
if (cookieLangValue && !options.headers.has('Accept-Language')) {
278+
if (cookieLangValue && options.headers && !options.headers.has('Accept-Language')) {
279279
options.headers.append('Accept-Language', cookieLangValue);
280280
}
281281
}
282282

283283
protected addTenantIdHeader(options: RequestOptionsArgs) {
284284
let cookieTenantIdValue = this._utilsService.getCookieValue('Abp.TenantId');
285-
if (cookieTenantIdValue && !options.headers.has('Abp.TenantId')) {
285+
if (cookieTenantIdValue && options.headers && !options.headers.has('Abp.TenantId')) {
286286
options.headers.append('Abp.TenantId', cookieTenantIdValue);
287287
}
288288
}
289289

290290
protected addAuthorizationHeaders(options: RequestOptionsArgs): void {
291-
let authorizationHeaders = options.headers.getAll('Authorization');
291+
let authorizationHeaders = options.headers ? options.headers.getAll('Authorization'): null;
292292
if (!authorizationHeaders) {
293293
authorizationHeaders = [];
294294
}
295295

296296
if (!this.itemExists(authorizationHeaders, (item: string) => item.indexOf('Bearer ') == 0)) {
297297
let token = this._tokenService.getToken();
298-
if (token) {
298+
if (options.headers && token) {
299299
options.headers.append('Authorization', 'Bearer ' + token);
300300
}
301301
}

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { AbpModule } from './abp.module';

src/session/abp-session.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
@Injectable()
44
export class AbpSessionService {
55

6-
get userId(): number {
6+
get userId(): number | undefined {
77
return abp.session.userId;
88
}
99

10-
get tenantId(): number {
10+
get tenantId(): number | undefined {
1111
return abp.session.tenantId;
1212
}
1313

14-
get impersonatorUserId(): number {
14+
get impersonatorUserId(): number | undefined {
1515
return abp.session.impersonatorUserId;
1616
}
1717

18-
get impersonatorTenantId(): number {
18+
get impersonatorTenantId(): number | undefined {
1919
return abp.session.impersonatorTenantId;
2020
}
2121

0 commit comments

Comments
 (0)