@mcp-abap-adt/connection 24.0.0 → 25.0.1
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 +92 -1
- package/README.md +63 -7
- package/dist/connection/AbstractAbapConnection.d.ts +3 -0
- package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
- package/dist/connection/AbstractAbapConnection.js +27 -9
- package/dist/connection/CloudHttpTransport.d.ts.map +1 -1
- package/dist/connection/CloudHttpTransport.js +2 -1
- package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
- package/dist/connection/CredentialAbapConnection.js +2 -1
- package/dist/connection/GenericWebSocketTransport.d.ts +6 -0
- package/dist/connection/GenericWebSocketTransport.d.ts.map +1 -1
- package/dist/connection/GenericWebSocketTransport.js +22 -10
- package/dist/connection/HttpTransport.d.ts +4 -4
- package/dist/connection/HttpTransport.d.ts.map +1 -1
- package/dist/connection/HttpTransport.js +22 -9
- package/dist/connection/IAdtTransport.d.ts +4 -3
- package/dist/connection/IAdtTransport.d.ts.map +1 -1
- package/dist/connection/RfcTransport.d.ts +6 -0
- package/dist/connection/RfcTransport.d.ts.map +1 -1
- package/dist/connection/RfcTransport.js +40 -71
- package/dist/connection/authErrors.d.ts +21 -5
- package/dist/connection/authErrors.d.ts.map +1 -1
- package/dist/connection/authErrors.js +29 -6
- package/dist/connection/createConnection.d.ts.map +1 -1
- package/dist/connection/createConnection.js +7 -0
- package/dist/connection/failureFacts.d.ts +100 -0
- package/dist/connection/failureFacts.d.ts.map +1 -0
- package/dist/connection/failureFacts.js +280 -0
- package/dist/connection/rfcConversation.d.ts +2 -0
- package/dist/connection/rfcConversation.d.ts.map +1 -1
- package/dist/connection/rfcConversation.js +16 -4
- package/dist/connection/withCheckRelogon.d.ts +8 -0
- package/dist/connection/withCheckRelogon.d.ts.map +1 -0
- package/dist/connection/withCheckRelogon.js +68 -0
- package/docs/INDEX.md +2 -0
- package/docs/MIGRATION-10.0.md +11 -1
- package/docs/MIGRATION-12.0.md +8 -0
- package/docs/MIGRATION-25.0.md +88 -0
- package/docs/MIGRATION-4.0.md +4 -0
- package/docs/USAGE.md +43 -18
- package/package.json +1 -1
package/docs/USAGE.md
CHANGED
|
@@ -710,9 +710,8 @@ on whether it is stateful (since 23.0.0):
|
|
|
710
710
|
rejects as itself — with `sessionLost: 'ADT_SESSION_REPLACED'` on that
|
|
711
711
|
response or on that error (`IAdtWireResponse`, `IAbapConnectionError`,
|
|
712
712
|
`@mcp-abap-adt/interfaces-adt-connection`, since 4.2.0). Only the request whose own
|
|
713
|
-
answer showed the replacement carries it.
|
|
714
|
-
|
|
715
|
-
reaches you.
|
|
713
|
+
answer showed the replacement carries it. The original instance is spent
|
|
714
|
+
before the answer reaches you.
|
|
716
715
|
|
|
717
716
|
The connection's own exchanges inside a request (a CSRF fetch, a logon) have no
|
|
718
717
|
answer of yours to keep: a replacement seen on one is `ADT_SESSION_REPLACED`.
|
|
@@ -730,11 +729,11 @@ nothing here suggests a working session to continue on — the one we had is
|
|
|
730
729
|
confirmed dead, and re-establishing silently is what let the old connector
|
|
731
730
|
carry on over a session the caller never opened.
|
|
732
731
|
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
732
|
+
The factory can complete a [stateless syntax check](#syntax-check-recovery-on-http)
|
|
733
|
+
after SAP explicitly rejects its CSRF token and the response confirms session
|
|
734
|
+
replacement. Recovery for other requests is the caller's decision. At the HTTP
|
|
735
|
+
wire level, the pooled-socket resend still applies only when no answer byte
|
|
736
|
+
arrived (see "Kept-alive connections, and the one resend" under the transports).
|
|
738
737
|
|
|
739
738
|
**A lost session spends the instance** (since 16.0.0), as `disconnect()` does.
|
|
740
739
|
After either of these — a stateless answer marked `sessionLost` included —
|
|
@@ -838,6 +837,21 @@ await connection.makeAdtRequest({ method: 'POST', url: '...' , timeout: 0 });
|
|
|
838
837
|
connection.setSessionType('stateless');
|
|
839
838
|
```
|
|
840
839
|
|
|
840
|
+
### Syntax check recovery on HTTP
|
|
841
|
+
|
|
842
|
+
On a modern HTTP connection built by `createConnection`, an ADT syntax check
|
|
843
|
+
(`POST /sap/bc/adt/checkruns` with an XML string body) is retried once during
|
|
844
|
+
the same call if SAP rejects the CSRF token and the response also shows that
|
|
845
|
+
the original session was replaced. The retry logs on with the same destination
|
|
846
|
+
and provider, then sends the check on a temporary session. A failure to log on
|
|
847
|
+
is the call's error. The temporary session is logged off and the original
|
|
848
|
+
connection remains spent. A successful retry still carries
|
|
849
|
+
`sessionLost: ADT_SESSION_REPLACED` so the caller can discard state tied to the
|
|
850
|
+
original session.
|
|
851
|
+
|
|
852
|
+
This applies to stateless checks outside a critical section. Stateful requests
|
|
853
|
+
and operations under an existing lock retain their session-bound behavior.
|
|
854
|
+
|
|
841
855
|
### Starting Over
|
|
842
856
|
|
|
843
857
|
There is no local-only reset. Discarding the cookie does not end the ABAP
|
|
@@ -1164,15 +1178,21 @@ carries it; the wire never reads `config.username` or `config.password`.
|
|
|
1164
1178
|
and a provider that writes no logon parameters (a bearer token) cannot log on
|
|
1165
1179
|
over RFC: the open fails, the provider is asked, and you get its refusal.
|
|
1166
1180
|
- A failed RFC open is thrown as `WireLogonError` with the SDK's own error as
|
|
1167
|
-
`cause`, so a provider can read the SDK's `key` and message.
|
|
1181
|
+
`cause`, so a provider can read the SDK's `key` and message. Its own message
|
|
1182
|
+
is fixed words (`The logon failed`, with the status when the wire has one),
|
|
1183
|
+
never the cause's text (25.0.0).
|
|
1168
1184
|
- **A failed RFC call carries `rfc`** (22.0.0): `{ key, group, code,
|
|
1169
1185
|
codeString }` (`IRfcErrorInfo`, `codeString` one of `RFC_RCS`, both from
|
|
1170
1186
|
`@mcp-abap-adt/interfaces-adt-connection`), checked once where the wire
|
|
1171
1187
|
receives the SDK's error — own data properties only, nothing read out of a
|
|
1172
1188
|
message. An error the SDK did not name carries no `rfc`. `rfc` is carried on
|
|
1173
|
-
every conversation, stateful or not. The message is the call's
|
|
1174
|
-
|
|
1175
|
-
|
|
1189
|
+
every conversation, stateful or not. The message is the call's, in fixed
|
|
1190
|
+
words built from `rfc` — `RFC call to SADT_REST_RFC_ENDPOINT failed:
|
|
1191
|
+
<codeString>`, or `… failed: the SDK did not name the failure` without `rfc`
|
|
1192
|
+
(25.0.0; before, it quoted the SDK's text, which names the partner's
|
|
1193
|
+
`host:port`, the time and the kernel's source module). The connection's log
|
|
1194
|
+
lines about a failed call, close or reset say the same words. The top-level
|
|
1195
|
+
`code` is not set —
|
|
1176
1196
|
except when the error ended the stateful conversation: then the message is
|
|
1177
1197
|
the session-lost one ("The RFC conversation that carried this connection's
|
|
1178
1198
|
SAP session has ended; …") and `code` is `ADT_SESSION_REPLACED`, the instance
|
|
@@ -1311,7 +1331,7 @@ token the provider renewed is on the very next attempt.
|
|
|
1311
1331
|
| answer | what happens |
|
|
1312
1332
|
|---|---|
|
|
1313
1333
|
| **403** "CSRF token validation failed", or a **401** to a mutation that holds no CSRF token yet | the wire's own CSRF recovery: a token fetched in the same session (its cookies kept) and one resend. None of this discards the session or opens another |
|
|
1314
|
-
| any other **401** — a mutation's with a CSRF token cached included — or a logon the system refused | put to `provider.rejected({ at, status?, error })`. On Ok the request is authorized again and sent **once more**, in the same session; on no, `AuthRefusedError`
|
|
1334
|
+
| any other **401** — a mutation's with a CSRF token cached included — or a logon the system refused | put to `provider.rejected({ at, status?, error })`. On Ok the request is authorized again and sent **once more**, in the same session; on no, `AuthRefusedError` whose cause is a copy of SAP's 401 (`status`) |
|
|
1315
1335
|
| the same refusal after an Ok | the verdict. The provider is not asked again — asking would invite a second renewal — and you get an `AuthRefusedError` saying the credential was refused again after the provider renewed it |
|
|
1316
1336
|
| **403** | propagates untouched, never put to the provider. The server authenticated the caller and refused the action anyway, so a new credential is the same caller — usually the body names the authorization object |
|
|
1317
1337
|
| anything else | untouched |
|
|
@@ -1356,8 +1376,9 @@ try {
|
|
|
1356
1376
|
if (error instanceof AuthRefusedError) {
|
|
1357
1377
|
// error.refusal is an IAuthProviderError: decide on its kind and facts;
|
|
1358
1378
|
// .reason / .hint are the words to show (the message is `reason — hint`).
|
|
1359
|
-
// error.at is 'prepare' | 'logon' | 'request'; error.cause is
|
|
1360
|
-
//
|
|
1379
|
+
// error.at is 'prepare' | 'logon' | 'request'; error.cause is a copy
|
|
1380
|
+
// (`WireFailure`: code, status, rfc) of the provider's throw when it threw,
|
|
1381
|
+
// else of the wire's error.
|
|
1361
1382
|
if (error.refusal.kind === 'credential-refused') {
|
|
1362
1383
|
// the credential itself was refused
|
|
1363
1384
|
}
|
|
@@ -1367,16 +1388,20 @@ try {
|
|
|
1367
1388
|
}
|
|
1368
1389
|
```
|
|
1369
1390
|
|
|
1370
|
-
`refusal` is the provider's, `cause`
|
|
1391
|
+
`refusal` is the provider's, `cause` says the error the wire raised by its facts,
|
|
1371
1392
|
so a network failure stays visible even when a provider words it as a credential
|
|
1372
|
-
problem
|
|
1393
|
+
problem: an `Error` named `WireFailure`, its message `The failure: <facts>`, with
|
|
1394
|
+
`code`, `status`, `rfc` and SAP's answer (`response`) as fields — never the value itself, whose text may
|
|
1395
|
+
name a host and whose fields may hold the request's credential headers
|
|
1396
|
+
(25.0.0). The provider was handed the value as it arrived
|
|
1397
|
+
(`IAuthRejection.error`). A refusal is an `IAuthProviderError` minted by `@mcp-abap-adt/auth-errors`
|
|
1373
1398
|
— frozen, with a `kind` and `facts` from closed allowlists; relay it, never copy
|
|
1374
1399
|
it. Every provider answer is re-checked with `classifyOutcome`: a minted refusal
|
|
1375
1400
|
passes as the same object, one from another copy of `auth-errors` is rebuilt,
|
|
1376
1401
|
and anything else — a plain `{ reason }` from a JavaScript provider, a value that
|
|
1377
1402
|
is no outcome — becomes `connection` / `provider-threw`, "the credential provider
|
|
1378
1403
|
failed", its text in no message. A provider that throws is the same refusal,
|
|
1379
|
-
with the throw as the cause.
|
|
1404
|
+
with a copy of the throw as the cause.
|
|
1380
1405
|
|
|
1381
1406
|
The connection's own refusals:
|
|
1382
1407
|
|