@eurosat/http 10.0.0 → 14.0.1
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/esm2020/eurosat-http.mjs +5 -0
- package/esm2020/lib/http.component.mjs +22 -0
- package/esm2020/lib/http.module.mjs +26 -0
- package/esm2020/lib/http.service.mjs +144 -0
- package/esm2020/public_api.mjs +7 -0
- package/fesm2015/{eurosat-http.js → eurosat-http.mjs} +184 -278
- package/fesm2015/eurosat-http.mjs.map +1 -0
- package/fesm2020/eurosat-http.mjs +196 -0
- package/fesm2020/eurosat-http.mjs.map +1 -0
- package/{eurosat-http.d.ts → index.d.ts} +5 -4
- package/lib/http.component.d.ts +8 -5
- package/lib/http.module.d.ts +8 -2
- package/lib/http.service.d.ts +36 -33
- package/package.json +24 -12
- package/public_api.d.ts +3 -3
- package/bundles/eurosat-http.umd.js +0 -297
- package/bundles/eurosat-http.umd.js.map +0 -1
- package/bundles/eurosat-http.umd.min.js +0 -2
- package/bundles/eurosat-http.umd.min.js.map +0 -1
- package/esm2015/eurosat-http.js +0 -10
- package/esm2015/lib/http.component.js +0 -27
- package/esm2015/lib/http.module.js +0 -24
- package/esm2015/lib/http.service.js +0 -232
- package/esm2015/public_api.js +0 -12
- package/eurosat-http.metadata.json +0 -1
- package/fesm2015/eurosat-http.js.map +0 -1
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('@angular/material/snack-bar'), require('rxjs'), require('rxjs/operators')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@eurosat/http', ['exports', '@angular/core', '@angular/common/http', '@angular/material/snack-bar', 'rxjs', 'rxjs/operators'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.eurosat = global.eurosat || {}, global.eurosat.http = {}), global.ng.core, global.ng.common.http, global.ng.material.snackBar, global.rxjs, global.rxjs.operators));
|
|
5
|
-
}(this, (function (exports, i0, i1, i2, rxjs, operators) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @fileoverview added by tsickle
|
|
9
|
-
* Generated from: lib/http.service.ts
|
|
10
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
11
|
-
*/
|
|
12
|
-
// @dynamic --> NEMAZAT https://github.com/dherges/ng-packagr/issues/641
|
|
13
|
-
var HttpService = /** @class */ (function () {
|
|
14
|
-
// není to prasárna?
|
|
15
|
-
/**
|
|
16
|
-
* @param {?} http
|
|
17
|
-
* @param {?} snackBar
|
|
18
|
-
*/
|
|
19
|
-
function HttpService(http, snackBar) {
|
|
20
|
-
this.http = http;
|
|
21
|
-
this.snackBar = snackBar;
|
|
22
|
-
if (!HttpService.instance) { // není to prasárna?
|
|
23
|
-
HttpService.instance = this;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @param {?} error
|
|
28
|
-
* @return {?}
|
|
29
|
-
*/
|
|
30
|
-
HttpService.handleError = function (error) {
|
|
31
|
-
HttpService.errorStatus(error);
|
|
32
|
-
// Todo: In a real world app, you might use a remote logging infrastructure
|
|
33
|
-
/** @type {?} */
|
|
34
|
-
var errMsg;
|
|
35
|
-
if (error instanceof i1.HttpResponse) {
|
|
36
|
-
/** @type {?} */
|
|
37
|
-
var body = error.body || '';
|
|
38
|
-
/** @type {?} */
|
|
39
|
-
var err = body.error || JSON.stringify(body);
|
|
40
|
-
errMsg = error.status + " - " + (error.statusText || '') + " " + err;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
errMsg = error.message ? error.message : error.toString();
|
|
44
|
-
}
|
|
45
|
-
console.error(errMsg);
|
|
46
|
-
return rxjs.throwError(errMsg);
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* @private
|
|
50
|
-
* @param {?} err
|
|
51
|
-
* @return {?}
|
|
52
|
-
*/
|
|
53
|
-
HttpService.errorStatus = function (err) {
|
|
54
|
-
switch (err.status) {
|
|
55
|
-
case 300:
|
|
56
|
-
case 301:
|
|
57
|
-
HttpService.handleRedirect(err);
|
|
58
|
-
break;
|
|
59
|
-
// case 302:
|
|
60
|
-
// HttpService.handleRedirect(err);
|
|
61
|
-
// break;
|
|
62
|
-
case 403:
|
|
63
|
-
HttpService.handleErrorMessage(err);
|
|
64
|
-
break;
|
|
65
|
-
case 503:
|
|
66
|
-
HttpService.handleErrorMessage(err);
|
|
67
|
-
break;
|
|
68
|
-
case 601:
|
|
69
|
-
HttpService.handleRedirect(err);
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
// todo 413 Request Entity Too Large - upload file z formu
|
|
73
|
-
};
|
|
74
|
-
// private static handleLoginRedirect(res: HttpResponse<any>) {
|
|
75
|
-
// const error = res['error'];
|
|
76
|
-
//
|
|
77
|
-
// }
|
|
78
|
-
/**
|
|
79
|
-
* @private
|
|
80
|
-
* @param {?} res
|
|
81
|
-
* @return {?}
|
|
82
|
-
*/
|
|
83
|
-
HttpService.handleRedirect = function (res) {
|
|
84
|
-
/** @type {?} */
|
|
85
|
-
var error = res['error'];
|
|
86
|
-
if (error.login) {
|
|
87
|
-
/** @type {?} */
|
|
88
|
-
var path = window.location.pathname;
|
|
89
|
-
path = path[0] === '/' ? path.substr(1) : path; // '/front/' => 'front/'
|
|
90
|
-
// console.log('Redirect ' + `${error.url}?r=${path}`);
|
|
91
|
-
window.location.href = error.url + "?r=" + path;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
window.location.href = "" + error.url;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* @private
|
|
99
|
-
* @param {?} res
|
|
100
|
-
* @return {?}
|
|
101
|
-
*/
|
|
102
|
-
HttpService.handleErrorMessage = function (res) {
|
|
103
|
-
/** @type {?} */
|
|
104
|
-
var message = res['error'];
|
|
105
|
-
if (res['error'] instanceof Blob) {
|
|
106
|
-
/** @type {?} */
|
|
107
|
-
var reader = new FileReader();
|
|
108
|
-
reader.addEventListener('loadend', ( /**
|
|
109
|
-
* @param {?} e
|
|
110
|
-
* @return {?}
|
|
111
|
-
*/function (e) {
|
|
112
|
-
HttpService.createSnackBar(e.srcElement['result']);
|
|
113
|
-
}));
|
|
114
|
-
reader.readAsText(res['error']);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
HttpService.createSnackBar(message);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* @private
|
|
122
|
-
* @param {?} message
|
|
123
|
-
* @return {?}
|
|
124
|
-
*/
|
|
125
|
-
HttpService.createSnackBar = function (message) {
|
|
126
|
-
/** @type {?} */
|
|
127
|
-
var config = new i2.MatSnackBarConfig();
|
|
128
|
-
config.duration = 2000;
|
|
129
|
-
config.panelClass = 'es-snackbar-alert-danger'; // AppSnackbarPanelClass.DANGER;
|
|
130
|
-
HttpService.instance.snackBar.open(message, null, config);
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* @param {?} url
|
|
134
|
-
* @param {?=} options
|
|
135
|
-
* @return {?}
|
|
136
|
-
*/
|
|
137
|
-
HttpService.prototype.get = function (url, options) {
|
|
138
|
-
if (!options) {
|
|
139
|
-
options = {};
|
|
140
|
-
}
|
|
141
|
-
if (!options.params) {
|
|
142
|
-
options.params = new i1.HttpParams();
|
|
143
|
-
}
|
|
144
|
-
options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST); // pridava se nejakej param na formy pro angular
|
|
145
|
-
return this.http.get(url, options)
|
|
146
|
-
.pipe(operators.catchError(HttpService.handleError));
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* @param {?} url
|
|
150
|
-
* @param {?} body
|
|
151
|
-
* @param {?=} options
|
|
152
|
-
* @return {?}
|
|
153
|
-
*/
|
|
154
|
-
HttpService.prototype.post = function (url, body, options) {
|
|
155
|
-
if (!options) {
|
|
156
|
-
options = {};
|
|
157
|
-
}
|
|
158
|
-
if (!options.params) {
|
|
159
|
-
options.params = new i1.HttpParams();
|
|
160
|
-
}
|
|
161
|
-
options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);
|
|
162
|
-
return this.http.post(url, body, options)
|
|
163
|
-
.pipe(operators.catchError(HttpService.handleError));
|
|
164
|
-
};
|
|
165
|
-
// upload file s vypnutym service workerem -> header{disable-ngsw: true}
|
|
166
|
-
// v ekj projektu fix-ngsw.sh
|
|
167
|
-
// sed -i '/onFetch(event) {/,/const req = event.request;/c onFetch(event){const req=event.request;if(req.headers.get('disable-ngsw')==="true")return;' ./front/ngsw-worker.js
|
|
168
|
-
/**
|
|
169
|
-
* @param {?} url
|
|
170
|
-
* @param {?} body
|
|
171
|
-
* @param {?=} options
|
|
172
|
-
* @return {?}
|
|
173
|
-
*/
|
|
174
|
-
HttpService.prototype.postFiles = function (url, body, options) {
|
|
175
|
-
if (!options) {
|
|
176
|
-
options = {};
|
|
177
|
-
}
|
|
178
|
-
if (!options.params) {
|
|
179
|
-
options.params = new i1.HttpParams();
|
|
180
|
-
}
|
|
181
|
-
options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);
|
|
182
|
-
/** @type {?} */
|
|
183
|
-
var headers = new i1.HttpHeaders();
|
|
184
|
-
options['headers'] = headers.set('disable-ngsw', 'true');
|
|
185
|
-
return this.http.post(url, body, options)
|
|
186
|
-
.pipe(operators.catchError(HttpService.handleError));
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* @param {?} url
|
|
190
|
-
* @param {?=} options
|
|
191
|
-
* @return {?}
|
|
192
|
-
*/
|
|
193
|
-
HttpService.prototype.delete = function (url, options) {
|
|
194
|
-
return this.http.delete(url, options)
|
|
195
|
-
.pipe(operators.catchError(HttpService.handleError));
|
|
196
|
-
};
|
|
197
|
-
return HttpService;
|
|
198
|
-
}());
|
|
199
|
-
HttpService.ANGULAR_REQUEST_CONST = '2';
|
|
200
|
-
HttpService.decorators = [
|
|
201
|
-
{ type: i0.Injectable, args: [{
|
|
202
|
-
providedIn: 'root'
|
|
203
|
-
},] }
|
|
204
|
-
];
|
|
205
|
-
/** @nocollapse */
|
|
206
|
-
HttpService.ctorParameters = function () { return [
|
|
207
|
-
{ type: i1.HttpClient },
|
|
208
|
-
{ type: i2.MatSnackBar }
|
|
209
|
-
]; };
|
|
210
|
-
/** @nocollapse */ HttpService.ɵprov = i0.ɵɵdefineInjectable({ factory: function HttpService_Factory() { return new HttpService(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(i2.MatSnackBar)); }, token: HttpService, providedIn: "root" });
|
|
211
|
-
if (false) {
|
|
212
|
-
/** @type {?} */
|
|
213
|
-
HttpService.ANGULAR_REQUEST_CONST;
|
|
214
|
-
/**
|
|
215
|
-
* @type {?}
|
|
216
|
-
* @private
|
|
217
|
-
*/
|
|
218
|
-
HttpService.instance;
|
|
219
|
-
/**
|
|
220
|
-
* @type {?}
|
|
221
|
-
* @private
|
|
222
|
-
*/
|
|
223
|
-
HttpService.prototype.http;
|
|
224
|
-
/**
|
|
225
|
-
* @type {?}
|
|
226
|
-
* @private
|
|
227
|
-
*/
|
|
228
|
-
HttpService.prototype.snackBar;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* @fileoverview added by tsickle
|
|
233
|
-
* Generated from: lib/http.component.ts
|
|
234
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
235
|
-
*/
|
|
236
|
-
var HttpComponent = /** @class */ (function () {
|
|
237
|
-
function HttpComponent() {
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* @return {?}
|
|
241
|
-
*/
|
|
242
|
-
HttpComponent.prototype.ngOnInit = function () {
|
|
243
|
-
};
|
|
244
|
-
return HttpComponent;
|
|
245
|
-
}());
|
|
246
|
-
HttpComponent.decorators = [
|
|
247
|
-
{ type: i0.Component, args: [{
|
|
248
|
-
selector: 'es-http',
|
|
249
|
-
template: "\n <p>\n http works!\n </p>\n "
|
|
250
|
-
}] }
|
|
251
|
-
];
|
|
252
|
-
/** @nocollapse */
|
|
253
|
-
HttpComponent.ctorParameters = function () { return []; };
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* @fileoverview added by tsickle
|
|
257
|
-
* Generated from: lib/http.module.ts
|
|
258
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
259
|
-
*/
|
|
260
|
-
var HttpModule = /** @class */ (function () {
|
|
261
|
-
function HttpModule() {
|
|
262
|
-
}
|
|
263
|
-
return HttpModule;
|
|
264
|
-
}());
|
|
265
|
-
HttpModule.decorators = [
|
|
266
|
-
{ type: i0.NgModule, args: [{
|
|
267
|
-
imports: [
|
|
268
|
-
i1.HttpClientModule
|
|
269
|
-
],
|
|
270
|
-
declarations: [HttpComponent],
|
|
271
|
-
providers: [
|
|
272
|
-
HttpService
|
|
273
|
-
],
|
|
274
|
-
exports: [],
|
|
275
|
-
},] }
|
|
276
|
-
];
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* @fileoverview added by tsickle
|
|
280
|
-
* Generated from: public_api.ts
|
|
281
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
282
|
-
*/
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* @fileoverview added by tsickle
|
|
286
|
-
* Generated from: eurosat-http.ts
|
|
287
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
288
|
-
*/
|
|
289
|
-
|
|
290
|
-
exports.HttpComponent = HttpComponent;
|
|
291
|
-
exports.HttpModule = HttpModule;
|
|
292
|
-
exports.HttpService = HttpService;
|
|
293
|
-
|
|
294
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
295
|
-
|
|
296
|
-
})));
|
|
297
|
-
//# sourceMappingURL=eurosat-http.umd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eurosat-http.umd.js","sources":["../../../projects/http/src/lib/http.service.ts","../../../projects/http/src/lib/http.component.ts","../../../projects/http/src/lib/http.module.ts"],"sourcesContent":["import {Injectable} from '@angular/core';\r\nimport {HttpClient, HttpHeaders, HttpParams, HttpResponse} from '@angular/common/http';\r\nimport {MatSnackBar, MatSnackBarConfig} from '@angular/material/snack-bar';\r\nimport {Observable, throwError} from 'rxjs';\r\nimport {catchError} from 'rxjs/operators';\r\n// @dynamic --> NEMAZAT https://github.com/dherges/ng-packagr/issues/641\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class HttpService {\r\n\r\n public static ANGULAR_REQUEST_CONST = '2';\r\n\r\n private static instance: HttpService; // není to prasárna?\r\n\r\n constructor(\r\n private http: HttpClient,\r\n private snackBar: MatSnackBar,\r\n ) {\r\n if (!HttpService.instance) { // není to prasárna?\r\n HttpService.instance = this;\r\n }\r\n }\r\n\r\n public static handleError (error: HttpResponse<any> | any) {\r\n HttpService.errorStatus(error);\r\n\r\n // Todo: In a real world app, you might use a remote logging infrastructure\r\n let errMsg: string;\r\n if (error instanceof HttpResponse) {\r\n const body = error.body || '';\r\n const err = body.error || JSON.stringify(body);\r\n errMsg = `${error.status} - ${error.statusText || ''} ${err}`;\r\n } else {\r\n errMsg = error.message ? error.message : error.toString();\r\n }\r\n console.error(errMsg);\r\n return throwError(errMsg);\r\n }\r\n\r\n private static errorStatus(err: HttpResponse<any>) {\r\n switch (err.status) {\r\n case 300:\r\n case 301:\r\n HttpService.handleRedirect(err);\r\n break;\r\n // case 302:\r\n // HttpService.handleRedirect(err);\r\n // break;\r\n case 403:\r\n HttpService.handleErrorMessage(err);\r\n break;\r\n case 503:\r\n HttpService.handleErrorMessage(err);\r\n break;\r\n case 601:\r\n HttpService.handleRedirect(err);\r\n break;\r\n }\r\n\r\n // todo 413 Request Entity Too Large - upload file z formu\r\n }\r\n\r\n // private static handleLoginRedirect(res: HttpResponse<any>) {\r\n // const error = res['error'];\r\n //\r\n // }\r\n\r\n private static handleRedirect(res: HttpResponse<any>) {\r\n const error = res['error'];\r\n if (error.login) {\r\n let path = window.location.pathname;\r\n path = path[0] === '/' ? path.substr(1) : path; // '/front/' => 'front/'\r\n // console.log('Redirect ' + `${error.url}?r=${path}`);\r\n window.location.href = `${error.url}?r=${path}`;\r\n } else {\r\n window.location.href = `${error.url}`;\r\n }\r\n }\r\n\r\n private static handleErrorMessage(res: HttpResponse<any>) {\r\n const message = res['error'];\r\n if (res['error'] instanceof Blob) {\r\n const reader = new FileReader();\r\n\r\n reader.addEventListener('loadend', (e) => {\r\n HttpService.createSnackBar(e.srcElement['result']);\r\n });\r\n\r\n reader.readAsText(res['error']);\r\n } else {\r\n HttpService.createSnackBar(message);\r\n }\r\n }\r\n\r\n private static createSnackBar(message) {\r\n const config = new MatSnackBarConfig();\r\n config.duration = 2000;\r\n config.panelClass = 'es-snackbar-alert-danger'; // AppSnackbarPanelClass.DANGER;\r\n HttpService.instance.snackBar.open(message, null, config);\r\n }\r\n\r\n get(url: string, options?: {params?: HttpParams, responseType?, observe?}): Observable<any> {\r\n if (!options) { options = {}; }\r\n if (!options.params) {\r\n options.params = new HttpParams();\r\n }\r\n options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST); // pridava se nejakej param na formy pro angular\r\n return this.http.get(url, options)\r\n .pipe(catchError(HttpService.handleError));\r\n }\r\n\r\n post(url: string, body: any | null, options?: {params?: HttpParams, responseType?, reportProgress?: boolean, observe?: any}): Observable<any> {\r\n if (!options) { options = {}; }\r\n if (!options.params) {\r\n options.params = new HttpParams();\r\n }\r\n options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);\r\n\r\n return this.http.post(url, body, options)\r\n .pipe(catchError(HttpService.handleError));\r\n }\r\n\r\n // upload file s vypnutym service workerem -> header{disable-ngsw: true}\r\n // v ekj projektu fix-ngsw.sh\r\n // sed -i '/onFetch(event) {/,/const req = event.request;/c onFetch(event){const req=event.request;if(req.headers.get('disable-ngsw')===\"true\")return;' ./front/ngsw-worker.js\r\n postFiles(url: string, body: any | null, options?: {params?: HttpParams, responseType?, reportProgress?: boolean, observe?: any}): Observable<any> {\r\n if (!options) { options = {}; }\r\n if (!options.params) {\r\n options.params = new HttpParams();\r\n }\r\n options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);\r\n const headers = new HttpHeaders();\r\n options['headers'] = headers.set('disable-ngsw', 'true');\r\n return this.http.post(url, body, options)\r\n .pipe(catchError(HttpService.handleError));\r\n }\r\n\r\n delete(url: string, options?: {}): Observable<Object> {\r\n return this.http.delete(url, options)\r\n .pipe(catchError(HttpService.handleError));\r\n }\r\n\r\n\r\n // private extractMsgpack(res: Response) {\r\n //\r\n // let buffer = res.arrayBuffer();\r\n // // console.log(buffer);\r\n //\r\n // let array = new Uint8Array(buffer);\r\n // // console.log(array);\r\n // // console.log('Decode ' + msgpack.decode(array));\r\n //\r\n // return msgpack.decode(array);\r\n // }\r\n\r\n\r\n\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'es-http',\r\n template: `\r\n <p>\r\n http works!\r\n </p>\r\n `,\r\n styles: []\r\n})\r\nexport class HttpComponent implements OnInit {\r\n\r\n constructor() { }\r\n\r\n ngOnInit() {\r\n }\r\n\r\n}\r\n","import {NgModule} from '@angular/core';\r\nimport {HttpComponent} from './http.component';\r\nimport {HttpClientModule} from '@angular/common/http';\r\nimport {HttpService} from './http.service';\r\n\r\n@NgModule({\r\n imports: [\r\n HttpClientModule\r\n ],\r\n declarations: [HttpComponent],\r\n providers: [\r\n HttpService\r\n ],\r\n exports: [],\r\n})\r\nexport class HttpModule { }\r\n"],"names":["HttpResponse","throwError","MatSnackBarConfig","HttpParams","catchError","HttpHeaders","Injectable","HttpClient","MatSnackBar","Component","NgModule","HttpClientModule"],"mappings":";;;;;;;;;;;;;;;;;;QAeI,qBACY,IAAgB,EAChB,QAAqB;YADrB,SAAI,GAAJ,IAAI,CAAY;YAChB,aAAQ,GAAR,QAAQ,CAAa;YAE7B,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;gBACvB,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC;aAC/B;SACJ;;;;;QAEa,uBAAW,GAAlB,UAAoB,KAA8B;YACrD,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;;;gBAG3B,MAAc;YAClB,IAAI,KAAK,YAAYA,eAAY,EAAE;;oBACzB,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE;;oBACvB,GAAG,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAC9C,MAAM,GAAM,KAAK,CAAC,MAAM,YAAM,KAAK,CAAC,UAAU,IAAI,EAAE,UAAI,GAAK,CAAC;aACjE;iBAAM;gBACH,MAAM,GAAG,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;aAC7D;YACD,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACtB,OAAOC,eAAU,CAAC,MAAM,CAAC,CAAC;SAC7B;;;;;;QAEc,uBAAW,GAAlB,UAAmB,GAAsB;YAC7C,QAAQ,GAAG,CAAC,MAAM;gBACd,KAAK,GAAG,CAAC;gBACT,KAAK,GAAG;oBACJ,WAAW,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;oBAChC,MAAM;;;;gBAIV,KAAK,GAAG;oBACJ,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;oBACpC,MAAM;gBACV,KAAK,GAAG;oBACJ,WAAW,CAAC,kBAAkB,CAAC,G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AO,EAAE,EAAE;iBACd;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common/http"),require("@angular/material/snack-bar"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@eurosat/http",["exports","@angular/core","@angular/common/http","@angular/material/snack-bar","rxjs","rxjs/operators"],e):e(((r="undefined"!=typeof globalThis?globalThis:r||self).eurosat=r.eurosat||{},r.eurosat.http={}),r.ng.core,r.ng.common.http,r.ng.material.snackBar,r.rxjs,r.rxjs.operators)}(this,(function(r,e,t,a,n,o){"use strict";var s=function(){function r(e,t){this.http=e,this.snackBar=t,r.instance||(r.instance=this)}return r.handleError=function(e){var a;if(r.errorStatus(e),e instanceof t.HttpResponse){var o=e.body||"",s=o.error||JSON.stringify(o);a=e.status+" - "+(e.statusText||"")+" "+s}else a=e.message?e.message:e.toString();return console.error(a),n.throwError(a)},r.errorStatus=function(e){switch(e.status){case 300:case 301:r.handleRedirect(e);break;case 403:case 503:r.handleErrorMessage(e);break;case 601:r.handleRedirect(e)}},r.handleRedirect=function(r){var e=r.error;if(e.login){var t=window.location.pathname;t="/"===t[0]?t.substr(1):t,window.location.href=e.url+"?r="+t}else window.location.href=""+e.url},r.handleErrorMessage=function(e){var t=e.error;if(e.error instanceof Blob){var a=new FileReader;a.addEventListener("loadend",(function(e){r.createSnackBar(e.srcElement.result)})),a.readAsText(e.error)}else r.createSnackBar(t)},r.createSnackBar=function(e){var t=new a.MatSnackBarConfig;t.duration=2e3,t.panelClass="es-snackbar-alert-danger",r.instance.snackBar.open(e,null,t)},r.prototype.get=function(e,a){return a||(a={}),a.params||(a.params=new t.HttpParams),a.params=a.params.set("_req_s",r.ANGULAR_REQUEST_CONST),this.http.get(e,a).pipe(o.catchError(r.handleError))},r.prototype.post=function(e,a,n){return n||(n={}),n.params||(n.params=new t.HttpParams),n.params=n.params.set("_req_s",r.ANGULAR_REQUEST_CONST),this.http.post(e,a,n).pipe(o.catchError(r.handleError))},r.prototype.postFiles=function(e,a,n){n||(n={}),n.params||(n.params=new t.HttpParams),n.params=n.params.set("_req_s",r.ANGULAR_REQUEST_CONST);var s=new t.HttpHeaders;return n.headers=s.set("disable-ngsw","true"),this.http.post(e,a,n).pipe(o.catchError(r.handleError))},r.prototype.delete=function(e,t){return this.http.delete(e,t).pipe(o.catchError(r.handleError))},r}();s.ANGULAR_REQUEST_CONST="2",s.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],s.ctorParameters=function(){return[{type:t.HttpClient},{type:a.MatSnackBar}]},s.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new s(e.ɵɵinject(t.HttpClient),e.ɵɵinject(a.MatSnackBar))},token:s,providedIn:"root"});var i=function(){function r(){}return r.prototype.ngOnInit=function(){},r}();i.decorators=[{type:e.Component,args:[{selector:"es-http",template:"\n <p>\n http works!\n </p>\n "}]}],i.ctorParameters=function(){return[]};var p=function(){};p.decorators=[{type:e.NgModule,args:[{imports:[t.HttpClientModule],declarations:[i],providers:[s],exports:[]}]}],r.HttpComponent=i,r.HttpModule=p,r.HttpService=s,Object.defineProperty(r,"__esModule",{value:!0})}));
|
|
2
|
-
//# sourceMappingURL=eurosat-http.umd.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/http/src/lib/http.service.ts","../../../projects/http/src/lib/http.component.ts","../../../projects/http/src/lib/http.module.ts"],"names":["HttpService","http","snackBar","this","instance","handleError","error","errMsg","errorStatus","HttpResponse","body","err","JSON","stringify","status","statusText","message","toString","console","throwError","handleRedirect","handleErrorMessage","res","login","path","window","location","pathname","substr","href","url","Blob","reader","FileReader","addEventListener","e","createSnackBar","srcElement","readAsText","config","MatSnackBarConfig","duration","panelClass","open","prototype","get","options","params","HttpParams","set","ANGULAR_REQUEST_CONST","pipe","catchError","post","postFiles","headers","HttpHeaders","delete","Injectable","args","providedIn","HttpClient","MatSnackBar","HttpComponent","ngOnInit","Component","selector","template","NgModule","imports","HttpClientModule","declarations","providers","exports"],"mappings":"0mBAeI,SAAAA,EACYC,EACAC,GADAC,KAAAF,KAAAA,EACAE,KAAAD,SAAAA,EAEHF,EAAYI,WACbJ,EAAYI,SAAWD,aAIjBH,EAAAK,YAAP,SAAoBC,OAInBC,EACJ,GAJAP,EAAYQ,YAAYF,GAIpBA,aAAiBG,EAAAA,aAAc,KACzBC,EAAOJ,EAAMI,MAAQ,GACrBC,EAAMD,EAAKJ,OAASM,KAAKC,UAAUH,GACzCH,EAAYD,EAAMQ,OAAM,OAAMR,EAAMS,YAAc,IAAE,IAAIJ,OAExDJ,EAASD,EAAMU,QAAUV,EAAMU,QAAUV,EAAMW,WAGnD,OADAC,QAAQZ,MAAMC,GACPY,EAAAA,WAAWZ,IAGPP,EAAAQ,YAAP,SAAmBG,GACvB,OAAQA,EAAIG,QACR,KAAK,IACL,KAAK,IACDd,EAAYoB,eAAeT,GAC3B,MAIJ,KAAK,IAGL,KAAK,IACDX,EAAYqB,mBAAmBV,GAC/B,MACJ,KAAK,IACDX,EAAYoB,eAAeT,KAYxBX,EAAAoB,eAAP,SAAsBE,OACpBhB,EAAQgB,EAAW,MACzB,GAAIhB,EAAMiB,MAAO,KACTC,EAAOC,OAAOC,SAASC,SAC3BH,EAAmB,MAAZA,EAAK,GAAaA,EAAKI,OAAO,GAAKJ,EAE1CC,OAAOC,SAASG,KAAUvB,EAAMwB,IAAG,MAAMN,OAEzCC,OAAOC,SAASG,KAAO,GAAGvB,EAAMwB,KAIzB9B,EAAAqB,mBAAP,SAA0BC,OACxBN,EAAUM,EAAW,MAC3B,GAAIA,EAAW,iBAAaS,KAAM,KACxBC,EAAS,IAAIC,WAEnBD,EAAOE,iBAAiB,WAAS,SAAGC,GAChCnC,EAAYoC,eAAeD,EAAEE,WAAmB,WAGpDL,EAAOM,WAAWhB,EAAW,YAE7BtB,EAAYoC,eAAepB,IAIpB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RC,WAAY,oDANRC,EAAAA,kBACAC,EAAAA,+KCWN,SAAAC,YAEAA,EAAAnB,UAAAoB,SAAA,sCAbDC,EAAAA,UAASN,KAAA,CAAC,CACTO,SAAU,UACVC,SAAU,6FCWZ,iCAVCC,EAAAA,SAAQT,KAAA,CAAC,CACNU,QAAS,CACLC,EAAAA,kBAEJC,aAAc,CAACR,GACfS,UAAW,CACPxE,GAEJyE,QAAS","sourcesContent":["import {Injectable} from '@angular/core';\r\nimport {HttpClient, HttpHeaders, HttpParams, HttpResponse} from '@angular/common/http';\r\nimport {MatSnackBar, MatSnackBarConfig} from '@angular/material/snack-bar';\r\nimport {Observable, throwError} from 'rxjs';\r\nimport {catchError} from 'rxjs/operators';\r\n// @dynamic --> NEMAZAT https://github.com/dherges/ng-packagr/issues/641\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class HttpService {\r\n\r\n public static ANGULAR_REQUEST_CONST = '2';\r\n\r\n private static instance: HttpService; // není to prasárna?\r\n\r\n constructor(\r\n private http: HttpClient,\r\n private snackBar: MatSnackBar,\r\n ) {\r\n if (!HttpService.instance) { // není to prasárna?\r\n HttpService.instance = this;\r\n }\r\n }\r\n\r\n public static handleError (error: HttpResponse<any> | any) {\r\n HttpService.errorStatus(error);\r\n\r\n // Todo: In a real world app, you might use a remote logging infrastructure\r\n let errMsg: string;\r\n if (error instanceof HttpResponse) {\r\n const body = error.body || '';\r\n const err = body.error || JSON.stringify(body);\r\n errMsg = `${error.status} - ${error.statusText || ''} ${err}`;\r\n } else {\r\n errMsg = error.message ? error.message : error.toString();\r\n }\r\n console.error(errMsg);\r\n return throwError(errMsg);\r\n }\r\n\r\n private static errorStatus(err: HttpResponse<any>) {\r\n switch (err.status) {\r\n case 300:\r\n case 301:\r\n HttpService.handleRedirect(err);\r\n break;\r\n // case 302:\r\n // HttpService.handleRedirect(err);\r\n // break;\r\n case 403:\r\n HttpService.handleErrorMessage(err);\r\n break;\r\n case 503:\r\n HttpService.handleErrorMessage(err);\r\n break;\r\n case 601:\r\n HttpService.handleRedirect(err);\r\n break;\r\n }\r\n\r\n // todo 413 Request Entity Too Large - upload file z formu\r\n }\r\n\r\n // private static handleLoginRedirect(res: HttpResponse<any>) {\r\n // const error = res['error'];\r\n //\r\n // }\r\n\r\n private static handleRedirect(res: HttpResponse<any>) {\r\n const error = res['error'];\r\n if (error.login) {\r\n let path = window.location.pathname;\r\n path = path[0] === '/' ? path.substr(1) : path; // '/front/' => 'front/'\r\n // console.log('Redirect ' + `${error.url}?r=${path}`);\r\n window.location.href = `${error.url}?r=${path}`;\r\n } else {\r\n window.location.href = `${error.url}`;\r\n }\r\n }\r\n\r\n private static handleErrorMessage(res: HttpResponse<any>) {\r\n const message = res['error'];\r\n if (res['error'] instanceof Blob) {\r\n const reader = new FileReader();\r\n\r\n reader.addEventListener('loadend', (e) => {\r\n HttpService.createSnackBar(e.srcElement['result']);\r\n });\r\n\r\n reader.readAsText(res['error']);\r\n } else {\r\n HttpService.createSnackBar(message);\r\n }\r\n }\r\n\r\n private static createSnackBar(message) {\r\n const config = new MatSnackBarConfig();\r\n config.duration = 2000;\r\n config.panelClass = 'es-snackbar-alert-danger'; // AppSnackbarPanelClass.DANGER;\r\n HttpService.instance.snackBar.open(message, null, config);\r\n }\r\n\r\n get(url: string, options?: {params?: HttpParams, responseType?, observe?}): Observable<any> {\r\n if (!options) { options = {}; }\r\n if (!options.params) {\r\n options.params = new HttpParams();\r\n }\r\n options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST); // pridava se nejakej param na formy pro angular\r\n return this.http.get(url, options)\r\n .pipe(catchError(HttpService.handleError));\r\n }\r\n\r\n post(url: string, body: any | null, options?: {params?: HttpParams, responseType?, reportProgress?: boolean, observe?: any}): Observable<any> {\r\n if (!options) { options = {}; }\r\n if (!options.params) {\r\n options.params = new HttpParams();\r\n }\r\n options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);\r\n\r\n return this.http.post(url, body, options)\r\n .pipe(catchError(HttpService.handleError));\r\n }\r\n\r\n // upload file s vypnutym service workerem -> header{disable-ngsw: true}\r\n // v ekj projektu fix-ngsw.sh\r\n // sed -i '/onFetch(event) {/,/const req = event.request;/c onFetch(event){const req=event.request;if(req.headers.get('disable-ngsw')===\"true\")return;' ./front/ngsw-worker.js\r\n postFiles(url: string, body: any | null, options?: {params?: HttpParams, responseType?, reportProgress?: boolean, observe?: any}): Observable<any> {\r\n if (!options) { options = {}; }\r\n if (!options.params) {\r\n options.params = new HttpParams();\r\n }\r\n options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);\r\n const headers = new HttpHeaders();\r\n options['headers'] = headers.set('disable-ngsw', 'true');\r\n return this.http.post(url, body, options)\r\n .pipe(catchError(HttpService.handleError));\r\n }\r\n\r\n delete(url: string, options?: {}): Observable<Object> {\r\n return this.http.delete(url, options)\r\n .pipe(catchError(HttpService.handleError));\r\n }\r\n\r\n\r\n // private extractMsgpack(res: Response) {\r\n //\r\n // let buffer = res.arrayBuffer();\r\n // // console.log(buffer);\r\n //\r\n // let array = new Uint8Array(buffer);\r\n // // console.log(array);\r\n // // console.log('Decode ' + msgpack.decode(array));\r\n //\r\n // return msgpack.decode(array);\r\n // }\r\n\r\n\r\n\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'es-http',\r\n template: `\r\n <p>\r\n http works!\r\n </p>\r\n `,\r\n styles: []\r\n})\r\nexport class HttpComponent implements OnInit {\r\n\r\n constructor() { }\r\n\r\n ngOnInit() {\r\n }\r\n\r\n}\r\n","import {NgModule} from '@angular/core';\r\nimport {HttpComponent} from './http.component';\r\nimport {HttpClientModule} from '@angular/common/http';\r\nimport {HttpService} from './http.service';\r\n\r\n@NgModule({\r\n imports: [\r\n HttpClientModule\r\n ],\r\n declarations: [HttpComponent],\r\n providers: [\r\n HttpService\r\n ],\r\n exports: [],\r\n})\r\nexport class HttpModule { }\r\n"]}
|
package/esm2015/eurosat-http.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview added by tsickle
|
|
3
|
-
* Generated from: eurosat-http.ts
|
|
4
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Generated bundle index. Do not edit.
|
|
8
|
-
*/
|
|
9
|
-
export { HttpService, HttpComponent, HttpModule } from './public_api';
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXVyb3NhdC1odHRwLmpzIiwic291cmNlUm9vdCI6IkM6L1VzZXJzL01pY2hhbC9FdXJvc2F0L25pbC9wcm9qZWN0cy9odHRwL3NyYy8iLCJzb3VyY2VzIjpbImV1cm9zYXQtaHR0cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7OztBQUlBLHVEQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWNfYXBpJztcbiJdfQ==
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview added by tsickle
|
|
3
|
-
* Generated from: lib/http.component.ts
|
|
4
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5
|
-
*/
|
|
6
|
-
import { Component } from '@angular/core';
|
|
7
|
-
export class HttpComponent {
|
|
8
|
-
constructor() { }
|
|
9
|
-
/**
|
|
10
|
-
* @return {?}
|
|
11
|
-
*/
|
|
12
|
-
ngOnInit() {
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
HttpComponent.decorators = [
|
|
16
|
-
{ type: Component, args: [{
|
|
17
|
-
selector: 'es-http',
|
|
18
|
-
template: `
|
|
19
|
-
<p>
|
|
20
|
-
http works!
|
|
21
|
-
</p>
|
|
22
|
-
`
|
|
23
|
-
}] }
|
|
24
|
-
];
|
|
25
|
-
/** @nocollapse */
|
|
26
|
-
HttpComponent.ctorParameters = () => [];
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiQzovVXNlcnMvTWljaGFsL0V1cm9zYXQvbmlsL3Byb2plY3RzL2h0dHAvc3JjLyIsInNvdXJjZXMiOlsibGliL2h0dHAuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUFFLFNBQVMsRUFBVSxNQUFNLGVBQWUsQ0FBQztBQVdsRCxNQUFNLE9BQU8sYUFBYTtJQUV4QixnQkFBZ0IsQ0FBQzs7OztJQUVqQixRQUFRO0lBQ1IsQ0FBQzs7O1lBZEYsU0FBUyxTQUFDO2dCQUNULFFBQVEsRUFBRSxTQUFTO2dCQUNuQixRQUFRLEVBQUU7Ozs7R0FJVDthQUVGIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQ29tcG9uZW50LCBPbkluaXQgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcclxuXHJcbkBDb21wb25lbnQoe1xyXG4gIHNlbGVjdG9yOiAnZXMtaHR0cCcsXHJcbiAgdGVtcGxhdGU6IGBcclxuICAgIDxwPlxyXG4gICAgICBodHRwIHdvcmtzIVxyXG4gICAgPC9wPlxyXG4gIGAsXHJcbiAgc3R5bGVzOiBbXVxyXG59KVxyXG5leHBvcnQgY2xhc3MgSHR0cENvbXBvbmVudCBpbXBsZW1lbnRzIE9uSW5pdCB7XHJcblxyXG4gIGNvbnN0cnVjdG9yKCkgeyB9XHJcblxyXG4gIG5nT25Jbml0KCkge1xyXG4gIH1cclxuXHJcbn1cclxuIl19
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview added by tsickle
|
|
3
|
-
* Generated from: lib/http.module.ts
|
|
4
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5
|
-
*/
|
|
6
|
-
import { NgModule } from '@angular/core';
|
|
7
|
-
import { HttpComponent } from './http.component';
|
|
8
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
9
|
-
import { HttpService } from './http.service';
|
|
10
|
-
export class HttpModule {
|
|
11
|
-
}
|
|
12
|
-
HttpModule.decorators = [
|
|
13
|
-
{ type: NgModule, args: [{
|
|
14
|
-
imports: [
|
|
15
|
-
HttpClientModule
|
|
16
|
-
],
|
|
17
|
-
declarations: [HttpComponent],
|
|
18
|
-
providers: [
|
|
19
|
-
HttpService
|
|
20
|
-
],
|
|
21
|
-
exports: [],
|
|
22
|
-
},] }
|
|
23
|
-
];
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cC5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiQzovVXNlcnMvTWljaGFsL0V1cm9zYXQvbmlsL3Byb2plY3RzL2h0dHAvc3JjLyIsInNvdXJjZXMiOlsibGliL2h0dHAubW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUFDLFFBQVEsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUN2QyxPQUFPLEVBQUMsYUFBYSxFQUFDLE1BQU0sa0JBQWtCLENBQUM7QUFDL0MsT0FBTyxFQUFDLGdCQUFnQixFQUFDLE1BQU0sc0JBQXNCLENBQUM7QUFDdEQsT0FBTyxFQUFDLFdBQVcsRUFBQyxNQUFNLGdCQUFnQixDQUFDO0FBWTNDLE1BQU0sT0FBTyxVQUFVOzs7W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