@mcp-abap-adt/connection 23.0.0 → 25.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 +100 -1
- package/README.md +59 -10
- package/dist/connection/AbstractAbapConnection.d.ts +1 -0
- package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
- package/dist/connection/AbstractAbapConnection.js +29 -12
- 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/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/docs/INDEX.md +4 -0
- package/docs/MIGRATION-10.0.md +11 -1
- package/docs/MIGRATION-12.0.md +8 -0
- package/docs/MIGRATION-24.0.md +42 -0
- package/docs/MIGRATION-25.0.md +88 -0
- package/docs/MIGRATION-4.0.md +4 -0
- package/docs/USAGE.md +29 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,103 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [25.0.0] - 2026-11-13
|
|
11
|
+
|
|
12
|
+
No error the connection hands out, and no line it logs, carries a thrown
|
|
13
|
+
value's text or a request's config: on every wire a failure is said by its
|
|
14
|
+
typed facts (`code`, `status`, `rfc`, SAP's answer as `response`) and fixed
|
|
15
|
+
words. A security fix, and breaking for code that read axios's own fields off
|
|
16
|
+
a connection's error or compared `AuthRefusedError.cause` with the original.
|
|
17
|
+
See [docs/MIGRATION-25.0.md](docs/MIGRATION-25.0.md).
|
|
18
|
+
|
|
19
|
+
### Changed — breaking
|
|
20
|
+
|
|
21
|
+
- **An HTTP failure is no longer the axios error.** It is an `Error` carrying
|
|
22
|
+
SAP's answer as `response` (`status`, `statusText`, `headers`, `data`, as
|
|
23
|
+
SAP gave them), `status` and `code`. It has no `config`, no `request`, no
|
|
24
|
+
`isAxiosError` and no `cause`: `axios.isAxiosError(error)` and
|
|
25
|
+
`instanceof AxiosError` are `false`.
|
|
26
|
+
- **`AuthRefusedError.cause` is a `WireFailure` copy**, typed
|
|
27
|
+
`FailureCopy | undefined` (was `unknown`): `code`, `status`, `rfc`,
|
|
28
|
+
`response` and the message `The failure: <facts>`. `cause === original` no
|
|
29
|
+
longer holds; the provider still receives the original as
|
|
30
|
+
`IAuthRejection.error`.
|
|
31
|
+
|
|
32
|
+
### Fixed — security
|
|
33
|
+
|
|
34
|
+
- **An RFC failure carries the SDK's typed fields, never its text.** A failed
|
|
35
|
+
call's message quoted the NW RFC SDK's free text —
|
|
36
|
+
`RFC call to SADT_REST_RFC_ENDPOINT failed: {"message":"partner '<host>:<port>' …"}`,
|
|
37
|
+
with the gateway's address, the time and the kernel's source module — and a
|
|
38
|
+
consumer handed that message on. It is now fixed words built from `rfc`:
|
|
39
|
+
`RFC call to SADT_REST_RFC_ENDPOINT failed: <codeString>` (one of `RFC_RCS`),
|
|
40
|
+
or `… failed: the SDK did not name the failure` when the SDK named none. The
|
|
41
|
+
`rfc` field (`key`, `group`, `code`, `codeString`) and the top-level `code`
|
|
42
|
+
are unchanged; the session-lost verdict's words were fixed already.
|
|
43
|
+
- The same for the log lines: a failed call (`RFC call failed: <codeString>`),
|
|
44
|
+
a failed close (`RFC close error: …`) and a failed reset (`RFC reset failed,
|
|
45
|
+
dropping the conversation: …`) name the return code only.
|
|
46
|
+
- `WireLogonError`'s message is fixed words — `The logon failed`, with
|
|
47
|
+
`(status <n>)` when the wire gives one — never its cause's message. Its
|
|
48
|
+
`cause` is the raw error as before, for the provider to read.
|
|
49
|
+
- The error for a missing `@mcp-abap-adt/sap-rfc-lite` no longer quotes the
|
|
50
|
+
loader's text (paths on the machine).
|
|
51
|
+
- A conversation factory that throws while building the conversation (the
|
|
52
|
+
SDK's client constructor, or a consumer's factory) was passed on as it
|
|
53
|
+
threw. It is now `The RFC conversation could not be built: <codeString>`
|
|
54
|
+
(or the fixed words), with `rfc` when the SDK named the failure; it is not a
|
|
55
|
+
logon, so no provider is asked.
|
|
56
|
+
- **An HTTP failure is no longer axios's error.** The wire handed up axios's
|
|
57
|
+
rejection as it was: its message names the host and port it could not reach
|
|
58
|
+
(`connect ECONNREFUSED <host>:<port>`), and its `config` holds the request's
|
|
59
|
+
`Authorization`, `Cookie` and CSRF headers. It is now an `Error` with SAP's
|
|
60
|
+
answer as `response` (`status`, `statusText`, `headers`, `data`, as SAP gave
|
|
61
|
+
them), `status`, axios's `code`, and the message
|
|
62
|
+
`Request failed with status code <n>`; with no answer, `code` and
|
|
63
|
+
`The request failed: <code>`. No `config`, `request`, `isAxiosError` or
|
|
64
|
+
`cause`.
|
|
65
|
+
- **`AuthRefusedError.cause` is a copy.** It kept the wire's error (or the
|
|
66
|
+
provider's throw) as it arrived — an axios error with its config, an RFC
|
|
67
|
+
SDK error with its text. It is now an `Error` named `WireFailure`, its
|
|
68
|
+
message `The failure: <facts>`, with `code` (its own, else the first down
|
|
69
|
+
its `cause` chain), `status`, `rfc` and SAP's answer as `response`. The
|
|
70
|
+
provider is still handed the wire's error as it arrived
|
|
71
|
+
(`IAuthRejection.error`) — over HTTP the client's own rejection, over RFC
|
|
72
|
+
the SDK's error: the SNC provider reads its message for GSS codes, and
|
|
73
|
+
`readRejection` its `key`.
|
|
74
|
+
- **A `WireLogonError` that leaves `connect()` or `makeAdtRequest()`** carries
|
|
75
|
+
such a copy as its `cause` (`outwardLogonError`), never the wire's raw error.
|
|
76
|
+
- **The WebSocket transport** hands its error handlers `<words>: <code>` with
|
|
77
|
+
`code`, never the socket library's or the parser's error; a factory or a
|
|
78
|
+
`send` that throws rejects the same way.
|
|
79
|
+
- A transport the consumer writes (`IAdtTransport`) hands up what it throws,
|
|
80
|
+
and a failure that is not the credential's passes through as it raised it:
|
|
81
|
+
its words are the consumer's.
|
|
82
|
+
- **Log lines** — a failed request (`Network error - cannot connect to SAP
|
|
83
|
+
system`, the request error line), the CSRF fetch before a mutation and the
|
|
84
|
+
CSRF retry, a failed establishment, a failed logoff (both lines), a cloud
|
|
85
|
+
security session that could not be opened — say the failure's facts, or
|
|
86
|
+
`no code was given`, never its message. An unparsable configuration URL is
|
|
87
|
+
not quoted.
|
|
88
|
+
|
|
89
|
+
## [24.0.0] - 2026-11-12
|
|
90
|
+
|
|
91
|
+
The shared contract moves to `@mcp-abap-adt/interfaces-adt-connection` 5.
|
|
92
|
+
Breaking for code typed against `IAbapConnection` or `AbapConnection` that
|
|
93
|
+
names a type argument on `makeAdtRequest`. Nothing changes at run time. See
|
|
94
|
+
[docs/MIGRATION-24.0.md](docs/MIGRATION-24.0.md).
|
|
95
|
+
|
|
96
|
+
### Changed — breaking
|
|
97
|
+
|
|
98
|
+
- **The shared contract is `@mcp-abap-adt/interfaces-adt-connection` `^5.0.0`.**
|
|
99
|
+
Its `IAbapConnection.makeAdtRequest(options)` takes no type parameter and
|
|
100
|
+
answers `Promise<IAdtWireResponse>`, the answer's `data` `unknown`. The
|
|
101
|
+
connectors' own `makeAdtRequest` keeps its generic signature, and a
|
|
102
|
+
connector is assignable to version 5's `IAbapConnection`. Code holding a
|
|
103
|
+
value typed `IAbapConnection` (or the `AbapConnection` alias) that names a
|
|
104
|
+
type argument — `makeAdtRequest<string>(…)` — no longer compiles: drop the
|
|
105
|
+
type argument and narrow `data` from `unknown`. README and docs/USAGE.md describe the version 5 contract.
|
|
106
|
+
|
|
10
107
|
## [23.0.0] - 2026-11-12
|
|
11
108
|
|
|
12
109
|
A stateless request keeps its answer when the SAP session was replaced
|
|
@@ -3010,7 +3107,9 @@ const connection = createAbapConnection(config, logger);
|
|
|
3010
3107
|
- JWT token refresh now properly handles connection errors (401/403 during initial connect)
|
|
3011
3108
|
- Permission errors (403 with "ExceptionResourceNoAccess") no longer trigger JWT refresh loops
|
|
3012
3109
|
- Proper separation: base class handles HTTP/session, concrete classes handle auth-specific errors
|
|
3013
|
-
[Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/
|
|
3110
|
+
[Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v25.0.0...HEAD
|
|
3111
|
+
[25.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v24.0.0...v25.0.0
|
|
3112
|
+
[24.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v23.0.0...v24.0.0
|
|
3014
3113
|
[23.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v22.0.1...v23.0.0
|
|
3015
3114
|
[22.0.1]: https://github.com/fr0ster/mcp-abap-connection/compare/v22.0.0...v22.0.1
|
|
3016
3115
|
[22.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v21.0.0...v22.0.0
|
package/README.md
CHANGED
|
@@ -162,6 +162,8 @@ 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
|
|
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
|
|
165
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
|
|
166
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
|
|
167
169
|
- 🚚 **[Migration to 21.0.0](./docs/MIGRATION-21.0.md)** - the CSRF token fetch asks once: no retry, no delay; `CSRF_CONFIG.RETRY_COUNT` / `RETRY_DELAY`, the establish context's `retries` / `retryDelayMs` / `isFatal`, `fetchCsrfToken`'s retry parameters and `endsTheExchange` are removed
|
|
@@ -568,12 +570,26 @@ reports the failure, the `Error` the caller receives carries it as
|
|
|
568
570
|
`rfc: { key, group, code, codeString }` (`IRfcErrorInfo`, typed by
|
|
569
571
|
`IAbapConnectionError` in `@mcp-abap-adt/interfaces-adt-connection`;
|
|
570
572
|
`codeString` is one of `RFC_RCS`). Read the failure from those, never from the
|
|
571
|
-
message: a call's failure says `RFC call to SADT_REST_RFC_ENDPOINT failed:
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
573
|
+
message: a call's failure says `RFC call to SADT_REST_RFC_ENDPOINT failed:
|
|
574
|
+
<codeString>` (for example `… failed: RFC_COMMUNICATION_FAILURE`) and sets no
|
|
575
|
+
top-level `code`; when the error ended the stateful conversation, the message
|
|
576
|
+
is the session-lost one and `code` is `ADT_SESSION_REPLACED` (below). `rfc` is
|
|
577
|
+
carried either way, on every conversation. A call's error the SDK did not
|
|
578
|
+
name — the closed-connection error, a passport sap-rfc-lite refuses — carries
|
|
579
|
+
no `rfc`, and its message ends `… failed: the SDK did not name the failure`.
|
|
580
|
+
(A `SAP-PASSPORT` header that is not hex is refused before any call, in its
|
|
581
|
+
own words.)
|
|
582
|
+
|
|
583
|
+
**No text of the SDK's reaches a message or a log line** (25.0.0). The NW RFC
|
|
584
|
+
SDK's own text names the partner it dialled (`host:port`), the time and the
|
|
585
|
+
kernel's source module; the connection never quotes it — not in a call's
|
|
586
|
+
failure, not in its log lines (a failed call, close or reset), not in a
|
|
587
|
+
`WireLogonError`'s message (`The logon failed`), not when the conversation
|
|
588
|
+
cannot be built (`The RFC conversation could not be built: <codeString>`), and
|
|
589
|
+
not when sap-rfc-lite cannot be loaded. What the SDK said reaches you as `rfc`.
|
|
590
|
+
The provider is handed the SDK's error as it arrived (`IAuthRejection.error`),
|
|
591
|
+
for its own reading; the `AuthRefusedError` you get carries a copy of it
|
|
592
|
+
("What a failure carries", below).
|
|
577
593
|
|
|
578
594
|
```typescript
|
|
579
595
|
import type { RfcReturnCodeName } from "@mcp-abap-adt/interfaces-adt-connection";
|
|
@@ -729,6 +745,40 @@ error. Code matching on that message must branch on `error.response.status`
|
|
|
729
745
|
instead — which it can now do, since the status is no longer thrown away.
|
|
730
746
|
See [MIGRATION-4.0.md](./docs/MIGRATION-4.0.md).
|
|
731
747
|
|
|
748
|
+
**What a failure carries** (25.0.0). An error the connection hands you says the
|
|
749
|
+
failure by its typed facts and fixed words — never a thrown value's text, and
|
|
750
|
+
never a request's config. A thrown value's text names hosts and ports (axios's
|
|
751
|
+
`connect ECONNREFUSED <host>:<port>`, the RFC SDK's partner), and axios's error
|
|
752
|
+
holds the request's config with its `Authorization`, `Cookie` and CSRF headers.
|
|
753
|
+
|
|
754
|
+
- **An HTTP failure** is an `Error` with SAP's answer as `response` — `status`,
|
|
755
|
+
`statusText`, `headers`, `data`, as SAP gave them — and `status`, axios's
|
|
756
|
+
`code`, and the message `Request failed with status code <n>`. With no
|
|
757
|
+
answer: `code` (`ECONNREFUSED`, `ECONNABORTED`, …) and
|
|
758
|
+
`The request failed: <code>` — the code its own, else the first down its
|
|
759
|
+
`cause` chain. It is not axios's error: no `config`, no `request`, no
|
|
760
|
+
`isAxiosError`, no `cause`.
|
|
761
|
+
- **`AuthRefusedError.cause`** is a copy of the wire's error (or of what the
|
|
762
|
+
provider threw): an `Error` named `WireFailure`, its message
|
|
763
|
+
`The failure: <facts>`, its facts as fields — `code` (its own, else one down
|
|
764
|
+
its `cause` chain), `status`, `rfc`, and SAP's answer as `response`. The
|
|
765
|
+
provider was handed the wire's error as it arrived — over HTTP the client's
|
|
766
|
+
own rejection, over RFC the SDK's error.
|
|
767
|
+
- **A `WireLogonError`** that leaves `connect()` carries such a copy as its
|
|
768
|
+
`cause`.
|
|
769
|
+
- **The WebSocket transport** hands its error handlers `<words>: <code>`, with
|
|
770
|
+
`code`.
|
|
771
|
+
- **Log lines** say a failure the same way: its facts, or `no code was given`.
|
|
772
|
+
|
|
773
|
+
A transport you write yourself (`IAdtTransport`) hands up what it throws: a
|
|
774
|
+
failure that is not the credential's passes through the connection as your
|
|
775
|
+
wire raised it, so its words are yours to choose.
|
|
776
|
+
|
|
777
|
+
Code that read `error.config`, `error.request`, `error.isAxiosError`, or tested
|
|
778
|
+
`axios.isAxiosError(error)` / `instanceof AxiosError` on a connection's error
|
|
779
|
+
reads `error.response`, `error.status` and `error.code` instead. See
|
|
780
|
+
[docs/MIGRATION-25.0.md](./docs/MIGRATION-25.0.md).
|
|
781
|
+
|
|
732
782
|
### When the credential is refused
|
|
733
783
|
|
|
734
784
|
Every request asks the provider first (`authorize`). A `401` that survives the
|
|
@@ -924,10 +974,9 @@ import type { IAdtWireResponse } from '@mcp-abap-adt/interfaces-adt-connection';
|
|
|
924
974
|
// The shared contract (IAbapConnection), what every connection provides:
|
|
925
975
|
interface AbapConnection {
|
|
926
976
|
connect(): Promise<void>; // REQUIRED before any request; rejects on failure
|
|
927
|
-
//
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
): Promise<IAdtWireResponse<T, D>>;
|
|
977
|
+
// The answer's `data` is `unknown`; the caller names no type for it
|
|
978
|
+
// (interfaces-adt-connection 5).
|
|
979
|
+
makeAdtRequest(options: AbapRequestOptions): Promise<IAdtWireResponse>;
|
|
931
980
|
getBaseUrl(): Promise<string | undefined>; // undefined over RFC: no HTTP origin
|
|
932
981
|
setSessionType(type: "stateless" | "stateful"): void; // Switch session type
|
|
933
982
|
getSessionId(): string | null; // Client-side conversation id
|
|
@@ -256,6 +256,7 @@ declare abstract class AbstractAbapConnection implements AbapConnection, ISessio
|
|
|
256
256
|
* back a session someone had already discarded.
|
|
257
257
|
*/
|
|
258
258
|
connect(): Promise<void>;
|
|
259
|
+
private connectOnce;
|
|
259
260
|
/**
|
|
260
261
|
* Tears the session down. Never throws, and always settles.
|
|
261
262
|
*
|
|
@@ -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;AA8C1C,uBAAe,sBACb,YACE,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB;IAwIjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,EAAE,aAAa;IACjC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,IA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BzB,OAAO,CAAC,eAAe;CA6BxB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -7,6 +7,7 @@ const SessionLifecycle_js_1 = require("../session/SessionLifecycle.js");
|
|
|
7
7
|
const networkErrors_js_1 = require("../utils/networkErrors.js");
|
|
8
8
|
const authErrors_js_1 = require("./authErrors.js");
|
|
9
9
|
const csrfConfig_js_1 = require("./csrfConfig.js");
|
|
10
|
+
const failureFacts_js_1 = require("./failureFacts.js");
|
|
10
11
|
const IAdtTransport_js_1 = require("./IAdtTransport.js");
|
|
11
12
|
const statefulRequest_js_1 = require("./statefulRequest.js");
|
|
12
13
|
/**
|
|
@@ -249,7 +250,8 @@ class AbstractAbapConnection {
|
|
|
249
250
|
this.baseUrl = new URL(config.url).origin;
|
|
250
251
|
}
|
|
251
252
|
catch (error) {
|
|
252
|
-
|
|
253
|
+
// Not quoted: the URL may carry a user and a password.
|
|
254
|
+
throw new Error(`Invalid URL in configuration: it could not be parsed (${(0, failureFacts_js_1.factWords)(error)})`);
|
|
253
255
|
}
|
|
254
256
|
}
|
|
255
257
|
this.logger?.debug(`AbstractAbapConnection - Session ID: ${this.sessionId.substring(0, 8)}...`);
|
|
@@ -378,6 +380,13 @@ class AbstractAbapConnection {
|
|
|
378
380
|
if (this.spent)
|
|
379
381
|
throw spentError();
|
|
380
382
|
const baselineEpoch = this.lifecycle.teardownEpoch;
|
|
383
|
+
// A refused logon the connection did not answer with the provider's word
|
|
384
|
+
// leaves without the wire's raw error (`outwardLogonError`).
|
|
385
|
+
await this.connectOnce(baselineEpoch).catch((error) => {
|
|
386
|
+
throw (0, authErrors_js_1.outwardLogonError)(error);
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
async connectOnce(baselineEpoch) {
|
|
381
390
|
await this.lifecycle.transition('connect', async () => {
|
|
382
391
|
// Again here: a disconnect() queued ahead of this connect — called in
|
|
383
392
|
// the same turn, before it — spends the instance only when its
|
|
@@ -655,7 +664,7 @@ class AbstractAbapConnection {
|
|
|
655
664
|
closing = Promise.reject(error);
|
|
656
665
|
}
|
|
657
666
|
const answered = closing.catch((error) => {
|
|
658
|
-
this.logger?.debug(`Could not tell the server the session is finished: ${
|
|
667
|
+
this.logger?.debug(`Could not tell the server the session is finished: ${(0, failureFacts_js_1.factWords)(error)}`);
|
|
659
668
|
});
|
|
660
669
|
// A close that is over is past its write: it sent nothing, it failed to
|
|
661
670
|
// send — logged above, and reported by `answered` settling — or its wire
|
|
@@ -1185,9 +1194,9 @@ class AbstractAbapConnection {
|
|
|
1185
1194
|
async credentialRejected(_rejection) {
|
|
1186
1195
|
return { outcome: { ok: false, refusal: authErrors_js_1.NO_CREDENTIAL_TO_RENEW } };
|
|
1187
1196
|
}
|
|
1188
|
-
// The defaults are
|
|
1189
|
-
//
|
|
1190
|
-
//
|
|
1197
|
+
// The defaults are IAdtWireResponse's (`unknown`). IAbapConnection
|
|
1198
|
+
// (interfaces-adt-connection 5) takes no type parameter; this generic
|
|
1199
|
+
// implementation is assignable to it, and its callers keep their signature.
|
|
1191
1200
|
async makeAdtRequest(options) {
|
|
1192
1201
|
// Admission first, synchronously, before any await: the check and the
|
|
1193
1202
|
// count must happen in one step, or a request could be admitted and still
|
|
@@ -1198,6 +1207,9 @@ class AbstractAbapConnection {
|
|
|
1198
1207
|
try {
|
|
1199
1208
|
return await this.performRequest(options, lease);
|
|
1200
1209
|
}
|
|
1210
|
+
catch (error) {
|
|
1211
|
+
throw (0, authErrors_js_1.outwardLogonError)(error);
|
|
1212
|
+
}
|
|
1201
1213
|
finally {
|
|
1202
1214
|
lease.release();
|
|
1203
1215
|
}
|
|
@@ -1462,7 +1474,8 @@ class AbstractAbapConnection {
|
|
|
1462
1474
|
}
|
|
1463
1475
|
const errorDetails = {
|
|
1464
1476
|
type: 'REQUEST_ERROR',
|
|
1465
|
-
|
|
1477
|
+
// The failure's facts, never its text: a network error's names the host.
|
|
1478
|
+
message: `Request failed: ${(0, failureFacts_js_1.factWords)(error)}`,
|
|
1466
1479
|
url: requestUrl,
|
|
1467
1480
|
method: normalizedMethod,
|
|
1468
1481
|
status: (0, IAdtTransport_js_1.refusalOf)(error)?.status,
|
|
@@ -1542,9 +1555,7 @@ class AbstractAbapConnection {
|
|
|
1542
1555
|
if (this.outranksOriginal(retryError)) {
|
|
1543
1556
|
throw retryError;
|
|
1544
1557
|
}
|
|
1545
|
-
this.logQuietly(() => this.logger?.debug(`CSRF retry failed; rethrowing original error: ${retryError
|
|
1546
|
-
? retryError.message
|
|
1547
|
-
: String(retryError)}`));
|
|
1558
|
+
this.logQuietly(() => this.logger?.debug(`CSRF retry failed; rethrowing original error: ${(0, failureFacts_js_1.factWords)(retryError)}`));
|
|
1548
1559
|
throw error;
|
|
1549
1560
|
}
|
|
1550
1561
|
}
|
|
@@ -1700,11 +1711,17 @@ class AbstractAbapConnection {
|
|
|
1700
1711
|
* and what it may do is not something renewing it changes.
|
|
1701
1712
|
*/
|
|
1702
1713
|
credentialRejection(error) {
|
|
1714
|
+
// The provider reads the wire's error as it arrived (`asArrived`): the
|
|
1715
|
+
// HTTP client's own rejection, not the copy a consumer is handed.
|
|
1703
1716
|
if (error instanceof authErrors_js_1.WireLogonError) {
|
|
1704
|
-
return {
|
|
1717
|
+
return {
|
|
1718
|
+
at: 'logon',
|
|
1719
|
+
status: error.status,
|
|
1720
|
+
error: (0, failureFacts_js_1.asArrived)(error.cause),
|
|
1721
|
+
};
|
|
1705
1722
|
}
|
|
1706
1723
|
if ((0, IAdtTransport_js_1.refusalOf)(error)?.status === 401) {
|
|
1707
|
-
return { at: 'request', status: 401, error };
|
|
1724
|
+
return { at: 'request', status: 401, error: (0, failureFacts_js_1.asArrived)(error) };
|
|
1708
1725
|
}
|
|
1709
1726
|
return null;
|
|
1710
1727
|
}
|
|
@@ -1743,7 +1760,7 @@ class AbstractAbapConnection {
|
|
|
1743
1760
|
if (error instanceof authErrors_js_1.AuthRefusedError)
|
|
1744
1761
|
throw error;
|
|
1745
1762
|
if (!(error instanceof authErrors_js_1.WireLogonError)) {
|
|
1746
|
-
this.logger?.debug(`Could not fetch CSRF token upfront, will retry on error: ${
|
|
1763
|
+
this.logger?.debug(`Could not fetch CSRF token upfront, will retry on error: ${(0, failureFacts_js_1.factWords)(error)}`);
|
|
1747
1764
|
return;
|
|
1748
1765
|
}
|
|
1749
1766
|
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":"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;AAEhF,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,oBAAoB,CAAC;AAGnE,8BAAsB,wBAAwB,CAC5C,WAAW,SAAS,aAAa,GAAG,aAAa,CACjD,SAAQ,sBAAsB;IAG5B,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,WAAW;gBAFhC,MAAM,EAAE,SAAS;IACjB,6EAA6E;IACpE,UAAU,EAAE,WAAW,EAChC,SAAS,EAAE,aAAa,EACxB,MAAM,GAAE,OAAO,GAAG,IAAW,EAC7B,SAAS,CAAC,EAAE,MAAM;IAClB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM;IAKlB;;;;;;;;;;OAUG;cACsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAU3D;;;;;;;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;CA2ClD"}
|
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.CredentialAbapConnection = void 0;
|
|
17
17
|
const 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;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,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C,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
|