@mcp-abap-adt/connection 15.1.0 → 17.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +187 -1
  2. package/README.md +137 -33
  3. package/dist/connection/AbstractAbapConnection.d.ts +140 -58
  4. package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
  5. package/dist/connection/AbstractAbapConnection.js +349 -255
  6. package/dist/connection/AdtCloudConnector.d.ts +6 -1
  7. package/dist/connection/AdtCloudConnector.d.ts.map +1 -1
  8. package/dist/connection/AdtCloudConnector.js +7 -2
  9. package/dist/connection/AdtOnPremConnector.d.ts +6 -1
  10. package/dist/connection/AdtOnPremConnector.d.ts.map +1 -1
  11. package/dist/connection/AdtOnPremConnector.js +7 -2
  12. package/dist/connection/CloudHttpTransport.d.ts +8 -1
  13. package/dist/connection/CloudHttpTransport.d.ts.map +1 -1
  14. package/dist/connection/CloudHttpTransport.js +30 -18
  15. package/dist/connection/CredentialAbapConnection.d.ts +3 -1
  16. package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
  17. package/dist/connection/CredentialAbapConnection.js +4 -2
  18. package/dist/connection/GenericWebSocketTransport.d.ts.map +1 -1
  19. package/dist/connection/GenericWebSocketTransport.js +7 -4
  20. package/dist/connection/HttpTransport.d.ts +80 -6
  21. package/dist/connection/HttpTransport.d.ts.map +1 -1
  22. package/dist/connection/HttpTransport.js +258 -25
  23. package/dist/connection/IAdtTransport.d.ts +46 -22
  24. package/dist/connection/IAdtTransport.d.ts.map +1 -1
  25. package/dist/connection/OnPremHttpTransport.d.ts +2 -13
  26. package/dist/connection/OnPremHttpTransport.d.ts.map +1 -1
  27. package/dist/connection/OnPremHttpTransport.js +16 -32
  28. package/dist/connection/RfcTransport.d.ts +7 -6
  29. package/dist/connection/RfcTransport.d.ts.map +1 -1
  30. package/dist/connection/RfcTransport.js +27 -49
  31. package/dist/connection/createConnection.d.ts +95 -0
  32. package/dist/connection/createConnection.d.ts.map +1 -0
  33. package/dist/connection/createConnection.js +44 -0
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +5 -5
  37. package/docs/INDEX.md +6 -2
  38. package/docs/MIGRATION-16.0.md +123 -0
  39. package/docs/MIGRATION-17.0.md +119 -0
  40. package/docs/SCOPE.md +22 -45
  41. package/docs/STATEFUL_SESSION_GUIDE.md +49 -49
  42. package/docs/USAGE.md +244 -120
  43. package/package.json +2 -2
  44. package/dist/connection/requestAbort.d.ts +0 -32
  45. package/dist/connection/requestAbort.d.ts.map +0 -1
  46. package/dist/connection/requestAbort.js +0 -69
  47. package/dist/utils/timeouts.d.ts +0 -18
  48. package/dist/utils/timeouts.d.ts.map +0 -1
  49. package/dist/utils/timeouts.js +0 -37
@@ -1,32 +0,0 @@
1
- /**
2
- * What a request's signal does to it: the error it ends with, the check made
3
- * at each send boundary, and the race each of its waits runs against it.
4
- *
5
- * The signal belongs to ONE caller. A wait it ends — the provider's
6
- * `authorize()` or `rejected()`, a logon, a conversation's `open()` — ends for
7
- * that caller only: the work behind it runs on, because another caller may be
8
- * waiting on the very same work (a provider shares one renewal among all who
9
- * ask). Its late answer is handled here and dropped, never left unhandled.
10
- *
11
- * A request already sent is not recalled: nothing here reaches into the wire.
12
- */
13
- import { type AdtRequestErrorCode } from '@mcp-abap-adt/interfaces-adt-connection';
14
- export type RequestAbortedError = Error & {
15
- code: AdtRequestErrorCode;
16
- };
17
- /** The error an aborted request rejects with: `ADT_REQUEST_ERROR.ABORTED`. */
18
- export declare function requestAborted(): RequestAbortedError;
19
- /** Whether an error is a request's abort. Read structurally, by its code. */
20
- export declare function isRequestAborted(error: unknown): boolean;
21
- /** A send boundary: an aborted request goes no further. */
22
- export declare function throwIfAborted(signal: AbortSignal | undefined): void;
23
- /**
24
- * One wait of a request, raced against its signal.
25
- *
26
- * Settles as `work` does, or rejects with the abort the moment the signal
27
- * fires — at once when it already has. `work` is never cancelled: it runs on
28
- * for whoever else waits on it, and what it answers after the abort is
29
- * handled and dropped. Without a signal, `work` itself.
30
- */
31
- export declare function untilAborted<T>(signal: AbortSignal | undefined, work: Promise<T>): Promise<T>;
32
- //# sourceMappingURL=requestAbort.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requestAbort.d.ts","sourceRoot":"","sources":["../../src/connection/requestAbort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,yCAAyC,CAAC;AASjD,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAExE,8EAA8E;AAC9E,wBAAgB,cAAc,IAAI,mBAAmB,CAKpD;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKxD;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAEpE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GACf,OAAO,CAAC,CAAC,CAAC,CAoBZ"}
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requestAborted = requestAborted;
4
- exports.isRequestAborted = isRequestAborted;
5
- exports.throwIfAborted = throwIfAborted;
6
- exports.untilAborted = untilAborted;
7
- /**
8
- * What a request's signal does to it: the error it ends with, the check made
9
- * at each send boundary, and the race each of its waits runs against it.
10
- *
11
- * The signal belongs to ONE caller. A wait it ends — the provider's
12
- * `authorize()` or `rejected()`, a logon, a conversation's `open()` — ends for
13
- * that caller only: the work behind it runs on, because another caller may be
14
- * waiting on the very same work (a provider shares one renewal among all who
15
- * ask). Its late answer is handled here and dropped, never left unhandled.
16
- *
17
- * A request already sent is not recalled: nothing here reaches into the wire.
18
- */
19
- const interfaces_adt_connection_1 = require("@mcp-abap-adt/interfaces-adt-connection");
20
- /**
21
- * Fixed words: nothing of the request, the signal's reason or anything a
22
- * server said reaches them.
23
- */
24
- const ABORTED_WORDS = 'The request was aborted by its caller; nothing more of it was sent.';
25
- /** The error an aborted request rejects with: `ADT_REQUEST_ERROR.ABORTED`. */
26
- function requestAborted() {
27
- const error = new Error(ABORTED_WORDS);
28
- error.name = 'AdtRequestAbortedError';
29
- error.code = interfaces_adt_connection_1.ADT_REQUEST_ERROR.ABORTED;
30
- return error;
31
- }
32
- /** Whether an error is a request's abort. Read structurally, by its code. */
33
- function isRequestAborted(error) {
34
- return (error?.code ===
35
- interfaces_adt_connection_1.ADT_REQUEST_ERROR.ABORTED);
36
- }
37
- /** A send boundary: an aborted request goes no further. */
38
- function throwIfAborted(signal) {
39
- if (signal?.aborted)
40
- throw requestAborted();
41
- }
42
- /**
43
- * One wait of a request, raced against its signal.
44
- *
45
- * Settles as `work` does, or rejects with the abort the moment the signal
46
- * fires — at once when it already has. `work` is never cancelled: it runs on
47
- * for whoever else waits on it, and what it answers after the abort is
48
- * handled and dropped. Without a signal, `work` itself.
49
- */
50
- function untilAborted(signal, work) {
51
- if (!signal)
52
- return work;
53
- // Handled before anything else can happen: an answer that arrives after
54
- // the abort is nobody's, and must not surface as an unhandled rejection.
55
- work.catch(() => { });
56
- if (signal.aborted)
57
- return Promise.reject(requestAborted());
58
- return new Promise((resolve, reject) => {
59
- const onAbort = () => reject(requestAborted());
60
- signal.addEventListener('abort', onAbort, { once: true });
61
- work.then((value) => {
62
- signal.removeEventListener('abort', onAbort);
63
- resolve(value);
64
- }, (error) => {
65
- signal.removeEventListener('abort', onAbort);
66
- reject(error);
67
- });
68
- });
69
- }
@@ -1,18 +0,0 @@
1
- import type { ITimeoutConfig } from '@mcp-abap-adt/interfaces-adt-connection';
2
- export type TimeoutConfig = ITimeoutConfig;
3
- export declare function getTimeoutConfig(): ITimeoutConfig;
4
- export declare function getTimeout(type?: 'default' | 'csrf' | 'long' | number): number;
5
- /**
6
- * Large ceiling timeout applied while a connection is inside an uninterruptible
7
- * critical section (lock → modify → unlock). A short per-request timeout must
8
- * not abort such a request mid-flight — not because aborting ends anything on
9
- * the server, but because it ends what the CLIENT knows: the modification may
10
- * or may not have been applied, and the handle `unlock` needs is gone, while
11
- * the lock and the ABAP session holding it sit there until that server-side
12
- * idle timeout, which this side can neither read nor influence.
13
- * Configurable via SAP_TIMEOUT_CRITICAL (ms).
14
- * Default 600000 (10 minutes) — a generous ceiling that still guards against a
15
- * permanently dead socket hanging forever.
16
- */
17
- export declare function getCriticalSectionTimeout(): number;
18
- //# sourceMappingURL=timeouts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"timeouts.d.ts","sourceRoot":"","sources":["../../src/utils/timeouts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAG9E,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAE3C,wBAAgB,gBAAgB,IAAI,cAAc,CAajD;AAED,wBAAgB,UAAU,CACxB,IAAI,GAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAkB,GACrD,MAAM,CAOR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD"}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTimeoutConfig = getTimeoutConfig;
4
- exports.getTimeout = getTimeout;
5
- exports.getCriticalSectionTimeout = getCriticalSectionTimeout;
6
- function getTimeoutConfig() {
7
- const defaultTimeout = parseInt(process.env.SAP_TIMEOUT_DEFAULT || '45000', 10);
8
- const csrfTimeout = parseInt(process.env.SAP_TIMEOUT_CSRF || '15000', 10);
9
- const longTimeout = parseInt(process.env.SAP_TIMEOUT_LONG || '60000', 10);
10
- return {
11
- default: defaultTimeout,
12
- csrf: csrfTimeout,
13
- long: longTimeout,
14
- };
15
- }
16
- function getTimeout(type = 'default') {
17
- if (typeof type === 'number') {
18
- return type;
19
- }
20
- const config = getTimeoutConfig();
21
- return config[type];
22
- }
23
- /**
24
- * Large ceiling timeout applied while a connection is inside an uninterruptible
25
- * critical section (lock → modify → unlock). A short per-request timeout must
26
- * not abort such a request mid-flight — not because aborting ends anything on
27
- * the server, but because it ends what the CLIENT knows: the modification may
28
- * or may not have been applied, and the handle `unlock` needs is gone, while
29
- * the lock and the ABAP session holding it sit there until that server-side
30
- * idle timeout, which this side can neither read nor influence.
31
- * Configurable via SAP_TIMEOUT_CRITICAL (ms).
32
- * Default 600000 (10 minutes) — a generous ceiling that still guards against a
33
- * permanently dead socket hanging forever.
34
- */
35
- function getCriticalSectionTimeout() {
36
- return parseInt(process.env.SAP_TIMEOUT_CRITICAL || '600000', 10);
37
- }