trm-core 6.3.0 → 6.4.1

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-04-28 v6.4.1
12
+ -------------------
13
+
14
+ ! node-r3trans ^1.5.0
15
+
16
+ 2025-04-28 v6.4.0
17
+ -------------------
18
+
19
+ + post activities in abap manifest
20
+ * return exception type for REST client
21
+
11
22
  2025-02-06 v6.3.0
12
23
  -------------------
13
24
 
@@ -62,7 +62,7 @@ class RESTClient {
62
62
  username: this._login.user,
63
63
  password: this._login.passwd
64
64
  },
65
- timeout: 10000,
65
+ timeout: 30000,
66
66
  }, AXIOS_CTX);
67
67
  }
68
68
  open() {
@@ -116,6 +116,7 @@ class RESTClient {
116
116
  if (axiosError.response.data.log) {
117
117
  rfcClientError.messageLog = axiosError.response.data.log;
118
118
  }
119
+ rfcClientError.exceptionType = error.message;
119
120
  logger_1.Logger.error(rfcClientError.toString(), true);
120
121
  throw rfcClientError;
121
122
  }));
@@ -150,49 +151,59 @@ class RESTClient {
150
151
  }
151
152
  readTable(tableName, fields, options) {
152
153
  return __awaiter(this, void 0, void 0, function* () {
153
- var sqlOutput = [];
154
- const delimiter = '|';
155
- var aOptions = [];
156
- if (options) {
157
- const aSplit = options.split(/\s+AND\s+/);
158
- if (aSplit.length > 1) {
159
- aSplit.forEach((s, i) => {
160
- var sText = s.trim();
161
- if (i !== 0) {
162
- sText = `AND ${sText}`;
163
- }
164
- aOptions.push({ text: sText });
154
+ try {
155
+ var sqlOutput = [];
156
+ const delimiter = '|';
157
+ var aOptions = [];
158
+ if (options) {
159
+ const aSplit = options.split(/\s+AND\s+/);
160
+ if (aSplit.length > 1) {
161
+ aSplit.forEach((s, i) => {
162
+ var sText = s.trim();
163
+ if (i !== 0) {
164
+ sText = `AND ${sText}`;
165
+ }
166
+ aOptions.push({ text: sText });
167
+ });
168
+ }
169
+ else {
170
+ aOptions = aSplit.map(s => {
171
+ return {
172
+ text: s
173
+ };
174
+ });
175
+ }
176
+ }
177
+ const result = yield this._axiosInstance.get('/read_table', {
178
+ params: {
179
+ rfcdest: this.rfcdest
180
+ },
181
+ data: {
182
+ query_table: tableName.toUpperCase(),
183
+ delimiter,
184
+ options: aOptions,
185
+ fields: fields
186
+ }
187
+ });
188
+ const data = result.data;
189
+ data.forEach(tab512 => {
190
+ var sqlLine = {};
191
+ const waSplit = tab512.wa.split(delimiter);
192
+ fields.forEach((field, index) => {
193
+ sqlLine[field.fieldName] = waSplit[index].trim();
165
194
  });
195
+ sqlOutput.push(sqlLine);
196
+ });
197
+ return (0, commons_1.normalize)(sqlOutput);
198
+ }
199
+ catch (e) {
200
+ if (e.message === 'TABLE_WITHOUT_DATA') {
201
+ return [];
166
202
  }
167
203
  else {
168
- aOptions = aSplit.map(s => {
169
- return {
170
- text: s
171
- };
172
- });
204
+ throw e;
173
205
  }
174
206
  }
175
- const result = yield this._axiosInstance.get('/read_table', {
176
- params: {
177
- rfcdest: this.rfcdest
178
- },
179
- data: {
180
- query_table: tableName.toUpperCase(),
181
- delimiter,
182
- options: aOptions,
183
- fields: fields
184
- }
185
- });
186
- const data = result.data;
187
- data.forEach(tab512 => {
188
- var sqlLine = {};
189
- const waSplit = tab512.wa.split(delimiter);
190
- fields.forEach((field, index) => {
191
- sqlLine[field.fieldName] = waSplit[index].trim();
192
- });
193
- sqlOutput.push(sqlLine);
194
- });
195
- return (0, commons_1.normalize)(sqlOutput);
196
207
  });
197
208
  }
198
209
  getFileSystem() {
@@ -285,9 +285,41 @@ class Manifest {
285
285
  }
286
286
  catch (e) { }
287
287
  });
288
- oAbapXml['asx:abap']['asx:values']['TRM_MANIFEST']['SAP_ENTRIES'] = {
289
- "item": sapEntries
290
- };
288
+ if (sapEntries.length > 0) {
289
+ oAbapXml['asx:abap']['asx:values']['TRM_MANIFEST']['SAP_ENTRIES'] = {
290
+ "item": sapEntries
291
+ };
292
+ }
293
+ }
294
+ if (manifest.postActivities) {
295
+ var postActivities = [];
296
+ manifest.postActivities.forEach(pa => {
297
+ var postActivity = {
298
+ 'NAME': {
299
+ "_text": pa.name
300
+ }
301
+ };
302
+ if (pa.parameters && pa.parameters.length > 0) {
303
+ postActivity['PARAMETERS'] = {
304
+ "item": pa.parameters.map(param => {
305
+ return {
306
+ 'NAME': {
307
+ "_text": param.name
308
+ },
309
+ 'VALUE': {
310
+ "_text": param.value
311
+ },
312
+ };
313
+ })
314
+ };
315
+ }
316
+ postActivities.push(postActivity);
317
+ });
318
+ if (postActivities.length > 0) {
319
+ oAbapXml['asx:abap']['asx:values']['TRM_MANIFEST']['POST_ACTIVITIES'] = {
320
+ "item": postActivities
321
+ };
322
+ }
291
323
  }
292
324
  const sXml = xml.js2xml(oAbapXml, { compact: true });
293
325
  return sXml ? new xml_beautify_1.default({ useSelfClosingElement: true, parser: xmldom_1.DOMParser }).beautify(sXml) : null;
@@ -539,30 +571,32 @@ class Manifest {
539
571
  if (manifestClone.postActivities && manifestClone.postActivities.length > 0) {
540
572
  var originalPostActivities = manifestClone.postActivities;
541
573
  delete manifestClone.postActivities;
542
- originalPostActivities.forEach((pa) => {
543
- if (!pa.name) {
544
- throw new Error(`Invalid post activity: name must be declared.`);
545
- }
546
- pa.name = pa.name.toUpperCase();
547
- if (Array.isArray(pa.parameters)) {
548
- manifestClone.postActivities = [];
549
- pa.parameters.forEach(param => {
550
- if (!param.name) {
551
- throw new Error(`Invalid post activity: parameter name must be declared.`);
552
- }
553
- param.name = param.name.toUpperCase();
554
- });
555
- manifestClone.postActivities.push({
556
- name: pa.name,
557
- parameters: pa.parameters
558
- });
559
- }
560
- else {
561
- manifestClone.postActivities.push({
562
- name: pa.name
563
- });
564
- }
565
- });
574
+ if (Array.isArray(originalPostActivities) && originalPostActivities.length > 0) {
575
+ manifestClone.postActivities = [];
576
+ originalPostActivities.forEach((pa) => {
577
+ if (!pa.name) {
578
+ throw new Error(`Invalid post activity: name must be declared.`);
579
+ }
580
+ pa.name = pa.name.toUpperCase();
581
+ if (Array.isArray(pa.parameters)) {
582
+ pa.parameters.forEach(param => {
583
+ if (!param.name) {
584
+ throw new Error(`Invalid post activity: parameter name must be declared.`);
585
+ }
586
+ param.name = param.name.toUpperCase();
587
+ });
588
+ manifestClone.postActivities.push({
589
+ name: pa.name,
590
+ parameters: pa.parameters
591
+ });
592
+ }
593
+ else {
594
+ manifestClone.postActivities.push({
595
+ name: pa.name
596
+ });
597
+ }
598
+ });
599
+ }
566
600
  }
567
601
  else {
568
602
  delete manifestClone.postActivities;
@@ -795,8 +795,18 @@ class Transport {
795
795
  migrate(rollback) {
796
796
  return __awaiter(this, void 0, void 0, function* () {
797
797
  if (!rollback) {
798
- const trmTrkorr = yield systemConnector_1.SystemConnector.migrateTransport(this.trkorr);
799
- return new Transport(trmTrkorr, null, true);
798
+ try {
799
+ const trmTrkorr = yield systemConnector_1.SystemConnector.migrateTransport(this.trkorr);
800
+ return new Transport(trmTrkorr, null, true);
801
+ }
802
+ catch (e) {
803
+ if (e.exceptionType === 'SNRO_INTERVAL_NOT_FOUND') {
804
+ throw new Error(`trm-server has no migration interval defined: re-install or execute post activities to generate number range interval.`);
805
+ }
806
+ else {
807
+ throw e;
808
+ }
809
+ }
800
810
  }
801
811
  else {
802
812
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trm-core",
3
- "version": "6.3.0",
3
+ "version": "6.4.1",
4
4
  "description": "TRM (Transport Request Manager) Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,7 +53,7 @@
53
53
  "get-stack-trace": "^3.1.1",
54
54
  "loading-cli": "^1.1.0",
55
55
  "lodash": "^4.17.21",
56
- "node-r3trans": "^1.4.7",
56
+ "node-r3trans": "^1.5.0",
57
57
  "object-keys-normalizer": "^1.0.1",
58
58
  "opener": "^1.5.2",
59
59
  "parse-multipart-data": "^1.5.0",