trm-core 6.3.0 → 6.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 +6 -0
- package/dist/client/RESTClient.js +50 -39
- package/dist/manifest/Manifest.js +61 -27
- package/dist/transport/Transport.js +12 -2
- package/package.json +1 -1
package/changelog.txt
CHANGED
|
@@ -62,7 +62,7 @@ class RESTClient {
|
|
|
62
62
|
username: this._login.user,
|
|
63
63
|
password: this._login.passwd
|
|
64
64
|
},
|
|
65
|
-
timeout:
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
aSplit.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
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
|
-
|
|
289
|
-
|
|
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
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
pa.parameters
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
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
|
-
|
|
799
|
-
|
|
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
|
}
|