@eurosat/http 10.0.0 → 12.0.0

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.
@@ -1,289 +1,184 @@
1
- import { Injectable, ɵɵdefineInjectable, ɵɵinject, Component, NgModule } from '@angular/core';
1
+ import { ɵɵdefineInjectable, ɵɵinject, Injectable, Component, NgModule } from '@angular/core';
2
2
  import { HttpResponse, HttpParams, HttpHeaders, HttpClient, HttpClientModule } from '@angular/common/http';
3
3
  import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar';
4
4
  import { throwError } from 'rxjs';
5
5
  import { catchError } from 'rxjs/operators';
6
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
- class HttpService {
14
- // není to prasárna?
15
- /**
16
- * @param {?} http
17
- * @param {?} snackBar
18
- */
19
- constructor(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
- static handleError(error) {
31
- HttpService.errorStatus(error);
32
- // Todo: In a real world app, you might use a remote logging infrastructure
33
- /** @type {?} */
34
- let errMsg;
35
- if (error instanceof HttpResponse) {
36
- /** @type {?} */
37
- const body = error.body || '';
38
- /** @type {?} */
39
- const 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 throwError(errMsg);
47
- }
48
- /**
49
- * @private
50
- * @param {?} err
51
- * @return {?}
52
- */
53
- static errorStatus(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
- static handleRedirect(res) {
84
- /** @type {?} */
85
- const error = res['error'];
86
- if (error.login) {
87
- /** @type {?} */
88
- let 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
- static handleErrorMessage(res) {
103
- /** @type {?} */
104
- const message = res['error'];
105
- if (res['error'] instanceof Blob) {
106
- /** @type {?} */
107
- const reader = new FileReader();
108
- reader.addEventListener('loadend', (/**
109
- * @param {?} e
110
- * @return {?}
111
- */
112
- (e) => {
113
- HttpService.createSnackBar(e.srcElement['result']);
114
- }));
115
- reader.readAsText(res['error']);
116
- }
117
- else {
118
- HttpService.createSnackBar(message);
119
- }
120
- }
121
- /**
122
- * @private
123
- * @param {?} message
124
- * @return {?}
125
- */
126
- static createSnackBar(message) {
127
- /** @type {?} */
128
- const config = new MatSnackBarConfig();
129
- config.duration = 2000;
130
- config.panelClass = 'es-snackbar-alert-danger'; // AppSnackbarPanelClass.DANGER;
131
- HttpService.instance.snackBar.open(message, null, config);
132
- }
133
- /**
134
- * @param {?} url
135
- * @param {?=} options
136
- * @return {?}
137
- */
138
- get(url, options) {
139
- if (!options) {
140
- options = {};
141
- }
142
- if (!options.params) {
143
- options.params = new HttpParams();
144
- }
145
- options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST); // pridava se nejakej param na formy pro angular
146
- return this.http.get(url, options)
147
- .pipe(catchError(HttpService.handleError));
148
- }
149
- /**
150
- * @param {?} url
151
- * @param {?} body
152
- * @param {?=} options
153
- * @return {?}
154
- */
155
- post(url, body, options) {
156
- if (!options) {
157
- options = {};
158
- }
159
- if (!options.params) {
160
- options.params = new HttpParams();
161
- }
162
- options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);
163
- return this.http.post(url, body, options)
164
- .pipe(catchError(HttpService.handleError));
165
- }
166
- // upload file s vypnutym service workerem -> header{disable-ngsw: true}
167
- // v ekj projektu fix-ngsw.sh
168
- // 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
169
- /**
170
- * @param {?} url
171
- * @param {?} body
172
- * @param {?=} options
173
- * @return {?}
174
- */
175
- postFiles(url, body, options) {
176
- if (!options) {
177
- options = {};
178
- }
179
- if (!options.params) {
180
- options.params = new HttpParams();
181
- }
182
- options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);
183
- /** @type {?} */
184
- const headers = new HttpHeaders();
185
- options['headers'] = headers.set('disable-ngsw', 'true');
186
- return this.http.post(url, body, options)
187
- .pipe(catchError(HttpService.handleError));
188
- }
189
- /**
190
- * @param {?} url
191
- * @param {?=} options
192
- * @return {?}
193
- */
194
- delete(url, options) {
195
- return this.http.delete(url, options)
196
- .pipe(catchError(HttpService.handleError));
197
- }
198
- }
199
- HttpService.ANGULAR_REQUEST_CONST = '2';
200
- HttpService.decorators = [
201
- { type: Injectable, args: [{
202
- providedIn: 'root'
203
- },] }
204
- ];
205
- /** @nocollapse */
206
- HttpService.ctorParameters = () => [
207
- { type: HttpClient },
208
- { type: MatSnackBar }
209
- ];
210
- /** @nocollapse */ HttpService.ɵprov = ɵɵdefineInjectable({ factory: function HttpService_Factory() { return new HttpService(ɵɵinject(HttpClient), ɵɵinject(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;
7
+ // @dynamic --> NEMAZAT https://github.com/dherges/ng-packagr/issues/641
8
+ class HttpService {
9
+ constructor(http, snackBar) {
10
+ this.http = http;
11
+ this.snackBar = snackBar;
12
+ if (!HttpService.instance) { // není to prasárna?
13
+ HttpService.instance = this;
14
+ }
15
+ }
16
+ static handleError(error) {
17
+ HttpService.errorStatus(error);
18
+ // Todo: In a real world app, you might use a remote logging infrastructure
19
+ let errMsg;
20
+ if (error instanceof HttpResponse) {
21
+ const body = error.body || '';
22
+ const err = body.error || JSON.stringify(body);
23
+ errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
24
+ }
25
+ else {
26
+ errMsg = error.message ? error.message : error.toString();
27
+ }
28
+ console.error(errMsg);
29
+ return throwError(errMsg);
30
+ }
31
+ static errorStatus(err) {
32
+ switch (err.status) {
33
+ case 300:
34
+ case 301:
35
+ HttpService.handleRedirect(err);
36
+ break;
37
+ // case 302:
38
+ // HttpService.handleRedirect(err);
39
+ // break;
40
+ case 403:
41
+ HttpService.handleErrorMessage(err);
42
+ break;
43
+ case 503:
44
+ HttpService.handleErrorMessage(err);
45
+ break;
46
+ case 601:
47
+ HttpService.handleRedirect(err);
48
+ break;
49
+ }
50
+ // todo 413 Request Entity Too Large - upload file z formu
51
+ }
52
+ // private static handleLoginRedirect(res: HttpResponse<any>) {
53
+ // const error = res['error'];
54
+ //
55
+ // }
56
+ static handleRedirect(res) {
57
+ const error = res['error'];
58
+ if (error.login) {
59
+ let path = window.location.pathname;
60
+ path = path[0] === '/' ? path.substr(1) : path; // '/front/' => 'front/'
61
+ // console.log('Redirect ' + `${error.url}?r=${path}`);
62
+ window.location.href = `${error.url}?r=${path}`;
63
+ }
64
+ else {
65
+ window.location.href = `${error.url}`;
66
+ }
67
+ }
68
+ static handleErrorMessage(res) {
69
+ const message = res['error'];
70
+ if (res['error'] instanceof Blob) {
71
+ const reader = new FileReader();
72
+ reader.addEventListener('loadend', (e) => {
73
+ HttpService.createSnackBar(e.srcElement['result']);
74
+ });
75
+ reader.readAsText(res['error']);
76
+ }
77
+ else {
78
+ HttpService.createSnackBar(message);
79
+ }
80
+ }
81
+ static createSnackBar(message) {
82
+ const config = new MatSnackBarConfig();
83
+ config.duration = 2000;
84
+ config.panelClass = 'es-snackbar-alert-danger'; // AppSnackbarPanelClass.DANGER;
85
+ HttpService.instance.snackBar.open(message, null, config);
86
+ }
87
+ get(url, options) {
88
+ if (!options) {
89
+ options = {};
90
+ }
91
+ if (!options.params) {
92
+ options.params = new HttpParams();
93
+ }
94
+ options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST); // pridava se nejakej param na formy pro angular
95
+ return this.http.get(url, options)
96
+ .pipe(catchError(HttpService.handleError));
97
+ }
98
+ post(url, body, options) {
99
+ if (!options) {
100
+ options = {};
101
+ }
102
+ if (!options.params) {
103
+ options.params = new HttpParams();
104
+ }
105
+ options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);
106
+ return this.http.post(url, body, options)
107
+ .pipe(catchError(HttpService.handleError));
108
+ }
109
+ // upload file s vypnutym service workerem -> header{disable-ngsw: true}
110
+ // v ekj projektu fix-ngsw.sh
111
+ // 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
112
+ postFiles(url, body, options) {
113
+ if (!options) {
114
+ options = {};
115
+ }
116
+ if (!options.params) {
117
+ options.params = new HttpParams();
118
+ }
119
+ options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);
120
+ const headers = new HttpHeaders();
121
+ options['headers'] = headers.set('disable-ngsw', 'true');
122
+ return this.http.post(url, body, options)
123
+ .pipe(catchError(HttpService.handleError));
124
+ }
125
+ delete(url, options) {
126
+ return this.http.delete(url, options)
127
+ .pipe(catchError(HttpService.handleError));
128
+ }
229
129
  }
130
+ HttpService.ANGULAR_REQUEST_CONST = '2';
131
+ /** @nocollapse */ HttpService.ɵprov = ɵɵdefineInjectable({ factory: function HttpService_Factory() { return new HttpService(ɵɵinject(HttpClient), ɵɵinject(MatSnackBar)); }, token: HttpService, providedIn: "root" });
132
+ HttpService.decorators = [
133
+ { type: Injectable, args: [{
134
+ providedIn: 'root'
135
+ },] }
136
+ ];
137
+ /** @nocollapse */
138
+ HttpService.ctorParameters = () => [
139
+ { type: HttpClient },
140
+ { type: MatSnackBar }
141
+ ];
230
142
 
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
- class HttpComponent {
237
- constructor() { }
238
- /**
239
- * @return {?}
240
- */
241
- ngOnInit() {
242
- }
243
- }
244
- HttpComponent.decorators = [
245
- { type: Component, args: [{
246
- selector: 'es-http',
247
- template: `
248
- <p>
249
- http works!
250
- </p>
251
- `
252
- }] }
253
- ];
254
- /** @nocollapse */
143
+ class HttpComponent {
144
+ constructor() { }
145
+ ngOnInit() {
146
+ }
147
+ }
148
+ HttpComponent.decorators = [
149
+ { type: Component, args: [{
150
+ selector: 'es-http',
151
+ template: `
152
+ <p>
153
+ http works!
154
+ </p>
155
+ `
156
+ },] }
157
+ ];
158
+ /** @nocollapse */
255
159
  HttpComponent.ctorParameters = () => [];
256
160
 
257
- /**
258
- * @fileoverview added by tsickle
259
- * Generated from: lib/http.module.ts
260
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
261
- */
262
- class HttpModule {
263
- }
264
- HttpModule.decorators = [
265
- { type: NgModule, args: [{
266
- imports: [
267
- HttpClientModule
268
- ],
269
- declarations: [HttpComponent],
270
- providers: [
271
- HttpService
272
- ],
273
- exports: [],
274
- },] }
161
+ class HttpModule {
162
+ }
163
+ HttpModule.decorators = [
164
+ { type: NgModule, args: [{
165
+ imports: [
166
+ HttpClientModule
167
+ ],
168
+ declarations: [HttpComponent],
169
+ providers: [
170
+ HttpService
171
+ ],
172
+ exports: [],
173
+ },] }
275
174
  ];
276
175
 
277
- /**
278
- * @fileoverview added by tsickle
279
- * Generated from: public_api.ts
280
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
176
+ /*
177
+ * Public API Surface of http
281
178
  */
282
179
 
283
- /**
284
- * @fileoverview added by tsickle
285
- * Generated from: eurosat-http.ts
286
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
180
+ /**
181
+ * Generated bundle index. Do not edit.
287
182
  */
288
183
 
289
184
  export { HttpComponent, HttpModule, HttpService };
@@ -1 +1 @@
1
- {"version":3,"file":"eurosat-http.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":[],"mappings":";;;;;;;;;;;;MASa,WAAW;;;;;;IAMpB,YACY,IAAgB,EAChB,QAAqB;QADrB,SAAI,GAAJ,IAAI,CAAY;QAChB,aAAQ,GAAR,QAAQ,CAAa;QAE7B,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;YACvB,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC;SAC/B;KACJ;;;;;IAEM,OAAO,WAAW,CAAE,KAA8B;QACrD,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;;;YAG3B,MAAc;QAClB,IAAI,KAAK,YAAY,YAAY,EAAE;;kBACzB,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE;;kBACvB,GAAG,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,MAAM,KAAK,CAAC,UAAU,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC;SACjE;aAAM;YACH,MAAM,GAAG,KAAK,CAAC,OA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;;;;YAPO,UAAU;YACV,WAAW;;;;;IASf,kCAA0C;;;;;IAE1C,qBAAqC;;;;;IAGjC,2BAAwB;;;;;IACxB,+BAA6B;;;;;;;;MCNxB,aAAa;IAExB,iBAAiB;;;;IAEjB,QAAQ;KACP;;;YAdF,SAAS,SAAC;gBACT,QAAQ,EAAE,SAAS;gBACnB,QAAQ,EAAE;;;;GAIT;aAEF;;;;;;;;;;MCKY,UAAU;;;YAVtB,QAAQ,SAAC;gBACN,OAAO,EAAE;oBACL,gBAAgB;iBACnB;gBACD,YAAY,EAAE,CAAC,aAAa,CAAC;gBAC7B,SAAS,EAAE;oBACP,WAAW;iBACd;gBACD,OAAO,EAAE,EAAE;aACd;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"eurosat-http.js","sources":["../../../projects/http/src/lib/http.service.ts","../../../projects/http/src/lib/http.component.ts","../../../projects/http/src/lib/http.module.ts","../../../projects/http/src/public_api.ts","../../../projects/http/src/eurosat-http.ts"],"sourcesContent":["import {Injectable} from '@angular/core';\nimport {HttpClient, HttpHeaders, HttpParams, HttpResponse} from '@angular/common/http';\nimport {MatSnackBar, MatSnackBarConfig} from '@angular/material/snack-bar';\nimport {Observable, throwError} from 'rxjs';\nimport {catchError} from 'rxjs/operators';\n// @dynamic --> NEMAZAT https://github.com/dherges/ng-packagr/issues/641\n@Injectable({\n providedIn: 'root'\n})\nexport class HttpService {\n\n public static ANGULAR_REQUEST_CONST = '2';\n\n private static instance: HttpService; // není to prasárna?\n\n constructor(\n private http: HttpClient,\n private snackBar: MatSnackBar,\n ) {\n if (!HttpService.instance) { // není to prasárna?\n HttpService.instance = this;\n }\n }\n\n public static handleError (error: HttpResponse<any> | any) {\n HttpService.errorStatus(error);\n\n // Todo: In a real world app, you might use a remote logging infrastructure\n let errMsg: string;\n if (error instanceof HttpResponse) {\n const body = error.body || '';\n const err = body.error || JSON.stringify(body);\n errMsg = `${error.status} - ${error.statusText || ''} ${err}`;\n } else {\n errMsg = error.message ? error.message : error.toString();\n }\n console.error(errMsg);\n return throwError(errMsg);\n }\n\n private static errorStatus(err: HttpResponse<any>) {\n switch (err.status) {\n case 300:\n case 301:\n HttpService.handleRedirect(err);\n break;\n // case 302:\n // HttpService.handleRedirect(err);\n // break;\n case 403:\n HttpService.handleErrorMessage(err);\n break;\n case 503:\n HttpService.handleErrorMessage(err);\n break;\n case 601:\n HttpService.handleRedirect(err);\n break;\n }\n\n // todo 413 Request Entity Too Large - upload file z formu\n }\n\n // private static handleLoginRedirect(res: HttpResponse<any>) {\n // const error = res['error'];\n //\n // }\n\n private static handleRedirect(res: HttpResponse<any>) {\n const error = res['error'];\n if (error.login) {\n let path = window.location.pathname;\n path = path[0] === '/' ? path.substr(1) : path; // '/front/' => 'front/'\n // console.log('Redirect ' + `${error.url}?r=${path}`);\n window.location.href = `${error.url}?r=${path}`;\n } else {\n window.location.href = `${error.url}`;\n }\n }\n\n private static handleErrorMessage(res: HttpResponse<any>) {\n const message = res['error'];\n if (res['error'] instanceof Blob) {\n const reader = new FileReader();\n\n reader.addEventListener('loadend', (e) => {\n HttpService.createSnackBar(e.srcElement['result']);\n });\n\n reader.readAsText(res['error']);\n } else {\n HttpService.createSnackBar(message);\n }\n }\n\n private static createSnackBar(message) {\n const config = new MatSnackBarConfig();\n config.duration = 2000;\n config.panelClass = 'es-snackbar-alert-danger'; // AppSnackbarPanelClass.DANGER;\n HttpService.instance.snackBar.open(message, null, config);\n }\n\n get(url: string, options?: {params?: HttpParams, responseType?, observe?}): Observable<any> {\n if (!options) { options = {}; }\n if (!options.params) {\n options.params = new HttpParams();\n }\n options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST); // pridava se nejakej param na formy pro angular\n return this.http.get(url, options)\n .pipe(catchError(HttpService.handleError));\n }\n\n post(url: string, body: any | null, options?: {params?: HttpParams, responseType?, reportProgress?: boolean, observe?: any}): Observable<any> {\n if (!options) { options = {}; }\n if (!options.params) {\n options.params = new HttpParams();\n }\n options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);\n\n return this.http.post(url, body, options)\n .pipe(catchError(HttpService.handleError));\n }\n\n // upload file s vypnutym service workerem -> header{disable-ngsw: true}\n // v ekj projektu fix-ngsw.sh\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\n postFiles(url: string, body: any | null, options?: {params?: HttpParams, responseType?, reportProgress?: boolean, observe?: any}): Observable<any> {\n if (!options) { options = {}; }\n if (!options.params) {\n options.params = new HttpParams();\n }\n options.params = options.params.set('_req_s', HttpService.ANGULAR_REQUEST_CONST);\n const headers = new HttpHeaders();\n options['headers'] = headers.set('disable-ngsw', 'true');\n return this.http.post(url, body, options)\n .pipe(catchError(HttpService.handleError));\n }\n\n delete(url: string, options?: {}): Observable<Object> {\n return this.http.delete(url, options)\n .pipe(catchError(HttpService.handleError));\n }\n\n\n // private extractMsgpack(res: Response) {\n //\n // let buffer = res.arrayBuffer();\n // // console.log(buffer);\n //\n // let array = new Uint8Array(buffer);\n // // console.log(array);\n // // console.log('Decode ' + msgpack.decode(array));\n //\n // return msgpack.decode(array);\n // }\n\n\n\n}\n","import { Component, OnInit } from '@angular/core';\n\n@Component({\n selector: 'es-http',\n template: `\n <p>\n http works!\n </p>\n `,\n styles: []\n})\nexport class HttpComponent implements OnInit {\n\n constructor() { }\n\n ngOnInit() {\n }\n\n}\n","import {NgModule} from '@angular/core';\nimport {HttpComponent} from './http.component';\nimport {HttpClientModule} from '@angular/common/http';\nimport {HttpService} from './http.service';\n\n@NgModule({\n imports: [\n HttpClientModule\n ],\n declarations: [HttpComponent],\n providers: [\n HttpService\n ],\n exports: [],\n})\nexport class HttpModule { }\n","/*\n * Public API Surface of http\n */\n\nexport * from './lib/http.service';\nexport * from './lib/http.component';\nexport * from './lib/http.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAKA;M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,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,qBAAqB,CAAC,CAAC;QACjF,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAClC,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC;aACpC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;KAClD;IAED,MAAM,CAAC,GAAW,EAAE,OAAY;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC;aAChC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;KAClD;;AAlIa,iCAAqB,GAAG,GAAG,CAAC;;;YAL7C,UAAU,SAAC;gBACR,UAAU,EAAE,MAAM;aACrB;;;;YAPO,UAAU;YACV,WAAW;;;MCSN,aAAa;IAExB,iBAAiB;IAEjB,QAAQ;KACP;;;YAdF,SAAS,SAAC;gBACT,QAAQ,EAAE,SAAS;gBACnB,QAAQ,EAAE;;;;GAIT;aAEF;;;;;MCKY,UAAU;;;YAVtB,QAAQ,SAAC;gBACN,OAAO,EAAE;oBACL,gBAAgB;iBACnB;gBACD,YAAY,EAAE,CAAC,aAAa,CAAC;gBAC7B,SAAS,EAAE;oBACP,WAAW;iBACd;gBACD,OAAO,EAAE,EAAE;aACd;;;ACdD;;;;ACAA;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { OnInit } from '@angular/core';
2
- export declare class HttpComponent implements OnInit {
3
- constructor();
4
- ngOnInit(): void;
5
- }
1
+ import { OnInit } from '@angular/core';
2
+ export declare class HttpComponent implements OnInit {
3
+ constructor();
4
+ ngOnInit(): void;
5
+ }
@@ -1,2 +1,2 @@
1
- export declare class HttpModule {
2
- }
1
+ export declare class HttpModule {
2
+ }
@@ -1,33 +1,33 @@
1
- import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http';
2
- import { MatSnackBar } from '@angular/material/snack-bar';
3
- import { Observable } from 'rxjs';
4
- export declare class HttpService {
5
- private http;
6
- private snackBar;
7
- static ANGULAR_REQUEST_CONST: string;
8
- private static instance;
9
- constructor(http: HttpClient, snackBar: MatSnackBar);
10
- static handleError(error: HttpResponse<any> | any): Observable<never>;
11
- private static errorStatus;
12
- private static handleRedirect;
13
- private static handleErrorMessage;
14
- private static createSnackBar;
15
- get(url: string, options?: {
16
- params?: HttpParams;
17
- responseType?: any;
18
- observe?: any;
19
- }): Observable<any>;
20
- post(url: string, body: any | null, options?: {
21
- params?: HttpParams;
22
- responseType?: any;
23
- reportProgress?: boolean;
24
- observe?: any;
25
- }): Observable<any>;
26
- postFiles(url: string, body: any | null, options?: {
27
- params?: HttpParams;
28
- responseType?: any;
29
- reportProgress?: boolean;
30
- observe?: any;
31
- }): Observable<any>;
32
- delete(url: string, options?: {}): Observable<Object>;
33
- }
1
+ import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http';
2
+ import { MatSnackBar } from '@angular/material/snack-bar';
3
+ import { Observable } from 'rxjs';
4
+ export declare class HttpService {
5
+ private http;
6
+ private snackBar;
7
+ static ANGULAR_REQUEST_CONST: string;
8
+ private static instance;
9
+ constructor(http: HttpClient, snackBar: MatSnackBar);
10
+ static handleError(error: HttpResponse<any> | any): Observable<never>;
11
+ private static errorStatus;
12
+ private static handleRedirect;
13
+ private static handleErrorMessage;
14
+ private static createSnackBar;
15
+ get(url: string, options?: {
16
+ params?: HttpParams;
17
+ responseType?: any;
18
+ observe?: any;
19
+ }): Observable<any>;
20
+ post(url: string, body: any | null, options?: {
21
+ params?: HttpParams;
22
+ responseType?: any;
23
+ reportProgress?: boolean;
24
+ observe?: any;
25
+ }): Observable<any>;
26
+ postFiles(url: string, body: any | null, options?: {
27
+ params?: HttpParams;
28
+ responseType?: any;
29
+ reportProgress?: boolean;
30
+ observe?: any;
31
+ }): Observable<any>;
32
+ delete(url: string, options?: {}): Observable<Object>;
33
+ }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@eurosat/http",
3
- "version": "10.0.0",
3
+ "version": "12.0.0",
4
4
  "peerDependencies": {
5
- "@angular/common": "^10.2.5",
6
- "@angular/core": "^10.2.5"
5
+ "@angular/common": "^12.2.16",
6
+ "@angular/core": "^12.2.16"
7
7
  },
8
8
  "main": "bundles/eurosat-http.umd.js",
9
9
  "module": "fesm2015/eurosat-http.js",
@@ -16,4 +16,4 @@
16
16
  "dependencies": {
17
17
  "tslib": "^2.0.0"
18
18
  }
19
- }
19
+ }
package/public_api.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './lib/http.service';
2
- export * from './lib/http.component';
3
- export * from './lib/http.module';
1
+ export * from './lib/http.service';
2
+ export * from './lib/http.component';
3
+ export * from './lib/http.module';