@mcp-abap-adt/connection 20.0.0 → 21.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.
@@ -109,22 +109,13 @@ export interface IAdtEstablishContext extends IAdtSessionContext {
109
109
  *
110
110
  * Handed up BEFORE the wire folds the answer in. It may throw a session
111
111
  * verdict — the answer belongs to a session that is gone — and the wire then
112
- * folds nothing of it and ends the exchange (`isFatal`).
113
- */
114
- observe: (headers: unknown) => void;
115
- /** How many times to ask again. Absent means the transport's own default. */
116
- retries?: number;
117
- /** Milliseconds between attempts. Absent means the transport's own default. */
118
- retryDelayMs?: number;
119
- /**
120
- * Which failures must not be retried.
112
+ * folds nothing of it and ends the exchange: the verdict carries no
113
+ * response, so it is neither folded in nor read as an absent endpoint.
121
114
  *
122
- * A verdict about the session — "the one we were on is gone" — is not a
123
- * failed exchange: retrying would observe the SAME new session, read it as
124
- * unchanged, and lose the replacement for good. The wire cannot tell those
125
- * apart, so it asks.
115
+ * The exchange is one request, never repeated and never delayed; the second
116
+ * endpoint is asked only after the first answered that it does not exist.
126
117
  */
127
- isFatal?: (error: unknown) => boolean;
118
+ observe: (headers: unknown) => void;
128
119
  }
129
120
  export interface IAdtTransport {
130
121
  /** For logs, so which transport ran is never inferred from behaviour. */
@@ -1 +1 @@
1
- {"version":3,"file":"IAdtTransport.d.ts","sourceRoot":"","sources":["../../src/connection/IAdtTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,4DAA4D;AAC5D,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;;;;OAQG;IACH,MAAM,CAAC,EA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;;OAIG;IACH,cAAc,IAAI,MAAM,GAAG,IAAI,CAAC;IAEhC;;;;;;OAMG;IACH,kBAAkB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C;;;;;;;;;;;;OAYG;IACH,kBAAkB,IAAI,OAAO,CAAC;IAE9B,4EAA4E;IAC5E,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD,0EAA0E;IAC1E,SAAS,IAAI,MAAM,GAAG,IAAI,CAAC;IAE3B;;;;;;OAMG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAE3C,oDAAoD;IACpD,aAAa,IAAI,IAAI,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;CAC3B;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,GAAG,IAAI,CAQtE"}
@@ -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,CAAC,EAAE,MAAM,CAAC;CAC7B;AAKD,qBAAa,YAAa,YAAW,gBAAgB;IAsHjD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAGxB,OAAO,C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AO,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) {
@@ -3,18 +3,12 @@
3
3
  *
4
4
  * Centralized constants for CSRF token fetching to ensure consistency
5
5
  * across different connection implementations.
6
+ *
7
+ * The fetch is one request per endpoint, never repeated and never delayed: a
8
+ * failed request is its own error. The fallback endpoint is asked only after
9
+ * the primary answered 404 (or 501) — a system without it — and is not a retry.
6
10
  */
7
11
  export declare const CSRF_CONFIG: {
8
- /**
9
- * Number of retry attempts for CSRF token fetch
10
- * Default: 3 attempts (total of 4 requests: initial + 3 retries)
11
- */
12
- readonly RETRY_COUNT: 3;
13
- /**
14
- * Delay between retry attempts (milliseconds)
15
- * Default: 1000ms (1 second)
16
- */
17
- readonly RETRY_DELAY: 1000;
18
12
  /**
19
13
  * CSRF token endpoint path (primary)
20
14
  * Standard SAP ADT core discovery endpoint (newer systems, returns smaller response)
@@ -1 +1 @@
1
- {"version":3,"file":"csrfConfig.d.ts","sourceRoot":"","sources":["../../src/connection/csrfConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,WAAW;IACtB;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;;OAIG;;IAGH;;OAEG;;;;;CAKK,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,mBAAmB;sCACL,MAAM,SAAS,MAAM;;;CAOtC,CAAC"}
1
+ {"version":3,"file":"csrfConfig.d.ts","sourceRoot":"","sources":["../../src/connection/csrfConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW;IACtB;;;OAGG;;IAGH;;;;OAIG;;IAGH;;OAEG;;;;;CAKK,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,mBAAmB;sCACL,MAAM,SAAS,MAAM;;;CAOtC,CAAC"}
@@ -6,18 +6,12 @@ exports.CSRF_ERROR_MESSAGES = exports.CSRF_CONFIG = void 0;
6
6
  *
7
7
  * Centralized constants for CSRF token fetching to ensure consistency
8
8
  * across different connection implementations.
9
+ *
10
+ * The fetch is one request per endpoint, never repeated and never delayed: a
11
+ * failed request is its own error. The fallback endpoint is asked only after
12
+ * the primary answered 404 (or 501) — a system without it — and is not a retry.
9
13
  */
10
14
  exports.CSRF_CONFIG = {
11
- /**
12
- * Number of retry attempts for CSRF token fetch
13
- * Default: 3 attempts (total of 4 requests: initial + 3 retries)
14
- */
15
- RETRY_COUNT: 3,
16
- /**
17
- * Delay between retry attempts (milliseconds)
18
- * Default: 1000ms (1 second)
19
- */
20
- RETRY_DELAY: 1000,
21
15
  /**
22
16
  * CSRF token endpoint path (primary)
23
17
  * Standard SAP ADT core discovery endpoint (newer systems, returns smaller response)
@@ -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;;;;GAI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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,CAAA;CAAE,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;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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