@mcp-abap-adt/interfaces-adt-connection 3.0.0 → 4.1.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.md CHANGED
@@ -7,6 +7,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [4.1.0] - 2026-11-11
11
+
12
+ ### Added
13
+
14
+ - **`IAbapConnectionError`** — the error a connection throws, as a consumer
15
+ reads it: `readonly code?: string | undefined` (a session error code from
16
+ `ADT_SESSION_ERROR`, or a Node network code — unchanged) and
17
+ `readonly rfc?: IRfcErrorInfo | undefined`. A connection throws an `Error`
18
+ carrying these fields; a consumer narrows a caught value to the type and
19
+ reads which failure it was from a field, never from the message.
20
+ - **`IRfcErrorInfo`** — what the SAP NetWeaver RFC SDK said about a failed
21
+ call: `key` (the SDK's free-text error key), `group` (`RFC_ERROR_GROUP`, a
22
+ number), `code` (`RFC_RC`, a number) and `codeString`, the return code's
23
+ name. No message and no ABAP message variables. All fields readonly.
24
+ - **`RFC_RCS` / `RfcReturnCodeName`** — the SDK's 34 `RFC_RC` names, in the
25
+ header's order (index = numeric code), and their union: the type of
26
+ `codeString`, so `rfc.codeString === 'RFC_CLOSED'` is checked by the
27
+ compiler.
28
+
29
+ Nothing a 4.0.0 consumer or implementer does changes: every field is optional,
30
+ and no existing name, type or constant moved.
31
+
32
+ ## [4.0.0] - 2026-11-08
33
+
34
+ ### Changed (breaking)
35
+
36
+ - **`IAbapConnection.getBaseUrl(): Promise<string | undefined>`** — was
37
+ `Promise<string>`. It answers the system's HTTP origin, or `undefined` for a
38
+ connection that has none: an RFC connection, whose destination states an RFC
39
+ address and no URL (`@mcp-abap-adt/interfaces-auth-sap` 4.0.0). The absence is
40
+ in the type, so a caller cannot read a URL that is not there.
41
+
42
+ ### Migrating to 4.0.0
43
+
44
+ - **A caller narrows the answer** before using it as a string:
45
+ `const url = await connection.getBaseUrl(); if (url !== undefined) { … }`.
46
+ Code that builds an absolute URL on it decides what to do without one — over
47
+ RFC a request carries a path, and no origin is invented.
48
+ - **An implementer** that answers a string still conforms; nothing to do. One
49
+ that has no URL answers `undefined` instead of `''` or a made-up origin.
50
+
10
51
  ## [3.0.0] - 2026-10-12
11
52
 
12
53
  ### Removed (breaking)
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @mcp-abap-adt/interfaces-adt-connection
2
2
 
3
3
  The ABAP connection contract: what an ADT request is sent through, and what
4
- comes back off the wire. Types and one constant; no implementation.
4
+ comes back off the wire. Types and two constants; no implementation.
5
5
 
6
6
  ```bash
7
7
  npm install @mcp-abap-adt/interfaces-adt-connection
@@ -9,13 +9,24 @@ npm install @mcp-abap-adt/interfaces-adt-connection
9
9
 
10
10
  | symbol | what it is |
11
11
  |---|---|
12
- | `IAbapConnection` | a connection an ADT request is made through: `makeAdtRequest`, connect/disconnect, the session type |
12
+ | `IAbapConnection` | a connection an ADT request is made through: `makeAdtRequest`, connect/disconnect, the session type. Since 4.0.0 `getBaseUrl()` answers `Promise<string \| undefined>`: `undefined` for a connection with no HTTP origin (RFC), so a caller narrows before using it — see the CHANGELOG's migration note |
13
13
  | `IAbapRequestOptions` | what one request carries |
14
14
  | `IAdtWireResponse` | the answer as it came off the wire — extends `IHttpWireResponse` from `interfaces-network` with the headers ADT sends. Since 2.0.0 its `data` is `unknown` unless the caller names the type (`makeAdtRequest<string>(…)`); it was `any` — see the CHANGELOG's migration note |
15
15
  | `ISessionLifecycleAware`, `ICriticalSection`, `IRequestProfiling`, `IDeferredResponseConnection` | the connection's capability atoms — a connection honours the ones it can |
16
16
  | `ADT_SESSION_ERROR` / `AdtSessionErrorCode` | what a session failure is called |
17
+ | `IAbapConnectionError` | the error a connection throws, as a consumer reads it: `code` — a session error code or a Node network code — and, for a failed RFC call, `rfc`. Narrow a caught value to it; never read the message. Since 4.1.0 |
18
+ | `IRfcErrorInfo`, `RFC_RCS` / `RfcReturnCodeName` | what the RFC SDK said about a failed call: `key` (free text), `group` and `code` (numbers), `codeString` — the return code's name, one of the SDK's `RFC_RC` names. Since 4.1.0 |
17
19
  | `ITimeoutConfig` | the deadlines a caller gives a connection: `default`, `csrf`, `long` |
18
20
 
21
+ A caught value is `unknown`: the consumer narrows it with its own check (it comes from outside
22
+ the type system) and then reads it by this type, never by a cast:
23
+
24
+ ```typescript
25
+ function closedByPartner(error: IAbapConnectionError): boolean {
26
+ return error.rfc?.codeString === 'RFC_CLOSED';
27
+ }
28
+ ```
29
+
19
30
  ## Why this package exists
20
31
 
21
32
  **It moves on its own schedule.** These four files were
@@ -37,9 +37,10 @@ export interface IAbapConnection {
37
37
  */
38
38
  connect(): Promise<void>;
39
39
  /**
40
- * Get base URL of SAP system
40
+ * The SAP system's HTTP origin, or `undefined` for a connection that has
41
+ * none (RFC). A caller narrows before reading it.
41
42
  */
42
- getBaseUrl(): Promise<string>;
43
+ getBaseUrl(): Promise<string | undefined>;
43
44
  /**
44
45
  * Get current session ID (for stateful connections)
45
46
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IAbapConnection.d.ts","sourceRoot":"","sources":["../src/IAbapConnection.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAE/C,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,CACxD,SAAQ,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC;IAChD;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG;QACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,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,CAAC,EAAE,eAAe,CAAC;QACrC,kBAAkB,CAAC,EAAE,eAAe,CAAC;QACrC,kBAAkB,CAAC,EAAE,eAAe,CAAC;KACtC,CAAC;CACH;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAE1C;;OAEG;IACH,YAAY,IAAI,MAAM,GAAG,IAAI,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,IAAI,CAAC;IAErD;;;;;;;;;;OAUG;IACH,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EACrC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACpC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The return codes of the SAP NetWeaver RFC SDK, by name: `RFC_RC` in the SDK's
3
+ * header `sapnwrfc.h`, every member in its order (index = the numeric code),
4
+ * without the header's `_RFC_RC_max_value` sentinel.
5
+ *
6
+ * A failed RFC call reports its code twice — as the number (`code`) and as the
7
+ * name the SDK renders for it (`codeString`, from `RfcGetRcAsString`). The name
8
+ * is what a consumer compares, so it is this closed list.
9
+ */
10
+ export declare const RFC_RCS: readonly ["RFC_OK", "RFC_COMMUNICATION_FAILURE", "RFC_LOGON_FAILURE", "RFC_ABAP_RUNTIME_FAILURE", "RFC_ABAP_MESSAGE", "RFC_ABAP_EXCEPTION", "RFC_CLOSED", "RFC_CANCELED", "RFC_TIMEOUT", "RFC_MEMORY_INSUFFICIENT", "RFC_VERSION_MISMATCH", "RFC_INVALID_PROTOCOL", "RFC_SERIALIZATION_FAILURE", "RFC_INVALID_HANDLE", "RFC_RETRY", "RFC_EXTERNAL_FAILURE", "RFC_EXECUTED", "RFC_NOT_FOUND", "RFC_NOT_SUPPORTED", "RFC_ILLEGAL_STATE", "RFC_INVALID_PARAMETER", "RFC_CODEPAGE_CONVERSION_FAILURE", "RFC_CONVERSION_FAILURE", "RFC_BUFFER_TOO_SMALL", "RFC_TABLE_MOVE_BOF", "RFC_TABLE_MOVE_EOF", "RFC_START_SAPGUI_FAILURE", "RFC_ABAP_CLASS_EXCEPTION", "RFC_UNKNOWN_ERROR", "RFC_AUTHORIZATION_FAILURE", "RFC_AUTHENTICATION_FAILURE", "RFC_CRYPTOLIB_FAILURE", "RFC_IO_FAILURE", "RFC_LOCKING_FAILURE"];
11
+ /** One of {@link RFC_RCS}: the name of an RFC SDK return code. */
12
+ export type RfcReturnCodeName = (typeof RFC_RCS)[number];
13
+ /**
14
+ * What the RFC SDK said about a failed call, as fields — its `RFC_ERROR_INFO`
15
+ * as `@mcp-abap-adt/sap-rfc-lite` hands it over, without the message and the
16
+ * ABAP message variables.
17
+ *
18
+ * Read a failure from these, never from the error's words:
19
+ *
20
+ * ```typescript
21
+ * if (error.rfc?.codeString === 'RFC_CLOSED') {
22
+ * // the other side closed the conversation
23
+ * }
24
+ * ```
25
+ */
26
+ export interface IRfcErrorInfo {
27
+ /** The SDK's error key: free text the SDK fills (up to 128 characters). */
28
+ readonly key: string;
29
+ /** The SDK's error group (`RFC_ERROR_GROUP`), as its number. */
30
+ readonly group: number;
31
+ /** The SDK's return code (`RFC_RC`), as its number. */
32
+ readonly code: number;
33
+ /** The return code's name, e.g. `RFC_CLOSED`. */
34
+ readonly codeString: RfcReturnCodeName;
35
+ }
36
+ /**
37
+ * The error a connection throws, as a consumer reads it: a caught value
38
+ * narrowed to this, never parsed out of its message.
39
+ *
40
+ * A connection throws an `Error` that carries these fields; it does not throw
41
+ * this type as such. Every field is optional, so an error that names neither —
42
+ * an HTTP failure, a programming error — still conforms.
43
+ */
44
+ export interface IAbapConnectionError {
45
+ /**
46
+ * What the failure is called: one of `ADT_SESSION_ERROR` for a session
47
+ * failure, or a Node network code (`ECONNREFUSED`, …). Unchanged by
48
+ * {@link rfc}: an RFC failure keeps the code it would have without it.
49
+ */
50
+ readonly code?: string | undefined;
51
+ /**
52
+ * The RFC SDK's fields, when the request failed in an RFC call that the SDK
53
+ * reported; absent for an HTTP failure and for anything raised before a
54
+ * call was made.
55
+ */
56
+ readonly rfc?: IRfcErrorInfo | undefined;
57
+ }
58
+ //# sourceMappingURL=IAbapConnectionError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAbapConnectionError.d.ts","sourceRoot":"","sources":["../src/IAbapConnectionError.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,4wBAmCV,CAAC;AAEX,kEAAkE;AAClE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;CAC1C"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RFC_RCS = void 0;
4
+ /**
5
+ * The return codes of the SAP NetWeaver RFC SDK, by name: `RFC_RC` in the SDK's
6
+ * header `sapnwrfc.h`, every member in its order (index = the numeric code),
7
+ * without the header's `_RFC_RC_max_value` sentinel.
8
+ *
9
+ * A failed RFC call reports its code twice — as the number (`code`) and as the
10
+ * name the SDK renders for it (`codeString`, from `RfcGetRcAsString`). The name
11
+ * is what a consumer compares, so it is this closed list.
12
+ */
13
+ exports.RFC_RCS = [
14
+ 'RFC_OK',
15
+ 'RFC_COMMUNICATION_FAILURE',
16
+ 'RFC_LOGON_FAILURE',
17
+ 'RFC_ABAP_RUNTIME_FAILURE',
18
+ 'RFC_ABAP_MESSAGE',
19
+ 'RFC_ABAP_EXCEPTION',
20
+ 'RFC_CLOSED',
21
+ 'RFC_CANCELED',
22
+ 'RFC_TIMEOUT',
23
+ 'RFC_MEMORY_INSUFFICIENT',
24
+ 'RFC_VERSION_MISMATCH',
25
+ 'RFC_INVALID_PROTOCOL',
26
+ 'RFC_SERIALIZATION_FAILURE',
27
+ 'RFC_INVALID_HANDLE',
28
+ 'RFC_RETRY',
29
+ 'RFC_EXTERNAL_FAILURE',
30
+ 'RFC_EXECUTED',
31
+ 'RFC_NOT_FOUND',
32
+ 'RFC_NOT_SUPPORTED',
33
+ 'RFC_ILLEGAL_STATE',
34
+ 'RFC_INVALID_PARAMETER',
35
+ 'RFC_CODEPAGE_CONVERSION_FAILURE',
36
+ 'RFC_CONVERSION_FAILURE',
37
+ 'RFC_BUFFER_TOO_SMALL',
38
+ 'RFC_TABLE_MOVE_BOF',
39
+ 'RFC_TABLE_MOVE_EOF',
40
+ 'RFC_START_SAPGUI_FAILURE',
41
+ 'RFC_ABAP_CLASS_EXCEPTION',
42
+ 'RFC_UNKNOWN_ERROR',
43
+ 'RFC_AUTHORIZATION_FAILURE',
44
+ 'RFC_AUTHENTICATION_FAILURE',
45
+ 'RFC_CRYPTOLIB_FAILURE',
46
+ 'RFC_IO_FAILURE',
47
+ 'RFC_LOCKING_FAILURE',
48
+ ];
package/dist/index.d.ts CHANGED
@@ -11,6 +11,8 @@
11
11
  * (decision 35); what separated it is the release rate (decision 38).
12
12
  */
13
13
  export type { IAbapConnection, IAdtWireResponse } from './IAbapConnection';
14
+ export type { IAbapConnectionError, IRfcErrorInfo, RfcReturnCodeName, } from './IAbapConnectionError';
15
+ export { RFC_RCS } from './IAbapConnectionError';
14
16
  export type { IAbapRequestOptions } from './IAbapRequestOptions';
15
17
  export type { AdtSessionErrorCode, ICriticalSection, IDeferredResponseConnection, IRequestProfiling, ISessionLifecycleAware, } from './IConnectionCapabilities';
16
18
  export { ADT_SESSION_ERROR } from './IConnectionCapabilities';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ADT_SESSION_ERROR = void 0;
3
+ exports.ADT_SESSION_ERROR = exports.RFC_RCS = void 0;
4
+ var IAbapConnectionError_1 = require("./IAbapConnectionError");
5
+ Object.defineProperty(exports, "RFC_RCS", { enumerable: true, get: function () { return IAbapConnectionError_1.RFC_RCS; } });
4
6
  var IConnectionCapabilities_1 = require("./IConnectionCapabilities");
5
7
  Object.defineProperty(exports, "ADT_SESSION_ERROR", { enumerable: true, get: function () { return IConnectionCapabilities_1.ADT_SESSION_ERROR; } });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/interfaces-adt-connection",
3
- "version": "3.0.0",
4
- "description": "The ABAP connection contract: IAbapConnection, its capability atoms, the wire response and the session error codes",
3
+ "version": "4.1.0",
4
+ "description": "The ABAP connection contract: IAbapConnection, its capability atoms, the wire response, the session error codes and the error a connection throws",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [