info-library 2.14.56 → 2.14.57-beta.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/esm2020/service/data.service.mjs +6 -6
- package/esm2020/utils/utilities.mjs +4 -1
- package/fesm2015/info-library.mjs +8 -5
- package/fesm2015/info-library.mjs.map +1 -1
- package/fesm2020/info-library.mjs +8 -5
- package/fesm2020/info-library.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/utilities.d.ts +1 -0
|
@@ -480,6 +480,9 @@ class Utilities {
|
|
|
480
480
|
return bytes;
|
|
481
481
|
}
|
|
482
482
|
jsonToEncrypt(object) {
|
|
483
|
+
return this.criptografar(JSON.stringify(object));
|
|
484
|
+
}
|
|
485
|
+
encryptQueryString(object) {
|
|
483
486
|
return this.criptografar(unescape(JSON.stringify(object)));
|
|
484
487
|
}
|
|
485
488
|
decryptToJson(value) {
|
|
@@ -676,12 +679,12 @@ class InfoDataService {
|
|
|
676
679
|
}
|
|
677
680
|
getNoToken(controller, method, param) {
|
|
678
681
|
return this._http
|
|
679
|
-
.get(this.getAPIUrl(controller) + this.getMethod(method || '') + (param == null ? '' : ('?' + encodeURIComponent(this._utilities.
|
|
682
|
+
.get(this.getAPIUrl(controller) + this.getMethod(method || '') + (param == null ? '' : ('?' + encodeURIComponent(this._utilities.encryptQueryString(param.replace(/null/g, '').replace(/undefined/g, ''))))), { headers: this.getHeaderDefault(), responseType: 'text' })
|
|
680
683
|
.pipe(map(r => new InfoDataAccessModel(this._utilities.decryptToJson(r))), catchError((e) => this.errorHandling(e)));
|
|
681
684
|
}
|
|
682
685
|
get(controller, method, param) {
|
|
683
686
|
return this._http
|
|
684
|
-
.get(this.getAPIUrl(controller) + this.getMethod(method || '') + (param == null ? '' : ('?' + encodeURIComponent(this._utilities.
|
|
687
|
+
.get(this.getAPIUrl(controller) + this.getMethod(method || '') + (param == null ? '' : ('?' + encodeURIComponent(this._utilities.encryptQueryString(param.replace(/null/g, '').replace(/undefined/g, ''))))), { headers: this.getHeaderToken(), responseType: 'text' })
|
|
685
688
|
.pipe(map(r => new InfoDataAccessModel(this._utilities.decryptToJson(r))), catchError((e) => this.errorHandling(e)));
|
|
686
689
|
}
|
|
687
690
|
getById(controller, id) {
|
|
@@ -703,7 +706,7 @@ class InfoDataService {
|
|
|
703
706
|
if (id == undefined || id == null)
|
|
704
707
|
alert('Id não informado');
|
|
705
708
|
return this._http
|
|
706
|
-
.delete(this.getAPIUrl(controller) + this.getMethod(method || '') + "?" + encodeURIComponent(this._utilities.
|
|
709
|
+
.delete(this.getAPIUrl(controller) + this.getMethod(method || '') + "?" + encodeURIComponent(this._utilities.encryptQueryString("id=" + id.toString())), { headers: this.getHeaderToken(), responseType: 'text' })
|
|
707
710
|
.pipe(map(r => new InfoDataAccessModel(this._utilities.decryptToJson(r))), catchError((e) => this.errorHandling(e)));
|
|
708
711
|
}
|
|
709
712
|
deleteByModel(controller, model, method) {
|
|
@@ -720,7 +723,7 @@ class InfoDataService {
|
|
|
720
723
|
for (let index = 0; index < model.length; index++)
|
|
721
724
|
formData.append(model[index].name, model[index]);
|
|
722
725
|
return this._http
|
|
723
|
-
.request('POST', this.getAPIUrl(controller) + this.getMethod(method || '') + (param == null ? '' : ('?' + encodeURIComponent(this._utilities.
|
|
726
|
+
.request('POST', this.getAPIUrl(controller) + this.getMethod(method || '') + (param == null ? '' : ('?' + encodeURIComponent(this._utilities.encryptQueryString(param)))), { headers: this.getHeaderToken(), body: formData, responseType: 'text' })
|
|
724
727
|
.pipe(map(r => new InfoDataAccessModel(this._utilities.decryptToJson(r))), catchError((e) => this.errorHandling(e)));
|
|
725
728
|
}
|
|
726
729
|
errorHandling(e, redirect = true) {
|
|
@@ -734,7 +737,7 @@ class InfoDataService {
|
|
|
734
737
|
getMethod(method) {
|
|
735
738
|
if (method == null || method.trim() == '' || method.indexOf('?') < 0)
|
|
736
739
|
return method ?? '';
|
|
737
|
-
return method.substring(0, method.indexOf('?')) + '?' + encodeURIComponent(this._utilities.
|
|
740
|
+
return method.substring(0, method.indexOf('?')) + '?' + encodeURIComponent(this._utilities.encryptQueryString(method.substring(method.indexOf('?') + 1).replace(/null/g, '').replace(/undefined/g, '')));
|
|
738
741
|
}
|
|
739
742
|
}
|
|
740
743
|
/** @nocollapse */ InfoDataService.ɵfac = function InfoDataService_Factory(t) { return new (t || InfoDataService)(i0.ɵɵinject(APICONTROLLER_CONFIG), i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i1$2.Router), i0.ɵɵinject(InfoPlatformModel), i0.ɵɵinject(Utilities)); };
|