@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.
- package/bundles/eurosat-http.umd.js +170 -274
- package/bundles/eurosat-http.umd.js.map +1 -1
- package/bundles/eurosat-http.umd.min.js +1 -1
- package/bundles/eurosat-http.umd.min.js.map +1 -1
- package/esm2015/eurosat-http.js +5 -10
- package/esm2015/lib/http.component.js +19 -27
- package/esm2015/lib/http.module.js +19 -24
- package/esm2015/lib/http.service.js +144 -232
- package/esm2015/public_api.js +7 -12
- package/eurosat-http.d.ts +4 -4
- package/fesm2015/eurosat-http.js +168 -273
- package/fesm2015/eurosat-http.js.map +1 -1
- package/lib/http.component.d.ts +5 -5
- package/lib/http.module.d.ts +2 -2
- package/lib/http.service.d.ts +33 -33
- package/package.json +4 -4
- package/public_api.d.ts +3 -3
package/fesm2015/eurosat-http.js
CHANGED
|
@@ -1,289 +1,184 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
],
|
|
269
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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,OAAO,GAAG,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;SAC7D;QACD,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACtB,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;KAC7B;;;;;;IAEO,OAAO,WAAW,CAAC,GAAsB;QAC7C,QAAQ,GAAG,CAAC,MAAM;YACd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AEF;;;;;;;;;;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;MAIa,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,KA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ACzD,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;;;;;;"}
|
package/lib/http.component.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/lib/http.module.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare class HttpModule {
|
|
2
|
-
}
|
|
1
|
+
export declare class HttpModule {
|
|
2
|
+
}
|
package/lib/http.service.d.ts
CHANGED
|
@@ -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": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^
|
|
6
|
-
"@angular/core": "^
|
|
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';
|