trm-client 7.7.0 → 8.0.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 +1 -0
- package/changelog.txt +10 -0
- package/dist/command/implementations/Dirty.d.ts +6 -0
- package/dist/command/implementations/Dirty.js +64 -0
- package/dist/command/implementations/Install.js +0 -3
- package/dist/command/implementations/List.js +19 -12
- package/dist/command/implementations/View.js +19 -22
- package/dist/command/implementations/index.d.ts +1 -0
- package/dist/command/implementations/index.js +1 -0
- package/dist/index.js +2 -1
- package/dist/utils/DummyConnector.d.ts +3 -0
- package/dist/utils/DummyConnector.js +3 -0
- package/dist/utils/getSapLogonConnections.js +5 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
[](https://github.com/RegestaItalia/trm-client)
|
|
5
5
|
[](https://www.npmjs.com/package/trm-client)
|
|
6
6
|
[](https://www.npmjs.com/package/trm-client)
|
|
7
|
+
[](https://codewiki.google/github.com/regestaitalia/trm-docs)
|
|
7
8
|
|
|
8
9
|
| 🚀 This project is funded and maintained by 🏦 | 🔗 |
|
|
9
10
|
|-------------------------------------------------|----------------------------------------------------------------|
|
package/changelog.txt
CHANGED
|
@@ -8,6 +8,16 @@ Legend
|
|
|
8
8
|
+ : added
|
|
9
9
|
- : removed
|
|
10
10
|
|
|
11
|
+
2026-04-16 v8.0.0
|
|
12
|
+
-------------------
|
|
13
|
+
! trm-core ^9.0.0
|
|
14
|
+
! trm-commons ^3.7.1
|
|
15
|
+
+ dirty command
|
|
16
|
+
|
|
17
|
+
2026-03-23 v7.7.1
|
|
18
|
+
-------------------
|
|
19
|
+
* sapgui connections
|
|
20
|
+
|
|
11
21
|
2026-03-23 v7.7.0
|
|
12
22
|
-------------------
|
|
13
23
|
* pack command usage
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Dirty = void 0;
|
|
16
|
+
const trm_commons_1 = require("trm-commons");
|
|
17
|
+
const AbstractCommand_1 = require("../AbstractCommand");
|
|
18
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
19
|
+
class Dirty extends AbstractCommand_1.AbstractCommand {
|
|
20
|
+
init() {
|
|
21
|
+
this.registerOpts.requiresConnection = true;
|
|
22
|
+
this.registerOpts.requiresRegistry = true;
|
|
23
|
+
this.registerOpts.ignoreRegistryUnreachable = true;
|
|
24
|
+
this.command.description(`Show local objetcs that flagged a package as dirty.`);
|
|
25
|
+
this.command.argument(`<package>`, `Name of the dirty package to check.`);
|
|
26
|
+
this.command.option(`--latest-only`, `Show only the latest transports with changes`, true);
|
|
27
|
+
}
|
|
28
|
+
keepFirstByKey(entries) {
|
|
29
|
+
const seen = new Set();
|
|
30
|
+
return entries.filter(entry => {
|
|
31
|
+
const key = `${entry.pgmid}|${entry.object}|${entry.objName}`;
|
|
32
|
+
if (seen.has(key)) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
seen.add(key);
|
|
36
|
+
return true;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
handler() {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const packages = yield this.getSystemPackages();
|
|
42
|
+
const dirtyPackage = packages.find(o => o.compareName(this.args.package) && o.compareRegistry(this.getRegistry()));
|
|
43
|
+
if (!dirtyPackage) {
|
|
44
|
+
throw new Error(`Package "${this.args.package}" not found`);
|
|
45
|
+
}
|
|
46
|
+
if (!dirtyPackage.isDirty()) {
|
|
47
|
+
throw new Error(`Package "${this.args.package}" is not flagged as dirty!`);
|
|
48
|
+
}
|
|
49
|
+
trm_commons_1.Logger.warning(`Package "${this.args.package}" is flagged as dirty!`);
|
|
50
|
+
trm_commons_1.Logger.info(`This means that one (or more) of its objects were added/removed/changed and it's TRM manifest is ${chalk_1.default.bold('INVALID')}.`);
|
|
51
|
+
trm_commons_1.Logger.info(`Here's a list that contains all entries that flagged the package.`);
|
|
52
|
+
var dirtyEntries = dirtyPackage.getDirtyEntries();
|
|
53
|
+
if (this.args.latestOnly) {
|
|
54
|
+
trm_commons_1.Logger.info(`Showing only the latest transports with changes.`);
|
|
55
|
+
dirtyEntries = this.keepFirstByKey(dirtyEntries);
|
|
56
|
+
}
|
|
57
|
+
const tableHead = [`Transport`, `PGMID`, `OBJECT`, `OBJECT NAME`];
|
|
58
|
+
var tableData = [];
|
|
59
|
+
dirtyEntries.forEach(d => tableData.push([chalk_1.default.bold(d.trkorr), d.pgmid, d.object, d.objName]));
|
|
60
|
+
trm_commons_1.Logger.table(tableHead, tableData);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.Dirty = Dirty;
|
|
@@ -197,9 +197,6 @@ class Install extends AbstractCommand_1.AbstractCommand {
|
|
|
197
197
|
}
|
|
198
198
|
});
|
|
199
199
|
var sOutput = `${result.manifest.name} v${result.manifest.version} installed`;
|
|
200
|
-
if (result.installTransport) {
|
|
201
|
-
sOutput += `, use ${result.installTransport.trkorr} transport in landscape`;
|
|
202
|
-
}
|
|
203
200
|
trm_commons_1.Logger.success(sOutput);
|
|
204
201
|
});
|
|
205
202
|
}
|
|
@@ -27,33 +27,37 @@ class List extends AbstractCommand_1.AbstractCommand {
|
|
|
27
27
|
handler() {
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
29
|
const dest = trm_core_1.SystemConnector.getDest();
|
|
30
|
+
var iDirtyPackages = 0;
|
|
30
31
|
var aPackages = yield this.getSystemPackages();
|
|
31
32
|
var iLocals = aPackages.filter(o => o.registry.getRegistryType() === trm_core_1.RegistryType.LOCAL).length;
|
|
32
33
|
if (!this.args.locals) {
|
|
33
34
|
aPackages = aPackages.filter(o => o.registry.getRegistryType() !== trm_core_1.RegistryType.LOCAL);
|
|
34
35
|
}
|
|
35
36
|
if (aPackages.length > 0) {
|
|
36
|
-
const tableHead = [`Name`, `Version`, `Registry`, `Devclass`, `
|
|
37
|
+
const tableHead = [`Name`, `Version`, `Registry`, `Devclass`, `Transport`, `Dirty`];
|
|
37
38
|
var tableData = [];
|
|
38
39
|
for (const oPackage of aPackages) {
|
|
39
40
|
try {
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
var packageName = oPackage.packageName || '';
|
|
42
|
+
var version = oPackage.manifest.get().version || '';
|
|
42
43
|
const registry = oPackage.registry.getRegistryType() === trm_core_1.RegistryType.LOCAL ? chalk_1.default.bold(oPackage.registry.name) : oPackage.registry.name;
|
|
43
44
|
const devclass = oPackage.getDevclass() || '';
|
|
44
45
|
const linkedTransport = oPackage.manifest.getLinkedTransport();
|
|
45
|
-
const
|
|
46
|
-
var
|
|
47
|
-
if (
|
|
48
|
-
|
|
46
|
+
const transport = linkedTransport ? linkedTransport.trkorr : '';
|
|
47
|
+
var dirty = '';
|
|
48
|
+
if (oPackage.isDirty()) {
|
|
49
|
+
iDirtyPackages++;
|
|
50
|
+
dirty = chalk_1.default.bgYellowBright(chalk_1.default.bold(`⚠ Manifest does not match content!`));
|
|
51
|
+
packageName = chalk_1.default.strikethrough(packageName);
|
|
52
|
+
version = chalk_1.default.strikethrough(version);
|
|
49
53
|
}
|
|
50
54
|
tableData.push([
|
|
51
55
|
packageName,
|
|
52
56
|
version,
|
|
53
57
|
registry,
|
|
54
58
|
devclass,
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
transport,
|
|
60
|
+
dirty
|
|
57
61
|
]);
|
|
58
62
|
}
|
|
59
63
|
catch (e) {
|
|
@@ -79,19 +83,19 @@ class List extends AbstractCommand_1.AbstractCommand {
|
|
|
79
83
|
var packageTree = {
|
|
80
84
|
text: chalk_1.default.bold(`${p[0]} v${p[1]}`),
|
|
81
85
|
children: [{
|
|
82
|
-
text:
|
|
86
|
+
text: p[3],
|
|
83
87
|
children: []
|
|
84
88
|
}]
|
|
85
89
|
};
|
|
86
90
|
if (p[4]) {
|
|
87
91
|
packageTree.children.push({
|
|
88
|
-
text:
|
|
92
|
+
text: `${trm_core_1.Transport.getTransportIcon()} ${p[4]}`,
|
|
89
93
|
children: []
|
|
90
94
|
});
|
|
91
95
|
}
|
|
92
96
|
if (p[5]) {
|
|
93
97
|
packageTree.children.push({
|
|
94
|
-
text:
|
|
98
|
+
text: p[5],
|
|
95
99
|
children: []
|
|
96
100
|
});
|
|
97
101
|
}
|
|
@@ -106,6 +110,9 @@ class List extends AbstractCommand_1.AbstractCommand {
|
|
|
106
110
|
if (iLocals > 0 && !this.args.locals) {
|
|
107
111
|
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'}.`);
|
|
108
112
|
}
|
|
113
|
+
if (iDirtyPackages > 0) {
|
|
114
|
+
trm_commons_1.Logger.warning(`There ${iDirtyPackages === 1 ? 'is' : 'are'} ${iDirtyPackages} dirty package${iDirtyPackages === 1 ? '' : 's'}. Run command "trm dirty <package>" to view ${iLocals === 1 ? 'it' : 'them'}.`);
|
|
115
|
+
}
|
|
109
116
|
}
|
|
110
117
|
else {
|
|
111
118
|
trm_commons_1.Logger.info(`${dest} has 0 packages.`);
|
|
@@ -31,11 +31,14 @@ class View extends AbstractCommand_1.AbstractCommand {
|
|
|
31
31
|
If the package is not found on the system, it will automatically fall back to the data provided by the registry, granted it exists.`);
|
|
32
32
|
this.command.argument(`<package>`, `Name of the package.`);
|
|
33
33
|
}
|
|
34
|
-
printHeaderSection() {
|
|
34
|
+
printHeaderSection(sapPackage) {
|
|
35
35
|
trm_commons_1.Logger.info(`Package name: ${chalk_1.default.bold(this.args.package)}`);
|
|
36
36
|
trm_commons_1.Logger.info(`Registry: ${this.getRegistry().name}`);
|
|
37
|
+
if (sapPackage) {
|
|
38
|
+
trm_commons_1.Logger.info(`SAP Package: ${sapPackage}`);
|
|
39
|
+
}
|
|
37
40
|
}
|
|
38
|
-
printVersionSection(systemPackage, registryView) {
|
|
41
|
+
printVersionSection(isDirty, systemPackage, registryView) {
|
|
39
42
|
if (!systemPackage && !registryView) {
|
|
40
43
|
return;
|
|
41
44
|
}
|
|
@@ -45,7 +48,11 @@ If the package is not found on the system, it will automatically fall back to th
|
|
|
45
48
|
if (systemPackage) {
|
|
46
49
|
oSystemManifest = systemPackage.manifest.get();
|
|
47
50
|
trm_commons_1.Logger.success(`Installed on ${trm_core_1.SystemConnector.getDest()}: Yes`);
|
|
48
|
-
console.log(`Installed version: ${oSystemManifest.version}`);
|
|
51
|
+
console.log(chalk_1.default.strikethrough(`Installed version: ${oSystemManifest.version}`));
|
|
52
|
+
if (isDirty) {
|
|
53
|
+
trm_commons_1.Logger.warning(`${chalk_1.default.bold('WARNING')}: Package is flagged as "dirty": one or more objects of the package don't match with release declared in manifest`);
|
|
54
|
+
trm_commons_1.Logger.warning(`${chalk_1.default.bold('WARNING')}: Run command "trm dirty <package>" to see a list of local changes.`);
|
|
55
|
+
}
|
|
49
56
|
}
|
|
50
57
|
else {
|
|
51
58
|
trm_commons_1.Logger.error(`Installed on ${trm_core_1.SystemConnector.getDest()}: No`);
|
|
@@ -70,14 +77,8 @@ If the package is not found on the system, it will automatically fall back to th
|
|
|
70
77
|
}
|
|
71
78
|
printManifestSection(manifest) {
|
|
72
79
|
console.log('');
|
|
73
|
-
if (manifest.
|
|
74
|
-
console.log(
|
|
75
|
-
}
|
|
76
|
-
if (manifest.importTransport !== undefined) {
|
|
77
|
-
console.log(`TRM transport: ${manifest.importTransport}`);
|
|
78
|
-
}
|
|
79
|
-
if (manifest.workbenchTransport !== undefined) {
|
|
80
|
-
console.log(`Landscape transport: ${manifest.workbenchTransport}`);
|
|
80
|
+
if (manifest.transport !== undefined) {
|
|
81
|
+
console.log(`${trm_core_1.Transport.getTransportIcon()} ${manifest.transport}`);
|
|
81
82
|
}
|
|
82
83
|
if (manifest.private !== undefined) {
|
|
83
84
|
if (manifest.private) {
|
|
@@ -155,10 +156,12 @@ If the package is not found on the system, it will automatically fall back to th
|
|
|
155
156
|
var keywords;
|
|
156
157
|
var printManifest;
|
|
157
158
|
var dependencies;
|
|
159
|
+
var isDirty = false;
|
|
158
160
|
if (oSystemView) {
|
|
159
161
|
if (!oSystemView.manifest) {
|
|
160
162
|
throw new Error(`Package "${packageName}" found, but manifest is missing on ${dest}!`);
|
|
161
163
|
}
|
|
164
|
+
isDirty = oSystemView.isDirty();
|
|
162
165
|
const oSystemManifest = oSystemView.manifest.get();
|
|
163
166
|
if (Array.isArray(oSystemManifest.authors)) {
|
|
164
167
|
authors = oSystemManifest.authors.map(o => {
|
|
@@ -189,14 +192,9 @@ If the package is not found on the system, it will automatically fall back to th
|
|
|
189
192
|
else {
|
|
190
193
|
keywords = oSystemManifest.keywords;
|
|
191
194
|
}
|
|
192
|
-
var
|
|
193
|
-
var workbenchTransport;
|
|
194
|
-
try {
|
|
195
|
-
importTransport = oSystemView.manifest.getLinkedTransport().trkorr;
|
|
196
|
-
}
|
|
197
|
-
catch (e) { }
|
|
195
|
+
var transport;
|
|
198
196
|
try {
|
|
199
|
-
|
|
197
|
+
transport = oSystemView.manifest.getLinkedTransport().trkorr;
|
|
200
198
|
}
|
|
201
199
|
catch (e) { }
|
|
202
200
|
dependencies = oSystemManifest.dependencies || [];
|
|
@@ -210,8 +208,7 @@ If the package is not found on the system, it will automatically fall back to th
|
|
|
210
208
|
license: oSystemManifest.license,
|
|
211
209
|
authors,
|
|
212
210
|
keywords,
|
|
213
|
-
|
|
214
|
-
workbenchTransport
|
|
211
|
+
transport
|
|
215
212
|
};
|
|
216
213
|
}
|
|
217
214
|
else if (oRegistryView) {
|
|
@@ -227,8 +224,8 @@ If the package is not found on the system, it will automatically fall back to th
|
|
|
227
224
|
else {
|
|
228
225
|
throw new Error(`Package "${packageName}" does not exist or insufficient view permissions.`);
|
|
229
226
|
}
|
|
230
|
-
this.printHeaderSection();
|
|
231
|
-
this.printVersionSection(oSystemView, oRegistryView);
|
|
227
|
+
this.printHeaderSection(printManifest.devclass);
|
|
228
|
+
this.printVersionSection(isDirty, oSystemView, oRegistryView);
|
|
232
229
|
this.printManifestSection(printManifest);
|
|
233
230
|
this.printDependenciesSection(dependencies);
|
|
234
231
|
});
|
|
@@ -31,6 +31,7 @@ __exportStar(require("./List"), exports);
|
|
|
31
31
|
__exportStar(require("./Content"), exports);
|
|
32
32
|
__exportStar(require("./View"), exports);
|
|
33
33
|
__exportStar(require("./Compare"), exports);
|
|
34
|
+
__exportStar(require("./Dirty"), exports);
|
|
34
35
|
__exportStar(require("./FindDependencies"), exports);
|
|
35
36
|
__exportStar(require("./Cg3y"), exports);
|
|
36
37
|
__exportStar(require("./Cg3z"), exports);
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ Full documentation available at https://docs.trmregistry.com/
|
|
|
21
21
|
Public registry at https://trmregistry.com/
|
|
22
22
|
|
|
23
23
|
© 2023 RegestaItalia https://regestaitalia.eu/`)
|
|
24
|
-
.version((0, utils_1.getClientVersion)());
|
|
24
|
+
.version(process.env.DEVELOPMENT && process.env.DEVELOPMENT.toLowerCase().trim() === 'true' ? 'Development' : (0, utils_1.getClientVersion)());
|
|
25
25
|
program.configureHelp({
|
|
26
26
|
sortSubcommands: true,
|
|
27
27
|
visibleCommands: (cmd) => {
|
|
@@ -69,6 +69,7 @@ new implementations_1.List(program, 'list', ['ls']).register();
|
|
|
69
69
|
new implementations_1.Content(program, 'content', ['contents']).register();
|
|
70
70
|
new implementations_1.View(program, 'view').register();
|
|
71
71
|
new implementations_1.Compare(program, 'compare').register();
|
|
72
|
+
new implementations_1.Dirty(program, 'dirty').register();
|
|
72
73
|
new implementations_1.FindDependencies(program, 'find-dependencies').register();
|
|
73
74
|
new implementations_1.Cg3y(program, 'cg3y').register();
|
|
74
75
|
new implementations_1.Cg3z(program, 'cg3z').register();
|
|
@@ -91,4 +91,7 @@ export declare class DummyConnector implements ISystemConnector {
|
|
|
91
91
|
getRootDevclass: () => Promise<any>;
|
|
92
92
|
getTransportImportStatus: () => Promise<any>;
|
|
93
93
|
getTimezone: () => Promise<string>;
|
|
94
|
+
createCustTransport: () => Promise<any>;
|
|
95
|
+
getObjectsLocks: () => Promise<any>;
|
|
96
|
+
updateTrmPackageData: () => Promise<any>;
|
|
94
97
|
}
|
|
@@ -122,6 +122,9 @@ class DummyConnector {
|
|
|
122
122
|
this.getTimezone = () => __awaiter(this, void 0, void 0, function* () {
|
|
123
123
|
return 'UTC';
|
|
124
124
|
});
|
|
125
|
+
this.createCustTransport = () => __awaiter(this, void 0, void 0, function* () { return this._throw(); });
|
|
126
|
+
this.getObjectsLocks = () => __awaiter(this, void 0, void 0, function* () { return this._throw(); });
|
|
127
|
+
this.updateTrmPackageData = () => __awaiter(this, void 0, void 0, function* () { return this._throw(); });
|
|
125
128
|
}
|
|
126
129
|
_throw() {
|
|
127
130
|
throw new Error(`No connection to SAP server.`);
|
|
@@ -53,8 +53,8 @@ function getSapLogonConnections() {
|
|
|
53
53
|
if (sapLandscape) {
|
|
54
54
|
const sXml = fs.readFileSync(GlobalContext_1.GlobalContext.getInstance().getSettings().sapLandscape, { encoding: 'utf8', flag: 'r' });
|
|
55
55
|
const result = yield (0, xml2js_1.xml2js)(sXml);
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
result.Landscape.Services[0].Service.forEach((xmlObj) => {
|
|
57
|
+
try {
|
|
58
58
|
var obj = xmlObj['$'];
|
|
59
59
|
var addrMatches = obj.server.match(/(.*)\:(\d*)$/);
|
|
60
60
|
var ashost = addrMatches[1];
|
|
@@ -75,9 +75,9 @@ function getSapLogonConnections() {
|
|
|
75
75
|
ashost,
|
|
76
76
|
saprouter
|
|
77
77
|
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
}
|
|
79
|
+
catch (_a) { }
|
|
80
|
+
});
|
|
81
81
|
}
|
|
82
82
|
return systems;
|
|
83
83
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trm-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "TRM (Transport Request Manager) Client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
48
|
"sanitize-filename": "^1.6.3",
|
|
49
49
|
"semver": "^7.7.4",
|
|
50
|
-
"trm-commons": "^3.
|
|
51
|
-
"trm-core": "^
|
|
50
|
+
"trm-commons": "^3.7.1",
|
|
51
|
+
"trm-core": "^9.0.0",
|
|
52
52
|
"trm-registry-types": "^2.1.0",
|
|
53
53
|
"xml2js": "^0.6.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"trm-commons": "^3.
|
|
56
|
+
"trm-commons": "^3.7.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/ini": "^1.3.31",
|