@mcp-abap-adt/connection 19.0.0 → 20.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 +138 -1
- package/README.md +91 -25
- package/dist/config/sapConfig.d.ts +6 -1
- package/dist/config/sapConfig.d.ts.map +1 -1
- package/dist/config/sapConfig.js +11 -0
- package/dist/connection/AbstractAbapConnection.d.ts +8 -2
- package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
- package/dist/connection/AbstractAbapConnection.js +17 -8
- package/dist/connection/CloudHttpTransport.js +2 -2
- package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
- package/dist/connection/CredentialAbapConnection.js +0 -1
- package/dist/connection/HttpTransport.d.ts +91 -20
- package/dist/connection/HttpTransport.d.ts.map +1 -1
- package/dist/connection/HttpTransport.js +235 -46
- package/dist/connection/IAdtTransport.d.ts +3 -2
- package/dist/connection/IAdtTransport.d.ts.map +1 -1
- package/dist/connection/createConnection.d.ts +20 -4
- package/dist/connection/createConnection.d.ts.map +1 -1
- package/dist/connection/createConnection.js +45 -28
- package/dist/connection/rfcConversation.d.ts +25 -25
- package/dist/connection/rfcConversation.d.ts.map +1 -1
- package/dist/connection/rfcConversation.js +24 -45
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/docs/INDEX.md +2 -0
- package/docs/INSTALLATION.md +7 -1
- package/docs/MIGRATION-18.0.md +2 -0
- package/docs/MIGRATION-20.0.md +121 -0
- package/docs/MIGRATION-6.0.md +2 -0
- package/docs/STATEFUL_SESSION_GUIDE.md +8 -0
- package/docs/USAGE.md +53 -14
- package/package.json +14 -19
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,141 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [20.0.0] - 2026-11-08
|
|
11
|
+
|
|
12
|
+
An RFC destination states its own address. Breaking for an RFC config and for code that reads
|
|
13
|
+
`getBaseUrl()`, builds an HTTP transport by hand or reads the session context's `baseUrl`; an HTTP
|
|
14
|
+
config passed to `createConnection` or the connectors compiles and behaves as before. See
|
|
15
|
+
[docs/MIGRATION-20.0.md](docs/MIGRATION-20.0.md).
|
|
16
|
+
|
|
17
|
+
### Changed — breaking
|
|
18
|
+
|
|
19
|
+
- **`@mcp-abap-adt/interfaces-auth-sap` ^4.0.0 and `@mcp-abap-adt/interfaces-adt-connection`
|
|
20
|
+
^4.0.0** (from ^3.4.0 and ^3.0.0). `ISapConfig` is a union by `connectionType`: an
|
|
21
|
+
`ISapHttpConfig` carries `url` and no RFC key; an `ISapRfcConfig` carries `client`, `language`
|
|
22
|
+
and one address — `ashost` + `sysnr`, or `mshost` + `msserv` / `sysid` (or both) + `group` —
|
|
23
|
+
and no `url`.
|
|
24
|
+
- **`rfcParamsFrom` / `rfcConversationFrom` take an `ISapRfcConfig` and read it as stated.** No
|
|
25
|
+
host or system number from a URL (the `80NN` port convention is gone), no `SAP_SYSNR` from the
|
|
26
|
+
environment, no `'000'` / `'EN'` / `'PUBLIC'` defaults, no trimming, no throw. `language` is the
|
|
27
|
+
SDK's `lang`; `msserv`, `sysid` and `saprouter` are sent exactly when stated.
|
|
28
|
+
`RfcMessageServerParams` is the "`msserv`, `sysid` or both" shape.
|
|
29
|
+
- **`createConnection`: each spec takes its own config shape** — `ISapHttpConfig` for the HTTP
|
|
30
|
+
wires, `ISapRfcConfig` for RFC — and the spec is narrowed by the compiler, with no cast. A `null`
|
|
31
|
+
or `undefined` spec fails with the runtime's own `TypeError`; any other value built past the
|
|
32
|
+
types is refused in the fixed words, as before.
|
|
33
|
+
- **`getBaseUrl(): Promise<string | undefined>`**: the `url`'s origin over HTTP, `undefined` over
|
|
34
|
+
RFC. An RFC config's construction parses no URL.
|
|
35
|
+
- **The HTTP transports take `baseUrl` as a required option**; a caller's path is put on it, and
|
|
36
|
+
the CSRF fetch, the cloud preflight and the logoff go to its origin, as before.
|
|
37
|
+
**`IAdtSessionContext` has no `baseUrl`**, and `establishSession` reads no `getBaseUrl()`.
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
|
|
41
|
+
- `SapHttpConfig` and `SapRfcConfig`, the two shapes of `SapConfig`.
|
|
42
|
+
- **`httpClient`, an option of the HTTP transports** (`HttpTransport`, `OnPremHttpTransport`,
|
|
43
|
+
`LegacyOnPremHttpTransport`, `CloudHttpTransport`): an `HttpClientFactory` — `create(agents)`
|
|
44
|
+
returns the axios instance the wire sends through, built from its two pooled agents
|
|
45
|
+
(`HttpClientAgents`), and `logoffRequest(options, onResponse)` the Node request a logoff goes
|
|
46
|
+
out on. Left out, it is the exported `nodeHttpClient`, which is what the wire used before:
|
|
47
|
+
nothing changes for a wire built without it. A test double goes under the wire through it.
|
|
48
|
+
`createConnection` passes it through for cloud + http, on-prem + http and on-prem + legacy-http
|
|
49
|
+
(`httpClient` beside `agentOptions` in `CloudHttpSpec` / `OnPremHttpSpec`).
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- **`sapConfigSignature` names the RFC address**: it carries `connectionType`, `ashost`, `sysnr`,
|
|
54
|
+
`mshost`, `msserv`, `sysid`, `group`, `saprouter` and `language` besides `url` and `client`, so
|
|
55
|
+
two configs that dial different servers no longer share a signature.
|
|
56
|
+
|
|
57
|
+
## [19.1.0] - 2026-10-23
|
|
58
|
+
|
|
59
|
+
The HTTP wire's sockets change (below: Fixed and the first two Changed entries; a minor release because `https:` now keeps sockets alive); the
|
|
60
|
+
dependency ranges are unchanged. The rest is the repository's own install, lockfile, tests and
|
|
61
|
+
workflows.
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
|
|
65
|
+
- **A request lost on a dead kept-alive socket is sent once more, on a new connection**
|
|
66
|
+
(mcp-abap-adt#314) — a named exception to "no retries". Over `http:` the wire used Node.js's
|
|
67
|
+
global agent, which keeps sockets alive; a server may close an idle one just as a request is
|
|
68
|
+
written onto it, and the request is lost unread. After a `500` in a stateful session the cleanup
|
|
69
|
+
`UNLOCK` failed so, with "socket hang up", and the enqueue lock stayed with the session — still
|
|
70
|
+
alive — until SM12. Now a request that went out on a socket taken from the pool, and whose
|
|
71
|
+
socket ended with no byte of an answer read (`ECONNRESET`, `EPIPE`), is resent once on a socket
|
|
72
|
+
opened for it, with the same cookies, session headers, CSRF token and body: the ABAP session and
|
|
73
|
+
its locks are bound to the cookies, not to the TCP connection (measured on an on-premise system,
|
|
74
|
+
2026-10-23: an `UNLOCK` on a fresh connection with the same cookies and lock handle released the
|
|
75
|
+
lock). Never resent: a request on a socket opened for it, one that read any byte of an answer,
|
|
76
|
+
one after a redirect, one with a stream body, the logoff, and the resend itself. All methods
|
|
77
|
+
qualify. The resend shows only as a `debug` line in fixed words. The risk, stated: a server that
|
|
78
|
+
read the request and died before a byte of its answer would run a non-idempotent request twice —
|
|
79
|
+
not what happens to a socket the server closed while idle.
|
|
80
|
+
|
|
81
|
+
### Changed
|
|
82
|
+
|
|
83
|
+
- **`https:` keeps its sockets alive too.** The HTTPS agent is built with Node.js's global-agent
|
|
84
|
+
options (`keepAlive: true`, `scheduling: 'lifo'`, `timeout: 5000` — an idle pooled socket is
|
|
85
|
+
closed after 5 s), as plain `http:` always had them, so a TLS handshake is no longer paid per
|
|
86
|
+
request. Your `agentOptions` and the TLS material still win over these: `ca`,
|
|
87
|
+
`rejectUnauthorized`, the client certificate are kept as before, and `keepAlive: false` there
|
|
88
|
+
turns the pool off. The wire's own `http.Agent` replaces the global one, with the same options.
|
|
89
|
+
- **The logoff always goes out on a connection of its own**, with `Connection: close` — over
|
|
90
|
+
`https:` also when your `agentOptions` say `keepAlive: true` (before, it then took a pooled
|
|
91
|
+
socket, and "written" could be a write onto a socket the server had closed).
|
|
92
|
+
- **The 7-day release age is dropped** (it was added earlier in this section and never shipped). `.npmrc` sets neither `min-release-age=7` nor
|
|
93
|
+
`min-release-age-exclude[]=@mcp-abap-adt/*`. The age gate conflicted with the gating
|
|
94
|
+
`npm audit`: a security fix younger than the gate could not be installed while the audit blocked
|
|
95
|
+
CI (seen 2026-10-22 with markdown-it 14.3.3). The defences that stay: `allowScripts` with
|
|
96
|
+
`strict-allow-scripts=true` (no dependency install script runs), lockfile hashes,
|
|
97
|
+
`npm ci --ignore-scripts` in CI, and the gating `npm audit`. Dependabot's own cooldown is
|
|
98
|
+
unchanged.
|
|
99
|
+
|
|
100
|
+
### Security
|
|
101
|
+
|
|
102
|
+
- **`npm audit` finds nothing, dev dependencies included** (it found 21: 19 moderate, 1 high,
|
|
103
|
+
1 critical). `follow-redirects` (under `axios`) 1.16.0 → 1.16.1 by a lockfile refresh within
|
|
104
|
+
the declared ranges (GHSA-q3jh-wrc6-jgq8, GHSA-8r9p-f939-6h3c — the one that reached the
|
|
105
|
+
runtime tree). The rest came with Jest: `handlebars` under `ts-jest` (GHSA-xw65-4hp5-5hc7,
|
|
106
|
+
GHSA-8r5x-fm3f-whwj, GHSA-p8wg-vrv2-v86f) and `sprintf-js` under `babel-plugin-istanbul` →
|
|
107
|
+
`@istanbuljs/load-nyc-config` → `js-yaml` 3 → `argparse` 1 (GHSA-hp3w-g68c-fv3c, no fixed
|
|
108
|
+
release), and they left with it (below). `@biomejs/biome` 2.5.15, `@types/node` 25.9.9.
|
|
109
|
+
- **No dependency has an install script, and none may run one.** With Jest gone the tree has no
|
|
110
|
+
package with an install script (it had two, `@parcel/watcher` and `unrs-resolver`, both
|
|
111
|
+
Jest's). `allowScripts` in `package.json` is empty — no dependency is allowed one — and `.npmrc`
|
|
112
|
+
sets `strict-allow-scripts=true`, so a new dependency with an unreviewed install script fails
|
|
113
|
+
the install instead of running it. npm reads these settings in full from 11.19.0 (measured
|
|
114
|
+
there); earlier npm 11 releases read part of them and npm 10, bundled with Node.js 22, none — so
|
|
115
|
+
CI and the release workflow install with `--ignore-scripts`, and docs/INSTALLATION.md, "From
|
|
116
|
+
Source", says `npm ci --ignore-scripts`. `.npmrc` does not set `ignore-scripts=true`: it would
|
|
117
|
+
also skip this package's own `prepublishOnly` gate.
|
|
118
|
+
- **CI and the release workflow run `npm audit --audit-level=moderate`**, dev dependencies
|
|
119
|
+
included, and run the tests through `npm run test:ci` instead of `npx jest`; the package scripts
|
|
120
|
+
call Biome and `tsc` from the installed dependencies instead of through `npx`.
|
|
121
|
+
- The `brace-expansion` override is gone: the package was reachable only through Jest.
|
|
122
|
+
|
|
123
|
+
### Changed
|
|
124
|
+
|
|
125
|
+
- **The tests run on Node.js's own test runner (`node:test`), not Jest.** `npm test` (and
|
|
126
|
+
`test:ci`, `test:shape`) runs `scripts/run-tests.mjs`: it compiles `src` with the tests by `tsc`
|
|
127
|
+
(`tsconfig.test.json`) into the git-ignored `.test-build/`, afresh on every run, and hands the
|
|
128
|
+
compiled `*.test.js` files to `node --test` — with Jest's default bound of 5 s a test from
|
|
129
|
+
Node.js 24 on (`--test-timeout`; Node.js 22 applies that flag to a whole file, so there a test is
|
|
130
|
+
bounded only by its own `timeout`); every `timeout` a test set under Jest is kept. `jest`, `ts-jest`, `@types/jest` and `jest-util`
|
|
131
|
+
are no longer dev dependencies, `jest.config.js` is gone, and with them 1,600-odd packages of
|
|
132
|
+
the dev tree. Every suite is converted as it was: `expect` → `node:assert/strict` (Jest's
|
|
133
|
+
`toMatchObject` as `helpers/assertions.ts`'s `assertMatchObject`, the asymmetric matchers as
|
|
134
|
+
the explicit checks they stood for), `jest.fn` / `spyOn` → `mock.fn` / `mock.method`, fake
|
|
135
|
+
timers → `mock.timers`, `jest.doMock` / `isolateModules` → `helpers/moduleCache.ts` over
|
|
136
|
+
`require.cache`. No production code changed. Same counts: 585 passed, 13 skipped (the live
|
|
137
|
+
RFC/SNC blocks, still listed and skipped with their reason, none of their hooks run). One file
|
|
138
|
+
or several: `node scripts/run-tests.mjs rfcLogon shapeCheck`; anything after `--` goes to
|
|
139
|
+
`node --test`. The plain-node scenario of `dispatchedGoodbye` now runs compiled, without the
|
|
140
|
+
transpiling `register.cjs`.
|
|
141
|
+
- **Every CI and release job is capped at 20 minutes** (`timeout-minutes`): on Node.js 22,
|
|
142
|
+
`node:test` bounds no single test (`--test-timeout` there bounds a whole file), so a hung test
|
|
143
|
+
would otherwise run until GitHub's 6-hour limit.
|
|
144
|
+
|
|
10
145
|
## [19.0.0] - 2026-10-22
|
|
11
146
|
|
|
12
147
|
### Changed (breaking)
|
|
@@ -2702,7 +2837,9 @@ const connection = createAbapConnection(config, logger);
|
|
|
2702
2837
|
- JWT token refresh now properly handles connection errors (401/403 during initial connect)
|
|
2703
2838
|
- Permission errors (403 with "ExceptionResourceNoAccess") no longer trigger JWT refresh loops
|
|
2704
2839
|
- Proper separation: base class handles HTTP/session, concrete classes handle auth-specific errors
|
|
2705
|
-
[Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/
|
|
2840
|
+
[Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v20.0.0...HEAD
|
|
2841
|
+
[20.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v19.1.0...v20.0.0
|
|
2842
|
+
[19.1.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v19.0.0...v19.1.0
|
|
2706
2843
|
[19.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v18.0.1...v19.0.0
|
|
2707
2844
|
[18.0.1]: https://github.com/fr0ster/mcp-abap-connection/compare/v18.0.0...v18.0.1
|
|
2708
2845
|
[18.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v17.1.0...v18.0.0
|
package/README.md
CHANGED
|
@@ -80,9 +80,10 @@ The package uses a clean separation of concerns:
|
|
|
80
80
|
conversation that IS the session
|
|
81
81
|
- On-prem is where this is a real choice; ABAP Cloud has one wire and its
|
|
82
82
|
connector takes no such parameter
|
|
83
|
-
- `rfcConversationFrom(config)` builds what `RfcTransport` needs
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
- `rfcConversationFrom(config)` builds what `RfcTransport` needs from an
|
|
84
|
+
RFC config's stated address, client and language — nothing derived, no
|
|
85
|
+
URL — and loads the SDK only when a conversation opens. It reads no user
|
|
86
|
+
or password: the provider writes the logon parameters
|
|
86
87
|
|
|
87
88
|
- **`GenericWebSocketTransport`** (concrete, exported):
|
|
88
89
|
- Transport abstraction for realtime WS message flows
|
|
@@ -161,6 +162,7 @@ the packages above. See [Migration to 9.0.0](./docs/MIGRATION-9.0.md).
|
|
|
161
162
|
|
|
162
163
|
- 📦 **[Installation Guide](./docs/INSTALLATION.md)** - Setup and installation instructions
|
|
163
164
|
- 📚 **[Usage Guide](./docs/USAGE.md)** - Detailed usage examples and API documentation
|
|
165
|
+
- 🚚 **[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`
|
|
164
166
|
- 🚚 **[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
|
|
165
167
|
- 🚚 **[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`)
|
|
166
168
|
- 🚚 **[Migration to 17.0.0](./docs/MIGRATION-17.0.md)** - no deadline of the package's own: `getTimeout`, `getTimeoutConfig` and `SAP_TIMEOUT_*` are gone, and a request inside a critical section carries none at all; an instance can be built on an existing session (`session`, `sessionCookies()`)
|
|
@@ -268,7 +270,7 @@ try {
|
|
|
268
270
|
`createConnection` returns a **new instance on every call**. Any other
|
|
269
271
|
combination of system and wire (cloud over RFC, say) is refused at
|
|
270
272
|
construction. The transport options are passed through as you give them:
|
|
271
|
-
`agentOptions` for the HTTP wires, `rfc` for the RFC wire, `wireLogger` for
|
|
273
|
+
`agentOptions` and `httpClient` for the HTTP wires, `rfc` for the RFC wire, `wireLogger` for
|
|
272
274
|
what the wire logs about itself, `logger` and `sessionId` for the connection.
|
|
273
275
|
The constructors below remain available; the factory only names the four
|
|
274
276
|
combinations that exist.
|
|
@@ -280,6 +282,25 @@ the socket and SAP then ends the request running on it — a write in it lost.
|
|
|
280
282
|
a critical section (`beginCriticalSection()`) a request carries none at all,
|
|
281
283
|
not even yours.
|
|
282
284
|
|
|
285
|
+
**Kept-alive connections, and the one resend** (19.0.1). The HTTP wires pool
|
|
286
|
+
their sockets over `http:` and `https:` alike (Node.js's global-agent options:
|
|
287
|
+
`keepAlive`, `lifo`, an idle socket closed after 5 s; your `agentOptions` win
|
|
288
|
+
over `https:`, so `keepAlive: false` there turns the pool off). A server may
|
|
289
|
+
close an idle kept-alive connection just as a request is written onto it; that
|
|
290
|
+
request is lost unread. So, as a **named exception to "no retries"**: a request
|
|
291
|
+
that went out on a socket taken from the pool, and whose socket ended with no
|
|
292
|
+
byte of an answer read (`ECONNRESET` — "socket hang up" — or `EPIPE`), is sent
|
|
293
|
+
once more, on a new connection, with the same cookies, session headers, CSRF
|
|
294
|
+
token and body — the ABAP session and its locks are the cookies', not the
|
|
295
|
+
socket's (measured on-premise, 2026-10-23). Nothing else is resent: not a
|
|
296
|
+
request on a socket opened for it, not one that read any byte of an answer, not
|
|
297
|
+
one after a redirect, not a stream body, not the logoff, and never a second
|
|
298
|
+
time. The resend is visible only as a `debug` line in fixed words. **The risk,
|
|
299
|
+
stated:** a server that read the request and died before writing a byte of its
|
|
300
|
+
answer would run it twice; for a socket the server closed while it was idle,
|
|
301
|
+
that does not happen. Without the resend, a cleanup `UNLOCK` died so and the
|
|
302
|
+
enqueue lock stayed until SM12 (mcp-abap-adt#314).
|
|
303
|
+
|
|
283
304
|
### An instance on an existing session
|
|
284
305
|
|
|
285
306
|
An instance may be built on a session that already exists, instead of logging
|
|
@@ -466,12 +487,26 @@ import {
|
|
|
466
487
|
RfcTransport,
|
|
467
488
|
rfcConversationFrom,
|
|
468
489
|
} from "@mcp-abap-adt/connection";
|
|
490
|
+
import type { SapRfcConfig } from "@mcp-abap-adt/connection";
|
|
469
491
|
import { BasicAuthProvider } from "@mcp-abap-adt/auth-providers";
|
|
470
492
|
|
|
493
|
+
// An RFC destination states its address — here one application server, its
|
|
494
|
+
// host and system number — and its client and logon language. No URL.
|
|
495
|
+
const rfcConfig: SapRfcConfig = {
|
|
496
|
+
connectionType: "rfc",
|
|
497
|
+
ashost: "your-sap-host",
|
|
498
|
+
sysnr: "00",
|
|
499
|
+
client: "100",
|
|
500
|
+
language: "EN",
|
|
501
|
+
authType: "basic",
|
|
502
|
+
username: "your-username",
|
|
503
|
+
password: "your-password",
|
|
504
|
+
};
|
|
505
|
+
|
|
471
506
|
const connection = new AdtOnPremConnector(
|
|
472
|
-
|
|
473
|
-
new BasicAuthProvider(
|
|
474
|
-
new RfcTransport(rfcConversationFrom(
|
|
507
|
+
rfcConfig,
|
|
508
|
+
new BasicAuthProvider(rfcConfig.username!, rfcConfig.password!),
|
|
509
|
+
new RfcTransport(rfcConversationFrom(rfcConfig), logger),
|
|
475
510
|
logger,
|
|
476
511
|
);
|
|
477
512
|
|
|
@@ -644,6 +679,35 @@ false }`, or (when `agentOptions` leaves it unset) `TLS_REJECT_UNAUTHORIZED=0` o
|
|
|
644
679
|
for production. Before 11.0.0 the certificate was not verified by default: see
|
|
645
680
|
[MIGRATION-11.0.md](./docs/MIGRATION-11.0.md).
|
|
646
681
|
|
|
682
|
+
### The HTTP client
|
|
683
|
+
|
|
684
|
+
An HTTP wire reaches the network through an `HttpClientFactory`, the `httpClient`
|
|
685
|
+
option of its constructor (20.0.0). Left out, it is `nodeHttpClient`: axios over
|
|
686
|
+
the wire's own pooled agents, and Node's `http` / `https` for the logoff — what
|
|
687
|
+
the wire has always used. Hand your own to put something under the wire, a test
|
|
688
|
+
double above all: everything the wire adds to its requests (cookies, CSRF token,
|
|
689
|
+
affinity headers, `sap-client`) still runs, and only the exchange is yours.
|
|
690
|
+
|
|
691
|
+
```typescript
|
|
692
|
+
import axios from "axios";
|
|
693
|
+
import {
|
|
694
|
+
type HttpClientFactory,
|
|
695
|
+
OnPremHttpTransport,
|
|
696
|
+
nodeHttpClient,
|
|
697
|
+
} from "@mcp-abap-adt/connection";
|
|
698
|
+
|
|
699
|
+
const httpClient: HttpClientFactory = {
|
|
700
|
+
...nodeHttpClient,
|
|
701
|
+
// Built from the wire's agents; built anew when a logon offers other TLS material.
|
|
702
|
+
create: (agents) => axios.create({ ...agents }),
|
|
703
|
+
};
|
|
704
|
+
const transport = new OnPremHttpTransport(() => ({}), logger, {
|
|
705
|
+
client: config.client,
|
|
706
|
+
baseUrl: config.url,
|
|
707
|
+
httpClient,
|
|
708
|
+
});
|
|
709
|
+
```
|
|
710
|
+
|
|
647
711
|
### Stateful Sessions
|
|
648
712
|
|
|
649
713
|
Enable stateful mode for requests that need the ABAP context, such as LOCK and
|
|
@@ -757,7 +821,7 @@ interface AbapConnection {
|
|
|
757
821
|
makeAdtRequest<T = unknown, D = unknown>(
|
|
758
822
|
options: AbapRequestOptions,
|
|
759
823
|
): Promise<IAdtWireResponse<T, D>>;
|
|
760
|
-
getBaseUrl(): Promise<string>;
|
|
824
|
+
getBaseUrl(): Promise<string | undefined>; // undefined over RFC: no HTTP origin
|
|
761
825
|
setSessionType(type: "stateless" | "stateful"): void; // Switch session type
|
|
762
826
|
getSessionId(): string | null; // Client-side conversation id
|
|
763
827
|
}
|
|
@@ -814,7 +878,7 @@ interface ILogger {
|
|
|
814
878
|
Builds a NEW connection from what the caller states: `system` (`'cloud'` or
|
|
815
879
|
`'onprem'`) and `transport` (`'http'`, `'legacy-http'` or `'rfc'`), plus
|
|
816
880
|
`config`, `credential` and, optionally, `logger`, `wireLogger`, `sessionId`,
|
|
817
|
-
`agentOptions` and `session` (HTTP) or `rfc` (`IRfcTransportOptions`). Nothing is inferred,
|
|
881
|
+
`agentOptions`, `httpClient` and `session` (HTTP) or `rfc` (`IRfcTransportOptions`). Nothing is inferred,
|
|
818
882
|
not even from `config.connectionType`. A combination that does not exist is
|
|
819
883
|
refused with a `TypeError`, and so is `session` over RFC. One instance is one
|
|
820
884
|
SAP session: call it again for a new one — or pass `session` (the string an
|
|
@@ -823,17 +887,19 @@ which `connect()` then takes over instead of logging on.
|
|
|
823
887
|
|
|
824
888
|
#### `rfcConversationFrom(config)`
|
|
825
889
|
|
|
826
|
-
What `RfcTransport` is constructed with
|
|
890
|
+
What `RfcTransport` is constructed with, from an RFC config
|
|
891
|
+
(`SapRfcConfig`, `connectionType: 'rfc'`). An RFC config has no URL: it states
|
|
892
|
+
its address, its `client` and its logon `language`, and the SDK gets them as
|
|
893
|
+
they are — nothing is derived, defaulted, trimmed or read from the environment.
|
|
894
|
+
The address is one of two, and the config's type admits exactly one:
|
|
827
895
|
|
|
828
|
-
- **One application server
|
|
829
|
-
|
|
830
|
-
`
|
|
831
|
-
|
|
832
|
-
config's `mshost`, `msserv` or `sysid` (one of the two is required) and
|
|
833
|
-
`group` (default `PUBLIC`) go to the SDK as they are, and the url gives no
|
|
834
|
-
host or system number — the message server picks the application server.
|
|
896
|
+
- **One application server**: `ashost` and `sysnr`.
|
|
897
|
+
- **A message server and a logon group**: `mshost`, its service as `msserv`,
|
|
898
|
+
`sysid` or both, and `group` — the message server picks the application
|
|
899
|
+
server.
|
|
835
900
|
|
|
836
|
-
`saprouter` goes with either.
|
|
901
|
+
`saprouter` goes with either. `language` reaches the SDK as `lang`. The
|
|
902
|
+
provider's logon parameters are spread over the address at each open.
|
|
837
903
|
|
|
838
904
|
The SAP NW RFC SDK is loaded when a conversation opens, not when this is called,
|
|
839
905
|
so a machine without it fails at `connect()` with a message saying what to
|
|
@@ -841,10 +907,10 @@ install rather than at construction.
|
|
|
841
907
|
|
|
842
908
|
```text
|
|
843
909
|
function rfcConversationFrom(
|
|
844
|
-
config:
|
|
910
|
+
config: SapRfcConfig,
|
|
845
911
|
): (logon: Readonly<Record<string, string>>) => IRfcConversation;
|
|
846
|
-
function rfcParamsFrom(config:
|
|
847
|
-
// RfcAddress = RfcConnectionParams (ashost, sysnr) | RfcMessageServerParams (mshost, msserv
|
|
912
|
+
function rfcParamsFrom(config: SapRfcConfig): RfcAddress; // the address only
|
|
913
|
+
// RfcAddress = RfcConnectionParams (ashost, sysnr) | RfcMessageServerParams (mshost, msserv and/or sysid, group)
|
|
848
914
|
```
|
|
849
915
|
|
|
850
916
|
```typescript
|
|
@@ -856,9 +922,9 @@ import {
|
|
|
856
922
|
import { BasicAuthProvider } from "@mcp-abap-adt/auth-providers";
|
|
857
923
|
|
|
858
924
|
const connection = new AdtOnPremConnector(
|
|
859
|
-
|
|
860
|
-
new BasicAuthProvider(
|
|
861
|
-
new RfcTransport(rfcConversationFrom(
|
|
925
|
+
rfcConfig,
|
|
926
|
+
new BasicAuthProvider(rfcConfig.username!, rfcConfig.password!),
|
|
927
|
+
new RfcTransport(rfcConversationFrom(rfcConfig), logger),
|
|
862
928
|
logger,
|
|
863
929
|
);
|
|
864
930
|
```
|
|
@@ -866,7 +932,7 @@ const connection = new AdtOnPremConnector(
|
|
|
866
932
|
A third argument turns on the wire log, which is off by default:
|
|
867
933
|
|
|
868
934
|
```typescript
|
|
869
|
-
new RfcTransport(rfcConversationFrom(
|
|
935
|
+
new RfcTransport(rfcConversationFrom(rfcConfig), logger, { logWire: true });
|
|
870
936
|
```
|
|
871
937
|
|
|
872
938
|
It adds three debug lines per request — header fields, request body, response
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type { ISapConfig, SapAuthType, SapConnectionType } from '@mcp-abap-adt/interfaces-auth-sap';
|
|
1
|
+
import type { ISapConfig, ISapHttpConfig, ISapRfcConfig, SapAuthType, SapConnectionType } from '@mcp-abap-adt/interfaces-auth-sap';
|
|
2
2
|
export type { SapAuthType, SapConnectionType };
|
|
3
|
+
/** A system's configuration: `SapHttpConfig` or `SapRfcConfig`, by `connectionType`. */
|
|
3
4
|
export type SapConfig = ISapConfig;
|
|
5
|
+
/** An HTTP destination: its URL, no RFC key. */
|
|
6
|
+
export type SapHttpConfig = ISapHttpConfig;
|
|
7
|
+
/** An RFC destination: its stated address, client and language, no URL. */
|
|
8
|
+
export type SapRfcConfig = ISapRfcConfig;
|
|
4
9
|
export declare function sapConfigSignature(config: ISapConfig): string;
|
|
5
10
|
//# sourceMappingURL=sapConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sapConfig.d.ts","sourceRoot":"","sources":["../../src/config/sapConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,EAClB,MAAM,mCAAmC,CAAC;AAG3C,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC/C,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"sapConfig.d.ts","sourceRoot":"","sources":["../../src/config/sapConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,iBAAiB,EAClB,MAAM,mCAAmC,CAAC;AAG3C,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC/C,wFAAwF;AACxF,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AACnC,gDAAgD;AAChD,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAC3C,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC;AAEzC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAuC7D"}
|
package/dist/config/sapConfig.js
CHANGED
|
@@ -14,8 +14,19 @@ function sapConfigSignature(config) {
|
|
|
14
14
|
? `${config.sessionCookies.substring(0, 10)}...${config.sessionCookies.substring(Math.max(0, config.sessionCookies.length - 10))}`
|
|
15
15
|
: null;
|
|
16
16
|
return JSON.stringify({
|
|
17
|
+
connectionType: config.connectionType ?? null,
|
|
17
18
|
url: config.url,
|
|
19
|
+
// The RFC address, as stated: two configs that dial different servers
|
|
20
|
+
// never share a signature. An HTTP config has none of these.
|
|
21
|
+
ashost: config.ashost ?? null,
|
|
22
|
+
sysnr: config.sysnr ?? null,
|
|
23
|
+
mshost: config.mshost ?? null,
|
|
24
|
+
msserv: config.msserv ?? null,
|
|
25
|
+
sysid: config.sysid ?? null,
|
|
26
|
+
group: config.group ?? null,
|
|
27
|
+
saprouter: config.saprouter ?? null,
|
|
18
28
|
client: config.client ?? null,
|
|
29
|
+
language: config.language ?? null,
|
|
19
30
|
authType: config.authType,
|
|
20
31
|
username: config.username ?? null,
|
|
21
32
|
password: config.password ? 'set' : null,
|
|
@@ -27,7 +27,12 @@ declare abstract class AbstractAbapConnection implements AbapConnection, ISessio
|
|
|
27
27
|
* transports share this unit instead of a base class.
|
|
28
28
|
*/
|
|
29
29
|
protected readonly lifecycle: SessionLifecycle;
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* The system's HTTP origin, read off an HTTP config's `url`. `undefined` for
|
|
32
|
+
* an RFC config: an RFC destination states its address and has no URL, and
|
|
33
|
+
* none is invented for it.
|
|
34
|
+
*/
|
|
35
|
+
private readonly baseUrl;
|
|
31
36
|
private sessionId;
|
|
32
37
|
private sessionMode;
|
|
33
38
|
/**
|
|
@@ -526,7 +531,8 @@ declare abstract class AbstractAbapConnection implements AbapConnection, ISessio
|
|
|
526
531
|
* keep it as a secret. Nothing here logs it.
|
|
527
532
|
*/
|
|
528
533
|
sessionCookies(): string | null;
|
|
529
|
-
|
|
534
|
+
/** The system's HTTP origin; `undefined` over RFC, which has none. */
|
|
535
|
+
getBaseUrl(): Promise<string | undefined>;
|
|
530
536
|
getAuthHeaders(): Promise<Record<string, string>>;
|
|
531
537
|
/**
|
|
532
538
|
* What every request carries from the credential. On every path, 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,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAGnB,MAAM,oBAAoB,CAAC;AAwD5B,uBAAe,sBACb,YACE,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB;
|
|
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,gC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AAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAMlD;;OAEG;IACH,SAAS,CAAC,UAAU,IAAI,MAAM,GAAG,IAAI;IAIrC;;;;;;OAMG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMlD;;;;;;;;OAQG;YACW,eAAe;IAU7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,aAAa;IAgCrB;;;;OAIG;IACH,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIlD;;;;;;;;OAQG;IACH,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,eAAe;CA6BxB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -61,6 +61,11 @@ class AbstractAbapConnection {
|
|
|
61
61
|
* transports share this unit instead of a base class.
|
|
62
62
|
*/
|
|
63
63
|
lifecycle = new SessionLifecycle_js_1.SessionLifecycle();
|
|
64
|
+
/**
|
|
65
|
+
* The system's HTTP origin, read off an HTTP config's `url`. `undefined` for
|
|
66
|
+
* an RFC config: an RFC destination states its address and has no URL, and
|
|
67
|
+
* none is invented for it.
|
|
68
|
+
*/
|
|
64
69
|
baseUrl;
|
|
65
70
|
sessionId = null;
|
|
66
71
|
sessionMode = 'stateless';
|
|
@@ -205,13 +210,18 @@ class AbstractAbapConnection {
|
|
|
205
210
|
this.resumeFrom = session ?? null;
|
|
206
211
|
// Generate sessionId (used for sap-adt-connection-id header)
|
|
207
212
|
this.sessionId = sessionId || (0, node_crypto_1.randomUUID)();
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
this.baseUrl =
|
|
213
|
+
// The HTTP origin of an HTTP config's URL (an unparsable one refused); an
|
|
214
|
+
// RFC config has none.
|
|
215
|
+
if (config.connectionType === 'rfc') {
|
|
216
|
+
this.baseUrl = undefined;
|
|
212
217
|
}
|
|
213
|
-
|
|
214
|
-
|
|
218
|
+
else {
|
|
219
|
+
try {
|
|
220
|
+
this.baseUrl = new URL(config.url).origin;
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
throw new Error(`Invalid URL in configuration: ${error instanceof Error ? error.message : error}`);
|
|
224
|
+
}
|
|
215
225
|
}
|
|
216
226
|
this.logger?.debug(`AbstractAbapConnection - Session ID: ${this.sessionId.substring(0, 8)}...`);
|
|
217
227
|
}
|
|
@@ -664,7 +674,6 @@ class AbstractAbapConnection {
|
|
|
664
674
|
*/
|
|
665
675
|
sessionContext() {
|
|
666
676
|
return {
|
|
667
|
-
baseUrl: this.baseUrl,
|
|
668
677
|
authorize: (headers) => this.credentialHeaders(headers),
|
|
669
678
|
logon: (target) => this.logon(target),
|
|
670
679
|
extraHeaders: { 'sap-adt-connection-id': this.getSessionId() ?? '' },
|
|
@@ -1078,6 +1087,7 @@ class AbstractAbapConnection {
|
|
|
1078
1087
|
sessionCookies() {
|
|
1079
1088
|
return this.transport.sessionCookies();
|
|
1080
1089
|
}
|
|
1090
|
+
/** The system's HTTP origin; `undefined` over RFC, which has none. */
|
|
1081
1091
|
async getBaseUrl() {
|
|
1082
1092
|
return this.baseUrl;
|
|
1083
1093
|
}
|
|
@@ -1717,7 +1727,6 @@ class AbstractAbapConnection {
|
|
|
1717
1727
|
*/
|
|
1718
1728
|
leasedContext(lease, generation = lease?.generation) {
|
|
1719
1729
|
return {
|
|
1720
|
-
baseUrl: this.baseUrl,
|
|
1721
1730
|
authorize: async (headers) => {
|
|
1722
1731
|
await this.credentialHeaders(headers);
|
|
1723
1732
|
if (lease && !this.lifecycle.isCurrent(lease)) {
|
|
@@ -85,7 +85,7 @@ class CloudHttpTransport extends HttpTransport_js_1.HttpTransport {
|
|
|
85
85
|
// The cache-buster is Eclipse's; kept because this must not be served
|
|
86
86
|
// from anything's cache — a cached session document would hand back an
|
|
87
87
|
// address that belongs to a session somebody else already ended.
|
|
88
|
-
url: `${
|
|
88
|
+
url: `${this.origin()}${SESSIONS_PATH}?_=${Date.now()}`,
|
|
89
89
|
// No deadline: a client deadline closes the socket, and SAP then
|
|
90
90
|
// ends what was running on it. connect() waits for SAP's answer.
|
|
91
91
|
headers: {
|
|
@@ -112,7 +112,7 @@ class CloudHttpTransport extends HttpTransport_js_1.HttpTransport {
|
|
|
112
112
|
}
|
|
113
113
|
// Published only while its ICF service is active; without it the close
|
|
114
114
|
// sends the platform's own logoff instead.
|
|
115
|
-
this.logoff = this.resolveLink(this.linkHref(response.data, LOGOFF_REL), `${
|
|
115
|
+
this.logoff = this.resolveLink(this.linkHref(response.data, LOGOFF_REL), `${this.origin()}${SESSIONS_PATH}`);
|
|
116
116
|
this.logger?.debug(`Security session opened: ${resource}`);
|
|
117
117
|
}
|
|
118
118
|
catch (error) {
|
|
@@ -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;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,EAC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C,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;CA8ClD"}
|
|
@@ -89,7 +89,6 @@ class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapC
|
|
|
89
89
|
// credential itself, with nobody deciding anything.
|
|
90
90
|
await this.transport.establish({
|
|
91
91
|
...this.sessionContext(),
|
|
92
|
-
baseUrl: await this.getBaseUrl(),
|
|
93
92
|
isFatal: (error) => this.endsTheExchange(error),
|
|
94
93
|
});
|
|
95
94
|
this.logger?.debug('Connected', {
|