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