@mcp-abap-adt/connection 15.1.0 → 17.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 +187 -1
- package/README.md +137 -33
- package/dist/connection/AbstractAbapConnection.d.ts +140 -58
- package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
- package/dist/connection/AbstractAbapConnection.js +349 -255
- package/dist/connection/AdtCloudConnector.d.ts +6 -1
- package/dist/connection/AdtCloudConnector.d.ts.map +1 -1
- package/dist/connection/AdtCloudConnector.js +7 -2
- package/dist/connection/AdtOnPremConnector.d.ts +6 -1
- package/dist/connection/AdtOnPremConnector.d.ts.map +1 -1
- package/dist/connection/AdtOnPremConnector.js +7 -2
- package/dist/connection/CloudHttpTransport.d.ts +8 -1
- package/dist/connection/CloudHttpTransport.d.ts.map +1 -1
- package/dist/connection/CloudHttpTransport.js +30 -18
- package/dist/connection/CredentialAbapConnection.d.ts +3 -1
- package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
- package/dist/connection/CredentialAbapConnection.js +4 -2
- package/dist/connection/GenericWebSocketTransport.d.ts.map +1 -1
- package/dist/connection/GenericWebSocketTransport.js +7 -4
- package/dist/connection/HttpTransport.d.ts +80 -6
- package/dist/connection/HttpTransport.d.ts.map +1 -1
- package/dist/connection/HttpTransport.js +258 -25
- package/dist/connection/IAdtTransport.d.ts +46 -22
- package/dist/connection/IAdtTransport.d.ts.map +1 -1
- package/dist/connection/OnPremHttpTransport.d.ts +2 -13
- package/dist/connection/OnPremHttpTransport.d.ts.map +1 -1
- package/dist/connection/OnPremHttpTransport.js +16 -32
- package/dist/connection/RfcTransport.d.ts +7 -6
- package/dist/connection/RfcTransport.d.ts.map +1 -1
- package/dist/connection/RfcTransport.js +27 -49
- package/dist/connection/createConnection.d.ts +95 -0
- package/dist/connection/createConnection.d.ts.map +1 -0
- package/dist/connection/createConnection.js +44 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/docs/INDEX.md +6 -2
- package/docs/MIGRATION-16.0.md +123 -0
- package/docs/MIGRATION-17.0.md +119 -0
- package/docs/SCOPE.md +22 -45
- package/docs/STATEFUL_SESSION_GUIDE.md +49 -49
- package/docs/USAGE.md +244 -120
- package/package.json +2 -2
- package/dist/connection/requestAbort.d.ts +0 -32
- package/dist/connection/requestAbort.d.ts.map +0 -1
- package/dist/connection/requestAbort.js +0 -69
- package/dist/utils/timeouts.d.ts +0 -18
- package/dist/utils/timeouts.d.ts.map +0 -1
- package/dist/utils/timeouts.js +0 -37
|
@@ -118,6 +118,13 @@ export declare class RfcTransport implements IOnPremTransport {
|
|
|
118
118
|
ingest(): void;
|
|
119
119
|
/** None, and never any: see `ingest()`. */
|
|
120
120
|
cookies(): null;
|
|
121
|
+
/** None: the session is the conversation, which no cookie names. */
|
|
122
|
+
sessionCookies(): null;
|
|
123
|
+
/**
|
|
124
|
+
* Refused, with nothing sent: an RFC session is a conversation, opened by
|
|
125
|
+
* this process and held by it, and a conversation cannot be taken over.
|
|
126
|
+
*/
|
|
127
|
+
resume(): Promise<void>;
|
|
121
128
|
/**
|
|
122
129
|
* Nothing to establish. `open()` made the ABAP session, and there is no token
|
|
123
130
|
* to earn: this endpoint answers `x-csrf-token: fetch` with the same two
|
|
@@ -196,12 +203,6 @@ export declare class RfcTransport implements IOnPremTransport {
|
|
|
196
203
|
* A new conversation, logged on: the provider is asked what to open with,
|
|
197
204
|
* every time, and a failed open is a refused logon whose cause is the SDK's
|
|
198
205
|
* own error, untouched — a provider reads its `key` and message.
|
|
199
|
-
*
|
|
200
|
-
* With a request's signal — a call that opens a conversation of its own —
|
|
201
|
-
* both waits are that request's: the provider's logon and the open. An
|
|
202
|
-
* abort ends either for this request at once. A logon it stopped waiting
|
|
203
|
-
* for opens nothing; an open it stopped waiting for runs on, and the
|
|
204
|
-
* conversation it opens — this request's alone — is closed when it does.
|
|
205
206
|
*/
|
|
206
207
|
private loggedOn;
|
|
207
208
|
private closeQuietly;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RfcTransport.d.ts","sourceRoot":"","sources":["../../src/connection/RfcTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"RfcTransport.d.ts","sourceRoot":"","sources":["../../src/connection/RfcTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAa5B,sFAAsF;AACtF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,CACF,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB;;;;;OAKG;IACH,kBAAkB,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAgFD,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;OAKG;IACH,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,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KACpC,gBAAgB,EACJ,MAAM,GAAE,OAAO,GAAG,IAAW,EAC7B,OAAO,GAAE,oBAAyB;IAGrD,oDAAoD;IACpD,OAAO,CAAC,OAAO;IAcT,IAAI,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBvD,0DAA0D;IACpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwBtB,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAezE;;;;;;;;;;;;;OAaG;YACW,aAAa;YAUb,WAAW;IAqDzB,uEAAuE;YACzD,gBAAgB;IAa9B;;;;OAIG;YACW,OAAO;IAWrB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAgBnB;;;;OAIG;YACW,QAAQ;YAYR,YAAY;YAQZ,KAAK;CA+KpB"}
|
|
@@ -46,7 +46,6 @@ exports.RfcTransport = void 0;
|
|
|
46
46
|
const node_crypto_1 = require("node:crypto");
|
|
47
47
|
const auth_errors_1 = require("@mcp-abap-adt/auth-errors");
|
|
48
48
|
const authErrors_js_1 = require("./authErrors.js");
|
|
49
|
-
const requestAbort_js_1 = require("./requestAbort.js");
|
|
50
49
|
const statefulRequest_js_1 = require("./statefulRequest.js");
|
|
51
50
|
/**
|
|
52
51
|
* The SDK answers with untyped structures: each level is read as a record and
|
|
@@ -171,6 +170,17 @@ class RfcTransport {
|
|
|
171
170
|
cookies() {
|
|
172
171
|
return null;
|
|
173
172
|
}
|
|
173
|
+
/** None: the session is the conversation, which no cookie names. */
|
|
174
|
+
sessionCookies() {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Refused, with nothing sent: an RFC session is a conversation, opened by
|
|
179
|
+
* this process and held by it, and a conversation cannot be taken over.
|
|
180
|
+
*/
|
|
181
|
+
async resume() {
|
|
182
|
+
throw new TypeError('An RFC session cannot be taken over: it is a conversation, not something a cookie names. Over RFC, connect() opens a new session.');
|
|
183
|
+
}
|
|
174
184
|
/**
|
|
175
185
|
* Nothing to establish. `open()` made the ABAP session, and there is no token
|
|
176
186
|
* to earn: this endpoint answers `x-csrf-token: fetch` with the same two
|
|
@@ -295,7 +305,7 @@ class RfcTransport {
|
|
|
295
305
|
const generation = this.generation;
|
|
296
306
|
return (0, statefulRequest_js_1.isStatefulRequest)(request)
|
|
297
307
|
? this.carry(request, this.conversation, generation)
|
|
298
|
-
: this.carryOnItsOwn(request, generation
|
|
308
|
+
: this.carryOnItsOwn(request, generation);
|
|
299
309
|
}
|
|
300
310
|
/**
|
|
301
311
|
* A request that is not stateful, in a fresh ABAP session.
|
|
@@ -311,17 +321,17 @@ class RfcTransport {
|
|
|
311
321
|
* package the first one saved would refuse the second one's write (PAK/058).
|
|
312
322
|
* So a concurrent call takes a conversation of its own instead of waiting.
|
|
313
323
|
*/
|
|
314
|
-
async carryOnItsOwn(request, generation
|
|
324
|
+
async carryOnItsOwn(request, generation) {
|
|
315
325
|
if (this.canReset !== false && !this.statelessBusy) {
|
|
316
|
-
return this.carryOnKept(request, generation
|
|
326
|
+
return this.carryOnKept(request, generation);
|
|
317
327
|
}
|
|
318
|
-
return this.carryOnThrowaway(request, generation
|
|
328
|
+
return this.carryOnThrowaway(request, generation);
|
|
319
329
|
}
|
|
320
|
-
async carryOnKept(request, generation
|
|
330
|
+
async carryOnKept(request, generation) {
|
|
321
331
|
this.statelessBusy = true;
|
|
322
332
|
try {
|
|
323
333
|
if (!this.stateless?.alive) {
|
|
324
|
-
const opened = await this.openOwn(generation
|
|
334
|
+
const opened = await this.openOwn(generation);
|
|
325
335
|
// Checked again after the await: close() may have run since openOwn()
|
|
326
336
|
// checked, and a conversation of a closed wire must not become the
|
|
327
337
|
// kept one of the next.
|
|
@@ -366,8 +376,8 @@ class RfcTransport {
|
|
|
366
376
|
}
|
|
367
377
|
}
|
|
368
378
|
/** A conversation opened for this one call, closed when it answers. */
|
|
369
|
-
async carryOnThrowaway(request, generation
|
|
370
|
-
const own = await this.openOwn(generation
|
|
379
|
+
async carryOnThrowaway(request, generation) {
|
|
380
|
+
const own = await this.openOwn(generation);
|
|
371
381
|
this.logger?.debug('RFC conversation opened for one stateless call');
|
|
372
382
|
try {
|
|
373
383
|
return await this.carry(request, own, generation);
|
|
@@ -381,8 +391,8 @@ class RfcTransport {
|
|
|
381
391
|
* wire was closed meanwhile, the conversation is closed again and nothing is
|
|
382
392
|
* sent — not a PUT, not a DELETE — on a wire already given back.
|
|
383
393
|
*/
|
|
384
|
-
async openOwn(generation
|
|
385
|
-
const own = await this.loggedOn(
|
|
394
|
+
async openOwn(generation) {
|
|
395
|
+
const own = await this.loggedOn();
|
|
386
396
|
if (generation !== this.generation || !this.conversation?.alive) {
|
|
387
397
|
await this.closeQuietly(own);
|
|
388
398
|
throw new Error('RFC transport was closed while the call was being opened; nothing was sent.');
|
|
@@ -415,42 +425,16 @@ class RfcTransport {
|
|
|
415
425
|
* A new conversation, logged on: the provider is asked what to open with,
|
|
416
426
|
* every time, and a failed open is a refused logon whose cause is the SDK's
|
|
417
427
|
* own error, untouched — a provider reads its `key` and message.
|
|
418
|
-
*
|
|
419
|
-
* With a request's signal — a call that opens a conversation of its own —
|
|
420
|
-
* both waits are that request's: the provider's logon and the open. An
|
|
421
|
-
* abort ends either for this request at once. A logon it stopped waiting
|
|
422
|
-
* for opens nothing; an open it stopped waiting for runs on, and the
|
|
423
|
-
* conversation it opens — this request's alone — is closed when it does.
|
|
424
428
|
*/
|
|
425
|
-
async loggedOn(
|
|
429
|
+
async loggedOn() {
|
|
426
430
|
const parameters = {};
|
|
427
|
-
|
|
428
|
-
await (0, requestAbort_js_1.untilAborted)(signal, this.context.logon(this.logonTarget(parameters)));
|
|
429
|
-
}
|
|
431
|
+
await this.context?.logon(this.logonTarget(parameters));
|
|
430
432
|
const conversation = this.connect(parameters);
|
|
431
|
-
// An `open()` that throws instead of rejecting is a refused logon too.
|
|
432
|
-
let opened;
|
|
433
433
|
try {
|
|
434
|
-
|
|
434
|
+
await conversation.open();
|
|
435
435
|
}
|
|
436
436
|
catch (e) {
|
|
437
|
-
opened = Promise.reject(e);
|
|
438
|
-
}
|
|
439
|
-
const opening = opened.catch((e) => {
|
|
440
437
|
throw new authErrors_js_1.WireLogonError(e);
|
|
441
|
-
});
|
|
442
|
-
try {
|
|
443
|
-
await (0, requestAbort_js_1.untilAborted)(signal, opening);
|
|
444
|
-
}
|
|
445
|
-
catch (e) {
|
|
446
|
-
if ((0, requestAbort_js_1.isRequestAborted)(e)) {
|
|
447
|
-
// A failed open has nothing to close, and its failure is nobody's.
|
|
448
|
-
// What would have become the kept conversation is closed too, not
|
|
449
|
-
// kept: the next call pays a logon, and no session outlives a call
|
|
450
|
-
// its caller gave up on.
|
|
451
|
-
opening.then(() => this.closeQuietly(conversation), () => { });
|
|
452
|
-
}
|
|
453
|
-
throw e;
|
|
454
438
|
}
|
|
455
439
|
return conversation;
|
|
456
440
|
}
|
|
@@ -515,20 +499,14 @@ class RfcTransport {
|
|
|
515
499
|
//
|
|
516
500
|
// Nor is one needed. What bounds this call is the server: a dialog step
|
|
517
501
|
// ends at `rdisp/max_wprun_time`. And a call that cannot be torn down
|
|
518
|
-
// mid-flight is precisely what the connection
|
|
519
|
-
// a critical section
|
|
520
|
-
//
|
|
502
|
+
// mid-flight is precisely what the connection keeps over HTTP, where a
|
|
503
|
+
// request inside a critical section carries no deadline at all, so an
|
|
504
|
+
// abort cannot orphan a lock handle. Here that comes free.
|
|
521
505
|
// The last point before anything leaves: nothing awaits between this
|
|
522
506
|
// check and the call, so a close() that ran at any await above stops it.
|
|
523
507
|
if (generation !== this.generation) {
|
|
524
508
|
throw new Error('RFC transport was closed before the call was sent; nothing was sent.');
|
|
525
509
|
}
|
|
526
|
-
// And the caller's abort, here for the same reason: the logon and the
|
|
527
|
-
// open answered turns ago, and an abort since must stop the call. A
|
|
528
|
-
// conversation opened for this call alone is closed by its caller's
|
|
529
|
-
// `finally`; the kept one is reset and stays kept.
|
|
530
|
-
if (request.signal?.aborted)
|
|
531
|
-
throw (0, requestAbort_js_1.requestAborted)();
|
|
532
510
|
let raw;
|
|
533
511
|
try {
|
|
534
512
|
raw = await conversation.call('SADT_REST_RFC_ENDPOINT', {
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a connection: the connector for the system, and the wire it travels
|
|
3
|
+
* over — both stated by the caller.
|
|
4
|
+
*
|
|
5
|
+
* Choosing the wire is the part consumers get wrong, so the four combinations
|
|
6
|
+
* that exist are named here once. Nothing is inferred: not from the config,
|
|
7
|
+
* not from the host name, not from `SapConfig.connectionType`. Taking a
|
|
8
|
+
* system and a transport is the caller stating which system it is dialling
|
|
9
|
+
* and what it travels over — the rule the connectors themselves follow.
|
|
10
|
+
*
|
|
11
|
+
* **A new instance on every call.** One connection instance is one SAP
|
|
12
|
+
* session: after its `disconnect()` (or a logoff of its own) it is spent, and
|
|
13
|
+
* a new session is a new call to this.
|
|
14
|
+
*
|
|
15
|
+
* **Or an existing session.** `session` — the cookies an earlier instance's
|
|
16
|
+
* `sessionCookies()` returned — builds the instance on that session instead:
|
|
17
|
+
* `connect()` does not log on, and SAP's answer to its one request says
|
|
18
|
+
* whether the session is alive. HTTP wires only; over RFC it is refused here.
|
|
19
|
+
*
|
|
20
|
+
* Every transport option is passed through as the caller gives it; what is
|
|
21
|
+
* not given takes the constructor's own default, nothing more.
|
|
22
|
+
*/
|
|
23
|
+
import type { AgentOptions } from 'node:https';
|
|
24
|
+
import type { IAuthProvider } from '@mcp-abap-adt/interfaces-auth';
|
|
25
|
+
import type { SapConfig } from '../config/sapConfig.js';
|
|
26
|
+
import type { ILogger } from '../logger.js';
|
|
27
|
+
import { AdtCloudConnector } from './AdtCloudConnector.js';
|
|
28
|
+
import { AdtOnPremConnector } from './AdtOnPremConnector.js';
|
|
29
|
+
import { CloudHttpTransport } from './CloudHttpTransport.js';
|
|
30
|
+
import { LegacyOnPremHttpTransport } from './LegacyOnPremHttpTransport.js';
|
|
31
|
+
import { OnPremHttpTransport } from './OnPremHttpTransport.js';
|
|
32
|
+
import { type IRfcTransportOptions, RfcTransport } from './RfcTransport.js';
|
|
33
|
+
/** What every combination takes. */
|
|
34
|
+
interface ConnectionSpecBase<TCredential extends IAuthProvider> {
|
|
35
|
+
/** The system: its URL, client and, over RFC, what the conversation needs. */
|
|
36
|
+
config: SapConfig;
|
|
37
|
+
/** The credential, handed to the connector as it is. */
|
|
38
|
+
credential: TCredential;
|
|
39
|
+
/** The connection's logger. Absent: none. */
|
|
40
|
+
logger?: ILogger | null | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* The wire's own logger — what it logs about carrying requests. Absent:
|
|
43
|
+
* none, as the transport constructors default. Separate from `logger` so a
|
|
44
|
+
* caller can keep the wire quiet, or route it elsewhere.
|
|
45
|
+
*/
|
|
46
|
+
wireLogger?: ILogger | null | undefined;
|
|
47
|
+
/** The client-side conversation id. Absent: a generated one. */
|
|
48
|
+
sessionId?: string | undefined;
|
|
49
|
+
}
|
|
50
|
+
/** What the HTTP wires take besides. */
|
|
51
|
+
interface HttpWireOptions {
|
|
52
|
+
/**
|
|
53
|
+
* The HTTPS agent's options — `ca`, `rejectUnauthorized` and the like, not
|
|
54
|
+
* the credential (its TLS material arrives at logon). Absent: none.
|
|
55
|
+
*/
|
|
56
|
+
agentOptions?: (() => AgentOptions) | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* An existing session to build the instance on, instead of logging on: the
|
|
59
|
+
* string an instance's `sessionCookies()` returned. `connect()` then sends
|
|
60
|
+
* no logon; it asks SAP, without the credential, whether that session is
|
|
61
|
+
* alive, and rejects with SAP's answer when it is not. Absent: `connect()`
|
|
62
|
+
* logs on and opens a new session.
|
|
63
|
+
*/
|
|
64
|
+
session?: string | undefined;
|
|
65
|
+
}
|
|
66
|
+
export interface CloudHttpSpec<TCredential extends IAuthProvider = IAuthProvider> extends ConnectionSpecBase<TCredential>, HttpWireOptions {
|
|
67
|
+
system: 'cloud';
|
|
68
|
+
transport: 'http';
|
|
69
|
+
}
|
|
70
|
+
export interface OnPremHttpSpec<TCredential extends IAuthProvider = IAuthProvider> extends ConnectionSpecBase<TCredential>, HttpWireOptions {
|
|
71
|
+
system: 'onprem';
|
|
72
|
+
/** `legacy-http`: BASIS 7.40, where the stateful header must not be sent. */
|
|
73
|
+
transport: 'http' | 'legacy-http';
|
|
74
|
+
}
|
|
75
|
+
export interface OnPremRfcSpec<TCredential extends IAuthProvider = IAuthProvider> extends ConnectionSpecBase<TCredential> {
|
|
76
|
+
system: 'onprem';
|
|
77
|
+
transport: 'rfc';
|
|
78
|
+
/** The RFC wire's own options (`logWire`, `maxLoggedBodyChars`). */
|
|
79
|
+
rfc?: IRfcTransportOptions | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Not over RFC: its session is a conversation, which cannot be taken over.
|
|
82
|
+
* Refused at construction.
|
|
83
|
+
*/
|
|
84
|
+
session?: undefined;
|
|
85
|
+
}
|
|
86
|
+
export type ConnectionSpec<TCredential extends IAuthProvider = IAuthProvider> = CloudHttpSpec<TCredential> | OnPremHttpSpec<TCredential> | OnPremRfcSpec<TCredential>;
|
|
87
|
+
/**
|
|
88
|
+
* What `createConnection` returns: one of the four connections that exist. A
|
|
89
|
+
* caller that needs the exact wire in the type narrows it (`instanceof`), or
|
|
90
|
+
* builds the connection with the constructors, which keep both in the type.
|
|
91
|
+
*/
|
|
92
|
+
export type CreatedConnection<TCredential extends IAuthProvider = IAuthProvider> = AdtCloudConnector<TCredential, CloudHttpTransport> | AdtOnPremConnector<TCredential, OnPremHttpTransport | LegacyOnPremHttpTransport | RfcTransport>;
|
|
93
|
+
export declare function createConnection<TCredential extends IAuthProvider>(spec: ConnectionSpec<TCredential>): CreatedConnection<TCredential>;
|
|
94
|
+
export {};
|
|
95
|
+
//# sourceMappingURL=createConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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});
|
|
3
|
+
exports.createConnection = createConnection;
|
|
4
|
+
const AdtCloudConnector_js_1 = require("./AdtCloudConnector.js");
|
|
5
|
+
const AdtOnPremConnector_js_1 = require("./AdtOnPremConnector.js");
|
|
6
|
+
const CloudHttpTransport_js_1 = require("./CloudHttpTransport.js");
|
|
7
|
+
const LegacyOnPremHttpTransport_js_1 = require("./LegacyOnPremHttpTransport.js");
|
|
8
|
+
const OnPremHttpTransport_js_1 = require("./OnPremHttpTransport.js");
|
|
9
|
+
const RfcTransport_js_1 = require("./RfcTransport.js");
|
|
10
|
+
const rfcConversation_js_1 = require("./rfcConversation.js");
|
|
11
|
+
/** Whatever a caller passed, read as the two words that pick the wire. */
|
|
12
|
+
function stated(spec) {
|
|
13
|
+
const record = (spec ?? {});
|
|
14
|
+
return { system: record.system, transport: record.transport };
|
|
15
|
+
}
|
|
16
|
+
function createConnection(spec) {
|
|
17
|
+
const { system, transport } = stated(spec);
|
|
18
|
+
// Fixed words, before anything is built.
|
|
19
|
+
if (transport === 'rfc' &&
|
|
20
|
+
spec.session !== undefined) {
|
|
21
|
+
throw new TypeError("createConnection: an RFC session cannot be taken over — it is a conversation, not something a cookie names. 'session' is for the HTTP wires; over RFC, connect() opens a new session.");
|
|
22
|
+
}
|
|
23
|
+
const logger = spec.logger ?? null;
|
|
24
|
+
const wireLogger = spec.wireLogger ?? null;
|
|
25
|
+
const address = { client: spec.config.client, baseUrl: spec.config.url };
|
|
26
|
+
if (system === 'cloud' && transport === 'http') {
|
|
27
|
+
const http = spec;
|
|
28
|
+
return new AdtCloudConnector_js_1.AdtCloudConnector(spec.config, spec.credential, new CloudHttpTransport_js_1.CloudHttpTransport(http.agentOptions, wireLogger, address), logger, spec.sessionId, http.session);
|
|
29
|
+
}
|
|
30
|
+
if (system === 'onprem' && transport === 'http') {
|
|
31
|
+
const http = spec;
|
|
32
|
+
return new AdtOnPremConnector_js_1.AdtOnPremConnector(spec.config, spec.credential, new OnPremHttpTransport_js_1.OnPremHttpTransport(http.agentOptions, wireLogger, address), logger, spec.sessionId, http.session);
|
|
33
|
+
}
|
|
34
|
+
if (system === 'onprem' && transport === 'legacy-http') {
|
|
35
|
+
const http = spec;
|
|
36
|
+
return new AdtOnPremConnector_js_1.AdtOnPremConnector(spec.config, spec.credential, new LegacyOnPremHttpTransport_js_1.LegacyOnPremHttpTransport(http.agentOptions, wireLogger, address), logger, spec.sessionId, http.session);
|
|
37
|
+
}
|
|
38
|
+
if (system === 'onprem' && transport === 'rfc') {
|
|
39
|
+
const rfc = spec;
|
|
40
|
+
return new AdtOnPremConnector_js_1.AdtOnPremConnector(spec.config, spec.credential, new RfcTransport_js_1.RfcTransport((0, rfcConversation_js_1.rfcConversationFrom)(spec.config), wireLogger, rfc.rfc), logger, spec.sessionId);
|
|
41
|
+
}
|
|
42
|
+
// Fixed words: nothing the caller passed is echoed back.
|
|
43
|
+
throw new TypeError("createConnection: no such combination of system and transport. ABAP Cloud has one wire, 'http'; on-prem takes 'http', 'legacy-http' or 'rfc'. Both are stated by the caller, never inferred.");
|
|
44
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { AdtCloudConnector } from './connection/AdtCloudConnector.js';
|
|
|
6
6
|
export { AdtOnPremConnector } from './connection/AdtOnPremConnector.js';
|
|
7
7
|
export { type AuthRefusalMoment, AuthRefusedError, WireLogonError, } from './connection/authErrors.js';
|
|
8
8
|
export { CloudHttpTransport } from './connection/CloudHttpTransport.js';
|
|
9
|
+
export { type CloudHttpSpec, type ConnectionSpec, type CreatedConnection, createConnection, type OnPremHttpSpec, type OnPremRfcSpec, } from './connection/createConnection.js';
|
|
9
10
|
export { CSRF_CONFIG, CSRF_ERROR_MESSAGES } from './connection/csrfConfig.js';
|
|
10
11
|
export { GenericWebSocketTransport, type IWebSocketFactory, type IWebSocketLike, } from './connection/GenericWebSocketTransport.js';
|
|
11
12
|
export { HttpTransport } from './connection/HttpTransport.js';
|
|
@@ -15,5 +16,4 @@ export { OnPremHttpTransport } from './connection/OnPremHttpTransport.js';
|
|
|
15
16
|
export { type IRfcConversation, type IRfcTransportOptions, RfcTransport, } from './connection/RfcTransport.js';
|
|
16
17
|
export { type RfcConnectionParams, rfcConversationFrom, rfcParamsFrom, } from './connection/rfcConversation.js';
|
|
17
18
|
export type { ILogger } from './logger.js';
|
|
18
|
-
export { getTimeout, getTimeoutConfig, type TimeoutConfig, } from './utils/timeouts.js';
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAK1C,YAAY,EACV,WAAW,EACX,SAAS,EACT,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,YAAY,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EACL,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAK1C,YAAY,EACV,WAAW,EACX,SAAS,EACT,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,E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the contract packages, under the names this
|
|
3
3
|
// package has always published them by.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.rfcParamsFrom = exports.rfcConversationFrom = exports.RfcTransport = exports.OnPremHttpTransport = exports.LegacyOnPremHttpTransport = exports.HttpTransport = exports.GenericWebSocketTransport = exports.CSRF_ERROR_MESSAGES = exports.CSRF_CONFIG = exports.createConnection = exports.CloudHttpTransport = exports.WireLogonError = exports.AuthRefusedError = exports.AdtOnPremConnector = exports.AdtCloudConnector = exports.sapConfigSignature = void 0;
|
|
6
6
|
// Config utilities
|
|
7
7
|
var sapConfig_js_1 = require("./config/sapConfig.js");
|
|
8
8
|
Object.defineProperty(exports, "sapConfigSignature", { enumerable: true, get: function () { return sapConfig_js_1.sapConfigSignature; } });
|
|
@@ -15,6 +15,10 @@ Object.defineProperty(exports, "AuthRefusedError", { enumerable: true, get: func
|
|
|
15
15
|
Object.defineProperty(exports, "WireLogonError", { enumerable: true, get: function () { return authErrors_js_1.WireLogonError; } });
|
|
16
16
|
var CloudHttpTransport_js_1 = require("./connection/CloudHttpTransport.js");
|
|
17
17
|
Object.defineProperty(exports, "CloudHttpTransport", { enumerable: true, get: function () { return CloudHttpTransport_js_1.CloudHttpTransport; } });
|
|
18
|
+
// The recommended way to build a connection: the system and the wire stated,
|
|
19
|
+
// a new instance per session.
|
|
20
|
+
var createConnection_js_1 = require("./connection/createConnection.js");
|
|
21
|
+
Object.defineProperty(exports, "createConnection", { enumerable: true, get: function () { return createConnection_js_1.createConnection; } });
|
|
18
22
|
// The session lifecycle vocabulary — ISessionLifecycleAware, ADT_SESSION_ERROR —
|
|
19
23
|
// is deliberately NOT exported here. It lives in @mcp-abap-adt/interfaces-adt-connection, and a
|
|
20
24
|
// consumer imports it from there: re-exporting a contract type gives it two
|
|
@@ -41,7 +45,3 @@ Object.defineProperty(exports, "RfcTransport", { enumerable: true, get: function
|
|
|
41
45
|
var rfcConversation_js_1 = require("./connection/rfcConversation.js");
|
|
42
46
|
Object.defineProperty(exports, "rfcConversationFrom", { enumerable: true, get: function () { return rfcConversation_js_1.rfcConversationFrom; } });
|
|
43
47
|
Object.defineProperty(exports, "rfcParamsFrom", { enumerable: true, get: function () { return rfcConversation_js_1.rfcParamsFrom; } });
|
|
44
|
-
// Timeouts
|
|
45
|
-
var timeouts_js_1 = require("./utils/timeouts.js");
|
|
46
|
-
Object.defineProperty(exports, "getTimeout", { enumerable: true, get: function () { return timeouts_js_1.getTimeout; } });
|
|
47
|
-
Object.defineProperty(exports, "getTimeoutConfig", { enumerable: true, get: function () { return timeouts_js_1.getTimeoutConfig; } });
|
package/docs/INDEX.md
CHANGED
|
@@ -15,6 +15,8 @@ mcp-abap-connection/
|
|
|
15
15
|
│ ├── INSTALLATION.md # Setup and installation guide
|
|
16
16
|
│ ├── USAGE.md # API documentation and examples
|
|
17
17
|
│ ├── MIGRATION-2.0.md # Moving to the explicit session lifecycle
|
|
18
|
+
│ ├── MIGRATION-17.0.md # no deadline of the package's own; an instance on an existing session
|
|
19
|
+
│ ├── MIGRATION-16.0.md # the request signal removed; disconnect() resolves once the logoff is written
|
|
18
20
|
│ ├── MIGRATION-15.0.md # interfaces-adt-connection 2: makeAdtRequest answers unknown
|
|
19
21
|
│ ├── MIGRATION-14.0.md # the sap-abap-auth CLI, open and commander are removed
|
|
20
22
|
│ ├── MIGRATION-13.0.md # interfaces-auth 7, auth-errors 2, auth-providers 6.0.0; no behaviour change
|
|
@@ -25,7 +27,7 @@ mcp-abap-connection/
|
|
|
25
27
|
│ ├── MIGRATION-8.0.md # request headers leave the stateful branch; onto interfaces 39; flushGoodbye
|
|
26
28
|
│ ├── MIGRATION-6.0.md # the factory and the per-credential classes go; RFC is a transport
|
|
27
29
|
│ ├── MIGRATION-4.0.md # JWT error classification: 401 refreshes, 403 propagates
|
|
28
|
-
│ ├── SCOPE.md # What this package
|
|
30
|
+
│ ├── SCOPE.md # What this package answers for, and only that
|
|
29
31
|
│ └── STATEFUL_SESSION_GUIDE.md # Stateful requests and lock windows
|
|
30
32
|
├── examples/ # Working code examples
|
|
31
33
|
│ ├── README.md # Examples overview
|
|
@@ -43,9 +45,11 @@ mcp-abap-connection/
|
|
|
43
45
|
- 📦 [Installation Guide](./INSTALLATION.md) - How to install and set up the package
|
|
44
46
|
- 📚 [Usage Guide](./USAGE.md) - Basic usage and comprehensive API documentation
|
|
45
47
|
- 📖 [Main README](../README.md) - Package overview and quick start
|
|
46
|
-
- 🧭 [Scope
|
|
48
|
+
- 🧭 [Scope](./SCOPE.md) - What this package answers for, and only that
|
|
47
49
|
|
|
48
50
|
### Upgrading
|
|
51
|
+
- 🚚 [Migrating to 17.0.0](./MIGRATION-17.0.md) - `getTimeout`, `getTimeoutConfig` and `SAP_TIMEOUT_*` are gone; a request carries only the caller's `timeout`, and none inside a critical section; `createConnection({ …, session })` and `sessionCookies()`
|
|
52
|
+
- 🚚 [Migrating to 16.0.0](./MIGRATION-16.0.md) - the per-request `signal` and `ADT_REQUEST_ABORTED` are removed; `disconnect()` resolves once the logoff is written; `flushGoodbye()` waits for the answer
|
|
49
53
|
- 🚚 [Migrating to 15.0.0](./MIGRATION-15.0.md) - on `@mcp-abap-adt/interfaces-adt-connection` 2: `makeAdtRequest`'s answer is `unknown` unless its type is named
|
|
50
54
|
- 🚚 [Migrating to 14.0.0](./MIGRATION-14.0.md) - the `sap-abap-auth` CLI is removed; use `@mcp-abap-adt/auth-broker-cli`
|
|
51
55
|
- 🚚 [Migrating to 13.0.0](./MIGRATION-13.0.md) - interfaces-auth 7 and auth-errors 2; the connection's behaviour is unchanged, a consumer holds one interfaces-auth major and takes the providers from auth-providers 6.0.0
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Migration to 16.0
|
|
2
|
+
|
|
3
|
+
16.0.0 makes this package answer for what [SCOPE.md](./SCOPE.md) lists, and for
|
|
4
|
+
nothing else. For a consumer on 15.x that means the following.
|
|
5
|
+
|
|
6
|
+
## What changed
|
|
7
|
+
|
|
8
|
+
- **`signal` is gone from request options.** This matches
|
|
9
|
+
`@mcp-abap-adt/interfaces-adt-connection` 3.0.0, which drops
|
|
10
|
+
`IAbapRequestOptions.signal`, `ADT_REQUEST_ERROR` and `AdtRequestErrorCode`.
|
|
11
|
+
No request rejects with `ADT_REQUEST_ABORTED` any more. A request behaves as
|
|
12
|
+
it did in 15.0.1: once admitted, it runs to its answer or its `timeout`.
|
|
13
|
+
`IAdtTransportRequest.signal` and `IAdtEstablishContext.signal` are gone
|
|
14
|
+
from the transport seam. Measured on an on-premise system (BASIS 816, 2026-10-12): ABAP
|
|
15
|
+
neither cancels a request that reached it nor rolls back across requests,
|
|
16
|
+
and a logoff releases the locks — so the signal protected nothing.
|
|
17
|
+
- **One connection instance is one SAP session.** The instance is spent after
|
|
18
|
+
`disconnect()`, after a failed `connect()` that received a session cookie
|
|
19
|
+
(a `SAP_SESSIONID_*`; over RFC, an open conversation) — whether or not a
|
|
20
|
+
logoff was sent for it —, or after a lost session: `ADT_SESSION_REPLACED`, raised
|
|
21
|
+
exactly as in 15.0.1 for a changed `SAP_SESSIONID` or a 400 "session not
|
|
22
|
+
found". On a spent instance, `connect()` and every request reject
|
|
23
|
+
`ADT_SESSION_ERROR.NOT_CONNECTED`. The connector decides nothing beyond
|
|
24
|
+
that; what to do next is yours.
|
|
25
|
+
- On a spent instance, `connect()` rejects with
|
|
26
|
+
`ADT_SESSION_ERROR.NOT_CONNECTED`: "This connection's SAP session has
|
|
27
|
+
ended (it was disconnected, logged off or lost); one connection instance is one
|
|
28
|
+
session. Create a new connection for a new session."
|
|
29
|
+
- A failed `connect()` that received no session cookie (a 401, a network
|
|
30
|
+
error, a 200 with only `sap-XSRF_*`) leaves the instance usable, and
|
|
31
|
+
`connect()` may be retried.
|
|
32
|
+
- **No 401 opens a new session on the same instance.** Before 16.0.0, a
|
|
33
|
+
mutation refused with a 401 while a CSRF token was cached (outside a
|
|
34
|
+
critical section) discarded the session and retried in a new one, and a GET
|
|
35
|
+
refused with a 401 on a wire with no cookies fetched a token to open one,
|
|
36
|
+
and a GET refused with a 401 while cookies were held was resent once with
|
|
37
|
+
them before the provider was asked. All three are removed. The 401 goes to the provider (`rejected`); on
|
|
38
|
+
Ok the request is resent once in the same session, otherwise you get
|
|
39
|
+
`AuthRefusedError` carrying SAP's 401. The CSRF refetch for a 403 "CSRF
|
|
40
|
+
token validation failed" (cookies kept) and the provider's re-ask stay.
|
|
41
|
+
- **`disconnect()` resolves once the logoff is written.** It resolves when the
|
|
42
|
+
bytes are handed to the socket over HTTP, or when the close call has
|
|
43
|
+
returned over RFC. It does not wait for SAP's answer. The first call never
|
|
44
|
+
throws: a logoff that fails is logged.
|
|
45
|
+
- **Call it once per instance.** A second call rejects with
|
|
46
|
+
`ADT_SESSION_ERROR.NOT_CONNECTED` ("disconnect() was already called for
|
|
47
|
+
this connection; call it once per instance"), whether it comes while the
|
|
48
|
+
first is still writing or after it. The first call is unaffected.
|
|
49
|
+
- No timer bounds the write. A server that never takes the bytes holds
|
|
50
|
+
`disconnect()` until the socket fails. That failure is logged, not thrown.
|
|
51
|
+
- **"Written" means handed to the operating system.** The logoff goes out
|
|
52
|
+
on a connection of its own over HTTP. Over HTTPS this holds while your
|
|
53
|
+
`agentOptions` leave `keepAlive` off.
|
|
54
|
+
- **Over RFC, the close waits for a call still running on its
|
|
55
|
+
conversation.** In `@mcp-abap-adt/sap-rfc-lite` 0.2.2, a call holds the
|
|
56
|
+
client's invocation mutex until it returns, and `close()` takes the same
|
|
57
|
+
mutex.
|
|
58
|
+
- **When the logoff is sent.** It is sent if and only if the instance holds
|
|
59
|
+
a live `SAP_SESSIONID_*` that it received: not one deleted by a past
|
|
60
|
+
`expires` or `Max-Age=0`.
|
|
61
|
+
- A `connect()` that fails as a whole after the server opened a session (a
|
|
62
|
+
cloud preflight's, or a 403/404 after logon on both discovery endpoints)
|
|
63
|
+
logs it off, and rejects only once the logoff is written.
|
|
64
|
+
- A 404 on core discovery alone is not a failure: the fallback runs in the
|
|
65
|
+
same session.
|
|
66
|
+
- A 401, or a 200 with only `sap-XSRF_*`, has no session, so nothing is
|
|
67
|
+
sent.
|
|
68
|
+
- The logoff never carries `sap-contextid`. Measured on an on-premise system (2026-10-13), a
|
|
69
|
+
logoff carrying a stale one got 400 and closed nothing, while one without
|
|
70
|
+
it ended the context and released its lock.
|
|
71
|
+
- A redirect answering the logoff counts as its answer: it is not
|
|
72
|
+
followed.
|
|
73
|
+
- On cloud, a session the server linked no logoff resource for is logged
|
|
74
|
+
off through the platform's ICF logoff (`/sap/public/bc/icf/logoff`), as
|
|
75
|
+
on-prem, instead of being left to the server's timeout. A linked logoff
|
|
76
|
+
resource is used as before.
|
|
77
|
+
- **`flushGoodbye(timeoutMs?)` has no default bound.** Without an argument it
|
|
78
|
+
waits for SAP's answer to the logoff for as long as it takes. With
|
|
79
|
+
`timeoutMs` it waits at most that long and returns without throwing.
|
|
80
|
+
- **`IAdtTransport.close(context, written?)`**: a wire reports the write by
|
|
81
|
+
calling `written`. `disconnect()` resolves at the first of `written()` and
|
|
82
|
+
the close settling.
|
|
83
|
+
|
|
84
|
+
## What a consumer must do
|
|
85
|
+
|
|
86
|
+
- **Build connections with `createConnection(spec)`** (recommended). You state
|
|
87
|
+
`system` and `transport` (`cloud`+`http`, or `onprem` with `http`,
|
|
88
|
+
`legacy-http` or `rfc`). The factory builds the matching connector and wire
|
|
89
|
+
and passes your transport options through. It returns a new instance on
|
|
90
|
+
every call. The constructors still work.
|
|
91
|
+
- **Drop `signal`** from the options passed to `makeAdtRequest`, and drop any
|
|
92
|
+
check for `ADT_REQUEST_ERROR` or `'ADT_REQUEST_ABORTED'`.
|
|
93
|
+
- **Call `disconnect()` once.** If more than one path in your code can end a
|
|
94
|
+
connection, such as a `finally` and a signal handler, let one of them own
|
|
95
|
+
the call, or catch the second call's rejection.
|
|
96
|
+
- **A process about to exit awaits `disconnect()`.** Once it resolves, the
|
|
97
|
+
logoff has left:
|
|
98
|
+
```typescript
|
|
99
|
+
await connection.disconnect();
|
|
100
|
+
process.exit(0);
|
|
101
|
+
```
|
|
102
|
+
- **A new session is a new instance, and creating it is yours.** Use your
|
|
103
|
+
own factory or `createConnection`. Anywhere you called `connect()` again on
|
|
104
|
+
an instance after `disconnect()`, create a new connection instead.
|
|
105
|
+
- **On a 401, create a new instance if you want a new session.** The
|
|
106
|
+
connection no longer opens one for you. Where you relied on a mutation's
|
|
107
|
+
401 being retried in a fresh session, catch the `AuthRefusedError` (or the
|
|
108
|
+
`ADT_SESSION_REPLACED` the resend may raise), `disconnect()` the instance,
|
|
109
|
+
and redo the work on a new connection — under a new lock, if it held one.
|
|
110
|
+
- **`flushGoodbye()` no longer gives up after 5 s.** If you need a bound,
|
|
111
|
+
pass one: `flushGoodbye(5000)`.
|
|
112
|
+
- **Await `flushGoodbye()` as well if SAP's answer matters**, for example
|
|
113
|
+
before a new connection connects, so that the server never holds two
|
|
114
|
+
sessions:
|
|
115
|
+
```typescript
|
|
116
|
+
await connection.disconnect();
|
|
117
|
+
await connection.flushGoodbye();
|
|
118
|
+
const next = createYourConnection();
|
|
119
|
+
await next.connect();
|
|
120
|
+
```
|
|
121
|
+
- **A custom transport** (`IAdtTransport`) whose `close()` stays pending long
|
|
122
|
+
after its goodbye has left should call the new `written` argument at that
|
|
123
|
+
point. Otherwise `disconnect()` waits for the close to settle.
|