dts-backoffice-util 20.0.0 → 20.1.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/README.md CHANGED
@@ -12,8 +12,8 @@ Segue abaixo as últimas versões da Biblioteca, conforme a versão do PO-UI e A
12
12
 
13
13
  | PO-UI | Angular | Versão dtsBackofficeUtil |
14
14
  |-|-|-|
15
- | v20 | v20 | 20.0.0 |
16
- | v19 | v19 | 19.4.0 |
15
+ | v20 | v20 | 20.1.0 |
16
+ | v19 | v19 | 19.5.0 |
17
17
  | v18 | v18 | 18.3.0 |
18
18
  | v17 | v17 | 17.1.0 |
19
19
  | v16 | v16 | 16.1.0 |
@@ -1555,6 +1555,9 @@ class TotvsScheduleExecutionService {
1555
1555
  }
1556
1556
  createExecution(parameters, loading) {
1557
1557
  const params = JSON.parse(JSON.stringify(parameters).replace(/\\\\/g, '*|'));
1558
+ if (params) {
1559
+ params.svUuidToken = this.getUuidAccessToken();
1560
+ }
1558
1561
  if (loading) {
1559
1562
  return this.http.post(`${this.urlJobScheduler}`, params, this.headers);
1560
1563
  }
@@ -1565,55 +1568,49 @@ class TotvsScheduleExecutionService {
1565
1568
  createExecutionForNow(executionParams, loading) {
1566
1569
  let jobScheduleParams;
1567
1570
  const date = new Date();
1568
- const params = JSON.parse(JSON.stringify(executionParams).replace(/\\\\/g, '*|'));
1569
- if (!params.programEMS5) {
1570
- params.programEMS5 = false;
1571
+ if (!executionParams.programEMS5) {
1572
+ executionParams.programEMS5 = false;
1571
1573
  }
1572
- if (!params.programStyle) {
1573
- params.programStyle = 0;
1574
+ if (!executionParams.programStyle) {
1575
+ executionParams.programStyle = 0;
1574
1576
  }
1575
- if (!params.programVersion) {
1576
- params.programVersion = '';
1577
+ if (!executionParams.programVersion) {
1578
+ executionParams.programVersion = '';
1577
1579
  }
1578
- if (!params.businessParams || params.businessParams.length === 0) {
1579
- params.businessParams = [{ chave: '', valor: '' }];
1580
+ if (!executionParams.businessParams || executionParams.businessParams.length === 0) {
1581
+ executionParams.businessParams = [{ chave: '', valor: '' }];
1580
1582
  }
1581
1583
  jobScheduleParams = {};
1582
1584
  jobScheduleParams.status = 'active';
1583
- jobScheduleParams.processID = params.programName;
1585
+ jobScheduleParams.processID = executionParams.programName;
1584
1586
  jobScheduleParams.firstExecution = `${date.getFullYear()}-${(date.getMonth() + 1)}-${date.getDate()}T${this.addZero(date.getHours())}:${this.addZero(date.getMinutes())}:00.000Z`;
1585
1587
  jobScheduleParams.recurrent = false;
1586
1588
  jobScheduleParams.executionParameter = {
1587
1589
  parametros: [
1588
- { chave: 'rpwServer', valor: params.executionServer },
1589
- { chave: 'RPW_PROGRAM', valor: params.externalName },
1590
- { chave: 'RPW_PRG_EMS5', valor: params.programEMS5 ? 'yes' : 'no' },
1591
- { chave: 'RPW_PRG_ESTILO', valor: params.programStyle },
1592
- { chave: 'RPW_PRG_VERS', valor: params.programVersion },
1593
- { parametros_negocio: params.businessParams }
1590
+ { chave: 'rpwServer', valor: executionParams.executionServer },
1591
+ { chave: 'RPW_PROGRAM', valor: executionParams.externalName },
1592
+ { chave: 'RPW_PRG_EMS5', valor: executionParams.programEMS5 ? 'yes' : 'no' },
1593
+ { chave: 'RPW_PRG_ESTILO', valor: executionParams.programStyle },
1594
+ { chave: 'RPW_PRG_VERS', valor: executionParams.programVersion },
1595
+ { parametros_negocio: executionParams.businessParams }
1594
1596
  ]
1595
1597
  };
1596
- if (params.paramDigitDef && params.paramDigitDef.length > 0) {
1598
+ if (executionParams.paramDigitDef && executionParams.paramDigitDef.length > 0) {
1597
1599
  jobScheduleParams.executionParameter.parametros.push({
1598
- param_digita_def: params.paramDigitDef
1600
+ param_digita_def: executionParams.paramDigitDef
1599
1601
  });
1600
1602
  }
1601
- if (params.paramDigitData && params.paramDigitData.length > 0) {
1603
+ if (executionParams.paramDigitData && executionParams.paramDigitData.length > 0) {
1602
1604
  jobScheduleParams.executionParameter.parametros.push({
1603
- param_digita_dados: params.paramDigitData
1605
+ param_digita_dados: executionParams.paramDigitData
1604
1606
  });
1605
1607
  }
1606
- if (params.paramSelections && params.paramSelections.length > 0) {
1608
+ if (executionParams.paramSelections && executionParams.paramSelections.length > 0) {
1607
1609
  jobScheduleParams.executionParameter.parametros.push({
1608
- selecoes: params.paramSelections
1610
+ selecoes: executionParams.paramSelections
1609
1611
  });
1610
1612
  }
1611
- if (loading) {
1612
- return this.http.post(`${this.urlJobScheduler}`, jobScheduleParams, this.headers);
1613
- }
1614
- else {
1615
- return this.http.post(`${this.urlJobScheduler}`, jobScheduleParams);
1616
- }
1613
+ return this.createExecution(jobScheduleParams, loading);
1617
1614
  }
1618
1615
  getExecutionByJobScheduleID(jobScheduleID, loading = false) {
1619
1616
  const url = `${this.urlJobExecution}?jobScheduleID=${jobScheduleID}`;
@@ -1728,6 +1725,18 @@ class TotvsScheduleExecutionService {
1728
1725
  }
1729
1726
  return str;
1730
1727
  }
1728
+ getUuidAccessToken() {
1729
+ let tokenService = localStorage.getItem('token-service.token');
1730
+ if (tokenService) {
1731
+ let jsonTokenService = JSON.parse(tokenService);
1732
+ let accessToken = jsonTokenService['access_token'];
1733
+ let payload = accessToken.split(".");
1734
+ let decodedAccessToken = atob(payload[1]);
1735
+ let jsonDecodedAccessToken = JSON.parse(decodedAccessToken);
1736
+ return jsonDecodedAccessToken['jti'];
1737
+ }
1738
+ return '';
1739
+ }
1731
1740
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: TotvsScheduleExecutionService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
1732
1741
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: TotvsScheduleExecutionService }); }
1733
1742
  }