@mcp-abap-adt/connection 11.0.1 → 13.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,155 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [13.0.0] - 2026-10-08
11
+
12
+ 12.0.0 was published only on the `next` dist-tag; 13.0.0 is the release that
13
+ reaches `latest`.
14
+
15
+ ### Breaking
16
+
17
+ - **connection moves to `@mcp-abap-adt/interfaces-auth` `^7.5.0`** (from
18
+ `^6.0.0`), `@mcp-abap-adt/auth-errors` `^2.1.1` (from `^1.0.0`) and
19
+ `@mcp-abap-adt/interfaces-auth-sap` `^3.3.0` (from `^3.2.0`). A process holds
20
+ one interfaces-auth major, so a consumer on interfaces-auth 6 must move with
21
+ it. See [MIGRATION-13.0.md](./docs/MIGRATION-13.0.md).
22
+ - interfaces-auth 7 adds the error kind `renewal-declined` and the
23
+ configuration case `invalid-value`, adds the operation `renewal-strategy`,
24
+ renames the operation `on-tokens-hook` to `persisting-tokens`, and removes the
25
+ interactive outcome `browser-launch-failed`,
26
+ `ITokenResult.refreshTokenDisposition` and `RefreshTokenDisposition`. A
27
+ consumer that switches on kinds or operations, or reads the removed members,
28
+ must follow. 7.1–7.5 add only members of code lists and new types
29
+ (`IBrowser`, the authorization parts).
30
+ - **The providers come from `@mcp-abap-adt/auth-providers` 6.0.0.** It is the
31
+ release built on interfaces-auth 7 and auth-errors 2, and the one this
32
+ release is tested with. 5.x does not fit (unbranded refusals), and no
33
+ auth-providers release fits connection 12.x.
34
+
35
+ ### Unchanged
36
+
37
+ - Behaviour. connection mints and relays refusals of kinds `connection` and
38
+ `logon-target` exactly as in 12.0.0; no code in `src` switches on the
39
+ members that changed, reads `refreshTokenDisposition` or names the renamed
40
+ operation, so only the dependency ranges and the lockfile moved.
41
+ - The lifecycle, the one credential retry per request, `WireLogonError`, and
42
+ the guard against a request naming another SAP client.
43
+
44
+ ### Changed
45
+
46
+ - `tools/check-provider-shape.mjs` is the byte-identical copy `auth-errors`
47
+ publishes (2.0.0 through 2.1.1 ship the same file; the shape check's R1 test
48
+ compares them).
49
+
50
+ ### Development
51
+
52
+ - The devDependency `@mcp-abap-adt/auth-providers` is `^6.0.0` (from
53
+ `^5.2.0`), and every suite runs the real 6.0.0 providers. The test-only 5.x
54
+ adapter (`src/__tests__/helpers/legacyProvider.ts`, its table and its
55
+ `afterEach`) is deleted, and so is its suite.
56
+ - The hand-run live probes in `scripts/` (`pr41-onprem-verify`,
57
+ `pr41-rfc-headers-probe`, `pr41-rfc-lock`, `pr41-rfc-transport-probe`,
58
+ `onprem-session-hold`) are removed: only Jest suites stay in the
59
+ repository; the probes remain in the git history.
60
+ The dev tree now holds one `@mcp-abap-adt/interfaces-auth` (7.5.0) and one
61
+ `@mcp-abap-adt/auth-errors` (2.1.1).
62
+ - Two tests met 6.0.0 for real; neither is a change in connection's code:
63
+ - `CertificateAuthProvider` 6.0.0 proves its material usable in `prepare()`,
64
+ so the placeholder strings the certificate cases loaded were refused there.
65
+ They load the throwaway `fixtures/tls` pair now.
66
+ - A teardown test replaced `getAuthHeaders`, which the logoff never calls,
67
+ and passed only because the adapter's extra awaits kept the logoff in
68
+ flight past the assertion. It now breaks the logoff's own path
69
+ (`credentialHeaders`) and waits for the dispatch.
70
+
71
+ ## [12.0.0] - 2026-10-06
72
+
73
+ ### Breaking
74
+
75
+ - **Refusals follow the authentication error contract.** connection moves to
76
+ `@mcp-abap-adt/interfaces-auth` `^6.0.0` (from `^3.0.0`) and
77
+ `@mcp-abap-adt/interfaces-auth-sap` `^3.2.0` (from `^2.0.0`), and depends on
78
+ `@mcp-abap-adt/auth-errors` `^1.0.0`. A refusal is now an
79
+ `IAuthProviderError`: a deep-frozen object with a `kind`, `facts` from
80
+ closed allowlists, and `reason` / `hint` rendered from them, minted only by
81
+ `auth-errors`. See [MIGRATION-12.0.md](./docs/MIGRATION-12.0.md).
82
+ - **`AuthRefusedError.refusal` is an `IAuthProviderError`.** Decide on
83
+ `refusal.kind` and `refusal.facts`. `reason`, `hint`, `at`, `cause` and the
84
+ `reason — hint` message are unchanged.
85
+ - **The constructor classifies the refusal it is given.**
86
+ - A refusal minted by this copy of `auth-errors` is kept as the same object.
87
+ - A `structuredClone`, or a refusal from another copy, is rebuilt from its
88
+ kind and facts, with its words rendered anew and no diagnostics.
89
+ - Anything else is `provider-threw` at `at`.
90
+ - Text written into a clone's `reason`, `hint` or `diagnostics` therefore
91
+ reaches neither `refusal` nor `message`.
92
+ - **A custom `ILogonTarget` builds its refusal through `auth-errors`**
93
+ (`authError['logon-target']({ wire, refused })`). An object literal no
94
+ longer compiles. A custom `IAuthProvider` answers minted refusals too.
95
+ - **The providers of `@mcp-abap-adt/auth-providers` 5.x do not fit
96
+ interfaces-auth 6.0.0's `IAuthProvider`.** Use auth-providers 6.0.0 when it
97
+ is published.
98
+
99
+ ### Changed
100
+
101
+ - connection's own refusals keep their words and gain a kind:
102
+ - the RFC wire's `this wire carries no TLS material (RFC)` is `logon-target`
103
+ `{ wire: 'rfc', refused: 'tls-material' }`
104
+ - the HTTP wire's `this wire takes no logon parameters (HTTP)` is
105
+ `logon-target` `{ wire: 'http', refused: 'logon-parameters' }`
106
+ - `the credential provider failed` is `connection` `provider-threw`
107
+ - `the credential was refused again after the provider renewed it` is
108
+ `connection` `refused-after-renewal`
109
+ - `this connection has no credential to renew` is `connection`
110
+ `no-credential`
111
+ - `facts.at` of the first two `connection` refusals is the moment of the
112
+ error that carries them
113
+ - **The connection re-checks every provider answer** with `classifyOutcome`:
114
+ - a refusal minted by the same `auth-errors` passes as the same object
115
+ - one from another copy is rebuilt from its kind and facts
116
+ - anything else (a plain `{ reason }` from a JavaScript provider, a
117
+ non-outcome) is `provider-threw`, and its text reaches no message
118
+ - **11.0.1 exported none of the refusal constants from its index.** Only
119
+ `AuthRefusedError`, `AuthRefusalMoment` and `WireLogonError` were exported,
120
+ and all three are unchanged. There is no `exports` map, so a deep import of
121
+ `dist/connection/authErrors.js` was possible. Such an import loses
122
+ `PROVIDER_FAILED` and `REFUSED_AGAIN`, which are now internal
123
+ `providerFailed(at)` / `refusedAgain(at)`; `NO_CREDENTIAL_TO_RENEW` is a
124
+ minted error; and `guarded(call, at)` takes the moment.
125
+ - `lint:check` also runs the contract's shape check
126
+ (`tools/check-provider-shape.mjs --rules 4,5,6`, a byte-identical copy of
127
+ the one `auth-errors` publishes): no type assertion to a contract type, no
128
+ spread of an error, no diagnostics outside a listed site.
129
+
130
+ ### Unchanged
131
+
132
+ - The lifecycle, the one credential retry per request, `WireLogonError`, and
133
+ 11.0.1's guard against a request naming another SAP client.
134
+
135
+ ### Development
136
+
137
+ - auth-providers 6.0.0 is not published yet, so the tests keep the
138
+ devDependency `@mcp-abap-adt/auth-providers` `^5.2.0`.
139
+ - They run its providers through a test-only adapter
140
+ (`src/__tests__/helpers/legacyProvider.ts`, never shipped). A closed table
141
+ translates each 5.x refusal the suites produce to its builder call, and a
142
+ test that meets any other 5.x refusal fails.
143
+ - Until the move to auth-providers 6.0.0, the dev tree holds a second,
144
+ nested `@mcp-abap-adt/interfaces-auth` 3.2.0 under auth-providers 5.2.0.
145
+ The production tree holds only 6.0.0.
146
+ - **Lint warnings are errors now.** `lint:check` runs Biome with
147
+ `--error-on-warnings`, and the tests are checked for unused imports and
148
+ variables too. The 25 warnings it had are gone, each fixed rather than
149
+ silenced:
150
+ - Unused suppressions, imports and two dead test helpers are removed.
151
+ - The session id `disconnect()` captured for a release record removed long
152
+ ago is removed.
153
+ - The RFC transport reads `SADT_REST_RFC_ENDPOINT`'s answer field by field
154
+ with type checks instead of as `any`.
155
+ - One suppression stays, explained: `makeAdtRequest<T = any, D = any>`
156
+ mirrors `IAbapConnection` in `@mcp-abap-adt/interfaces-adt-connection`,
157
+ whose defaults change there first.
158
+
10
159
  ## [11.0.1] - 2026-10-06
11
160
 
12
161
  ### Fixed
@@ -2172,7 +2321,9 @@ const connection = createAbapConnection(config, logger);
2172
2321
  - JWT token refresh now properly handles connection errors (401/403 during initial connect)
2173
2322
  - Permission errors (403 with "ExceptionResourceNoAccess") no longer trigger JWT refresh loops
2174
2323
  - Proper separation: base class handles HTTP/session, concrete classes handle auth-specific errors
2175
- [Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v11.0.1...HEAD
2324
+ [Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v13.0.0...HEAD
2325
+ [13.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v12.0.0...v13.0.0
2326
+ [12.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v11.0.1...v12.0.0
2176
2327
  [11.0.1]: https://github.com/fr0ster/mcp-abap-connection/compare/v11.0.0...v11.0.1
2177
2328
  [11.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v10.0.3...v11.0.0
2178
2329
  [10.0.3]: https://github.com/fr0ster/mcp-abap-connection/compare/v10.0.2...v10.0.3
package/README.md CHANGED
@@ -58,7 +58,7 @@ The package uses a clean separation of concerns:
58
58
 
59
59
  - **Auth providers** (an `IAuthProvider` from `@mcp-abap-adt/interfaces-auth`; the
60
60
  ready-made ones — `BasicAuthProvider`, `TokenAuthProvider`, `SamlAuthProvider`,
61
- `CertificateAuthProvider` — are in `@mcp-abap-adt/auth-providers`, not here):
61
+ `CertificateAuthProvider` — are in `@mcp-abap-adt/auth-providers` 6.0.0, not here):
62
62
  - What a connection authenticates with, passed in. The connection never asks
63
63
  what kind of provider it was given; it calls the same four methods on all of
64
64
  them: `prepare` once before the wire opens, `establish` at each logon,
@@ -66,7 +66,12 @@ The package uses a clean separation of concerns:
66
66
  - A `401` that survives the wire's own session recovery, or a refused logon, is
67
67
  put to the provider through `rejected`. If it answers Ok (a renewed token, say)
68
68
  the request gets exactly one more attempt; if it says no, or the retry is
69
- refused too, you get an `AuthRefusedError` carrying the provider's own words
69
+ refused too, you get an `AuthRefusedError` carrying the provider's refusal —
70
+ an `IAuthProviderError` minted by `@mcp-abap-adt/auth-errors`, with a `kind`
71
+ to decide on and the `reason` / `hint` words to show
72
+ - Every answer is re-checked: a refusal that is not a minted error (a plain
73
+ `{ reason }` from a JavaScript provider) becomes "the credential provider
74
+ failed" (`connection` / `provider-threw`), and its text reaches no message
70
75
 
71
76
  - **Transports** (`OnPremHttpTransport`, `CloudHttpTransport`, `RfcTransport`):
72
77
  - What a request travels over, and everything that is true of that wire.
@@ -133,16 +138,18 @@ This package interacts with external packages **ONLY through interfaces**:
133
138
  - **Logger interface**: Uses `ILogger` interface for logging - does not know about concrete logger implementation
134
139
  - **No direct dependencies on auth packages**: All token-related operations are handled through configuration (`SapConfig`) passed by consumers
135
140
 
136
- The contracts themselves come from five packages, and are the only runtime
141
+ The contracts themselves come from five packages, and with `@mcp-abap-adt/auth-errors`
142
+ — the runtime that mints and classifies the auth errors — are the only runtime
137
143
  dependencies of this one besides `axios`, `commander` and `open`:
138
144
 
139
145
  | Package | What this package takes from it |
140
146
  |---|---|
141
147
  | `@mcp-abap-adt/interfaces-adt-connection` | `IAbapConnection`, `IAbapRequestOptions`, `IAdtWireResponse`, `ITimeoutConfig`, the capability atoms, `ADT_SESSION_ERROR` |
142
- | `@mcp-abap-adt/interfaces-auth` | `IAuthProvider`, `AuthOutcome`, `IAuthRefusal`, `IAuthRejection`, `ILogonTarget`, `IRequestTarget`, `ICertificateMaterial`, `ITokenRefresher`, `ITokenRefreshResult` |
148
+ | `@mcp-abap-adt/interfaces-auth` (7.x) | `IAuthProvider`, `AuthOutcome`, `IAuthRefusal` (= `IAuthProviderError`), `IAuthRejection`, `ILogonTarget`, `IRequestTarget`, `ICertificateMaterial`, `ITokenRefresher`, `ITokenRefreshResult` |
143
149
  | `@mcp-abap-adt/interfaces-auth-sap` | `ISapConfig`, `SapAuthType`, `SapConnectionType`, `ICertificateMaterialLoader` |
144
150
  | `@mcp-abap-adt/interfaces-network` | `NETWORK_ERROR_CODES`, the WebSocket contracts |
145
151
  | `@mcp-abap-adt/interfaces-utils` | `ILogger` |
152
+ | `@mcp-abap-adt/auth-errors` | `authError` (the builders: every refusal is minted here), `classifyOutcome` |
146
153
 
147
154
  Not `@mcp-abap-adt/interfaces`. That package is **deleted** as of its 52.0.0,
148
155
  which was never published: npm still serves 51.0.0 — every symbol re-exported and
@@ -154,6 +161,8 @@ the packages above. See [Migration to 9.0.0](./docs/MIGRATION-9.0.md).
154
161
 
155
162
  - 📦 **[Installation Guide](./docs/INSTALLATION.md)** - Setup and installation instructions
156
163
  - 📚 **[Usage Guide](./docs/USAGE.md)** - Detailed usage examples and API documentation
164
+ - 🚚 **[Migration to 13.0.0](./docs/MIGRATION-13.0.md)** - interfaces-auth 7 and auth-errors 2, and the providers from auth-providers 6.0.0; no behaviour change, one interfaces-auth major per process
165
+ - 🚚 **[Migration to 12.0.0](./docs/MIGRATION-12.0.md)** - refusals follow the auth error contract (interfaces-auth 6, auth-errors): `AuthRefusedError.refusal` is an `IAuthProviderError` — read its `kind`; a custom `ILogonTarget` mints its refusal; no auth-providers release fits 12.x — take 13.0.0 with auth-providers 6.0.0
157
166
  - 🚚 **[Migration to 11.0.0](./docs/MIGRATION-11.0.md)** - the server certificate is verified by default; trust a self-signed system with `agentOptions.ca`, or opt out explicitly
158
167
  - 🚚 **[Migration to 10.0.0](./docs/MIGRATION-10.0.md)** - the credential providers moved to `@mcp-abap-adt/auth-providers`; the connection speaks `IAuthProvider` 3.0; `AuthRefusedError`; the RFC factory takes the logon parameters
159
168
  - 🚚 **[Migration to 9.0.0](./docs/MIGRATION-9.0.md)** - the contracts split out of `@mcp-abap-adt/interfaces`; which package each one moved to
@@ -187,14 +196,25 @@ longer brings them along:
187
196
  npm install @mcp-abap-adt/interfaces-adt-connection @mcp-abap-adt/interfaces-auth @mcp-abap-adt/interfaces-auth-sap
188
197
  ```
189
198
 
199
+ A provider or a logon target of your own answers refusals minted by
200
+ `@mcp-abap-adt/auth-errors` (`authError[kind](facts)`); install it too. Keep one
201
+ `@mcp-abap-adt/interfaces-auth` major in the process (`npm ls
202
+ @mcp-abap-adt/interfaces-auth`).
203
+
190
204
  The credential providers (`BasicAuthProvider`, `TokenAuthProvider`,
191
205
  `SamlAuthProvider`, `CertificateAuthProvider`) are not part of this package
192
206
  since 10.0.0. Install them from where they live:
193
207
 
194
208
  ```bash
195
- npm install @mcp-abap-adt/auth-providers
209
+ npm install @mcp-abap-adt/auth-providers@^6
196
210
  ```
197
211
 
212
+ connection 13.x works with **auth-providers 6.0.0** (`^6.0.0`), the release
213
+ built on interfaces-auth 7 and auth-errors 2, and is tested with it: the 5.x
214
+ providers answer unbranded refusals and do not fit. See
215
+ [Migration to 13.0.0](./docs/MIGRATION-13.0.md) and
216
+ [Migration to 12.0.0](./docs/MIGRATION-12.0.md).
217
+
198
218
  For detailed installation instructions, see [Installation Guide](./docs/INSTALLATION.md).
199
219
 
200
220
  ## Quick Start
@@ -469,8 +489,10 @@ See [MIGRATION-4.0.md](./docs/MIGRATION-4.0.md).
469
489
  Every request asks the provider first (`authorize`). A `401` that survives the
470
490
  wire's own session recovery, or a logon the system refused, is put to the
471
491
  provider (`rejected`); on Ok the request is sent once more, otherwise it fails
472
- with an `AuthRefusedError` carrying the provider's own words. A `403` is never
473
- put to the provider.
492
+ with an `AuthRefusedError` carrying the provider's refusal. A `403` is never
493
+ put to the provider. The refusal is an `IAuthProviderError`: decide on its
494
+ `kind` and `facts`; `reason` and `hint` are the words to show, and the error's
495
+ message is `reason — hint`. It is frozen — relay it, never copy it.
474
496
 
475
497
  ```typescript
476
498
  import { AuthRefusedError } from "@mcp-abap-adt/connection";
@@ -479,6 +501,9 @@ try {
479
501
  await connection.connect();
480
502
  } catch (error) {
481
503
  if (error instanceof AuthRefusedError) {
504
+ if (error.refusal.kind === "credential-refused") {
505
+ // the credential itself was refused: renew it, or ask the user
506
+ }
482
507
  console.error(error.refusal.reason, error.refusal.hint, error.at);
483
508
  }
484
509
  throw error;
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/AbstractAbapConnection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACb,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,KAAK,YAAY,EACjB,gBAAgB,EAEjB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAEL,KAAK,aAAa,EAInB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAGnB,MAAM,oBAAoB,CAAC;AAgD5B,uBAAe,sBACb,YACE,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB;IAuGjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,EAAE,aAAa;IACjC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAlH3C;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,mBAA0B;IAEtD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,WAAW,CAAyC;IAE5D;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,gBAAgB,CAAgC;IACxD;;;;;;;;;;OAUG;IACH;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,OAAO,CAAoC;IAEnD,OAAO,CAAC,iBAAiB,CAAS;IAClC,oFAAoF;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,GAAG,IAAI;IAIrC;;;;;;OAMG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMlD;;;;;;;;OAQG;YACW,eAAe;IAU7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,aAAa;IAiCrB;;;;OAIG;IACH,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIlD;;;;;;;;OAQG;IACH,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,eAAe;CA6BxB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
1
+ {"version":3,"file":"AbstractAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/AbstractAbapConnection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,KAAK,YAAY,EACjB,gBAAgB,EAEjB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAEL,KAAK,aAAa,EAInB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAGnB,MAAM,oBAAoB,CAAC;AAgD5B,uBAAe,sBACb,YACE,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB;IAuGjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,EAAE,aAAa;IACjC,SAAS,CAAC,QAAQ,CAAC,M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AAI,EAAE,MAAM,EACZ,UAAU,GAAE,MAAgC,EAC5C,UAAU,GAAE,MAAgC;IAC5C;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,GAChD,OAAO,CAAC,MAAM,CAAC;IAmBlB,SAAS,CAAC,YAAY,IAAI,MAAM,GAAG,IAAI;IAIvC;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAMlD;;OAEG;IACH,SAAS,CAAC,UAAU,IAAI,MAAM,GAAG,IAAI;IAIrC;;;;;;OAMG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMlD;;;;;;;;OAQG;YACW,eAAe;IAU7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,aAAa;IAiCrB;;;;OAIG;IACH,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIlD;;;;;;;;OAQG;IACH,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,eAAe;CA6BxB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -323,7 +323,7 @@ class AbstractAbapConnection {
323
323
  catch (again) {
324
324
  if (!(again instanceof authErrors_js_1.WireLogonError))
325
325
  throw again;
326
- throw new authErrors_js_1.AuthRefusedError(authErrors_js_1.REFUSED_AGAIN, 'logon', again.cause);
326
+ throw new authErrors_js_1.AuthRefusedError((0, authErrors_js_1.refusedAgain)('logon'), 'logon', again.cause);
327
327
  }
328
328
  }
329
329
  });
@@ -371,11 +371,6 @@ class AbstractAbapConnection {
371
371
  // anything is queued, so a caller who has asked to disconnect cannot have
372
372
  // requests still going through while this waits its turn.
373
373
  this.lifecycle.beginTeardown({ origin: 'caller', sessionLost: false });
374
- // Captured before the transition and before anything is cleared: a
375
- // concurrent disconnect JOINS the transition and its callback is never run
376
- // for the joiner, so a joiner would otherwise learn nothing about what it
377
- // asked to release.
378
- const session = this.getSessionIdentity();
379
374
  await this.lifecycle.transition('disconnect', async () => {
380
375
  // DISPATCHED, not awaited. The goodbye carries no request timeout by
381
376
  // design — a server that never answers must not hold a teardown open —
@@ -842,6 +837,10 @@ class AbstractAbapConnection {
842
837
  async credentialRejected(_rejection) {
843
838
  return { outcome: { ok: false, refusal: authErrors_js_1.NO_CREDENTIAL_TO_RENEW } };
844
839
  }
840
+ // The defaults are IAbapConnection's (interfaces-adt-connection), which this
841
+ // implements: changing them here alone would type every caller's response
842
+ // differently from the contract it codes against. They change there first.
843
+ // biome-ignore lint/suspicious/noExplicitAny: mirrors IAbapConnection.makeAdtRequest
845
844
  async makeAdtRequest(options) {
846
845
  // Admission first, synchronously, before any await: the check and the
847
846
  // count must happen in one step, or a request could be admitted and still
@@ -878,7 +877,7 @@ class AbstractAbapConnection {
878
877
  // The request's own headers: everything but the credential's, which is
879
878
  // written fresh onto a copy of these for every attempt (`authorizedFrom`).
880
879
  const requestHeaders = {};
881
- if (!customHeaders || !customHeaders.Accept) {
880
+ if (!customHeaders?.Accept) {
882
881
  requestHeaders.Accept =
883
882
  'application/xml, application/json, text/plain, */*';
884
883
  }
@@ -1288,10 +1287,10 @@ class AbstractAbapConnection {
1288
1287
  this.observeResponse(refusal.headers, lease.generation);
1289
1288
  }
1290
1289
  this.throwIfSessionDead(again, lease);
1291
- const refusedAgain = this.credentialRejection(again);
1292
- if (!refusedAgain)
1290
+ const secondRejection = this.credentialRejection(again);
1291
+ if (!secondRejection)
1293
1292
  throw again;
1294
- throw new authErrors_js_1.AuthRefusedError(authErrors_js_1.REFUSED_AGAIN, refusedAgain.at, refusedAgain.error);
1293
+ throw new authErrors_js_1.AuthRefusedError((0, authErrors_js_1.refusedAgain)(secondRejection.at), secondRejection.at, secondRejection.error);
1295
1294
  }
1296
1295
  }
1297
1296
  /**
@@ -1338,7 +1337,7 @@ class AbstractAbapConnection {
1338
1337
  */
1339
1338
  async renewCredential(rejection, renewal) {
1340
1339
  if (renewal.spent) {
1341
- throw new authErrors_js_1.AuthRefusedError(authErrors_js_1.REFUSED_AGAIN, rejection.at, rejection.error);
1340
+ throw new authErrors_js_1.AuthRefusedError((0, authErrors_js_1.refusedAgain)(rejection.at), rejection.at, rejection.error);
1342
1341
  }
1343
1342
  renewal.spent = true;
1344
1343
  const answer = await this.credentialRejected(rejection);
@@ -1 +1 @@
1
- {"version":3,"file":"CloudHttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/CloudHttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAa9E,qBAAa,kBACX,SAAQ,aACR,YAAW,eAAe;IAE1B,SAAkB,IAAI,gBAAgB;IAEtC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAU;IAEnC;;;;;;;;;;;;;;;;;OAiBG;cACgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI3D,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAuB;IAExB,IAAI,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IA4DhD,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgDhE;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;CAW5B"}
1
+ {"version":3,"file":"CloudHttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/CloudHttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAa9E,qBAAa,kBACX,SA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U3D;;;;;;;OAOG;cACsB,gBAAgB,CACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC;IAYhB,6EAA6E;cACpD,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAUnE;;;OAGG;cACsB,kBAAkB,CACzC,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,aAAa,CAAC;cAIT,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CA+ClD"}
@@ -38,7 +38,7 @@ class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapC
38
38
  * unhandled rejection.
39
39
  */
40
40
  async prepareCredential() {
41
- const { outcome, thrown } = await (0, authErrors_js_1.guarded)(() => this.credential.prepare());
41
+ const { outcome, thrown } = await (0, authErrors_js_1.guarded)(() => this.credential.prepare(), 'prepare');
42
42
  if (!outcome.ok) {
43
43
  throw new authErrors_js_1.AuthRefusedError(outcome.refusal, 'prepare', thrown);
44
44
  }
@@ -54,14 +54,14 @@ class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapC
54
54
  async authorizeRequest(headers) {
55
55
  // Asked per request, never held: a provider renews behind this call, and a
56
56
  // value kept here would be the stale one.
57
- const { outcome, thrown } = await (0, authErrors_js_1.guarded)(() => this.credential.authorize((0, requestTarget_js_1.requestTargetOn)(headers)));
57
+ const { outcome, thrown } = await (0, authErrors_js_1.guarded)(() => this.credential.authorize((0, requestTarget_js_1.requestTargetOn)(headers)), 'request');
58
58
  if (!outcome.ok) {
59
59
  throw new authErrors_js_1.AuthRefusedError(outcome.refusal, 'request', thrown);
60
60
  }
61
61
  }
62
62
  /** What the credential brings to a logon: TLS material, logon parameters. */
63
63
  async logon(target) {
64
- const { outcome, thrown } = await (0, authErrors_js_1.guarded)(() => this.credential.establish(target));
64
+ const { outcome, thrown } = await (0, authErrors_js_1.guarded)(() => this.credential.establish(target), 'logon');
65
65
  if (!outcome.ok) {
66
66
  throw new authErrors_js_1.AuthRefusedError(outcome.refusal, 'logon', thrown);
67
67
  }
@@ -71,7 +71,7 @@ class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapC
71
71
  * is kept beside it to become the cause of the refusal.
72
72
  */
73
73
  async credentialRejected(rejection) {
74
- return (0, authErrors_js_1.guarded)(() => this.credential.rejected(rejection));
74
+ return (0, authErrors_js_1.guarded)(() => this.credential.rejected(rejection), rejection.at);
75
75
  }
76
76
  async establishSession() {
77
77
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"HttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/HttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAE3B,MAAM,oBAAoB,CAAC;AAuC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AA6DzD,qBAAa,aAAc,YAAW,aAAa;IAsC/C,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IACzC;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO;IA7C1B;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAU;IAE/B,OAAO,CAAC,QAAQ,CAA8B;IAE9C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAqC;IAErD,iFAAiF;IACjF,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;;;OAOG;IACH,OAAO,CAAC,QAA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IAIlD;;;;;;;OAOG;IACG,SAAS,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqH7D,uEAAuE;IACvE,SAAS,IAAI,MAAM,GAAG,IAAI;IAI1B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAI1C,4EAA4E;IAC5E,aAAa,IAAI,IAAI;IASrB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,KAAK;IA0Cb;;;;;OAKG;IACH,SAAS,CAAC,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAItD;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IAoE3B,0EAA0E;IAC1E,OAAO,CAAC,SAAS;IASjB,0EAA0E;IAC1E,OAAO,CAAC,OAAO;IAQf;;;;;;;OAOG;IACH,SAAS,CAAC,WAAW,IAAI,YAAY;IAoBrC,OAAO,CAAC,MAAM;IAuBd;;;;;;;OAOG;IACG,IAAI,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD;;;;;;OAMG;IACG,KAAK,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAExD;;;;;OAKG;IACG,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAKzE;;;;;;OAMG;IACH,OAAO,CAAC,GAAG;IAmBX;;;;;;;;;;;;;OAaG;cACa,YAAY,CAC1B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;YAInB,QAAQ;CA4BvB"}
@@ -25,6 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.HttpTransport = exports.isStatefulRequest = void 0;
27
27
  const node_https_1 = require("node:https");
28
+ const auth_errors_1 = require("@mcp-abap-adt/auth-errors");
28
29
  const axios_1 = __importDefault(require("axios"));
29
30
  const cookies_js_1 = require("../utils/cookies.js");
30
31
  const authErrors_js_1 = require("./authErrors.js");
@@ -616,7 +617,10 @@ class HttpTransport {
616
617
  },
617
618
  logonParameters: () => ({
618
619
  ok: false,
619
- refusal: { reason: 'this wire takes no logon parameters (HTTP)' },
620
+ refusal: auth_errors_1.authError['logon-target']({
621
+ wire: 'http',
622
+ refused: 'logon-parameters',
623
+ }),
620
624
  }),
621
625
  };
622
626
  }
@@ -46,7 +46,7 @@ import type { IAdtEstablishContext, IAdtSessionContext, IAdtTransportRequest, IA
46
46
  export interface IRfcConversation {
47
47
  open(): Promise<void>;
48
48
  close(): Promise<void>;
49
- call(fm: string, params: Record<string, unknown>): Promise<Record<string, any>>;
49
+ call(fm: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
50
50
  readonly alive: boolean;
51
51
  /**
52
52
  * Ends the ABAP session context and keeps the connection open
@@ -1 +1 @@
1
- {"version":3,"file":"RfcTransport.d.ts","sourceRoot":"","sources":["../../src/connection/RfcTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAElB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAG5B,sFAAsF;AACtF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,CACF,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAChC,QAAQ,CAAC,K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,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAQzC,2EAA2E;IAC3E,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIzC;;;;OAIG;IACH,aAAa,IAAI,IAAI;IAErB;;;;;OAKG;gBAEgB,OAAO,EAAE,CACxB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KACpC,gBAAgB,EACJ,MAAM,GAAE,OAAO,GAAG,IAAW,EAC7B,OAAO,GAAE,oBAAyB;IAGrD,oDAAoD;IACpD,OAAO,CAAC,OAAO;IAcT,IAAI,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBvD,0DAA0D;IACpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwBtB,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAezE;;;;;;;;;;;;;OAaG;YACW,aAAa;YAUb,WAAW;IAqDzB,uEAAuE;YACzD,gBAAgB;IAa9B;;;;OAIG;YACW,OAAO;IAWrB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAgBnB;;;;OAIG;YACW,QAAQ;YAYR,YAAY;YAQZ,KAAK;CA+KpB"}
@@ -44,8 +44,18 @@
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.RfcTransport = void 0;
46
46
  const node_crypto_1 = require("node:crypto");
47
+ const auth_errors_1 = require("@mcp-abap-adt/auth-errors");
47
48
  const authErrors_js_1 = require("./authErrors.js");
48
49
  const statefulRequest_js_1 = require("./statefulRequest.js");
50
+ /**
51
+ * The SDK answers with untyped structures: each level is read as a record and
52
+ * each field checked before use, rather than trusted as `any`.
53
+ */
54
+ function record(value) {
55
+ return typeof value === 'object' && value !== null
56
+ ? value
57
+ : undefined;
58
+ }
49
59
  /**
50
60
  * ADT exception types, mapped to what they would have been over HTTP. Standard
51
61
  * types, returned in `<exc:exception>` XML.
@@ -389,7 +399,10 @@ class RfcTransport {
389
399
  return {
390
400
  tlsMaterial: () => ({
391
401
  ok: false,
392
- refusal: { reason: 'this wire carries no TLS material (RFC)' },
402
+ refusal: auth_errors_1.authError['logon-target']({
403
+ wire: 'rfc',
404
+ refused: 'tls-material',
405
+ }),
393
406
  }),
394
407
  logonParameters: (written) => {
395
408
  Object.assign(parameters, written);
@@ -503,21 +516,28 @@ class RfcTransport {
503
516
  this.logger?.error(`RFC call failed: ${msg}`);
504
517
  throw new Error(`RFC call to SADT_REST_RFC_ENDPOINT failed: ${msg}`);
505
518
  }
506
- const answer = raw.RESPONSE ?? raw;
507
- const rawCode = answer.STATUS_LINE?.STATUS_CODE ?? answer.STATUS_LINE?.CODE;
519
+ const answer = record(raw.RESPONSE) ?? raw;
520
+ const statusLine = record(answer.STATUS_LINE);
521
+ const rawCode = statusLine?.STATUS_CODE ?? statusLine?.CODE;
508
522
  let status = typeof rawCode === 'string'
509
523
  ? Number.parseInt(rawCode, 10)
510
- : (rawCode ?? 0);
511
- let statusText = answer.STATUS_LINE?.REASON_PHRASE ?? answer.STATUS_LINE?.REASON ?? '';
512
- const data = answer.MESSAGE_BODY
513
- ? Buffer.isBuffer(answer.MESSAGE_BODY)
514
- ? answer.MESSAGE_BODY.toString('utf-8')
515
- : String(answer.MESSAGE_BODY)
524
+ : typeof rawCode === 'number'
525
+ ? rawCode
526
+ : 0;
527
+ const reason = statusLine?.REASON_PHRASE ?? statusLine?.REASON;
528
+ let statusText = typeof reason === 'string' ? reason : '';
529
+ const answered = answer.MESSAGE_BODY;
530
+ const data = answered
531
+ ? Buffer.isBuffer(answered)
532
+ ? answered.toString('utf-8')
533
+ : String(answered)
516
534
  : '';
517
535
  const headers = {};
518
- for (const field of answer.HEADER_FIELDS ?? []) {
519
- if (field.NAME && field.VALUE !== undefined) {
520
- headers[String(field.NAME).toLowerCase()] = field.VALUE;
536
+ const fields = answer.HEADER_FIELDS;
537
+ for (const field of Array.isArray(fields) ? fields : []) {
538
+ const entry = record(field);
539
+ if (entry?.NAME && entry.VALUE !== undefined) {
540
+ headers[String(entry.NAME).toLowerCase()] = entry.VALUE;
521
541
  }
522
542
  }
523
543
  // BASIS < 7.50 answers without populating STATUS_LINE. Left alone, a
@@ -9,8 +9,11 @@ export type AuthRefusalMoment = 'prepare' | 'logon' | 'request';
9
9
  * The credential said no, or the system refused it and the provider's answer
10
10
  * is final.
11
11
  *
12
- * `refusal` is the provider's own words; `cause` keeps the wire's error as it
13
- * arrived, so a network failure stays visible even when a provider words it as
12
+ * `refusal` is the provider's error as `@mcp-abap-adt/auth-errors` minted it
13
+ * (or the connection's own), classified on the way in: a refusal that is not
14
+ * this copy's minted error is rebuilt from its kind and facts, or else is
15
+ * `provider-threw` — decide on its `kind` and `facts`; the message is its
16
+ * `reason — hint`. `cause` keeps the wire's error as it arrived, so a network failure stays visible even when a provider words it as
14
17
  * a credential problem — unless the provider threw instead of answering, when
15
18
  * it is that throw.
16
19
  */
@@ -32,13 +35,16 @@ export declare class WireLogonError extends Error {
32
35
  readonly cause: unknown;
33
36
  constructor(cause: unknown, status?: number);
34
37
  }
35
- /** A provider threw instead of answering: a bug in the provider, not an answer. */
36
- export declare const PROVIDER_FAILED: IAuthRefusal;
38
+ /**
39
+ * A provider threw instead of answering, or answered something that is not an
40
+ * outcome: a bug in the provider, not an answer.
41
+ */
42
+ export declare function providerFailed(at: AuthRefusalMoment): IAuthRefusal;
37
43
  /**
38
44
  * The provider said Ok to a rejection and the retry was refused too. The one
39
45
  * refusal the connection words itself, because the provider's last word was Ok.
40
46
  */
41
- export declare const REFUSED_AGAIN: IAuthRefusal;
47
+ export declare function refusedAgain(at: AuthRefusalMoment): IAuthRefusal;
42
48
  /** A connection built without a credential has nothing to renew. */
43
49
  export declare const NO_CREDENTIAL_TO_RENEW: IAuthRefusal;
44
50
  /**
@@ -51,11 +57,18 @@ export interface GuardedAnswer {
51
57
  thrown?: unknown;
52
58
  }
53
59
  /**
54
- * Run one provider call so that a throw is an answer too.
60
+ * Run one provider call so that a throw is an answer too, and so that what
61
+ * the provider answered is an outcome the connection can trust.
55
62
  *
56
63
  * A consumer's provider may be buggy; the connection must not let that surface
57
64
  * as an unhandled rejection. The throw is kept beside the outcome, to become
58
65
  * the cause of whatever the caller then raises.
66
+ *
67
+ * A provider written in JavaScript can answer any object, and an
68
+ * `AuthRefusedError` built from it would carry its free text. So every answer
69
+ * goes through `classifyOutcome`: a refusal minted by this copy of
70
+ * `auth-errors` passes as the same object, another copy's is rebuilt from its
71
+ * kind and facts, and anything else is `provider-threw` at `at`.
59
72
  */
60
- export declare function guarded(call: () => Promise<AuthOutcome>): Promise<GuardedAnswer>;
73
+ export declare function guarded(call: () => Promise<AuthOutcome>, at: AuthRefusalMoment): Promise<GuardedAnswer>;
61
74
  //# sourceMappingURL=authErrors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authErrors.d.ts","sourceRoot":"","sources":["../../src/connection/authErrors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE/E,4DAA4D;AAC5D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhE;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;IAC/B,SAAkB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAEtB,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,OAAO;CAS1E;AAED;;;;;;GAMG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,SAAkB,KAAK,EAAE,OAAO,CAAC;gBAErB,KAAK,EAAE,OAAO,EAAE,M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AG,YAAY,CAElE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,iBAAiB,GAAG,YAAY,CAEhE;AAED,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,EAAE,YAEnC,CAAC;AAEH;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,EAChC,EAAE,EAAE,iBAAiB,GACpB,OAAO,CAAC,aAAa,CAAC,CAOxB"}
@@ -4,14 +4,20 @@
4
4
  * puts on a failure that is a refused logon.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.NO_CREDENTIAL_TO_RENEW = exports.REFUSED_AGAIN = exports.PROVIDER_FAILED = exports.WireLogonError = exports.AuthRefusedError = void 0;
7
+ exports.NO_CREDENTIAL_TO_RENEW = exports.WireLogonError = exports.AuthRefusedError = void 0;
8
+ exports.providerFailed = providerFailed;
9
+ exports.refusedAgain = refusedAgain;
8
10
  exports.guarded = guarded;
11
+ const auth_errors_1 = require("@mcp-abap-adt/auth-errors");
9
12
  /**
10
13
  * The credential said no, or the system refused it and the provider's answer
11
14
  * is final.
12
15
  *
13
- * `refusal` is the provider's own words; `cause` keeps the wire's error as it
14
- * arrived, so a network failure stays visible even when a provider words it as
16
+ * `refusal` is the provider's error as `@mcp-abap-adt/auth-errors` minted it
17
+ * (or the connection's own), classified on the way in: a refusal that is not
18
+ * this copy's minted error is rebuilt from its kind and facts, or else is
19
+ * `provider-threw` — decide on its `kind` and `facts`; the message is its
20
+ * `reason — hint`. `cause` keeps the wire's error as it arrived, so a network failure stays visible even when a provider words it as
15
21
  * a credential problem — unless the provider threw instead of answering, when
16
22
  * it is that throw.
17
23
  */
@@ -20,14 +26,28 @@ class AuthRefusedError extends Error {
20
26
  at;
21
27
  cause;
22
28
  constructor(refusal, at, cause) {
23
- super(refusal.hint ? `${refusal.reason} — ${refusal.hint}` : refusal.reason);
29
+ const checked = checkedRefusal(refusal, at);
30
+ super(checked.hint ? `${checked.reason} — ${checked.hint}` : checked.reason);
24
31
  this.name = 'AuthRefusedError';
25
- this.refusal = refusal;
32
+ this.refusal = checked;
26
33
  this.at = at;
27
34
  this.cause = cause;
28
35
  }
29
36
  }
30
37
  exports.AuthRefusedError = AuthRefusedError;
38
+ /**
39
+ * The refusal an `AuthRefusedError` carries, never the object as given unread:
40
+ * anyone may build one — over a `structuredClone`, say — and its words reach
41
+ * the message. A refusal this copy of `auth-errors` minted is kept as the same
42
+ * object; one that rebuilds from its kind and facts (a clone, another copy's)
43
+ * is rebuilt, its words rendered anew and its diagnostics dropped; anything
44
+ * else is `provider-threw` at the moment.
45
+ */
46
+ function checkedRefusal(refusal, at) {
47
+ const fallback = providerFailed(at);
48
+ const outcome = (0, auth_errors_1.classifyOutcome)({ ok: false, refusal }, fallback);
49
+ return outcome.ok ? fallback : outcome.refusal;
50
+ }
31
51
  /**
32
52
  * A wire's mark: this failure is a refused logon. It decides nothing — what to
33
53
  * do about it is the provider's answer, not the wire's.
@@ -46,33 +66,44 @@ class WireLogonError extends Error {
46
66
  }
47
67
  }
48
68
  exports.WireLogonError = WireLogonError;
49
- /** A provider threw instead of answering: a bug in the provider, not an answer. */
50
- exports.PROVIDER_FAILED = {
51
- reason: 'the credential provider failed',
52
- };
69
+ /**
70
+ * A provider threw instead of answering, or answered something that is not an
71
+ * outcome: a bug in the provider, not an answer.
72
+ */
73
+ function providerFailed(at) {
74
+ return auth_errors_1.authError.connection({ problem: 'provider-threw', at });
75
+ }
53
76
  /**
54
77
  * The provider said Ok to a rejection and the retry was refused too. The one
55
78
  * refusal the connection words itself, because the provider's last word was Ok.
56
79
  */
57
- exports.REFUSED_AGAIN = {
58
- reason: 'the credential was refused again after the provider renewed it',
59
- };
80
+ function refusedAgain(at) {
81
+ return auth_errors_1.authError.connection({ problem: 'refused-after-renewal', at });
82
+ }
60
83
  /** A connection built without a credential has nothing to renew. */
61
- exports.NO_CREDENTIAL_TO_RENEW = {
62
- reason: 'this connection has no credential to renew',
63
- };
84
+ exports.NO_CREDENTIAL_TO_RENEW = auth_errors_1.authError.connection({
85
+ problem: 'no-credential',
86
+ });
64
87
  /**
65
- * Run one provider call so that a throw is an answer too.
88
+ * Run one provider call so that a throw is an answer too, and so that what
89
+ * the provider answered is an outcome the connection can trust.
66
90
  *
67
91
  * A consumer's provider may be buggy; the connection must not let that surface
68
92
  * as an unhandled rejection. The throw is kept beside the outcome, to become
69
93
  * the cause of whatever the caller then raises.
94
+ *
95
+ * A provider written in JavaScript can answer any object, and an
96
+ * `AuthRefusedError` built from it would carry its free text. So every answer
97
+ * goes through `classifyOutcome`: a refusal minted by this copy of
98
+ * `auth-errors` passes as the same object, another copy's is rebuilt from its
99
+ * kind and facts, and anything else is `provider-threw` at `at`.
70
100
  */
71
- async function guarded(call) {
101
+ async function guarded(call, at) {
102
+ const fallback = providerFailed(at);
72
103
  try {
73
- return { outcome: await call() };
104
+ return { outcome: (0, auth_errors_1.classifyOutcome)(await call(), fallback) };
74
105
  }
75
106
  catch (thrown) {
76
- return { outcome: { ok: false, refusal: exports.PROVIDER_FAILED }, thrown };
107
+ return { outcome: { ok: false, refusal: fallback }, thrown };
77
108
  }
78
109
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rfcConversation.d.ts","sourceRoot":"","sources":["../../src/connection/rfcConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,mBAAmB,CAepE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,GAChB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,gBAAgB,CAqB/D"}
1
+ {"version":3,"file":"rfcConversation.d.ts","sourceRoot":"","sources":["../../src/connection/rfcConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,mBAAmB,CAepE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,GAChB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,gBAAgB,CAoB/D"}
@@ -56,7 +56,6 @@ function rfcConversationFrom(config) {
56
56
  try {
57
57
  // Dynamic, because the SDK is an optional peer: it needs the SAP NW RFC
58
58
  // SDK installed on the machine, and most consumers travel over HTTP.
59
- // biome-ignore lint/correctness/noNodejsModules: optional by design
60
59
  Client = require('@mcp-abap-adt/sap-rfc-lite').Client;
61
60
  }
62
61
  catch (error) {
package/docs/INDEX.md CHANGED
@@ -15,6 +15,8 @@ mcp-abap-connection/
15
15
  │ ├── INSTALLATION.md # Setup and installation guide
16
16
  │ ├── USAGE.md # API documentation and examples
17
17
  │ ├── MIGRATION-2.0.md # Moving to the explicit session lifecycle
18
+ │ ├── MIGRATION-13.0.md # interfaces-auth 7, auth-errors 2, auth-providers 6.0.0; no behaviour change
19
+ │ ├── MIGRATION-12.0.md # refusals follow the auth error contract (interfaces-auth 6, auth-errors)
18
20
  │ ├── MIGRATION-11.0.md # the server certificate is verified by default
19
21
  │ ├── MIGRATION-10.0.md # providers move to auth-providers; IAuthProvider 3.0; AuthRefusedError
20
22
  │ ├── MIGRATION-9.0.md # the contracts split out of @mcp-abap-adt/interfaces
@@ -48,6 +50,8 @@ mcp-abap-connection/
48
50
  - 🔑 [JWT Auth Tools](./JWT_AUTH_TOOLS.md) - CLI tool for browser-based authentication
49
51
 
50
52
  ### Upgrading
53
+ - 🚚 [Migrating to 13.0.0](./MIGRATION-13.0.md) - interfaces-auth 7 and auth-errors 2; the connection's behaviour is unchanged, a consumer holds one interfaces-auth major and takes the providers from auth-providers 6.0.0
54
+ - 🚚 [Migrating to 12.0.0](./MIGRATION-12.0.md) - refusals follow the auth error contract: `AuthRefusedError.refusal` is an `IAuthProviderError` (read its `kind`), a custom `ILogonTarget` mints its refusal through `@mcp-abap-adt/auth-errors`, and no auth-providers release fits 12.x — auth-providers 6.0.0 goes with 13.0.0
51
55
  - 🚚 [Migrating to 11.0.0](./MIGRATION-11.0.md) - the server certificate is verified by default; trust a self-signed system with `agentOptions.ca`, or opt out explicitly with `TLS_REJECT_UNAUTHORIZED=0`
52
56
  - 🚚 [Migrating to 10.0.0](./MIGRATION-10.0.md) - the credential providers moved to `@mcp-abap-adt/auth-providers`; the connection speaks `IAuthProvider` 3.0 and raises `AuthRefusedError`; the RFC factory takes the logon parameters
53
57
  - 🚚 [Migrating to 9.0.0](./MIGRATION-9.0.md) - the contracts split into `interfaces-adt`, `-auth`, `-network` and `-utils`, and this package stopped depending on the umbrella; `interfaces-auth-sap` joined them in the release after, when authentication split into what is SAP's and what is not
@@ -83,8 +87,8 @@ mcp-abap-connection/
83
87
  - **Connection Interface**: [USAGE.md - API Reference](./USAGE.md#api-reference)
84
88
  - **Configuration Types**: [USAGE.md - Configuration Types](./USAGE.md#configuration-types)
85
89
  - **Connectors**: `AdtOnPremConnector`, `AdtCloudConnector`
86
- - **Credentials**: an `IAuthProvider` (`@mcp-abap-adt/interfaces-auth`); the ready-made providers live in `@mcp-abap-adt/auth-providers`
87
- - **Errors**: `AuthRefusedError`, `WireLogonError`
90
+ - **Credentials**: an `IAuthProvider` (`@mcp-abap-adt/interfaces-auth`); the ready-made providers live in `@mcp-abap-adt/auth-providers` (6.0.0 with connection 13.x)
91
+ - **Errors**: `AuthRefusedError` (its `refusal` an `IAuthProviderError` minted by `@mcp-abap-adt/auth-errors`), `WireLogonError`
88
92
  - **Transports**: `HttpTransport`, `RfcTransport` (+ `rfcConversationFrom()`)
89
93
 
90
94
  ## Version Highlights
@@ -208,7 +208,8 @@ actually use:
208
208
 
209
209
  ```bash
210
210
  npm install @mcp-abap-adt/interfaces-adt-connection # IAbapConnection, ITimeoutConfig, ADT_SESSION_ERROR
211
- npm install @mcp-abap-adt/interfaces-auth # IAuthProvider, AuthOutcome, ITokenRefresher
211
+ npm install @mcp-abap-adt/interfaces-auth # IAuthProvider, AuthOutcome, IAuthProviderError, ITokenRefresher (7.x)
212
+ npm install @mcp-abap-adt/auth-errors # authError builders, classify — to mint a refusal of your own
212
213
  npm install @mcp-abap-adt/interfaces-auth-sap # ISapConfig, SapAuthType, ICertificateMaterialLoader
213
214
  npm install @mcp-abap-adt/interfaces-network # NETWORK_ERROR_CODES, the WebSocket contracts
214
215
  npm install @mcp-abap-adt/interfaces-utils # ILogger
@@ -223,8 +224,12 @@ puts two copies of the same contract in your tree.
223
224
 
224
225
  The credential providers (`BasicAuthProvider`, `TokenAuthProvider`,
225
226
  `SamlAuthProvider`, `CertificateAuthProvider`) are no longer part of this
226
- package as of 10.0.0; install `@mcp-abap-adt/auth-providers` for them. See
227
- [Migration to 10.0.0](./MIGRATION-10.0.md).
227
+ package as of 10.0.0; install `@mcp-abap-adt/auth-providers` for them —
228
+ connection 13.x works with auth-providers **6.0.0** (`^6.0.0`), built on
229
+ interfaces-auth 7 and auth-errors 2; the 5.x providers do not fit.
230
+ See [Migration to 10.0.0](./MIGRATION-10.0.md),
231
+ [Migration to 12.0.0](./MIGRATION-12.0.md) and
232
+ [Migration to 13.0.0](./MIGRATION-13.0.md).
228
233
 
229
234
  ### Create `tsconfig.json`
230
235
 
@@ -222,6 +222,7 @@ provider refuses, so a goodbye that authorizes catches it; the connection absorb
222
222
  a rejected close it dispatched, but a close that never throws is the contract.
223
223
 
224
224
  ```ts
225
+ import { authError } from '@mcp-abap-adt/auth-errors';
225
226
  import type {
226
227
  AuthOutcome,
227
228
  ILogonTarget,
@@ -239,7 +240,13 @@ async function logOn(
239
240
  const target: ILogonTarget = {
240
241
  tlsMaterial: (): AuthOutcome => ({
241
242
  ok: false,
242
- refusal: { reason: 'this wire carries no TLS material (example wire)' },
243
+ // Since 12.0.0 a refusal is minted by @mcp-abap-adt/auth-errors. A wire of
244
+ // your own is neither of connection's two, so `wire` is 'unknown' — 'http'
245
+ // and 'rfc' carry the words of connection's own wires. See MIGRATION-12.0.md.
246
+ refusal: authError['logon-target']({
247
+ wire: 'unknown',
248
+ refused: 'tls-material',
249
+ }),
243
250
  }),
244
251
  logonParameters: (offered): AuthOutcome => {
245
252
  parameters = { ...offered };
@@ -0,0 +1,160 @@
1
+ # Migration to 12.0
2
+
3
+ 12.0.0 moves the connection onto the **authentication error contract**:
4
+ `@mcp-abap-adt/interfaces-auth` 6.0.0, which declares the types, and
5
+ `@mcp-abap-adt/auth-errors` 1.0.0, which mints them. Every refusal a provider,
6
+ a logon target or the connection itself gives is now an `IAuthProviderError`: a
7
+ frozen object with a `kind`, `facts` drawn from closed allowlists, and the
8
+ `reason` / `hint` words rendered from them. Free text no longer travels as a
9
+ refusal.
10
+
11
+ The lifecycle didn't change. `prepare`, `establish`, `authorize` and `rejected`
12
+ are called when and as often as in 11.x. One `rejected` Ok still buys exactly
13
+ one more attempt, and a second refusal is still the verdict. The client guard
14
+ of 11.0.1 is unchanged: a request naming another SAP client is still refused
15
+ before anything is sent.
16
+
17
+ ## Dependencies
18
+
19
+ | Package | 11.x | 12.0 |
20
+ |---|---|---|
21
+ | `@mcp-abap-adt/interfaces-auth` | `^3.0.0` | `^6.0.0` |
22
+ | `@mcp-abap-adt/interfaces-auth-sap` | `^2.0.0` | `^3.2.0` |
23
+ | `@mcp-abap-adt/auth-errors` | — | `^1.0.0` (new) |
24
+
25
+ A process should hold **one** interfaces-auth major. Check it with
26
+ `npm ls @mcp-abap-adt/interfaces-auth`.
27
+
28
+ **The providers of `@mcp-abap-adt/auth-providers` 5.x do not fit.** They answer
29
+ unbranded `{ reason, hint }` refusals of interfaces-auth 3–5, and those are not
30
+ an `AuthOutcome` of 6.0.0, so handing a 5.x `BasicAuthProvider` (or any other
31
+ 5.x provider) to a connector no longer compiles. Move to
32
+ `@mcp-abap-adt/auth-providers` 6.0.0, the release that adopts the same
33
+ contract. It was published on interfaces-auth 7, so it fits connection
34
+ **13.0.0**, not 12.x: take 13.0.0 with it ([Migration to 13.0](./MIGRATION-13.0.md)).
35
+
36
+ ## Reading an `AuthRefusedError`
37
+
38
+ `AuthRefusedError` keeps its shape: `refusal`, `at` (`'prepare' | 'logon' |
39
+ 'request'`), `cause`. Its `message` is still `reason — hint`, or the reason
40
+ alone. What changed is `refusal`. It is an `IAuthProviderError`, so decide on
41
+ its `kind` and `facts`, never on its words:
42
+
43
+ ```typescript
44
+ import { AuthRefusedError } from '@mcp-abap-adt/connection';
45
+
46
+ function explain(error: unknown): string | undefined {
47
+ if (!(error instanceof AuthRefusedError)) return undefined;
48
+ const refusal = error.refusal;
49
+ if (refusal.kind === 'credential-refused') {
50
+ return `the ${refusal.facts.credential} was refused at ${error.at}`;
51
+ }
52
+ if (refusal.kind === 'connection' && refusal.facts.problem === 'provider-threw') {
53
+ return 'the credential provider is broken; see error.cause';
54
+ }
55
+ return error.message; // reason — hint, as in 11.x
56
+ }
57
+ ```
58
+
59
+ `refusal.reason` and `refusal.hint` read as before. For a switch over every
60
+ kind that stops compiling when a kind is added, use `matchKind` from
61
+ `@mcp-abap-adt/auth-errors` (see its README).
62
+
63
+ **A refusal is frozen.** It is deep-frozen, so don't write to it. Relay it as
64
+ the object it is. Don't spread it into a new object (`{ ...refusal }`), because
65
+ a copy is no longer a minted error. A `structuredClone` of a refusal (sent to
66
+ a worker, say) is no longer minted either: `isMinted` answers false. Classify
67
+ it again with `classify` from `auth-errors` before deciding on it.
68
+
69
+ **`AuthRefusedError` classifies the refusal it is given.** Its constructor
70
+ reads none of its words as given:
71
+ - A refusal minted by this copy of `auth-errors` is kept as the same object.
72
+ - A clone or another copy's refusal is rebuilt from its `kind` and `facts`.
73
+ Its words are rendered anew, and its diagnostics are dropped.
74
+ - Anything else is `provider-threw` at the error's moment.
75
+
76
+ So an `AuthRefusedError` built over a clone still reads `reason — hint`, and
77
+ text written into a clone's `reason`, `hint` or `diagnostics` reaches neither
78
+ `refusal` nor `message`.
79
+
80
+ ## The connection's own refusals
81
+
82
+ The words are unchanged. Each now has a kind and facts:
83
+
84
+ | When | `kind` | `facts` | `reason` |
85
+ |---|---|---|---|
86
+ | the RFC wire is offered TLS material | `logon-target` | `{ wire: 'rfc', refused: 'tls-material' }` | `this wire carries no TLS material (RFC)` |
87
+ | the HTTP wire is offered logon parameters | `logon-target` | `{ wire: 'http', refused: 'logon-parameters' }` | `this wire takes no logon parameters (HTTP)` |
88
+ | the provider threw, or answered something that is not an outcome | `connection` | `{ problem: 'provider-threw', at }` | `the credential provider failed` |
89
+ | refused again after the provider renewed | `connection` | `{ problem: 'refused-after-renewal', at }` | `the credential was refused again after the provider renewed it` |
90
+ | a connection without a credential is asked to renew | `connection` | `{ problem: 'no-credential' }` | `this connection has no credential to renew` |
91
+
92
+ `at` in `facts` is the moment of the `AuthRefusedError` that carries it.
93
+
94
+ **The connection re-checks what a provider answers.** Every answer passes
95
+ through `classifyOutcome`:
96
+ - A refusal minted by the same `auth-errors` passes as the same object.
97
+ - A refusal minted by another copy is rebuilt from its kind and facts.
98
+ - Anything else (a plain `{ reason: '…' }` from a provider written in
99
+ JavaScript, a non-outcome) becomes `provider-threw`, and its text reaches no
100
+ message.
101
+
102
+ A provider that throws is `provider-threw` too, with the throw as `cause`, as
103
+ in 11.x.
104
+
105
+ ## A logon target of your own
106
+
107
+ A wire of your own hands the provider an `ILogonTarget`. Its refusals must be
108
+ minted now, because an object literal is not an `IAuthProviderError` and does
109
+ not compile:
110
+
111
+ ```typescript
112
+ import { authError } from '@mcp-abap-adt/auth-errors';
113
+ import type { AuthOutcome, ILogonTarget } from '@mcp-abap-adt/interfaces-auth';
114
+
115
+ function logonTarget(parameters: Record<string, string>): ILogonTarget {
116
+ return {
117
+ // A wire of your own is neither of connection's two, so it is `unknown`:
118
+ // "the logon target did not take the TLS material".
119
+ tlsMaterial: (): AuthOutcome => ({
120
+ ok: false,
121
+ refusal: authError['logon-target']({
122
+ wire: 'unknown',
123
+ refused: 'tls-material',
124
+ }),
125
+ }),
126
+ logonParameters: (offered): AuthOutcome => {
127
+ Object.assign(parameters, offered);
128
+ return { ok: true };
129
+ },
130
+ };
131
+ }
132
+ ```
133
+
134
+ `wire` is one of `http`, `rfc` or `unknown`. `http` and `rfc` carry the words
135
+ of connection's own wires (`this wire takes no logon parameters (HTTP)`, …), so
136
+ a target of your own uses `unknown` unless it really is one of those.
137
+
138
+ ## A provider of your own
139
+
140
+ An `IAuthProvider` you wrote answers minted refusals: `authError[kind](facts)`
141
+ from `@mcp-abap-adt/auth-errors`. Its `guard(operation, body)` runs one
142
+ moment so that a throw becomes a refusal and the answer is classified. A
143
+ provider that still answers `{ ok: false, refusal: { reason } }` compiles no
144
+ more in TypeScript. In JavaScript, the connection answers `provider-threw` for
145
+ it, as described above. `@mcp-abap-adt/auth-providers` 6.0.0 (with connection
146
+ 13.x) ships `AuthProviderBase`, which owns the four moments for you.
147
+
148
+ ## Deep imports
149
+
150
+ 11.0.1's index exported none of the refusal constants: only
151
+ `AuthRefusedError`, `AuthRefusalMoment` and `WireLogonError`, all unchanged.
152
+ There is no `exports` map, though, so a deep import of
153
+ `dist/connection/authErrors.js` was possible. If you did that:
154
+
155
+ - `PROVIDER_FAILED` and `REFUSED_AGAIN` are gone. They are internal functions
156
+ of the moment now, `providerFailed(at)` and `refusedAgain(at)`.
157
+ - `NO_CREDENTIAL_TO_RENEW` is a minted error.
158
+ - `guarded(call, at)` takes the moment.
159
+
160
+ None of these is an API. Read the refusal's `kind` and `facts` instead.
@@ -0,0 +1,66 @@
1
+ # Migration to 13.0
2
+
3
+ 13.0.0 moves the connection from interfaces-auth 6 to **7**, with
4
+ `@mcp-abap-adt/auth-errors` 2, and is the release that works with
5
+ `@mcp-abap-adt/auth-providers` **6.0.0**. The connection's own behaviour does not
6
+ change: the lifecycle, the one credential retry, the refusals it mints and
7
+ `WireLogonError` are as in 12.x. 12.0.0 was only on the `next` dist-tag, so for
8
+ most consumers this is the step from 11.x with the 12 migration included; read
9
+ [Migration to 12.0.0](./MIGRATION-12.0.md) too.
10
+
11
+ ## Dependencies
12
+
13
+ | Package | 12.0 | 13.0 |
14
+ |---|---|---|
15
+ | `@mcp-abap-adt/interfaces-auth` | `^6.0.0` | `^7.5.0` |
16
+ | `@mcp-abap-adt/interfaces-auth-sap` | `^3.2.0` | `^3.3.0` |
17
+ | `@mcp-abap-adt/auth-errors` | `^1.0.0` | `^2.1.1` |
18
+ | `@mcp-abap-adt/auth-providers` (yours, not a dependency) | none fits | `^6.0.0` |
19
+
20
+ A process should hold **one** interfaces-auth major and one auth-errors copy
21
+ (`npm ls @mcp-abap-adt/interfaces-auth @mcp-abap-adt/auth-errors`; each should
22
+ appear once, the rest `deduped`). Providers must speak interfaces-auth 7 as well.
23
+
24
+ ## The providers: auth-providers 6.0.0
25
+
26
+ connection 13.0.0 is tested with `@mcp-abap-adt/auth-providers` 6.0.0, built on
27
+ interfaces-auth 7.5 and auth-errors 2.1. Install it beside the connection:
28
+
29
+ ```bash
30
+ npm install @mcp-abap-adt/connection@^13 @mcp-abap-adt/auth-providers@^6
31
+ ```
32
+
33
+ - auth-providers 5.x does not fit: its refusals are unbranded `{ reason, hint }`,
34
+ not an `AuthOutcome` of interfaces-auth 7. No auth-providers release fits
35
+ connection 12.x (6.0.0 is on interfaces-auth 7, 5.x on 3), so move to 13.0.0
36
+ and 6.0.0 together.
37
+ - The credentials the connection docs use keep their constructors:
38
+ `new BasicAuthProvider(user, password)`, `TokenAuthProvider.fixed(token)` /
39
+ `.from(refresher)`, `new SamlAuthProvider(cookies)`,
40
+ `new CertificateAuthProvider(loader, config)` / `.fromFiles(config)`,
41
+ `new SncLogonProvider({ … })`.
42
+ - `CertificateAuthProvider` proves its material usable in `prepare()`, so a
43
+ certificate it cannot use is refused at `connect()` (`AuthRefusedError` at
44
+ `prepare`), before any logon.
45
+ - A token provider (`ClientCredentialsProvider`, `AuthorizationCodeProvider`,
46
+ the OIDC and SAML providers, …) now needs `renewal` — `refreshThenLogin()`
47
+ or `refreshOnly()` — and takes `persistence` in place of `onTokens`; an
48
+ interactive one is handed an `IBrowser`. Each is an `IAuthProvider` itself
49
+ and goes to a connector unwrapped. See auth-providers' README, *Migrating to
50
+ 6.0.0*.
51
+
52
+ ## What interfaces-auth 7 changes
53
+
54
+ - New error kind `renewal-declined`; a consumer that switches on `kind`
55
+ exhaustively must handle it.
56
+ - New configuration case `invalid-value`; new operation `renewal-strategy`.
57
+ - The operation `on-tokens-hook` is now `persisting-tokens`.
58
+ - The interactive outcome `browser-launch-failed` is gone.
59
+ - `ITokenResult.refreshTokenDisposition` and `RefreshTokenDisposition` are gone.
60
+
61
+ 7.1–7.5 add only new types (`IBrowser`, the authorization parts) and new
62
+ members of code lists (`CONFIG_FIELDS`, `OPERATIONS`,
63
+ `INTERACTIVE_LOGIN_STRATEGIES`).
64
+
65
+ The connection reads none of these, so nothing in its API changes. A consumer
66
+ that does must update its own code.
package/docs/SCOPE.md CHANGED
@@ -17,6 +17,7 @@ This package is **one component of the `@mcp-abap-adt/*` family**. Each package
17
17
  | Token validation, refresh, re-authentication, expiry tracking | the `IAuthProvider` the consumer hands in (`@mcp-abap-adt/interfaces-auth`; ready-made ones in `@mcp-abap-adt/auth-providers`) |
18
18
  | Session state persistence across processes | `@mcp-abap-adt/auth-broker` |
19
19
  | Auth-type constants, provider error codes, auth lifecycle contracts | `@mcp-abap-adt/interfaces-auth`, `@mcp-abap-adt/interfaces-auth-sap` |
20
+ | Minting and classifying an auth refusal (`IAuthProviderError`) | `@mcp-abap-adt/auth-errors` |
20
21
 
21
22
  The rule: **if it is about *acquiring* or *refreshing* credentials, it is not our job.** We receive credentials that are valid at call time and use them. The consumer is responsible for handing us fresh ones — they know their IdP, their refresh cadence, their re-auth UX.
22
23
 
@@ -41,4 +42,4 @@ It forwards every `(name, value)` pair from the JS `Client(params)` object to `R
41
42
 
42
43
  - [`INSTALLATION.md`](./INSTALLATION.md)
43
44
  - [`USAGE.md`](./USAGE.md)
44
- - Sibling packages: `@mcp-abap-adt/interfaces-adt-connection`, `@mcp-abap-adt/interfaces-auth`, `@mcp-abap-adt/interfaces-auth-sap`, `@mcp-abap-adt/interfaces-network`, `@mcp-abap-adt/interfaces-utils`, `@mcp-abap-adt/sap-rfc-lite`, `@mcp-abap-adt/auth-broker`
45
+ - Sibling packages: `@mcp-abap-adt/interfaces-adt-connection`, `@mcp-abap-adt/interfaces-auth`, `@mcp-abap-adt/interfaces-auth-sap`, `@mcp-abap-adt/interfaces-network`, `@mcp-abap-adt/interfaces-utils`, `@mcp-abap-adt/auth-errors` (mints and classifies every auth refusal), `@mcp-abap-adt/sap-rfc-lite`, `@mcp-abap-adt/auth-broker`
@@ -189,7 +189,7 @@ credential — the second 401 ends the request as `AuthRefusedError` with the re
189
189
  verdict (`at: 'request'`), not `SESSION_REPLACED`, and the connection stays connected. Inside a
190
190
  critical section, treat that as a lost lock: `disconnect()`, `connect()`, and redo the work under
191
191
  a new lock.
192
- If the provider says no, or the retry is refused too, the caller gets an `AuthRefusedError`. A 403 is an authorization answer, not a credential one: it never goes to the
192
+ If the provider says no, or the retry is refused too, the caller gets an `AuthRefusedError` (the refused-again verdict is `refusal.kind === 'connection'`, `facts.problem === 'refused-after-renewal'`). A 403 is an authorization answer, not a credential one: it never goes to the
193
193
  provider. See [When the credential is refused](./USAGE.md#when-the-credential-is-refused).
194
194
 
195
195
  A reconnect is a NEW session, so do it outside a lock window rather than inside one.
package/docs/USAGE.md CHANGED
@@ -928,7 +928,7 @@ export class CloudSdkAbapConnection {
928
928
  ### The credential, and how a refusal is classified
929
929
 
930
930
  For SAP BTP cloud systems, hand `AdtCloudConnector` a token provider from
931
- `@mcp-abap-adt/auth-providers`: `TokenAuthProvider.fixed(token)` is a token with
931
+ `@mcp-abap-adt/auth-providers` 6.0.0 (connection 13.x works with `^6.0.0`): `TokenAuthProvider.fixed(token)` is a token with
932
932
  nothing behind it, `TokenAuthProvider.from(refresher)` takes an `ITokenRefresher`
933
933
  and renews a token the system refused. Obtaining tokens in the first place is
934
934
  `@mcp-abap-adt/auth-broker`'s job, not this package's.
@@ -997,9 +997,13 @@ try {
997
997
  await connection.connect();
998
998
  } catch (error) {
999
999
  if (error instanceof AuthRefusedError) {
1000
- // error.refusal.reason / .hint are the provider's words;
1000
+ // error.refusal is an IAuthProviderError: decide on its kind and facts;
1001
+ // .reason / .hint are the words to show (the message is `reason — hint`).
1001
1002
  // error.at is 'prepare' | 'logon' | 'request'; error.cause is the provider's
1002
1003
  // throw when it threw, else the wire's error.
1004
+ if (error.refusal.kind === 'credential-refused') {
1005
+ // the credential itself was refused
1006
+ }
1003
1007
  console.error(error.message);
1004
1008
  }
1005
1009
  throw error;
@@ -1008,8 +1012,28 @@ try {
1008
1012
 
1009
1013
  `refusal` is the provider's, `cause` is the error the wire raised as it arrived,
1010
1014
  so a network failure stays visible even when a provider words it as a credential
1011
- problem. A provider that throws is treated as refusing with the reason "the
1012
- credential provider failed" and the throw as the cause.
1015
+ problem. A refusal is an `IAuthProviderError` minted by `@mcp-abap-adt/auth-errors`
1016
+ — frozen, with a `kind` and `facts` from closed allowlists; relay it, never copy
1017
+ it. Every provider answer is re-checked with `classifyOutcome`: a minted refusal
1018
+ passes as the same object, one from another copy of `auth-errors` is rebuilt,
1019
+ and anything else — a plain `{ reason }` from a JavaScript provider, a value that
1020
+ is no outcome — becomes `connection` / `provider-threw`, "the credential provider
1021
+ failed", its text in no message. A provider that throws is the same refusal,
1022
+ with the throw as the cause.
1023
+
1024
+ The connection's own refusals:
1025
+
1026
+ | `kind` | `facts` | words |
1027
+ |---|---|---|
1028
+ | `logon-target` | `{ wire: 'rfc', refused: 'tls-material' }` | this wire carries no TLS material (RFC) |
1029
+ | `logon-target` | `{ wire: 'http', refused: 'logon-parameters' }` | this wire takes no logon parameters (HTTP) |
1030
+ | `connection` | `{ problem: 'provider-threw', at }` | the credential provider failed |
1031
+ | `connection` | `{ problem: 'refused-after-renewal', at }` | the credential was refused again after the provider renewed it |
1032
+ | `connection` | `{ problem: 'no-credential' }` | this connection has no credential to renew |
1033
+
1034
+ A wire of your own mints its target's refusals the same way
1035
+ (`authError['logon-target']({ wire: 'unknown', refused })`); see
1036
+ [MIGRATION-12.0.md](./MIGRATION-12.0.md).
1013
1037
 
1014
1038
  **Concurrency.** Many requests meeting the same expired token each call
1015
1039
  `rejected()`; the connection adds no single-flight of its own. They share one
@@ -8,7 +8,7 @@ This directory contains example code demonstrating how to use the `@mcp-abap-adt
8
8
  # Install dependencies
9
9
  cd packages/connection
10
10
  npm install
11
- npm install @mcp-abap-adt/auth-providers # the credential providers the examples use
11
+ npm install @mcp-abap-adt/auth-providers@^6 # the credential providers the examples use (6.0.0 with connection 13.x)
12
12
 
13
13
  # Build the package
14
14
  npm run build
@@ -9,7 +9,8 @@
9
9
  * 1. Calls tokenRefresher.refreshToken() to get a new token
10
10
  * 2. Answers Ok, so the connection authorizes the request again
11
11
  * 3. The request is sent exactly once more; a second refusal is an
12
- * AuthRefusedError carrying the provider's words
12
+ * AuthRefusedError with the connection's verdict, `refusal.kind`
13
+ * 'connection' / `facts.problem` 'refused-after-renewal'
13
14
  *
14
15
  * A **403** is left alone. It means the server authenticated you and refused
15
16
  * the action anyway — an authorization gap, not an expired credential — so it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/connection",
3
- "version": "11.0.1",
3
+ "version": "13.0.0",
4
4
  "description": "ABAP connection layer for MCP ABAP ADT server",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,12 +39,12 @@
39
39
  "chrono": "node scripts/version-stats.mjs",
40
40
  "clean": "node scripts/clean.mjs",
41
41
  "lint": "npx biome check --write src scripts",
42
- "lint:check": "npx biome check src scripts",
42
+ "lint:check": "npx biome check src scripts --error-on-warnings && node tools/check-provider-shape.mjs --rules 4,5,6",
43
43
  "format": "npx biome format --write src scripts",
44
44
  "build": "npm run --silent clean && npx biome check src scripts --diagnostic-level=error && npx tsc -p tsconfig.json && npm run --silent typecheck:scripts",
45
45
  "build:fast": "npx tsc -p tsconfig.json",
46
46
  "test": "npm run --silent check:docs && jest",
47
- "prepublishOnly": "npm run build && npm run check:docs && npm run --silent check:pack",
47
+ "prepublishOnly": "npm run build && npm run lint:check && npm run check:docs && npm run --silent check:pack",
48
48
  "check:docs": "node scripts/check-docs.mjs",
49
49
  "typecheck:scripts": "npx tsc -p tsconfig.scripts.json",
50
50
  "check:pack": "node scripts/check-pack.mjs"
@@ -53,9 +53,10 @@
53
53
  "node": "^22 || ^24 || ^26"
54
54
  },
55
55
  "dependencies": {
56
+ "@mcp-abap-adt/auth-errors": "^2.1.1",
56
57
  "@mcp-abap-adt/interfaces-adt-connection": "^1.0.0",
57
- "@mcp-abap-adt/interfaces-auth": "^3.0.0",
58
- "@mcp-abap-adt/interfaces-auth-sap": "^2.0.0",
58
+ "@mcp-abap-adt/interfaces-auth": "^7.5.0",
59
+ "@mcp-abap-adt/interfaces-auth-sap": "^3.3.0",
59
60
  "@mcp-abap-adt/interfaces-network": "^2.0.0",
60
61
  "@mcp-abap-adt/interfaces-utils": "^1.1.0",
61
62
  "axios": "^1.16.0",
@@ -67,7 +68,7 @@
67
68
  },
68
69
  "devDependencies": {
69
70
  "@biomejs/biome": "^2.3.14",
70
- "@mcp-abap-adt/auth-providers": "^5.2.0",
71
+ "@mcp-abap-adt/auth-providers": "^6.0.0",
71
72
  "@types/jest": "^30.0.0",
72
73
  "@types/node": "^25.2.3",
73
74
  "dotenv": "^17.3.1",