@mcp-abap-adt/connection 24.0.0 → 25.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +92 -1
  2. package/README.md +63 -7
  3. package/dist/connection/AbstractAbapConnection.d.ts +3 -0
  4. package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
  5. package/dist/connection/AbstractAbapConnection.js +27 -9
  6. package/dist/connection/CloudHttpTransport.d.ts.map +1 -1
  7. package/dist/connection/CloudHttpTransport.js +2 -1
  8. package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
  9. package/dist/connection/CredentialAbapConnection.js +2 -1
  10. package/dist/connection/GenericWebSocketTransport.d.ts +6 -0
  11. package/dist/connection/GenericWebSocketTransport.d.ts.map +1 -1
  12. package/dist/connection/GenericWebSocketTransport.js +22 -10
  13. package/dist/connection/HttpTransport.d.ts +4 -4
  14. package/dist/connection/HttpTransport.d.ts.map +1 -1
  15. package/dist/connection/HttpTransport.js +22 -9
  16. package/dist/connection/IAdtTransport.d.ts +4 -3
  17. package/dist/connection/IAdtTransport.d.ts.map +1 -1
  18. package/dist/connection/RfcTransport.d.ts +6 -0
  19. package/dist/connection/RfcTransport.d.ts.map +1 -1
  20. package/dist/connection/RfcTransport.js +40 -71
  21. package/dist/connection/authErrors.d.ts +21 -5
  22. package/dist/connection/authErrors.d.ts.map +1 -1
  23. package/dist/connection/authErrors.js +29 -6
  24. package/dist/connection/createConnection.d.ts.map +1 -1
  25. package/dist/connection/createConnection.js +7 -0
  26. package/dist/connection/failureFacts.d.ts +100 -0
  27. package/dist/connection/failureFacts.d.ts.map +1 -0
  28. package/dist/connection/failureFacts.js +280 -0
  29. package/dist/connection/rfcConversation.d.ts +2 -0
  30. package/dist/connection/rfcConversation.d.ts.map +1 -1
  31. package/dist/connection/rfcConversation.js +16 -4
  32. package/dist/connection/withCheckRelogon.d.ts +8 -0
  33. package/dist/connection/withCheckRelogon.d.ts.map +1 -0
  34. package/dist/connection/withCheckRelogon.js +68 -0
  35. package/docs/INDEX.md +2 -0
  36. package/docs/MIGRATION-10.0.md +11 -1
  37. package/docs/MIGRATION-12.0.md +8 -0
  38. package/docs/MIGRATION-25.0.md +88 -0
  39. package/docs/MIGRATION-4.0.md +4 -0
  40. package/docs/USAGE.md +43 -18
  41. package/package.json +1 -1
@@ -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,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAC7C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,6DAA6D;AAC7D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,C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ACpD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,GAAG,IAAI,CAQtE"}
@@ -272,6 +272,12 @@ export declare class RfcTransport implements IOnPremTransport {
272
272
  * A new conversation, logged on with `parameters`; a failed open is a
273
273
  * refused logon whose cause is the SDK's own error, untouched — a provider
274
274
  * reads its `key` and message.
275
+ *
276
+ * A factory that throws while building the conversation — the SDK's client
277
+ * constructor, or a consumer's factory — is not a logon: nothing was sent.
278
+ * It is said in fixed words with the SDK's fields as `rfc`, never the
279
+ * thrown value's text — except the shipped factory's own fixed words, which
280
+ * go as they are.
275
281
  */
276
282
  private openedWith;
277
283
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"RfcTransport.d.ts","sourceRoot":"","sources":["../../src/connection/RfcTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAUH,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;;;;;OAKG;IACH,IAAI,CACF,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,GAC1C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAA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gB,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;IAwBzE;;;;;;;;;;;;;;;;;OAiBG;YACW,aAAa;YAiBb,WAAW;IAyFzB;;;OAGG;YACW,gBAAgB;IAe9B;;;OAGG;IACH,OAAO,CAAC,WAAW;IAQnB,iEAAiE;IACjE,OAAO,CAAC,aAAa;IAOrB;;;OAGG;YACW,mBAAmB;IAMjC;;;;;OAKG;YACW,OAAO;IAcrB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAgBnB,gEAAgE;YAClD,eAAe;IAM7B;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAMlB;;;;;;;;;;OAUG;YACW,UAAU;IAwBxB;;;;OAIG;IACH,OAAO,CAAC,UAAU;YAQJ,YAAY;YAQZ,KAAK;CA8MpB"}
@@ -57,8 +57,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
57
57
  exports.RfcTransport = void 0;
58
58
  const node_crypto_1 = require("node:crypto");
59
59
  const auth_errors_1 = require("@mcp-abap-adt/auth-errors");
60
- const interfaces_adt_connection_1 = require("@mcp-abap-adt/interfaces-adt-connection");
61
60
  const authErrors_js_1 = require("./authErrors.js");
61
+ const failureFacts_js_1 = require("./failureFacts.js");
62
+ const rfcConversation_js_1 = require("./rfcConversation.js");
62
63
  const statefulRequest_js_1 = require("./statefulRequest.js");
63
64
  /**
64
65
  * The SDK answers with untyped structures: each level is read as a record and
@@ -190,76 +191,26 @@ function statusFromExceptionXml(body) {
190
191
  ? EXCEPTION_STATUS[type]
191
192
  : { code: 500, text: 'Internal Server Error' };
192
193
  }
193
- /** An own data property of `source`, read without running a getter. */
194
- function ownData(source, name) {
195
- const descriptor = Object.getOwnPropertyDescriptor(source, name);
196
- return descriptor !== undefined && 'value' in descriptor
197
- ? descriptor.value
198
- : undefined;
199
- }
200
- function isInteger(value) {
201
- return typeof value === 'number' && Number.isInteger(value);
202
- }
203
194
  /**
204
- * The SDK's error as fields, or `undefined` when `thrown` is not that shape.
205
- *
206
- * The one place an SDK error enters, so the one place it is checked: `key` and
207
- * `codeString` own data properties holding strings, `group` and `code` own
208
- * data properties holding integers, and `codeString` one of the closed list
209
- * `RFC_RCS`. No getter runs, and an object whose traps throw reads as no
210
- * shape. `name` and `message` are not read, and nothing is read out of a
211
- * message.
212
- */
213
- function rfcErrorOf(thrown) {
214
- if (typeof thrown !== 'object' || thrown === null)
215
- return undefined;
216
- try {
217
- const key = ownData(thrown, 'key');
218
- const group = ownData(thrown, 'group');
219
- const code = ownData(thrown, 'code');
220
- const codeString = ownData(thrown, 'codeString');
221
- if (typeof key !== 'string' || !isInteger(group) || !isInteger(code)) {
222
- return undefined;
223
- }
224
- // Compared with each listed name, so only a string can match: this is
225
- // the check of `codeString`, and what is stored is the listed member.
226
- const listed = interfaces_adt_connection_1.RFC_RCS.find((name) => name === codeString);
227
- if (listed === undefined)
228
- return undefined;
229
- return Object.freeze({ key, group, code, codeString: listed });
230
- }
231
- catch {
232
- return undefined;
233
- }
234
- }
235
- /**
236
- * What a failed call throws: an `Error` with today's words, and the SDK's
237
- * fields as `rfc` when the SDK named the failure. The top-level `code` is not
195
+ * What a failed call throws: an `Error` in fixed words, and the SDK's fields
196
+ * as `rfc` when the SDK named the failure. The top-level `code` is not
238
197
  * set: `rfc` does not change what it means.
239
198
  */
240
199
  function rfcCallError(text, rfc) {
241
200
  const error = new Error(text);
242
201
  return rfc === undefined ? error : Object.assign(error, { rfc });
243
202
  }
244
- /** Words a value is described by when describing it throws. */
245
- const UNDESCRIBABLE = 'the failure could not be described';
203
+ /** The words for a failure the SDK did not name with its fields. */
204
+ const UNNAMED = 'the SDK did not name the failure';
246
205
  /**
247
- * A thrown value in words, for a message and a log line. It never throws:
248
- * `instanceof` runs a Proxy's trap, `message` may be a getter, and
249
- * `JSON.stringify` runs every enumerable getter and `toJSON` — any of which
250
- * may throw. Then the words are fixed, and nothing the throw said is kept.
206
+ * A failure in fixed words: the return code the SDK named — a member of the
207
+ * closed list `RFC_RCS` — else fixed words. Nothing the thrown value says is
208
+ * read: the SDK's text names the partner it dialled (`host:port`), the time
209
+ * and the kernel's source module, and none of it may reach a message or a log
210
+ * line. What the SDK said reaches a caller as `rfc`, its fields.
251
211
  */
252
- function message(e) {
253
- try {
254
- if (e instanceof Error)
255
- return String(e.message);
256
- if (e && typeof e === 'object')
257
- return String(JSON.stringify(e));
258
- return String(e);
259
- }
260
- catch {
261
- return UNDESCRIBABLE;
262
- }
212
+ function failureWords(thrown) {
213
+ return (0, failureFacts_js_1.rfcErrorOf)(thrown)?.codeString ?? UNNAMED;
263
214
  }
264
215
  /**
265
216
  * Header names whose VALUE must never reach a log.
@@ -553,7 +504,7 @@ class RfcTransport {
553
504
  await conversation.close();
554
505
  }
555
506
  catch (e) {
556
- this.logQuietly(() => `RFC close error: ${message(e)}`);
507
+ this.logQuietly(() => `RFC close error: ${failureWords(e)}`);
557
508
  return;
558
509
  }
559
510
  this.logQuietly(() => 'RFC conversation closed');
@@ -660,7 +611,7 @@ class RfcTransport {
660
611
  }
661
612
  catch (e) {
662
613
  // A context that could not be reset must not serve the next call.
663
- this.logQuietly(() => `RFC reset failed, dropping the conversation: ${message(e)}`);
614
+ this.logQuietly(() => `RFC reset failed, dropping the conversation: ${failureWords(e)}`);
664
615
  this.dropStateless(kept);
665
616
  await this.closeQuietly(kept);
666
617
  }
@@ -765,9 +716,26 @@ class RfcTransport {
765
716
  * A new conversation, logged on with `parameters`; a failed open is a
766
717
  * refused logon whose cause is the SDK's own error, untouched — a provider
767
718
  * reads its `key` and message.
719
+ *
720
+ * A factory that throws while building the conversation — the SDK's client
721
+ * constructor, or a consumer's factory — is not a logon: nothing was sent.
722
+ * It is said in fixed words with the SDK's fields as `rfc`, never the
723
+ * thrown value's text — except the shipped factory's own fixed words, which
724
+ * go as they are.
768
725
  */
769
726
  async openedWith(parameters) {
770
- const conversation = this.connect(parameters);
727
+ let conversation;
728
+ try {
729
+ conversation = this.connect(parameters);
730
+ }
731
+ catch (e) {
732
+ // The shipped factory's own words (sap-rfc-lite missing, and what to
733
+ // install) quote nothing, and say more than these would.
734
+ if ((0, rfcConversation_js_1.isFactoryOwnWords)(e))
735
+ throw e;
736
+ const rfc = (0, failureFacts_js_1.rfcErrorOf)(e);
737
+ throw rfcCallError(`The RFC conversation could not be built: ${rfc?.codeString ?? UNNAMED}`, rfc);
738
+ }
771
739
  try {
772
740
  await conversation.open();
773
741
  }
@@ -794,7 +762,7 @@ class RfcTransport {
794
762
  await conversation.close();
795
763
  }
796
764
  catch (e) {
797
- this.logQuietly(() => `RFC close error: ${message(e)}`);
765
+ this.logQuietly(() => `RFC close error: ${failureWords(e)}`);
798
766
  }
799
767
  }
800
768
  async carry(request, conversation, generation, passport,
@@ -890,8 +858,9 @@ class RfcTransport {
890
858
  // An RFC-level failure, not an answer: nothing came back to classify.
891
859
  // The verdict comes first — the SDK's fields, read once, and whether the
892
860
  // session survived — so nothing that describes the failure afterwards
893
- // (formatting the thrown value, a logger) can stand in for it.
894
- const rfc = rfcErrorOf(e);
861
+ // (a logger) can stand in for it. The words are the return code's, or
862
+ // fixed: the SDK's text is never read (`failureWords`).
863
+ const rfc = (0, failureFacts_js_1.rfcErrorOf)(e);
895
864
  // The library released the stateful conversation after the error
896
865
  // (`alive` false), and it was not a close() of ours: the session it
897
866
  // carried is gone, with every lock taken in it. Said, not cured — no
@@ -899,10 +868,10 @@ class RfcTransport {
899
868
  const lost = carriesSession && !conversation.alive && generation === this.generation;
900
869
  if (lost)
901
870
  this.dropSession(conversation);
902
- const msg = message(e);
903
- const text = `RFC call to SADT_REST_RFC_ENDPOINT failed: ${msg}`;
871
+ const words = rfc?.codeString ?? UNNAMED;
872
+ const text = `RFC call to SADT_REST_RFC_ENDPOINT failed: ${words}`;
904
873
  try {
905
- this.logger?.error(`RFC call failed: ${msg}`);
874
+ this.logger?.error(`RFC call failed: ${words}`);
906
875
  }
907
876
  catch {
908
877
  // A broken logger must not replace the call's failure.
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import type { IAbapConnectionError, IRfcErrorInfo } from '@mcp-abap-adt/interfaces-adt-connection';
6
6
  import type { AuthOutcome, IAuthRefusal } from '@mcp-abap-adt/interfaces-auth';
7
+ import { type FailureCopy } from './failureFacts.js';
7
8
  /** When in the connection's life the credential refused. */
8
9
  export type AuthRefusalMoment = 'prepare' | 'logon' | 'request';
9
10
  /**
@@ -14,14 +15,18 @@ export type AuthRefusalMoment = 'prepare' | 'logon' | 'request';
14
15
  * (or the connection's own), classified on the way in: a refusal that is not
15
16
  * this copy's minted error is rebuilt from its kind and facts, or else is
16
17
  * `provider-threw` — decide on its `kind` and `facts`; the message is its
17
- * `reason — hint`. `cause` keeps the wire's error as it arrived, so a network failure stays visible even when a provider words it as
18
- * a credential problem — unless the provider threw instead of answering, when
19
- * it is that throw.
18
+ * `reason — hint`. `cause` says the wire's error — or, when the provider threw
19
+ * instead of answering, that throw — by its facts, so a network failure stays
20
+ * visible even when a provider words it as a credential problem: a copy
21
+ * (`failureCopy`) in fixed words with its `code`, `status` and `rfc`, never
22
+ * the value itself — an RFC SDK's text names the partner's host and port, an
23
+ * axios error holds the request's credential headers. The provider was handed
24
+ * the wire's error as it arrived (`IAuthRejection.error`).
20
25
  */
21
26
  export declare class AuthRefusedError extends Error {
22
27
  readonly refusal: IAuthRefusal;
23
28
  readonly at: AuthRefusalMoment;
24
- readonly cause?: unknown;
29
+ readonly cause: FailureCopy | undefined;
25
30
  constructor(refusal: IAuthRefusal, at: AuthRefusalMoment, cause?: unknown);
26
31
  }
27
32
  /**
@@ -29,13 +34,24 @@ export declare class AuthRefusedError extends Error {
29
34
  * do about it is the provider's answer, not the wire's.
30
35
  *
31
36
  * Exported so a consumer's own wire can say the same thing. `cause` is the raw
32
- * error, the same object, never re-wrapped.
37
+ * error, the same object, never re-wrapped: the provider reads it
38
+ * (`IAuthRejection.error`). The message is fixed words and the status, never
39
+ * the cause's text — an RFC SDK's names the partner it dialled. It is the
40
+ * wire's mark to the connection: the connection hands a consumer none with a
41
+ * raw cause (`outwardLogonError`).
33
42
  */
34
43
  export declare class WireLogonError extends Error {
35
44
  readonly status?: number;
36
45
  readonly cause: unknown;
37
46
  constructor(cause: unknown, status?: number);
38
47
  }
48
+ /**
49
+ * A `WireLogonError` as it may leave the connection: the same status, its
50
+ * cause a copy in fixed words with its facts (`failureCopy`), never the wire's
51
+ * raw error — which the provider was handed, and which may hold an RFC SDK's
52
+ * text or a request's credential headers. Anything else is returned as it is.
53
+ */
54
+ export declare function outwardLogonError(error: unknown): unknown;
39
55
  /**
40
56
  * A wire's mark: the session this wire carries has ended under it — over RFC,
41
57
  * an RFC error ended the stateful conversation, and the locks taken in it
@@ -1 +1 @@
1
- {"version":3,"file":"authErrors.d.ts","sourceRoot":"","sources":["../../src/connection/authErrors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACd,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE/E,4DAA4D;AAC5D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;IAC/B,SAAkB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAEtB,OAAO,EAAE,Y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AI,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,EAChC,EAAE,EAAE,iBAAiB,GACpB,OAAO,CAAC,aAAa,CAAC,CAOxB"}
@@ -5,10 +5,12 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.NO_CREDENTIAL_TO_RENEW = exports.WireSessionLostError = exports.WireLogonError = exports.AuthRefusedError = void 0;
8
+ exports.outwardLogonError = outwardLogonError;
8
9
  exports.providerFailed = providerFailed;
9
10
  exports.refusedAgain = refusedAgain;
10
11
  exports.guarded = guarded;
11
12
  const auth_errors_1 = require("@mcp-abap-adt/auth-errors");
13
+ const failureFacts_js_1 = require("./failureFacts.js");
12
14
  /**
13
15
  * The credential said no, or the system refused it and the provider's answer
14
16
  * is final.
@@ -17,9 +19,13 @@ const auth_errors_1 = require("@mcp-abap-adt/auth-errors");
17
19
  * (or the connection's own), classified on the way in: a refusal that is not
18
20
  * this copy's minted error is rebuilt from its kind and facts, or else is
19
21
  * `provider-threw` — decide on its `kind` and `facts`; the message is its
20
- * `reason — hint`. `cause` keeps the wire's error as it arrived, so a network failure stays visible even when a provider words it as
21
- * a credential problem — unless the provider threw instead of answering, when
22
- * it is that throw.
22
+ * `reason — hint`. `cause` says the wire's error — or, when the provider threw
23
+ * instead of answering, that throw — by its facts, so a network failure stays
24
+ * visible even when a provider words it as a credential problem: a copy
25
+ * (`failureCopy`) in fixed words with its `code`, `status` and `rfc`, never
26
+ * the value itself — an RFC SDK's text names the partner's host and port, an
27
+ * axios error holds the request's credential headers. The provider was handed
28
+ * the wire's error as it arrived (`IAuthRejection.error`).
23
29
  */
24
30
  class AuthRefusedError extends Error {
25
31
  refusal;
@@ -31,7 +37,7 @@ class AuthRefusedError extends Error {
31
37
  this.name = 'AuthRefusedError';
32
38
  this.refusal = checked;
33
39
  this.at = at;
34
- this.cause = cause;
40
+ this.cause = (0, failureFacts_js_1.failureCopy)(cause);
35
41
  }
36
42
  }
37
43
  exports.AuthRefusedError = AuthRefusedError;
@@ -53,19 +59,36 @@ function checkedRefusal(refusal, at) {
53
59
  * do about it is the provider's answer, not the wire's.
54
60
  *
55
61
  * Exported so a consumer's own wire can say the same thing. `cause` is the raw
56
- * error, the same object, never re-wrapped.
62
+ * error, the same object, never re-wrapped: the provider reads it
63
+ * (`IAuthRejection.error`). The message is fixed words and the status, never
64
+ * the cause's text — an RFC SDK's names the partner it dialled. It is the
65
+ * wire's mark to the connection: the connection hands a consumer none with a
66
+ * raw cause (`outwardLogonError`).
57
67
  */
58
68
  class WireLogonError extends Error {
59
69
  status;
60
70
  cause;
61
71
  constructor(cause, status) {
62
- super(cause instanceof Error ? cause.message : String(cause));
72
+ super(status === undefined
73
+ ? 'The logon failed'
74
+ : `The logon failed (status ${status})`);
63
75
  this.name = 'WireLogonError';
64
76
  this.cause = cause;
65
77
  this.status = status;
66
78
  }
67
79
  }
68
80
  exports.WireLogonError = WireLogonError;
81
+ /**
82
+ * A `WireLogonError` as it may leave the connection: the same status, its
83
+ * cause a copy in fixed words with its facts (`failureCopy`), never the wire's
84
+ * raw error — which the provider was handed, and which may hold an RFC SDK's
85
+ * text or a request's credential headers. Anything else is returned as it is.
86
+ */
87
+ function outwardLogonError(error) {
88
+ return error instanceof WireLogonError
89
+ ? new WireLogonError((0, failureFacts_js_1.failureCopy)(error.cause), error.status)
90
+ : error;
91
+ }
69
92
  /**
70
93
  * A wire's mark: the session this wire carries has ended under it — over RFC,
71
94
  * an RFC error ended the stateful conversation, and the locks taken in it
@@ -1 +1 @@
1
- {"version":3,"file":"createConnection.d.ts","sourceRoot":"","sources":["../../src/connection/createConnection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,mCAAmC,CAA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pTransport.js")
8
8
  const OnPremHttpTransport_js_1 = require("./OnPremHttpTransport.js");
9
9
  const RfcTransport_js_1 = require("./RfcTransport.js");
10
10
  const rfcConversation_js_1 = require("./rfcConversation.js");
11
+ const withCheckRelogon_js_1 = require("./withCheckRelogon.js");
11
12
  /**
12
13
  * Fixed words: nothing the caller passed is echoed back. Typed `never`: the
13
14
  * compiler proves every combination of the spec type is handled before it,
@@ -28,6 +29,12 @@ function httpAddress(spec) {
28
29
  };
29
30
  }
30
31
  function createConnection(spec) {
32
+ const connection = buildConnection(spec);
33
+ if (spec.transport !== 'http')
34
+ return connection;
35
+ return (0, withCheckRelogon_js_1.withCheckRelogon)(connection, () => buildConnection({ ...spec, session: undefined }));
36
+ }
37
+ function buildConnection(spec) {
31
38
  const logger = spec.logger ?? null;
32
39
  const wireLogger = spec.wireLogger ?? null;
33
40
  // The spec is a union discriminated by `transport` and `system`: each branch
@@ -0,0 +1,100 @@
1
+ /**
2
+ * What a thrown value may say about itself to a caller or a log line: its
3
+ * typed facts, never its text.
4
+ *
5
+ * A thrown value comes from outside the type system — the NW RFC SDK, axios,
6
+ * Node's sockets, a WebSocket library, a consumer's own code — and its message,
7
+ * stack, cause and fields carry whatever its author put there: a gateway's
8
+ * `host:port`, a URL with credentials in it, a request's headers. So nothing
9
+ * of it is quoted. What it says is read as facts, each checked where it is
10
+ * read — the RFC SDK's fields (`rfc`), a Node or axios error code (`code`),
11
+ * an HTTP status (`status`) — and said in fixed words built from those facts.
12
+ *
13
+ * Every read is of an own data property: no getter runs, and an object whose
14
+ * traps throw reads as having no facts.
15
+ */
16
+ import { type IAbapConnectionError, type IRfcErrorInfo } from '@mcp-abap-adt/interfaces-adt-connection';
17
+ import type { IAdtTransportResponse } from './IAdtTransport.js';
18
+ /** An own data property of `source`, read without running a getter. */
19
+ export declare function ownData(source: object, name: string): unknown;
20
+ /**
21
+ * The SDK's error as fields, or `undefined` when `thrown` is not that shape.
22
+ *
23
+ * The one place an SDK error enters, so the one place it is checked: `key` and
24
+ * `codeString` own data properties holding strings, `group` and `code` own
25
+ * data properties holding integers, and `codeString` one of the closed list
26
+ * `RFC_RCS`. No getter runs, and an object whose traps throw reads as no
27
+ * shape. `name` and `message` are not read, and nothing is read out of a
28
+ * message.
29
+ */
30
+ export declare function rfcErrorOf(thrown: unknown): IRfcErrorInfo | undefined;
31
+ /**
32
+ * A code as a Node or axios error carries it (`ECONNREFUSED`,
33
+ * `ERR_BAD_REQUEST`, one of `ADT_SESSION_ERROR`): a non-empty string of
34
+ * upper-case ASCII letters, digits and `_` only, at most 64 of them. Anything
35
+ * else is no code — free text is never taken for one.
36
+ */
37
+ export declare function codeOf(thrown: unknown): string | undefined;
38
+ /**
39
+ * The code a thrown value carries: its own (`codeOf`), else the first one down
40
+ * its `cause` chain (own data properties, at most four deep) — a client that
41
+ * wraps a socket's failure (`fetch failed`, its cause `ECONNREFUSED`) says it
42
+ * there.
43
+ */
44
+ export declare function failureCode(thrown: unknown): string | undefined;
45
+ /**
46
+ * The HTTP status a thrown value carries: its own `status`, else its
47
+ * `response`'s — `undefined` when neither is an HTTP status.
48
+ */
49
+ export declare function statusOf(thrown: unknown): number | undefined;
50
+ /** The facts a thrown value is said by. */
51
+ export interface FailureFacts {
52
+ readonly code?: string;
53
+ readonly status?: number;
54
+ readonly rfc?: IRfcErrorInfo;
55
+ /** SAP's answer, as SAP gave it: status, reason, headers, body. */
56
+ readonly response?: IAdtTransportResponse;
57
+ }
58
+ /** Every fact `thrown` carries, each checked; none of its text. */
59
+ export declare function factsOf(thrown: unknown): FailureFacts;
60
+ /** The words for a value that carries no fact. */
61
+ export declare const NO_FACTS = "no code was given";
62
+ /**
63
+ * A thrown value in fixed words: its facts — the RFC return code, the code,
64
+ * the status — or `no code was given`. For a message and a log line.
65
+ */
66
+ export declare function factWords(thrown: unknown): string;
67
+ /** A copy of a thrown value: fixed words and its facts, nothing else of it. */
68
+ export type FailureCopy = Error & IAbapConnectionError & FailureFacts;
69
+ /**
70
+ * A copy of `thrown` a consumer may stringify or inspect: an `Error` named
71
+ * `WireFailure`, its message `The failure: <facts>`, and its facts as fields
72
+ * (`code`, `status`, `rfc`, SAP's answer as `response`). No message, stack,
73
+ * cause, config or other field of `thrown` is kept. `undefined` stays
74
+ * `undefined`.
75
+ */
76
+ export declare function failureCopy(thrown: unknown): FailureCopy | undefined;
77
+ /** What an HTTP request's failure is, as the wire hands it up. */
78
+ export type HttpFailure = Error & IAbapConnectionError & {
79
+ readonly status?: number;
80
+ /** SAP's answer, as SAP gave it: status, reason, headers, body. */
81
+ readonly response?: IAdtTransportResponse;
82
+ };
83
+ /**
84
+ * What an HTTP client's rejection becomes before it leaves the wire: an
85
+ * `Error` in fixed words with its facts and SAP's answer, and nothing else.
86
+ *
87
+ * axios's error carries the request's config — its `Authorization`, `Cookie`
88
+ * and CSRF headers among it — the Node request, and a message that names the
89
+ * host and port it could not reach. None of that is kept. What is: SAP's
90
+ * answer when there was one (`response`, `status`; the message axios gives it,
91
+ * `Request failed with status code <n>`, built from the status), else the
92
+ * code (`ECONNREFUSED`, `ECONNABORTED`, …) and `The request failed: <code>`.
93
+ */
94
+ export declare function httpFailure(thrown: unknown): HttpFailure;
95
+ /**
96
+ * The wire's error as it arrived: the value an `httpFailure` was made from,
97
+ * or `value` itself. For `IAuthRejection.error` only — never for a consumer.
98
+ */
99
+ export declare function asArrived(value: unknown): unknown;
100
+ //# sourceMappingURL=failureFacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failureFacts.d.ts","sourceRoot":"","sources":["../../src/connection/failureFacts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAEnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,uEAAuE;AACvE,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,M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