@sd-angular/core 0.0.881 → 0.0.885
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/sd-angular-core-api.metadata.json +1 -1
- package/api/src/lib/api.model.d.ts +2 -2
- package/api/src/lib/http.interceptor.d.ts +1 -1
- package/assets/ckeditor/plugins/notification/plugin.js +1 -1
- package/assets/ckeditor/plugins/videoembed/.gitattributes +17 -0
- package/assets/ckeditor/plugins/wordcount/lang/ca.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/cs.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/de.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/el.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/en.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/es.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/eu.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/fa.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/fr.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/he.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/hr.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/hu.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/ja.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/nl.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/no.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/pl.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/pt-br.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/ro.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/ru.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/sk.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/sv.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/tr.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/uk.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/zh-cn.js +1 -1
- package/assets/ckeditor/plugins/wordcount/lang/zh.js +1 -1
- package/assets/ckeditor/plugins/wordcount/samples/wordcount.html +1 -1
- package/assets/ckeditor/plugins/wordcount/samples/wordcountWithMaxCount.html +1 -1
- package/bundles/sd-angular-core-api.umd.js +134 -121
- package/bundles/sd-angular-core-api.umd.js.map +1 -1
- package/bundles/sd-angular-core-api.umd.min.js +1 -1
- package/bundles/sd-angular-core-api.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-cache.umd.js +152 -14
- package/bundles/sd-angular-core-cache.umd.js.map +1 -1
- package/bundles/sd-angular-core-cache.umd.min.js +2 -2
- package/bundles/sd-angular-core-cache.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.js +33 -24
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-upload-excel.umd.js +1 -0
- package/bundles/sd-angular-core-upload-excel.umd.js.map +1 -1
- package/bundles/sd-angular-core-upload-excel.umd.min.js +1 -1
- package/bundles/sd-angular-core-upload-excel.umd.min.js.map +1 -1
- package/cache/sd-angular-core-cache.d.ts +0 -1
- package/cache/sd-angular-core-cache.metadata.json +1 -1
- package/cache/src/lib/cache.model.d.ts +27 -4
- package/cache/src/lib/cache.service.d.ts +3 -2
- package/cache/src/public-api.d.ts +1 -0
- package/esm2015/api/src/lib/api.model.js +1 -1
- package/esm2015/api/src/lib/http.interceptor.js +36 -29
- package/esm2015/cache/sd-angular-core-cache.js +1 -2
- package/esm2015/cache/src/lib/cache.model.js +1 -1
- package/esm2015/cache/src/lib/cache.service.js +115 -11
- package/esm2015/cache/src/public-api.js +2 -1
- package/esm2015/grid-material/src/lib/components/grid-filter/grid-filter.component.js +8 -7
- package/esm2015/grid-material/src/lib/grid-material.component.js +8 -1
- package/esm2015/grid-material/src/lib/models/grid-column.model.js +1 -1
- package/esm2015/upload-excel/src/lib/upload-excel.component.js +2 -1
- package/fesm2015/sd-angular-core-api.js +35 -29
- package/fesm2015/sd-angular-core-api.js.map +1 -1
- package/fesm2015/sd-angular-core-cache.js +115 -11
- package/fesm2015/sd-angular-core-cache.js.map +1 -1
- package/fesm2015/sd-angular-core-grid-material.js +14 -6
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-upload-excel.js +1 -0
- package/fesm2015/sd-angular-core-upload-excel.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/models/grid-column.model.d.ts +1 -0
- package/package.json +1 -1
- package/{sd-angular-core-0.0.881.tgz → sd-angular-core-0.0.885.tgz} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"SdApiModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":4,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClientModule","line":6,"character":4}],"exports":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClientModule","line":9,"character":4}],"providers":[{"provide":{"__symbolic":"reference","module":"@angular/common/http","name":"HTTP_INTERCEPTORS","line":12,"character":15},"useClass":{"__symbolic":"reference","name":"SdHttpInterceptor"},"multi":true}]}]}],"members":{}},"SdTokenService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":42,"character":5},"arguments":[{"__symbolic":"reference","name":"API_CONFIG"}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":42,"character":25}}],null],"parameters":[{"__symbolic":"reference","name":"IApiConfiguration"},{"__symbolic":"reference","module":"@sd-angular/core/cache","name":"SdCacheService","line":43,"character":26}]}]},"statics":{"ɵprov":{}}},"IApiConfiguration":{"__symbolic":"interface"},"API_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":13,"character":30},"arguments":["api.configuration"]},"TOKEN":{"__symbolic":"call","arguments":[{"origin":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"location"},"member":"origin"},"key":"ed4a2ffc-af43-41fb-9ac9-970f43d99571"}]},"SdApiService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":11,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":37,"character":5},"arguments":[{"__symbolic":"reference","name":"API_CONFIG"}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":37,"character":25}}],null,null],"parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":36,"character":24},{"__symbolic":"reference","name":"IApiConfiguration"},{"__symbolic":"reference","module":"@sd-angular/core/cache","name":"SdCacheService","line":38,"character":26},{"__symbolic":"reference","name":"SdTokenService"}]}],"put":[{"__symbolic":"method"}],"delete":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"SdHttpService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":11,"character":24},{"__symbolic":"reference","name":"SdTokenService"}]}]},"statics":{"ɵprov":{}}},"SdHttpInterceptor":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":7,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":10,"character":5},"arguments":[{"__symbolic":"reference","name":"API_CONFIG"}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":10,"character":25}}],null],"parameters":[{"__symbolic":"reference","name":"IApiConfiguration"},{"__symbolic":"reference","name":"SdTokenService"}]}]
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"SdApiModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":4,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClientModule","line":6,"character":4}],"exports":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClientModule","line":9,"character":4}],"providers":[{"provide":{"__symbolic":"reference","module":"@angular/common/http","name":"HTTP_INTERCEPTORS","line":12,"character":15},"useClass":{"__symbolic":"reference","name":"SdHttpInterceptor"},"multi":true}]}]}],"members":{}},"SdTokenService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":42,"character":5},"arguments":[{"__symbolic":"reference","name":"API_CONFIG"}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":42,"character":25}}],null],"parameters":[{"__symbolic":"reference","name":"IApiConfiguration"},{"__symbolic":"reference","module":"@sd-angular/core/cache","name":"SdCacheService","line":43,"character":26}]}]},"statics":{"ɵprov":{}}},"IApiConfiguration":{"__symbolic":"interface"},"API_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":13,"character":30},"arguments":["api.configuration"]},"TOKEN":{"__symbolic":"call","arguments":[{"origin":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"location"},"member":"origin"},"key":"ed4a2ffc-af43-41fb-9ac9-970f43d99571"}]},"SdApiService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":11,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":37,"character":5},"arguments":[{"__symbolic":"reference","name":"API_CONFIG"}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":37,"character":25}}],null,null],"parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":36,"character":24},{"__symbolic":"reference","name":"IApiConfiguration"},{"__symbolic":"reference","module":"@sd-angular/core/cache","name":"SdCacheService","line":38,"character":26},{"__symbolic":"reference","name":"SdTokenService"}]}],"put":[{"__symbolic":"method"}],"delete":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"SdHttpService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":11,"character":24},{"__symbolic":"reference","name":"SdTokenService"}]}]},"statics":{"ɵprov":{}}},"SdHttpInterceptor":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":7,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":10,"character":5},"arguments":[{"__symbolic":"reference","name":"API_CONFIG"}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":10,"character":25}}],null],"parameters":[{"__symbolic":"reference","name":"IApiConfiguration"},{"__symbolic":"reference","name":"SdTokenService"}]}]}}},"origins":{"SdApiModule":"./src/lib/api.module","SdTokenService":"./src/lib/token.service","IApiConfiguration":"./src/lib/api.model","API_CONFIG":"./src/lib/api.model","TOKEN":"./src/lib/api.model","SdApiService":"./src/lib/api.service","SdHttpService":"./src/lib/http.service","SdHttpInterceptor":"./src/lib/http.interceptor"},"importAs":"@sd-angular/core/api"}
|
|
@@ -4,8 +4,8 @@ export interface IApiConfiguration {
|
|
|
4
4
|
host?: string;
|
|
5
5
|
tokenHeader?: string;
|
|
6
6
|
customHeaders?: () => HttpHeaders;
|
|
7
|
-
beforeRemote?: (request: HttpRequest<any>) => void
|
|
8
|
-
afterRemote?: (response: HttpResponse<any> | HttpErrorResponse) => void
|
|
7
|
+
beforeRemote?: (request: HttpRequest<any>) => void | Promise<void>;
|
|
8
|
+
afterRemote?: (response: HttpResponse<any> | HttpErrorResponse) => void | Promise<void>;
|
|
9
9
|
translate?: (value: string) => string;
|
|
10
10
|
}
|
|
11
11
|
export declare const API_CONFIG: InjectionToken<IApiConfiguration>;
|
|
@@ -6,5 +6,5 @@ export declare class SdHttpInterceptor implements HttpInterceptor {
|
|
|
6
6
|
private configuration;
|
|
7
7
|
private tokenService;
|
|
8
8
|
constructor(configuration: IApiConfiguration, tokenService: SdTokenService);
|
|
9
|
-
intercept(request: HttpRequest<any>, next: HttpHandler)
|
|
9
|
+
intercept: (request: HttpRequest<any>, next: HttpHandler) => Observable<HttpEvent<any>>;
|
|
10
10
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Auto detect text files and perform LF normalization
|
|
2
|
+
* text=auto
|
|
3
|
+
|
|
4
|
+
# Custom for Visual Studio
|
|
5
|
+
*.cs diff=csharp
|
|
6
|
+
|
|
7
|
+
# Standard to msysgit
|
|
8
|
+
*.doc diff=astextplain
|
|
9
|
+
*.DOC diff=astextplain
|
|
10
|
+
*.docx diff=astextplain
|
|
11
|
+
*.DOCX diff=astextplain
|
|
12
|
+
*.dot diff=astextplain
|
|
13
|
+
*.DOT diff=astextplain
|
|
14
|
+
*.pdf diff=astextplain
|
|
15
|
+
*.PDF diff=astextplain
|
|
16
|
+
*.rtf diff=astextplain
|
|
17
|
+
*.RTF diff=astextplain
|
|
@@ -31,127 +31,6 @@
|
|
|
31
31
|
var hash__namespace = /*#__PURE__*/_interopNamespace(hash);
|
|
32
32
|
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
|
|
33
33
|
|
|
34
|
-
var API_CONFIG = new i0.InjectionToken('api.configuration');
|
|
35
|
-
var TOKEN = hash__default['default']({
|
|
36
|
-
origin: location.origin,
|
|
37
|
-
key: 'ed4a2ffc-af43-41fb-9ac9-970f43d99571'
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
var SdTokenService = /** @class */ (function () {
|
|
41
|
-
function SdTokenService(configuration, cacheService) {
|
|
42
|
-
var _this = this;
|
|
43
|
-
this.configuration = configuration;
|
|
44
|
-
this.cacheService = cacheService;
|
|
45
|
-
this.set = function (token) {
|
|
46
|
-
var set = _this.cacheService.create(TOKEN, {
|
|
47
|
-
type: 'local',
|
|
48
|
-
hours: 240
|
|
49
|
-
}).set;
|
|
50
|
-
set(token);
|
|
51
|
-
};
|
|
52
|
-
this.clear = function () {
|
|
53
|
-
var remove = _this.cacheService.create(TOKEN, {
|
|
54
|
-
type: 'local',
|
|
55
|
-
hours: 240
|
|
56
|
-
}).remove;
|
|
57
|
-
remove();
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
Object.defineProperty(SdTokenService.prototype, "token", {
|
|
61
|
-
get: function () {
|
|
62
|
-
var get = this.cacheService.create(TOKEN, {
|
|
63
|
-
type: 'local',
|
|
64
|
-
hours: 240
|
|
65
|
-
}).get;
|
|
66
|
-
return get();
|
|
67
|
-
},
|
|
68
|
-
enumerable: false,
|
|
69
|
-
configurable: true
|
|
70
|
-
});
|
|
71
|
-
Object.defineProperty(SdTokenService.prototype, "customHeaders", {
|
|
72
|
-
get: function () {
|
|
73
|
-
var _a, _b;
|
|
74
|
-
return ((_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.customHeaders) === null || _b === void 0 ? void 0 : _b.call(_a)) || null;
|
|
75
|
-
},
|
|
76
|
-
enumerable: false,
|
|
77
|
-
configurable: true
|
|
78
|
-
});
|
|
79
|
-
return SdTokenService;
|
|
80
|
-
}());
|
|
81
|
-
SdTokenService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SdTokenService_Factory() { return new SdTokenService(i0.ɵɵinject(API_CONFIG, 8), i0.ɵɵinject(i2.SdCacheService)); }, token: SdTokenService, providedIn: "root" });
|
|
82
|
-
SdTokenService.decorators = [
|
|
83
|
-
{ type: i0.Injectable, args: [{
|
|
84
|
-
providedIn: 'root'
|
|
85
|
-
},] }
|
|
86
|
-
];
|
|
87
|
-
SdTokenService.ctorParameters = function () { return [
|
|
88
|
-
{ type: undefined, decorators: [{ type: i0.Inject, args: [API_CONFIG,] }, { type: i0.Optional }] },
|
|
89
|
-
{ type: i2.SdCacheService }
|
|
90
|
-
]; };
|
|
91
|
-
|
|
92
|
-
var SdHttpInterceptor = /** @class */ (function () {
|
|
93
|
-
function SdHttpInterceptor(configuration, tokenService) {
|
|
94
|
-
this.configuration = configuration;
|
|
95
|
-
this.tokenService = tokenService;
|
|
96
|
-
}
|
|
97
|
-
SdHttpInterceptor.prototype.intercept = function (request, next) {
|
|
98
|
-
var _this = this;
|
|
99
|
-
var _a, _b, _c, _d;
|
|
100
|
-
if (((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.tokenHeader) && this.tokenService.token) {
|
|
101
|
-
request = request.clone({ headers: request.headers.set(this.configuration.tokenHeader, this.tokenService.token) });
|
|
102
|
-
}
|
|
103
|
-
if (!request.url.startsWith('http')) {
|
|
104
|
-
request = request.clone({
|
|
105
|
-
url: (((_b = this.configuration) === null || _b === void 0 ? void 0 : _b.host) || location.host) + request.url
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
if (request.body instanceof FormData) {
|
|
109
|
-
request = request.clone({
|
|
110
|
-
headers: request.headers.delete('Content-Type')
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
(_d = (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.beforeRemote) === null || _d === void 0 ? void 0 : _d.call(_c, request);
|
|
114
|
-
return next.handle(request).pipe(operators.map(function (event) {
|
|
115
|
-
var _a, _b;
|
|
116
|
-
if (event instanceof i1.HttpResponse) {
|
|
117
|
-
(_b = (_a = _this.configuration) === null || _a === void 0 ? void 0 : _a.afterRemote) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
118
|
-
}
|
|
119
|
-
return event;
|
|
120
|
-
}), operators.catchError(function (error) {
|
|
121
|
-
var _a, _b;
|
|
122
|
-
(_b = (_a = _this.configuration) === null || _a === void 0 ? void 0 : _a.afterRemote) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
123
|
-
return rxjs.throwError(error);
|
|
124
|
-
}));
|
|
125
|
-
};
|
|
126
|
-
return SdHttpInterceptor;
|
|
127
|
-
}());
|
|
128
|
-
SdHttpInterceptor.decorators = [
|
|
129
|
-
{ type: i0.Injectable }
|
|
130
|
-
];
|
|
131
|
-
SdHttpInterceptor.ctorParameters = function () { return [
|
|
132
|
-
{ type: undefined, decorators: [{ type: i0.Inject, args: [API_CONFIG,] }, { type: i0.Optional }] },
|
|
133
|
-
{ type: SdTokenService }
|
|
134
|
-
]; };
|
|
135
|
-
|
|
136
|
-
var SdApiModule = /** @class */ (function () {
|
|
137
|
-
function SdApiModule() {
|
|
138
|
-
}
|
|
139
|
-
return SdApiModule;
|
|
140
|
-
}());
|
|
141
|
-
SdApiModule.decorators = [
|
|
142
|
-
{ type: i0.NgModule, args: [{
|
|
143
|
-
imports: [
|
|
144
|
-
i1.HttpClientModule,
|
|
145
|
-
],
|
|
146
|
-
exports: [
|
|
147
|
-
i1.HttpClientModule
|
|
148
|
-
],
|
|
149
|
-
providers: [
|
|
150
|
-
{ provide: i1.HTTP_INTERCEPTORS, useClass: SdHttpInterceptor, multi: true }
|
|
151
|
-
],
|
|
152
|
-
},] }
|
|
153
|
-
];
|
|
154
|
-
|
|
155
34
|
/*! *****************************************************************************
|
|
156
35
|
Copyright (c) Microsoft Corporation.
|
|
157
36
|
|
|
@@ -453,6 +332,140 @@
|
|
|
453
332
|
return value;
|
|
454
333
|
}
|
|
455
334
|
|
|
335
|
+
var API_CONFIG = new i0.InjectionToken('api.configuration');
|
|
336
|
+
var TOKEN = hash__default['default']({
|
|
337
|
+
origin: location.origin,
|
|
338
|
+
key: 'ed4a2ffc-af43-41fb-9ac9-970f43d99571'
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
var SdTokenService = /** @class */ (function () {
|
|
342
|
+
function SdTokenService(configuration, cacheService) {
|
|
343
|
+
var _this = this;
|
|
344
|
+
this.configuration = configuration;
|
|
345
|
+
this.cacheService = cacheService;
|
|
346
|
+
this.set = function (token) {
|
|
347
|
+
var set = _this.cacheService.create(TOKEN, {
|
|
348
|
+
type: 'local',
|
|
349
|
+
hours: 240
|
|
350
|
+
}).set;
|
|
351
|
+
set(token);
|
|
352
|
+
};
|
|
353
|
+
this.clear = function () {
|
|
354
|
+
var remove = _this.cacheService.create(TOKEN, {
|
|
355
|
+
type: 'local',
|
|
356
|
+
hours: 240
|
|
357
|
+
}).remove;
|
|
358
|
+
remove();
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
Object.defineProperty(SdTokenService.prototype, "token", {
|
|
362
|
+
get: function () {
|
|
363
|
+
var get = this.cacheService.create(TOKEN, {
|
|
364
|
+
type: 'local',
|
|
365
|
+
hours: 240
|
|
366
|
+
}).get;
|
|
367
|
+
return get();
|
|
368
|
+
},
|
|
369
|
+
enumerable: false,
|
|
370
|
+
configurable: true
|
|
371
|
+
});
|
|
372
|
+
Object.defineProperty(SdTokenService.prototype, "customHeaders", {
|
|
373
|
+
get: function () {
|
|
374
|
+
var _a, _b;
|
|
375
|
+
return ((_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.customHeaders) === null || _b === void 0 ? void 0 : _b.call(_a)) || null;
|
|
376
|
+
},
|
|
377
|
+
enumerable: false,
|
|
378
|
+
configurable: true
|
|
379
|
+
});
|
|
380
|
+
return SdTokenService;
|
|
381
|
+
}());
|
|
382
|
+
SdTokenService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SdTokenService_Factory() { return new SdTokenService(i0.ɵɵinject(API_CONFIG, 8), i0.ɵɵinject(i2.SdCacheService)); }, token: SdTokenService, providedIn: "root" });
|
|
383
|
+
SdTokenService.decorators = [
|
|
384
|
+
{ type: i0.Injectable, args: [{
|
|
385
|
+
providedIn: 'root'
|
|
386
|
+
},] }
|
|
387
|
+
];
|
|
388
|
+
SdTokenService.ctorParameters = function () { return [
|
|
389
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [API_CONFIG,] }, { type: i0.Optional }] },
|
|
390
|
+
{ type: i2.SdCacheService }
|
|
391
|
+
]; };
|
|
392
|
+
|
|
393
|
+
var SdHttpInterceptor = /** @class */ (function () {
|
|
394
|
+
function SdHttpInterceptor(configuration, tokenService) {
|
|
395
|
+
var _this = this;
|
|
396
|
+
this.configuration = configuration;
|
|
397
|
+
this.tokenService = tokenService;
|
|
398
|
+
this.intercept = function (request, next) {
|
|
399
|
+
var _a, _b;
|
|
400
|
+
if (((_a = _this.configuration) === null || _a === void 0 ? void 0 : _a.tokenHeader) && _this.tokenService.token) {
|
|
401
|
+
request = request.clone({ headers: request.headers.set(_this.configuration.tokenHeader, _this.tokenService.token) });
|
|
402
|
+
}
|
|
403
|
+
if (!request.url.startsWith('http')) {
|
|
404
|
+
request = request.clone({
|
|
405
|
+
url: (((_b = _this.configuration) === null || _b === void 0 ? void 0 : _b.host) || location.host) + request.url
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
if (request.body instanceof FormData) {
|
|
409
|
+
request = request.clone({
|
|
410
|
+
headers: request.headers.delete('Content-Type')
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
return rxjs.of(request).pipe(operators.switchMap(function (req) { return __awaiter(_this, void 0, void 0, function () {
|
|
414
|
+
var _c, _d, beforeRemote;
|
|
415
|
+
return __generator(this, function (_e) {
|
|
416
|
+
switch (_e.label) {
|
|
417
|
+
case 0:
|
|
418
|
+
beforeRemote = (_d = (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.beforeRemote) === null || _d === void 0 ? void 0 : _d.call(_c, req);
|
|
419
|
+
if (!(beforeRemote instanceof Promise)) return [3 /*break*/, 2];
|
|
420
|
+
return [4 /*yield*/, beforeRemote];
|
|
421
|
+
case 1:
|
|
422
|
+
_e.sent();
|
|
423
|
+
_e.label = 2;
|
|
424
|
+
case 2: return [2 /*return*/, req];
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}); }), operators.switchMap(next.handle)).pipe(operators.map(function (event) {
|
|
428
|
+
var _a, _b;
|
|
429
|
+
if (event instanceof i1.HttpResponse) {
|
|
430
|
+
(_b = (_a = _this.configuration) === null || _a === void 0 ? void 0 : _a.afterRemote) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
431
|
+
}
|
|
432
|
+
return event;
|
|
433
|
+
}), operators.catchError(function (error) {
|
|
434
|
+
var _a, _b;
|
|
435
|
+
(_b = (_a = _this.configuration) === null || _a === void 0 ? void 0 : _a.afterRemote) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
436
|
+
return rxjs.throwError(error);
|
|
437
|
+
}));
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
return SdHttpInterceptor;
|
|
441
|
+
}());
|
|
442
|
+
SdHttpInterceptor.decorators = [
|
|
443
|
+
{ type: i0.Injectable }
|
|
444
|
+
];
|
|
445
|
+
SdHttpInterceptor.ctorParameters = function () { return [
|
|
446
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [API_CONFIG,] }, { type: i0.Optional }] },
|
|
447
|
+
{ type: SdTokenService }
|
|
448
|
+
]; };
|
|
449
|
+
|
|
450
|
+
var SdApiModule = /** @class */ (function () {
|
|
451
|
+
function SdApiModule() {
|
|
452
|
+
}
|
|
453
|
+
return SdApiModule;
|
|
454
|
+
}());
|
|
455
|
+
SdApiModule.decorators = [
|
|
456
|
+
{ type: i0.NgModule, args: [{
|
|
457
|
+
imports: [
|
|
458
|
+
i1.HttpClientModule,
|
|
459
|
+
],
|
|
460
|
+
exports: [
|
|
461
|
+
i1.HttpClientModule
|
|
462
|
+
],
|
|
463
|
+
providers: [
|
|
464
|
+
{ provide: i1.HTTP_INTERCEPTORS, useClass: SdHttpInterceptor, multi: true }
|
|
465
|
+
],
|
|
466
|
+
},] }
|
|
467
|
+
];
|
|
468
|
+
|
|
456
469
|
var _timeout, _cacheDuration, _cache, _defineParams;
|
|
457
470
|
var SdApiService = /** @class */ (function () {
|
|
458
471
|
function SdApiService(httpClient, configuration, cacheService, tokenService) {
|