@mcp-abap-adt/connection 20.0.0 → 21.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 +73 -1
- package/README.md +84 -35
- package/dist/connection/AbstractAbapConnection.d.ts +2 -8
- package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
- package/dist/connection/AbstractAbapConnection.js +4 -18
- package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
- package/dist/connection/CredentialAbapConnection.js +1 -4
- package/dist/connection/HttpTransport.d.ts.map +1 -1
- package/dist/connection/HttpTransport.js +97 -72
- package/dist/connection/IAdtTransport.d.ts +5 -14
- package/dist/connection/IAdtTransport.d.ts.map +1 -1
- package/dist/connection/RfcTransport.d.ts +64 -9
- package/dist/connection/RfcTransport.d.ts.map +1 -1
- package/dist/connection/RfcTransport.js +174 -31
- package/dist/connection/csrfConfig.d.ts +4 -10
- package/dist/connection/csrfConfig.d.ts.map +1 -1
- package/dist/connection/csrfConfig.js +4 -10
- package/dist/connection/rfcConversation.d.ts +7 -2
- package/dist/connection/rfcConversation.d.ts.map +1 -1
- package/dist/connection/rfcConversation.js +8 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/docs/INDEX.md +2 -0
- package/docs/MIGRATION-21.0.md +87 -0
- package/docs/USAGE.md +55 -41
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,76 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [21.0.0] - 2026-11-11
|
|
11
|
+
|
|
12
|
+
The CSRF token fetch asks once. Breaking for code that reads `CSRF_CONFIG.RETRY_COUNT` /
|
|
13
|
+
`RETRY_DELAY`, for a wire of its own that reads the establish context's `retries`,
|
|
14
|
+
`retryDelayMs` or `isFatal`, and for a subclass that calls `fetchCsrfToken` with retry numbers or
|
|
15
|
+
overrides `endsTheExchange`; a caller of `createConnection`, the connectors and `makeAdtRequest`
|
|
16
|
+
changes nothing. See [docs/MIGRATION-21.0.md](docs/MIGRATION-21.0.md).
|
|
17
|
+
|
|
18
|
+
### Changed — breaking
|
|
19
|
+
|
|
20
|
+
- **The CSRF token fetch is one request per endpoint, with no retry and no delay.** A logon
|
|
21
|
+
against a closed port made four requests about a second apart and reported its failure some
|
|
22
|
+
three seconds later; the recovery after a `403` "CSRF token validation failed" asked up to six
|
|
23
|
+
times, two seconds apart. A failed request is its own error now: `connect()` rejects with it at
|
|
24
|
+
once. The fallback endpoint `/sap/bc/adt/discovery` is still asked, once, only after
|
|
25
|
+
`/sap/bc/adt/core/discovery` answered `404` or `501` (BASIS < 7.52) — it is not a retry. The
|
|
26
|
+
named resend on a pooled socket that ended before any answer byte (#314) is unchanged.
|
|
27
|
+
- **Removed:** `CSRF_CONFIG.RETRY_COUNT`, `CSRF_CONFIG.RETRY_DELAY`;
|
|
28
|
+
`IAdtEstablishContext.retries`, `.retryDelayMs` and `.isFatal` (with nothing retried it decides
|
|
29
|
+
nothing: a session verdict carries no response, so the wire neither folds it in nor reads it as
|
|
30
|
+
an absent endpoint); the `retryCount` / `retryDelay` parameters of the protected
|
|
31
|
+
`fetchCsrfToken`, now `fetchCsrfToken(url, fence?)`; the protected `endsTheExchange`.
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- **A CSRF token is read as one non-empty string.** Response headers come from outside the type
|
|
36
|
+
system: an `x-csrf-token` that arrived as an array (the header twice), a number or an empty
|
|
37
|
+
value was stored as the token; it is now no token — on a success the fetch fails
|
|
38
|
+
`NOT_IN_HEADERS`, on a refusal nothing is kept.
|
|
39
|
+
|
|
40
|
+
### Documentation
|
|
41
|
+
|
|
42
|
+
- **The two other resends are named beside the #314 one**, in the README and USAGE ("Two more
|
|
43
|
+
named resends"): the CSRF recovery (a token fetched in the same session and one resend after a
|
|
44
|
+
refusal over the token) and the credential's renewal (one more attempt after `rejected()`
|
|
45
|
+
answers Ok). Both are unchanged; each happens at most once for a request.
|
|
46
|
+
|
|
47
|
+
## [20.1.0] - 2026-11-09
|
|
48
|
+
|
|
49
|
+
A request runs in its `sap-language` over RFC as it does over HTTP.
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- **`RfcTransport` honours a request's `sap-language`.** `SADT_REST_RFC_ENDPOINT` has no ICF
|
|
54
|
+
logon: it ran every request in the conversation's logon language and ignored `sap-language`
|
|
55
|
+
as a header, a query parameter or a body attribute — a class created with `sap-language: RU`
|
|
56
|
+
on an EN logon got master language EN, where over HTTP it gets RU (measured on S/4HANA 2025).
|
|
57
|
+
Now a non-stateful request whose `sap-language` (a header, or the query parameter in `params`
|
|
58
|
+
or in the URL) names another language than the logon language of the conversation that would
|
|
59
|
+
carry it — the `lang` its logon carries: the provider's where it writes one, else the
|
|
60
|
+
factory's — goes on a conversation logged on in that language (its `lang` over any the
|
|
61
|
+
provider writes), opened for that call and closed after it, whatever the answer — a logger
|
|
62
|
+
that throws included; nothing is kept. A stateful request naming another language than the
|
|
63
|
+
stateful conversation's is refused before anything is sent, in words naming both languages: a session cannot change its language. A request naming two different
|
|
64
|
+
languages is refused the same way. Language keys are compared without case; the same
|
|
65
|
+
language, or none, goes as before. `HttpTransport` is unchanged. Measured on E19 (2026-11-09):
|
|
66
|
+
a class created over RFC with `sap-language: RU` on an EN logon reads back
|
|
67
|
+
`adtcore:masterLanguage="RU"`.
|
|
68
|
+
- **`RfcTransport.close()` closes every conversation whatever a close or the logger does.** A
|
|
69
|
+
stateless conversation whose close rejected, under a logger whose `debug` threw, stopped
|
|
70
|
+
`close()` before the stateful conversation was closed. Every close-path log line is now
|
|
71
|
+
written so that it cannot throw.
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
|
|
75
|
+
- **`RfcConversationFactory`**: what `RfcTransport` takes — the factory function, and its logon
|
|
76
|
+
`language` where stated. `rfcConversationFrom(config)` states the config's `language`. A plain
|
|
77
|
+
factory function still compiles; one that states no `language`, under a provider that writes no
|
|
78
|
+
`lang`, has every request naming a `sap-language` treated as naming another one.
|
|
79
|
+
|
|
10
80
|
## [20.0.0] - 2026-11-08
|
|
11
81
|
|
|
12
82
|
An RFC destination states its own address. Breaking for an RFC config and for code that reads
|
|
@@ -2837,7 +2907,9 @@ const connection = createAbapConnection(config, logger);
|
|
|
2837
2907
|
- JWT token refresh now properly handles connection errors (401/403 during initial connect)
|
|
2838
2908
|
- Permission errors (403 with "ExceptionResourceNoAccess") no longer trigger JWT refresh loops
|
|
2839
2909
|
- Proper separation: base class handles HTTP/session, concrete classes handle auth-specific errors
|
|
2840
|
-
[Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/
|
|
2910
|
+
[Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v21.0.0...HEAD
|
|
2911
|
+
[21.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v20.1.0...v21.0.0
|
|
2912
|
+
[20.1.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v20.0.0...v20.1.0
|
|
2841
2913
|
[20.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v19.1.0...v20.0.0
|
|
2842
2914
|
[19.1.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v19.0.0...v19.1.0
|
|
2843
2915
|
[19.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v18.0.1...v19.0.0
|
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 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
|
|
165
166
|
- 🚚 **[Migration to 20.0.0](./docs/MIGRATION-20.0.md)** - an RFC config is an `ISapRfcConfig` that states its address (`ashost` + `sysnr`, or `mshost` + `msserv` / `sysid` + `group`), `client` and `language`: no URL, no defaults, no `SAP_SYSNR`; `getBaseUrl()` may answer `undefined`; hand-built HTTP transports take `baseUrl`; `IAdtSessionContext` has no `baseUrl`
|
|
166
167
|
- 🚚 **[Migration to 19.0.0](./docs/MIGRATION-19.0.md)** - `@mcp-abap-adt/sap-rfc-lite` ^0.3.2: no compile on install; prebuilt RFC bindings for linux-x64, win32-x64, darwin-arm64; elsewhere build sap-rfc-lite's binding from its repository; the API is unchanged
|
|
167
168
|
- 🚚 **[Migration to 18.0.0](./docs/MIGRATION-18.0.md)** - `rfcParamsFrom` returns `RfcAddress` (application server or message server): narrow before reading `.ashost` / `.sysnr`; RFC through a message server and a logon group (`mshost`, `msserv` | `sysid`, `group`, `saprouter`)
|
|
@@ -301,6 +302,31 @@ answer would run it twice; for a socket the server closed while it was idle,
|
|
|
301
302
|
that does not happen. Without the resend, a cleanup `UNLOCK` died so and the
|
|
302
303
|
enqueue lock stayed until SM12 (mcp-abap-adt#314).
|
|
303
304
|
|
|
305
|
+
**Two more named resends** (named in 21.0.0; the behaviour is older). Beside
|
|
306
|
+
the one above, a request is sent once more in exactly two cases — each at most
|
|
307
|
+
once for a request, never a second time:
|
|
308
|
+
|
|
309
|
+
- **The CSRF recovery.** SAP refused the request over its CSRF token — a `403`
|
|
310
|
+
"CSRF token validation failed", or an answer whose body names the CSRF token
|
|
311
|
+
— or answered `401` to a `POST`, `PUT` or `DELETE` sent while the wire held
|
|
312
|
+
no token. The wire fetches a token in the same session (its cookies kept; one
|
|
313
|
+
fetch, no retry) and sends the request once more, authorized anew. Not a plain
|
|
314
|
+
retry: the request was refused for what it carried — a stale or missing token
|
|
315
|
+
— and goes again carrying something different, the fresh token; sent as it
|
|
316
|
+
was, it would only be refused again. A resend that fails ends the request: a
|
|
317
|
+
session verdict or the credential's refusal is thrown, anything else rethrows
|
|
318
|
+
the error the recovery started from.
|
|
319
|
+
- **The credential's renewal.** A `401`, or a logon the system refused, goes to
|
|
320
|
+
the provider (`rejected()`); when it answers Ok, the request — or the logon —
|
|
321
|
+
is authorized again and sent once more, in the same session. Not a plain retry
|
|
322
|
+
either: the provider renewed what the attempt carries, and the attempt carries
|
|
323
|
+
the new credential. One per request: a second refusal is `AuthRefusedError`
|
|
324
|
+
(refused again), and the provider is not asked twice. A `403` never goes to
|
|
325
|
+
the provider.
|
|
326
|
+
|
|
327
|
+
Nothing else is sent again: a failed request — the CSRF token fetch included
|
|
328
|
+
(21.0.0) — is its own error.
|
|
329
|
+
|
|
304
330
|
### An instance on an existing session
|
|
305
331
|
|
|
306
332
|
An instance may be built on a session that already exists, instead of logging
|
|
@@ -908,7 +934,9 @@ install rather than at construction.
|
|
|
908
934
|
```text
|
|
909
935
|
function rfcConversationFrom(
|
|
910
936
|
config: SapRfcConfig,
|
|
911
|
-
):
|
|
937
|
+
): RfcConversationFactory & { readonly language: string };
|
|
938
|
+
// RfcConversationFactory = ((logon: Readonly<Record<string, string>>) => IRfcConversation)
|
|
939
|
+
// & { readonly language?: string } // the logon language
|
|
912
940
|
function rfcParamsFrom(config: SapRfcConfig): RfcAddress; // the address only
|
|
913
941
|
// RfcAddress = RfcConnectionParams (ashost, sysnr) | RfcMessageServerParams (mshost, msserv and/or sysid, group)
|
|
914
942
|
```
|
|
@@ -943,6 +971,41 @@ themselves are not redacted, so read a captured log before pasting it into an
|
|
|
943
971
|
issue. `HttpTransport` never logs bodies, so this is the one wire whose debug
|
|
944
972
|
channel can be asked for the payload.
|
|
945
973
|
|
|
974
|
+
#### A request's language over RFC
|
|
975
|
+
|
|
976
|
+
A request runs in the language its `sap-language` names — a header, or the
|
|
977
|
+
`sap-language` query parameter in `params` or in the URL — on both wires. Over
|
|
978
|
+
HTTP the ICF layer reads it. `SADT_REST_RFC_ENDPOINT` runs a request in its
|
|
979
|
+
conversation's logon language and ignores `sap-language`, so `RfcTransport`
|
|
980
|
+
compares the two (SAP language keys, without case) — the request's language
|
|
981
|
+
with the logon language of the conversation that would carry it. A
|
|
982
|
+
conversation's logon language is the `lang` its logon carries: the provider's,
|
|
983
|
+
where it writes one among its logon parameters at that logon, else the one the
|
|
984
|
+
factory states (`rfcConversationFrom` states the config's `language`):
|
|
985
|
+
|
|
986
|
+
- **None named:** the request goes as any other.
|
|
987
|
+
- **A stateful request** is compared with the stateful conversation's logon
|
|
988
|
+
language.
|
|
989
|
+
- **A non-stateful request** is compared with the kept stateless
|
|
990
|
+
conversation's logon language — once it is open, the language it logged on
|
|
991
|
+
in; before, the language the provider's logon parameters for it name. The
|
|
992
|
+
same language: it goes on the kept conversation, as any other. Another: it
|
|
993
|
+
goes on a conversation logged on in the request's language (`lang` as the
|
|
994
|
+
request names it, over any `lang` the provider writes), opened for that one
|
|
995
|
+
call and closed when it answers, whatever the answer. Nothing is kept: the
|
|
996
|
+
next such call logs on again.
|
|
997
|
+
- **A stateful request in another language** (a `LOCK`, an `UNLOCK`, anything
|
|
998
|
+
in the lock's session): refused before anything is sent, with an error naming
|
|
999
|
+
both languages — a session cannot change its language. Connect with the
|
|
1000
|
+
language the locked work needs.
|
|
1001
|
+
- **Two different languages named on one request:** refused before anything is
|
|
1002
|
+
sent.
|
|
1003
|
+
|
|
1004
|
+
A factory of your own that does not state `language`, with a provider that
|
|
1005
|
+
writes no `lang`, leaves the wire without a logon language to compare: every
|
|
1006
|
+
non-stateful request naming a `sap-language` then takes a conversation of its
|
|
1007
|
+
own in that language, and every stateful one naming it is refused.
|
|
1008
|
+
|
|
946
1009
|
#### `CSRF_CONFIG` and `CSRF_ERROR_MESSAGES`
|
|
947
1010
|
|
|
948
1011
|
**New in 0.1.13+:** Exported constants for consistent CSRF token handling across different connection implementations.
|
|
@@ -951,9 +1014,8 @@ channel can be asked for the payload.
|
|
|
951
1014
|
import { CSRF_CONFIG, CSRF_ERROR_MESSAGES } from '@mcp-abap-adt/connection';
|
|
952
1015
|
|
|
953
1016
|
// CSRF_CONFIG contains:
|
|
954
|
-
// - RETRY_COUNT: number (default: 3)
|
|
955
|
-
// - RETRY_DELAY: number (default: 1000ms)
|
|
956
1017
|
// - ENDPOINT: string (default: '/sap/bc/adt/core/discovery')
|
|
1018
|
+
// - FALLBACK_ENDPOINT: string (default: '/sap/bc/adt/discovery', BASIS < 7.52)
|
|
957
1019
|
// - REQUIRED_HEADERS: { 'x-csrf-token': 'fetch', 'Accept': 'application/atomsvc+xml' }
|
|
958
1020
|
|
|
959
1021
|
// CSRF_ERROR_MESSAGES contains:
|
|
@@ -973,41 +1035,28 @@ const yourHttpClient = {
|
|
|
973
1035
|
({ headers: {} as Record<string, string> }),
|
|
974
1036
|
};
|
|
975
1037
|
|
|
1038
|
+
// One request, and the fallback endpoint only when the first answers 404 or 501 —
|
|
1039
|
+
// the way this package fetches its own: no retry, no delay. A failed request
|
|
1040
|
+
// is its own error, and the caller decides what to do about it.
|
|
976
1041
|
async function fetchCsrfToken(baseUrl: string): Promise<string> {
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
}
|
|
991
|
-
throw new Error(CSRF_ERROR_MESSAGES.NOT_IN_HEADERS);
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
return token;
|
|
995
|
-
} catch (error) {
|
|
996
|
-
if (attempt >= CSRF_CONFIG.RETRY_COUNT) {
|
|
997
|
-
throw new Error(
|
|
998
|
-
CSRF_ERROR_MESSAGES.FETCH_FAILED(
|
|
999
|
-
CSRF_CONFIG.RETRY_COUNT + 1,
|
|
1000
|
-
error instanceof Error ? error.message : String(error)
|
|
1001
|
-
)
|
|
1002
|
-
);
|
|
1003
|
-
}
|
|
1004
|
-
await new Promise(resolve => setTimeout(resolve, CSRF_CONFIG.RETRY_DELAY));
|
|
1005
|
-
}
|
|
1042
|
+
let response: { headers: Record<string, string> };
|
|
1043
|
+
try {
|
|
1044
|
+
response = await yourHttpClient.get(`${baseUrl}${CSRF_CONFIG.ENDPOINT}`, {
|
|
1045
|
+
headers: CSRF_CONFIG.REQUIRED_HEADERS,
|
|
1046
|
+
});
|
|
1047
|
+
} catch (error) {
|
|
1048
|
+
const status = (error as { response?: { status?: number } }).response
|
|
1049
|
+
?.status;
|
|
1050
|
+
if (status !== 404 && status !== 501) throw error;
|
|
1051
|
+
response = await yourHttpClient.get(
|
|
1052
|
+
`${baseUrl}${CSRF_CONFIG.FALLBACK_ENDPOINT}`,
|
|
1053
|
+
{ headers: CSRF_CONFIG.REQUIRED_HEADERS },
|
|
1054
|
+
);
|
|
1006
1055
|
}
|
|
1007
1056
|
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1057
|
+
const token = response.headers['x-csrf-token'];
|
|
1058
|
+
if (!token) throw new Error(CSRF_ERROR_MESSAGES.NOT_IN_HEADERS);
|
|
1059
|
+
return token;
|
|
1011
1060
|
}
|
|
1012
1061
|
```
|
|
1013
1062
|
|
|
@@ -681,7 +681,7 @@ declare abstract class AbstractAbapConnection implements AbapConnection, ISessio
|
|
|
681
681
|
* the wire: fencing the answer by generation, and letting the identity policy
|
|
682
682
|
* read what it means.
|
|
683
683
|
*/
|
|
684
|
-
protected fetchCsrfToken(_url: string,
|
|
684
|
+
protected fetchCsrfToken(_url: string,
|
|
685
685
|
/**
|
|
686
686
|
* The request's lease: fences what is sent and the response effects.
|
|
687
687
|
* A plain session generation — what this parameter took before 10.0.1,
|
|
@@ -727,7 +727,7 @@ declare abstract class AbstractAbapConnection implements AbapConnection, ISessio
|
|
|
727
727
|
* written: that is the last await before the wire sends, and a provider may
|
|
728
728
|
* take long enough for the caller to disconnect and connect again — sent
|
|
729
729
|
* then, the request would carry the new session's cookies. The throw is a
|
|
730
|
-
* session verdict, so the exchange stops at once
|
|
730
|
+
* session verdict, so the exchange stops at once.
|
|
731
731
|
*
|
|
732
732
|
* Without one — connect()'s own establishment, which is making the session
|
|
733
733
|
* rather than working in it — nothing is fenced. `generation` alone fences
|
|
@@ -735,12 +735,6 @@ declare abstract class AbstractAbapConnection implements AbapConnection, ISessio
|
|
|
735
735
|
* sent, and the wire still folds the answer into its jar.
|
|
736
736
|
*/
|
|
737
737
|
private leasedContext;
|
|
738
|
-
/**
|
|
739
|
-
* What stops a token exchange at once, past its retries: a session verdict,
|
|
740
|
-
* or the provider's refusal to authorize it — asking again would only ask
|
|
741
|
-
* the provider again.
|
|
742
|
-
*/
|
|
743
|
-
protected endsTheExchange(error: unknown): boolean;
|
|
744
738
|
/**
|
|
745
739
|
* Clear SAP-side session state when SAP rejects the cached CSRF token + session
|
|
746
740
|
* cookies (HTTP 401 on a mutation while a cached token exists). This forces the
|
|
@@ -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,EAInB,MAAM,iBAAiB,CAAC;AAEzB,OA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cACa,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3D;;;;;OAKG;cACa,kBAAkB,CAChC,UAAU,EAAE,cAAc,GACzB,OAAO,CAAC,aAAa,CAAC;IAOnB,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAC3C,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAcpB,cAAc;IA2L5B;;;;;;;;OAQG;YACW,YAAY;IAkB1B;;;;;;;;;;;;;;;OAeG;YACW,cAAc;IAgB5B;;;;;;;;;;;;;;;OAeG;YACW,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,EAInB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAGnB,MAAM,oBAAoB,CAAC;AAwD5B,uBAAe,sBACb,YACE,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB;IAwIjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB;;;;;;;;;;OAUG;IACH,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 class AbstractAbapConnection {
|
|
|
1412
1412
|
method: normalizedMethod,
|
|
1413
1413
|
});
|
|
1414
1414
|
try {
|
|
1415
|
-
this.setCsrfToken(await this.fetchCsrfToken(requestUrl,
|
|
1415
|
+
this.setCsrfToken(await this.fetchCsrfToken(requestUrl, lease));
|
|
1416
1416
|
const refreshedToken = this.getCsrfToken();
|
|
1417
1417
|
if (refreshedToken) {
|
|
1418
1418
|
requestHeaders['x-csrf-token'] = refreshedToken;
|
|
@@ -1636,7 +1636,7 @@ class AbstractAbapConnection {
|
|
|
1636
1636
|
* the wire: fencing the answer by generation, and letting the identity policy
|
|
1637
1637
|
* read what it means.
|
|
1638
1638
|
*/
|
|
1639
|
-
async fetchCsrfToken(_url,
|
|
1639
|
+
async fetchCsrfToken(_url,
|
|
1640
1640
|
/**
|
|
1641
1641
|
* The request's lease: fences what is sent and the response effects.
|
|
1642
1642
|
* A plain session generation — what this parameter took before 10.0.1,
|
|
@@ -1654,9 +1654,6 @@ class AbstractAbapConnection {
|
|
|
1654
1654
|
...(typeof fence === 'number'
|
|
1655
1655
|
? this.leasedContext(undefined, fence)
|
|
1656
1656
|
: this.leasedContext(fence)),
|
|
1657
|
-
retries: retryCount,
|
|
1658
|
-
retryDelayMs: retryDelay,
|
|
1659
|
-
isFatal: (error) => this.endsTheExchange(error),
|
|
1660
1657
|
});
|
|
1661
1658
|
const token = this.transport.csrfToken();
|
|
1662
1659
|
if (!token)
|
|
@@ -1704,10 +1701,7 @@ class AbstractAbapConnection {
|
|
|
1704
1701
|
async ensureWireReady(
|
|
1705
1702
|
/** The request's lease: fences what is sent and the response effects. */
|
|
1706
1703
|
lease) {
|
|
1707
|
-
await this.transport.establish(
|
|
1708
|
-
...this.leasedContext(lease),
|
|
1709
|
-
isFatal: (error) => this.endsTheExchange(error),
|
|
1710
|
-
});
|
|
1704
|
+
await this.transport.establish(this.leasedContext(lease));
|
|
1711
1705
|
}
|
|
1712
1706
|
/**
|
|
1713
1707
|
* The context for a token exchange a request makes on its own behalf — its
|
|
@@ -1718,7 +1712,7 @@ class AbstractAbapConnection {
|
|
|
1718
1712
|
* written: that is the last await before the wire sends, and a provider may
|
|
1719
1713
|
* take long enough for the caller to disconnect and connect again — sent
|
|
1720
1714
|
* then, the request would carry the new session's cookies. The throw is a
|
|
1721
|
-
* session verdict, so the exchange stops at once
|
|
1715
|
+
* session verdict, so the exchange stops at once.
|
|
1722
1716
|
*
|
|
1723
1717
|
* Without one — connect()'s own establishment, which is making the session
|
|
1724
1718
|
* rather than working in it — nothing is fenced. `generation` alone fences
|
|
@@ -1747,14 +1741,6 @@ class AbstractAbapConnection {
|
|
|
1747
1741
|
},
|
|
1748
1742
|
};
|
|
1749
1743
|
}
|
|
1750
|
-
/**
|
|
1751
|
-
* What stops a token exchange at once, past its retries: a session verdict,
|
|
1752
|
-
* or the provider's refusal to authorize it — asking again would only ask
|
|
1753
|
-
* the provider again.
|
|
1754
|
-
*/
|
|
1755
|
-
endsTheExchange(error) {
|
|
1756
|
-
return this.isSessionVerdict(error) || error instanceof authErrors_js_1.AuthRefusedError;
|
|
1757
|
-
}
|
|
1758
1744
|
/**
|
|
1759
1745
|
* Clear SAP-side session state when SAP rejects the cached CSRF token + session
|
|
1760
1746
|
* cookies (HTTP 401 on a mutation while a cached token exists). This forces the
|
|
@@ -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,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;AAChF,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"}
|
|
@@ -87,10 +87,7 @@ class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapC
|
|
|
87
87
|
// does not need one: the wire authorizes PER ATTEMPT, so a one-shot token
|
|
88
88
|
// is offered on the establishing call and withheld afterwards by the
|
|
89
89
|
// credential itself, with nobody deciding anything.
|
|
90
|
-
await this.transport.establish(
|
|
91
|
-
...this.sessionContext(),
|
|
92
|
-
isFatal: (error) => this.endsTheExchange(error),
|
|
93
|
-
});
|
|
90
|
+
await this.transport.establish(this.sessionContext());
|
|
94
91
|
this.logger?.debug('Connected', {
|
|
95
92
|
credential: this.credential.kind,
|
|
96
93
|
hasCsrfToken: !!this.getCsrfToken(),
|
|
@@ -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;AAI5C,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAE3B,MAAM,oBAAoB,CAAC;AAiM5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,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,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;AAI5C,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EA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AAE,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;CAgEvB"}
|
|
@@ -202,6 +202,40 @@ function withoutContextCookie(cookie) {
|
|
|
202
202
|
var statefulRequest_js_2 = require("./statefulRequest.js");
|
|
203
203
|
Object.defineProperty(exports, "isStatefulRequest", { enumerable: true, get: function () { return statefulRequest_js_2.isStatefulRequest; } });
|
|
204
204
|
/** A 404 there means the system has no such endpoint, not that it is unwell. */
|
|
205
|
+
/**
|
|
206
|
+
* A response's headers as fields, or none. They come from outside the type
|
|
207
|
+
* system: whatever is not a plain object of fields is no headers at all.
|
|
208
|
+
*/
|
|
209
|
+
function headerFields(headers) {
|
|
210
|
+
return isFields(headers) ? headers : undefined;
|
|
211
|
+
}
|
|
212
|
+
function isFields(value) {
|
|
213
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
214
|
+
}
|
|
215
|
+
/** The headers of the response a failed request carries, or none. */
|
|
216
|
+
function refusalHeaders(error) {
|
|
217
|
+
if (typeof error !== 'object' || error === null || !('response' in error)) {
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
const response = error.response;
|
|
221
|
+
if (typeof response !== 'object' ||
|
|
222
|
+
response === null ||
|
|
223
|
+
!('headers' in response)) {
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
return headerFields(response.headers);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The CSRF token a response's headers carry: a non-empty string, else none —
|
|
230
|
+
* an array, a number or an empty value is no token.
|
|
231
|
+
*/
|
|
232
|
+
function csrfTokenIn(headers) {
|
|
233
|
+
const fields = headerFields(headers);
|
|
234
|
+
if (fields === undefined)
|
|
235
|
+
return undefined;
|
|
236
|
+
const token = fields['x-csrf-token'];
|
|
237
|
+
return typeof token === 'string' && token !== '' ? token : undefined;
|
|
238
|
+
}
|
|
205
239
|
function absentEndpoint(error) {
|
|
206
240
|
const status = error
|
|
207
241
|
?.response?.status;
|
|
@@ -643,84 +677,75 @@ class HttpTransport {
|
|
|
643
677
|
// BASIS < 7.52 has no /sap/bc/adt/core/discovery.
|
|
644
678
|
`${base}${csrfConfig_js_1.CSRF_CONFIG.FALLBACK_ENDPOINT}`,
|
|
645
679
|
];
|
|
646
|
-
const retries = context.retries ?? csrfConfig_js_1.CSRF_CONFIG.RETRY_COUNT;
|
|
647
|
-
const delay = context.retryDelayMs ?? csrfConfig_js_1.CSRF_CONFIG.RETRY_DELAY;
|
|
648
680
|
let last;
|
|
649
681
|
for (const [index, url] of endpoints.entries()) {
|
|
650
|
-
//
|
|
651
|
-
//
|
|
652
|
-
//
|
|
653
|
-
//
|
|
654
|
-
//
|
|
682
|
+
// One request per endpoint, and no delay: a failed request is its own
|
|
683
|
+
// error, and asked again a host that refused the connection or answered
|
|
684
|
+
// 500 says nothing new. The second endpoint is not a retry — it exists
|
|
685
|
+
// for a system that HAS no `/sap/bc/adt/core/discovery` (BASIS < 7.52),
|
|
686
|
+
// which the server says by answering 404 there. Asked after a refused
|
|
687
|
+
// connection or a network error, it would ask a host that is not
|
|
688
|
+
// answering to answer a different path.
|
|
655
689
|
if (index > 0 && !absentEndpoint(last))
|
|
656
690
|
break;
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
691
|
+
try {
|
|
692
|
+
// Authorized per request: a provider may renew behind the call.
|
|
693
|
+
const auth = {};
|
|
694
|
+
await context.authorize(auth);
|
|
695
|
+
const response = await this.send({
|
|
696
|
+
method: 'GET',
|
|
697
|
+
url,
|
|
698
|
+
headers: {
|
|
699
|
+
...auth,
|
|
700
|
+
...context.extraHeaders,
|
|
701
|
+
...csrfConfig_js_1.CSRF_CONFIG.REQUIRED_HEADERS,
|
|
702
|
+
},
|
|
703
|
+
});
|
|
704
|
+
// Handed up BEFORE the token is read: the cookies are the session,
|
|
705
|
+
// and a fold that only happened on success would lose the session a
|
|
706
|
+
// tokenless answer still opened. And before the fold: an answer the
|
|
707
|
+
// connection refuses as a gone session's throws here, and nothing
|
|
708
|
+
// of it reaches the jar.
|
|
709
|
+
context.observe(response.headers);
|
|
710
|
+
this.ingest(headerFields(response.headers));
|
|
711
|
+
const token = csrfTokenIn(response.headers);
|
|
712
|
+
if (token !== undefined) {
|
|
713
|
+
this.token = token;
|
|
714
|
+
this.logger?.debug('CSRF token obtained');
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
// A 200 without a token is not an absent endpoint: the fallback is
|
|
718
|
+
// not asked, and this is the error.
|
|
719
|
+
last = new Error(csrfConfig_js_1.CSRF_ERROR_MESSAGES.NOT_IN_HEADERS);
|
|
720
|
+
}
|
|
721
|
+
catch (error) {
|
|
722
|
+
// The provider's refusal to authorize leaves as it is: it is its
|
|
723
|
+
// word. So does a session verdict — the connection's own, thrown by
|
|
724
|
+
// `authorize` or `observe`: it carries no response, so nothing below
|
|
725
|
+
// folds anything of it in or reads it as an absent endpoint.
|
|
726
|
+
if (error instanceof authErrors_js_1.AuthRefusedError)
|
|
727
|
+
throw error;
|
|
728
|
+
last = error instanceof Error ? error : new Error(String(error));
|
|
729
|
+
const headers = refusalHeaders(error);
|
|
730
|
+
if (headers !== undefined) {
|
|
731
|
+
// A refusal can still carry the cookies that matter — handed up
|
|
732
|
+
// first, so one the connection refuses is not folded in.
|
|
733
|
+
context.observe(headers);
|
|
734
|
+
this.ingest(headers);
|
|
685
735
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
// it again.
|
|
691
|
-
if (error instanceof authErrors_js_1.AuthRefusedError || context.isFatal?.(error)) {
|
|
692
|
-
throw error;
|
|
693
|
-
}
|
|
694
|
-
last = error instanceof Error ? error : new Error(String(error));
|
|
695
|
-
const response = error.response;
|
|
696
|
-
if (response?.headers) {
|
|
697
|
-
// A refusal can still carry the cookies that matter — handed up
|
|
698
|
-
// first, so one the connection refuses is not folded in.
|
|
699
|
-
context.observe(response.headers);
|
|
700
|
-
this.ingest(response.headers);
|
|
701
|
-
}
|
|
702
|
-
// A refused logon, named as one — after its cookies are in, and
|
|
703
|
-
// without a retry: asking again with the credential just refused
|
|
704
|
-
// tells the system nothing new. What to do about it is not the
|
|
705
|
-
// wire's to decide.
|
|
706
|
-
if ((0, IAdtTransport_js_1.refusalOf)(error)?.status === 401) {
|
|
707
|
-
throw new authErrors_js_1.WireLogonError(error, 401);
|
|
708
|
-
}
|
|
709
|
-
if (response?.headers) {
|
|
710
|
-
// …and the token itself. SAP answers 405 to a GET on some
|
|
711
|
-
// endpoints and puts the token in the header anyway, and other
|
|
712
|
-
// refusals carry one too. A retry would throw away a token the
|
|
713
|
-
// server already handed over.
|
|
714
|
-
const onError = response.headers['x-csrf-token'];
|
|
715
|
-
if (onError) {
|
|
716
|
-
this.token = onError;
|
|
717
|
-
this.logger?.debug('CSRF token arrived on a refusal, and is kept');
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
}
|
|
736
|
+
// A refused logon, named as one — after its cookies are in. What to
|
|
737
|
+
// do about it is not the wire's to decide.
|
|
738
|
+
if ((0, IAdtTransport_js_1.refusalOf)(error)?.status === 401) {
|
|
739
|
+
throw new authErrors_js_1.WireLogonError(error, 401);
|
|
721
740
|
}
|
|
722
|
-
|
|
723
|
-
|
|
741
|
+
// …and the token itself. SAP answers 405 to a GET on some endpoints
|
|
742
|
+
// and puts the token in the header anyway, and other refusals carry
|
|
743
|
+
// one too.
|
|
744
|
+
const onError = csrfTokenIn(headers);
|
|
745
|
+
if (onError !== undefined) {
|
|
746
|
+
this.token = onError;
|
|
747
|
+
this.logger?.debug('CSRF token arrived on a refusal, and is kept');
|
|
748
|
+
return;
|
|
724
749
|
}
|
|
725
750
|
}
|
|
726
751
|
}
|