trm-core 7.4.5 → 7.5.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 CHANGED
@@ -8,6 +8,17 @@ Legend
8
8
  + : added
9
9
  - : removed
10
10
 
11
+ 2025-09-03 v7.5.0
12
+ -------------------
13
+ ! trm-commons ^3.1.0
14
+ * npm global path
15
+ + rfc closeConnection method
16
+ ! private/protected methods/attributes
17
+
18
+ 2025-08-27 v7.4.6
19
+ -------------------
20
+ * template manifest values
21
+
11
22
  2025-08-17 v7.4.5
12
23
  -------------------
13
24
  ! node-r3trans ^2.0.1
@@ -25,7 +25,7 @@ exports.commit = {
25
25
  run: (context) => __awaiter(void 0, void 0, void 0, function* () {
26
26
  trm_commons_1.Logger.log('Commit (RFC Connection) step', true);
27
27
  trm_commons_1.Logger.loading(`Closing rfc connection...`, true);
28
- yield systemConnector_1.SystemConnector.systemConnector.close();
28
+ yield systemConnector_1.SystemConnector.systemConnector.closeConnection();
29
29
  trm_commons_1.Logger.loading(`Opening rfc connection...`, true);
30
30
  yield systemConnector_1.SystemConnector.systemConnector.connect(true);
31
31
  trm_commons_1.Logger.success(`Commit OK`, true);
@@ -277,19 +277,7 @@ exports.setManifestValues = {
277
277
  context.runtime.trmPackage.manifest.registry = context.rawInput.packageData.registry.endpoint;
278
278
  }
279
279
  if (!context.rawInput.contextData.noInquirer) {
280
- var inqDefault1 = context.runtime.trmPackage.manifest.postActivities || [];
281
- if (inqDefault1.length === 0) {
282
- inqDefault1.push({
283
- name: '<<class name>>',
284
- parameters: [{
285
- name: '<<parameter1>>',
286
- value: '<<value1>>'
287
- }, {
288
- name: '<<parameter2>>',
289
- value: '<<value2>>'
290
- }]
291
- });
292
- }
280
+ const inqDefault1 = context.runtime.trmPackage.manifest.postActivities || [];
293
281
  const inq = yield trm_commons_1.Inquirer.prompt([{
294
282
  message: context.runtime.trmPackage.manifest.postActivities.length > 0 ? `Do you want to edit ${context.runtime.trmPackage.manifest.postActivities.length} post activities?` : `Do you want to add post activities?`,
295
283
  type: 'confirm',
@@ -303,7 +291,16 @@ exports.setManifestValues = {
303
291
  when: (hash) => {
304
292
  return hash.editPostActivities;
305
293
  },
306
- default: JSON.stringify(inqDefault1, null, 2),
294
+ default: JSON.stringify(inqDefault1.length === 0 ? [{
295
+ name: '<<class name>>',
296
+ parameters: [{
297
+ name: '<<parameter1>>',
298
+ value: '<<value1>>'
299
+ }, {
300
+ name: '<<parameter2>>',
301
+ value: '<<value2>>'
302
+ }]
303
+ }] : inqDefault1, null, 2),
307
304
  validate: (input) => {
308
305
  try {
309
306
  const parsedInput = JSON.parse(input);
@@ -350,14 +347,7 @@ exports.setManifestValues = {
350
347
  });
351
348
  }
352
349
  if (!context.rawInput.contextData.noInquirer) {
353
- var inqDefault2 = context.runtime.trmPackage.manifest.dependencies || [];
354
- if (inqDefault2.length === 0) {
355
- inqDefault2.push({
356
- name: '<<name>>',
357
- version: '<<version>>',
358
- registry: '<<registry?>>'
359
- });
360
- }
350
+ const inqDefault2 = context.runtime.trmPackage.manifest.dependencies || [];
361
351
  const inq = yield trm_commons_1.Inquirer.prompt([{
362
352
  message: `Do you want to manually edit dependencies?`,
363
353
  type: 'confirm',
@@ -371,7 +361,11 @@ exports.setManifestValues = {
371
361
  when: (hash) => {
372
362
  return hash.editDependencies;
373
363
  },
374
- default: JSON.stringify(inqDefault2, null, 2),
364
+ default: JSON.stringify(inqDefault2.length === 0 ? [{
365
+ name: '<<name>>',
366
+ version: '<<version>>',
367
+ registry: '<<registry?>>'
368
+ }] : inqDefault2, null, 2),
375
369
  validate: (input) => {
376
370
  try {
377
371
  const parsedInput = JSON.parse(input);
@@ -393,13 +387,7 @@ exports.setManifestValues = {
393
387
  }
394
388
  }
395
389
  if (!context.rawInput.contextData.noInquirer) {
396
- var inqDefault3 = context.runtime.trmPackage.manifest.sapEntries || {};
397
- if (Object.keys(inqDefault3).length === 0) {
398
- inqDefault3['<<table>>'] = [{
399
- '<<field1>>': '<<value1>>',
400
- '<<field2>>': '<<value2>>'
401
- }];
402
- }
390
+ const inqDefault3 = context.runtime.trmPackage.manifest.sapEntries || {};
403
391
  const inq = yield trm_commons_1.Inquirer.prompt([{
404
392
  message: `Do you want to manually required SAP objects?`,
405
393
  type: 'confirm',
@@ -413,7 +401,12 @@ exports.setManifestValues = {
413
401
  when: (hash) => {
414
402
  return hash.editSapEntries;
415
403
  },
416
- default: JSON.stringify(inqDefault3, null, 2),
404
+ default: JSON.stringify(Object.keys(inqDefault3).length === 0 ? {
405
+ '<<table>>': [{
406
+ '<<field1>>': '<<value1>>',
407
+ '<<field2>>': '<<value2>>'
408
+ }]
409
+ } : inqDefault3, null, 2),
417
410
  validate: (input) => {
418
411
  try {
419
412
  const parsedInput = JSON.parse(input);
@@ -1,13 +1,14 @@
1
1
  import * as components from "./components";
2
2
  import * as struct from "./struct";
3
3
  import { IClient } from "./IClient";
4
+ import { AxiosInstance } from "axios";
4
5
  import { Login, RESTClientError, SapMessage } from ".";
5
6
  export declare class RESTClient implements IClient {
6
7
  endpoint: string;
7
8
  rfcdest: components.RFCDEST;
8
9
  private _login;
9
10
  private _cLangu;
10
- private _axiosInstance;
11
+ protected _axiosInstance: AxiosInstance;
11
12
  private _connected;
12
13
  constructor(endpoint: string, rfcdest: components.RFCDEST, _login: Login, _cLangu: string);
13
14
  open(): Promise<void>;
@@ -5,7 +5,7 @@ import { RFCClientError, SapMessage } from ".";
5
5
  export declare class RFCClient implements IClient {
6
6
  private _rfcClientArgs;
7
7
  private _cLangu;
8
- private _rfcClient;
8
+ protected _rfcClient: any;
9
9
  private _aliveCheck;
10
10
  constructor(_rfcClientArgs: any, _cLangu: string, traceDir?: string);
11
11
  private getRfcClient;
@@ -1,5 +1,5 @@
1
- import { CreateAxiosDefaults } from "axios";
1
+ import { AxiosInstance, CreateAxiosDefaults } from "axios";
2
2
  export declare const AXIOS_SESSION_HEADER = "X-TRM-SESSION-ID";
3
3
  export declare const AXIOS_INTERNAL_HEADER = "X-TRM-REQUEST-ID";
4
4
  export type AxiosCtx = 'Registry' | 'RestServer';
5
- export declare function getAxiosInstance(config: CreateAxiosDefaults<any>, sCtx: AxiosCtx): import("axios").AxiosInstance;
5
+ export declare function getAxiosInstance(config: CreateAxiosDefaults<any>, sCtx: AxiosCtx, inj?: AxiosInstance): AxiosInstance;
@@ -20,8 +20,8 @@ function _getInternalId(response) {
20
20
  return 'Unknown';
21
21
  }
22
22
  }
23
- function getAxiosInstance(config, sCtx) {
24
- const instance = axios_1.default.create(config);
23
+ function getAxiosInstance(config, sCtx, inj) {
24
+ var instance = inj || axios_1.default.create(config);
25
25
  instance.interceptors.request.use((request) => {
26
26
  const internalId = (0, uuid_1.v4)();
27
27
  request.headers.set(exports.AXIOS_INTERNAL_HEADER, internalId);
@@ -8,22 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.getNpmGlobalPath = getNpmGlobalPath;
16
13
  const child_process_1 = require("child_process");
17
- const path_1 = __importDefault(require("path"));
18
14
  const util_1 = require("util");
19
15
  const trm_commons_1 = require("trm-commons");
20
16
  function getNpmGlobalPath() {
21
17
  return __awaiter(this, void 0, void 0, function* () {
22
18
  trm_commons_1.Logger.loading(`Reading NPM global path...`);
23
19
  const execPromise = (0, util_1.promisify)(child_process_1.exec);
24
- const { stdout } = yield execPromise(`npm config get prefix`);
25
- const prefixPath = stdout.replace(/\n$/, '');
26
- const globalPath = path_1.default.join(prefixPath, 'node_modules');
20
+ const { stdout } = yield execPromise(`npm root -g`);
21
+ const globalPath = stdout.replace(/\n$/, '');
27
22
  trm_commons_1.Logger.log(`NPM Global path: ${globalPath}`, true);
28
23
  return globalPath;
29
24
  });
@@ -12,6 +12,7 @@ export interface ISystemConnector extends ISystemConnectorBase {
12
12
  getLogonLanguage: (c: boolean) => string;
13
13
  getLogonUser: () => string;
14
14
  connect: () => Promise<void>;
15
+ closeConnection: () => Promise<void>;
15
16
  checkConnection: () => Promise<boolean>;
16
17
  ping: () => Promise<string>;
17
18
  getFileSystem: () => Promise<struct.FILESYS>;
@@ -6,7 +6,7 @@ import * as components from "../client/components";
6
6
  import * as struct from "../client/struct";
7
7
  import { SystemConnectorBase } from "./SystemConnectorBase";
8
8
  import { RESTConnection } from "./RESTConnection";
9
- import { ClientError, SapMessage } from "../client";
9
+ import { ClientError, RESTClient, SapMessage } from "../client";
10
10
  import { SystemConnectorSupportedBulk } from "./SystemConnectorSupportedBulk";
11
11
  export declare class RESTSystemConnector extends SystemConnectorBase implements ISystemConnector {
12
12
  private _connection;
@@ -14,10 +14,10 @@ export declare class RESTSystemConnector extends SystemConnectorBase implements
14
14
  private _dest;
15
15
  private _lang;
16
16
  private _user;
17
- private _client;
17
+ protected _client: RESTClient;
18
18
  private _isServerApisAllowed;
19
19
  supportedBulk: SystemConnectorSupportedBulk;
20
- constructor(_connection: RESTConnection, _login: Login);
20
+ constructor(_connection: RESTConnection, _login: Login, normalizeEndpoint?: boolean);
21
21
  protected getSysname(): string;
22
22
  getDest(): string;
23
23
  protected getLangu(c: boolean): string;
@@ -32,6 +32,7 @@ export declare class RESTSystemConnector extends SystemConnectorBase implements
32
32
  getConnectionData(): RESTConnection;
33
33
  getLogonUser(): string;
34
34
  connect(): Promise<void>;
35
+ closeConnection(): Promise<void>;
35
36
  checkConnection(): Promise<boolean>;
36
37
  ping(): Promise<string>;
37
38
  getFileSystem(): Promise<struct.FILESYS>;
@@ -20,7 +20,7 @@ const normalize_url_1 = __importDefault(require("@esm2cjs/normalize-url"));
20
20
  const ENDPOINT_RESOURCE_BASE = '/ztrmserver';
21
21
  const NONE_DEST = 'NONE';
22
22
  class RESTSystemConnector extends SystemConnectorBase_1.SystemConnectorBase {
23
- constructor(_connection, _login) {
23
+ constructor(_connection, _login, normalizeEndpoint = true) {
24
24
  super();
25
25
  this._connection = _connection;
26
26
  this._login = _login;
@@ -31,10 +31,12 @@ class RESTSystemConnector extends SystemConnectorBase_1.SystemConnectorBase {
31
31
  this._login.user = this._login.user.toUpperCase();
32
32
  this._lang = this._login.lang;
33
33
  this._user = this._login.user;
34
- trm_commons_1.Logger.log(`REST connection data before normalize: ${JSON.stringify(this._connection)}`, true);
35
- this._connection.endpoint = (0, normalize_url_1.default)(this._connection.endpoint, {
36
- removeTrailingSlash: true
37
- });
34
+ if (normalizeEndpoint) {
35
+ trm_commons_1.Logger.log(`REST connection data before normalize: ${JSON.stringify(this._connection)}`, true);
36
+ this._connection.endpoint = (0, normalize_url_1.default)(this._connection.endpoint, {
37
+ removeTrailingSlash: true
38
+ });
39
+ }
38
40
  if (!new RegExp(`${ENDPOINT_RESOURCE_BASE}$`, 'gmi').test(this._connection.endpoint)) {
39
41
  this._connection.endpoint = `${this._connection.endpoint}${ENDPOINT_RESOURCE_BASE}`;
40
42
  }
@@ -119,6 +121,10 @@ class RESTSystemConnector extends SystemConnectorBase_1.SystemConnectorBase {
119
121
  }
120
122
  });
121
123
  }
124
+ closeConnection() {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ });
127
+ }
122
128
  checkConnection() {
123
129
  return __awaiter(this, void 0, void 0, function* () {
124
130
  return this._client.checkConnection();
@@ -1,4 +1,4 @@
1
- import { ClientError, SapMessage } from "../client";
1
+ import { ClientError, RFCClient, SapMessage } from "../client";
2
2
  import { DEVCLASS } from "../client/components";
3
3
  import { TADIR } from "../client/struct";
4
4
  import { RFCConnection } from "./RFCConnection";
@@ -14,7 +14,7 @@ export declare class RFCSystemConnector extends SystemConnectorBase implements I
14
14
  private _traceDir?;
15
15
  private _lang;
16
16
  private _user;
17
- private _client;
17
+ protected _client: RFCClient;
18
18
  private _isServerApisAllowed;
19
19
  supportedBulk: SystemConnectorSupportedBulk;
20
20
  constructor(_connection: RFCConnection, _login: Login, _traceDir?: string);
@@ -32,7 +32,7 @@ export declare class RFCSystemConnector extends SystemConnectorBase implements I
32
32
  getConnectionData(): RFCConnection;
33
33
  getLogonUser(): string;
34
34
  connect(silent?: boolean): Promise<void>;
35
- close(): Promise<void>;
35
+ closeConnection(): Promise<void>;
36
36
  checkConnection(): Promise<boolean>;
37
37
  ping(): Promise<string>;
38
38
  getFileSystem(): Promise<struct.FILESYS>;
@@ -100,7 +100,7 @@ class RFCSystemConnector extends SystemConnectorBase_1.SystemConnectorBase {
100
100
  }
101
101
  });
102
102
  }
103
- close() {
103
+ closeConnection() {
104
104
  return __awaiter(this, void 0, void 0, function* () {
105
105
  yield this._client.close();
106
106
  });
@@ -16,6 +16,7 @@ export declare namespace SystemConnector {
16
16
  function getLogonLanguage(c: boolean): string;
17
17
  function getLogonUser(): string;
18
18
  function connect(): Promise<void>;
19
+ function closeConnection(): Promise<void>;
19
20
  function checkConnection(): Promise<boolean>;
20
21
  function getTransportStatus(trkorr: TRKORR): Promise<string>;
21
22
  function getPackageWorkbenchTransport(oPackage: TrmPackage): Promise<Transport>;
@@ -58,6 +58,13 @@ var SystemConnector;
58
58
  });
59
59
  }
60
60
  SystemConnector.connect = connect;
61
+ function closeConnection() {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ yield checkSystemConnector();
64
+ return SystemConnector.systemConnector.closeConnection();
65
+ });
66
+ }
67
+ SystemConnector.closeConnection = closeConnection;
61
68
  function checkConnection() {
62
69
  return __awaiter(this, void 0, void 0, function* () {
63
70
  yield checkSystemConnector();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trm-core",
3
- "version": "7.4.5",
3
+ "version": "7.5.0",
4
4
  "description": "TRM (Transport Request Manager) Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -68,7 +68,7 @@
68
68
  "xml-js": "^1.6.11"
69
69
  },
70
70
  "peerDependencies": {
71
- "trm-commons": "^2.0.0"
71
+ "trm-commons": "^3.1.0"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@types/adm-zip": "^0.5.0",
@@ -86,7 +86,7 @@
86
86
  "@types/uuid": "^9.0.8",
87
87
  "jest": "^29.7.0",
88
88
  "rimraf": "^6.0.1",
89
- "trm-commons": "^2.0.0",
89
+ "trm-commons": "^3.1.0",
90
90
  "ts-jest": "^29.1.2",
91
91
  "ts-node": "^10.9.2",
92
92
  "typescript": "^5.8.2"