@mcp-abap-adt/connection 20.0.0 → 20.1.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,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [20.1.0] - 2026-11-09
11
+
12
+ A request runs in its `sap-language` over RFC as it does over HTTP.
13
+
14
+ ### Fixed
15
+
16
+ - **`RfcTransport` honours a request's `sap-language`.** `SADT_REST_RFC_ENDPOINT` has no ICF
17
+ logon: it ran every request in the conversation's logon language and ignored `sap-language`
18
+ as a header, a query parameter or a body attribute — a class created with `sap-language: RU`
19
+ on an EN logon got master language EN, where over HTTP it gets RU (measured on S/4HANA 2025).
20
+ Now a non-stateful request whose `sap-language` (a header, or the query parameter in `params`
21
+ or in the URL) names another language than the logon language of the conversation that would
22
+ carry it — the `lang` its logon carries: the provider's where it writes one, else the
23
+ factory's — goes on a conversation logged on in that language (its `lang` over any the
24
+ provider writes), opened for that call and closed after it, whatever the answer — a logger
25
+ that throws included; nothing is kept. A stateful request naming another language than the
26
+ stateful conversation's is refused before anything is sent, in words naming both languages: a session cannot change its language. A request naming two different
27
+ languages is refused the same way. Language keys are compared without case; the same
28
+ language, or none, goes as before. `HttpTransport` is unchanged. Measured on E19 (2026-11-09):
29
+ a class created over RFC with `sap-language: RU` on an EN logon reads back
30
+ `adtcore:masterLanguage="RU"`.
31
+ - **`RfcTransport.close()` closes every conversation whatever a close or the logger does.** A
32
+ stateless conversation whose close rejected, under a logger whose `debug` threw, stopped
33
+ `close()` before the stateful conversation was closed. Every close-path log line is now
34
+ written so that it cannot throw.
35
+
36
+ ### Added
37
+
38
+ - **`RfcConversationFactory`**: what `RfcTransport` takes — the factory function, and its logon
39
+ `language` where stated. `rfcConversationFrom(config)` states the config's `language`. A plain
40
+ factory function still compiles; one that states no `language`, under a provider that writes no
41
+ `lang`, has every request naming a `sap-language` treated as naming another one.
42
+
10
43
  ## [20.0.0] - 2026-11-08
11
44
 
12
45
  An RFC destination states its own address. Breaking for an RFC config and for code that reads
@@ -2837,7 +2870,8 @@ const connection = createAbapConnection(config, logger);
2837
2870
  - JWT token refresh now properly handles connection errors (401/403 during initial connect)
2838
2871
  - Permission errors (403 with "ExceptionResourceNoAccess") no longer trigger JWT refresh loops
2839
2872
  - Proper separation: base class handles HTTP/session, concrete classes handle auth-specific errors
2840
- [Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v20.0.0...HEAD
2873
+ [Unreleased]: https://github.com/fr0ster/mcp-abap-connection/compare/v20.1.0...HEAD
2874
+ [20.1.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v20.0.0...v20.1.0
2841
2875
  [20.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v19.1.0...v20.0.0
2842
2876
  [19.1.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v19.0.0...v19.1.0
2843
2877
  [19.0.0]: https://github.com/fr0ster/mcp-abap-connection/compare/v18.0.1...v19.0.0
package/README.md CHANGED
@@ -908,7 +908,9 @@ install rather than at construction.
908
908
  ```text
909
909
  function rfcConversationFrom(
910
910
  config: SapRfcConfig,
911
- ): (logon: Readonly<Record<string, string>>) => IRfcConversation;
911
+ ): RfcConversationFactory & { readonly language: string };
912
+ // RfcConversationFactory = ((logon: Readonly<Record<string, string>>) => IRfcConversation)
913
+ // & { readonly language?: string } // the logon language
912
914
  function rfcParamsFrom(config: SapRfcConfig): RfcAddress; // the address only
913
915
  // RfcAddress = RfcConnectionParams (ashost, sysnr) | RfcMessageServerParams (mshost, msserv and/or sysid, group)
914
916
  ```
@@ -943,6 +945,41 @@ themselves are not redacted, so read a captured log before pasting it into an
943
945
  issue. `HttpTransport` never logs bodies, so this is the one wire whose debug
944
946
  channel can be asked for the payload.
945
947
 
948
+ #### A request's language over RFC
949
+
950
+ A request runs in the language its `sap-language` names — a header, or the
951
+ `sap-language` query parameter in `params` or in the URL — on both wires. Over
952
+ HTTP the ICF layer reads it. `SADT_REST_RFC_ENDPOINT` runs a request in its
953
+ conversation's logon language and ignores `sap-language`, so `RfcTransport`
954
+ compares the two (SAP language keys, without case) — the request's language
955
+ with the logon language of the conversation that would carry it. A
956
+ conversation's logon language is the `lang` its logon carries: the provider's,
957
+ where it writes one among its logon parameters at that logon, else the one the
958
+ factory states (`rfcConversationFrom` states the config's `language`):
959
+
960
+ - **None named:** the request goes as any other.
961
+ - **A stateful request** is compared with the stateful conversation's logon
962
+ language.
963
+ - **A non-stateful request** is compared with the kept stateless
964
+ conversation's logon language — once it is open, the language it logged on
965
+ in; before, the language the provider's logon parameters for it name. The
966
+ same language: it goes on the kept conversation, as any other. Another: it
967
+ goes on a conversation logged on in the request's language (`lang` as the
968
+ request names it, over any `lang` the provider writes), opened for that one
969
+ call and closed when it answers, whatever the answer. Nothing is kept: the
970
+ next such call logs on again.
971
+ - **A stateful request in another language** (a `LOCK`, an `UNLOCK`, anything
972
+ in the lock's session): refused before anything is sent, with an error naming
973
+ both languages — a session cannot change its language. Connect with the
974
+ language the locked work needs.
975
+ - **Two different languages named on one request:** refused before anything is
976
+ sent.
977
+
978
+ A factory of your own that does not state `language`, with a provider that
979
+ writes no `lang`, leaves the wire without a logon language to compare: every
980
+ non-stateful request naming a `sap-language` then takes a conversation of its
981
+ own in that language, and every stateful one naming it is refused.
982
+
946
983
  #### `CSRF_CONFIG` and `CSRF_ERROR_MESSAGES`
947
984
 
948
985
  **New in 0.1.13+:** Exported constants for consistent CSRF token handling across different connection implementations.
@@ -39,6 +39,18 @@
39
39
  * Eclipse's JCo trace carries no session header either. A transport that
40
40
  * also captured cookies would be doing that work twice, and the two copies
41
41
  * would disagree the first time one of them was cleared.
42
+ *
43
+ * **A request's language.** Over HTTP the ICF layer reads `sap-language` — a
44
+ * header or a query parameter — and runs the request in it. This endpoint has
45
+ * no ICF logon: it runs a request in the conversation's logon language and
46
+ * ignores `sap-language` wherever it is written (measured on S/4HANA 2025,
47
+ * 2026-11-09). So a request's `sap-language` is compared with the logon
48
+ * language of the conversation that would carry it — the `lang` its logon
49
+ * carries: the provider's where it wrote one, else the factory's. Another
50
+ * language: a non-stateful request goes on a conversation logged on in it,
51
+ * opened for that call and closed after it, nothing kept; a stateful one is
52
+ * refused before anything is sent, because a session cannot change its
53
+ * language.
42
54
  */
43
55
  import type { ILogger } from '../logger.js';
44
56
  import type { IAdtEstablishContext, IAdtSessionContext, IAdtTransportRequest, IAdtTransportResponse, IOnPremTransport } from './IAdtTransport.js';
@@ -56,6 +68,18 @@ export interface IRfcConversation {
56
68
  */
57
69
  resetServerContext?(): Promise<void>;
58
70
  }
71
+ /**
72
+ * What `RfcTransport` opens its conversations with: the logon parameters the
73
+ * provider wrote go in, a conversation comes out. `language` is the logon
74
+ * language a conversation opens in when its logon names no `lang`, where the
75
+ * factory states it — `rfcConversationFrom` does, from the config. The
76
+ * effective logon language is the `lang` the logon carried, else this. Where
77
+ * neither states one, the wire cannot know the logon language, and every
78
+ * request that names a `sap-language` is treated as naming another one.
79
+ */
80
+ export type RfcConversationFactory = ((logon: Readonly<Record<string, string>>) => IRfcConversation) & {
81
+ readonly language?: string;
82
+ };
59
83
  /** What this wire does beyond carrying the request. */
60
84
  export interface IRfcTransportOptions {
61
85
  /**
@@ -102,6 +126,15 @@ export declare class RfcTransport implements IOnPremTransport {
102
126
  private canReset;
103
127
  /** Names the conversation, and so the ABAP session it carries. */
104
128
  private conversationId;
129
+ /**
130
+ * The language the stateful conversation logged on in: the `lang` its logon
131
+ * carried — the provider's where it wrote one, else the factory's. What a
132
+ * request's `sap-language` is compared with. `undefined` when neither
133
+ * states one.
134
+ */
135
+ private logonLanguage;
136
+ /** The language the kept stateless conversation logged on in, the same way. */
137
+ private statelessLanguage;
105
138
  /**
106
139
  * Where each logon asks the provider what to open with. Kept from `open()`;
107
140
  * `null` when the wire is driven without a lifecycle, and then a conversation
@@ -160,7 +193,7 @@ export declare class RfcTransport implements IOnPremTransport {
160
193
  * that reached for it in its constructor could not be built at all on a
161
194
  * machine without it.
162
195
  */
163
- constructor(connect: (logon: Readonly<Record<string, string>>) => IRfcConversation, logger?: ILogger | null, options?: IRfcTransportOptions);
196
+ constructor(connect: RfcConversationFactory, logger?: ILogger | null, options?: IRfcTransportOptions);
164
197
  /** Cut a body down to what a log line may carry. */
165
198
  private clipped;
166
199
  open(context?: IAdtSessionContext): Promise<void>;
@@ -180,15 +213,23 @@ export declare class RfcTransport implements IOnPremTransport {
180
213
  * before the first one's reset would run in the first one's context — a
181
214
  * package the first one saved would refuse the second one's write (PAK/058).
182
215
  * So a concurrent call takes a conversation of its own instead of waiting.
216
+ *
217
+ * A request that names a `sap-language` runs on a conversation logged on in
218
+ * it: the kept one when that one's logon language is the same, else one of
219
+ * its own logged on with that `lang`, closed after the call.
183
220
  */
184
221
  private carryOnItsOwn;
185
222
  private carryOnKept;
186
- /** A conversation opened for this one call, closed when it answers. */
223
+ /**
224
+ * A conversation opened for this one call with `parameters`, closed when it
225
+ * answers, whatever the answer.
226
+ */
187
227
  private carryOnThrowaway;
188
228
  /**
189
- * A new conversation, logged on. The logon takes time (~0.5 s on E19); if the
190
- * wire was closed meanwhile, the conversation is closed again and nothing is
191
- * sent — not a PUT, not a DELETE — on a wire already given back.
229
+ * A new conversation, logged on with `parameters`. The logon takes time
230
+ * (~0.5 s on E19); if the wire was closed meanwhile, the conversation is
231
+ * closed again and nothing is sent — not a PUT, not a DELETE — on a wire
232
+ * already given back.
192
233
  */
193
234
  private openOwn;
194
235
  /**
@@ -199,12 +240,26 @@ export declare class RfcTransport implements IOnPremTransport {
199
240
  * and whether that matters is the provider's call.
200
241
  */
201
242
  private logonTarget;
243
+ /** What the provider writes for one logon: asked every time. */
244
+ private logonParameters;
245
+ /**
246
+ * The language a logon with `parameters` logs on in: its `lang` — the
247
+ * provider's, or the one a call in another language put over it — else the
248
+ * factory's.
249
+ */
250
+ private languageOf;
251
+ /**
252
+ * A new conversation, logged on with `parameters`; a failed open is a
253
+ * refused logon whose cause is the SDK's own error, untouched — a provider
254
+ * reads its `key` and message.
255
+ */
256
+ private openedWith;
202
257
  /**
203
- * A new conversation, logged on: the provider is asked what to open with,
204
- * every time, and a failed open is a refused logon whose cause is the SDK's
205
- * own error, untouched — a provider reads its `key` and message.
258
+ * A debug line that cannot throw: the line is built and written inside the
259
+ * guard, so neither a value that will not stringify nor a logger that throws
260
+ * stops what logs it — a close above all.
206
261
  */
207
- private loggedOn;
262
+ private logQuietly;
208
263
  private closeQuietly;
209
264
  private carry;
210
265
  }
@@ -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;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,kBAAkB,CA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B;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAM7B;;;;;OAKG;IACG,SAAS,CAAC,QAAQ,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAE9D,+BAA+B;IAC/B,SAAS,IAAI,IAAI;IAIjB;;;OAGG;IACH,cAAc,IAAI,IAAI;IAEtB;;;OAGG;IACH,6EAA6E;IAC7E,kBAAkB,IAAI,OAAO;IAI7B,kBAAkB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAQzC,2EAA2E;IAC3E,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAIzC;;;;OAIG;IACH,aAAa,IAAI,IAAI;IAErB;;;;;OAKG;gBAEgB,OAAO,EAAE,sBAAsB,EAC/B,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;IAsBvD,0DAA0D;IACpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BtB,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAuBzE;;;;;;;;;;;;;;;;;OAiBG;YACW,aAAa;YAeb,WAAW;IA+EzB;;;OAGG;YACW,gBAAgB;IAc9B;;;;;OAKG;YACW,OAAO;IAcrB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAgBnB,gEAAgE;YAClD,eAAe;IAM7B;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAMlB;;;;OAIG;YACW,UAAU;IAYxB;;;;OAIG;IACH,OAAO,CAAC,UAAU;YAQJ,YAAY;YAQZ,KAAK;CA+KpB"}
@@ -40,6 +40,18 @@
40
40
  * Eclipse's JCo trace carries no session header either. A transport that
41
41
  * also captured cookies would be doing that work twice, and the two copies
42
42
  * would disagree the first time one of them was cleared.
43
+ *
44
+ * **A request's language.** Over HTTP the ICF layer reads `sap-language` — a
45
+ * header or a query parameter — and runs the request in it. This endpoint has
46
+ * no ICF logon: it runs a request in the conversation's logon language and
47
+ * ignores `sap-language` wherever it is written (measured on S/4HANA 2025,
48
+ * 2026-11-09). So a request's `sap-language` is compared with the logon
49
+ * language of the conversation that would carry it — the `lang` its logon
50
+ * carries: the provider's where it wrote one, else the factory's. Another
51
+ * language: a non-stateful request goes on a conversation logged on in it,
52
+ * opened for that call and closed after it, nothing kept; a stateful one is
53
+ * refused before anything is sent, because a session cannot change its
54
+ * language.
43
55
  */
44
56
  Object.defineProperty(exports, "__esModule", { value: true });
45
57
  exports.RfcTransport = void 0;
@@ -56,6 +68,71 @@ function record(value) {
56
68
  ? value
57
69
  : undefined;
58
70
  }
71
+ /** The header and query parameter that name the language a request runs in. */
72
+ const LANGUAGE_FIELD = 'sap-language';
73
+ /**
74
+ * The language a request names in `sap-language` — a header, a query
75
+ * parameter in `params`, or one written into the URL — or `undefined` when it
76
+ * names none. Names are read without case, as HTTP reads them; an empty value
77
+ * names no language. A request that names two different languages is refused:
78
+ * which of them a system would take is not something this wire decides.
79
+ */
80
+ function requestedLanguage(request) {
81
+ const named = [];
82
+ for (const [name, value] of Object.entries(request.headers ?? {})) {
83
+ if (name.toLowerCase() === LANGUAGE_FIELD)
84
+ named.push(String(value));
85
+ }
86
+ for (const [name, value] of Object.entries(request.params ?? {})) {
87
+ if (name.toLowerCase() === LANGUAGE_FIELD &&
88
+ value !== undefined &&
89
+ value !== null) {
90
+ named.push(String(value));
91
+ }
92
+ }
93
+ const queryStart = request.url.indexOf('?');
94
+ if (queryStart >= 0) {
95
+ const query = new URLSearchParams(request.url.slice(queryStart + 1));
96
+ for (const [name, value] of query) {
97
+ if (name.toLowerCase() === LANGUAGE_FIELD)
98
+ named.push(value);
99
+ }
100
+ }
101
+ let language;
102
+ for (const value of named) {
103
+ if (value === '')
104
+ continue;
105
+ if (language === undefined) {
106
+ language = value;
107
+ }
108
+ else if (!sameLanguage(language, value)) {
109
+ throw new Error(`The request names two languages in ${LANGUAGE_FIELD}, ${language} and ${value}; nothing was sent.`);
110
+ }
111
+ }
112
+ return language;
113
+ }
114
+ /**
115
+ * `language` when a request names it and the conversation's logon language is
116
+ * another (or unknown); `undefined` when it names none or the same one.
117
+ */
118
+ function otherLanguage(language, logonLanguage) {
119
+ return language !== undefined && !sameLanguage(language, logonLanguage)
120
+ ? language
121
+ : undefined;
122
+ }
123
+ /**
124
+ * The provider's logon parameters, with the request's language as `lang` over
125
+ * any `lang` the provider wrote — or as they are when the request names none.
126
+ */
127
+ function inLanguage(parameters, language) {
128
+ return language === undefined
129
+ ? parameters
130
+ : { ...parameters, lang: language };
131
+ }
132
+ /** SAP language keys are read without case: `ru` and `RU` are one language. */
133
+ function sameLanguage(a, b) {
134
+ return b !== undefined && a.toUpperCase() === b.toUpperCase();
135
+ }
59
136
  /**
60
137
  * ADT exception types, mapped to what they would have been over HTTP. Standard
61
138
  * types, returned in `<exc:exception>` XML.
@@ -152,6 +229,15 @@ class RfcTransport {
152
229
  canReset;
153
230
  /** Names the conversation, and so the ABAP session it carries. */
154
231
  conversationId = '';
232
+ /**
233
+ * The language the stateful conversation logged on in: the `lang` its logon
234
+ * carried — the provider's where it wrote one, else the factory's. What a
235
+ * request's `sap-language` is compared with. `undefined` when neither
236
+ * states one.
237
+ */
238
+ logonLanguage;
239
+ /** The language the kept stateless conversation logged on in, the same way. */
240
+ statelessLanguage;
155
241
  /**
156
242
  * Where each logon asks the provider what to open with. Kept from `open()`;
157
243
  * `null` when the wire is driven without a lifecycle, and then a conversation
@@ -251,7 +337,8 @@ class RfcTransport {
251
337
  if (this.conversation?.alive)
252
338
  return;
253
339
  const generation = this.generation;
254
- const conversation = await this.loggedOn();
340
+ const parameters = await this.logonParameters();
341
+ const conversation = await this.openedWith(parameters);
255
342
  // close() ran while this logged on: the session it would have handed out
256
343
  // belongs to a wire already given back, so it is closed, not kept.
257
344
  if (generation !== this.generation) {
@@ -259,6 +346,7 @@ class RfcTransport {
259
346
  throw new Error('RFC transport was closed while it was being opened.');
260
347
  }
261
348
  this.conversation = conversation;
349
+ this.logonLanguage = this.languageOf(parameters);
262
350
  // Minted here, where the session begins. A conversation opened after an
263
351
  // earlier one closed is a DIFFERENT ABAP session, and the fingerprint has
264
352
  // to say so — a constant would report `unchanged` across a reconnect and
@@ -281,17 +369,20 @@ class RfcTransport {
281
369
  this.stateless = null;
282
370
  this.conversation = null;
283
371
  this.conversationId = '';
372
+ this.logonLanguage = undefined;
373
+ this.statelessLanguage = undefined;
284
374
  if (stateless)
285
375
  await this.closeQuietly(stateless);
286
376
  if (!conversation)
287
377
  return;
288
378
  try {
289
379
  await conversation.close();
290
- this.logger?.debug('RFC conversation closed');
291
380
  }
292
381
  catch (e) {
293
- this.logger?.debug(`RFC close error: ${message(e)}`);
382
+ this.logQuietly(() => `RFC close error: ${message(e)}`);
383
+ return;
294
384
  }
385
+ this.logQuietly(() => 'RFC conversation closed');
295
386
  }
296
387
  async send(request) {
297
388
  if (!this.conversation?.alive) {
@@ -303,9 +394,15 @@ class RfcTransport {
303
394
  // Taken once, here: every await below compares against it, and a call
304
395
  // that finds the wire closed since it began sends nothing.
305
396
  const generation = this.generation;
306
- return (0, statefulRequest_js_1.isStatefulRequest)(request)
307
- ? this.carry(request, this.conversation, generation)
308
- : this.carryOnItsOwn(request, generation);
397
+ const language = requestedLanguage(request);
398
+ if ((0, statefulRequest_js_1.isStatefulRequest)(request)) {
399
+ const other = otherLanguage(language, this.logonLanguage);
400
+ if (other !== undefined) {
401
+ throw new Error(`The request asks for ${LANGUAGE_FIELD} ${other}, but the stateful RFC session is logged on in ${this.logonLanguage ?? 'a language neither the RFC conversation factory nor the provider states'}: a session cannot change its language, so the request was not sent.`);
402
+ }
403
+ return this.carry(request, this.conversation, generation);
404
+ }
405
+ return this.carryOnItsOwn(request, language, generation);
309
406
  }
310
407
  /**
311
408
  * A request that is not stateful, in a fresh ABAP session.
@@ -320,18 +417,29 @@ class RfcTransport {
320
417
  * before the first one's reset would run in the first one's context — a
321
418
  * package the first one saved would refuse the second one's write (PAK/058).
322
419
  * So a concurrent call takes a conversation of its own instead of waiting.
420
+ *
421
+ * A request that names a `sap-language` runs on a conversation logged on in
422
+ * it: the kept one when that one's logon language is the same, else one of
423
+ * its own logged on with that `lang`, closed after the call.
323
424
  */
324
- async carryOnItsOwn(request, generation) {
425
+ async carryOnItsOwn(request, language, generation) {
325
426
  if (this.canReset !== false && !this.statelessBusy) {
326
- return this.carryOnKept(request, generation);
427
+ return this.carryOnKept(request, language, generation);
327
428
  }
328
- return this.carryOnThrowaway(request, generation);
429
+ return this.carryOnThrowaway(request, inLanguage(await this.logonParameters(), language), generation);
329
430
  }
330
- async carryOnKept(request, generation) {
431
+ async carryOnKept(request, language, generation) {
331
432
  this.statelessBusy = true;
332
433
  try {
333
- if (!this.stateless?.alive) {
334
- const opened = await this.openOwn(generation);
434
+ let kept = this.stateless;
435
+ if (!kept?.alive) {
436
+ // The provider is asked first: what it writes says which language the
437
+ // kept conversation would log on in, before any logon is made.
438
+ const parameters = await this.logonParameters();
439
+ if (otherLanguage(language, this.languageOf(parameters)) !== undefined) {
440
+ return await this.carryOnThrowaway(request, inLanguage(parameters, language), generation);
441
+ }
442
+ const opened = await this.openOwn(parameters, generation);
335
443
  // Checked again after the await: close() may have run since openOwn()
336
444
  // checked, and a conversation of a closed wire must not become the
337
445
  // kept one of the next.
@@ -352,9 +460,13 @@ class RfcTransport {
352
460
  }
353
461
  this.canReset = true;
354
462
  this.stateless = opened;
463
+ this.statelessLanguage = this.languageOf(parameters);
464
+ kept = opened;
355
465
  this.logger?.debug('RFC stateless conversation opened (reset per call)');
356
466
  }
357
- const kept = this.stateless;
467
+ else if (otherLanguage(language, this.statelessLanguage) !== undefined) {
468
+ return await this.carryOnThrowaway(request, inLanguage(await this.logonParameters(), language), generation);
469
+ }
358
470
  try {
359
471
  return await this.carry(request, kept, generation);
360
472
  }
@@ -364,9 +476,11 @@ class RfcTransport {
364
476
  }
365
477
  catch (e) {
366
478
  // A context that could not be reset must not serve the next call.
367
- this.logger?.debug(`RFC reset failed, dropping the conversation: ${message(e)}`);
368
- if (this.stateless === kept)
479
+ this.logQuietly(() => `RFC reset failed, dropping the conversation: ${message(e)}`);
480
+ if (this.stateless === kept) {
369
481
  this.stateless = null;
482
+ this.statelessLanguage = undefined;
483
+ }
370
484
  await this.closeQuietly(kept);
371
485
  }
372
486
  }
@@ -375,11 +489,14 @@ class RfcTransport {
375
489
  this.statelessBusy = false;
376
490
  }
377
491
  }
378
- /** A conversation opened for this one call, closed when it answers. */
379
- async carryOnThrowaway(request, generation) {
380
- const own = await this.openOwn(generation);
381
- this.logger?.debug('RFC conversation opened for one stateless call');
492
+ /**
493
+ * A conversation opened for this one call with `parameters`, closed when it
494
+ * answers, whatever the answer.
495
+ */
496
+ async carryOnThrowaway(request, parameters, generation) {
497
+ const own = await this.openOwn(parameters, generation);
382
498
  try {
499
+ this.logger?.debug('RFC conversation opened for one stateless call');
383
500
  return await this.carry(request, own, generation);
384
501
  }
385
502
  finally {
@@ -387,12 +504,13 @@ class RfcTransport {
387
504
  }
388
505
  }
389
506
  /**
390
- * A new conversation, logged on. The logon takes time (~0.5 s on E19); if the
391
- * wire was closed meanwhile, the conversation is closed again and nothing is
392
- * sent — not a PUT, not a DELETE — on a wire already given back.
507
+ * A new conversation, logged on with `parameters`. The logon takes time
508
+ * (~0.5 s on E19); if the wire was closed meanwhile, the conversation is
509
+ * closed again and nothing is sent — not a PUT, not a DELETE — on a wire
510
+ * already given back.
393
511
  */
394
- async openOwn(generation) {
395
- const own = await this.loggedOn();
512
+ async openOwn(parameters, generation) {
513
+ const own = await this.openedWith(parameters);
396
514
  if (generation !== this.generation || !this.conversation?.alive) {
397
515
  await this.closeQuietly(own);
398
516
  throw new Error('RFC transport was closed while the call was being opened; nothing was sent.');
@@ -421,14 +539,26 @@ class RfcTransport {
421
539
  },
422
540
  };
423
541
  }
424
- /**
425
- * A new conversation, logged on: the provider is asked what to open with,
426
- * every time, and a failed open is a refused logon whose cause is the SDK's
427
- * own error, untouched — a provider reads its `key` and message.
428
- */
429
- async loggedOn() {
542
+ /** What the provider writes for one logon: asked every time. */
543
+ async logonParameters() {
430
544
  const parameters = {};
431
545
  await this.context?.logon(this.logonTarget(parameters));
546
+ return parameters;
547
+ }
548
+ /**
549
+ * The language a logon with `parameters` logs on in: its `lang` — the
550
+ * provider's, or the one a call in another language put over it — else the
551
+ * factory's.
552
+ */
553
+ languageOf(parameters) {
554
+ return parameters.lang ?? this.connect.language;
555
+ }
556
+ /**
557
+ * A new conversation, logged on with `parameters`; a failed open is a
558
+ * refused logon whose cause is the SDK's own error, untouched — a provider
559
+ * reads its `key` and message.
560
+ */
561
+ async openedWith(parameters) {
432
562
  const conversation = this.connect(parameters);
433
563
  try {
434
564
  await conversation.open();
@@ -438,12 +568,25 @@ class RfcTransport {
438
568
  }
439
569
  return conversation;
440
570
  }
571
+ /**
572
+ * A debug line that cannot throw: the line is built and written inside the
573
+ * guard, so neither a value that will not stringify nor a logger that throws
574
+ * stops what logs it — a close above all.
575
+ */
576
+ logQuietly(line) {
577
+ try {
578
+ this.logger?.debug(line());
579
+ }
580
+ catch {
581
+ // A broken logger must not stop a close; there is nowhere left to say so.
582
+ }
583
+ }
441
584
  async closeQuietly(conversation) {
442
585
  try {
443
586
  await conversation.close();
444
587
  }
445
588
  catch (e) {
446
- this.logger?.debug(`RFC close error: ${message(e)}`);
589
+ this.logQuietly(() => `RFC close error: ${message(e)}`);
447
590
  }
448
591
  }
449
592
  async carry(request, conversation, generation) {
@@ -12,7 +12,7 @@
12
12
  * conversation is actually opened.
13
13
  */
14
14
  import type { ISapRfcConfig } from '@mcp-abap-adt/interfaces-auth-sap';
15
- import type { IRfcConversation } from './RfcTransport.js';
15
+ import type { RfcConversationFactory } from './RfcTransport.js';
16
16
  /**
17
17
  * Where the native client dials: one application server. What it logs on with
18
18
  * is not here: the provider writes that at each logon (`user`/`passwd`, or the
@@ -64,10 +64,15 @@ export declare function rfcParamsFrom(config: ISapRfcConfig): RfcAddress;
64
64
  * for this open go in, spread over the address the config states; nothing
65
65
  * else is added.
66
66
  *
67
+ * It states its logon language (`language`, the config's), so `RfcTransport`
68
+ * can tell a request that names another `sap-language` apart.
69
+ *
67
70
  * The SDK is loaded when a conversation is opened, not when this is called, so
68
71
  * a consumer can build the transport on a machine that has no SDK and find out
69
72
  * at `connect()` rather than at construction — with a message that says what to
70
73
  * install.
71
74
  */
72
- export declare function rfcConversationFrom(config: ISapRfcConfig): (logon: Readonly<Record<string, string>>) => IRfcConversation;
75
+ export declare function rfcConversationFrom(config: ISapRfcConfig): RfcConversationFactory & {
76
+ readonly language: string;
77
+ };
73
78
  //# sourceMappingURL=rfcConversation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rfcConversation.d.ts","sourceRoot":"","sources":["../../src/connection/rfcConversation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,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,MAAM,sBAAsB,GAAG;IACnC,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,GAAG,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,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AAC;AAE9E,qEAAqE;AACrE,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,sBAAsB,CAAC;AAEtE;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,UAAU,CAiB/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,GACpB,sBAAsB,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAwBxD"}
@@ -47,6 +47,9 @@ function rfcParamsFrom(config) {
47
47
  * for this open go in, spread over the address the config states; nothing
48
48
  * else is added.
49
49
  *
50
+ * It states its logon language (`language`, the config's), so `RfcTransport`
51
+ * can tell a request that names another `sap-language` apart.
52
+ *
50
53
  * The SDK is loaded when a conversation is opened, not when this is called, so
51
54
  * a consumer can build the transport on a machine that has no SDK and find out
52
55
  * at `connect()` rather than at construction — with a message that says what to
@@ -54,7 +57,7 @@ function rfcParamsFrom(config) {
54
57
  */
55
58
  function rfcConversationFrom(config) {
56
59
  const params = rfcParamsFrom(config);
57
- return (logon) => {
60
+ const open = (logon) => {
58
61
  let Client;
59
62
  try {
60
63
  // Dynamic, because the SDK is an optional peer: it needs the SAP NW RFC
@@ -68,4 +71,8 @@ function rfcConversationFrom(config) {
68
71
  }
69
72
  return new Client({ ...params, ...logon });
70
73
  };
74
+ // The language every conversation it opens logs on in, unless the logon
75
+ // names another: what `RfcTransport` tells a request's `sap-language` apart
76
+ // from.
77
+ return Object.assign(open, { language: params.lang });
71
78
  }
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export { type HttpClientAgents, type HttpClientFactory, HttpTransport, nodeHttpC
13
13
  export type { IAdtEstablishContext, IAdtSessionContext, IAdtTransport, IAdtTransportRequest, IAdtTransportResponse, ICloudTransport, IOnPremTransport, } from './connection/IAdtTransport.js';
14
14
  export { LegacyOnPremHttpTransport } from './connection/LegacyOnPremHttpTransport.js';
15
15
  export { OnPremHttpTransport } from './connection/OnPremHttpTransport.js';
16
- export { type IRfcConversation, type IRfcTransportOptions, RfcTransport, } from './connection/RfcTransport.js';
16
+ export { type IRfcConversation, type IRfcTransportOptions, type RfcConversationFactory, RfcTransport, } from './connection/RfcTransport.js';
17
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,EACjB,aAAa,EACb,YAAY,GACb,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;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,GAC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AE,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,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,aAAa,EACb,cAAc,GACf,MAAM,+BAA+B,CAAC;AACvC,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,KAAK,sBAAsB,EAC3B,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/USAGE.md CHANGED
@@ -1003,7 +1003,7 @@ establishing, and whatever session state it keeps.
1003
1003
  ```text
1004
1004
  new HttpTransport(agentOptions?, logger?, { client?, baseUrl, httpClient? })
1005
1005
  new RfcTransport(
1006
- connect: (logon: Readonly<Record<string, string>>) => IRfcConversation,
1006
+ connect: RfcConversationFactory, // (logon) => IRfcConversation, and its logon `language`
1007
1007
  logger?,
1008
1008
  { logWire?, maxLoggedBodyChars? },
1009
1009
  )
@@ -1028,7 +1028,14 @@ here, under the wire, so what the wire adds to its own requests still runs.
1028
1028
  `RfcTransport` you build
1029
1029
  with `rfcConversationFrom(rfcConfig)`, which takes the RFC config's stated
1030
1030
  address, `client` and `language` as they are and loads the SAP NW RFC SDK only
1031
- when a conversation opens.
1031
+ when a conversation opens. It states that `language` as the factory's logon
1032
+ language. A request's `sap-language` (header or query parameter) is compared
1033
+ with the logon language of the conversation that would carry it — the `lang`
1034
+ its logon carries: the provider's where it writes one, else the factory's. A
1035
+ non-stateful request naming another one goes on a conversation logged on in
1036
+ it, opened for that call and closed after it, and a stateful one is refused
1037
+ before it is sent — a session cannot change its language. See the README, "A request's
1038
+ language over RFC".
1032
1039
 
1033
1040
  **What the wire takes from the credential.** The provider writes it, the wire
1034
1041
  carries it; the wire never reads `config.username` or `config.password`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/connection",
3
- "version": "20.0.0",
3
+ "version": "20.1.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",