trm-client 4.2.1 → 4.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 +17 -6
- package/dist/commands/addRegistry.js +5 -4
- package/dist/commands/alias.js +29 -29
- package/dist/commands/check.js +5 -4
- package/dist/commands/commons/CommandContext.js +2 -1
- package/dist/commands/commons/viewRegistryPackage.js +6 -6
- package/dist/commands/compare.js +12 -11
- package/dist/commands/content.js +7 -6
- package/dist/commands/createAlias.js +2 -2
- package/dist/commands/deleteAlias.js +2 -2
- package/dist/commands/findDependencies.js +2 -1
- package/dist/commands/import.js +2 -1
- package/dist/commands/info.js +6 -5
- package/dist/commands/install.js +2 -1
- package/dist/commands/list.js +8 -7
- package/dist/commands/login.js +3 -3
- package/dist/commands/logout.js +3 -3
- package/dist/commands/pack.js +3 -2
- package/dist/commands/ping.js +3 -2
- package/dist/commands/prompts/connect.js +5 -5
- package/dist/commands/prompts/pickRegistry.js +2 -2
- package/dist/commands/publish.js +2 -1
- package/dist/commands/removeRegistry.js +4 -4
- package/dist/commands/settings.js +2 -2
- package/dist/commands/unpublish.js +2 -2
- package/dist/commands/view.js +10 -9
- package/dist/commands/whoami.js +5 -5
- package/dist/systemAlias/SystemAlias.js +2 -2
- package/dist/utils/checkCliUpdate.js +7 -7
- package/dist/utils/executeCommand.js +18 -17
- package/dist/utils/logError.js +4 -3
- package/package.json +4 -3
package/changelog.txt
CHANGED
|
@@ -8,15 +8,26 @@ Legend
|
|
|
8
8
|
+ : added
|
|
9
9
|
- : removed
|
|
10
10
|
|
|
11
|
-
2025-
|
|
11
|
+
2025-04-28 v4.4.0
|
|
12
12
|
-------------------
|
|
13
13
|
|
|
14
|
-
!
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
! trm-core ^6.5.0
|
|
15
|
+
! trm-commons ^1.0.0
|
|
16
|
+
|
|
17
|
+
2025-04-28 v4.3.0
|
|
18
|
+
-------------------
|
|
19
|
+
|
|
20
|
+
! trm-core ^6.4.1
|
|
18
21
|
|
|
19
22
|
2025-04-23 v4.2.1
|
|
20
23
|
-------------------
|
|
21
24
|
|
|
22
|
-
* node-r3trans version read
|
|
25
|
+
* node-r3trans version read
|
|
26
|
+
|
|
27
|
+
2025-02-26 v4.2.0
|
|
28
|
+
-------------------
|
|
29
|
+
|
|
30
|
+
! connect to registry via option
|
|
31
|
+
- trm dependencies on client
|
|
32
|
+
+ content command
|
|
33
|
+
+ pack/import command
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.addRegistry = void 0;
|
|
13
13
|
const trm_core_1 = require("trm-core");
|
|
14
14
|
const registryAlias_1 = require("../registryAlias");
|
|
15
|
+
const trm_commons_1 = require("trm-commons");
|
|
15
16
|
function addRegistry(commandArgs) {
|
|
16
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
18
|
const registryName = commandArgs.registryName.trim();
|
|
@@ -32,7 +33,7 @@ function addRegistry(commandArgs) {
|
|
|
32
33
|
throw new Error(`Invalid authentication JSON object.`);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
const inq1 = yield
|
|
36
|
+
const inq1 = yield trm_commons_1.Inquirer.prompt({
|
|
36
37
|
type: "input",
|
|
37
38
|
name: "endpoint",
|
|
38
39
|
message: "Registry endpoint",
|
|
@@ -44,16 +45,16 @@ function addRegistry(commandArgs) {
|
|
|
44
45
|
var pingSuccess = true;
|
|
45
46
|
try {
|
|
46
47
|
const ping = yield registry.getRegistry().ping();
|
|
47
|
-
|
|
48
|
+
trm_commons_1.Logger.registryResponse(ping.wallMessage);
|
|
48
49
|
}
|
|
49
50
|
catch (e) {
|
|
50
|
-
|
|
51
|
+
trm_commons_1.Logger.error(`Ping to registry "${registryName}" (${endpoint}) failed.`);
|
|
51
52
|
pingSuccess = false;
|
|
52
53
|
throw e;
|
|
53
54
|
}
|
|
54
55
|
finally {
|
|
55
56
|
if (pingSuccess) {
|
|
56
|
-
|
|
57
|
+
trm_commons_1.Logger.success(`Registry "${registryName}" added.`);
|
|
57
58
|
}
|
|
58
59
|
else {
|
|
59
60
|
registryAlias_1.RegistryAlias.delete(registryName);
|
package/dist/commands/alias.js
CHANGED
|
@@ -10,14 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.alias = void 0;
|
|
13
|
-
const trm_core_1 = require("trm-core");
|
|
14
13
|
const systemAlias_1 = require("../systemAlias");
|
|
15
14
|
const createAlias_1 = require("./createAlias");
|
|
16
15
|
const deleteAlias_1 = require("./deleteAlias");
|
|
17
16
|
const prompts_1 = require("./prompts");
|
|
18
17
|
const utils_1 = require("../utils");
|
|
18
|
+
const trm_commons_1 = require("trm-commons");
|
|
19
19
|
const _create = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
const inq1 = yield
|
|
20
|
+
const inq1 = yield trm_commons_1.Inquirer.prompt({
|
|
21
21
|
name: 'name',
|
|
22
22
|
message: 'Alias name',
|
|
23
23
|
type: 'input'
|
|
@@ -37,75 +37,75 @@ const _view = (alias) => {
|
|
|
37
37
|
const saprouter = alias.connection.saprouter;
|
|
38
38
|
const client = alias.login.client;
|
|
39
39
|
if (dest) {
|
|
40
|
-
|
|
40
|
+
trm_commons_1.Logger.info(`System ID: ${dest}`);
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
|
|
43
|
+
trm_commons_1.Logger.warning(`System ID: Unknown`);
|
|
44
44
|
}
|
|
45
45
|
if (ashost) {
|
|
46
|
-
|
|
46
|
+
trm_commons_1.Logger.info(`Application server: ${ashost}`);
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
|
-
|
|
49
|
+
trm_commons_1.Logger.warning(`Application server: Unknown`);
|
|
50
50
|
}
|
|
51
51
|
if (sysnr) {
|
|
52
|
-
|
|
52
|
+
trm_commons_1.Logger.info(`Instance number: ${sysnr}`);
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
|
-
|
|
55
|
+
trm_commons_1.Logger.warning(`Instance number: Unknown`);
|
|
56
56
|
}
|
|
57
57
|
if (saprouter) {
|
|
58
|
-
|
|
58
|
+
trm_commons_1.Logger.info(`SAProuter: ${saprouter}`);
|
|
59
59
|
}
|
|
60
60
|
if (client) {
|
|
61
|
-
|
|
61
|
+
trm_commons_1.Logger.info(`Logon client: ${client}`);
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
|
-
|
|
64
|
+
trm_commons_1.Logger.warning(`Logon client: Unknown`);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
else if (alias.type === utils_1.SystemConnectorType.REST) {
|
|
68
68
|
const endpoint = alias.connection.endpoint;
|
|
69
69
|
const rfcdest = alias.connection.rfcdest;
|
|
70
70
|
if (endpoint) {
|
|
71
|
-
|
|
71
|
+
trm_commons_1.Logger.info(`System endpoint: ${endpoint}`);
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
|
-
|
|
74
|
+
trm_commons_1.Logger.warning(`System endpoint: Unknown`);
|
|
75
75
|
}
|
|
76
76
|
if (rfcdest) {
|
|
77
|
-
|
|
77
|
+
trm_commons_1.Logger.info(`RFC Forward: ${rfcdest}`);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
if (lang) {
|
|
81
|
-
|
|
81
|
+
trm_commons_1.Logger.info(`Logon language: ${lang}`);
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
|
-
|
|
84
|
+
trm_commons_1.Logger.warning(`Logon language: Unknown`);
|
|
85
85
|
}
|
|
86
86
|
if (user) {
|
|
87
|
-
|
|
87
|
+
trm_commons_1.Logger.info(`Logon user: ${user}`);
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
|
-
|
|
90
|
+
trm_commons_1.Logger.warning(`Logon user: Unknown`);
|
|
91
91
|
}
|
|
92
92
|
if (hasPassword) {
|
|
93
|
-
|
|
93
|
+
trm_commons_1.Logger.info(`Logon password: Saved`);
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
|
-
|
|
96
|
+
trm_commons_1.Logger.warning(`Logon password: Unknown`);
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
const _check = (alias) => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
|
-
|
|
100
|
+
trm_commons_1.Logger.loading(`Checking connection with alias "${alias.alias}"...`);
|
|
101
101
|
const oSystemAlias = new systemAlias_1.SystemAlias(alias.type, alias.connection, alias.login);
|
|
102
102
|
try {
|
|
103
103
|
yield oSystemAlias.getConnection().connect();
|
|
104
|
-
|
|
104
|
+
trm_commons_1.Logger.success(`Connection OK.`);
|
|
105
105
|
}
|
|
106
106
|
catch (e) {
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
trm_commons_1.Logger.error(`Connection failed!`);
|
|
108
|
+
trm_commons_1.Logger.error(e.toString());
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
const _edit = (alias) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -149,10 +149,10 @@ const _edit = (alias) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
149
149
|
}
|
|
150
150
|
finally {
|
|
151
151
|
if (connectionSuccess) {
|
|
152
|
-
|
|
152
|
+
trm_commons_1.Logger.success(`Alias "${alias.alias}" updated.`);
|
|
153
153
|
}
|
|
154
154
|
else {
|
|
155
|
-
|
|
155
|
+
trm_commons_1.Logger.error(`Alias "${alias.alias}" couldn't be updated.`);
|
|
156
156
|
systemAlias_1.SystemAlias.delete(alias.alias);
|
|
157
157
|
if (alias.type === utils_1.SystemConnectorType.RFC) {
|
|
158
158
|
systemAlias_1.SystemAlias.create(alias.alias, alias.type, {
|
|
@@ -191,13 +191,13 @@ function alias(commandArgs) {
|
|
|
191
191
|
var aliasPick;
|
|
192
192
|
if (commandArgs.systemAlias) {
|
|
193
193
|
if (!aAlias.find(o => o.alias === commandArgs.systemAlias)) {
|
|
194
|
-
|
|
194
|
+
trm_commons_1.Logger.warning(`Alias "${commandArgs.systemAlias}" not found.`);
|
|
195
195
|
}
|
|
196
196
|
else {
|
|
197
197
|
aliasPick = commandArgs.systemAlias;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
const inq1 = yield
|
|
200
|
+
const inq1 = yield trm_commons_1.Inquirer.prompt({
|
|
201
201
|
name: `action`,
|
|
202
202
|
message: `Action`,
|
|
203
203
|
type: `list`,
|
|
@@ -219,7 +219,7 @@ function alias(commandArgs) {
|
|
|
219
219
|
}]
|
|
220
220
|
});
|
|
221
221
|
if (inq1.action.startsWith(`pick_`) && !aliasPick) {
|
|
222
|
-
const inq2 = yield
|
|
222
|
+
const inq2 = yield trm_commons_1.Inquirer.prompt({
|
|
223
223
|
name: `aliasPick`,
|
|
224
224
|
message: `Select system alias`,
|
|
225
225
|
type: `list`,
|
package/dist/commands/check.js
CHANGED
|
@@ -12,9 +12,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.check = void 0;
|
|
13
13
|
const trm_core_1 = require("trm-core");
|
|
14
14
|
const commons_1 = require("./commons");
|
|
15
|
+
const trm_commons_1 = require("trm-commons");
|
|
15
16
|
var systemPackages = [];
|
|
16
17
|
const _dependencies = (oPackage) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
|
|
18
|
+
trm_commons_1.Logger.loading(`Analyzing package dependencies...`);
|
|
18
19
|
const packages = yield commons_1.CommandContext.getSystemPackages();
|
|
19
20
|
yield (0, trm_core_1.checkPackageDependencies)({
|
|
20
21
|
contextData: {
|
|
@@ -30,7 +31,7 @@ const _dependencies = (oPackage) => __awaiter(void 0, void 0, void 0, function*
|
|
|
30
31
|
});
|
|
31
32
|
});
|
|
32
33
|
const _sapEntries = (oPackage) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
|
|
34
|
+
trm_commons_1.Logger.loading(`Analyzing package SAP Entries...`);
|
|
34
35
|
yield (0, trm_core_1.checkSapEntries)({
|
|
35
36
|
packageData: {
|
|
36
37
|
package: oPackage
|
|
@@ -56,7 +57,7 @@ function check(commandArgs) {
|
|
|
56
57
|
}];
|
|
57
58
|
var analysisType = commandArgs.analysisType;
|
|
58
59
|
if (!analysisType || !analysisTypes.map(o => o.value).includes(analysisType)) {
|
|
59
|
-
const inq1 = yield
|
|
60
|
+
const inq1 = yield trm_commons_1.Inquirer.prompt({
|
|
60
61
|
message: `Analysis type`,
|
|
61
62
|
name: `analysisType`,
|
|
62
63
|
type: `list`,
|
|
@@ -64,7 +65,7 @@ function check(commandArgs) {
|
|
|
64
65
|
});
|
|
65
66
|
analysisType = inq1.analysisType;
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
trm_commons_1.Logger.loading(`Searching package "${packageName}"...`);
|
|
68
69
|
systemPackages = yield commons_1.CommandContext.getSystemPackages();
|
|
69
70
|
const oPackage = systemPackages.find(o => o.compareName(packageName) && o.compareRegistry(commons_1.CommandContext.getRegistry()));
|
|
70
71
|
if (!oPackage) {
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CommandContext = void 0;
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
13
14
|
const trm_core_1 = require("trm-core");
|
|
14
15
|
var CommandContext;
|
|
15
16
|
(function (CommandContext) {
|
|
@@ -29,7 +30,7 @@ var CommandContext;
|
|
|
29
30
|
function getSystemPackages() {
|
|
30
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
32
|
if (!this._systemPackages) {
|
|
32
|
-
|
|
33
|
+
trm_commons_1.Logger.loading(`Reading system packages...`);
|
|
33
34
|
this._systemPackages = yield trm_core_1.SystemConnector.getInstalledPackages(true, true, true);
|
|
34
35
|
}
|
|
35
36
|
return this._systemPackages;
|
|
@@ -13,28 +13,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.viewRegistryPackage = void 0;
|
|
16
|
-
const trm_core_1 = require("trm-core");
|
|
17
16
|
const CommandContext_1 = require("./CommandContext");
|
|
18
17
|
const chalk_1 = __importDefault(require("chalk"));
|
|
18
|
+
const trm_commons_1 = require("trm-commons");
|
|
19
19
|
function viewRegistryPackage(packageName, print = true) {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
|
|
21
|
+
trm_commons_1.Logger.loading(`Reading registry data...`);
|
|
22
22
|
var oRegistryView;
|
|
23
23
|
try {
|
|
24
24
|
oRegistryView = yield CommandContext_1.CommandContext.getRegistry().view(packageName, 'latest');
|
|
25
25
|
}
|
|
26
26
|
catch (e) {
|
|
27
|
-
|
|
27
|
+
trm_commons_1.Logger.error(e, true);
|
|
28
28
|
oRegistryView = null;
|
|
29
29
|
}
|
|
30
30
|
if (print) {
|
|
31
31
|
if (!oRegistryView) {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
trm_commons_1.Logger.warning(`${chalk_1.default.bold('WARNING')}: This package was not found on the registry.`);
|
|
33
|
+
trm_commons_1.Logger.warning(`${chalk_1.default.bold('WARNING')}: This package may have been deleted!`);
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
36
|
if (oRegistryView.release && oRegistryView.release.deprecated) {
|
|
37
|
-
|
|
37
|
+
trm_commons_1.Logger.warning(`${chalk_1.default.bold('WARNING')}: This package has been marked as deprecated!`);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
package/dist/commands/compare.js
CHANGED
|
@@ -39,15 +39,16 @@ const prompts_1 = require("./prompts");
|
|
|
39
39
|
const commons_1 = require("./commons");
|
|
40
40
|
const trm_core_1 = require("trm-core");
|
|
41
41
|
const utils_1 = require("../utils");
|
|
42
|
+
const trm_commons_1 = require("trm-commons");
|
|
42
43
|
const _compareConnectionData = (a, b) => {
|
|
43
44
|
return false;
|
|
44
45
|
};
|
|
45
46
|
const _promptConnections = (aConnections) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
47
|
if (aConnections.length > 0) {
|
|
47
|
-
|
|
48
|
+
trm_commons_1.Logger.info(`Compare systems: ${aConnections.map(o => o.getDest()).join(', ')}`);
|
|
48
49
|
}
|
|
49
50
|
var askConnection = true;
|
|
50
|
-
const inq1 = yield
|
|
51
|
+
const inq1 = yield trm_commons_1.Inquirer.prompt([{
|
|
51
52
|
message: "Add another connection?",
|
|
52
53
|
name: "continue",
|
|
53
54
|
type: "confirm",
|
|
@@ -139,16 +140,16 @@ function compare(commandArgs) {
|
|
|
139
140
|
aConnections = oPromptRes.connections;
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
|
-
|
|
143
|
+
trm_commons_1.Logger.info(`Compare systems: ${aConnections.map(o => o.getDest()).join(', ')}`);
|
|
143
144
|
const tableHead = [`System`, `Installed`, `Version`, `Devclass`, `Import transport`];
|
|
144
145
|
var tableData = [];
|
|
145
|
-
|
|
146
|
+
trm_commons_1.Logger.loading(`Reading registry data...`);
|
|
146
147
|
var oRegistryView;
|
|
147
148
|
try {
|
|
148
149
|
oRegistryView = yield (0, commons_1.viewRegistryPackage)(packageName, true);
|
|
149
150
|
}
|
|
150
151
|
catch (e) { }
|
|
151
|
-
|
|
152
|
+
trm_commons_1.Logger.loading(`Reading system data...`);
|
|
152
153
|
for (const oConnection of aConnections) {
|
|
153
154
|
trm_core_1.SystemConnector.systemConnector = oConnection;
|
|
154
155
|
const system = trm_core_1.SystemConnector.getDest() || '';
|
|
@@ -183,16 +184,16 @@ function compare(commandArgs) {
|
|
|
183
184
|
importTransport
|
|
184
185
|
]);
|
|
185
186
|
}
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
trm_commons_1.Logger.info(`Package name: ${packageName}`);
|
|
188
|
+
trm_commons_1.Logger.info(`Registry: ${registry.name}`);
|
|
188
189
|
try {
|
|
189
|
-
|
|
190
|
+
trm_commons_1.Logger.info(`Latest version: ${oRegistryView.release.version}`);
|
|
190
191
|
}
|
|
191
192
|
catch (e) {
|
|
192
|
-
|
|
193
|
+
trm_commons_1.Logger.warning(`Latest version: Unknown`);
|
|
193
194
|
}
|
|
194
|
-
|
|
195
|
-
|
|
195
|
+
trm_commons_1.Logger.log(`\n`);
|
|
196
|
+
trm_commons_1.Logger.table(tableHead, tableData);
|
|
196
197
|
});
|
|
197
198
|
}
|
|
198
199
|
exports.compare = compare;
|
package/dist/commands/content.js
CHANGED
|
@@ -17,12 +17,13 @@ const trm_core_1 = require("trm-core");
|
|
|
17
17
|
const commons_1 = require("./commons");
|
|
18
18
|
const utils_1 = require("../utils");
|
|
19
19
|
const chalk_1 = __importDefault(require("chalk"));
|
|
20
|
+
const trm_commons_1 = require("trm-commons");
|
|
20
21
|
function content(commandArgs) {
|
|
21
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
|
|
23
|
+
trm_commons_1.Logger.loading(`Searching package "${commandArgs.package}"...`);
|
|
23
24
|
const remotePackage = new trm_core_1.TrmPackage(commandArgs.package, commons_1.CommandContext.getRegistry());
|
|
24
25
|
const remoteManifest = yield remotePackage.fetchRemoteManifest(commandArgs.version);
|
|
25
|
-
|
|
26
|
+
trm_commons_1.Logger.loading(`Reading content...`);
|
|
26
27
|
var transports = {};
|
|
27
28
|
var aNodes = [];
|
|
28
29
|
var iOtherEntries = 0;
|
|
@@ -121,7 +122,7 @@ function content(commandArgs) {
|
|
|
121
122
|
tree.children.push(tableNode);
|
|
122
123
|
}
|
|
123
124
|
});
|
|
124
|
-
|
|
125
|
+
trm_commons_1.Logger.tree(tree);
|
|
125
126
|
var header = ['Namespace', 'ABAP Package', 'TRM Transport', 'Customizing', 'Translations'];
|
|
126
127
|
var row1 = [];
|
|
127
128
|
var row2 = [];
|
|
@@ -166,13 +167,13 @@ function content(commandArgs) {
|
|
|
166
167
|
row2.push(``);
|
|
167
168
|
}
|
|
168
169
|
if (row2.filter(s => s.length > 0).length > 0) {
|
|
169
|
-
|
|
170
|
+
trm_commons_1.Logger.table(header, [row1, row2]);
|
|
170
171
|
}
|
|
171
172
|
else {
|
|
172
|
-
|
|
173
|
+
trm_commons_1.Logger.table(header, [row1]);
|
|
173
174
|
}
|
|
174
175
|
if (iOtherEntries > 0) {
|
|
175
|
-
|
|
176
|
+
trm_commons_1.Logger.warning(`There are ${iOtherEntries} other records to show. Run with option --all in order to see them.`);
|
|
176
177
|
}
|
|
177
178
|
});
|
|
178
179
|
}
|
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.createAlias = void 0;
|
|
13
|
-
const trm_core_1 = require("trm-core");
|
|
14
13
|
const systemAlias_1 = require("../systemAlias");
|
|
15
14
|
const prompts_1 = require("./prompts");
|
|
16
15
|
const utils_1 = require("../utils");
|
|
16
|
+
const trm_commons_1 = require("trm-commons");
|
|
17
17
|
function createAlias(commandArgs) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const connectionArgs = yield (0, prompts_1.connect)({
|
|
@@ -55,7 +55,7 @@ function createAlias(commandArgs) {
|
|
|
55
55
|
}
|
|
56
56
|
finally {
|
|
57
57
|
if (connectionSuccess) {
|
|
58
|
-
|
|
58
|
+
trm_commons_1.Logger.success(`Alias "${commandArgs.alias}" created.`);
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
61
|
systemAlias_1.SystemAlias.delete(commandArgs.alias);
|
|
@@ -10,14 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.deleteAlias = void 0;
|
|
13
|
-
const
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
14
|
const systemAlias_1 = require("../systemAlias");
|
|
15
15
|
function deleteAlias(commandArgs) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
const alias = commandArgs.alias;
|
|
18
18
|
systemAlias_1.SystemAlias.get(alias);
|
|
19
19
|
systemAlias_1.SystemAlias.delete(alias);
|
|
20
|
-
|
|
20
|
+
trm_commons_1.Logger.success(`Alias "${alias}" deleted.`);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
exports.deleteAlias = deleteAlias;
|
|
@@ -10,10 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.findDependencies = void 0;
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
13
14
|
const trm_core_1 = require("trm-core");
|
|
14
15
|
function findDependencies(commandArgs) {
|
|
15
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
|
|
17
|
+
trm_commons_1.Logger.loading(`Searching for dependencies in package "${commandArgs.devclass}"...`);
|
|
17
18
|
yield (0, trm_core_1.findDependencies)({
|
|
18
19
|
contextData: {
|
|
19
20
|
noInquirer: commandArgs.noPrompts
|
package/dist/commands/import.js
CHANGED
|
@@ -13,6 +13,7 @@ exports._import = void 0;
|
|
|
13
13
|
const trm_core_1 = require("trm-core");
|
|
14
14
|
const utils_1 = require("../utils");
|
|
15
15
|
const commons_1 = require("./commons");
|
|
16
|
+
const trm_commons_1 = require("trm-commons");
|
|
16
17
|
const _parsePackageReplacementsArgument = (arg) => {
|
|
17
18
|
if (arg) {
|
|
18
19
|
try {
|
|
@@ -76,7 +77,7 @@ function _import(commandArgs) {
|
|
|
76
77
|
if (result.installTransport) {
|
|
77
78
|
sOutput += `, use ${result.installTransport.trkorr} transport in landscape`;
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
+
trm_commons_1.Logger.success(sOutput);
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
exports._import = _import;
|
package/dist/commands/info.js
CHANGED
|
@@ -21,6 +21,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
21
21
|
const get_root_path_1 = require("get-root-path");
|
|
22
22
|
const chalk_1 = __importDefault(require("chalk"));
|
|
23
23
|
const semver_1 = require("semver");
|
|
24
|
+
const trm_commons_1 = require("trm-commons");
|
|
24
25
|
const _getDependencyVersion = (moduleName, rootModule = 'trm-client') => {
|
|
25
26
|
var file;
|
|
26
27
|
try {
|
|
@@ -30,7 +31,7 @@ const _getDependencyVersion = (moduleName, rootModule = 'trm-client') => {
|
|
|
30
31
|
file = (0, fs_1.readFileSync)(path_1.default.join(get_root_path_1.rootPath, `/node_modules/${moduleName}/package.json`));
|
|
31
32
|
}
|
|
32
33
|
if (!file) {
|
|
33
|
-
|
|
34
|
+
trm_commons_1.Logger.warning(`Library ${moduleName} was not found!`, true);
|
|
34
35
|
}
|
|
35
36
|
else {
|
|
36
37
|
return JSON.parse(file.toString()).version;
|
|
@@ -44,7 +45,7 @@ const _getNodeRfcVersion = (npmGlobal) => {
|
|
|
44
45
|
catch (e) {
|
|
45
46
|
}
|
|
46
47
|
if (!file) {
|
|
47
|
-
|
|
48
|
+
trm_commons_1.Logger.warning(`Library node-rfc was not found!`, true);
|
|
48
49
|
}
|
|
49
50
|
else {
|
|
50
51
|
return JSON.parse(file.toString()).version;
|
|
@@ -67,7 +68,7 @@ const _getNpmLatestForText = (packageName, installedVersion, text) => __awaiter(
|
|
|
67
68
|
});
|
|
68
69
|
function info(commandArgs) {
|
|
69
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
|
|
71
|
+
trm_commons_1.Logger.loading(`Reading data...`);
|
|
71
72
|
const npmGlobal = yield (0, trm_core_1.getNpmGlobalPath)();
|
|
72
73
|
const clientLatest = yield (0, utils_1.checkCliUpdate)(false);
|
|
73
74
|
const clientVersion = (0, utils_1.getClientVersion)();
|
|
@@ -177,13 +178,13 @@ function info(commandArgs) {
|
|
|
177
178
|
text: chalk_1.default.bold(`Client`),
|
|
178
179
|
children: clientChildrenTree
|
|
179
180
|
};
|
|
180
|
-
|
|
181
|
+
trm_commons_1.Logger.tree(clientTree);
|
|
181
182
|
const serverTree = {
|
|
182
183
|
text: chalk_1.default.bold(`Server (${trm_core_1.SystemConnector.getDest()})`),
|
|
183
184
|
children: serverDependenciesTree
|
|
184
185
|
};
|
|
185
186
|
if (!(trm_core_1.SystemConnector.systemConnector instanceof utils_1.NoConnection)) {
|
|
186
|
-
|
|
187
|
+
trm_commons_1.Logger.tree(serverTree);
|
|
187
188
|
}
|
|
188
189
|
});
|
|
189
190
|
}
|
package/dist/commands/install.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.install = void 0;
|
|
|
13
13
|
const trm_core_1 = require("trm-core");
|
|
14
14
|
const utils_1 = require("../utils");
|
|
15
15
|
const commons_1 = require("./commons");
|
|
16
|
+
const trm_commons_1 = require("trm-commons");
|
|
16
17
|
const _parsePackageReplacementsArgument = (arg) => {
|
|
17
18
|
if (arg) {
|
|
18
19
|
try {
|
|
@@ -76,7 +77,7 @@ function install(commandArgs) {
|
|
|
76
77
|
if (result.installTransport) {
|
|
77
78
|
sOutput += `, use ${result.installTransport.trkorr} transport in landscape`;
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
+
trm_commons_1.Logger.success(sOutput);
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
exports.install = install;
|
package/dist/commands/list.js
CHANGED
|
@@ -16,9 +16,10 @@ exports.list = void 0;
|
|
|
16
16
|
const trm_core_1 = require("trm-core");
|
|
17
17
|
const commons_1 = require("./commons");
|
|
18
18
|
const chalk_1 = __importDefault(require("chalk"));
|
|
19
|
+
const trm_commons_1 = require("trm-commons");
|
|
19
20
|
function list(commandArgs) {
|
|
20
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
|
|
22
|
+
trm_commons_1.Logger.loading(`Reading packages...`);
|
|
22
23
|
const dest = trm_core_1.SystemConnector.getDest();
|
|
23
24
|
var aPackages = yield commons_1.CommandContext.getSystemPackages();
|
|
24
25
|
var iLocals = aPackages.filter(o => o.registry.getRegistryType() === trm_core_1.RegistryType.LOCAL).length;
|
|
@@ -48,20 +49,20 @@ function list(commandArgs) {
|
|
|
48
49
|
]);
|
|
49
50
|
}
|
|
50
51
|
catch (e) {
|
|
51
|
-
|
|
52
|
+
trm_commons_1.Logger.error(e, true);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
if (tableData.length < aPackages.length) {
|
|
55
|
-
|
|
56
|
+
trm_commons_1.Logger.warning(`${aPackages.length - tableData.length} packages couldn't be printed (check logs).`);
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
trm_commons_1.Logger.info(`${dest} has ${aPackages.length} packages.`);
|
|
59
|
+
trm_commons_1.Logger.table(tableHead, tableData);
|
|
59
60
|
if (iLocals > 0 && !commandArgs.locals) {
|
|
60
|
-
|
|
61
|
+
trm_commons_1.Logger.warning(`There ${iLocals === 1 ? 'is' : 'are'} ${iLocals} local package${iLocals === 1 ? '' : 's'}. Run with option -l (--locals) to list ${iLocals === 1 ? 'it' : 'them'}.`);
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
else {
|
|
64
|
-
|
|
65
|
+
trm_commons_1.Logger.info(`${dest} has 0 packages.`);
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
}
|
package/dist/commands/login.js
CHANGED
|
@@ -10,17 +10,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.login = void 0;
|
|
13
|
-
const trm_core_1 = require("trm-core");
|
|
14
13
|
const registryAlias_1 = require("../registryAlias");
|
|
15
14
|
const whoami_1 = require("./whoami");
|
|
16
15
|
const commons_1 = require("./commons");
|
|
16
|
+
const trm_commons_1 = require("trm-commons");
|
|
17
17
|
function login(commandArgs) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
var continueLogin = false;
|
|
20
20
|
if (!commandArgs.force) {
|
|
21
21
|
try {
|
|
22
22
|
const whoami = yield commons_1.CommandContext.getRegistry().whoAmI();
|
|
23
|
-
const inq1 = yield
|
|
23
|
+
const inq1 = yield trm_commons_1.Inquirer.prompt({
|
|
24
24
|
type: "confirm",
|
|
25
25
|
name: "continue",
|
|
26
26
|
message: `Already logged in as "${whoami.username}". Do you want to logout and continue?`,
|
|
@@ -51,7 +51,7 @@ function login(commandArgs) {
|
|
|
51
51
|
}
|
|
52
52
|
yield commons_1.CommandContext.getRegistry().authenticate(oAuth);
|
|
53
53
|
oAuth = commons_1.CommandContext.getRegistry().getAuthData();
|
|
54
|
-
|
|
54
|
+
trm_commons_1.Logger.success('Logged in.');
|
|
55
55
|
registryAlias_1.RegistryAlias.update(commons_1.CommandContext.getRegistry().name, oAuth);
|
|
56
56
|
yield (0, whoami_1.whoami)({});
|
|
57
57
|
}
|
package/dist/commands/logout.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.logout = void 0;
|
|
13
|
-
const
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
14
|
const registryAlias_1 = require("../registryAlias");
|
|
15
15
|
const commons_1 = require("./commons");
|
|
16
16
|
function logout(commandArgs) {
|
|
@@ -18,10 +18,10 @@ function logout(commandArgs) {
|
|
|
18
18
|
try {
|
|
19
19
|
yield commons_1.CommandContext.getRegistry().whoAmI();
|
|
20
20
|
registryAlias_1.RegistryAlias.update(commons_1.CommandContext.getRegistry().name, null);
|
|
21
|
-
|
|
21
|
+
trm_commons_1.Logger.info(`Logged out.`);
|
|
22
22
|
}
|
|
23
23
|
catch (e) {
|
|
24
|
-
|
|
24
|
+
trm_commons_1.Logger.info(`Not logged in. Did you mean to use command "login"?`);
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
}
|
package/dist/commands/pack.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.pack = void 0;
|
|
|
13
13
|
const trm_core_1 = require("trm-core");
|
|
14
14
|
const utils_1 = require("../utils");
|
|
15
15
|
const commons_1 = require("./commons");
|
|
16
|
+
const trm_commons_1 = require("trm-commons");
|
|
16
17
|
const _parseDependenciesArg = (arg) => {
|
|
17
18
|
if (arg) {
|
|
18
19
|
try {
|
|
@@ -45,7 +46,7 @@ function pack(commandArgs) {
|
|
|
45
46
|
throw new Error(`Provide an output path for the file with option -o (--output). Run with option -h (--help) for more information.`);
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
48
|
-
outputPath = (yield
|
|
49
|
+
outputPath = (yield trm_commons_1.Inquirer.prompt({
|
|
49
50
|
message: `Output path`,
|
|
50
51
|
name: 'outputPath',
|
|
51
52
|
type: `input`
|
|
@@ -89,7 +90,7 @@ function pack(commandArgs) {
|
|
|
89
90
|
}
|
|
90
91
|
});
|
|
91
92
|
const sOutput = `+ ${result.trmPackage.manifest.get().name} ${result.trmPackage.manifest.get().version} >> ${outputPath}`;
|
|
92
|
-
|
|
93
|
+
trm_commons_1.Logger.success(sOutput);
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
96
|
exports.pack = pack;
|
package/dist/commands/ping.js
CHANGED
|
@@ -11,11 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ping = void 0;
|
|
13
13
|
const trm_core_1 = require("trm-core");
|
|
14
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
15
|
function ping(commandArgs) {
|
|
15
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
|
|
17
|
+
trm_commons_1.Logger.loading(`Pinging trm-server on ${trm_core_1.SystemConnector.getDest()}...`);
|
|
17
18
|
const pingValue = yield trm_core_1.SystemConnector.ping();
|
|
18
|
-
|
|
19
|
+
trm_commons_1.Logger.info(pingValue);
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
22
|
exports.ping = ping;
|
|
@@ -13,10 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.connect = void 0;
|
|
16
|
-
const trm_core_1 = require("trm-core");
|
|
17
16
|
const systemAlias_1 = require("../../systemAlias");
|
|
18
17
|
const utils_1 = require("../../utils");
|
|
19
18
|
const normalize_url_1 = __importDefault(require("@esm2cjs/normalize-url"));
|
|
19
|
+
const trm_commons_1 = require("trm-commons");
|
|
20
20
|
const languageList = [
|
|
21
21
|
{ value: 'AR', name: 'AR (Arabic)' },
|
|
22
22
|
{ value: 'BG', name: 'BG (Bulgarian)' },
|
|
@@ -95,7 +95,7 @@ function connect(commandArgs, createAliasIfNotExist = true, addNoConnection) {
|
|
|
95
95
|
var result;
|
|
96
96
|
var inputType;
|
|
97
97
|
if (!commandArgs.ashost && !commandArgs.dest && !commandArgs.sysnr) {
|
|
98
|
-
const inq1 = yield
|
|
98
|
+
const inq1 = yield trm_commons_1.Inquirer.prompt({
|
|
99
99
|
type: `list`,
|
|
100
100
|
name: `inputType`,
|
|
101
101
|
message: `Select connection type`,
|
|
@@ -112,7 +112,7 @@ function connect(commandArgs, createAliasIfNotExist = true, addNoConnection) {
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
else if (inputType === 'alias') {
|
|
115
|
-
const inq2 = yield
|
|
115
|
+
const inq2 = yield trm_commons_1.Inquirer.prompt({
|
|
116
116
|
type: `list`,
|
|
117
117
|
name: `aliasName`,
|
|
118
118
|
message: `Select alias`,
|
|
@@ -129,7 +129,7 @@ function connect(commandArgs, createAliasIfNotExist = true, addNoConnection) {
|
|
|
129
129
|
}
|
|
130
130
|
else {
|
|
131
131
|
if (inputType === 'logon') {
|
|
132
|
-
const inq3 = yield
|
|
132
|
+
const inq3 = yield trm_commons_1.Inquirer.prompt({
|
|
133
133
|
type: `list`,
|
|
134
134
|
name: `logonConnection`,
|
|
135
135
|
message: `Select connection`,
|
|
@@ -149,7 +149,7 @@ function connect(commandArgs, createAliasIfNotExist = true, addNoConnection) {
|
|
|
149
149
|
else {
|
|
150
150
|
type = commandArgs.type;
|
|
151
151
|
}
|
|
152
|
-
result = yield
|
|
152
|
+
result = yield trm_commons_1.Inquirer.prompt([{
|
|
153
153
|
type: `list`,
|
|
154
154
|
name: `type`,
|
|
155
155
|
message: `Connection type`,
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.pickRegistry = void 0;
|
|
13
|
-
const
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
14
|
const registryAlias_1 = require("../../registryAlias");
|
|
15
15
|
function pickRegistry() {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -21,7 +21,7 @@ function pickRegistry() {
|
|
|
21
21
|
registryAlias = registryAlias_1.RegistryAlias.get(allAliases[0].alias);
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
const inq1 = yield
|
|
24
|
+
const inq1 = yield trm_commons_1.Inquirer.prompt({
|
|
25
25
|
type: "list",
|
|
26
26
|
name: "alias",
|
|
27
27
|
message: `Choose registry`,
|
package/dist/commands/publish.js
CHANGED
|
@@ -37,6 +37,7 @@ const trm_core_1 = require("trm-core");
|
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const utils_1 = require("../utils");
|
|
39
39
|
const commons_1 = require("./commons");
|
|
40
|
+
const trm_commons_1 = require("trm-commons");
|
|
40
41
|
const _parseDependenciesArg = (arg) => {
|
|
41
42
|
if (arg) {
|
|
42
43
|
try {
|
|
@@ -112,7 +113,7 @@ function publish(commandArgs) {
|
|
|
112
113
|
}
|
|
113
114
|
});
|
|
114
115
|
const sOutput = `+ ${result.trmPackage.manifest.get().name} ${result.trmPackage.manifest.get().version} on ${commons_1.CommandContext.getRegistry().name}`;
|
|
115
|
-
|
|
116
|
+
trm_commons_1.Logger.success(sOutput);
|
|
116
117
|
});
|
|
117
118
|
}
|
|
118
119
|
exports.publish = publish;
|
|
@@ -10,14 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.removeRegistry = void 0;
|
|
13
|
-
const
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
14
|
const registryAlias_1 = require("../registryAlias");
|
|
15
15
|
function removeRegistry(commandArgs) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
const registryName = commandArgs.registryName.trim();
|
|
18
18
|
registryAlias_1.RegistryAlias.get(registryName);
|
|
19
19
|
const force = commandArgs.force;
|
|
20
|
-
const inq1 = yield
|
|
20
|
+
const inq1 = yield trm_commons_1.Inquirer.prompt({
|
|
21
21
|
type: "confirm",
|
|
22
22
|
name: "removeRegistry",
|
|
23
23
|
message: `Do you really want to remove "${registryName}" registry?`,
|
|
@@ -26,11 +26,11 @@ function removeRegistry(commandArgs) {
|
|
|
26
26
|
});
|
|
27
27
|
const confirmRemove = inq1.removeRegistry !== undefined ? inq1.removeRegistry : force;
|
|
28
28
|
if (!confirmRemove) {
|
|
29
|
-
|
|
29
|
+
trm_commons_1.Logger.info(`Registry "${registryName}" was not removed.`);
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
32
|
registryAlias_1.RegistryAlias.delete(registryName);
|
|
33
|
-
|
|
33
|
+
trm_commons_1.Logger.success(`Registry removed.`);
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
}
|
|
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.settings = void 0;
|
|
13
|
-
const trm_core_1 = require("trm-core");
|
|
14
13
|
const settings_1 = require("../settings");
|
|
14
|
+
const trm_commons_1 = require("trm-commons");
|
|
15
15
|
function settings(commandArgs) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
const setArgument = commandArgs.set;
|
|
@@ -26,7 +26,7 @@ function settings(commandArgs) {
|
|
|
26
26
|
}
|
|
27
27
|
const settingsData = settings_1.Settings.getInstance().data;
|
|
28
28
|
Object.keys(settingsData).forEach(k => {
|
|
29
|
-
|
|
29
|
+
trm_commons_1.Logger.log(`${k}: ${settingsData[k]}`);
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -34,8 +34,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.unpublish = void 0;
|
|
36
36
|
const semver = __importStar(require("semver"));
|
|
37
|
-
const trm_core_1 = require("trm-core");
|
|
38
37
|
const commons_1 = require("./commons");
|
|
38
|
+
const trm_commons_1 = require("trm-commons");
|
|
39
39
|
function unpublish(commandArgs) {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
41
|
const packageName = commandArgs.package;
|
|
@@ -46,7 +46,7 @@ function unpublish(commandArgs) {
|
|
|
46
46
|
}
|
|
47
47
|
yield registry.unpublish(packageName, packageVersion);
|
|
48
48
|
const sOutput = `- ${packageName} ${packageVersion} on ${registry.name}`;
|
|
49
|
-
|
|
49
|
+
trm_commons_1.Logger.success(sOutput);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
exports.unpublish = unpublish;
|
package/dist/commands/view.js
CHANGED
|
@@ -19,9 +19,10 @@ const semver_1 = require("semver");
|
|
|
19
19
|
const registryAlias_1 = require("../registryAlias");
|
|
20
20
|
const utils_1 = require("../utils");
|
|
21
21
|
const chalk_1 = __importDefault(require("chalk"));
|
|
22
|
+
const trm_commons_1 = require("trm-commons");
|
|
22
23
|
const _printHeaderSection = (packageName) => {
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
trm_commons_1.Logger.info(`Package name: ${chalk_1.default.bold(packageName)}`);
|
|
25
|
+
trm_commons_1.Logger.info(`Registry: ${commons_1.CommandContext.getRegistry().name}`);
|
|
25
26
|
};
|
|
26
27
|
const _printVersionSection = (systemPackage, registryView) => {
|
|
27
28
|
if (!systemPackage && !registryView) {
|
|
@@ -32,21 +33,21 @@ const _printVersionSection = (systemPackage, registryView) => {
|
|
|
32
33
|
console.log('');
|
|
33
34
|
if (systemPackage) {
|
|
34
35
|
oSystemManifest = systemPackage.manifest.get();
|
|
35
|
-
|
|
36
|
+
trm_commons_1.Logger.success(`Installed on ${trm_core_1.SystemConnector.getDest()}: Yes`);
|
|
36
37
|
console.log(`Installed version: ${oSystemManifest.version}`);
|
|
37
38
|
}
|
|
38
39
|
else {
|
|
39
|
-
|
|
40
|
+
trm_commons_1.Logger.error(`Installed on ${trm_core_1.SystemConnector.getDest()}: No`);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
if (registryView && registryView.release) {
|
|
43
44
|
console.log(`Latest version available: ${registryView.release.version}`);
|
|
44
45
|
if (oSystemManifest) {
|
|
45
46
|
if ((0, semver_1.eq)(oSystemManifest.version, registryView.release.version)) {
|
|
46
|
-
|
|
47
|
+
trm_commons_1.Logger.success(`Latest version installed: Yes`);
|
|
47
48
|
}
|
|
48
49
|
else {
|
|
49
|
-
|
|
50
|
+
trm_commons_1.Logger.error(`Latest version installed: No`);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
}
|
|
@@ -97,7 +98,7 @@ const _printManifestSection = (manifest) => {
|
|
|
97
98
|
const _printDependenciesSection = (dependencies) => {
|
|
98
99
|
if (dependencies.length > 0) {
|
|
99
100
|
console.log('');
|
|
100
|
-
|
|
101
|
+
trm_commons_1.Logger.info(`This package has a total of ${dependencies.length} dependencies.`);
|
|
101
102
|
const registryAliases = registryAlias_1.RegistryAlias.getAll();
|
|
102
103
|
const tableHead = [`Name`, `Version`, `Registry`];
|
|
103
104
|
var tableData = [];
|
|
@@ -123,14 +124,14 @@ const _printDependenciesSection = (dependencies) => {
|
|
|
123
124
|
dependencyRegistry
|
|
124
125
|
]);
|
|
125
126
|
});
|
|
126
|
-
|
|
127
|
+
trm_commons_1.Logger.table(tableHead, tableData);
|
|
127
128
|
}
|
|
128
129
|
};
|
|
129
130
|
function view(commandArgs) {
|
|
130
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
132
|
const packageName = commandArgs.package;
|
|
132
133
|
const dest = trm_core_1.SystemConnector.getDest();
|
|
133
|
-
|
|
134
|
+
trm_commons_1.Logger.loading(`Searching package ${packageName}...`);
|
|
134
135
|
const aSystemPackages = yield commons_1.CommandContext.getSystemPackages();
|
|
135
136
|
const oSystemView = aSystemPackages.find(o => o.compareName(packageName) && o.compareRegistry(commons_1.CommandContext.getRegistry()));
|
|
136
137
|
const oRegistryView = yield (0, commons_1.viewRegistryPackage)(packageName, true);
|
package/dist/commands/whoami.js
CHANGED
|
@@ -10,21 +10,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.whoami = void 0;
|
|
13
|
-
const
|
|
13
|
+
const trm_commons_1 = require("trm-commons");
|
|
14
14
|
const commons_1 = require("./commons");
|
|
15
15
|
function whoami(commandArgs) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
try {
|
|
18
18
|
const whoAmI = yield commons_1.CommandContext.getRegistry().whoAmI();
|
|
19
|
-
|
|
19
|
+
trm_commons_1.Logger.info(`Username: ${whoAmI.username}`);
|
|
20
20
|
if (whoAmI.logonMessage) {
|
|
21
|
-
|
|
21
|
+
trm_commons_1.Logger.registryResponse(whoAmI.logonMessage);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
catch (e) {
|
|
25
25
|
if (e.status === 400) {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
trm_commons_1.Logger.error(`Registry response error: ${e.status} ${e.response}`, true);
|
|
27
|
+
trm_commons_1.Logger.error(`Not logged in.`);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
30
|
throw e;
|
|
@@ -40,7 +40,7 @@ const utils_1 = require("../utils");
|
|
|
40
40
|
const path_1 = __importDefault(require("path"));
|
|
41
41
|
const fs = __importStar(require("fs"));
|
|
42
42
|
const ini = __importStar(require("ini"));
|
|
43
|
-
const
|
|
43
|
+
const trm_commons_1 = require("trm-commons");
|
|
44
44
|
const SYSTEM_FILE_NAME = "systems.ini";
|
|
45
45
|
class SystemAlias {
|
|
46
46
|
constructor(type, _connection, _login) {
|
|
@@ -206,7 +206,7 @@ class SystemAlias {
|
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
if (!alias) {
|
|
209
|
-
const aliasName = (yield
|
|
209
|
+
const aliasName = (yield trm_commons_1.Inquirer.prompt([{
|
|
210
210
|
name: 'create',
|
|
211
211
|
message: 'Create new alias for connection?',
|
|
212
212
|
type: 'confirm',
|
|
@@ -13,11 +13,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.checkCliUpdate = void 0;
|
|
16
|
-
const trm_core_1 = require("trm-core");
|
|
17
16
|
const semver_1 = require("semver");
|
|
18
17
|
const getClientVersion_1 = require("./getClientVersion");
|
|
19
18
|
const chalk_1 = __importDefault(require("chalk"));
|
|
20
19
|
const getNpmPackageLatestVersion_1 = require("./getNpmPackageLatestVersion");
|
|
20
|
+
const trm_commons_1 = require("trm-commons");
|
|
21
21
|
function checkCliUpdate(print) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
try {
|
|
@@ -26,11 +26,11 @@ function checkCliUpdate(print) {
|
|
|
26
26
|
const versionDiff = (0, semver_1.diff)(localVersion, latestVersion);
|
|
27
27
|
if ((versionDiff === 'minor' || versionDiff === 'major') && (0, semver_1.gt)(latestVersion, localVersion)) {
|
|
28
28
|
if (print) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
trm_commons_1.Logger.warning(`A newer release of trm-client (v${chalk_1.default.bold(latestVersion)}) is available.`);
|
|
30
|
+
trm_commons_1.Logger.warning(`New releases can introduce features and bug fixes.`);
|
|
31
|
+
trm_commons_1.Logger.warning(`It is recommended to update your client by running the command`);
|
|
32
|
+
trm_commons_1.Logger.warning(` npm update trm-client --global`);
|
|
33
|
+
trm_commons_1.Logger.warning(` `);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
return {
|
|
@@ -39,7 +39,7 @@ function checkCliUpdate(print) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
catch (e) {
|
|
42
|
-
|
|
42
|
+
trm_commons_1.Logger.error(e, true);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -42,6 +42,7 @@ const trm_core_1 = require("trm-core");
|
|
|
42
42
|
const getLogFolder_1 = require("./getLogFolder");
|
|
43
43
|
const registryAlias_1 = require("../registryAlias");
|
|
44
44
|
const commons_1 = require("../commands/commons");
|
|
45
|
+
const trm_commons_1 = require("trm-commons");
|
|
45
46
|
var LoggerType;
|
|
46
47
|
(function (LoggerType) {
|
|
47
48
|
LoggerType["CLI"] = "CLI";
|
|
@@ -59,16 +60,16 @@ const _getLogger = (type, debug, logOutputFolder) => {
|
|
|
59
60
|
logOutputFolder = (0, getLogFolder_1.getLogFolder)();
|
|
60
61
|
}
|
|
61
62
|
switch (type) {
|
|
62
|
-
case LoggerType.CLI: return new
|
|
63
|
-
case LoggerType.CLI_LOG: return new
|
|
64
|
-
case LoggerType.CONSOLE: return new
|
|
65
|
-
case LoggerType.VOID: return new
|
|
63
|
+
case LoggerType.CLI: return new trm_commons_1.CliLogger(debug);
|
|
64
|
+
case LoggerType.CLI_LOG: return new trm_commons_1.CliLogFileLogger(logOutputFolder, debug);
|
|
65
|
+
case LoggerType.CONSOLE: return new trm_commons_1.ConsoleLogger(debug);
|
|
66
|
+
case LoggerType.VOID: return new trm_commons_1.DummyLogger();
|
|
66
67
|
default: throw new Error(`Unknown logger type "${type}". Possible values are ${Object.keys(LoggerType).map(k => LoggerType[k]).join(', ')}.`);
|
|
67
68
|
}
|
|
68
69
|
};
|
|
69
70
|
const _getInquirer = (type) => {
|
|
70
71
|
switch (type) {
|
|
71
|
-
case InquirerType.CLI: return new
|
|
72
|
+
case InquirerType.CLI: return new trm_commons_1.CliInquirer();
|
|
72
73
|
default: throw new Error(`Unknown inquirer type "${type}". Possible values are ${Object.keys(InquirerType).map(k => InquirerType[k]).join(', ')}.`);
|
|
73
74
|
}
|
|
74
75
|
};
|
|
@@ -76,10 +77,10 @@ function executeCommand(args) {
|
|
|
76
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
78
|
var exitCode;
|
|
78
79
|
try {
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
trm_commons_1.Inquirer.inquirer = _getInquirer(InquirerType.CLI);
|
|
81
|
+
trm_commons_1.Logger.logger = _getLogger(args.logType, args.debug, args.logOutputFolder);
|
|
81
82
|
if (!/^win/i.test(process.platform)) {
|
|
82
|
-
|
|
83
|
+
trm_commons_1.Logger.warning(`Running on untested OS ${process.platform}! Some features aren't tested yet.`);
|
|
83
84
|
}
|
|
84
85
|
const requiresConnection = args.requiresConnection;
|
|
85
86
|
const requiresTrmDependencies = args.requiresTrmDependencies;
|
|
@@ -121,11 +122,11 @@ function executeCommand(args) {
|
|
|
121
122
|
if (registryAuthBlacklist.includes(registryPing.authenticationType)) {
|
|
122
123
|
throw new Error(`This command is not supported by registry "${registry.name}".`);
|
|
123
124
|
}
|
|
124
|
-
|
|
125
|
+
trm_commons_1.Logger.registryResponse(registryPing.wallMessage);
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
catch (e) {
|
|
128
|
-
|
|
129
|
+
trm_commons_1.Logger.error(e, true);
|
|
129
130
|
if (!ignoreRegistryUnreachable) {
|
|
130
131
|
throw new Error(`Registry "${registry.name}" is unreachable.`);
|
|
131
132
|
}
|
|
@@ -135,8 +136,8 @@ function executeCommand(args) {
|
|
|
135
136
|
yield registry.authenticate(registryAlias.authData);
|
|
136
137
|
}
|
|
137
138
|
catch (e) {
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
trm_commons_1.Logger.error(e, true);
|
|
140
|
+
trm_commons_1.Logger.warning(`Registry "${registry.name}" login failed.`);
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
commons_1.CommandContext.registry = registry;
|
|
@@ -162,8 +163,8 @@ function executeCommand(args) {
|
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
yield commands[commandFn](args);
|
|
165
|
-
if (
|
|
166
|
-
|
|
166
|
+
if (trm_commons_1.Logger.logger instanceof trm_commons_1.CliLogger || trm_commons_1.Logger.logger instanceof trm_commons_1.CliLogFileLogger) {
|
|
167
|
+
trm_commons_1.Logger.logger.forceStop();
|
|
167
168
|
}
|
|
168
169
|
exitCode = 0;
|
|
169
170
|
}
|
|
@@ -172,9 +173,9 @@ function executeCommand(args) {
|
|
|
172
173
|
exitCode = 1;
|
|
173
174
|
}
|
|
174
175
|
finally {
|
|
175
|
-
if (
|
|
176
|
-
const sessionId =
|
|
177
|
-
const logFilePath =
|
|
176
|
+
if (trm_commons_1.Logger.logger instanceof trm_commons_1.CliLogFileLogger) {
|
|
177
|
+
const sessionId = trm_commons_1.Logger.logger.getSessionId();
|
|
178
|
+
const logFilePath = trm_commons_1.Logger.logger.getFilePath();
|
|
178
179
|
console.log(`Log output "${logFilePath}" for session ID ${sessionId}.`);
|
|
179
180
|
}
|
|
180
181
|
process.exit(exitCode);
|
package/dist/utils/logError.js
CHANGED
|
@@ -17,18 +17,19 @@ const trm_core_1 = require("trm-core");
|
|
|
17
17
|
const util_1 = require("util");
|
|
18
18
|
const chalk_1 = __importDefault(require("chalk"));
|
|
19
19
|
const node_html_parser_1 = require("node-html-parser");
|
|
20
|
+
const trm_commons_1 = require("trm-commons");
|
|
20
21
|
function logError(err) {
|
|
21
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
23
|
var originalException;
|
|
23
24
|
if (err.originalException) {
|
|
24
25
|
originalException = err;
|
|
25
26
|
while (originalException.originalException) {
|
|
26
|
-
|
|
27
|
+
trm_commons_1.Logger.error((0, util_1.inspect)(originalException, { breakLength: Infinity, compact: true }), true);
|
|
27
28
|
originalException = originalException.originalException;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
31
|
-
|
|
32
|
+
trm_commons_1.Logger.error((0, util_1.inspect)(err, { breakLength: Infinity, compact: true }), true);
|
|
32
33
|
originalException = err;
|
|
33
34
|
}
|
|
34
35
|
var sError = (originalException.message || 'Unknown error.').trim();
|
|
@@ -65,7 +66,7 @@ function logError(err) {
|
|
|
65
66
|
}
|
|
66
67
|
aError.push(sError);
|
|
67
68
|
aError.forEach(message => {
|
|
68
|
-
|
|
69
|
+
trm_commons_1.Logger.error(message);
|
|
69
70
|
});
|
|
70
71
|
});
|
|
71
72
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trm-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "TRM (Transport Request Manager) Client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"ini": "^4.1.1",
|
|
46
46
|
"node-html-parser": "^6.1.13",
|
|
47
47
|
"semver": "^7.5.4",
|
|
48
|
-
"trm-
|
|
48
|
+
"trm-commons": "^1.0.0",
|
|
49
|
+
"trm-core": "^6.5.0",
|
|
49
50
|
"trm-registry-types": "^1.2.0",
|
|
50
51
|
"xml2js": "^0.6.2"
|
|
51
52
|
},
|
|
@@ -56,4 +57,4 @@
|
|
|
56
57
|
"@types/xml2js": "^0.4.11",
|
|
57
58
|
"rimraf": "^6.0.1"
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
+
}
|