@mcp-abap-adt/connection 17.0.0 → 18.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 CHANGED
@@ -7,6 +7,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [18.0.0] - 2026-10-16
11
+
12
+ Migrating from 17.x: [docs/MIGRATION-18.0.md](./docs/MIGRATION-18.0.md).
13
+
14
+ ### Added
15
+
16
+ - **RFC through a message server and a logon group.** With `mshost` in the config,
17
+ `rfcParamsFrom` / `rfcConversationFrom` dial the message server: `mshost`, `msserv` or
18
+ `sysid` (one is required; a config with neither is refused naming both), and `group`
19
+ (default `PUBLIC`), passed to the SAP NW RFC SDK as its own keys. The url then gives no host
20
+ and no system number, and `SAP_SYSNR` is not read. `saprouter` is carried with either
21
+ addressing. Needs `@mcp-abap-adt/interfaces-auth-sap` ^3.4.0, which adds those `ISapConfig` fields; the dependency is raised to it.
22
+ - `RfcMessageServerParams` and `RfcAddress` (`RfcConnectionParams | RfcMessageServerParams`)
23
+ are exported; `RfcConnectionParams` gains an optional `saprouter`.
24
+ - **Not yet run against a live message server.** The address follows the SDK's own parameters
25
+ and is unit-tested; `mshost` + `msserv` without `sysid` is accepted but unconfirmed. If the SDK
26
+ refuses it, add `sysid`. The gated integration test covers it on a system that has one.
27
+
28
+ ### Changed (breaking)
29
+
30
+ - **`rfcParamsFrom` returns `RfcAddress`** instead of `RfcConnectionParams`. Nothing changes at
31
+ run time for a config without `mshost`, but a caller that read `.ashost` / `.sysnr` straight
32
+ from the result no longer compiles: narrow first (`'ashost' in params`). See the migration note.
33
+
34
+ ## [17.1.0] - 2026-10-13
35
+
36
+ What this package answers for is listed in [docs/SCOPE.md](./docs/SCOPE.md).
37
+
38
+ ### Added
39
+ - **`disconnect()` without `connect()` on an instance built on a session.**
40
+ An instance built with `session` (`createConnection({ …, session })`, or the
41
+ connectors' sixth argument) may be disconnected without connecting:
42
+ `disconnect()` sends the ICF logoff (`/sap/public/bc/icf/logoff`, on cloud
43
+ too) with the handed cookies — no `sap-contextid`, no credential, no CSRF
44
+ fetch or any other request before it, the credential's `prepare()` never
45
+ called — resolves when the logoff is written, and spends the instance;
46
+ `flushGoodbye()` waits for SAP's answer. A session string naming no
47
+ `SAP_SESSIONID` sends nothing. Still once: a second `disconnect()` rejects,
48
+ and `connect()` after it is refused as on any spent instance. For logging
49
+ off a leftover session of a process that is gone. No new API; an instance
50
+ built without `session` behaves as in 17.0.0.
51
+
10
52
  ## [17.0.0] - 2026-10-13
11
53
 
12
54
  What this package answers for is listed in [docs/SCOPE.md](./docs/SCOPE.md).
@@ -2630,7 +2672,9 @@ const connection = createAbapConnection(config, logger);
2630
2672
  - JWT token refresh now properly handles connection errors (401/403 during initial connect)
2631
2673
  - Permission errors (403 with "ExceptionResourceNoAccess") no longer trigger JWT refresh loops
2632
2674
  - Proper separation: base class handles HTTP/session, concrete classes handle auth-specific errors
2633
- [Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v17.0.0...HEAD
2675
+ [Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v18.0.0...HEAD
2676
+ [18.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v17.1.0...v18.0.0
2677
+ [17.1.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v17.0.0...v17.1.0
2634
2678
  [17.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v16.0.0...v17.0.0
2635
2679
  [16.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v15.1.0...v16.0.0
2636
2680
  [15.1.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v15.0.1...v15.1.0
package/README.md CHANGED
@@ -161,6 +161,7 @@ the packages above. See [Migration to 9.0.0](./docs/MIGRATION-9.0.md).
161
161
 
162
162
  - 📦 **[Installation Guide](./docs/INSTALLATION.md)** - Setup and installation instructions
163
163
  - 📚 **[Usage Guide](./docs/USAGE.md)** - Detailed usage examples and API documentation
164
+ - 🚚 **[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`)
164
165
  - 🚚 **[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()`)
165
166
  - 🚚 **[Migration to 16.0.0](./docs/MIGRATION-16.0.md)** - the per-request `signal` (15.1.0) and `ADT_REQUEST_ABORTED` are removed; `disconnect()` resolves once the logoff is written, not answered — a process about to exit awaits it; `flushGoodbye()` when the answer matters
166
167
  - 🚚 **[Migration to 15.0.0](./docs/MIGRATION-15.0.md)** - on `@mcp-abap-adt/interfaces-adt-connection` 2: `makeAdtRequest`'s answer is `unknown` unless its type is named; nothing changes at run time
@@ -817,9 +818,17 @@ which `connect()` then takes over instead of logging on.
817
818
 
818
819
  #### `rfcConversationFrom(config)`
819
820
 
820
- What `RfcTransport` is constructed with. Derives `ashost` from the url and
821
- `sysnr` from the HTTP port by the SAP convention that `80XX` is the ICM port for
822
- system `XX`, which `SAP_SYSNR` overrides for a port that follows no convention.
821
+ What `RfcTransport` is constructed with. The address is one of two:
822
+
823
+ - **One application server** (default): `ashost` from the url and `sysnr` from
824
+ the HTTP port by the SAP convention that `80XX` is the ICM port for system
825
+ `XX`, which `SAP_SYSNR` overrides for a port that follows no convention.
826
+ - **A message server and a logon group**, when the config states `mshost`: the
827
+ config's `mshost`, `msserv` or `sysid` (one of the two is required) and
828
+ `group` (default `PUBLIC`) go to the SDK as they are, and the url gives no
829
+ host or system number — the message server picks the application server.
830
+
831
+ `saprouter` goes with either.
823
832
 
824
833
  The SAP NW RFC SDK is loaded when a conversation opens, not when this is called,
825
834
  so a machine without it fails at `connect()` with a message saying what to
@@ -829,7 +838,8 @@ install rather than at construction.
829
838
  function rfcConversationFrom(
830
839
  config: SapConfig,
831
840
  ): (logon: Readonly<Record<string, string>>) => IRfcConversation;
832
- function rfcParamsFrom(config: SapConfig): RfcConnectionParams; // the address only
841
+ function rfcParamsFrom(config: SapConfig): RfcAddress; // the address only
842
+ // RfcAddress = RfcConnectionParams (ashost, sysnr) | RfcMessageServerParams (mshost, msserv | sysid, group)
833
843
  ```
834
844
 
835
845
  ```typescript
@@ -284,6 +284,12 @@ declare abstract class AbstractAbapConnection implements AbapConnection, ISessio
284
284
  * `connect()` rejects, so a caller's `disconnect()` in its `finally` is the
285
285
  * first of that life and has nothing of it to wait for.
286
286
  *
287
+ * **On an instance built on an existing session, without `connect()`**, this
288
+ * logs that session off: the handed cookies go to the wire, and the logoff
289
+ * is sent with them as for any instance — no request before it, no
290
+ * credential, the provider's `prepare()` never called. A string naming no
291
+ * `SAP_SESSIONID` sends nothing. The instance is spent either way.
292
+ *
287
293
  * **Requests already in flight are not waited for, and the logoff ends the
288
294
  * session they are running on** — so they will start failing against a
289
295
  * session that no longer exists. That is the caller having asked to
@@ -300,6 +306,16 @@ declare abstract class AbstractAbapConnection implements AbapConnection, ISessio
300
306
  * answer.
301
307
  */
302
308
  disconnect(): Promise<void>;
309
+ /**
310
+ * Puts the cookies of a handed session into the wire, as `resume()` seeds
311
+ * its jar, and sends nothing: what the wire held goes first, and the
312
+ * session's cookies arrive as a `Set-Cookie` the wire folds in through its
313
+ * own `ingest()`. A wire whose session no cookie names (RFC) keeps nothing
314
+ * of it, and its close then has nothing to end. Never throws — it is
315
+ * reached from `disconnect()`: a custom wire that throws here is logged in
316
+ * fixed words (the cookies are never echoed) and its close decides alone.
317
+ */
318
+ private seedHandedSession;
303
319
  /**
304
320
  * Wait for SAP's answer to the last dispatched goodbye.
305
321
  *
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection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iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMlD;;;;;;;;OAQG;YACW,eAAe;IAU7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,aAAa;IAiCrB;;;;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"}
@@ -427,6 +427,12 @@ class AbstractAbapConnection {
427
427
  * `connect()` rejects, so a caller's `disconnect()` in its `finally` is the
428
428
  * first of that life and has nothing of it to wait for.
429
429
  *
430
+ * **On an instance built on an existing session, without `connect()`**, this
431
+ * logs that session off: the handed cookies go to the wire, and the logoff
432
+ * is sent with them as for any instance — no request before it, no
433
+ * credential, the provider's `prepare()` never called. A string naming no
434
+ * `SAP_SESSIONID` sends nothing. The instance is spent either way.
435
+ *
430
436
  * **Requests already in flight are not waited for, and the logoff ends the
431
437
  * session they are running on** — so they will start failing against a
432
438
  * session that no longer exists. That is the caller having asked to
@@ -467,6 +473,18 @@ class AbstractAbapConnection {
467
473
  // The context is taken now, while the session is still true: the clear
468
474
  // below runs while the close is suspended on its first await.
469
475
  const context = this.sessionContext();
476
+ // An instance built on an existing session whose `connect()` never took
477
+ // it over: the session is still the caller's handed string, held by
478
+ // nothing. The wire is given its cookies — no request, no credential,
479
+ // nothing asked of the provider — so the logoff below ends it as for any
480
+ // instance: sent only when they name a live `SAP_SESSIONID`, without
481
+ // `sap-contextid`. A caller ending a leftover session of a process that
482
+ // is gone wants neither a probe nor a logon for it.
483
+ if (this.resumeFrom !== null) {
484
+ const session = this.resumeFrom;
485
+ this.resumeFrom = null;
486
+ this.seedHandedSession(session);
487
+ }
470
488
  // Kept, not dropped: `flushGoodbye()` is how a caller who is about to
471
489
  // open a new connection waits for it. Rejections are absorbed here so that holding
472
490
  // the promise never turns a failed goodbye into an unhandled rejection —
@@ -484,6 +502,29 @@ class AbstractAbapConnection {
484
502
  // by the write.
485
503
  await written;
486
504
  }
505
+ /**
506
+ * Puts the cookies of a handed session into the wire, as `resume()` seeds
507
+ * its jar, and sends nothing: what the wire held goes first, and the
508
+ * session's cookies arrive as a `Set-Cookie` the wire folds in through its
509
+ * own `ingest()`. A wire whose session no cookie names (RFC) keeps nothing
510
+ * of it, and its close then has nothing to end. Never throws — it is
511
+ * reached from `disconnect()`: a custom wire that throws here is logged in
512
+ * fixed words (the cookies are never echoed) and its close decides alone.
513
+ */
514
+ seedHandedSession(session) {
515
+ try {
516
+ this.transport.forgetSession();
517
+ this.transport.ingest({
518
+ 'set-cookie': session
519
+ .split(';')
520
+ .map((entry) => entry.trim())
521
+ .filter((entry) => entry !== ''),
522
+ });
523
+ }
524
+ catch {
525
+ this.logger?.debug('Could not hand the session to the wire for its logoff');
526
+ }
527
+ }
487
528
  /**
488
529
  * Wait for SAP's answer to the last dispatched goodbye.
489
530
  *
@@ -15,27 +15,51 @@
15
15
  import type { SapConfig } from '../config/sapConfig.js';
16
16
  import type { IRfcConversation } from './RfcTransport.js';
17
17
  /**
18
- * Where the native client dials. What it logs on with is not here: the
19
- * provider writes that at each logon (`user`/`passwd`, or the SNC keys), and
20
- * the factory spreads it over these.
18
+ * Where the native client dials: one application server. What it logs on with
19
+ * is not here: the provider writes that at each logon (`user`/`passwd`, or the
20
+ * SNC keys), and the factory spreads it over these.
21
21
  */
22
22
  export interface RfcConnectionParams {
23
23
  ashost: string;
24
24
  sysnr: string;
25
25
  client: string;
26
26
  lang: string;
27
+ saprouter?: string;
27
28
  }
29
+ /**
30
+ * Where the native client dials: a message server, which picks an application
31
+ * server of the logon group (load-balanced logon). The keys are the SAP NW RFC
32
+ * SDK's own; one of `msserv` and `sysid` names the message server's service.
33
+ */
34
+ export interface RfcMessageServerParams {
35
+ mshost: string;
36
+ msserv?: string;
37
+ sysid?: string;
38
+ group: string;
39
+ client: string;
40
+ lang: string;
41
+ saprouter?: string;
42
+ }
43
+ /** One application server, or a message server and a logon group. */
44
+ export type RfcAddress = RfcConnectionParams | RfcMessageServerParams;
28
45
  /**
29
46
  * Read out of the config, never asked of the server.
30
47
  *
31
- * The system number comes off the HTTP port by the SAP convention that 80XX is
32
- * the ICM port for system XX — the convention the port itself follows, not a
33
- * guess about the deployment. `SAP_SYSNR` overrides it for a port that follows
34
- * no convention, which is the case on a system reached through 50400.
48
+ * **A message server**, when the config states `mshost`: the SDK needs the
49
+ * message server's service, so `msserv` or `sysid` must be there too, and the
50
+ * logon group is `group` or SAP's default `PUBLIC`. `url` then gives no host
51
+ * and no system number — the message server chooses the application server.
52
+ *
53
+ * **One application server** otherwise: the host comes off `url`, and the
54
+ * system number off the HTTP port by the SAP convention that 80XX is the ICM
55
+ * port for system XX — the convention the port itself follows, not a guess
56
+ * about the deployment. `SAP_SYSNR` overrides it for a port that follows no
57
+ * convention, which is the case on a system reached through 50400.
35
58
  *
36
- * The address only: no username or password is read from the config.
59
+ * `saprouter` goes with either. The address only: no username or password is
60
+ * read from the config.
37
61
  */
38
- export declare function rfcParamsFrom(config: SapConfig): RfcConnectionParams;
62
+ export declare function rfcParamsFrom(config: SapConfig): RfcAddress;
39
63
  /**
40
64
  * The factory `RfcTransport` asks for: the logon parameters the provider wrote
41
65
  * for this open go in, spread over the address from the config.
@@ -1 +1 @@
1
- {"version":3,"file":"rfcConversation.d.ts","sourceRoot":"","sources":["../../src/connection/rfcConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,mBAAmB,CAepE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,GAChB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,gBAAgB,CAoB/D"}
1
+ {"version":3,"file":"rfcConversation.d.ts","sourceRoot":"","sources":["../../src/connection/rfcConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qEAAqE;AACrE,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,sBAAsB,CAAC;AAEtE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAsC3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,GAChB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,gBAAgB,CAoB/D"}
@@ -19,16 +19,39 @@ exports.rfcConversationFrom = rfcConversationFrom;
19
19
  /**
20
20
  * Read out of the config, never asked of the server.
21
21
  *
22
- * The system number comes off the HTTP port by the SAP convention that 80XX is
23
- * the ICM port for system XX — the convention the port itself follows, not a
24
- * guess about the deployment. `SAP_SYSNR` overrides it for a port that follows
25
- * no convention, which is the case on a system reached through 50400.
22
+ * **A message server**, when the config states `mshost`: the SDK needs the
23
+ * message server's service, so `msserv` or `sysid` must be there too, and the
24
+ * logon group is `group` or SAP's default `PUBLIC`. `url` then gives no host
25
+ * and no system number — the message server chooses the application server.
26
26
  *
27
- * The address only: no username or password is read from the config.
27
+ * **One application server** otherwise: the host comes off `url`, and the
28
+ * system number off the HTTP port by the SAP convention that 80XX is the ICM
29
+ * port for system XX — the convention the port itself follows, not a guess
30
+ * about the deployment. `SAP_SYSNR` overrides it for a port that follows no
31
+ * convention, which is the case on a system reached through 50400.
32
+ *
33
+ * `saprouter` goes with either. The address only: no username or password is
34
+ * read from the config.
28
35
  */
29
36
  function rfcParamsFrom(config) {
37
+ const client = config.client || '000';
38
+ const router = config.saprouter ? { saprouter: config.saprouter } : {};
39
+ if (config.mshost) {
40
+ if (!config.msserv && !config.sysid) {
41
+ throw new Error('An RFC conversation through a message server needs msserv or sysid beside mshost');
42
+ }
43
+ return {
44
+ mshost: config.mshost,
45
+ ...(config.msserv ? { msserv: config.msserv } : {}),
46
+ ...(config.sysid ? { sysid: config.sysid } : {}),
47
+ group: config.group || 'PUBLIC',
48
+ client,
49
+ lang: 'EN',
50
+ ...router,
51
+ };
52
+ }
30
53
  if (!config.url) {
31
- throw new Error('An RFC conversation needs a url to take its host from');
54
+ throw new Error('An RFC conversation needs a url to take its host from, or mshost for a message server');
32
55
  }
33
56
  const parsed = new URL(config.url);
34
57
  const port = Number.parseInt(parsed.port || '8000', 10);
@@ -36,8 +59,9 @@ function rfcParamsFrom(config) {
36
59
  return {
37
60
  ashost: parsed.hostname,
38
61
  sysnr: process.env.SAP_SYSNR?.trim() || derived,
39
- client: config.client || '000',
62
+ client,
40
63
  lang: 'EN',
64
+ ...router,
41
65
  };
42
66
  }
43
67
  /**
package/dist/index.d.ts CHANGED
@@ -14,6 +14,6 @@ export type { IAdtEstablishContext, IAdtSessionContext, IAdtTransport, IAdtTrans
14
14
  export { LegacyOnPremHttpTransport } from './connection/LegacyOnPremHttpTransport.js';
15
15
  export { OnPremHttpTransport } from './connection/OnPremHttpTransport.js';
16
16
  export { type IRfcConversation, type IRfcTransportOptions, RfcTransport, } from './connection/RfcTransport.js';
17
- export { type RfcConnectionParams, rfcConversationFrom, rfcParamsFrom, } from './connection/rfcConversation.js';
17
+ export { type RfcAddress, type RfcConnectionParams, type RfcMessageServerParams, rfcConversationFrom, rfcParamsFrom, } from './connection/rfcConversation.js';
18
18
  export type { ILogger } from './logger.js';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -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;AA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AAC;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;AAGxE,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,kCAAkC,CAAC;AAQ1C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EACL,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,YAAY,GACb,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,mBAAmB,EACnB,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
package/docs/INDEX.md CHANGED
@@ -15,6 +15,7 @@ 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-18.0.md # rfcParamsFrom returns RfcAddress; RFC through a message server
18
19
  │ ├── MIGRATION-17.0.md # no deadline of the package's own; an instance on an existing session
19
20
  │ ├── MIGRATION-16.0.md # the request signal removed; disconnect() resolves once the logoff is written
20
21
  │ ├── MIGRATION-15.0.md # interfaces-adt-connection 2: makeAdtRequest answers unknown
@@ -48,6 +49,7 @@ mcp-abap-connection/
48
49
  - 🧭 [Scope](./SCOPE.md) - What this package answers for, and only that
49
50
 
50
51
  ### Upgrading
52
+ - 🚚 [Migrating to 18.0.0](./MIGRATION-18.0.md) - `rfcParamsFrom` returns `RfcAddress`; RFC through a message server and a logon group
51
53
  - 🚚 [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
54
  - 🚚 [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
53
55
  - 🚚 [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
@@ -0,0 +1,53 @@
1
+ # Migration to 18.0
2
+
3
+ 18.0.0 adds RFC logon through a message server and a logon group
4
+ (load-balanced logon). For a consumer on 17.x, the change is confined to the
5
+ types of one function.
6
+
7
+ ## What changed
8
+
9
+ - **`rfcParamsFrom(config)` returns `RfcAddress`.** That is
10
+ `RfcConnectionParams | RfcMessageServerParams`; before, it returned
11
+ `RfcConnectionParams`.
12
+ - A config with `mshost` yields a message-server address:
13
+ `{ mshost, msserv?, sysid?, group, client, lang, saprouter? }`.
14
+ - Any other config yields the application-server address as before:
15
+ `{ ashost, sysnr, client, lang, saprouter? }`.
16
+ - At run time nothing changes for a config without `mshost`. The break is in
17
+ the type: code that read `.ashost` or `.sysnr` straight off the result no
18
+ longer compiles.
19
+ - **New exported types:** `RfcAddress`, `RfcMessageServerParams`.
20
+ - **`RfcConnectionParams`** gains an optional `saprouter`.
21
+ - **`@mcp-abap-adt/interfaces-auth-sap` ^3.4.0** is required. It adds the
22
+ `ISapConfig` fields `mshost`, `msserv`, `sysid`, `group` and `saprouter`.
23
+
24
+ ## What to do
25
+
26
+ If you call `rfcParamsFrom` and read its fields, narrow first:
27
+
28
+ ```typescript
29
+ const params = rfcParamsFrom(config);
30
+ if ('ashost' in params) {
31
+ // one application server: params.ashost, params.sysnr
32
+ } else {
33
+ // a message server: params.mshost, params.msserv / params.sysid, params.group
34
+ }
35
+ ```
36
+
37
+ If you only pass the config to `rfcConversationFrom` or `createConnection`,
38
+ there is nothing to do.
39
+
40
+ ## Using a message server
41
+
42
+ Add `mshost`, plus `msserv` or `sysid` (one of the two is required), and
43
+ `group` (default `PUBLIC`) to the config. `saprouter` works with either
44
+ addressing. The url is still the system's ADT URL, but the RFC wire takes no
45
+ host and no system number from it, and `SAP_SYSNR` is not read.
46
+
47
+ **Verification status.** The message-server address follows the SAP NW RFC SDK's
48
+ own connection parameters, and it is unit-tested. It has **not yet been run
49
+ against a live message server**. In particular, `mshost` + `msserv` without
50
+ `sysid` is accepted here, but no SDK documentation found so far confirms that
51
+ combination. If the SDK refuses it, add `sysid`. The gated integration test in
52
+ `src/__tests__/rfc-connection.test.ts` (`SAP_MSHOST`, plus `SAP_MSSERV` or
53
+ `SAP_SYSID`) runs it on a system that has one.
package/docs/SCOPE.md CHANGED
@@ -12,7 +12,7 @@
12
12
  session is alive. The cookies of the instance's session are readable (`sessionCookies()`),
13
13
  for the caller to keep.
14
14
  3. **Requests.** Each carries the credential the `IAuthProvider` hands over, the CSRF token
15
- and the session's cookies. A request is sent stateful (`LOCK`, `UNLOCK`, activation) or
15
+ and the session's cookies. A request is sent stateful (`LOCK`, `UNLOCK`) or
16
16
  stateless; nothing else of the session is kept between requests. A request carries no
17
17
  deadline but the caller's own timeout.
18
18
  4. **SAP's answer** reaches the caller as SAP gave it.
package/docs/USAGE.md CHANGED
@@ -228,6 +228,34 @@ What `connect()` does then:
228
228
  The credential's logon moment (`establish`, which brings TLS material) is
229
229
  offered only after the session answered, so it never rides on that request.
230
230
 
231
+ **Logging a kept session off without `connect()`** (since 17.1.0). An instance
232
+ built with `session` may be disconnected without ever connecting — for a
233
+ leftover session of a process that is gone:
234
+
235
+ ```typescript
236
+ const leftover = createConnection({
237
+ system: 'onprem',
238
+ transport: 'http',
239
+ config,
240
+ credential: new BasicAuthProvider(config.username, config.password),
241
+ session: keptCookies,
242
+ });
243
+ await leftover.disconnect(); // the logoff has left; no connect() needed
244
+ await leftover.flushGoodbye(); // only if you need SAP's answer too
245
+ ```
246
+
247
+ `disconnect()` then sends **the logoff and nothing else**: the ICF logoff
248
+ (`/sap/public/bc/icf/logoff`, on cloud too — measured to end a cloud security
249
+ session) with the handed cookies, without `sap-contextid`, without the
250
+ credential and with no CSRF fetch or other request before it; the credential's
251
+ `prepare()` is never called. It resolves when the logoff is written, as always,
252
+ and `flushGoodbye()` waits for SAP's answer. A string that names no
253
+ `SAP_SESSIONID` sends nothing. The instance is spent either way: a second
254
+ `disconnect()` rejects, and so does a `connect()` after it. An instance built
255
+ without `session` sends nothing at a `disconnect()` before `connect()`, as
256
+ before. Whether the session was still alive is SAP's to know; the logoff's
257
+ answer is not read.
258
+
231
259
  Wrapping the connection with your own HTTP request logging stays with the
232
260
  consumer. That is a policy of yours, typically read from your environment, not
233
261
  a property of the wire. The factory passes `wireLogger` to the transport,
@@ -583,6 +611,9 @@ the logoff is the backstop, not the way to finish your work.
583
611
  retried.
584
612
  3. A successful `connect()` (200) sends no logoff; the session lives until
585
613
  `disconnect()`.
614
+ An instance built on a kept session (`session`) and never connected sends
615
+ it at `disconnect()` with the handed cookies when they name a
616
+ `SAP_SESSIONID_*` (see "Logging a kept session off without `connect()`").
586
617
  4. Where it goes: on-premise, the platform's ICF logoff
587
618
  (`/sap/public/bc/icf/logoff`). On cloud, the logoff resource the session
588
619
  document links to; when it links none, the same ICF logoff, sent exactly as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/connection",
3
- "version": "17.0.0",
3
+ "version": "18.0.0",
4
4
  "description": "ABAP connection layer for MCP ABAP ADT server",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,7 +53,7 @@
53
53
  "@mcp-abap-adt/auth-errors": "^2.2.1",
54
54
  "@mcp-abap-adt/interfaces-adt-connection": "^3.0.0",
55
55
  "@mcp-abap-adt/interfaces-auth": "^7.5.0",
56
- "@mcp-abap-adt/interfaces-auth-sap": "^3.3.0",
56
+ "@mcp-abap-adt/interfaces-auth-sap": "^3.4.0",
57
57
  "@mcp-abap-adt/interfaces-network": "^2.0.1",
58
58
  "@mcp-abap-adt/interfaces-utils": "^1.1.1",
59
59
  "axios": "^1.16.0"