@esfaenza/httpservice 11.2.56 → 11.2.58

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.
@@ -321,10 +321,6 @@
321
321
  * Durata della cache lato libreria dopo il quale la cache verrà ripulita
322
322
  */
323
323
  var CLIENT_CACHE_DURATION_S = new core.InjectionToken('CLIENT_CACHE_DURATION_S');
324
- /**
325
- * URL del Backend a cui inviare le chiamate
326
- */
327
- var BACKEND_URL = new core.InjectionToken('BACKEND_URL');
328
324
  /**
329
325
  * Locale della libreria per messaggi d'errore ed Header di default "Accept-Language". Sono supportati "it-IT" ed "en-US"
330
326
  */
@@ -471,9 +467,8 @@
471
467
  /**
472
468
  * @ignore
473
469
  */
474
- function HTTPService(BACKEND_URL, EXTENSION_CLASS, HTTP_INVALIDATION, LOCALE, APP_NAME, CLIENT_CACHE_DURATION_S, CACHE_BY_USER, DEBUG_MODE, http, localStorage, utisExts) {
470
+ function HTTPService(EXTENSION_CLASS, HTTP_INVALIDATION, LOCALE, APP_NAME, CLIENT_CACHE_DURATION_S, CACHE_BY_USER, DEBUG_MODE, http, localStorage, utisExts) {
475
471
  var _a, _b;
476
- this.BACKEND_URL = BACKEND_URL;
477
472
  this.EXTENSION_CLASS = EXTENSION_CLASS;
478
473
  this.HTTP_INVALIDATION = HTTP_INVALIDATION;
479
474
  this.LOCALE = LOCALE;
@@ -703,12 +698,13 @@
703
698
  *
704
699
  * @returns {Observable<T>} Observable che contiene il risultato della chiamata
705
700
  */
706
- HTTPService.prototype.postwithFiles = function (url, bodyData, fileArrayOrFile) {
701
+ HTTPService.prototype.postwithFiles = function (url, bodyData, fileArrayOrFile, params) {
707
702
  var _this = this;
703
+ if (params === void 0) { params = null; }
708
704
  return rxjs.from([this.defaultStartCall(url)]).pipe(operators.concatMap(function (myGuid) {
709
705
  var formData = _this.getFilesFormData(fileArrayOrFile);
710
706
  formData.append("body", JSON.stringify(bodyData));
711
- var httpCall = _this.http.post(url, formData, { headers: _this.getHeaders(null, true, null, null) });
707
+ var httpCall = _this.http.post(url, formData, { params: params, headers: _this.getHeaders(null, true, null, null) });
712
708
  return httpCall.pipe(operators.catchError(function (err, caught) { return _this.registerErrorAndReturnEmptyObservable(err, myGuid); }), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid); }));
713
709
  }));
714
710
  };
@@ -861,7 +857,8 @@
861
857
  var cache = this.localStorage.getLocalItem(this.localStorageHttpCacheKey);
862
858
  var tmp = /#cache(:?-(\d+))/gi.exec(url);
863
859
  var cacheTime = tmp ? tmp[2] : null;
864
- var normalizedUrl = url.replace("#cache" + (cacheTime ? "-" + cacheTime : ""), "").replace(this.BACKEND_URL, "");
860
+ var normalizedUrl_tmp = url.replace("#cache" + (cacheTime ? "-" + cacheTime : ""), "");
861
+ var normalizedUrl = normalizedUrl_tmp.substring(normalizedUrl_tmp.indexOf('/api'));
865
862
  if (!cache || !this.HTTP_INVALIDATION || !this.HTTP_INVALIDATION[normalizedUrl])
866
863
  return;
867
864
  var apisToInvalidate = this.HTTP_INVALIDATION[normalizedUrl];
@@ -1289,7 +1286,6 @@
1289
1286
  { type: core.Injectable }
1290
1287
  ];
1291
1288
  HTTPService.ctorParameters = function () { return [
1292
- { type: undefined, decorators: [{ type: core.Inject, args: [BACKEND_URL,] }] },
1293
1289
  { type: HttpServiceExtensions },
1294
1290
  { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [HTTP_INVALIDATION,] }] },
1295
1291
  { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [HTTP_LOCALE,] }] },
@@ -1313,7 +1309,6 @@
1313
1309
  HttpServiceExtensions,
1314
1310
  { provide: HTTP_INVALIDATION, useValue: config === null || config === void 0 ? void 0 : config.httpInvalidation },
1315
1311
  { provide: CLIENT_CACHE_DURATION_S, useValue: config === null || config === void 0 ? void 0 : config.clientCacheDurationS },
1316
- { provide: BACKEND_URL, useValue: config === null || config === void 0 ? void 0 : config.backendUrl },
1317
1312
  { provide: HTTP_LOCALE, useValue: (config === null || config === void 0 ? void 0 : config.httpLocale) || 'it-IT' },
1318
1313
  { provide: APP_NAME, useValue: config === null || config === void 0 ? void 0 : config.appName },
1319
1314
  { provide: CACHE_BY_USER, useValue: config === null || config === void 0 ? void 0 : config.cacheByUser },
@@ -1357,11 +1352,10 @@
1357
1352
  exports.HttpserviceModule = HttpserviceModule;
1358
1353
  exports["ɵa"] = HTTP_INVALIDATION;
1359
1354
  exports["ɵb"] = CLIENT_CACHE_DURATION_S;
1360
- exports["ɵc"] = BACKEND_URL;
1361
- exports["ɵd"] = HTTP_LOCALE;
1362
- exports["ɵe"] = APP_NAME;
1363
- exports["ɵf"] = CACHE_BY_USER;
1364
- exports["ɵg"] = DEBUG_MODE;
1355
+ exports["ɵc"] = HTTP_LOCALE;
1356
+ exports["ɵd"] = APP_NAME;
1357
+ exports["ɵe"] = CACHE_BY_USER;
1358
+ exports["ɵf"] = DEBUG_MODE;
1365
1359
 
1366
1360
  Object.defineProperty(exports, '__esModule', { value: true });
1367
1361