trm-core 8.3.1 → 8.4.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/changelog.txt +14 -0
- package/dist/actions/install/checkAlreadyInstalled.js +3 -3
- package/dist/actions/install/checkTransports.js +1 -0
- package/dist/actions/install/generateInstallTransport.js +12 -7
- package/dist/actions/install/importCustTransport.js +6 -3
- package/dist/actions/install/importDevcTransport.js +6 -3
- package/dist/actions/install/importLangTransport.js +6 -3
- package/dist/actions/install/importTadirTransport.js +3 -3
- package/dist/actions/install/index.d.ts +1 -1
- package/dist/actions/install/init.js +1 -1
- package/dist/actions/install/setInstallDevclass.js +21 -16
- package/dist/actions/publish/generateCustTransport.js +0 -2
- package/dist/actions/publish/generateLangTransport.js +0 -4
- package/dist/actions/publish/generateTadirTransport.js +0 -5
- package/dist/actions/publish/index.d.ts +1 -1
- package/dist/actions/publish/init.js +1 -3
- package/dist/actions/publish/releaseTransports.js +5 -3
- package/dist/actions/publish/setManifestValues.js +1 -0
- package/dist/client/RESTClient.d.ts +1 -0
- package/dist/client/RESTClient.js +11 -0
- package/dist/client/RFCClient.d.ts +1 -0
- package/dist/client/RFCClient.js +9 -0
- package/dist/client/components/SYDATUM.d.ts +1 -0
- package/dist/client/components/SYDATUM.js +2 -0
- package/dist/client/components/SYTIME.d.ts +1 -0
- package/dist/client/components/SYTIME.js +2 -0
- package/dist/client/components/TRTPSTEP.d.ts +1 -0
- package/dist/client/components/TRTPSTEP.js +2 -0
- package/dist/client/components/index.d.ts +3 -0
- package/dist/client/components/index.js +3 -0
- package/dist/client/struct/TPSTAT.d.ts +7 -0
- package/dist/client/struct/TPSTAT.js +2 -0
- package/dist/client/struct/index.d.ts +1 -0
- package/dist/client/struct/index.js +1 -0
- package/dist/commons/checkCoreTrmDependencies.d.ts +1 -1
- package/dist/commons/checkCoreTrmDependencies.js +2 -2
- package/dist/commons/fromAbapToDate.d.ts +1 -1
- package/dist/commons/fromAbapToDate.js +28 -1
- package/dist/commons/getAxiosInstance.js +11 -1
- package/dist/commons/getCoreTrmDependencies.d.ts +1 -1
- package/dist/commons/getCoreTrmDependencies.js +2 -2
- package/dist/commons/getNodePackage.d.ts +1 -1
- package/dist/commons/getNodePackage.js +4 -2
- package/dist/registry/RegistryV2.d.ts +2 -1
- package/dist/registry/RegistryV2.js +7 -4
- package/dist/systemConnector/ISystemConnector.d.ts +1 -0
- package/dist/systemConnector/ISystemConnectorBase.d.ts +1 -0
- package/dist/systemConnector/RESTSystemConnector.d.ts +1 -0
- package/dist/systemConnector/RESTSystemConnector.js +5 -0
- package/dist/systemConnector/RFCSystemConnector.d.ts +1 -0
- package/dist/systemConnector/RFCSystemConnector.js +5 -0
- package/dist/systemConnector/SystemConnector.d.ts +2 -0
- package/dist/systemConnector/SystemConnector.js +14 -0
- package/dist/systemConnector/SystemConnectorBase.d.ts +2 -0
- package/dist/systemConnector/SystemConnectorBase.js +106 -0
- package/dist/transport/Transport.d.ts +4 -4
- package/dist/transport/Transport.js +60 -38
- package/package.json +7 -4
|
@@ -14,14 +14,14 @@ const getCoreTrmDependencies_1 = require("./getCoreTrmDependencies");
|
|
|
14
14
|
const registry_1 = require("../registry");
|
|
15
15
|
const systemConnector_1 = require("../systemConnector");
|
|
16
16
|
const semver_1 = require("semver");
|
|
17
|
-
function checkCoreTrmDependencies(systemPackages) {
|
|
17
|
+
function checkCoreTrmDependencies(systemPackages, globalPath) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
var returnData = {
|
|
20
20
|
dependencies: [],
|
|
21
21
|
versionNotSatisfiedDependencies: [],
|
|
22
22
|
missingDependencies: []
|
|
23
23
|
};
|
|
24
|
-
const trmDependencies = (0, getCoreTrmDependencies_1.getCoreTrmDependencies)();
|
|
24
|
+
const trmDependencies = (0, getCoreTrmDependencies_1.getCoreTrmDependencies)(globalPath);
|
|
25
25
|
if (trmDependencies && Object.keys(trmDependencies).length > 0) {
|
|
26
26
|
const oPublicRegistry = registry_1.RegistryProvider.getRegistry();
|
|
27
27
|
if (!systemPackages) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AS4DATE, AS4TIME } from "../client";
|
|
2
|
-
export declare function fromAbapToDate(as4date: AS4DATE, as4time: AS4TIME): Date
|
|
2
|
+
export declare function fromAbapToDate(as4date: AS4DATE, as4time: AS4TIME): Promise<Date>;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.fromAbapToDate = fromAbapToDate;
|
|
4
|
-
|
|
13
|
+
const luxon_1 = require("luxon");
|
|
14
|
+
const systemConnector_1 = require("../systemConnector");
|
|
15
|
+
function fromAbapToDateLegacy(as4date, as4time) {
|
|
5
16
|
const aDate = Array.from(as4date);
|
|
6
17
|
const aTime = Array.from(as4time);
|
|
7
18
|
const year = parseInt(`${aDate[0]}${aDate[1]}${aDate[2]}${aDate[3]}`);
|
|
@@ -12,3 +23,19 @@ function fromAbapToDate(as4date, as4time) {
|
|
|
12
23
|
const seconds = parseInt(`${aTime[4]}${aTime[5]}`);
|
|
13
24
|
return new Date(year, month, day, hour, minutes, seconds);
|
|
14
25
|
}
|
|
26
|
+
function fromAbapToDate(as4date, as4time) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const ianaZone = yield systemConnector_1.SystemConnector.getTimezone();
|
|
29
|
+
const year = Number(as4date.slice(0, 4));
|
|
30
|
+
const month = Number(as4date.slice(4, 6));
|
|
31
|
+
const day = Number(as4date.slice(6, 8));
|
|
32
|
+
const hour = Number(as4time.slice(0, 2));
|
|
33
|
+
const minute = Number(as4time.slice(2, 4));
|
|
34
|
+
const second = Number(as4time.slice(4, 6));
|
|
35
|
+
const dt = luxon_1.DateTime.fromObject({ year, month, day, hour, minute, second }, { zone: ianaZone });
|
|
36
|
+
if (!dt.isValid) {
|
|
37
|
+
return fromAbapToDateLegacy(as4date, as4time);
|
|
38
|
+
}
|
|
39
|
+
return dt.toJSDate();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -48,7 +48,17 @@ function getAxiosInstance(config, sCtx, inj) {
|
|
|
48
48
|
const internalId = _getInternalId(response);
|
|
49
49
|
var sResponse = `status: ${response.status}, status text: ${response.statusText}`;
|
|
50
50
|
if (response.data) {
|
|
51
|
-
|
|
51
|
+
if (Buffer.isBuffer(response.data)) {
|
|
52
|
+
try {
|
|
53
|
+
sResponse += `, data: <file of ${response.data.byteLength} bytes>`;
|
|
54
|
+
}
|
|
55
|
+
catch (_a) {
|
|
56
|
+
sResponse += `, data: <file of unknown bytes>`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
sResponse += `, data: ${(0, util_1.inspect)(response.data, { breakLength: Infinity, compact: true })}`;
|
|
61
|
+
}
|
|
52
62
|
}
|
|
53
63
|
trm_commons_1.Logger.log(`Ending ${sCtx} AXIOS request ${internalId}: ${sResponse}`, true);
|
|
54
64
|
return response;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCoreTrmDependencies = getCoreTrmDependencies;
|
|
4
4
|
const getNodePackage_1 = require("./getNodePackage");
|
|
5
|
-
function getCoreTrmDependencies() {
|
|
6
|
-
const nodePackage = (0, getNodePackage_1.getNodePackage)();
|
|
5
|
+
function getCoreTrmDependencies(globalPath) {
|
|
6
|
+
const nodePackage = (0, getNodePackage_1.getNodePackage)(globalPath);
|
|
7
7
|
return nodePackage.trmDependencies || {};
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getNodePackage(packageName?: string): any;
|
|
1
|
+
export declare function getNodePackage(globalPath?: string, packageName?: string): any;
|
|
@@ -4,8 +4,10 @@ exports.getNodePackage = getNodePackage;
|
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const trm_commons_1 = require("trm-commons");
|
|
7
|
-
function getNodePackage(packageName) {
|
|
8
|
-
|
|
7
|
+
function getNodePackage(globalPath, packageName) {
|
|
8
|
+
if (!globalPath) {
|
|
9
|
+
globalPath = (0, trm_commons_1.getGlobalNodeModules)();
|
|
10
|
+
}
|
|
9
11
|
if (__dirname.includes(globalPath)) {
|
|
10
12
|
const parts = __dirname.split(node_path_1.sep);
|
|
11
13
|
const index = parts.lastIndexOf("node_modules");
|
|
@@ -6,12 +6,13 @@ export declare const PUBLIC_RESERVED_KEYWORD = "public";
|
|
|
6
6
|
export declare class RegistryV2 implements AbstractRegistry {
|
|
7
7
|
endpoint: string;
|
|
8
8
|
name: string;
|
|
9
|
+
private _coreVersion?;
|
|
9
10
|
private _cache;
|
|
10
11
|
private _registryType;
|
|
11
12
|
private _axiosInstance;
|
|
12
13
|
private _authData;
|
|
13
14
|
private _userAgent;
|
|
14
|
-
constructor(endpoint: string, name?: string);
|
|
15
|
+
constructor(endpoint: string, name?: string, _coreVersion?: string);
|
|
15
16
|
private getDefaultAxiosHeaders;
|
|
16
17
|
compare(registry: AbstractRegistry): boolean;
|
|
17
18
|
getRegistryType(): RegistryType;
|
|
@@ -61,9 +61,10 @@ const node_cache_1 = __importDefault(require("node-cache"));
|
|
|
61
61
|
const AXIOS_CTX = "RegistryV2";
|
|
62
62
|
exports.PUBLIC_RESERVED_KEYWORD = 'public';
|
|
63
63
|
class RegistryV2 {
|
|
64
|
-
constructor(endpoint, name = 'Unknown') {
|
|
64
|
+
constructor(endpoint, name = 'Unknown', _coreVersion) {
|
|
65
65
|
this.endpoint = endpoint;
|
|
66
66
|
this.name = name;
|
|
67
|
+
this._coreVersion = _coreVersion;
|
|
67
68
|
this._cache = new node_cache_1.default({ stdTTL: 60, useClones: false });
|
|
68
69
|
var envEndpoint = process.env.TRM_PUBLIC_REGISTRY_ENDPOINT;
|
|
69
70
|
trm_commons_1.Logger.log(`TRM_PUBLIC_REGISTRY_ENDPOINT Environment variable: ${envEndpoint}`, true);
|
|
@@ -102,11 +103,13 @@ class RegistryV2 {
|
|
|
102
103
|
var axiosHeaders = new axios_1.AxiosHeaders();
|
|
103
104
|
if (!this._userAgent) {
|
|
104
105
|
try {
|
|
105
|
-
this._userAgent = `trm-core v${(0, commons_1.getNodePackage)().version}`;
|
|
106
|
+
this._userAgent = `trm-core v${this._coreVersion || (0, commons_1.getNodePackage)().version}`;
|
|
107
|
+
}
|
|
108
|
+
catch (_a) {
|
|
109
|
+
this._userAgent = `trm-core with unknown version`;
|
|
106
110
|
}
|
|
107
|
-
catch (_a) { }
|
|
108
111
|
}
|
|
109
|
-
axiosHeaders.setUserAgent(this._userAgent
|
|
112
|
+
axiosHeaders.setUserAgent(this._userAgent);
|
|
110
113
|
return axiosHeaders;
|
|
111
114
|
}
|
|
112
115
|
compare(registry) {
|
|
@@ -65,4 +65,5 @@ export interface ISystemConnector extends ISystemConnectorBase {
|
|
|
65
65
|
createLogPolling: (event: components.ZTRM_POLLING_EVENT) => Promise<components.ZTRM_POLLING_ID>;
|
|
66
66
|
deleteLogPolling: (logID: components.ZTRM_POLLING_ID) => Promise<void>;
|
|
67
67
|
readLogPolling: (logID: components.ZTRM_POLLING_ID) => Promise<components.ZTRM_POLLING_LAST_MSG>;
|
|
68
|
+
getTransportImportStatus: (trkorr: components.TRKORR, system: components.TMSSYSNAM) => Promise<struct.TPSTAT>;
|
|
68
69
|
}
|
|
@@ -38,4 +38,5 @@ export interface ISystemConnectorBase {
|
|
|
38
38
|
getObjectDependencies: (object: components.TROBJTYPE, objName: components.SOBJ_NAME) => Promise<ObjectDependencies>;
|
|
39
39
|
getTableKeys: (tabname: components.TABNAME) => Promise<struct.DD03L[]>;
|
|
40
40
|
getRootDevclass: (devclass: components.DEVCLASS) => Promise<components.DEVCLASS>;
|
|
41
|
+
getTimezone: () => Promise<string>;
|
|
41
42
|
}
|
|
@@ -88,4 +88,5 @@ export declare class RESTSystemConnector extends SystemConnectorBase implements
|
|
|
88
88
|
createLogPolling(event: components.ZTRM_POLLING_EVENT): Promise<components.ZTRM_POLLING_ID>;
|
|
89
89
|
deleteLogPolling(logID: components.ZTRM_POLLING_ID): Promise<void>;
|
|
90
90
|
readLogPolling(logID: components.ZTRM_POLLING_ID): Promise<components.ZTRM_POLLING_LAST_MSG>;
|
|
91
|
+
getTransportImportStatus(trkorr: components.TRKORR, system: components.TMSSYSNAM): Promise<struct.TPSTAT>;
|
|
91
92
|
}
|
|
@@ -363,5 +363,10 @@ class RESTSystemConnector extends SystemConnectorBase_1.SystemConnectorBase {
|
|
|
363
363
|
return this._client.readLogPolling(logID);
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
|
+
getTransportImportStatus(trkorr, system) {
|
|
367
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
368
|
+
return this._client.getTransportImportStatus(trkorr, system);
|
|
369
|
+
});
|
|
370
|
+
}
|
|
366
371
|
}
|
|
367
372
|
exports.RESTSystemConnector = RESTSystemConnector;
|
|
@@ -86,4 +86,5 @@ export declare class RFCSystemConnector extends SystemConnectorBase implements I
|
|
|
86
86
|
createLogPolling(event: components.ZTRM_POLLING_EVENT): Promise<components.ZTRM_POLLING_ID>;
|
|
87
87
|
deleteLogPolling(logID: components.ZTRM_POLLING_ID): Promise<void>;
|
|
88
88
|
readLogPolling(logID: components.ZTRM_POLLING_ID): Promise<components.ZTRM_POLLING_LAST_MSG>;
|
|
89
|
+
getTransportImportStatus(trkorr: components.TRKORR, system: components.TMSSYSNAM): Promise<struct.TPSTAT>;
|
|
89
90
|
}
|
|
@@ -333,5 +333,10 @@ class RFCSystemConnector extends SystemConnectorBase_1.SystemConnectorBase {
|
|
|
333
333
|
return this._client.readLogPolling(logID);
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
|
+
getTransportImportStatus(trkorr, system) {
|
|
337
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
338
|
+
return this._client.getTransportImportStatus(trkorr, system);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
336
341
|
}
|
|
337
342
|
exports.RFCSystemConnector = RFCSystemConnector;
|
|
@@ -103,4 +103,6 @@ export declare namespace SystemConnector {
|
|
|
103
103
|
function createLogPolling(event: components.ZTRM_POLLING_EVENT): Promise<components.ZTRM_POLLING_ID>;
|
|
104
104
|
function deleteLogPolling(logID: components.ZTRM_POLLING_ID): Promise<void>;
|
|
105
105
|
function readLogPolling(logID: components.ZTRM_POLLING_ID): Promise<components.ZTRM_POLLING_LAST_MSG>;
|
|
106
|
+
function getTransportImportStatus(trkorr: components.TRKORR, system: components.TMSSYSNAM): Promise<struct.TPSTAT>;
|
|
107
|
+
function getTimezone(): Promise<string>;
|
|
106
108
|
}
|
|
@@ -595,4 +595,18 @@ var SystemConnector;
|
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
SystemConnector.readLogPolling = readLogPolling;
|
|
598
|
+
function getTransportImportStatus(trkorr, system) {
|
|
599
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
600
|
+
yield checkSystemConnector();
|
|
601
|
+
return SystemConnector.systemConnector.getTransportImportStatus(trkorr, system);
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
SystemConnector.getTransportImportStatus = getTransportImportStatus;
|
|
605
|
+
function getTimezone() {
|
|
606
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
607
|
+
yield checkSystemConnector();
|
|
608
|
+
return SystemConnector.systemConnector.getTimezone();
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
SystemConnector.getTimezone = getTimezone;
|
|
598
612
|
})(SystemConnector || (exports.SystemConnector = SystemConnector = {}));
|
|
@@ -20,6 +20,7 @@ export declare abstract class SystemConnectorBase implements ISystemConnectorBas
|
|
|
20
20
|
private _r3transInfoLog;
|
|
21
21
|
private _tableKeys;
|
|
22
22
|
private _rootDevclass;
|
|
23
|
+
private _timezone;
|
|
23
24
|
protected abstract readTable(tableName: components.TABNAME, fields: struct.RFC_DB_FLD[], options?: string): Promise<any[]>;
|
|
24
25
|
protected abstract getSysname(): string;
|
|
25
26
|
protected abstract getLangu(c: boolean): string;
|
|
@@ -64,4 +65,5 @@ export declare abstract class SystemConnectorBase implements ISystemConnectorBas
|
|
|
64
65
|
getObjectDependencies(object: components.TROBJTYPE, objName: components.SOBJ_NAME): Promise<ObjectDependencies>;
|
|
65
66
|
getTableKeys(tabname: components.TABNAME): Promise<struct.DD03L[]>;
|
|
66
67
|
getRootDevclass(devclass: components.DEVCLASS): Promise<components.DEVCLASS>;
|
|
68
|
+
getTimezone(): Promise<string>;
|
|
67
69
|
}
|
|
@@ -651,5 +651,111 @@ class SystemConnectorBase {
|
|
|
651
651
|
return this._rootDevclass[devclass];
|
|
652
652
|
});
|
|
653
653
|
}
|
|
654
|
+
getTimezone() {
|
|
655
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
656
|
+
if (!this._timezone) {
|
|
657
|
+
const map = {
|
|
658
|
+
CET: "Europe/Berlin",
|
|
659
|
+
EET: "Europe/Helsinki",
|
|
660
|
+
GMTUK: "Europe/London",
|
|
661
|
+
AZOREN: "Atlantic/Azores",
|
|
662
|
+
CYPRUS: "Asia/Nicosia",
|
|
663
|
+
MOLDVA: "Europe/Chisinau",
|
|
664
|
+
TURKEY: "Europe/Istanbul",
|
|
665
|
+
CAT: "Africa/Harare",
|
|
666
|
+
EGYPT: "Africa/Cairo",
|
|
667
|
+
MOROCC: "Africa/Casablanca",
|
|
668
|
+
ISRAEL: "Asia/Jerusalem",
|
|
669
|
+
IRAN: "Asia/Tehran",
|
|
670
|
+
IRAQ: "Asia/Baghdad",
|
|
671
|
+
JORDAN: "Asia/Amman",
|
|
672
|
+
LBANON: "Asia/Beirut",
|
|
673
|
+
SYRIA: "Asia/Damascus",
|
|
674
|
+
AFGHAN: "Asia/Kabul",
|
|
675
|
+
AZT: "Asia/Baku",
|
|
676
|
+
BDT: "Asia/Dhaka",
|
|
677
|
+
INDIA: "Asia/Kolkata",
|
|
678
|
+
JAPAN: "Asia/Tokyo",
|
|
679
|
+
NEPAL: "Asia/Kathmandu",
|
|
680
|
+
PKT: "Asia/Karachi",
|
|
681
|
+
RUS02: "Europe/Kaliningrad",
|
|
682
|
+
RUS03: "Europe/Moscow",
|
|
683
|
+
RUS04: "Europe/Samara",
|
|
684
|
+
RUS05: "Asia/Yekaterinburg",
|
|
685
|
+
RUS06: "Asia/Omsk",
|
|
686
|
+
RUS07: "Asia/Krasnoyarsk",
|
|
687
|
+
RUS08: "Asia/Irkutsk",
|
|
688
|
+
RUS09: "Asia/Yakutsk",
|
|
689
|
+
RUS10: "Asia/Vladivostok",
|
|
690
|
+
RUS11: "Asia/Magadan",
|
|
691
|
+
RUS12: "Asia/Kamchatka",
|
|
692
|
+
AUSEUC: "Australia/Eucla",
|
|
693
|
+
AUSLHI: "Australia/Lord_Howe",
|
|
694
|
+
AUSNSW: "Australia/Sydney",
|
|
695
|
+
AUSNT: "Australia/Darwin",
|
|
696
|
+
AUSQLD: "Australia/Brisbane",
|
|
697
|
+
AUSSA: "Australia/Adelaide",
|
|
698
|
+
AUSTAS: "Australia/Hobart",
|
|
699
|
+
AUSVIC: "Australia/Melbourne",
|
|
700
|
+
AUSWA: "Australia/Perth",
|
|
701
|
+
NORFLK: "Pacific/Norfolk",
|
|
702
|
+
NZST: "Pacific/Auckland",
|
|
703
|
+
NZCHA: "Pacific/Chatham",
|
|
704
|
+
ALA: "America/Anchorage",
|
|
705
|
+
ALAW: "America/Adak",
|
|
706
|
+
EST: "America/New_York",
|
|
707
|
+
EST_: "America/Toronto",
|
|
708
|
+
EST_NA: "America/New_York",
|
|
709
|
+
ESTNO: "America/New_York",
|
|
710
|
+
CST: "America/Chicago",
|
|
711
|
+
CST_NA: "America/Chicago",
|
|
712
|
+
CSTNO: "America/Chicago",
|
|
713
|
+
MST: "America/Denver",
|
|
714
|
+
MSTNO: "America/Phoenix",
|
|
715
|
+
MST_NA: "America/Denver",
|
|
716
|
+
PST: "America/Los_Angeles",
|
|
717
|
+
HAW: "Pacific/Honolulu",
|
|
718
|
+
NST: "America/St_Johns",
|
|
719
|
+
PIERRE: "America/Miquelon",
|
|
720
|
+
ART: "America/Argentina/Buenos_Aires",
|
|
721
|
+
BRAZIL: "America/Sao_Paulo",
|
|
722
|
+
BRZLAN: "America/Manaus",
|
|
723
|
+
BRZLWE: "America/Rio_Branco",
|
|
724
|
+
CHILE: "America/Santiago",
|
|
725
|
+
CHILEE: "Pacific/Easter",
|
|
726
|
+
CHILEM: "America/Punta_Arenas",
|
|
727
|
+
PARAGY: "America/Asuncion",
|
|
728
|
+
URUGUA: "America/Montevideo",
|
|
729
|
+
GST: "America/Godthab",
|
|
730
|
+
GSTE: "America/Scoresbysund",
|
|
731
|
+
GSTW: "America/Godthab",
|
|
732
|
+
FLKLND: "Atlantic/Stanley",
|
|
733
|
+
FIJI: "Pacific/Fiji",
|
|
734
|
+
MAU: "Indian/Mauritius",
|
|
735
|
+
UTC: "UTC",
|
|
736
|
+
};
|
|
737
|
+
try {
|
|
738
|
+
const sapTimezone = (yield this.readTable('TTZCU', [{ fieldName: 'TZONESYS' }]))[0].tzonesys;
|
|
739
|
+
const m = sapTimezone.match(/^UTC([+-])(\d{1,2})$/);
|
|
740
|
+
if (m) {
|
|
741
|
+
const sign = m[1];
|
|
742
|
+
const hours = Number(m[2]);
|
|
743
|
+
const etcSign = sign === "+" ? "-" : "+";
|
|
744
|
+
this._timezone = `Etc/GMT${etcSign}${hours}`;
|
|
745
|
+
}
|
|
746
|
+
if (!map[sapTimezone]) {
|
|
747
|
+
throw new Error(`Unsupported SAP timezone: ${sapTimezone}`);
|
|
748
|
+
}
|
|
749
|
+
this._timezone = map[sapTimezone];
|
|
750
|
+
}
|
|
751
|
+
catch (e) {
|
|
752
|
+
trm_commons_1.Logger.error(`Cannot read/parse system timezone!`, true);
|
|
753
|
+
trm_commons_1.Logger.error(e.toString());
|
|
754
|
+
this._timezone = 'UTC';
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
return this._timezone;
|
|
758
|
+
});
|
|
759
|
+
}
|
|
654
760
|
}
|
|
655
761
|
exports.SystemConnectorBase = SystemConnectorBase;
|
|
@@ -51,9 +51,8 @@ export declare class Transport {
|
|
|
51
51
|
addTranslations(aDevclass: DEVCLASS[]): Promise<void>;
|
|
52
52
|
getLinkedPackage(): Promise<TrmPackage>;
|
|
53
53
|
delete(): Promise<null>;
|
|
54
|
-
release(lock: boolean, skipLog: boolean, tmpFolder?: string
|
|
55
|
-
readReleaseLog(tmpFolder: string
|
|
56
|
-
readImportLog(tmpFolder: string): Promise<void>;
|
|
54
|
+
release(lock: boolean, skipLog: boolean, tmpFolder?: string): Promise<void>;
|
|
55
|
+
readReleaseLog(tmpFolder: string): Promise<number>;
|
|
57
56
|
private _isInTmsQueue;
|
|
58
57
|
private static _getFileNames;
|
|
59
58
|
static _getFilePaths(fileNames: FileNames): Promise<FilePaths>;
|
|
@@ -82,7 +81,7 @@ export declare class Transport {
|
|
|
82
81
|
objName: SOBJ_NAME;
|
|
83
82
|
}, transportsCache?: Transport[]): Promise<Transport[]>;
|
|
84
83
|
static getLatest(transports: Transport[]): Promise<Transport>;
|
|
85
|
-
import(
|
|
84
|
+
import(): Promise<void>;
|
|
86
85
|
rename(as4text: string): Promise<void>;
|
|
87
86
|
canBeDeleted(): Promise<boolean>;
|
|
88
87
|
isReleased(): Promise<boolean>;
|
|
@@ -91,4 +90,5 @@ export declare class Transport {
|
|
|
91
90
|
deleteFromTms(system: TMSSYSNAM): Promise<void>;
|
|
92
91
|
refreshTmsTxt(): Promise<void>;
|
|
93
92
|
changeOwner(newOwner: TR_AS4USER): Promise<void>;
|
|
93
|
+
static getTransportIcon(): string;
|
|
94
94
|
}
|
|
@@ -56,6 +56,8 @@ const path_1 = __importDefault(require("path"));
|
|
|
56
56
|
const cliProgress = __importStar(require("cli-progress"));
|
|
57
57
|
const trm_commons_1 = require("trm-commons");
|
|
58
58
|
const systemConnector_1 = require("../systemConnector");
|
|
59
|
+
const is_unicode_supported_1 = __importDefault(require("is-unicode-supported"));
|
|
60
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
59
61
|
exports.COMMENT_OBJ = 'ZTRM';
|
|
60
62
|
class Transport {
|
|
61
63
|
constructor(trkorr, _trTarget, _migration) {
|
|
@@ -180,7 +182,7 @@ class Transport {
|
|
|
180
182
|
getDate() {
|
|
181
183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
182
184
|
const e070 = yield this.getE070();
|
|
183
|
-
return (0, commons_1.fromAbapToDate)(e070.as4Date, e070.as4Time);
|
|
185
|
+
return yield ((0, commons_1.fromAbapToDate)(e070.as4Date, e070.as4Time));
|
|
184
186
|
});
|
|
185
187
|
}
|
|
186
188
|
getTrmPackageName() {
|
|
@@ -395,20 +397,20 @@ class Transport {
|
|
|
395
397
|
return null;
|
|
396
398
|
});
|
|
397
399
|
}
|
|
398
|
-
release(lock, skipLog, tmpFolder
|
|
400
|
+
release(lock, skipLog, tmpFolder) {
|
|
399
401
|
return __awaiter(this, void 0, void 0, function* () {
|
|
400
402
|
trm_commons_1.Logger.loading('Releasing transport...', skipLog);
|
|
401
|
-
yield systemConnector_1.SystemConnector.releaseTrkorr(this.trkorr, lock
|
|
403
|
+
yield systemConnector_1.SystemConnector.releaseTrkorr(this.trkorr, lock);
|
|
402
404
|
yield systemConnector_1.SystemConnector.dequeueTransport(this.trkorr);
|
|
403
405
|
if (tmpFolder) {
|
|
404
|
-
yield this.readReleaseLog(tmpFolder
|
|
406
|
+
yield this.readReleaseLog(tmpFolder);
|
|
405
407
|
}
|
|
406
408
|
else {
|
|
407
|
-
yield this._isInTmsQueue(skipLog, false
|
|
409
|
+
yield this._isInTmsQueue(skipLog, false);
|
|
408
410
|
}
|
|
409
411
|
});
|
|
410
412
|
}
|
|
411
|
-
readReleaseLog(tmpFolder
|
|
413
|
+
readReleaseLog(tmpFolder) {
|
|
412
414
|
return __awaiter(this, void 0, void 0, function* () {
|
|
413
415
|
const filePaths = yield Transport._getFilePaths(this._fileNames);
|
|
414
416
|
const localPath = path_1.default.join(tmpFolder, this._fileNames.releaseLog);
|
|
@@ -442,10 +444,9 @@ class Transport {
|
|
|
442
444
|
exitCode: '',
|
|
443
445
|
result: 'Needs update'
|
|
444
446
|
});
|
|
445
|
-
const timeoutDate = new Date((new Date()).getTime() + (secondsTimeout * 1000));
|
|
446
447
|
var exitWhile = false;
|
|
447
448
|
var whileResult = null;
|
|
448
|
-
while (!exitWhile
|
|
449
|
+
while (!exitWhile) {
|
|
449
450
|
var logResult = [];
|
|
450
451
|
try {
|
|
451
452
|
const logBinary = yield systemConnector_1.SystemConnector.getBinaryFile(filePaths.releaseLog);
|
|
@@ -544,11 +545,11 @@ class Transport {
|
|
|
544
545
|
error = new Error(`Error occurred during transport ${this.trkorr} release.`);
|
|
545
546
|
}
|
|
546
547
|
if (whileResult === "SUCCESS") {
|
|
547
|
-
trm_commons_1.Logger.success(
|
|
548
|
+
trm_commons_1.Logger.success(`${Transport.getTransportIcon()} ${this.trkorr} released with success.`);
|
|
548
549
|
rc = 0;
|
|
549
550
|
}
|
|
550
551
|
if (whileResult === "WARNING") {
|
|
551
|
-
trm_commons_1.Logger.warning(
|
|
552
|
+
trm_commons_1.Logger.warning(`${Transport.getTransportIcon()} ${this.trkorr} released with warning.`);
|
|
552
553
|
rc = 4;
|
|
553
554
|
}
|
|
554
555
|
}
|
|
@@ -560,23 +561,40 @@ class Transport {
|
|
|
560
561
|
}
|
|
561
562
|
});
|
|
562
563
|
}
|
|
563
|
-
readImportLog(tmpFolder) {
|
|
564
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
564
|
_isInTmsQueue(skipLog_1) {
|
|
568
|
-
return __awaiter(this, arguments, void 0, function* (skipLog, checkImpSing = false
|
|
569
|
-
|
|
570
|
-
trm_commons_1.Logger.log(`TMS check for transport ${this.trkorr}, timeout date set to ${timeoutDate}`, true);
|
|
565
|
+
return __awaiter(this, arguments, void 0, function* (skipLog, checkImpSing = false) {
|
|
566
|
+
trm_commons_1.Logger.log(`TMS check for transport ${this.trkorr}`, true);
|
|
571
567
|
var inQueue = false;
|
|
572
568
|
var rc = 12;
|
|
569
|
+
var message;
|
|
573
570
|
if (this._trTarget) {
|
|
574
571
|
var inQueueAttempts = 0;
|
|
575
|
-
|
|
572
|
+
trm_commons_1.Logger.loading(`Checking transport status...`, skipLog);
|
|
573
|
+
while (!inQueue) {
|
|
576
574
|
inQueueAttempts++;
|
|
577
|
-
trm_commons_1.Logger.log(`Attempt ${inQueueAttempts}
|
|
578
|
-
|
|
579
|
-
|
|
575
|
+
trm_commons_1.Logger.log(`Attempt ${inQueueAttempts}, reading in 3 seconds...`, true);
|
|
576
|
+
yield (0, promises_1.setTimeout)(3000);
|
|
577
|
+
if (!checkImpSing) {
|
|
578
|
+
trm_commons_1.Logger.loading(`${Transport.getTransportIcon()} Releasing...`, skipLog);
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
const lastCheck = new Date();
|
|
582
|
+
try {
|
|
583
|
+
const tpstat = yield systemConnector_1.SystemConnector.getTransportImportStatus(this.trkorr, this._trTarget);
|
|
584
|
+
if (tpstat.message) {
|
|
585
|
+
const statDate = yield (0, commons_1.fromAbapToDate)(tpstat.moddate, tpstat.modtime);
|
|
586
|
+
trm_commons_1.Logger.loading(`Last check ${lastCheck.toISOString().split("T")[0]} ${lastCheck.toTimeString().split(" ")[0]}, last update ${statDate.toISOString().split("T")[0]} ${statDate.toTimeString().split(" ")[0]}: ${tpstat.message}...`, skipLog);
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
trm_commons_1.Logger.loading(`Last check ${lastCheck.toISOString().split("T")[0]} ${lastCheck.toTimeString().split(" ")[0]}...`, skipLog);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
catch (e) {
|
|
593
|
+
trm_commons_1.Logger.loading(`Last check ${lastCheck.toISOString().split("T")[0]} ${lastCheck.toTimeString().split(" ")[0]}, last update /: Unable to read status`, skipLog);
|
|
594
|
+
trm_commons_1.Logger.error(`Unable to read status!`, true);
|
|
595
|
+
trm_commons_1.Logger.error(e.toString(), true);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
580
598
|
var tmsQueue = yield systemConnector_1.SystemConnector.readTmsQueue(this._trTarget);
|
|
581
599
|
tmsQueue = tmsQueue.filter(o => o.trkorr === this.trkorr);
|
|
582
600
|
tmsQueue = tmsQueue.sort((a, b) => parseInt(b.bufpos) - parseInt(a.bufpos));
|
|
@@ -598,20 +616,21 @@ class Transport {
|
|
|
598
616
|
}
|
|
599
617
|
}
|
|
600
618
|
}
|
|
601
|
-
if (!
|
|
602
|
-
|
|
619
|
+
if (!checkImpSing) {
|
|
620
|
+
trm_commons_1.Logger.success(`${Transport.getTransportIcon()} ${this.trkorr} released.`, skipLog);
|
|
621
|
+
rc = -1;
|
|
603
622
|
}
|
|
604
623
|
else {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
rc = -1;
|
|
624
|
+
try {
|
|
625
|
+
message = (yield systemConnector_1.SystemConnector.getTransportImportStatus(this.trkorr, this._trTarget)).message;
|
|
608
626
|
}
|
|
627
|
+
catch (_a) { }
|
|
609
628
|
}
|
|
610
629
|
}
|
|
611
630
|
else {
|
|
612
631
|
trm_commons_1.Logger.error(`No target specified, unable to check queue!!`, true);
|
|
613
632
|
}
|
|
614
|
-
return rc;
|
|
633
|
+
return { rc, message };
|
|
615
634
|
});
|
|
616
635
|
}
|
|
617
636
|
static _getFileNames(trkorr, targetSystem) {
|
|
@@ -758,36 +777,36 @@ class Transport {
|
|
|
758
777
|
});
|
|
759
778
|
}
|
|
760
779
|
import() {
|
|
761
|
-
return __awaiter(this,
|
|
780
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
762
781
|
if (!this._trTarget) {
|
|
763
782
|
throw new Error('Missing transport target.');
|
|
764
783
|
}
|
|
765
|
-
trm_commons_1.Logger.log(`Starting
|
|
784
|
+
trm_commons_1.Logger.log(`Starting ${this.trkorr} import`, true);
|
|
766
785
|
trm_commons_1.Logger.loading(`Forwarding transport ${this.trkorr}`, true);
|
|
767
786
|
yield systemConnector_1.SystemConnector.forwardTransport(this.trkorr, this._trTarget, this._trTarget, true);
|
|
768
|
-
trm_commons_1.Logger.loading(`Importing
|
|
787
|
+
trm_commons_1.Logger.loading(`Importing ${this.trkorr}`, true);
|
|
769
788
|
yield systemConnector_1.SystemConnector.importTransport(this.trkorr, this._trTarget);
|
|
770
789
|
trm_commons_1.Logger.log(`Starting transport ${this.trkorr} TMS queue status check`, true);
|
|
771
|
-
const
|
|
772
|
-
trm_commons_1.Logger.log(`Transport ${this.trkorr} import ended: return code ${rc}`, true);
|
|
773
|
-
switch (rc) {
|
|
790
|
+
const queue = yield this._isInTmsQueue(false, true);
|
|
791
|
+
trm_commons_1.Logger.log(`Transport ${this.trkorr} import ended: return code ${queue.rc}`, true);
|
|
792
|
+
switch (queue.rc) {
|
|
774
793
|
case -1:
|
|
775
794
|
trm_commons_1.Logger.error(`${this.trkorr} import has no return code!`);
|
|
776
795
|
break;
|
|
777
796
|
case 0:
|
|
778
|
-
trm_commons_1.Logger.success(`${this.trkorr} import ended with success
|
|
797
|
+
trm_commons_1.Logger.success(`${this.trkorr} import ended with success${queue.message ? ' -> ' + queue.message : '.'}`);
|
|
779
798
|
break;
|
|
780
799
|
case 4:
|
|
781
|
-
trm_commons_1.Logger.warning(`${this.trkorr} import ended with warning
|
|
800
|
+
trm_commons_1.Logger.warning(`${this.trkorr} import ended with warning${queue.message ? ' -> ' + queue.message : '.'}`);
|
|
782
801
|
break;
|
|
783
802
|
case 8:
|
|
784
|
-
trm_commons_1.Logger.error(`${this.trkorr} import ended with error
|
|
803
|
+
trm_commons_1.Logger.error(`${this.trkorr} import ended with error (check ${chalk_1.default.bold('STMS')})${queue.message ? ' -> ' + queue.message : '.'}`);
|
|
785
804
|
break;
|
|
786
805
|
case 12:
|
|
787
|
-
trm_commons_1.Logger.error(`${this.trkorr} import was cancelled
|
|
806
|
+
trm_commons_1.Logger.error(`${this.trkorr} import was cancelled${queue.message ? ' -> ' + queue.message : '.'}`);
|
|
788
807
|
break;
|
|
789
808
|
case 16:
|
|
790
|
-
trm_commons_1.Logger.error(`${this.trkorr} import was cancelled
|
|
809
|
+
trm_commons_1.Logger.error(`${this.trkorr} import was cancelled${queue.message ? ' -> ' + queue.message : '.'}`);
|
|
791
810
|
break;
|
|
792
811
|
}
|
|
793
812
|
});
|
|
@@ -849,5 +868,8 @@ class Transport {
|
|
|
849
868
|
yield systemConnector_1.SystemConnector.changeTrOwner(this.trkorr, newOwner);
|
|
850
869
|
});
|
|
851
870
|
}
|
|
871
|
+
static getTransportIcon() {
|
|
872
|
+
return (0, is_unicode_supported_1.default)() ? '🚚' : '⛟';
|
|
873
|
+
}
|
|
852
874
|
}
|
|
853
875
|
exports.Transport = Transport;
|