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.
@@ -491,6 +491,9 @@ class Utilities {
491
491
  return bytes;
492
492
  }
493
493
  jsonToEncrypt(object) {
494
+ return this.criptografar(JSON.stringify(object));
495
+ }
496
+ encryptQueryString(object) {
494
497
  return this.criptografar(unescape(JSON.stringify(object)));
495
498
  }
496
499
  decryptToJson(value) {
@@ -689,12 +692,12 @@ class InfoDataService {
689
692
  }
690
693
  getNoToken(controller, method, param) {
691
694
  return this._http
692
- .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' })
695
+ .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' })
693
696
  .pipe(map(r => new InfoDataAccessModel(this._utilities.decryptToJson(r))), catchError((e) => this.errorHandling(e)));
694
697
  }
695
698
  get(controller, method, param) {
696
699
  return this._http
697
- .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' })
700
+ .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' })
698
701
  .pipe(map(r => new InfoDataAccessModel(this._utilities.decryptToJson(r))), catchError((e) => this.errorHandling(e)));
699
702
  }
700
703
  getById(controller, id) {
@@ -716,7 +719,7 @@ class InfoDataService {
716
719
  if (id == undefined || id == null)
717
720
  alert('Id não informado');
718
721
  return this._http
719
- .delete(this.getAPIUrl(controller) + this.getMethod(method || '') + "?" + encodeURIComponent(this._utilities.jsonToEncrypt("id=" + id.toString())), { headers: this.getHeaderToken(), responseType: 'text' })
722
+ .delete(this.getAPIUrl(controller) + this.getMethod(method || '') + "?" + encodeURIComponent(this._utilities.encryptQueryString("id=" + id.toString())), { headers: this.getHeaderToken(), responseType: 'text' })
720
723
  .pipe(map(r => new InfoDataAccessModel(this._utilities.decryptToJson(r))), catchError((e) => this.errorHandling(e)));
721
724
  }
722
725
  deleteByModel(controller, model, method) {
@@ -733,7 +736,7 @@ class InfoDataService {
733
736
  for (let index = 0; index < model.length; index++)
734
737
  formData.append(model[index].name, model[index]);
735
738
  return this._http
736
- .request('POST', this.getAPIUrl(controller) + this.getMethod(method || '') + (param == null ? '' : ('?' + encodeURIComponent(this._utilities.jsonToEncrypt(param)))), { headers: this.getHeaderToken(), body: formData, responseType: 'text' })
739
+ .request('POST', this.getAPIUrl(controller) + this.getMethod(method || '') + (param == null ? '' : ('?' + encodeURIComponent(this._utilities.encryptQueryString(param)))), { headers: this.getHeaderToken(), body: formData, responseType: 'text' })
737
740
  .pipe(map(r => new InfoDataAccessModel(this._utilities.decryptToJson(r))), catchError((e) => this.errorHandling(e)));
738
741
  }
739
742
  errorHandling(e, redirect = true) {
@@ -747,7 +750,7 @@ class InfoDataService {
747
750
  getMethod(method) {
748
751
  if (method == null || method.trim() == '' || method.indexOf('?') < 0)
749
752
  return method !== null && method !== void 0 ? method : '';
750
- return method.substring(0, method.indexOf('?')) + '?' + encodeURIComponent(this._utilities.jsonToEncrypt(method.substring(method.indexOf('?') + 1).replace(/null/g, '').replace(/undefined/g, '')));
753
+ return method.substring(0, method.indexOf('?')) + '?' + encodeURIComponent(this._utilities.encryptQueryString(method.substring(method.indexOf('?') + 1).replace(/null/g, '').replace(/undefined/g, '')));
751
754
  }
752
755
  }
753
756
  /** @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)); };
@@ -1288,7 +1291,7 @@ class InfoAuthenticationService {
1288
1291
  }
1289
1292
  getPermissions(url, logAtividade = false) {
1290
1293
  return this._http
1291
- .get(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/getpermissao?' + encodeURIComponent(this._utilities.jsonToEncrypt('url=' + url + '&logatividade=' + logAtividade.toString())), { headers: this._dataService.getHeaderToken(), responseType: 'text' })
1294
+ .get(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/getpermissao?' + encodeURIComponent(this._utilities.encryptQueryString('url=' + url + '&logatividade=' + logAtividade.toString())), { headers: this._dataService.getHeaderToken(), responseType: 'text' })
1292
1295
  .pipe(map((rs) => {
1293
1296
  var r = this._utilities.decryptToJson(rs);
1294
1297
  return new InfoLoginModel(r.Success, r.Messages, r.Data);
@@ -1378,7 +1381,7 @@ class InfoAuthenticationService {
1378
1381
  }
1379
1382
  validaSessao(url) {
1380
1383
  return this._http
1381
- .get(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/validasessao?' + encodeURIComponent(this._utilities.jsonToEncrypt('url=' + url)), { headers: this._dataService.getHeaderToken(), responseType: 'text' })
1384
+ .get(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/validasessao?' + encodeURIComponent(this._utilities.encryptQueryString('url=' + url)), { headers: this._dataService.getHeaderToken(), responseType: 'text' })
1382
1385
  .pipe(map((rs) => {
1383
1386
  var r = this._utilities.decryptToJson(rs);
1384
1387
  return new InfoLoginModel(r === true, '', r);