@mcp-abap-adt/connection 1.7.0 → 1.8.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RfcAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/RfcAbapConnection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"RfcAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/RfcAbapConnection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAkG1D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,iBAAkB,YAAW,cAAc;IASpD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IATzB,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsB;IAChD,OAAO,CAAC,WAAW,CAAyC;IAC5D,OAAO,CAAC,aAAa,CAAuB;gBAGzB,MAAM,EAAE,SAAS,EACjB,MAAM,GAAE,OAAO,GAAG,IAAW;IAa1C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA8BxB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,YAAY,IAAI,MAAM,GAAG,IAAI;IAI7B,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,IAAI;IAU9C,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EACnC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IA8L9B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5B,OAAO,CAAC,MAAM,CAAC,cAAc;CAqB9B"}
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RfcAbapConnection = void 0;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
function rfcErrorMessage(e) {
|
|
6
|
+
if (e instanceof Error)
|
|
7
|
+
return e.message;
|
|
8
|
+
if (e && typeof e === 'object')
|
|
9
|
+
return JSON.stringify(e);
|
|
10
|
+
return String(e);
|
|
11
|
+
}
|
|
5
12
|
/**
|
|
6
13
|
* Derive RFC connection parameters from ISapConfig.
|
|
7
14
|
* Parses hostname from config.url, system number from port (80XX → XX).
|
|
@@ -14,8 +21,10 @@ const node_crypto_1 = require("node:crypto");
|
|
|
14
21
|
function buildRfcParams(config) {
|
|
15
22
|
const parsed = new URL(config.url);
|
|
16
23
|
const port = Number.parseInt(parsed.port || '8000', 10);
|
|
17
|
-
// SAP HTTP port convention: 80XX where XX = system number
|
|
18
|
-
|
|
24
|
+
// SAP HTTP port convention: 80XX where XX = system number.
|
|
25
|
+
// SAP_SYSNR env var overrides derivation for non-standard ports (e.g. 50400).
|
|
26
|
+
const derivedSysnr = String(port - 8000).padStart(2, '0');
|
|
27
|
+
const sysnr = process.env.SAP_SYSNR?.trim() || derivedSysnr;
|
|
19
28
|
return {
|
|
20
29
|
ashost: parsed.hostname,
|
|
21
30
|
sysnr,
|
|
@@ -105,7 +114,7 @@ class RfcAbapConnection {
|
|
|
105
114
|
catch (e) {
|
|
106
115
|
throw new Error('@mcp-abap-adt/sap-rfc-lite is not available. To use RFC connections, install SAP NW RFC SDK ' +
|
|
107
116
|
'and run: npm install @mcp-abap-adt/sap-rfc-lite. ' +
|
|
108
|
-
`Details: ${
|
|
117
|
+
`Details: ${rfcErrorMessage(e)}`);
|
|
109
118
|
}
|
|
110
119
|
this.rfcClient = new Client(this.rfcParams);
|
|
111
120
|
try {
|
|
@@ -114,7 +123,7 @@ class RfcAbapConnection {
|
|
|
114
123
|
}
|
|
115
124
|
catch (e) {
|
|
116
125
|
this.rfcClient = null;
|
|
117
|
-
const msg =
|
|
126
|
+
const msg = rfcErrorMessage(e);
|
|
118
127
|
this.logger?.error(`RFC connection failed: ${msg}`);
|
|
119
128
|
throw new Error(`Failed to open RFC connection: ${msg}`);
|
|
120
129
|
}
|
|
@@ -277,7 +286,7 @@ class RfcAbapConnection {
|
|
|
277
286
|
throw e;
|
|
278
287
|
}
|
|
279
288
|
// RFC-level error
|
|
280
|
-
const msg =
|
|
289
|
+
const msg = rfcErrorMessage(e);
|
|
281
290
|
this.logger?.error(`RFC call failed: ${msg}`);
|
|
282
291
|
throw new Error(`RFC call to SADT_REST_RFC_ENDPOINT failed: ${msg}`);
|
|
283
292
|
}
|
|
@@ -299,7 +308,7 @@ class RfcAbapConnection {
|
|
|
299
308
|
this.logger?.debug('RFC connection closed');
|
|
300
309
|
}
|
|
301
310
|
catch (e) {
|
|
302
|
-
this.logger?.debug(`RFC close error: ${
|
|
311
|
+
this.logger?.debug(`RFC close error: ${rfcErrorMessage(e)}`);
|
|
303
312
|
}
|
|
304
313
|
this.rfcClient = null;
|
|
305
314
|
}
|