@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/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,95 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [25.0.1] - 2026-11-21
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- For HTTP connections made by `createConnection`, a stateless syntax check
|
|
15
|
+
(`POST /sap/bc/adt/checkruns`) that SAP rejects with a CSRF validation error
|
|
16
|
+
while replacing the session is retried once after logging on to a fresh
|
|
17
|
+
session. A failed logon is returned to the caller. The temporary session
|
|
18
|
+
is closed and the original instance remains spent.
|
|
19
|
+
|
|
20
|
+
## [25.0.0] - 2026-11-13
|
|
21
|
+
|
|
22
|
+
No error the connection hands out, and no line it logs, carries a thrown
|
|
23
|
+
value's text or a request's config: on every wire a failure is said by its
|
|
24
|
+
typed facts (`code`, `status`, `rfc`, SAP's answer as `response`) and fixed
|
|
25
|
+
words. A security fix, and breaking for code that read axios's own fields off
|
|
26
|
+
a connection's error or compared `AuthRefusedError.cause` with the original.
|
|
27
|
+
See [docs/MIGRATION-25.0.md](docs/MIGRATION-25.0.md).
|
|
28
|
+
|
|
29
|
+
### Changed — breaking
|
|
30
|
+
|
|
31
|
+
- **An HTTP failure is no longer the axios error.** It is an `Error` carrying
|
|
32
|
+
SAP's answer as `response` (`status`, `statusText`, `headers`, `data`, as
|
|
33
|
+
SAP gave them), `status` and `code`. It has no `config`, no `request`, no
|
|
34
|
+
`isAxiosError` and no `cause`: `axios.isAxiosError(error)` and
|
|
35
|
+
`instanceof AxiosError` are `false`.
|
|
36
|
+
- **`AuthRefusedError.cause` is a `WireFailure` copy**, typed
|
|
37
|
+
`FailureCopy | undefined` (was `unknown`): `code`, `status`, `rfc`,
|
|
38
|
+
`response` and the message `The failure: <facts>`. `cause === original` no
|
|
39
|
+
longer holds; the provider still receives the original as
|
|
40
|
+
`IAuthRejection.error`.
|
|
41
|
+
|
|
42
|
+
### Fixed — security
|
|
43
|
+
|
|
44
|
+
- **An RFC failure carries the SDK's typed fields, never its text.** A failed
|
|
45
|
+
call's message quoted the NW RFC SDK's free text —
|
|
46
|
+
`RFC call to SADT_REST_RFC_ENDPOINT failed: {"message":"partner '<host>:<port>' …"}`,
|
|
47
|
+
with the gateway's address, the time and the kernel's source module — and a
|
|
48
|
+
consumer handed that message on. It is now fixed words built from `rfc`:
|
|
49
|
+
`RFC call to SADT_REST_RFC_ENDPOINT failed: <codeString>` (one of `RFC_RCS`),
|
|
50
|
+
or `… failed: the SDK did not name the failure` when the SDK named none. The
|
|
51
|
+
`rfc` field (`key`, `group`, `code`, `codeString`) and the top-level `code`
|
|
52
|
+
are unchanged; the session-lost verdict's words were fixed already.
|
|
53
|
+
- The same for the log lines: a failed call (`RFC call failed: <codeString>`),
|
|
54
|
+
a failed close (`RFC close error: …`) and a failed reset (`RFC reset failed,
|
|
55
|
+
dropping the conversation: …`) name the return code only.
|
|
56
|
+
- `WireLogonError`'s message is fixed words — `The logon failed`, with
|
|
57
|
+
`(status <n>)` when the wire gives one — never its cause's message. Its
|
|
58
|
+
`cause` is the raw error as before, for the provider to read.
|
|
59
|
+
- The error for a missing `@mcp-abap-adt/sap-rfc-lite` no longer quotes the
|
|
60
|
+
loader's text (paths on the machine).
|
|
61
|
+
- A conversation factory that throws while building the conversation (the
|
|
62
|
+
SDK's client constructor, or a consumer's factory) was passed on as it
|
|
63
|
+
threw. It is now `The RFC conversation could not be built: <codeString>`
|
|
64
|
+
(or the fixed words), with `rfc` when the SDK named the failure; it is not a
|
|
65
|
+
logon, so no provider is asked.
|
|
66
|
+
- **An HTTP failure is no longer axios's error.** The wire handed up axios's
|
|
67
|
+
rejection as it was: its message names the host and port it could not reach
|
|
68
|
+
(`connect ECONNREFUSED <host>:<port>`), and its `config` holds the request's
|
|
69
|
+
`Authorization`, `Cookie` and CSRF headers. It is now an `Error` with SAP's
|
|
70
|
+
answer as `response` (`status`, `statusText`, `headers`, `data`, as SAP gave
|
|
71
|
+
them), `status`, axios's `code`, and the message
|
|
72
|
+
`Request failed with status code <n>`; with no answer, `code` and
|
|
73
|
+
`The request failed: <code>`. No `config`, `request`, `isAxiosError` or
|
|
74
|
+
`cause`.
|
|
75
|
+
- **`AuthRefusedError.cause` is a copy.** It kept the wire's error (or the
|
|
76
|
+
provider's throw) as it arrived — an axios error with its config, an RFC
|
|
77
|
+
SDK error with its text. It is now an `Error` named `WireFailure`, its
|
|
78
|
+
message `The failure: <facts>`, with `code` (its own, else the first down
|
|
79
|
+
its `cause` chain), `status`, `rfc` and SAP's answer as `response`. The
|
|
80
|
+
provider is still handed the wire's error as it arrived
|
|
81
|
+
(`IAuthRejection.error`) — over HTTP the client's own rejection, over RFC
|
|
82
|
+
the SDK's error: the SNC provider reads its message for GSS codes, and
|
|
83
|
+
`readRejection` its `key`.
|
|
84
|
+
- **A `WireLogonError` that leaves `connect()` or `makeAdtRequest()`** carries
|
|
85
|
+
such a copy as its `cause` (`outwardLogonError`), never the wire's raw error.
|
|
86
|
+
- **The WebSocket transport** hands its error handlers `<words>: <code>` with
|
|
87
|
+
`code`, never the socket library's or the parser's error; a factory or a
|
|
88
|
+
`send` that throws rejects the same way.
|
|
89
|
+
- A transport the consumer writes (`IAdtTransport`) hands up what it throws,
|
|
90
|
+
and a failure that is not the credential's passes through as it raised it:
|
|
91
|
+
its words are the consumer's.
|
|
92
|
+
- **Log lines** — a failed request (`Network error - cannot connect to SAP
|
|
93
|
+
system`, the request error line), the CSRF fetch before a mutation and the
|
|
94
|
+
CSRF retry, a failed establishment, a failed logoff (both lines), a cloud
|
|
95
|
+
security session that could not be opened — say the failure's facts, or
|
|
96
|
+
`no code was given`, never its message. An unparsable configuration URL is
|
|
97
|
+
not quoted.
|
|
98
|
+
|
|
10
99
|
## [24.0.0] - 2026-11-12
|
|
11
100
|
|
|
12
101
|
The shared contract moves to `@mcp-abap-adt/interfaces-adt-connection` 5.
|
|
@@ -3028,7 +3117,9 @@ const connection = createAbapConnection(config, logger);
|
|
|
3028
3117
|
- JWT token refresh now properly handles connection errors (401/403 during initial connect)
|
|
3029
3118
|
- Permission errors (403 with "ExceptionResourceNoAccess") no longer trigger JWT refresh loops
|
|
3030
3119
|
- Proper separation: base class handles HTTP/session, concrete classes handle auth-specific errors
|
|
3031
|
-
[Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/
|
|
3120
|
+
[Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v25.0.1...HEAD
|
|
3121
|
+
[25.0.1]: https://github.com/fr0ster/mcp-abap-connection/compare/v25.0.0...v25.0.1
|
|
3122
|
+
[25.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v24.0.0...v25.0.0
|
|
3032
3123
|
[24.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v23.0.0...v24.0.0
|
|
3033
3124
|
[23.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v22.0.1...v23.0.0
|
|
3034
3125
|
[22.0.1]: https://github.com/fr0ster/mcp-abap-connection/compare/v22.0.0...v22.0.1
|
package/README.md
CHANGED
|
@@ -162,6 +162,7 @@ the packages above. See [Migration to 9.0.0](./docs/MIGRATION-9.0.md).
|
|
|
162
162
|
|
|
163
163
|
- 📦 **[Installation Guide](./docs/INSTALLATION.md)** - Setup and installation instructions
|
|
164
164
|
- 📚 **[Usage Guide](./docs/USAGE.md)** - Detailed usage examples and API documentation
|
|
165
|
+
- 🚚 **[Migration to 25.0.0](./docs/MIGRATION-25.0.md)** - security: an error and a log line carry the failure's typed facts (`code`, `status`, `rfc`, SAP's answer as `response`), never a thrown value's text or a request config; the HTTP failure is not the axios error (no `config`, `request`, `isAxiosError`); `AuthRefusedError.cause` is a `WireFailure` copy
|
|
165
166
|
- 🚚 **[Migration to 24.0.0](./docs/MIGRATION-24.0.md)** - on `@mcp-abap-adt/interfaces-adt-connection` ^5.0.0: `IAbapConnection` / `AbapConnection`'s `makeAdtRequest` takes no type argument; drop it and narrow `data` from `unknown`; the connectors are unchanged
|
|
166
167
|
- 🚚 **[Migration to 23.0.0](./docs/MIGRATION-23.0.md)** - a stateless request whose answer shows the SAP session replaced keeps that answer, marked `sessionLost`, and the instance is spent; a stateful request still rejects `ADT_SESSION_REPLACED`; nothing is resent; `@mcp-abap-adt/interfaces-adt-connection` ^4.2.0
|
|
167
168
|
- 🚚 **[Migration to 22.0.0](./docs/MIGRATION-22.0.md)** - over RFC: a connection-ending RFC error on the stateful conversation is `ADT_SESSION_REPLACED` and spends the instance (no silent reconnect); a failed RFC call carries `rfc: { key, group, code, codeString }`; the `SAP-PASSPORT` header becomes the RFC call's passport; `@mcp-abap-adt/sap-rfc-lite` ^0.4.0
|
|
@@ -271,6 +272,11 @@ try {
|
|
|
271
272
|
// One instance is one SAP session: a new session is a new createConnection().
|
|
272
273
|
```
|
|
273
274
|
|
|
275
|
+
For modern HTTP connections, `createConnection` can retry a stateless ADT
|
|
276
|
+
syntax check once on a temporary session when SAP rejects the CSRF token and
|
|
277
|
+
the connection detects session replacement. The caller receives the retry
|
|
278
|
+
result or the new logon's error. See [Session Lifecycle](docs/USAGE.md#session-lifecycle).
|
|
279
|
+
|
|
274
280
|
`createConnection` returns a **new instance on every call**. Any other
|
|
275
281
|
combination of system and wire (cloud over RFC, say) is refused at
|
|
276
282
|
construction. The transport options are passed through as you give them:
|
|
@@ -569,12 +575,26 @@ reports the failure, the `Error` the caller receives carries it as
|
|
|
569
575
|
`rfc: { key, group, code, codeString }` (`IRfcErrorInfo`, typed by
|
|
570
576
|
`IAbapConnectionError` in `@mcp-abap-adt/interfaces-adt-connection`;
|
|
571
577
|
`codeString` is one of `RFC_RCS`). Read the failure from those, never from the
|
|
572
|
-
message: a call's failure says `RFC call to SADT_REST_RFC_ENDPOINT failed:
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
+
message: a call's failure says `RFC call to SADT_REST_RFC_ENDPOINT failed:
|
|
579
|
+
<codeString>` (for example `… failed: RFC_COMMUNICATION_FAILURE`) and sets no
|
|
580
|
+
top-level `code`; when the error ended the stateful conversation, the message
|
|
581
|
+
is the session-lost one and `code` is `ADT_SESSION_REPLACED` (below). `rfc` is
|
|
582
|
+
carried either way, on every conversation. A call's error the SDK did not
|
|
583
|
+
name — the closed-connection error, a passport sap-rfc-lite refuses — carries
|
|
584
|
+
no `rfc`, and its message ends `… failed: the SDK did not name the failure`.
|
|
585
|
+
(A `SAP-PASSPORT` header that is not hex is refused before any call, in its
|
|
586
|
+
own words.)
|
|
587
|
+
|
|
588
|
+
**No text of the SDK's reaches a message or a log line** (25.0.0). The NW RFC
|
|
589
|
+
SDK's own text names the partner it dialled (`host:port`), the time and the
|
|
590
|
+
kernel's source module; the connection never quotes it — not in a call's
|
|
591
|
+
failure, not in its log lines (a failed call, close or reset), not in a
|
|
592
|
+
`WireLogonError`'s message (`The logon failed`), not when the conversation
|
|
593
|
+
cannot be built (`The RFC conversation could not be built: <codeString>`), and
|
|
594
|
+
not when sap-rfc-lite cannot be loaded. What the SDK said reaches you as `rfc`.
|
|
595
|
+
The provider is handed the SDK's error as it arrived (`IAuthRejection.error`),
|
|
596
|
+
for its own reading; the `AuthRefusedError` you get carries a copy of it
|
|
597
|
+
("What a failure carries", below).
|
|
578
598
|
|
|
579
599
|
```typescript
|
|
580
600
|
import type { RfcReturnCodeName } from "@mcp-abap-adt/interfaces-adt-connection";
|
|
@@ -730,6 +750,40 @@ error. Code matching on that message must branch on `error.response.status`
|
|
|
730
750
|
instead — which it can now do, since the status is no longer thrown away.
|
|
731
751
|
See [MIGRATION-4.0.md](./docs/MIGRATION-4.0.md).
|
|
732
752
|
|
|
753
|
+
**What a failure carries** (25.0.0). An error the connection hands you says the
|
|
754
|
+
failure by its typed facts and fixed words — never a thrown value's text, and
|
|
755
|
+
never a request's config. A thrown value's text names hosts and ports (axios's
|
|
756
|
+
`connect ECONNREFUSED <host>:<port>`, the RFC SDK's partner), and axios's error
|
|
757
|
+
holds the request's config with its `Authorization`, `Cookie` and CSRF headers.
|
|
758
|
+
|
|
759
|
+
- **An HTTP failure** is an `Error` with SAP's answer as `response` — `status`,
|
|
760
|
+
`statusText`, `headers`, `data`, as SAP gave them — and `status`, axios's
|
|
761
|
+
`code`, and the message `Request failed with status code <n>`. With no
|
|
762
|
+
answer: `code` (`ECONNREFUSED`, `ECONNABORTED`, …) and
|
|
763
|
+
`The request failed: <code>` — the code its own, else the first down its
|
|
764
|
+
`cause` chain. It is not axios's error: no `config`, no `request`, no
|
|
765
|
+
`isAxiosError`, no `cause`.
|
|
766
|
+
- **`AuthRefusedError.cause`** is a copy of the wire's error (or of what the
|
|
767
|
+
provider threw): an `Error` named `WireFailure`, its message
|
|
768
|
+
`The failure: <facts>`, its facts as fields — `code` (its own, else one down
|
|
769
|
+
its `cause` chain), `status`, `rfc`, and SAP's answer as `response`. The
|
|
770
|
+
provider was handed the wire's error as it arrived — over HTTP the client's
|
|
771
|
+
own rejection, over RFC the SDK's error.
|
|
772
|
+
- **A `WireLogonError`** that leaves `connect()` carries such a copy as its
|
|
773
|
+
`cause`.
|
|
774
|
+
- **The WebSocket transport** hands its error handlers `<words>: <code>`, with
|
|
775
|
+
`code`.
|
|
776
|
+
- **Log lines** say a failure the same way: its facts, or `no code was given`.
|
|
777
|
+
|
|
778
|
+
A transport you write yourself (`IAdtTransport`) hands up what it throws: a
|
|
779
|
+
failure that is not the credential's passes through the connection as your
|
|
780
|
+
wire raised it, so its words are yours to choose.
|
|
781
|
+
|
|
782
|
+
Code that read `error.config`, `error.request`, `error.isAxiosError`, or tested
|
|
783
|
+
`axios.isAxiosError(error)` / `instanceof AxiosError` on a connection's error
|
|
784
|
+
reads `error.response`, `error.status` and `error.code` instead. See
|
|
785
|
+
[docs/MIGRATION-25.0.md](./docs/MIGRATION-25.0.md).
|
|
786
|
+
|
|
733
787
|
### When the credential is refused
|
|
734
788
|
|
|
735
789
|
Every request asks the provider first (`authorize`). A `401` that survives the
|
|
@@ -853,7 +907,9 @@ connection.setSessionType("stateless");
|
|
|
853
907
|
request rejects `ADT_SESSION_REPLACED`; a stateless one gets SAP's answer as it
|
|
854
908
|
came — a success resolves, a refusal rejects as itself — marked
|
|
855
909
|
`sessionLost: 'ADT_SESSION_REPLACED'` (since 23.0.0). Either way the instance
|
|
856
|
-
is spent
|
|
910
|
+
is spent. Create a new connection for later calls. The factory can finish a
|
|
911
|
+
[stateless syntax check](./docs/USAGE.md#syntax-check-recovery-on-http) on a
|
|
912
|
+
temporary session after an explicit CSRF refusal. See
|
|
857
913
|
[When the session is lost](./docs/USAGE.md#when-the-session-is-lost).
|
|
858
914
|
|
|
859
915
|
### Custom Logger
|
|
@@ -12,6 +12,8 @@ import { type IAdtSessionContext, type IAdtTransport } from './IAdtTransport.js'
|
|
|
12
12
|
* replaced, the session is lost, and the answer is the caller's.
|
|
13
13
|
*/
|
|
14
14
|
type SessionObservation = 'kept' | 'lost';
|
|
15
|
+
/** Whether a thrown value is a refusal this connection marked `sessionLost`. */
|
|
16
|
+
export declare function carriesSessionLost(error: unknown): boolean;
|
|
15
17
|
declare abstract class AbstractAbapConnection implements AbapConnection, ISessionLifecycleAware, ICriticalSection, IRequestProfiling {
|
|
16
18
|
private readonly config;
|
|
17
19
|
/**
|
|
@@ -256,6 +258,7 @@ declare abstract class AbstractAbapConnection implements AbapConnection, ISessio
|
|
|
256
258
|
* back a session someone had already discarded.
|
|
257
259
|
*/
|
|
258
260
|
connect(): Promise<void>;
|
|
261
|
+
private connectOnce;
|
|
259
262
|
/**
|
|
260
263
|
* Tears the session down. Never throws, and always settles.
|
|
261
264
|
*
|
|
@@ -1 +1 @@
|
|
|
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;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAEL,KAAK,aAAa,
|
|
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;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAEL,KAAK,aAAa,EAMnB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAGnB,MAAM,oBAAoB,CAAC;AA4C5B;;;;GAIG;AACH,KAAK,kBAAkB,GAAG,MAAM,GAAG,MAAM,CAAC;AAiB1C,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,K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;IACH,SAAS,CAAC,UAAU,IAAI,MAAM,GAAG,IAAI;IAIrC;;;;;;OAMG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMlD;;;;;;;;OAQG;YACW,eAAe;IAO7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,aAAa;IAgCrB;;;;;;;;OAQG;IACH,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,eAAe;CA6BxB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AbstractAbapConnection = void 0;
|
|
4
|
+
exports.carriesSessionLost = carriesSessionLost;
|
|
4
5
|
const node_crypto_1 = require("node:crypto");
|
|
5
6
|
const interfaces_adt_connection_1 = require("@mcp-abap-adt/interfaces-adt-connection");
|
|
6
7
|
const SessionLifecycle_js_1 = require("../session/SessionLifecycle.js");
|
|
7
8
|
const networkErrors_js_1 = require("../utils/networkErrors.js");
|
|
8
9
|
const authErrors_js_1 = require("./authErrors.js");
|
|
9
10
|
const csrfConfig_js_1 = require("./csrfConfig.js");
|
|
11
|
+
const failureFacts_js_1 = require("./failureFacts.js");
|
|
10
12
|
const IAdtTransport_js_1 = require("./IAdtTransport.js");
|
|
11
13
|
const statefulRequest_js_1 = require("./statefulRequest.js");
|
|
12
14
|
/**
|
|
@@ -249,7 +251,8 @@ class AbstractAbapConnection {
|
|
|
249
251
|
this.baseUrl = new URL(config.url).origin;
|
|
250
252
|
}
|
|
251
253
|
catch (error) {
|
|
252
|
-
|
|
254
|
+
// Not quoted: the URL may carry a user and a password.
|
|
255
|
+
throw new Error(`Invalid URL in configuration: it could not be parsed (${(0, failureFacts_js_1.factWords)(error)})`);
|
|
253
256
|
}
|
|
254
257
|
}
|
|
255
258
|
this.logger?.debug(`AbstractAbapConnection - Session ID: ${this.sessionId.substring(0, 8)}...`);
|
|
@@ -378,6 +381,13 @@ class AbstractAbapConnection {
|
|
|
378
381
|
if (this.spent)
|
|
379
382
|
throw spentError();
|
|
380
383
|
const baselineEpoch = this.lifecycle.teardownEpoch;
|
|
384
|
+
// A refused logon the connection did not answer with the provider's word
|
|
385
|
+
// leaves without the wire's raw error (`outwardLogonError`).
|
|
386
|
+
await this.connectOnce(baselineEpoch).catch((error) => {
|
|
387
|
+
throw (0, authErrors_js_1.outwardLogonError)(error);
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
async connectOnce(baselineEpoch) {
|
|
381
391
|
await this.lifecycle.transition('connect', async () => {
|
|
382
392
|
// Again here: a disconnect() queued ahead of this connect — called in
|
|
383
393
|
// the same turn, before it — spends the instance only when its
|
|
@@ -655,7 +665,7 @@ class AbstractAbapConnection {
|
|
|
655
665
|
closing = Promise.reject(error);
|
|
656
666
|
}
|
|
657
667
|
const answered = closing.catch((error) => {
|
|
658
|
-
this.logger?.debug(`Could not tell the server the session is finished: ${
|
|
668
|
+
this.logger?.debug(`Could not tell the server the session is finished: ${(0, failureFacts_js_1.factWords)(error)}`);
|
|
659
669
|
});
|
|
660
670
|
// A close that is over is past its write: it sent nothing, it failed to
|
|
661
671
|
// send — logged above, and reported by `answered` settling — or its wire
|
|
@@ -1198,6 +1208,9 @@ class AbstractAbapConnection {
|
|
|
1198
1208
|
try {
|
|
1199
1209
|
return await this.performRequest(options, lease);
|
|
1200
1210
|
}
|
|
1211
|
+
catch (error) {
|
|
1212
|
+
throw (0, authErrors_js_1.outwardLogonError)(error);
|
|
1213
|
+
}
|
|
1201
1214
|
finally {
|
|
1202
1215
|
lease.release();
|
|
1203
1216
|
}
|
|
@@ -1462,7 +1475,8 @@ class AbstractAbapConnection {
|
|
|
1462
1475
|
}
|
|
1463
1476
|
const errorDetails = {
|
|
1464
1477
|
type: 'REQUEST_ERROR',
|
|
1465
|
-
|
|
1478
|
+
// The failure's facts, never its text: a network error's names the host.
|
|
1479
|
+
message: `Request failed: ${(0, failureFacts_js_1.factWords)(error)}`,
|
|
1466
1480
|
url: requestUrl,
|
|
1467
1481
|
method: normalizedMethod,
|
|
1468
1482
|
status: (0, IAdtTransport_js_1.refusalOf)(error)?.status,
|
|
@@ -1542,9 +1556,7 @@ class AbstractAbapConnection {
|
|
|
1542
1556
|
if (this.outranksOriginal(retryError)) {
|
|
1543
1557
|
throw retryError;
|
|
1544
1558
|
}
|
|
1545
|
-
this.logQuietly(() => this.logger?.debug(`CSRF retry failed; rethrowing original error: ${retryError
|
|
1546
|
-
? retryError.message
|
|
1547
|
-
: String(retryError)}`));
|
|
1559
|
+
this.logQuietly(() => this.logger?.debug(`CSRF retry failed; rethrowing original error: ${(0, failureFacts_js_1.factWords)(retryError)}`));
|
|
1548
1560
|
throw error;
|
|
1549
1561
|
}
|
|
1550
1562
|
}
|
|
@@ -1700,11 +1712,17 @@ class AbstractAbapConnection {
|
|
|
1700
1712
|
* and what it may do is not something renewing it changes.
|
|
1701
1713
|
*/
|
|
1702
1714
|
credentialRejection(error) {
|
|
1715
|
+
// The provider reads the wire's error as it arrived (`asArrived`): the
|
|
1716
|
+
// HTTP client's own rejection, not the copy a consumer is handed.
|
|
1703
1717
|
if (error instanceof authErrors_js_1.WireLogonError) {
|
|
1704
|
-
return {
|
|
1718
|
+
return {
|
|
1719
|
+
at: 'logon',
|
|
1720
|
+
status: error.status,
|
|
1721
|
+
error: (0, failureFacts_js_1.asArrived)(error.cause),
|
|
1722
|
+
};
|
|
1705
1723
|
}
|
|
1706
1724
|
if ((0, IAdtTransport_js_1.refusalOf)(error)?.status === 401) {
|
|
1707
|
-
return { at: 'request', status: 401, error };
|
|
1725
|
+
return { at: 'request', status: 401, error: (0, failureFacts_js_1.asArrived)(error) };
|
|
1708
1726
|
}
|
|
1709
1727
|
return null;
|
|
1710
1728
|
}
|
|
@@ -1743,7 +1761,7 @@ class AbstractAbapConnection {
|
|
|
1743
1761
|
if (error instanceof authErrors_js_1.AuthRefusedError)
|
|
1744
1762
|
throw error;
|
|
1745
1763
|
if (!(error instanceof authErrors_js_1.WireLogonError)) {
|
|
1746
|
-
this.logger?.debug(`Could not fetch CSRF token upfront, will retry on error: ${
|
|
1764
|
+
this.logger?.debug(`Could not fetch CSRF token upfront, will retry on error: ${(0, failureFacts_js_1.factWords)(error)}`);
|
|
1747
1765
|
return;
|
|
1748
1766
|
}
|
|
1749
1767
|
const rejection = this.credentialRejection(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudHttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/CloudHttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;
|
|
1
|
+
{"version":3,"file":"CloudHttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/CloudHttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAgB9E,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,iGAAiG;IACjG,OAAO,CAAC,MAAM,CAAuB;IAEtB,IAAI,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiEhD,KAAK,CAClB,OAAO,EAAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,GACnB,OAAO,CAAC,IAAI,CAAC;IA8ChB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAenB;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;CAWjB"}
|
|
@@ -35,6 +35,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
35
35
|
exports.CloudHttpTransport = void 0;
|
|
36
36
|
const cookies_js_1 = require("../utils/cookies.js");
|
|
37
37
|
const authErrors_js_1 = require("./authErrors.js");
|
|
38
|
+
const failureFacts_js_1 = require("./failureFacts.js");
|
|
38
39
|
const HttpTransport_js_1 = require("./HttpTransport.js");
|
|
39
40
|
const SESSIONS_PATH = '/sap/bc/adt/core/http/sessions';
|
|
40
41
|
/** The versioned media types Eclipse asks this resource for, newest first. */
|
|
@@ -123,7 +124,7 @@ class CloudHttpTransport extends HttpTransport_js_1.HttpTransport {
|
|
|
123
124
|
// Not fatal here. If no session was opened, the establishment that
|
|
124
125
|
// follows says so with the whole picture; an error raised from a
|
|
125
126
|
// preflight would replace that with something less useful.
|
|
126
|
-
this.logger?.debug(`Could not open a security session: ${
|
|
127
|
+
this.logger?.debug(`Could not open a security session: ${(0, failureFacts_js_1.factWords)(error)}`);
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
async close(context, written) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/CredentialAbapConnection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,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,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAoB,KAAK,aAAa,EAAW,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"CredentialAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/CredentialAbapConnection.ts"],"names":[],"mappings":"AA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AbstractAbapConnection_js_1 = require("./AbstractAbapConnection.js");
|
|
18
18
|
const authErrors_js_1 = require("./authErrors.js");
|
|
19
|
+
const failureFacts_js_1 = require("./failureFacts.js");
|
|
19
20
|
const IAdtTransport_js_1 = require("./IAdtTransport.js");
|
|
20
21
|
const requestTarget_js_1 = require("./requestTarget.js");
|
|
21
22
|
class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapConnection {
|
|
@@ -95,7 +96,7 @@ class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapC
|
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
catch (error) {
|
|
98
|
-
this.logger?.warn(`Could not establish (${this.credential.kind}): ${
|
|
99
|
+
this.logger?.warn(`Could not establish (${this.credential.kind}): ${(0, failureFacts_js_1.factWords)(error)}`);
|
|
99
100
|
// A rejecting response can still carry the cookies that matter; the wire
|
|
100
101
|
// folds them in as it establishes, so nothing is read out of the error
|
|
101
102
|
// here beyond saying whether any arrived.
|
|
@@ -37,6 +37,12 @@ export declare class GenericWebSocketTransport implements IWebSocketTransport {
|
|
|
37
37
|
onClose(handler: (info: IWebSocketCloseInfo) => void | Promise<void>): void;
|
|
38
38
|
isConnected(): boolean;
|
|
39
39
|
private handleIncomingMessage;
|
|
40
|
+
/**
|
|
41
|
+
* What reaches an error handler: `words` and the failure's facts (`code`,
|
|
42
|
+
* its own or one down its `cause` chain; `status`, `rfc`, `response`) as
|
|
43
|
+
* fields, never what the socket library or the parser said — a connection
|
|
44
|
+
* error's text names the host, a parse error's quotes the message.
|
|
45
|
+
*/
|
|
40
46
|
private normalizeError;
|
|
41
47
|
private emitOpen;
|
|
42
48
|
private emitError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericWebSocketTransport.d.ts","sourceRoot":"","sources":["../../src/connection/GenericWebSocketTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"GenericWebSocketTransport.d.ts","sourceRoot":"","sources":["../../src/connection/GenericWebSocketTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAG1C;;GAEG;AACH,UAAU,cAAc;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACvD,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3C,OAAO,EACH,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC,GACzE,IAAI,CAAC;CACV;AAED,UAAU,iBAAiB;IACzB,MAAM,CACJ,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC7B,OAAO,CAAC,EAAE,wBAAwB,GACjC,cAAc,CAAC;CACnB;AAID,qBAAa,yBAA0B,YAAW,mBAAmB;IASvD,OAAO,CAAC,QAAQ,CAAC,OAAO;IARpC,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,eAAe,CAAgD;IACvE,OAAO,CAAC,YAAY,CAAyC;IAC7D,OAAO,CAAC,aAAa,CAAqD;IAC1E,OAAO,CAAC,aAAa,CAEd;gBAEsB,OAAO,EAAE,iBAAiB;IAEjD,OAAO,CACX,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,IAAI,CAAC;IAgEV,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBzD,IAAI,CAAC,CAAC,GAAG,OAAO,EACpB,OAAO,EAAE,yBAAyB,CAAC,CAAC,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC;IAYhB,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,IAAI;IAIlE,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAIjD,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAI9D,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAI3E,WAAW,IAAI,OAAO;YAIR,qBAAqB;IAoBnC;;;;;OAKG;IACH,OAAO,CAAC,cAAc;YAOR,QAAQ;YAMR,SAAS;YAMT,SAAS;CAKxB;AAED,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GenericWebSocketTransport = void 0;
|
|
4
|
+
const failureFacts_js_1 = require("./failureFacts.js");
|
|
4
5
|
const WS_OPEN = 1;
|
|
5
6
|
class GenericWebSocketTransport {
|
|
6
7
|
factory;
|
|
@@ -18,7 +19,13 @@ class GenericWebSocketTransport {
|
|
|
18
19
|
}
|
|
19
20
|
// The caller's deadline, or none: no default of this package's own.
|
|
20
21
|
const connectTimeoutMs = options?.connectTimeoutMs;
|
|
21
|
-
|
|
22
|
+
let socket;
|
|
23
|
+
try {
|
|
24
|
+
socket = this.factory.create(url, options?.protocols, options);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw this.normalizeError(error, 'WebSocket could not be created');
|
|
28
|
+
}
|
|
22
29
|
this.socket = socket;
|
|
23
30
|
await new Promise((resolve, reject) => {
|
|
24
31
|
const timeoutId = connectTimeoutMs === undefined
|
|
@@ -77,7 +84,12 @@ class GenericWebSocketTransport {
|
|
|
77
84
|
if (!this.socket || this.socket.readyState !== WS_OPEN) {
|
|
78
85
|
throw new Error('WebSocket is not connected');
|
|
79
86
|
}
|
|
80
|
-
|
|
87
|
+
try {
|
|
88
|
+
this.socket.send(JSON.stringify(message));
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
throw this.normalizeError(error, 'WebSocket send failed');
|
|
92
|
+
}
|
|
81
93
|
}
|
|
82
94
|
onMessage(handler) {
|
|
83
95
|
this.messageHandlers.push(handler);
|
|
@@ -110,14 +122,14 @@ class GenericWebSocketTransport {
|
|
|
110
122
|
await this.emitError(this.normalizeError(error, 'Failed to process WS message'));
|
|
111
123
|
}
|
|
112
124
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return new Error(
|
|
125
|
+
/**
|
|
126
|
+
* What reaches an error handler: `words` and the failure's facts (`code`,
|
|
127
|
+
* its own or one down its `cause` chain; `status`, `rfc`, `response`) as
|
|
128
|
+
* fields, never what the socket library or the parser said — a connection
|
|
129
|
+
* error's text names the host, a parse error's quotes the message.
|
|
130
|
+
*/
|
|
131
|
+
normalizeError(error, words) {
|
|
132
|
+
return Object.assign(new Error(`${words}: ${(0, failureFacts_js_1.factWords)(error)}`), (0, failureFacts_js_1.factsOf)(error));
|
|
121
133
|
}
|
|
122
134
|
async emitOpen() {
|
|
123
135
|
for (const handler of this.openHandlers) {
|
|
@@ -358,10 +358,10 @@ export declare class HttpTransport implements IAdtTransport {
|
|
|
358
358
|
/** Called once the logoff's bytes are on the socket; see `close()`. */
|
|
359
359
|
written?: () => void): Promise<void>;
|
|
360
360
|
/**
|
|
361
|
-
* Throws for a status the request does not admit —
|
|
362
|
-
*
|
|
363
|
-
* `
|
|
364
|
-
*
|
|
361
|
+
* Throws for a status the request does not admit — axios rejects, and the
|
|
362
|
+
* wire hands up `httpFailure`'s copy: SAP's answer as `response` and
|
|
363
|
+
* `status`, the code, fixed words — never axios's error, which holds the
|
|
364
|
+
* request's config.
|
|
365
365
|
*/
|
|
366
366
|
send(request: IAdtTransportRequest): Promise<IAdtTransportResponse>;
|
|
367
367
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/HttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,IAAI,SAAS,EAGlB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAA2B,MAAM,YAAY,CAAC;AAG/E,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAc,EACZ,KAAK,aAAa,EAGnB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"HttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/HttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAo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AQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,EAC/D,OAAO,CAAC,EAAE,MAAM,IAAI,GACnB,OAAO,CAAC,IAAI,CAAC;IAShB;;;;;;;;;;;;;;OAcG;cACa,UAAU,CACxB,OAAO,EAAE,kBAAkB,EAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjC;IACD,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,IAAI,GACnB,OAAO,CAAC,IAAI,CAAC;IAyChB;;;;;OAKG;IACG,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAKzE;;;;;;OAMG;IACH,OAAO,CAAC,GAAG;IAmBX;;;;;;;;;;;;;;OAcG;cACa,YAAY,CAC1B,OAAO,EAAE,oBAAoB;IAC7B,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,IAAI,GACnB,OAAO,CAAC,qBAAqB,CAAC;IAIjC;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,GAC9C,aAAa;IAOhB,0DAA0D;IAC1D,OAAO,CAAC,YAAY;IAOpB;;;;;;;;;;;;;;;;;;OAkBG;YACW,UAAU;YA+BV,QAAQ;CAwEvB"}
|
|
@@ -34,6 +34,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
34
34
|
const cookies_js_1 = require("../utils/cookies.js");
|
|
35
35
|
const authErrors_js_1 = require("./authErrors.js");
|
|
36
36
|
const csrfConfig_js_1 = require("./csrfConfig.js");
|
|
37
|
+
const failureFacts_js_1 = require("./failureFacts.js");
|
|
37
38
|
const IAdtTransport_js_1 = require("./IAdtTransport.js");
|
|
38
39
|
const statefulRequest_js_1 = require("./statefulRequest.js");
|
|
39
40
|
/**
|
|
@@ -725,7 +726,9 @@ class HttpTransport {
|
|
|
725
726
|
// folds anything of it in or reads it as an absent endpoint.
|
|
726
727
|
if (error instanceof authErrors_js_1.AuthRefusedError)
|
|
727
728
|
throw error;
|
|
728
|
-
|
|
729
|
+
// The wire's own failure (`httpFailure`) or the connection's verdict
|
|
730
|
+
// as it is; anything else said by its facts, never its text.
|
|
731
|
+
last = error instanceof Error ? error : (0, failureFacts_js_1.failureCopy)(error);
|
|
729
732
|
const headers = refusalHeaders(error);
|
|
730
733
|
if (headers !== undefined) {
|
|
731
734
|
// A refusal can still carry the cookies that matter — handed up
|
|
@@ -1061,14 +1064,14 @@ class HttpTransport {
|
|
|
1061
1064
|
this.logger?.debug('Told the server the session is finished');
|
|
1062
1065
|
}
|
|
1063
1066
|
catch (error) {
|
|
1064
|
-
this.logger?.debug(`Could not tell the server the session is finished: ${
|
|
1067
|
+
this.logger?.debug(`Could not tell the server the session is finished: ${(0, failureFacts_js_1.factWords)(error)}`);
|
|
1065
1068
|
}
|
|
1066
1069
|
}
|
|
1067
1070
|
/**
|
|
1068
|
-
* Throws for a status the request does not admit —
|
|
1069
|
-
*
|
|
1070
|
-
* `
|
|
1071
|
-
*
|
|
1071
|
+
* Throws for a status the request does not admit — axios rejects, and the
|
|
1072
|
+
* wire hands up `httpFailure`'s copy: SAP's answer as `response` and
|
|
1073
|
+
* `status`, the code, fixed words — never axios's error, which holds the
|
|
1074
|
+
* request's config.
|
|
1072
1075
|
*/
|
|
1073
1076
|
async send(request) {
|
|
1074
1077
|
const fixed = this.fix(request);
|
|
@@ -1223,9 +1226,19 @@ class HttpTransport {
|
|
|
1223
1226
|
};
|
|
1224
1227
|
// A logoff opens a socket of its own and is never resent: its answer is
|
|
1225
1228
|
// not read, and its write is what `disconnect()` resolves at.
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
+
let response;
|
|
1230
|
+
try {
|
|
1231
|
+
response =
|
|
1232
|
+
written !== undefined
|
|
1233
|
+
? await this.client()(config)
|
|
1234
|
+
: await this.sendPooled(config);
|
|
1235
|
+
}
|
|
1236
|
+
catch (error) {
|
|
1237
|
+
// Never as the client threw it: axios's error holds this request's
|
|
1238
|
+
// config — its credential headers among it — and words naming the host.
|
|
1239
|
+
// SAP's answer and the code go up; nothing else of it does.
|
|
1240
|
+
throw (0, failureFacts_js_1.httpFailure)(error);
|
|
1241
|
+
}
|
|
1229
1242
|
return {
|
|
1230
1243
|
status: response.status,
|
|
1231
1244
|
statusText: response.statusText,
|
|
@@ -269,9 +269,10 @@ export interface IAdtTransport {
|
|
|
269
269
|
* The response a refusal carries, whichever client threw it.
|
|
270
270
|
*
|
|
271
271
|
* `IAdtTransport` promises exactly this about a failure and nothing more: the
|
|
272
|
-
* error has a `response`. `HttpTransport` throws
|
|
273
|
-
*
|
|
274
|
-
*
|
|
272
|
+
* error has a `response`. `HttpTransport` throws a plain `Error` with SAP's
|
|
273
|
+
* answer as the field (`httpFailure`: never axios's error, which holds the
|
|
274
|
+
* request's config); `RfcTransport` throws a plain `Error` with the field too,
|
|
275
|
+
* which is what the contract asks for.
|
|
275
276
|
*
|
|
276
277
|
* Read structurally, because `instanceof AxiosError` is a question about which
|
|
277
278
|
* HTTP client is installed — an answer no other wire can give, and the reason
|