info-library 2.14.56 → 2.14.57

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.
@@ -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.jsonToEncrypt(param.replace(/null/g, '').replace(/undefined/g, ''))))), { headers: this.getHeaderDefault(), responseType: 'text' })
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.jsonToEncrypt(param.replace(/null/g, '').replace(/undefined/g, ''))))), { headers: this.getHeaderToken(), responseType: 'text' })
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.jsonToEncrypt("id=" + id.toString())), { headers: this.getHeaderToken(), responseType: 'text' })
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.jsonToEncrypt(param)))), { headers: this.getHeaderToken(), body: formData, responseType: 'text' })
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.jsonToEncrypt(method.substring(method.indexOf('?') + 1).replace(/null/g, '').replace(/undefined/g, '')));
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)); };
@@ -1234,7 +1237,7 @@ class InfoAuthenticationService {
1234
1237
  }
1235
1238
  getPermissions(url, logAtividade = false) {
1236
1239
  return this._http
1237
- .get(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/getpermissao?' + encodeURIComponent(this._utilities.jsonToEncrypt('url=' + url + '&logatividade=' + logAtividade.toString())), { headers: this._dataService.getHeaderToken(), responseType: 'text' })
1240
+ .get(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/getpermissao?' + encodeURIComponent(this._utilities.encryptQueryString('url=' + url + '&logatividade=' + logAtividade.toString())), { headers: this._dataService.getHeaderToken(), responseType: 'text' })
1238
1241
  .pipe(map((rs) => {
1239
1242
  var r = this._utilities.decryptToJson(rs);
1240
1243
  return new InfoLoginModel(r.Success, r.Messages, r.Data);
@@ -1324,7 +1327,7 @@ class InfoAuthenticationService {
1324
1327
  }
1325
1328
  validaSessao(url) {
1326
1329
  return this._http
1327
- .get(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/validasessao?' + encodeURIComponent(this._utilities.jsonToEncrypt('url=' + url)), { headers: this._dataService.getHeaderToken(), responseType: 'text' })
1330
+ .get(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/validasessao?' + encodeURIComponent(this._utilities.encryptQueryString('url=' + url)), { headers: this._dataService.getHeaderToken(), responseType: 'text' })
1328
1331
  .pipe(map((rs) => {
1329
1332
  var r = this._utilities.decryptToJson(rs);
1330
1333
  return new InfoLoginModel(r === true, '', r);