@mcp-abap-adt/interfaces-adt-connection 4.2.0 → 5.0.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,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [5.0.0] - 2026-11-12
11
+
12
+ ### Changed (breaking)
13
+
14
+ - **`IAbapConnection.makeAdtRequest(options: IAbapRequestOptions): Promise<IAdtWireResponse>`**
15
+ — the type parameters `<T = unknown, D = unknown>` are gone. The answer's
16
+ `data` is `unknown`, and the caller reads it. A caller that chose `T` made
17
+ every connection that records or forwards a request assert one, since
18
+ nothing such a connection holds is a `T` the caller picked; a non-generic
19
+ connection could not satisfy the interface at all.
20
+ `IAdtWireResponse<T = unknown, D = unknown>` itself is unchanged and stays
21
+ generic, for a caller that types an answer it has read.
22
+
23
+ Who is affected, each direction checked with the compiler
24
+ (`src/__typechecks__/nonGenericRequest.ts`):
25
+
26
+ - **A caller that passes type arguments** — `makeAdtRequest<string>(…)` — no
27
+ longer compiles. Nothing else a caller writes changes.
28
+ - **An implementer** that keeps its own `<T, D>` still conforms: a generic
29
+ method is assignable to the non-generic member. One that answers
30
+ `IAdtWireResponse` without type parameters conforms now, and needs no
31
+ assertion.
32
+ - **A package whose public signatures take an `IAbapConnection`** and that
33
+ wants a non-generic connection handed to it names this major: a non-generic
34
+ connection is not assignable to 4.x's generic interface.
35
+
36
+ ### Migrating to 5.0.0
37
+
38
+ See [`MIGRATION-5.0.md`](MIGRATION-5.0.md).
39
+
10
40
  ## [4.2.0] - 2026-11-12
11
41
 
12
42
  ### Added
@@ -0,0 +1,74 @@
1
+ # Migrating to `@mcp-abap-adt/interfaces-adt-connection` 5.0.0
2
+
3
+ `IAbapConnection.makeAdtRequest` takes no type parameters:
4
+
5
+ ```ts
6
+ // 4.x
7
+ makeAdtRequest<T = unknown, D = unknown>(options: IAbapRequestOptions): Promise<IAdtWireResponse<T, D>>;
8
+ // 5.0.0
9
+ makeAdtRequest(options: IAbapRequestOptions): Promise<IAdtWireResponse>;
10
+ ```
11
+
12
+ The answer's `data` is `unknown`. `IAdtWireResponse<T = unknown, D = unknown>`
13
+ is unchanged.
14
+
15
+ ## A caller that passed type arguments
16
+
17
+ The call no longer compiles. Drop the type arguments and read `data` as what
18
+ it is, `unknown`, narrowing it where it is read:
19
+
20
+ ```diff
21
+ - const answer = await connection.makeAdtRequest<string>(options);
22
+ - const text: string = answer.data;
23
+ + const answer = await connection.makeAdtRequest(options);
24
+ + const text = typeof answer.data === 'string' ? answer.data : '';
25
+ ```
26
+
27
+ An object is narrowed by a check of its own (`'field' in data`, or a type
28
+ guard), never by an assertion: what came off the wire is data from outside the
29
+ type system. A caller that passed no type arguments changes nothing.
30
+
31
+ ## A function that forwards the call
32
+
33
+ A wrapper that took `<T, D>` only to hand them to `makeAdtRequest` drops them
34
+ and answers `Promise<IAdtWireResponse>`:
35
+
36
+ ```diff
37
+ - function send<T = unknown, D = unknown>(options: IAbapRequestOptions): Promise<IAdtWireResponse<T, D>> {
38
+ - return connection.makeAdtRequest<T, D>(options);
39
+ - }
40
+ + function send(options: IAbapRequestOptions): Promise<IAdtWireResponse> {
41
+ + return connection.makeAdtRequest(options);
42
+ + }
43
+ ```
44
+
45
+ ## An implementation of `IAbapConnection`
46
+
47
+ - **Generic** (`makeAdtRequest<T = unknown, D = unknown>(…)`): nothing to do. A
48
+ generic method is assignable to the non-generic member, so the
49
+ implementation conforms as it is, and its own callers keep their type
50
+ arguments when they hold the implementation's own type.
51
+ - **A recorder, a forwarder or a test stand-in** that answers a fixed shape:
52
+ declare it non-generic and drop the assertion the generic member forced on
53
+ it:
54
+
55
+ ```diff
56
+ - makeAdtRequest: async <T = unknown, D = unknown>() =>
57
+ - ({ data: undefined, status: 200, statusText: 'OK', headers: {} }) as unknown as IAdtWireResponse<T, D>,
58
+ + makeAdtRequest: async (): Promise<IAdtWireResponse> => ({
59
+ + data: undefined,
60
+ + status: 200,
61
+ + statusText: 'OK',
62
+ + headers: {},
63
+ + }),
64
+ ```
65
+
66
+ ## A package that takes an `IAbapConnection` in its own signatures
67
+
68
+ A non-generic connection is not assignable to 4.x's `IAbapConnection` (`unknown`
69
+ is not assignable to a caller's `T`). To accept one, name `^5.0.0`. For that
70
+ package's callers this is no break: any connection they hold today is generic,
71
+ and a generic connection is assignable to the 5.0.0 parameter. Keep one copy of
72
+ this package in the tree: 4.x's and 5.0.0's `IAbapConnection` differ in
73
+ `makeAdtRequest`, so a non-generic connection typed by 5.0.0 is not assignable
74
+ where a 4.x copy is named.
package/README.md CHANGED
@@ -9,9 +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`, 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/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
- | `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. Since 4.2.0 it may carry `sessionLost` (below) |
14
+ | `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
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
17
  | `AdtSessionLoss` | the type of `sessionLost` on `IAdtWireResponse` and on `IAbapConnectionError`: present when the answer of a stateless request showed the SAP session replaced. The answer is SAP's, as it came; the connection's session is gone with it, so a new session is a new connection. `code` is unchanged by it. Since 4.2.0 |
@@ -65,9 +65,13 @@ export interface IAbapConnection {
65
65
  * - Manages CSRF token
66
66
  * - Retries on 401/403 with token refresh (JWT only)
67
67
  *
68
+ * **It names no type for the answer** (since 5.0.0). `data` is `unknown`,
69
+ * and the caller reads it: a connection answers what came off the wire, so
70
+ * one that records or forwards a request has no `T` of the caller's to give.
71
+ *
68
72
  * @param options - Request options (url, method, data, etc.)
69
- * @returns Promise with Axios response
73
+ * @returns Promise with the answer as it came off the wire
70
74
  */
71
- makeAdtRequest<T = unknown, D = unknown>(options: IAbapRequestOptions): Promise<IAdtWireResponse<T, D>>;
75
+ makeAdtRequest(options: IAbapRequestOptions): Promise<IAdtWireResponse>;
72
76
  }
73
77
  //# 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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AM,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;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;CACzE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/interfaces-adt-connection",
3
- "version": "4.2.0",
3
+ "version": "5.0.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",
@@ -8,6 +8,7 @@
8
8
  "dist",
9
9
  "README.md",
10
10
  "CHANGELOG.md",
11
+ "MIGRATION-5.0.md",
11
12
  "LICENSE",
12
13
  "COPYING"
13
14
  ],