@mcp-abap-adt/connection 16.0.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.
- package/CHANGELOG.md +44 -1
- package/README.md +74 -18
- package/dist/connection/AbstractAbapConnection.d.ts +51 -19
- package/dist/connection/AbstractAbapConnection.d.ts.map +1 -1
- package/dist/connection/AbstractAbapConnection.js +100 -32
- package/dist/connection/AdtCloudConnector.d.ts +6 -1
- package/dist/connection/AdtCloudConnector.d.ts.map +1 -1
- package/dist/connection/AdtCloudConnector.js +7 -2
- package/dist/connection/AdtOnPremConnector.d.ts +6 -1
- package/dist/connection/AdtOnPremConnector.d.ts.map +1 -1
- package/dist/connection/AdtOnPremConnector.js +7 -2
- package/dist/connection/CloudHttpTransport.d.ts.map +1 -1
- package/dist/connection/CloudHttpTransport.js +2 -3
- package/dist/connection/CredentialAbapConnection.d.ts +3 -1
- package/dist/connection/CredentialAbapConnection.d.ts.map +1 -1
- package/dist/connection/CredentialAbapConnection.js +4 -2
- package/dist/connection/GenericWebSocketTransport.d.ts.map +1 -1
- package/dist/connection/GenericWebSocketTransport.js +7 -4
- package/dist/connection/HttpTransport.d.ts +19 -0
- package/dist/connection/HttpTransport.d.ts.map +1 -1
- package/dist/connection/HttpTransport.js +115 -5
- package/dist/connection/IAdtTransport.d.ts +34 -3
- package/dist/connection/IAdtTransport.d.ts.map +1 -1
- package/dist/connection/RfcTransport.d.ts +7 -0
- package/dist/connection/RfcTransport.d.ts.map +1 -1
- package/dist/connection/RfcTransport.js +14 -3
- package/dist/connection/createConnection.d.ts +18 -0
- package/dist/connection/createConnection.d.ts.map +1 -1
- package/dist/connection/createConnection.js +8 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/docs/INDEX.md +2 -0
- package/docs/MIGRATION-17.0.md +119 -0
- package/docs/SCOPE.md +7 -2
- package/docs/STATEFUL_SESSION_GUIDE.md +12 -11
- package/docs/USAGE.md +88 -36
- package/package.json +1 -1
- package/dist/utils/timeouts.d.ts +0 -18
- package/dist/utils/timeouts.d.ts.map +0 -1
- package/dist/utils/timeouts.js +0 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdtCloudConnector.d.ts","sourceRoot":"","sources":["../../src/connection/AdtCloudConnector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,qBAAa,iBAAiB,CAC5B,WAAW,SAAS,aAAa,GAAG,aAAa;AACjD;;;;GAIG;AACH,UAAU,SAAS,eAAe,GAAG,kBAAkB,CACvD,SAAQ,wBAAwB,CAAC,WAAW,CAAC;IAC7C,SAAiB,SAAS,EAAE,UAAU,CAAC;gBAGrC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,WAAW,EACvB,SAAS,EAAE,UAAU,EACrB,MAAM,GAAE,OAAO,GAAG,IAAW,EAC7B,SAAS,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"AdtCloudConnector.d.ts","sourceRoot":"","sources":["../../src/connection/AdtCloudConnector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,qBAAa,iBAAiB,CAC5B,WAAW,SAAS,aAAa,GAAG,aAAa;AACjD;;;;GAIG;AACH,UAAU,SAAS,eAAe,GAAG,kBAAkB,CACvD,SAAQ,wBAAwB,CAAC,WAAW,CAAC;IAC7C,SAAiB,SAAS,EAAE,UAAU,CAAC;gBAGrC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,WAAW,EACvB,SAAS,EAAE,UAAU,EACrB,MAAM,GAAE,OAAO,GAAG,IAAW,EAC7B,SAAS,CAAC,EAAE,MAAM;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM;CAInB"}
|
|
@@ -20,8 +20,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.AdtCloudConnector = void 0;
|
|
21
21
|
const CredentialAbapConnection_js_1 = require("./CredentialAbapConnection.js");
|
|
22
22
|
class AdtCloudConnector extends CredentialAbapConnection_js_1.CredentialAbapConnection {
|
|
23
|
-
constructor(config, credential, transport, logger = null, sessionId
|
|
24
|
-
|
|
23
|
+
constructor(config, credential, transport, logger = null, sessionId,
|
|
24
|
+
/**
|
|
25
|
+
* An existing session to take over instead of logging on: the cookies
|
|
26
|
+
* `sessionCookies()` returned for it. HTTP wires only.
|
|
27
|
+
*/
|
|
28
|
+
session) {
|
|
29
|
+
super(config, credential, transport, logger, sessionId, session);
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
exports.AdtCloudConnector = AdtCloudConnector;
|
|
@@ -38,6 +38,11 @@ TTransport extends IOnPremTransport = OnPremHttpTransport> extends CredentialAba
|
|
|
38
38
|
* taking any connection and casting.
|
|
39
39
|
*/
|
|
40
40
|
readonly transport: TTransport;
|
|
41
|
-
constructor(config: SapConfig, credential: TCredential, transport: TTransport, logger?: ILogger | null, sessionId?: string
|
|
41
|
+
constructor(config: SapConfig, credential: TCredential, transport: TTransport, logger?: ILogger | null, sessionId?: string,
|
|
42
|
+
/**
|
|
43
|
+
* An existing session to take over instead of logging on: the cookies
|
|
44
|
+
* `sessionCookies()` returned for it. HTTP wires only.
|
|
45
|
+
*/
|
|
46
|
+
session?: string);
|
|
42
47
|
}
|
|
43
48
|
//# sourceMappingURL=AdtOnPremConnector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdtOnPremConnector.d.ts","sourceRoot":"","sources":["../../src/connection/AdtOnPremConnector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,qBAAa,kBAAkB,CAC7B,WAAW,SAAS,aAAa,GAAG,aAAa;AACjD;;;;GAIG;AACH,UAAU,SAAS,gBAAgB,GAAG,mBAAmB,CACzD,SAAQ,wBAAwB,CAAC,WAAW,CAAC;IAC7C;;;;;;;OAOG;IACH,SAAiB,SAAS,EAAE,UAAU,CAAC;gBAGrC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,WAAW,EACvB,SAAS,EAAE,UAAU,EACrB,MAAM,GAAE,OAAO,GAAG,IAAW,EAC7B,SAAS,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"AdtOnPremConnector.d.ts","sourceRoot":"","sources":["../../src/connection/AdtOnPremConnector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,qBAAa,kBAAkB,CAC7B,WAAW,SAAS,aAAa,GAAG,aAAa;AACjD;;;;GAIG;AACH,UAAU,SAAS,gBAAgB,GAAG,mBAAmB,CACzD,SAAQ,wBAAwB,CAAC,WAAW,CAAC;IAC7C;;;;;;;OAOG;IACH,SAAiB,SAAS,EAAE,UAAU,CAAC;gBAGrC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,WAAW,EACvB,SAAS,EAAE,UAAU,EACrB,MAAM,GAAE,OAAO,GAAG,IAAW,EAC7B,SAAS,CAAC,EAAE,MAAM;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM;CAInB"}
|
|
@@ -21,8 +21,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.AdtOnPremConnector = void 0;
|
|
22
22
|
const CredentialAbapConnection_js_1 = require("./CredentialAbapConnection.js");
|
|
23
23
|
class AdtOnPremConnector extends CredentialAbapConnection_js_1.CredentialAbapConnection {
|
|
24
|
-
constructor(config, credential, transport, logger = null, sessionId
|
|
25
|
-
|
|
24
|
+
constructor(config, credential, transport, logger = null, sessionId,
|
|
25
|
+
/**
|
|
26
|
+
* An existing session to take over instead of logging on: the cookies
|
|
27
|
+
* `sessionCookies()` returned for it. HTTP wires only.
|
|
28
|
+
*/
|
|
29
|
+
session) {
|
|
30
|
+
super(config, credential, transport, logger, sessionId, session);
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
exports.AdtOnPremConnector = AdtOnPremConnector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudHttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/CloudHttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;
|
|
1
|
+
{"version":3,"file":"CloudHttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/CloudHttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAgB9E,qBAAa,kBACX,SAAQ,aACR,YAAW,eAAe;IAE1B,SAAkB,IAAI,gBAAgB;IAEtC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAU;IAEnC;;;;;;;;;;;;;;;;;OAiBG;cACgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI3D,iGAAiG;IACjG,OAAO,CAAC,MAAM,CAAuB;IAEtB,IAAI,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiEhD,KAAK,CAClB,OAAO,EAAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,GACnB,OAAO,CAAC,IAAI,CAAC;IA8ChB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAenB;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;CAWjB"}
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.CloudHttpTransport = void 0;
|
|
36
36
|
const cookies_js_1 = require("../utils/cookies.js");
|
|
37
|
-
const timeouts_js_1 = require("../utils/timeouts.js");
|
|
38
37
|
const authErrors_js_1 = require("./authErrors.js");
|
|
39
38
|
const HttpTransport_js_1 = require("./HttpTransport.js");
|
|
40
39
|
const SESSIONS_PATH = '/sap/bc/adt/core/http/sessions';
|
|
@@ -87,8 +86,8 @@ class CloudHttpTransport extends HttpTransport_js_1.HttpTransport {
|
|
|
87
86
|
// from anything's cache — a cached session document would hand back an
|
|
88
87
|
// address that belongs to a session somebody else already ended.
|
|
89
88
|
url: `${context.baseUrl}${SESSIONS_PATH}?_=${Date.now()}`,
|
|
90
|
-
//
|
|
91
|
-
|
|
89
|
+
// No deadline: a client deadline closes the socket, and SAP then
|
|
90
|
+
// ends what was running on it. connect() waits for SAP's answer.
|
|
92
91
|
headers: {
|
|
93
92
|
...auth,
|
|
94
93
|
...context.extraHeaders,
|
|
@@ -22,7 +22,9 @@ export declare abstract class CredentialAbapConnection<TCredential extends IAuth
|
|
|
22
22
|
readonly credential: TCredential;
|
|
23
23
|
constructor(config: SapConfig,
|
|
24
24
|
/** Public because the type is the point: a caller can reach what it gave. */
|
|
25
|
-
credential: TCredential, transport: IAdtTransport, logger?: ILogger | null, sessionId?: string
|
|
25
|
+
credential: TCredential, transport: IAdtTransport, logger?: ILogger | null, sessionId?: string,
|
|
26
|
+
/** An existing session to take over; see `createConnection`'s `session`. */
|
|
27
|
+
session?: string);
|
|
26
28
|
/**
|
|
27
29
|
* Whatever the credential needs before the first request goes out.
|
|
28
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/CredentialAbapConnection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAA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CAAC,EAAE,MAAM;IAClB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM;IAKlB;;;;;;;;;;OAUG;cACsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAU3D;;;;;;;OAOG;cACsB,gBAAgB,CACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC;IAYhB,6EAA6E;cACpD,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAUnE;;;OAGG;cACsB,kBAAkB,CACzC,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,aAAa,CAAC;cAIT,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CA+ClD"}
|
|
@@ -22,8 +22,10 @@ class CredentialAbapConnection extends AbstractAbapConnection_js_1.AbstractAbapC
|
|
|
22
22
|
credential;
|
|
23
23
|
constructor(config,
|
|
24
24
|
/** Public because the type is the point: a caller can reach what it gave. */
|
|
25
|
-
credential, transport, logger = null, sessionId
|
|
26
|
-
|
|
25
|
+
credential, transport, logger = null, sessionId,
|
|
26
|
+
/** An existing session to take over; see `createConnection`'s `session`. */
|
|
27
|
+
session) {
|
|
28
|
+
super(config, transport, logger, sessionId, session);
|
|
27
29
|
this.credential = credential;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericWebSocketTransport.d.ts","sourceRoot":"","sources":["../../src/connection/GenericWebSocketTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAE1C;;GAEG;AACH,UAAU,cAAc;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAA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CAAC,IAAI,CAAC;IA2DV,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBzD,IAAI,CAAC,CAAC,GAAG,OAAO,EACpB,OAAO,EAAE,yBAAyB,CAAC,CAAC,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC;IAQhB,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,IAAI;IAIlE,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAIjD,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAI9D,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAI3E,WAAW,IAAI,OAAO;YAIR,qBAAqB;IAoBnC,OAAO,CAAC,cAAc;YAUR,QAAQ;YAMR,SAAS;YAMT,SAAS;CAKxB;AAED,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -16,13 +16,16 @@ class GenericWebSocketTransport {
|
|
|
16
16
|
if (this.socket && this.isConnected()) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
// The caller's deadline, or none: no default of this package's own.
|
|
20
|
+
const connectTimeoutMs = options?.connectTimeoutMs;
|
|
20
21
|
const socket = this.factory.create(url, options?.protocols, options);
|
|
21
22
|
this.socket = socket;
|
|
22
23
|
await new Promise((resolve, reject) => {
|
|
23
|
-
const timeoutId =
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const timeoutId = connectTimeoutMs === undefined
|
|
25
|
+
? undefined
|
|
26
|
+
: setTimeout(() => {
|
|
27
|
+
reject(new Error(`WebSocket connect timeout after ${connectTimeoutMs}ms`));
|
|
28
|
+
}, connectTimeoutMs);
|
|
26
29
|
socket.onopen = () => {
|
|
27
30
|
clearTimeout(timeoutId);
|
|
28
31
|
this.emitOpen().catch(() => {
|
|
@@ -86,6 +86,25 @@ export declare class HttpTransport implements IAdtTransport {
|
|
|
86
86
|
ingest(headers?: Record<string, unknown>): void;
|
|
87
87
|
/** What to put on the `Cookie` header, or nothing if the jar is empty. */
|
|
88
88
|
cookies(): string | null;
|
|
89
|
+
/**
|
|
90
|
+
* The session's cookies, for the caller to keep and hand back to
|
|
91
|
+
* `resume()`: the jar without `sap-XSRF_*`, which belongs to the CSRF token
|
|
92
|
+
* and is earned again with it. `SAP_SESSIONID_*`, `sap-usercontext`,
|
|
93
|
+
* `sap-contextid` — so a stateful request after the resume reaches the same
|
|
94
|
+
* ABAP context — and whatever else the server set to keep the session where
|
|
95
|
+
* it lives. `null` while the wire holds no live `SAP_SESSIONID`.
|
|
96
|
+
*/
|
|
97
|
+
sessionCookies(): string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Take over the session `session` names: see `IAdtTransport.resume`.
|
|
100
|
+
*
|
|
101
|
+
* The request is the CSRF fetch on the discovery endpoint — the fallback on
|
|
102
|
+
* a `404` there, as `establish()` does, in the same session — with no
|
|
103
|
+
* credential and no retry. On the cloud wire it says
|
|
104
|
+
* `x-sap-security-session: use`, because the seeded jar holds a session
|
|
105
|
+
* (`sessionHeaders`).
|
|
106
|
+
*/
|
|
107
|
+
resume(context: IAdtSessionContext, session: string): Promise<void>;
|
|
89
108
|
/**
|
|
90
109
|
* Which ABAP session this wire is on.
|
|
91
110
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpTransport.d.ts","sourceRoot":"","sources":["../../src/connection/HttpTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK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,OAAO,EAAE,kBAAkB,EAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjC;IACD,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,IAAI,GACnB,OAAO,CAAC,IAAI,CAAC;IAyChB;;;;;OAKG;IACG,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAKzE;;;;;;OAMG;IACH,OAAO,CAAC,GAAG;IAmBX;;;;;;;;;;;;;;OAcG;cACa,YAAY,CAC1B,OAAO,EAAE,oBAAoB;IAC7B,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,IAAI,GACnB,OAAO,CAAC,qBAAqB,CAAC;IAIjC;;;;;;OAMG;IACH,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,GAC9C,aAAa;YAMF,QAAQ;CA8DvB"}
|
|
@@ -103,6 +103,27 @@ function absentEndpoint(error) {
|
|
|
103
103
|
?.response?.status;
|
|
104
104
|
return status === 404 || status === 501;
|
|
105
105
|
}
|
|
106
|
+
/** The cookie the CSRF token is bound to: re-earned with the token, never kept. */
|
|
107
|
+
const XSRF_COOKIE_PREFIX = 'sap-XSRF_';
|
|
108
|
+
/** Two fingerprints name the same session: the same cookies, the same values. */
|
|
109
|
+
function sameSession(a, b) {
|
|
110
|
+
if (a.size !== b.size)
|
|
111
|
+
return false;
|
|
112
|
+
for (const [name, value] of a) {
|
|
113
|
+
if (b.get(name) !== value)
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* SAP answered, but not as the session handed over. The answer rides on the
|
|
120
|
+
* error as `response`, as on any refusal; the words are fixed.
|
|
121
|
+
*/
|
|
122
|
+
function notTheSession(response, what) {
|
|
123
|
+
const error = new Error(`The session handed over did not answer as itself: ${what}. Nothing was logged on and nothing is logged off; this connection is spent.`);
|
|
124
|
+
error.response = response;
|
|
125
|
+
return error;
|
|
126
|
+
}
|
|
106
127
|
const MATERIAL_FIELDS = ['cert', 'key', 'pfx', 'passphrase'];
|
|
107
128
|
/**
|
|
108
129
|
* The material fields a provider offered, and nothing else: a key outside
|
|
@@ -254,6 +275,95 @@ class HttpTransport {
|
|
|
254
275
|
cookies() {
|
|
255
276
|
return this.combined;
|
|
256
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* The session's cookies, for the caller to keep and hand back to
|
|
280
|
+
* `resume()`: the jar without `sap-XSRF_*`, which belongs to the CSRF token
|
|
281
|
+
* and is earned again with it. `SAP_SESSIONID_*`, `sap-usercontext`,
|
|
282
|
+
* `sap-contextid` — so a stateful request after the resume reaches the same
|
|
283
|
+
* ABAP context — and whatever else the server set to keep the session where
|
|
284
|
+
* it lives. `null` while the wire holds no live `SAP_SESSIONID`.
|
|
285
|
+
*/
|
|
286
|
+
sessionCookies() {
|
|
287
|
+
if (!this.holdsSessionCookie())
|
|
288
|
+
return null;
|
|
289
|
+
const pairs = Array.from(this.jar.entries())
|
|
290
|
+
.filter(([name]) => !name.startsWith(XSRF_COOKIE_PREFIX))
|
|
291
|
+
.map(([name, value]) => (value ? `${name}=${value}` : name));
|
|
292
|
+
return pairs.join('; ');
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Take over the session `session` names: see `IAdtTransport.resume`.
|
|
296
|
+
*
|
|
297
|
+
* The request is the CSRF fetch on the discovery endpoint — the fallback on
|
|
298
|
+
* a `404` there, as `establish()` does, in the same session — with no
|
|
299
|
+
* credential and no retry. On the cloud wire it says
|
|
300
|
+
* `x-sap-security-session: use`, because the seeded jar holds a session
|
|
301
|
+
* (`sessionHeaders`).
|
|
302
|
+
*/
|
|
303
|
+
async resume(context, session) {
|
|
304
|
+
this.forgetSession();
|
|
305
|
+
this.ingest({
|
|
306
|
+
'set-cookie': session
|
|
307
|
+
.split(';')
|
|
308
|
+
.map((entry) => entry.trim())
|
|
309
|
+
.filter((entry) => entry !== ''),
|
|
310
|
+
});
|
|
311
|
+
const handed = this.sessionFingerprint();
|
|
312
|
+
if (handed.size === 0) {
|
|
313
|
+
this.forgetSession();
|
|
314
|
+
throw new Error('The session handed over names no SAP_SESSIONID, so there is no session to take over; nothing was sent.');
|
|
315
|
+
}
|
|
316
|
+
const base = context.baseUrl.endsWith('/')
|
|
317
|
+
? context.baseUrl.slice(0, -1)
|
|
318
|
+
: context.baseUrl;
|
|
319
|
+
const endpoints = [
|
|
320
|
+
`${base}${csrfConfig_js_1.CSRF_CONFIG.ENDPOINT}`,
|
|
321
|
+
`${base}${csrfConfig_js_1.CSRF_CONFIG.FALLBACK_ENDPOINT}`,
|
|
322
|
+
];
|
|
323
|
+
let response;
|
|
324
|
+
for (const [index, url] of endpoints.entries()) {
|
|
325
|
+
try {
|
|
326
|
+
// No `context.authorize`: the session's cookies are the only thing
|
|
327
|
+
// that may authenticate this request. And no redirect followed: a
|
|
328
|
+
// redirect is not the session answering — followed, a login page's
|
|
329
|
+
// 200, or a SAP_SESSIONID replaced on the way, would be judged
|
|
330
|
+
// instead of what SAP said. Not admitted, a 3xx rejects as it came.
|
|
331
|
+
const fixed = this.fix({
|
|
332
|
+
method: 'GET',
|
|
333
|
+
url,
|
|
334
|
+
headers: {
|
|
335
|
+
...context.extraHeaders,
|
|
336
|
+
...csrfConfig_js_1.CSRF_CONFIG.REQUIRED_HEADERS,
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
response = await this.dispatch(fixed, this.dress(fixed), undefined, {
|
|
340
|
+
maxRedirects: 0,
|
|
341
|
+
});
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
if (index === 0 && absentEndpoint(error))
|
|
346
|
+
continue;
|
|
347
|
+
// SAP's answer as it is — a 401 for a session that is gone.
|
|
348
|
+
throw error;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (!response)
|
|
352
|
+
throw new Error(csrfConfig_js_1.CSRF_ERROR_MESSAGES.NOT_IN_HEADERS);
|
|
353
|
+
context.observe(response.headers);
|
|
354
|
+
this.ingest(response.headers);
|
|
355
|
+
if (!sameSession(handed, this.sessionFingerprint())) {
|
|
356
|
+
throw notTheSession(response, 'the answer names another session, or none');
|
|
357
|
+
}
|
|
358
|
+
const token = response.headers['x-csrf-token'];
|
|
359
|
+
if (typeof token !== 'string' || token === '') {
|
|
360
|
+
throw notTheSession(response, 'the answer carries no CSRF token');
|
|
361
|
+
}
|
|
362
|
+
this.token = token;
|
|
363
|
+
// The credential's logon, now that the session has answered: what it
|
|
364
|
+
// brings — TLS material — is for the requests that follow.
|
|
365
|
+
await context.logon(this.logonTarget());
|
|
366
|
+
}
|
|
257
367
|
/**
|
|
258
368
|
* Which ABAP session this wire is on.
|
|
259
369
|
*
|
|
@@ -404,7 +514,7 @@ class HttpTransport {
|
|
|
404
514
|
for (const [index, url] of endpoints.entries()) {
|
|
405
515
|
// The fallback exists for a system that HAS no
|
|
406
516
|
// `/sap/bc/adt/core/discovery` — BASIS < 7.52 — which the server says by
|
|
407
|
-
// answering 404 there. Trying it after a refused connection or a
|
|
517
|
+
// answering 404 there. Trying it after a refused connection or a network
|
|
408
518
|
// asks a host that is not answering to answer a different path, which
|
|
409
519
|
// doubles the wait before the caller is told what is actually wrong.
|
|
410
520
|
if (index > 0 && !absentEndpoint(last))
|
|
@@ -422,9 +532,6 @@ class HttpTransport {
|
|
|
422
532
|
...context.extraHeaders,
|
|
423
533
|
...csrfConfig_js_1.CSRF_CONFIG.REQUIRED_HEADERS,
|
|
424
534
|
},
|
|
425
|
-
...(context.timeoutMs !== undefined
|
|
426
|
-
? { timeout: context.timeoutMs }
|
|
427
|
-
: {}),
|
|
428
535
|
});
|
|
429
536
|
// Handed up BEFORE the token is read: the cookies are the session,
|
|
430
537
|
// and a fold that only happened on success would lose the session a
|
|
@@ -861,8 +968,11 @@ class HttpTransport {
|
|
|
861
968
|
? (0, node_https_1.request)(options, onResponse)
|
|
862
969
|
: (0, node_http_1.request)(options, onResponse);
|
|
863
970
|
}
|
|
864
|
-
async dispatch(request, headers, written
|
|
971
|
+
async dispatch(request, headers, written,
|
|
972
|
+
/** `maxRedirects: 0` for the adoption probe alone; see `resume()`. */
|
|
973
|
+
redirects) {
|
|
865
974
|
const response = await this.client()({
|
|
975
|
+
...(redirects ?? {}),
|
|
866
976
|
// The write is the point `disconnect()` resolves at: the request's
|
|
867
977
|
// `finish`, emitted once its bytes are handed to the socket — not when
|
|
868
978
|
// the server answers, which it may do minutes later or never.
|
|
@@ -30,7 +30,12 @@ export interface IAdtTransportRequest {
|
|
|
30
30
|
* its query — silently, and only on one of the two wires.
|
|
31
31
|
*/
|
|
32
32
|
params?: Record<string, unknown>;
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Milliseconds: the caller's own deadline, and the only one a request
|
|
35
|
+
* carries. Absent means none — no wire sets one of its own, because a
|
|
36
|
+
* client deadline closes the socket and SAP then ends the request running
|
|
37
|
+
* on it, a write in it lost.
|
|
38
|
+
*/
|
|
34
39
|
timeout?: number;
|
|
35
40
|
/**
|
|
36
41
|
* Which statuses resolve rather than throw. Absent means the default: 2xx
|
|
@@ -110,8 +115,6 @@ export interface IAdtEstablishContext extends IAdtSessionContext {
|
|
|
110
115
|
retries?: number;
|
|
111
116
|
/** Milliseconds between attempts. Absent means the transport's own default. */
|
|
112
117
|
retryDelayMs?: number;
|
|
113
|
-
/** Milliseconds per attempt. Absent means the transport's own default. */
|
|
114
|
-
timeoutMs?: number;
|
|
115
118
|
/**
|
|
116
119
|
* Which failures must not be retried.
|
|
117
120
|
*
|
|
@@ -185,6 +188,34 @@ export interface IAdtTransport {
|
|
|
185
188
|
ingest(headers?: Record<string, unknown>): void;
|
|
186
189
|
/** What to put on the `Cookie` header, or `null` for a wire that has none. */
|
|
187
190
|
cookies(): string | null;
|
|
191
|
+
/**
|
|
192
|
+
* Take over a session that already exists, instead of logging on.
|
|
193
|
+
*
|
|
194
|
+
* `session` is what `sessionCookies()` handed out for it. The wire seeds its
|
|
195
|
+
* jar with those cookies and makes ONE request in that session **without
|
|
196
|
+
* the credential**, earning its CSRF token: a dead session must not quietly
|
|
197
|
+
* become a new one, and a credential on the request would open one (a dead
|
|
198
|
+
* cookie with a good password gets a new `SAP_SESSIONID`, measured). The
|
|
199
|
+
* credential's logon (`context.logon`) is offered only once the session has
|
|
200
|
+
* answered, so what it brings rides on the requests that follow, never on
|
|
201
|
+
* this one.
|
|
202
|
+
*
|
|
203
|
+
* Resolves when SAP answered as that session — a CSRF token, and the
|
|
204
|
+
* `SAP_SESSIONID` it was handed, unchanged. Rejects otherwise with SAP's
|
|
205
|
+
* answer as it is: a `401`, or an error carrying the `response` that did not
|
|
206
|
+
* belong to the session. Nothing is logged off either way: the wire opened
|
|
207
|
+
* nothing.
|
|
208
|
+
*
|
|
209
|
+
* A wire whose session is not something a cookie names — RFC, where it is a
|
|
210
|
+
* conversation — rejects without sending anything.
|
|
211
|
+
*/
|
|
212
|
+
resume(context: IAdtSessionContext, session: string): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* The cookies of the session this wire is on, as `resume()` takes them, or
|
|
215
|
+
* `null` while it is on none (or on a wire whose session no cookie names).
|
|
216
|
+
* For the caller to keep; never logged.
|
|
217
|
+
*/
|
|
218
|
+
sessionCookies(): string | null;
|
|
188
219
|
/**
|
|
189
220
|
* Which session this wire is on, as something comparable.
|
|
190
221
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IAdtTransport.d.ts","sourceRoot":"","sources":["../../src/connection/IAdtTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,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OAAO,CAAC,GAAG,IAAI,CAAC;IAEhD,8EAA8E;IAC9E,OAAO,IAAI,MAAM,GAAG,IAAI,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpE;;;;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"}
|
|
@@ -118,6 +118,13 @@ export declare class RfcTransport implements IOnPremTransport {
|
|
|
118
118
|
ingest(): void;
|
|
119
119
|
/** None, and never any: see `ingest()`. */
|
|
120
120
|
cookies(): null;
|
|
121
|
+
/** None: the session is the conversation, which no cookie names. */
|
|
122
|
+
sessionCookies(): null;
|
|
123
|
+
/**
|
|
124
|
+
* Refused, with nothing sent: an RFC session is a conversation, opened by
|
|
125
|
+
* this process and held by it, and a conversation cannot be taken over.
|
|
126
|
+
*/
|
|
127
|
+
resume(): Promise<void>;
|
|
121
128
|
/**
|
|
122
129
|
* Nothing to establish. `open()` made the ABAP session, and there is no token
|
|
123
130
|
* to earn: this endpoint answers `x-csrf-token: fetch` with the same two
|
|
@@ -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,qB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AAqB,CAAC;IAezE;;;;;;;;;;;;;OAaG;YACW,aAAa;YAUb,WAAW;IAqDzB,uEAAuE;YACzD,gBAAgB;IAa9B;;;;OAIG;YACW,OAAO;IAWrB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAgBnB;;;;OAIG;YACW,QAAQ;YAYR,YAAY;YAQZ,KAAK;CA+KpB"}
|
|
@@ -170,6 +170,17 @@ class RfcTransport {
|
|
|
170
170
|
cookies() {
|
|
171
171
|
return null;
|
|
172
172
|
}
|
|
173
|
+
/** None: the session is the conversation, which no cookie names. */
|
|
174
|
+
sessionCookies() {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Refused, with nothing sent: an RFC session is a conversation, opened by
|
|
179
|
+
* this process and held by it, and a conversation cannot be taken over.
|
|
180
|
+
*/
|
|
181
|
+
async resume() {
|
|
182
|
+
throw new TypeError('An RFC session cannot be taken over: it is a conversation, not something a cookie names. Over RFC, connect() opens a new session.');
|
|
183
|
+
}
|
|
173
184
|
/**
|
|
174
185
|
* Nothing to establish. `open()` made the ABAP session, and there is no token
|
|
175
186
|
* to earn: this endpoint answers `x-csrf-token: fetch` with the same two
|
|
@@ -488,9 +499,9 @@ class RfcTransport {
|
|
|
488
499
|
//
|
|
489
500
|
// Nor is one needed. What bounds this call is the server: a dialog step
|
|
490
501
|
// ends at `rdisp/max_wprun_time`. And a call that cannot be torn down
|
|
491
|
-
// mid-flight is precisely what the connection
|
|
492
|
-
// a critical section
|
|
493
|
-
//
|
|
502
|
+
// mid-flight is precisely what the connection keeps over HTTP, where a
|
|
503
|
+
// request inside a critical section carries no deadline at all, so an
|
|
504
|
+
// abort cannot orphan a lock handle. Here that comes free.
|
|
494
505
|
// The last point before anything leaves: nothing awaits between this
|
|
495
506
|
// check and the call, so a close() that ran at any await above stops it.
|
|
496
507
|
if (generation !== this.generation) {
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
* session: after its `disconnect()` (or a logoff of its own) it is spent, and
|
|
13
13
|
* a new session is a new call to this.
|
|
14
14
|
*
|
|
15
|
+
* **Or an existing session.** `session` — the cookies an earlier instance's
|
|
16
|
+
* `sessionCookies()` returned — builds the instance on that session instead:
|
|
17
|
+
* `connect()` does not log on, and SAP's answer to its one request says
|
|
18
|
+
* whether the session is alive. HTTP wires only; over RFC it is refused here.
|
|
19
|
+
*
|
|
15
20
|
* Every transport option is passed through as the caller gives it; what is
|
|
16
21
|
* not given takes the constructor's own default, nothing more.
|
|
17
22
|
*/
|
|
@@ -49,6 +54,14 @@ interface HttpWireOptions {
|
|
|
49
54
|
* the credential (its TLS material arrives at logon). Absent: none.
|
|
50
55
|
*/
|
|
51
56
|
agentOptions?: (() => AgentOptions) | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* An existing session to build the instance on, instead of logging on: the
|
|
59
|
+
* string an instance's `sessionCookies()` returned. `connect()` then sends
|
|
60
|
+
* no logon; it asks SAP, without the credential, whether that session is
|
|
61
|
+
* alive, and rejects with SAP's answer when it is not. Absent: `connect()`
|
|
62
|
+
* logs on and opens a new session.
|
|
63
|
+
*/
|
|
64
|
+
session?: string | undefined;
|
|
52
65
|
}
|
|
53
66
|
export interface CloudHttpSpec<TCredential extends IAuthProvider = IAuthProvider> extends ConnectionSpecBase<TCredential>, HttpWireOptions {
|
|
54
67
|
system: 'cloud';
|
|
@@ -64,6 +77,11 @@ export interface OnPremRfcSpec<TCredential extends IAuthProvider = IAuthProvider
|
|
|
64
77
|
transport: 'rfc';
|
|
65
78
|
/** The RFC wire's own options (`logWire`, `maxLoggedBodyChars`). */
|
|
66
79
|
rfc?: IRfcTransportOptions | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Not over RFC: its session is a conversation, which cannot be taken over.
|
|
82
|
+
* Refused at construction.
|
|
83
|
+
*/
|
|
84
|
+
session?: undefined;
|
|
67
85
|
}
|
|
68
86
|
export type ConnectionSpec<TCredential extends IAuthProvider = IAuthProvider> = CloudHttpSpec<TCredential> | OnPremHttpSpec<TCredential> | OnPremRfcSpec<TCredential>;
|
|
69
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createConnection.d.ts","sourceRoot":"","sources":["../../src/connection/createConnection.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"createConnection.d.ts","sourceRoot":"","sources":["../../src/connection/createConnection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,KAAK,oBAAoB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG5E,oCAAoC;AACpC,UAAU,kBAAkB,CAAC,WAAW,SAAS,aAAa;IAC5D,8EAA8E;IAC9E,MAAM,EAAE,SAAS,CAAC;IAClB,wDAAwD;IACxD,UAAU,EAAE,WAAW,CAAC;IACxB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,wCA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AC,WAAW,SAAS,aAAa,EAChE,IAAI,EAAE,cAAc,CAAC,WAAW,CAAC,GAChC,iBAAiB,CAAC,WAAW,CAAC,CA8DhC"}
|
|
@@ -15,20 +15,25 @@ function stated(spec) {
|
|
|
15
15
|
}
|
|
16
16
|
function createConnection(spec) {
|
|
17
17
|
const { system, transport } = stated(spec);
|
|
18
|
+
// Fixed words, before anything is built.
|
|
19
|
+
if (transport === 'rfc' &&
|
|
20
|
+
spec.session !== undefined) {
|
|
21
|
+
throw new TypeError("createConnection: an RFC session cannot be taken over — it is a conversation, not something a cookie names. 'session' is for the HTTP wires; over RFC, connect() opens a new session.");
|
|
22
|
+
}
|
|
18
23
|
const logger = spec.logger ?? null;
|
|
19
24
|
const wireLogger = spec.wireLogger ?? null;
|
|
20
25
|
const address = { client: spec.config.client, baseUrl: spec.config.url };
|
|
21
26
|
if (system === 'cloud' && transport === 'http') {
|
|
22
27
|
const http = spec;
|
|
23
|
-
return new AdtCloudConnector_js_1.AdtCloudConnector(spec.config, spec.credential, new CloudHttpTransport_js_1.CloudHttpTransport(http.agentOptions, wireLogger, address), logger, spec.sessionId);
|
|
28
|
+
return new AdtCloudConnector_js_1.AdtCloudConnector(spec.config, spec.credential, new CloudHttpTransport_js_1.CloudHttpTransport(http.agentOptions, wireLogger, address), logger, spec.sessionId, http.session);
|
|
24
29
|
}
|
|
25
30
|
if (system === 'onprem' && transport === 'http') {
|
|
26
31
|
const http = spec;
|
|
27
|
-
return new AdtOnPremConnector_js_1.AdtOnPremConnector(spec.config, spec.credential, new OnPremHttpTransport_js_1.OnPremHttpTransport(http.agentOptions, wireLogger, address), logger, spec.sessionId);
|
|
32
|
+
return new AdtOnPremConnector_js_1.AdtOnPremConnector(spec.config, spec.credential, new OnPremHttpTransport_js_1.OnPremHttpTransport(http.agentOptions, wireLogger, address), logger, spec.sessionId, http.session);
|
|
28
33
|
}
|
|
29
34
|
if (system === 'onprem' && transport === 'legacy-http') {
|
|
30
35
|
const http = spec;
|
|
31
|
-
return new AdtOnPremConnector_js_1.AdtOnPremConnector(spec.config, spec.credential, new LegacyOnPremHttpTransport_js_1.LegacyOnPremHttpTransport(http.agentOptions, wireLogger, address), logger, spec.sessionId);
|
|
36
|
+
return new AdtOnPremConnector_js_1.AdtOnPremConnector(spec.config, spec.credential, new LegacyOnPremHttpTransport_js_1.LegacyOnPremHttpTransport(http.agentOptions, wireLogger, address), logger, spec.sessionId, http.session);
|
|
32
37
|
}
|
|
33
38
|
if (system === 'onprem' && transport === 'rfc') {
|
|
34
39
|
const rfc = spec;
|
package/dist/index.d.ts
CHANGED
|
@@ -16,5 +16,4 @@ export { OnPremHttpTransport } from './connection/OnPremHttpTransport.js';
|
|
|
16
16
|
export { type IRfcConversation, type IRfcTransportOptions, RfcTransport, } from './connection/RfcTransport.js';
|
|
17
17
|
export { type RfcConnectionParams, rfcConversationFrom, rfcParamsFrom, } from './connection/rfcConversation.js';
|
|
18
18
|
export type { ILogger } from './logger.js';
|
|
19
|
-
export { getTimeout, getTimeoutConfig, type TimeoutConfig, } from './utils/timeouts.js';
|
|
20
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAK1C,YAAY,EACV,WAAW,EACX,SAAS,EACT,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,YAAY,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,O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AE,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,GACpB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,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,YAAY,GACb,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Types - re-exported from the contract packages, under the names this
|
|
3
3
|
// package has always published them by.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.rfcParamsFrom = exports.rfcConversationFrom = exports.RfcTransport = exports.OnPremHttpTransport = exports.LegacyOnPremHttpTransport = exports.HttpTransport = exports.GenericWebSocketTransport = exports.CSRF_ERROR_MESSAGES = exports.CSRF_CONFIG = exports.createConnection = exports.CloudHttpTransport = exports.WireLogonError = exports.AuthRefusedError = exports.AdtOnPremConnector = exports.AdtCloudConnector = exports.sapConfigSignature = void 0;
|
|
6
6
|
// Config utilities
|
|
7
7
|
var sapConfig_js_1 = require("./config/sapConfig.js");
|
|
8
8
|
Object.defineProperty(exports, "sapConfigSignature", { enumerable: true, get: function () { return sapConfig_js_1.sapConfigSignature; } });
|
|
@@ -45,7 +45,3 @@ Object.defineProperty(exports, "RfcTransport", { enumerable: true, get: function
|
|
|
45
45
|
var rfcConversation_js_1 = require("./connection/rfcConversation.js");
|
|
46
46
|
Object.defineProperty(exports, "rfcConversationFrom", { enumerable: true, get: function () { return rfcConversation_js_1.rfcConversationFrom; } });
|
|
47
47
|
Object.defineProperty(exports, "rfcParamsFrom", { enumerable: true, get: function () { return rfcConversation_js_1.rfcParamsFrom; } });
|
|
48
|
-
// Timeouts
|
|
49
|
-
var timeouts_js_1 = require("./utils/timeouts.js");
|
|
50
|
-
Object.defineProperty(exports, "getTimeout", { enumerable: true, get: function () { return timeouts_js_1.getTimeout; } });
|
|
51
|
-
Object.defineProperty(exports, "getTimeoutConfig", { enumerable: true, get: function () { return timeouts_js_1.getTimeoutConfig; } });
|