@esfaenza/httpservice 11.2.46 → 11.2.47
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/esfaenza-httpservice.umd.js +62 -64
- package/bundles/esfaenza-httpservice.umd.js.map +1 -1
- package/bundles/esfaenza-httpservice.umd.min.js +2 -2
- package/bundles/esfaenza-httpservice.umd.min.js.map +1 -1
- package/esm2015/lib/httpservice.service.js +65 -67
- package/fesm2015/esfaenza-httpservice.js +64 -66
- package/fesm2015/esfaenza-httpservice.js.map +1 -1
- package/package.json +1 -1
|
@@ -557,25 +557,27 @@
|
|
|
557
557
|
if (transaction === void 0) { transaction = ""; }
|
|
558
558
|
if (succesfulResultMandatory === void 0) { succesfulResultMandatory = true; }
|
|
559
559
|
if (errorCallback === void 0) { errorCallback = null; }
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
var httpCall = this.http.get(cachedInfos.finalUrl, { headers: this.getHeaders(transaction), params: params });
|
|
567
|
-
return httpCall.pipe(operators.map(function (res) {
|
|
568
|
-
var responseItem = res;
|
|
569
|
-
if (cachedInfos.cache) {
|
|
570
|
-
_this.cacheResponse(_this.utisExts.deepClone(responseItem), cachedInfos);
|
|
571
|
-
_this.log(_this.loc("Cached result for") + " " + url);
|
|
560
|
+
// TODO provare e testare
|
|
561
|
+
return rxjs.from(this.defaultStartCall(url)).pipe(operators.concatMap(function (myGuid) {
|
|
562
|
+
var cachedInfos = _this.tryGetCacheInformations(url, params);
|
|
563
|
+
if (cachedInfos.cache && cachedInfos.cacheItem) {
|
|
564
|
+
_this.log(_this.loc("Result for") + " " + url + " " + _this.loc("retrieved from cache"));
|
|
565
|
+
return rxjs.of(cachedInfos.cacheItem).pipe(operators.delay(0), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid); }));
|
|
572
566
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
567
|
+
var httpCall = _this.http.get(cachedInfos.finalUrl, { headers: _this.getHeaders(transaction), params: params });
|
|
568
|
+
return httpCall.pipe(operators.map(function (res) {
|
|
569
|
+
var responseItem = res;
|
|
570
|
+
if (cachedInfos.cache) {
|
|
571
|
+
_this.cacheResponse(_this.utisExts.deepClone(responseItem), cachedInfos);
|
|
572
|
+
_this.log(_this.loc("Cached result for") + " " + url);
|
|
573
|
+
}
|
|
574
|
+
return responseItem;
|
|
575
|
+
}), operators.catchError(function (err, caught) {
|
|
576
|
+
if (errorCallback)
|
|
577
|
+
errorCallback();
|
|
578
|
+
return !succesfulResultMandatory ? rxjs.throwError(err) : _this.registerErrorAndReturnEmptyObservable(err, myGuid);
|
|
579
|
+
}), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid, cachedInfos); }));
|
|
580
|
+
}));
|
|
579
581
|
};
|
|
580
582
|
/**
|
|
581
583
|
* Esecuzione di una GET HTTP con eventualmente la gestione della cache qualora la chiamata termini con la convenzione "#cache"
|
|
@@ -599,24 +601,25 @@
|
|
|
599
601
|
if (transaction === void 0) { transaction = ""; }
|
|
600
602
|
if (succesfulResultMandatory === void 0) { succesfulResultMandatory = true; }
|
|
601
603
|
if (errorCallback === void 0) { errorCallback = null; }
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
var httpCall = this.http.get(cachedInfos.finalUrl, { responseType: type, headers: this.getHeaders(transaction), params: params });
|
|
609
|
-
return httpCall.pipe(operators.map(function (blob) {
|
|
610
|
-
if (cachedInfos.cache) {
|
|
611
|
-
_this.cacheResponse(blob, cachedInfos);
|
|
612
|
-
_this.log(_this.loc("Cached result for") + " " + url);
|
|
604
|
+
return rxjs.from(this.defaultStartCall(url)).pipe(operators.concatMap(function (myGuid) {
|
|
605
|
+
var cachedInfos = _this.tryGetCacheInformations(url, params);
|
|
606
|
+
if (cachedInfos.cache && cachedInfos.cacheItem) {
|
|
607
|
+
_this.log(_this.loc("Result for") + " " + url + " " + _this.loc("retrieved from cache"));
|
|
608
|
+
return rxjs.of(cachedInfos.cacheItem).pipe(operators.delay(0), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid); }));
|
|
613
609
|
}
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
610
|
+
var httpCall = _this.http.get(cachedInfos.finalUrl, { responseType: type, headers: _this.getHeaders(transaction), params: params });
|
|
611
|
+
return httpCall.pipe(operators.map(function (blob) {
|
|
612
|
+
if (cachedInfos.cache) {
|
|
613
|
+
_this.cacheResponse(blob, cachedInfos);
|
|
614
|
+
_this.log(_this.loc("Cached result for") + " " + url);
|
|
615
|
+
}
|
|
616
|
+
return blob;
|
|
617
|
+
}), operators.catchError(function (err, caught) {
|
|
618
|
+
if (errorCallback)
|
|
619
|
+
errorCallback();
|
|
620
|
+
return !succesfulResultMandatory ? rxjs.throwError(err) : _this.registerErrorAndReturnEmptyObservable(err, myGuid);
|
|
621
|
+
}), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid, cachedInfos); }));
|
|
622
|
+
}));
|
|
620
623
|
};
|
|
621
624
|
/**
|
|
622
625
|
* Esecuzione di una POST HTTP
|
|
@@ -635,14 +638,12 @@
|
|
|
635
638
|
if (params === void 0) { params = null; }
|
|
636
639
|
if (transaction === void 0) { transaction = ""; }
|
|
637
640
|
if (succesfulResultMandatory === void 0) { succesfulResultMandatory = true; }
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
})
|
|
644
|
-
return !succesfulResultMandatory ? rxjs.throwError(err) : _this.registerErrorAndReturnEmptyObservable(err, myGuid);
|
|
645
|
-
}), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid); }));
|
|
641
|
+
return rxjs.from(this.defaultStartCall(url)).pipe(operators.concatMap(function (myGuid) {
|
|
642
|
+
var httpCall = _this.http.post(url, bodyData, { headers: _this.getHeaders(transaction), params: params });
|
|
643
|
+
return httpCall.pipe(operators.catchError(function (err, caught) {
|
|
644
|
+
return !succesfulResultMandatory ? rxjs.throwError(err) : _this.registerErrorAndReturnEmptyObservable(err, myGuid);
|
|
645
|
+
}), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid); }));
|
|
646
|
+
}));
|
|
646
647
|
};
|
|
647
648
|
/**
|
|
648
649
|
* Esecuzione di una DELETE HTTP
|
|
@@ -660,14 +661,12 @@
|
|
|
660
661
|
if (params === void 0) { params = null; }
|
|
661
662
|
if (transaction === void 0) { transaction = ""; }
|
|
662
663
|
if (succesfulResultMandatory === void 0) { succesfulResultMandatory = true; }
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
})
|
|
669
|
-
return !succesfulResultMandatory ? rxjs.throwError(err) : _this.registerErrorAndReturnEmptyObservable(err, myGuid);
|
|
670
|
-
}), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid); }));
|
|
664
|
+
return rxjs.from(this.defaultStartCall(url)).pipe(operators.concatMap(function (myGuid) {
|
|
665
|
+
var httpCall = _this.http.delete(url, { headers: _this.getHeaders(transaction), params: params });
|
|
666
|
+
return httpCall.pipe(operators.catchError(function (err, caught) {
|
|
667
|
+
return !succesfulResultMandatory ? rxjs.throwError(err) : _this.registerErrorAndReturnEmptyObservable(err, myGuid);
|
|
668
|
+
}), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid); }));
|
|
669
|
+
}));
|
|
671
670
|
};
|
|
672
671
|
/**
|
|
673
672
|
* Esecuzione di una PUT HTTP
|
|
@@ -686,14 +685,12 @@
|
|
|
686
685
|
if (params === void 0) { params = null; }
|
|
687
686
|
if (transaction === void 0) { transaction = ""; }
|
|
688
687
|
if (succesfulResultMandatory === void 0) { succesfulResultMandatory = true; }
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
})
|
|
695
|
-
return !succesfulResultMandatory ? rxjs.throwError(err) : _this.registerErrorAndReturnEmptyObservable(err, myGuid);
|
|
696
|
-
}), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid); }));
|
|
688
|
+
return rxjs.from(this.defaultStartCall(url)).pipe(operators.concatMap(function (myGuid) {
|
|
689
|
+
var httpCall = _this.http.put(url, bodyData, { headers: _this.getHeaders(transaction), params: params });
|
|
690
|
+
return httpCall.pipe(operators.catchError(function (err, caught) {
|
|
691
|
+
return !succesfulResultMandatory ? rxjs.throwError(err) : _this.registerErrorAndReturnEmptyObservable(err, myGuid);
|
|
692
|
+
}), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid); }));
|
|
693
|
+
}));
|
|
697
694
|
};
|
|
698
695
|
/**
|
|
699
696
|
* Esecuzione di una POST HTTP
|
|
@@ -708,11 +705,12 @@
|
|
|
708
705
|
*/
|
|
709
706
|
HTTPService.prototype.postwithFiles = function (url, bodyData, fileArrayOrFile) {
|
|
710
707
|
var _this = this;
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
708
|
+
return rxjs.from(this.defaultStartCall(url)).pipe(operators.concatMap(function (myGuid) {
|
|
709
|
+
var formData = _this.getFilesFormData(fileArrayOrFile);
|
|
710
|
+
formData.append("body", JSON.stringify(bodyData));
|
|
711
|
+
var httpCall = _this.http.post(url, formData, { headers: _this.getHeaders(null, true, null, null) });
|
|
712
|
+
return httpCall.pipe(operators.catchError(function (err, caught) { return _this.registerErrorAndReturnEmptyObservable(err, myGuid); }), operators.finalize(function () { _this.tryFinalizeByGuid(myGuid); }));
|
|
713
|
+
}));
|
|
716
714
|
};
|
|
717
715
|
/**
|
|
718
716
|
* Esecuzione di una POST HTTP
|