@mcp-abap-adt/interfaces-adt-connection 5.0.0 → 5.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,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [5.1.0] - 2026-11-14
11
+
12
+ ### Added
13
+
14
+ - **Optional, typed members of `IAbapConnection`** — what a full connector has
15
+ beyond the five members every connection meets, each with the signature the
16
+ connector declares:
17
+ - `disconnect?(): Promise<void>`
18
+ - `flushGoodbye?(timeoutMs?: number): Promise<void>`
19
+ - `isConnected?(): boolean`
20
+ - `beginCriticalSection?(): void`, `endCriticalSection?(): void`
21
+ - `getSessionMode?(): 'stateful' | 'stateless'` (the connector's name) and
22
+ `getSessionType?(): 'stateful' | 'stateless'` (a batch recorder's)
23
+ - `sessionCookies?(): string | null`
24
+ - `getConfig?(): IAbapConnectionConfig`
25
+
26
+ A holder of an `IAbapConnection` calls one with `?.`
27
+ (`connection.disconnect?.()`) and needs no detection at run time; a
28
+ connection may lack any of them. Where a capability atom declares the same
29
+ member (`ISessionLifecycleAware`, `ICriticalSection`), the two are identical,
30
+ and a consumer that needs the member present still narrows to the atom.
31
+ - **`IAbapConnectionConfig`** — what `getConfig()` answers:
32
+ `readonly connectionType?: 'http' | 'rfc' | undefined`, the transport alone.
33
+ Declared here because this package depends on `interfaces-network` alone; a
34
+ connector's own configuration, wider than this, is assignable to it.
35
+
36
+ Nothing a 5.0.0 caller writes changes, and an implementer that has none of
37
+ these members, or has them with these signatures, conforms as before
38
+ (`AbstractAbapConnection` of `@mcp-abap-adt/connection` 25.0.0 and
39
+ `AdtBatchConnection` of `@mcp-abap-adt/adt-clients` do). **One that has a
40
+ member of one of these names with another signature no longer conforms** —
41
+ say, an `isConnected` that answers something other than a boolean, or a
42
+ `getConfig` whose answer's `connectionType` is not `'http'` or `'rfc'`
43
+ (`src/__typechecks__/optionalMembers.ts`). Released as a minor: an added
44
+ optional member is additive for every caller and every implementer that does
45
+ not already use the name for something else.
46
+
10
47
  ## [5.0.0] - 2026-11-12
11
48
 
12
49
  ### Changed (breaking)
package/README.md CHANGED
@@ -9,7 +9,9 @@ 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(options): Promise<IAdtWireResponse>` (no type parameters since 5.0.0), 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 |
12
+ | `IAbapConnection` | a connection an ADT request is made through: `makeAdtRequest(options): Promise<IAdtWireResponse>` (no type parameters since 5.0.0), `connect()`, the session id and 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
+ | optional members of `IAbapConnection` | what a full connector has beyond the five required members, each with the connector's signature: `disconnect?()`, `flushGoodbye?(timeoutMs?)`, `isConnected?()`, `beginCriticalSection?()` / `endCriticalSection?()`, `getSessionMode?()` / `getSessionType?()`, `sessionCookies?()`, `getConfig?()`. A connection may lack any of them, so a caller calls one with `?.` (`connection.disconnect?.()`); a consumer that needs one present narrows to its capability atom. Since 5.1.0 |
14
+ | `IAbapConnectionConfig` | what `getConfig()` answers: `connectionType?: 'http' \| 'rfc'`, the transport alone; a connector's own, wider configuration is assignable to it. Since 5.1.0 |
13
15
  | `IAbapRequestOptions` | what one request carries |
14
16
  | `IAdtWireResponse` | the answer as it came off the wire — extends `IHttpWireResponse` from `interfaces-network` with the headers ADT sends. Its `data` is `unknown` (since 2.0.0; it was `any`), and since 5.0.0 `makeAdtRequest` takes no type arguments: a caller reads `data` and narrows it — see [`MIGRATION-5.0.md`](MIGRATION-5.0.md). Since 4.2.0 it may carry `sessionLost` (below) |
15
17
  | `ISessionLifecycleAware`, `ICriticalSection`, `IRequestProfiling`, `IDeferredResponseConnection` | the connection's capability atoms — a connection honours the ones it can |
@@ -28,6 +28,22 @@ export interface IAdtWireResponse<T = unknown, D = unknown> extends Omit<IHttpWi
28
28
  */
29
29
  readonly sessionLost?: AdtSessionLoss | undefined;
30
30
  }
31
+ /**
32
+ * What a connection states of its configuration through
33
+ * {@link IAbapConnection.getConfig}: the transport it goes over, and nothing
34
+ * else.
35
+ *
36
+ * A connector's own configuration type carries far more (the system's URL or
37
+ * RFC address, the client, the credential); this is the part a holder of an
38
+ * `IAbapConnection` reads. Declared here, not borrowed from the configuration
39
+ * contracts, because this package depends on `interfaces-network` alone — so a
40
+ * connector returns its own configuration, which is assignable to this.
41
+ * Since 5.1.0.
42
+ */
43
+ export interface IAbapConnectionConfig {
44
+ /** `'rfc'` over RFC; `'http'`, or absent, over HTTP. */
45
+ readonly connectionType?: 'http' | 'rfc' | undefined;
46
+ }
31
47
  /**
32
48
  * ABAP Connection interface
33
49
  *
@@ -36,6 +52,15 @@ export interface IAdtWireResponse<T = unknown, D = unknown> extends Omit<IHttpWi
36
52
  *
37
53
  * For JWT connections, token refresh is handled internally via ITokenRefresher.
38
54
  * For Basic connections, no token refresh is needed.
55
+ *
56
+ * **The optional members** (since 5.1.0) are what a full connector has beyond
57
+ * the five every connection meets. A connection may lack any of them — an RFC
58
+ * transport, a batch recorder, an embedder's own or a test stub — so a caller
59
+ * calls one with `?.` (`connection.disconnect?.()`) and needs no detection at
60
+ * run time. Each has the signature of the member the connector declares; where
61
+ * a capability atom (`ISessionLifecycleAware`, `ICriticalSection`) declares the
62
+ * same member, the two are identical, and a consumer that needs the member
63
+ * present still narrows to the atom.
39
64
  */
40
65
  export interface IAbapConnection {
41
66
  /**
@@ -73,5 +98,63 @@ export interface IAbapConnection {
73
98
  * @returns Promise with the answer as it came off the wire
74
99
  */
75
100
  makeAdtRequest(options: IAbapRequestOptions): Promise<IAdtWireResponse>;
101
+ /**
102
+ * Tells the server this session is finished: the logoff is written, not
103
+ * awaited for its answer ({@link flushGoodbye} waits for that). The same
104
+ * member as `ISessionLifecycleAware.disconnect`. Optional: a connection with
105
+ * no session of its own to end has none, so a caller uses `?.`.
106
+ */
107
+ disconnect?(): Promise<void>;
108
+ /**
109
+ * Waits for the goodbye {@link disconnect} sent, within a budget, and
110
+ * resolves rather than throws. The same member as
111
+ * `ISessionLifecycleAware.flushGoodbye`. Optional, called with `?.`.
112
+ *
113
+ * @param timeoutMs how long to wait; an implementation chooses its default.
114
+ */
115
+ flushGoodbye?(timeoutMs?: number): Promise<void>;
116
+ /**
117
+ * Whether a caller may start work on this connection: `false` once its
118
+ * session is gone or being torn down. The same member as
119
+ * `ISessionLifecycleAware.isConnected`. Optional, called with `?.`.
120
+ */
121
+ isConnected?(): boolean;
122
+ /**
123
+ * Enters a section in which the ordinary per-request deadline is suspended
124
+ * (a lock → write → unlock chain). Nests; each call needs its own
125
+ * {@link endCriticalSection}. The same member as
126
+ * `ICriticalSection.beginCriticalSection`. Optional, called with `?.`.
127
+ */
128
+ beginCriticalSection?(): void;
129
+ /**
130
+ * Leaves the section {@link beginCriticalSection} entered; ordinary
131
+ * deadlines resume when the outermost one ends. The same member as
132
+ * `ICriticalSection.endCriticalSection`. Optional, called with `?.`.
133
+ */
134
+ endCriticalSection?(): void;
135
+ /**
136
+ * The session mode the connection's next requests are sent in, as
137
+ * {@link setSessionType} set it. A connector's name for it. Optional, called
138
+ * with `?.`.
139
+ */
140
+ getSessionMode?(): 'stateful' | 'stateless';
141
+ /**
142
+ * The same reading as {@link getSessionMode}, under the name a batch
143
+ * recorder gives it. Optional, called with `?.`.
144
+ */
145
+ getSessionType?(): 'stateful' | 'stateless';
146
+ /**
147
+ * The session's cookies as one string, which a later connection can be
148
+ * built on to resume the session; `null` when there are none (no session
149
+ * yet, or a transport without cookies, such as RFC). Optional, called with
150
+ * `?.`.
151
+ */
152
+ sessionCookies?(): string | null;
153
+ /**
154
+ * What the connection states of its configuration: the transport it goes
155
+ * over ({@link IAbapConnectionConfig}). A connector answers its own
156
+ * configuration, which is assignable to it. Optional, called with `?.`.
157
+ */
158
+ getConfig?(): IAbapConnectionConfig;
76
159
  }
77
160
  //# sourceMappingURL=IAbapConnection.d.ts.map
@@ -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;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,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,EAAE,MAAM,CAAC;QAClB,kBAAkB,CAAC,EAAE,eAAe,CAAC;QACrC,kBAAkB,CAAC,EAAE,eAAe,CAAC;QACrC,kBAAkB,CAAC,EAAE,eAAe,CAAC;KACtC,CAAC;IACF;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CACnD;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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tD;AAED;;;;;;;;;;;;;;;;;GAiBG;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;;;;;;;;;;;;;;OAcG;IACH,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAExE;;;;;OAKG;IACH,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B;;;;;;OAMG;IACH,YAAY,CAAC,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD;;;;OAIG;IACH,WAAW,CAAC,IAAI,OAAO,CAAC;IAExB;;;;;OAKG;IACH,oBAAoB,CAAC,IAAI,IAAI,CAAC;IAE9B;;;;OAIG;IACH,kBAAkB,CAAC,IAAI,IAAI,CAAC;IAE5B;;;;OAIG;IACH,cAAc,CAAC,IAAI,UAAU,GAAG,WAAW,CAAC;IAE5C;;;OAGG;IACH,cAAc,CAAC,IAAI,UAAU,GAAG,WAAW,CAAC;IAE5C;;;;;OAKG;IACH,cAAc,CAAC,IAAI,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;OAIG;IACH,SAAS,CAAC,IAAI,qBAAqB,CAAC;CACrC"}
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * connector either follow or install a second copy. The subject is still ADT
11
11
  * (decision 35); what separated it is the release rate (decision 38).
12
12
  */
13
- export type { IAbapConnection, IAdtWireResponse } from './IAbapConnection';
13
+ export type { IAbapConnection, IAbapConnectionConfig, IAdtWireResponse, } from './IAbapConnection';
14
14
  export type { IAbapConnectionError, IRfcErrorInfo, RfcReturnCodeName, } from './IAbapConnectionError';
15
15
  export { RFC_RCS } from './IAbapConnectionError';
16
16
  export type { IAbapRequestOptions } from './IAbapRequestOptions';
@@ -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,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,cAAc,EACd,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,EACV,eAAe,EACf,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,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,cAAc,EACd,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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/interfaces-adt-connection",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
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",