@esfaenza/httpservice 15.2.2 → 15.2.4

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,11 +1,12 @@
1
- import * as i2 from '@angular/common/http';
1
+ import * as i3 from '@angular/common/http';
2
2
  import { HttpEventType, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
3
3
  import * as i0 from '@angular/core';
4
4
  import { InjectionToken, Injectable, Optional, Inject, NgModule } from '@angular/core';
5
- import { concatMap, delay, finalize, map, catchError, scan } from 'rxjs/operators';
5
+ import { concatMap, delay, finalize, map, catchError, first, scan } from 'rxjs/operators';
6
6
  import { forkJoin, from, of, throwError, Observable } from 'rxjs';
7
- import * as i3 from '@esfaenza/preferences';
8
- import * as i4 from '@esfaenza/extensions';
7
+ import * as i2 from '@esfaenza/localizations';
8
+ import * as i4 from '@esfaenza/preferences';
9
+ import * as i5 from '@esfaenza/extensions';
9
10
 
10
11
  /**
11
12
  * Dizionario di invalidazioni delle chiamate HTTP
@@ -15,10 +16,6 @@ const HTTP_INVALIDATION = new InjectionToken('HTTP_INVALIDATION');
15
16
  * Durata della cache lato libreria dopo il quale la cache verrà ripulita
16
17
  */
17
18
  const CLIENT_CACHE_DURATION_S = new InjectionToken('CLIENT_CACHE_DURATION_S');
18
- /**
19
- * Locale della libreria per messaggi d'errore ed Header di default "Accept-Language". Sono supportati "it-IT" ed "en-US"
20
- */
21
- const HTTP_LOCALE = new InjectionToken('HTTP_LOCALE');
22
19
  /**
23
20
  * Nome dell'APP utilizzato per creare le chiavi delle cache specifiche per l'applicazione corrente
24
21
  */
@@ -109,35 +106,13 @@ class HttpServiceExtensions {
109
106
  handleException(status, text) {
110
107
  console.error("ESHttpError " + status + " " + text);
111
108
  }
112
- }
113
-
114
- /**
115
- * Oggetto statico di localizzazione per i messaggi
116
- */
117
- const Loc = {
118
- "Result for": { "en-US": "Result for", "it-IT": "Risultato per", },
119
- "retrieved from cache": { "en-US": "retrieved from cache", "it-IT": "recuperato dalla cache", },
120
- "Cached result for": { "en-US": "Cached result for", "it-IT": "Messo in cache risultato per", },
121
- "Starting call": { "en-US": "Starting call", "it-IT": "Inizio la chiamata", },
122
- "at URL": { "en-US": "at URL", "it-IT": "all'URL", },
123
- "Invlalidating cache element": { "en-US": "Invlalidating cache element", "it-IT": "Invalido elemento della cache", },
124
- "Finalizing call": { "en-US": "Finalizing call", "it-IT": "Finalizzo chiamata", },
125
- "with status": { "en-US": "with status", "it-IT": "con stato", },
126
- "Success": { "en-US": "Success", "it-IT": "Successso", },
127
- "Failure": { "en-US": "Failure", "it-IT": "Fallimento", },
128
- "Error 401 on call": { "en-US": "Error 401 on call", "it-IT": "Errore 401 su chiamata", },
129
- "with redirect already in progress. Ignoring this event": { "en-US": "with redirect already in progress. Ignoring this event", "it-IT": "con redirezione già in corso. Ignoro l'evento", },
130
- "redirecting to login": { "en-US": "redirecting to login", "it-IT": "redireziono al login", },
131
- "Redirecting to Login, ignoring HTTP error on call": { "en-US": "Redirecting to Login, ignoring HTTP error on call", "it-IT": "Redireziono al login ignorando errori sulla chiamata", },
132
- "Already Handling an error, ignoring HTTP error on call": { "en-US": "Already Handling an error, ignoring HTTP error on call", "it-IT": "sto già gestendo un errore, ignoro quello corrente per la chiamata HTTP", },
133
- "Error 444 on call": { "en-US": "Error 444 on call", "it-IT": "Errore 444 su chiamata" },
134
- "Resource not found": { "en-US": "Resource not found", "it-IT": "Risorsa non trovata" },
135
- "Converted old storage system to new one": { "en-US": "Converted old storage system to new one", "it-IT": "Convertito il vecchio sistema di storicizzazione al nuovo" },
136
- "Marking cache to be persisted as soon as possible": { "en-US": "Marking cache to be persisted as soon as possible", "it-IT": "Marco cache da persistere il prima possibile" },
137
- "No more HTTP calls to be executed, entering idle state and persisting modified caches": { "en-US": "No more HTTP calls to be executed, entering idle state and persisting modified caches", "it-IT": "Nessun'altra chiamata HTTP dev'essere eseguita, entro in stato IDLE e persisto le cache modificate" },
138
- "Caches succesfully persisted": { "en-US": "Caches succesfully persisted", "it-IT": "Le cache sono state persistite con successo" },
139
- "Errors persisting modified caches": { "en-US": "Errors persisting modified caches", "it-IT": "Errori nella persistizione delle cache (esiste persistizione? boh...)" },
140
- };
109
+ }
110
+ HttpServiceExtensions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpServiceExtensions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
111
+ HttpServiceExtensions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpServiceExtensions, providedIn: 'root' });
112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpServiceExtensions, decorators: [{
113
+ type: Injectable,
114
+ args: [{ providedIn: 'root' }]
115
+ }] });
141
116
 
142
117
  class CacheInfos {
143
118
  constructor(finalUrl, cache, cacheKey, cacheTime, cacheItem) {
@@ -158,14 +133,14 @@ class HTTPService {
158
133
  /**
159
134
  * @ignore
160
135
  */
161
- constructor(EXTENSION_CLASS, HTTP_INVALIDATION, LOCALE, APP_NAME, CLIENT_CACHE_DURATION_S, CACHE_BY_USER, DEBUG_MODE, http, localStorage, utisExts) {
136
+ constructor(EXTENSION_CLASS, HTTP_INVALIDATION, APP_NAME, CLIENT_CACHE_DURATION_S, CACHE_BY_USER, DEBUG_MODE, bc, http, localStorage, utisExts) {
162
137
  this.EXTENSION_CLASS = EXTENSION_CLASS;
163
138
  this.HTTP_INVALIDATION = HTTP_INVALIDATION;
164
- this.LOCALE = LOCALE;
165
139
  this.APP_NAME = APP_NAME;
166
140
  this.CLIENT_CACHE_DURATION_S = CLIENT_CACHE_DURATION_S;
167
141
  this.CACHE_BY_USER = CACHE_BY_USER;
168
142
  this.DEBUG_MODE = DEBUG_MODE;
143
+ this.bc = bc;
169
144
  this.http = http;
170
145
  this.localStorage = localStorage;
171
146
  this.utisExts = utisExts;
@@ -226,14 +201,16 @@ class HTTPService {
226
201
  * @returns {Observable<T>} Observable che contiene il risultato della chiamata
227
202
  */
228
203
  get(url, params = null, transaction = "", succesfulResultMandatory = true, errorCallback = null) {
229
- // TODO provare e testare
230
- return from([this.defaultStartCall(url)]).pipe(concatMap((myGuid) => {
204
+ return forkJoin({
205
+ myGuid: from([this.defaultStartCall(url)]),
206
+ locale: this.bc.Locale
207
+ }).pipe(concatMap((ret) => {
231
208
  let cachedInfos = this.tryGetCacheInformations(url, params);
232
209
  if (cachedInfos.cache && cachedInfos.cacheItem) {
233
210
  this.log(this.loc("Result for") + " " + url + " " + this.loc("retrieved from cache"));
234
- return of(cachedInfos.cacheItem).pipe(delay(0), finalize(() => { this.tryFinalizeByGuid(myGuid); }));
211
+ return of(cachedInfos.cacheItem).pipe(delay(0), finalize(() => { this.tryFinalizeByGuid(ret.myGuid); }));
235
212
  }
236
- var httpCall = this.http.get(cachedInfos.finalUrl, { headers: this.getHeaders(transaction), params: params });
213
+ var httpCall = this.http.get(cachedInfos.finalUrl, { headers: this.getHeaders(ret.locale, transaction), params: params });
237
214
  return httpCall.pipe(map((res) => {
238
215
  let responseItem = res;
239
216
  if (cachedInfos.cache) {
@@ -244,8 +221,8 @@ class HTTPService {
244
221
  }), catchError((err, caught) => {
245
222
  if (errorCallback)
246
223
  errorCallback();
247
- return !succesfulResultMandatory ? throwError(err) : this.registerErrorAndReturnEmptyObservable(err, myGuid);
248
- }), finalize(() => { this.tryFinalizeByGuid(myGuid, cachedInfos); }));
224
+ return !succesfulResultMandatory ? throwError(err) : this.registerErrorAndReturnEmptyObservable(err, ret.myGuid);
225
+ }), finalize(() => { this.tryFinalizeByGuid(ret.myGuid, cachedInfos); }));
249
226
  }));
250
227
  }
251
228
  /**
@@ -264,13 +241,16 @@ class HTTPService {
264
241
  * @returns {Observable<Blob | ArrayBuffer>} Observable che contiene il risultato della chiamata
265
242
  */
266
243
  getRaw(url, params = null, type = "arraybuffer", transaction = "", succesfulResultMandatory = true, errorCallback = null) {
267
- return from([this.defaultStartCall(url)]).pipe(concatMap((myGuid) => {
244
+ return forkJoin({
245
+ myGuid: from([this.defaultStartCall(url)]),
246
+ locale: this.bc.Locale
247
+ }).pipe(concatMap((ret) => {
268
248
  let cachedInfos = this.tryGetCacheInformations(url, params);
269
249
  if (cachedInfos.cache && cachedInfos.cacheItem) {
270
250
  this.log(this.loc("Result for") + " " + url + " " + this.loc("retrieved from cache"));
271
- return of(cachedInfos.cacheItem).pipe(delay(0), finalize(() => { this.tryFinalizeByGuid(myGuid); }));
251
+ return of(cachedInfos.cacheItem).pipe(delay(0), finalize(() => { this.tryFinalizeByGuid(ret.myGuid); }));
272
252
  }
273
- var httpCall = this.http.get(cachedInfos.finalUrl, { responseType: type, headers: this.getHeaders(transaction), params: params });
253
+ var httpCall = this.http.get(cachedInfos.finalUrl, { responseType: type, headers: this.getHeaders(ret.locale, transaction), params: params });
274
254
  return httpCall.pipe(map((blob) => {
275
255
  if (cachedInfos.cache) {
276
256
  this.cacheResponse(blob, cachedInfos);
@@ -280,8 +260,8 @@ class HTTPService {
280
260
  }), catchError((err, caught) => {
281
261
  if (errorCallback)
282
262
  errorCallback();
283
- return !succesfulResultMandatory ? throwError(err) : this.registerErrorAndReturnEmptyObservable(err, myGuid);
284
- }), finalize(() => { this.tryFinalizeByGuid(myGuid, cachedInfos); }));
263
+ return !succesfulResultMandatory ? throwError(err) : this.registerErrorAndReturnEmptyObservable(err, ret.myGuid);
264
+ }), finalize(() => { this.tryFinalizeByGuid(ret.myGuid, cachedInfos); }));
285
265
  }));
286
266
  }
287
267
  /**
@@ -297,11 +277,14 @@ class HTTPService {
297
277
  * @returns {Observable<T>} Observable che contiene il risultato della chiamata
298
278
  */
299
279
  post(url, bodyData, params = null, transaction = "", succesfulResultMandatory = true) {
300
- return from([this.defaultStartCall(url)]).pipe(concatMap((myGuid) => {
301
- var httpCall = this.http.post(url, bodyData, { headers: this.getHeaders(transaction), params: params });
280
+ return forkJoin({
281
+ myGuid: from([this.defaultStartCall(url)]),
282
+ locale: this.bc.Locale
283
+ }).pipe(concatMap((ret) => {
284
+ var httpCall = this.http.post(url, bodyData, { headers: this.getHeaders(ret.locale, transaction), params: params });
302
285
  return httpCall.pipe(catchError((err, caught) => {
303
- return !succesfulResultMandatory ? throwError(err) : this.registerErrorAndReturnEmptyObservable(err, myGuid);
304
- }), finalize(() => { this.tryFinalizeByGuid(myGuid); }));
286
+ return !succesfulResultMandatory ? throwError(err) : this.registerErrorAndReturnEmptyObservable(err, ret.myGuid);
287
+ }), finalize(() => { this.tryFinalizeByGuid(ret.myGuid); }));
305
288
  }));
306
289
  }
307
290
  /**
@@ -316,11 +299,14 @@ class HTTPService {
316
299
  * @returns {Observable<T>} Observable che contiene il risultato della chiamata
317
300
  */
318
301
  delete(url, params = null, transaction = "", succesfulResultMandatory = true) {
319
- return from([this.defaultStartCall(url)]).pipe(concatMap((myGuid) => {
320
- var httpCall = this.http.delete(url, { headers: this.getHeaders(transaction), params: params });
302
+ return forkJoin({
303
+ myGuid: from([this.defaultStartCall(url)]),
304
+ locale: this.bc.Locale
305
+ }).pipe(concatMap((ret) => {
306
+ var httpCall = this.http.delete(url, { headers: this.getHeaders(ret.locale, transaction), params: params });
321
307
  return httpCall.pipe(catchError((err, caught) => {
322
- return !succesfulResultMandatory ? throwError(err) : this.registerErrorAndReturnEmptyObservable(err, myGuid);
323
- }), finalize(() => { this.tryFinalizeByGuid(myGuid); }));
308
+ return !succesfulResultMandatory ? throwError(err) : this.registerErrorAndReturnEmptyObservable(err, ret.myGuid);
309
+ }), finalize(() => { this.tryFinalizeByGuid(ret.myGuid); }));
324
310
  }));
325
311
  }
326
312
  /**
@@ -336,11 +322,14 @@ class HTTPService {
336
322
  * @returns {Observable<T>} Observable che contiene il risultato della chiamata
337
323
  */
338
324
  put(url, bodyData, params = null, transaction = "", succesfulResultMandatory = true) {
339
- return from([this.defaultStartCall(url)]).pipe(concatMap((myGuid) => {
340
- var httpCall = this.http.put(url, bodyData, { headers: this.getHeaders(transaction), params: params });
325
+ return forkJoin({
326
+ myGuid: from([this.defaultStartCall(url)]),
327
+ locale: this.bc.Locale
328
+ }).pipe(concatMap((ret) => {
329
+ var httpCall = this.http.put(url, bodyData, { headers: this.getHeaders(ret.locale, transaction), params: params });
341
330
  return httpCall.pipe(catchError((err, caught) => {
342
- return !succesfulResultMandatory ? throwError(err) : this.registerErrorAndReturnEmptyObservable(err, myGuid);
343
- }), finalize(() => { this.tryFinalizeByGuid(myGuid); }));
331
+ return !succesfulResultMandatory ? throwError(err) : this.registerErrorAndReturnEmptyObservable(err, ret.myGuid);
332
+ }), finalize(() => { this.tryFinalizeByGuid(ret.myGuid); }));
344
333
  }));
345
334
  }
346
335
  /**
@@ -355,11 +344,14 @@ class HTTPService {
355
344
  * @returns {Observable<T>} Observable che contiene il risultato della chiamata
356
345
  */
357
346
  postwithFiles(url, bodyData, fileArrayOrFile, params = null) {
358
- return from([this.defaultStartCall(url)]).pipe(concatMap((myGuid) => {
347
+ return forkJoin({
348
+ myGuid: from([this.defaultStartCall(url)]),
349
+ locale: this.bc.Locale
350
+ }).pipe(concatMap((ret) => {
359
351
  var formData = this.getFilesFormData(fileArrayOrFile);
360
352
  formData.append("body", JSON.stringify(bodyData));
361
- var httpCall = this.http.post(url, formData, { params: params, headers: this.getHeaders(null, true, null, null) });
362
- return httpCall.pipe(catchError((err, caught) => { return this.registerErrorAndReturnEmptyObservable(err, myGuid); }), finalize(() => { this.tryFinalizeByGuid(myGuid); }));
353
+ var httpCall = this.http.post(url, formData, { params: params, headers: this.getHeaders(ret.locale, null, true, null, null) });
354
+ return httpCall.pipe(catchError((err, caught) => { return this.registerErrorAndReturnEmptyObservable(err, ret.myGuid); }), finalize(() => { this.tryFinalizeByGuid(ret.myGuid); }));
363
355
  }));
364
356
  }
365
357
  /**
@@ -375,9 +367,10 @@ class HTTPService {
375
367
  * @param {Function} afterGetFile Callback da chiamare dopo aver gestito la risposta del **getFileCallback**, in caso **handleError** fosse **false** verrà richiamato anche in caso di errore
376
368
  * @param {boolean} handleError Indica se di default gli errori devono essere gestiti dalla libreria o se devono essere ignorati
377
369
  */
378
- postGetFile(url, bodyData, filename, getFileCallback, afterGetFile = null, handleError = true, pars) {
370
+ async postGetFile(url, bodyData, filename, getFileCallback, afterGetFile = null, handleError = true, pars) {
379
371
  let myGuid = this.defaultStartCall(url);
380
- this.http.post(url, bodyData, { params: pars, headers: this.getHeaders(), observe: 'response', responseType: "blob" }).pipe(catchError((err, caught) => {
372
+ let locale = await this.bc.Locale.pipe(first()).toPromise();
373
+ this.http.post(url, bodyData, { params: pars, headers: this.getHeaders(locale), observe: 'response', responseType: "blob" }).pipe(catchError((err, caught) => {
381
374
  if (afterGetFile && !handleError)
382
375
  afterGetFile();
383
376
  return this.registerErrorAndReturnEmptyObservable(err, myGuid, handleError);
@@ -402,9 +395,10 @@ class HTTPService {
402
395
  * @param {Function} afterGetFile Callback da chiamare dopo aver gestito la risposta del **getFileCallback**, in caso **handleError** fosse **false** verrà richiamato anche in caso di errore
403
396
  * @param {boolean} handleError Indica se di default gli errori devono essere gestiti dalla libreria o se devono essere ignorati
404
397
  */
405
- getFile(url, params = null, filename, getFileCallback, afterGetFile = null, handleError = true) {
398
+ async getFile(url, params = null, filename, getFileCallback, afterGetFile = null, handleError = true) {
406
399
  let myGuid = this.defaultStartCall(url);
407
- this.http.get(url, { params: params, headers: this.getHeaders(), observe: 'response', responseType: "blob" }).pipe(catchError((err, caught) => {
400
+ let locale = await this.bc.Locale.pipe(first()).toPromise();
401
+ this.http.get(url, { params: params, headers: this.getHeaders(locale), observe: 'response', responseType: "blob" }).pipe(catchError((err, caught) => {
408
402
  if (afterGetFile && !handleError)
409
403
  afterGetFile();
410
404
  return this.registerErrorAndReturnEmptyObservable(err, myGuid, handleError);
@@ -444,24 +438,28 @@ class HTTPService {
444
438
  * @returns {Observable<Download>} Observable dei vari step di progresso del download
445
439
  */
446
440
  getFileWithProgress(url, params = null, getFileCallback) {
447
- let myGuid = this.defaultStartCall(url);
448
- return this.http.get(url, { responseType: 'blob', headers: this.getHeaders(), params: params, observe: 'events', reportProgress: true })
449
- .pipe(scan((previous, event) => {
450
- if (this.isHttpProgressEvent(event)) {
451
- let progress = event.total ? (event.loaded > event.total ? 100 : Math.round((100 * event.loaded) / event.total)) : previous.progress;
452
- return { progress: progress, state: 'IN_PROGRESS', content: null };
453
- }
454
- if (this.isHttpResponse(event)) {
455
- if (event.body) {
456
- let cdisp = event.headers.get('content-disposition');
457
- let cdispFilename = cdisp.split(';')[1].split('filename')[1].split('=')[1].trim().replace(/\"/g, '');
458
- let retUrl = window.URL.createObjectURL(event.body);
459
- getFileCallback(retUrl, cdispFilename);
441
+ return forkJoin({
442
+ myGuid: from([this.defaultStartCall(url)]),
443
+ locale: this.bc.Locale
444
+ }).pipe(concatMap((ret) => {
445
+ return this.http.get(url, { responseType: 'blob', headers: this.getHeaders(ret.locale), params: params, observe: 'events', reportProgress: true })
446
+ .pipe(scan((previous, event) => {
447
+ if (this.isHttpProgressEvent(event)) {
448
+ let progress = event.total ? (event.loaded > event.total ? 100 : Math.round((100 * event.loaded) / event.total)) : previous.progress;
449
+ return { progress: progress, state: 'IN_PROGRESS', content: null };
460
450
  }
461
- return { progress: 100, state: 'DONE', content: event.body };
462
- }
463
- return previous;
464
- }, { state: 'PENDING', progress: 0, content: null }), catchError((err, _) => { return this.registerErrorAndReturnEmptyObservable(err, myGuid); }), finalize(() => { this.tryFinalizeByGuid(myGuid); }));
451
+ if (this.isHttpResponse(event)) {
452
+ if (event.body) {
453
+ let cdisp = event.headers.get('content-disposition');
454
+ let cdispFilename = cdisp.split(';')[1].split('filename')[1].split('=')[1].trim().replace(/\"/g, '');
455
+ let retUrl = window.URL.createObjectURL(event.body);
456
+ getFileCallback(retUrl, cdispFilename);
457
+ }
458
+ return { progress: 100, state: 'DONE', content: event.body };
459
+ }
460
+ return previous;
461
+ }, { state: 'PENDING', progress: 0, content: null }), catchError((err, _) => { return this.registerErrorAndReturnEmptyObservable(err, ret.myGuid); }), finalize(() => { this.tryFinalizeByGuid(ret.myGuid); }));
462
+ }));
465
463
  }
466
464
  /**
467
465
  * Riconosce se l'evento HTTP è di tipo **HttpResponse** e, se sì, lo casta al tipo corretto per essere utilizzato correttamente nel blocco di codice successivo
@@ -599,7 +597,7 @@ class HTTPService {
599
597
  *
600
598
  * @returns {HttpHeaders} Header generati in base ai parametri
601
599
  */
602
- getHeaders(transactionId = "", includeAuth = true, contentType = "application/json", accept = "application/json") {
600
+ getHeaders(locale = 'it-IT', transactionId = "", includeAuth = true, contentType = "application/json", accept = "application/json") {
603
601
  var headers = new HttpHeaders();
604
602
  var authtoken = this.ExtensionsImpl.retrieveAccessToken();
605
603
  if (contentType)
@@ -610,7 +608,7 @@ class HTTPService {
610
608
  headers = headers.append("Authorization", "Bearer " + authtoken);
611
609
  if (accept)
612
610
  headers = headers.append("Accept", accept);
613
- headers = headers.append("Accept-Language", this.LOCALE ?? 'it-IT');
611
+ headers = headers.append("Accept-Language", locale);
614
612
  return headers;
615
613
  }
616
614
  /**
@@ -866,17 +864,15 @@ class HTTPService {
866
864
  * @returns {string} Messaggio localizzato
867
865
  */
868
866
  loc(message) {
869
- if (!Loc[message]) {
870
- console.warn("Untranslated message: " + message);
871
- return "";
872
- }
873
- return Loc[message][this.LOCALE];
867
+ // Togliamo velocemente ste localizzazioni inutili....
868
+ return message;
874
869
  }
875
870
  }
876
- HTTPService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPService, deps: [{ token: HttpServiceExtensions }, { token: HTTP_INVALIDATION, optional: true }, { token: HTTP_LOCALE, optional: true }, { token: APP_NAME, optional: true }, { token: CLIENT_CACHE_DURATION_S, optional: true }, { token: CACHE_BY_USER, optional: true }, { token: DEBUG_MODE, optional: true }, { token: i2.HttpClient }, { token: i3.CacheService }, { token: i4.UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
877
- HTTPService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPService });
871
+ HTTPService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPService, deps: [{ token: HttpServiceExtensions }, { token: HTTP_INVALIDATION, optional: true }, { token: APP_NAME, optional: true }, { token: CLIENT_CACHE_DURATION_S, optional: true }, { token: CACHE_BY_USER, optional: true }, { token: DEBUG_MODE, optional: true }, { token: i2.BaseLocalization }, { token: i3.HttpClient }, { token: i4.CacheService }, { token: i5.UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
872
+ HTTPService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPService, providedIn: 'root' });
878
873
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HTTPService, decorators: [{
879
- type: Injectable
874
+ type: Injectable,
875
+ args: [{ providedIn: 'root' }]
880
876
  }], ctorParameters: function () { return [{ type: HttpServiceExtensions }, { type: undefined, decorators: [{
881
877
  type: Optional
882
878
  }, {
@@ -884,11 +880,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
884
880
  args: [HTTP_INVALIDATION]
885
881
  }] }, { type: undefined, decorators: [{
886
882
  type: Optional
887
- }, {
888
- type: Inject,
889
- args: [HTTP_LOCALE]
890
- }] }, { type: undefined, decorators: [{
891
- type: Optional
892
883
  }, {
893
884
  type: Inject,
894
885
  args: [APP_NAME]
@@ -907,18 +898,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
907
898
  }, {
908
899
  type: Inject,
909
900
  args: [DEBUG_MODE]
910
- }] }, { type: i2.HttpClient }, { type: i3.CacheService }, { type: i4.UtilityService }]; } });
901
+ }] }, { type: i2.BaseLocalization }, { type: i3.HttpClient }, { type: i4.CacheService }, { type: i5.UtilityService }]; } });
911
902
 
912
903
  class HttpserviceModule {
913
904
  static forRoot(config) {
914
905
  return {
915
906
  ngModule: HttpserviceModule,
916
907
  providers: [
917
- HTTPService,
918
- HttpServiceExtensions,
919
908
  { provide: HTTP_INVALIDATION, useValue: config?.httpInvalidation },
920
909
  { provide: CLIENT_CACHE_DURATION_S, useValue: config?.clientCacheDurationS },
921
- { provide: HTTP_LOCALE, useValue: config?.httpLocale || 'it-IT' },
922
910
  { provide: APP_NAME, useValue: config?.appName },
923
911
  { provide: CACHE_BY_USER, useValue: config?.cacheByUser },
924
912
  { provide: DEBUG_MODE, useValue: config?.debugMode }