@mcp-abap-adt/connection 17.1.0 → 18.0.1

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,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [18.0.1] - 2026-10-20
11
+
12
+ ### Fixed
13
+
14
+ - **A replaced session no longer leaks the session that replaced it.** When an answer
15
+ carried another session's `SAP_SESSIONID` (`ADT_SESSION_REPLACED` by the identity
16
+ policy), the connection cleared its cookies and sent nothing, so a later `disconnect()`
17
+ had no `SAP_SESSIONID` to log off and the session SAP opened under that answer stayed in
18
+ SM05 until its idle timeout — one per replacement. That session is now logged off at
19
+ the replacement, with the logoff `disconnect()` sends (its cookie, no `sap-contextid`,
20
+ the answer not read), and then the cookies are cleared as before. `disconnect()` waits
21
+ for its write and `flushGoodbye()` for its answer; a `connect()` whose establishment
22
+ found the session replaced rejects once it is written, and sends no second logoff for
23
+ it. A session reported gone (`400 "Session not found"`) and a `401` send nothing new.
24
+ `ADT_SESSION_REPLACED` reaches the caller as before; no retry, no timer. Over RFC no
25
+ answer can replace the conversation, so nothing changes there.
26
+
27
+ ## [18.0.0] - 2026-10-16
28
+
29
+ Migrating from 17.x: [docs/MIGRATION-18.0.md](./docs/MIGRATION-18.0.md).
30
+
31
+ ### Added
32
+
33
+ - **RFC through a message server and a logon group.** With `mshost` in the config,
34
+ `rfcParamsFrom` / `rfcConversationFrom` dial the message server: `mshost`, `msserv` or
35
+ `sysid` (one is required; a config with neither is refused naming both), and `group`
36
+ (default `PUBLIC`), passed to the SAP NW RFC SDK as its own keys. The url then gives no host
37
+ and no system number, and `SAP_SYSNR` is not read. `saprouter` is carried with either
38
+ addressing. Needs `@mcp-abap-adt/interfaces-auth-sap` ^3.4.0, which adds those `ISapConfig` fields; the dependency is raised to it.
39
+ - `RfcMessageServerParams` and `RfcAddress` (`RfcConnectionParams | RfcMessageServerParams`)
40
+ are exported; `RfcConnectionParams` gains an optional `saprouter`.
41
+ - **Not yet run against a live message server.** The address follows the SDK's own parameters
42
+ and is unit-tested; `mshost` + `msserv` without `sysid` is accepted but unconfirmed. If the SDK
43
+ refuses it, add `sysid`. The gated integration test covers it on a system that has one.
44
+
45
+ ### Changed (breaking)
46
+
47
+ - **`rfcParamsFrom` returns `RfcAddress`** instead of `RfcConnectionParams`. Nothing changes at
48
+ run time for a config without `mshost`, but a caller that read `.ashost` / `.sysnr` straight
49
+ from the result no longer compiles: narrow first (`'ashost' in params`). See the migration note.
50
+
10
51
  ## [17.1.0] - 2026-10-13
11
52
 
12
53
  What this package answers for is listed in [docs/SCOPE.md](./docs/SCOPE.md).
@@ -2648,7 +2689,9 @@ const connection = createAbapConnection(config, logger);
2648
2689
  - JWT token refresh now properly handles connection errors (401/403 during initial connect)
2649
2690
  - Permission errors (403 with "ExceptionResourceNoAccess") no longer trigger JWT refresh loops
2650
2691
  - Proper separation: base class handles HTTP/session, concrete classes handle auth-specific errors
2651
- [Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v17.1.0...HEAD
2692
+ [Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v18.0.1...HEAD
2693
+ [18.0.1]: https://github.com/fr0ster/mcp-abap-connection/compare/v18.0.0...v18.0.1
2694
+ [18.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v17.1.0...v18.0.0
2652
2695
  [17.1.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v17.0.0...v17.1.0
2653
2696
  [17.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v16.0.0...v17.0.0
2654
2697
  [16.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v15.1.0...v16.0.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
@@ -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;IAmIjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,EAAE,aAAa;IACjC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,I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AgB;IAqC9B;;;;;;;;OAQG;cACa,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,MAAgC,EAC5C,UAAU,GAAE,MAAgC;IAC5C;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,GAChD,OAAO,CAAC,MAAM,CAAC;IAkBlB,SAAS,CAAC,YAAY,IAAI,MAAM,GAAG,IAAI;IAIvC;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,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;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"}
@@ -776,7 +776,10 @@ class AbstractAbapConnection {
776
776
  // the status). A failed connect() takes no ENQUEUE lock. The answer is not
777
777
  // waited for, as a teardown does not wait for one; its failure was
778
778
  // absorbed above, so nothing goes unhandled.
779
- await goodbye.written;
779
+ // With the instance's earlier logoff, when it sent one: a session the
780
+ // establishment found replaced was logged off as it was found
781
+ // (`applyIdentityPolicy`), and this connect() is what it failed.
782
+ await Promise.all([goodbye.written, this.ended?.written]);
780
783
  throw error;
781
784
  }
782
785
  if (this.lifecycle.teardownEpoch !== baselineEpoch) {
@@ -998,6 +1001,23 @@ class AbstractAbapConnection {
998
1001
  applyIdentityPolicy(classification) {
999
1002
  if (classification !== 'replaced')
1000
1003
  return;
1004
+ // The answer that replaced the session brought a session of its own,
1005
+ // which SAP opened and which nothing here will ever use: it is logged off
1006
+ // now, while the wire still holds its cookie, as `disconnect()` logs off
1007
+ // any session — its `SAP_SESSIONID`, no `sap-contextid`, the answer not
1008
+ // read. The loss clears the cookies next, so a later `disconnect()` has
1009
+ // none to send, and without this the replacing session stayed in SM05
1010
+ // until its idle timeout — one per replacement. The old session is SAP's
1011
+ // to have ended. Kept with the instance's goodbye: `disconnect()` waits
1012
+ // for its write, `flushGoodbye()` for its answer — and a `connect()` this
1013
+ // replacement fails rejects only once it is written.
1014
+ //
1015
+ // The cookies go at once, as `disconnect()` drops them right after its
1016
+ // logoff: the wire took its snapshot synchronously, and any other path
1017
+ // that would end the session — a failed `connect()`'s logoff above all —
1018
+ // must find nothing left to send, or the same session is logged off twice.
1019
+ this.endSession(this.sessionContext());
1020
+ this.clearSessionState();
1001
1021
  this.raiseSessionLost('the session cookie changed under us');
1002
1022
  throw (0, SessionLifecycle_js_1.sessionError)(interfaces_adt_connection_1.ADT_SESSION_ERROR.SESSION_REPLACED, 'The SAP session this connection was using is gone and the requests are now on a different one; anything held against the old session — a lock and any write under it — is dead. ' +
1003
1023
  'The server does not swap sessions on a whim: the usual causes are the session idling out (the timeout is idle-based, so a quiet connection loses it while a busy one does not) or a request landing on a different application server. ' +
@@ -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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AM,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
@@ -692,6 +692,18 @@ After either of these, `connect()` and every request on the instance reject
692
692
  still holds a live `SAP_SESSIONID`, and after a loss the connection has
693
693
  already cleared its cookies, so it sends nothing.
694
694
 
695
+ **A replacement logs the replacing session off** (since 18.0.1). The answer
696
+ that replaced the session carried the `SAP_SESSIONID` of a new one, which SAP
697
+ opened and nothing will use; the connection sends it the same logoff
698
+ `disconnect()` sends — that cookie, no `sap-contextid`, the answer not read —
699
+ before it clears the cookies, so it does not stay in SM05 until its idle
700
+ timeout. `disconnect()` waits for that logoff's write, `flushGoodbye()` for
701
+ its answer; a `connect()` that found its session replaced rejects once it is
702
+ written. The old session SAP already ended, and a session reported gone
703
+ (`400 "Session not found"`) brought no new one: nothing is sent for either.
704
+ `ADT_SESSION_REPLACED` reaches the caller as before. Over RFC the
705
+ conversation is the session and no answer can replace it.
706
+
695
707
  ## Advanced Features
696
708
 
697
709
  ### Session ID Management
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/connection",
3
- "version": "17.1.0",
3
+ "version": "18.0.1",
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"