@mcp-abap-adt/interfaces-adt 1.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 +16 -0
- package/COPYING +674 -0
- package/LICENSE +165 -0
- package/README.md +35 -0
- package/dist/Headers.d.ts +57 -0
- package/dist/Headers.d.ts.map +1 -0
- package/dist/Headers.js +62 -0
- package/dist/adt/AdtTypes.d.ts +40 -0
- package/dist/adt/AdtTypes.d.ts.map +1 -0
- package/dist/adt/AdtTypes.js +5 -0
- package/dist/adt/IAdtAbapGit.d.ts +60 -0
- package/dist/adt/IAdtAbapGit.d.ts.map +1 -0
- package/dist/adt/IAdtAbapGit.js +2 -0
- package/dist/adt/IAdtAccessControl.d.ts +30 -0
- package/dist/adt/IAdtAccessControl.d.ts.map +1 -0
- package/dist/adt/IAdtAccessControl.js +5 -0
- package/dist/adt/IAdtAppendStructure.d.ts +32 -0
- package/dist/adt/IAdtAppendStructure.d.ts.map +1 -0
- package/dist/adt/IAdtAppendStructure.js +5 -0
- package/dist/adt/IAdtAuthorizationField.d.ts +49 -0
- package/dist/adt/IAdtAuthorizationField.d.ts.map +1 -0
- package/dist/adt/IAdtAuthorizationField.js +5 -0
- package/dist/adt/IAdtBehaviorDefinition.d.ts +58 -0
- package/dist/adt/IAdtBehaviorDefinition.d.ts.map +1 -0
- package/dist/adt/IAdtBehaviorDefinition.js +7 -0
- package/dist/adt/IAdtBehaviorImplementation.d.ts +30 -0
- package/dist/adt/IAdtBehaviorImplementation.d.ts.map +1 -0
- package/dist/adt/IAdtBehaviorImplementation.js +5 -0
- package/dist/adt/IAdtCapabilities.d.ts +391 -0
- package/dist/adt/IAdtCapabilities.d.ts.map +1 -0
- package/dist/adt/IAdtCapabilities.js +2 -0
- package/dist/adt/IAdtClass.d.ts +66 -0
- package/dist/adt/IAdtClass.d.ts.map +1 -0
- package/dist/adt/IAdtClass.js +5 -0
- package/dist/adt/IAdtClientOptions.d.ts +25 -0
- package/dist/adt/IAdtClientOptions.d.ts.map +1 -0
- package/dist/adt/IAdtClientOptions.js +9 -0
- package/dist/adt/IAdtContentTypes.d.ts +45 -0
- package/dist/adt/IAdtContentTypes.d.ts.map +1 -0
- package/dist/adt/IAdtContentTypes.js +13 -0
- package/dist/adt/IAdtDataElement.d.ts +95 -0
- package/dist/adt/IAdtDataElement.d.ts.map +1 -0
- package/dist/adt/IAdtDataElement.js +5 -0
- package/dist/adt/IAdtDdl.d.ts +37 -0
- package/dist/adt/IAdtDdl.d.ts.map +1 -0
- package/dist/adt/IAdtDdl.js +7 -0
- package/dist/adt/IAdtDomain.d.ts +79 -0
- package/dist/adt/IAdtDomain.d.ts.map +1 -0
- package/dist/adt/IAdtDomain.js +5 -0
- package/dist/adt/IAdtEnhancement.d.ts +61 -0
- package/dist/adt/IAdtEnhancement.d.ts.map +1 -0
- package/dist/adt/IAdtEnhancement.js +7 -0
- package/dist/adt/IAdtFeatureToggle.d.ts +100 -0
- package/dist/adt/IAdtFeatureToggle.d.ts.map +1 -0
- package/dist/adt/IAdtFeatureToggle.js +5 -0
- package/dist/adt/IAdtFunctionGroup.d.ts +52 -0
- package/dist/adt/IAdtFunctionGroup.d.ts.map +1 -0
- package/dist/adt/IAdtFunctionGroup.js +5 -0
- package/dist/adt/IAdtFunctionInclude.d.ts +23 -0
- package/dist/adt/IAdtFunctionInclude.d.ts.map +1 -0
- package/dist/adt/IAdtFunctionInclude.js +5 -0
- package/dist/adt/IAdtFunctionModule.d.ts +35 -0
- package/dist/adt/IAdtFunctionModule.d.ts.map +1 -0
- package/dist/adt/IAdtFunctionModule.js +5 -0
- package/dist/adt/IAdtInclude.d.ts +45 -0
- package/dist/adt/IAdtInclude.d.ts.map +1 -0
- package/dist/adt/IAdtInclude.js +17 -0
- package/dist/adt/IAdtInterface.d.ts +33 -0
- package/dist/adt/IAdtInterface.d.ts.map +1 -0
- package/dist/adt/IAdtInterface.js +5 -0
- package/dist/adt/IAdtMessageClass.d.ts +35 -0
- package/dist/adt/IAdtMessageClass.d.ts.map +1 -0
- package/dist/adt/IAdtMessageClass.js +2 -0
- package/dist/adt/IAdtMetadataExtension.d.ts +29 -0
- package/dist/adt/IAdtMetadataExtension.d.ts.map +1 -0
- package/dist/adt/IAdtMetadataExtension.js +5 -0
- package/dist/adt/IAdtObject.d.ts +224 -0
- package/dist/adt/IAdtObject.d.ts.map +1 -0
- package/dist/adt/IAdtObject.js +82 -0
- package/dist/adt/IAdtObjectState.d.ts +36 -0
- package/dist/adt/IAdtObjectState.d.ts.map +1 -0
- package/dist/adt/IAdtObjectState.js +13 -0
- package/dist/adt/IAdtPackage.d.ts +69 -0
- package/dist/adt/IAdtPackage.d.ts.map +1 -0
- package/dist/adt/IAdtPackage.js +5 -0
- package/dist/adt/IAdtProgram.d.ts +37 -0
- package/dist/adt/IAdtProgram.d.ts.map +1 -0
- package/dist/adt/IAdtProgram.js +5 -0
- package/dist/adt/IAdtResponse.d.ts +289 -0
- package/dist/adt/IAdtResponse.d.ts.map +1 -0
- package/dist/adt/IAdtResponse.js +51 -0
- package/dist/adt/IAdtScalarFunction.d.ts +30 -0
- package/dist/adt/IAdtScalarFunction.d.ts.map +1 -0
- package/dist/adt/IAdtScalarFunction.js +5 -0
- package/dist/adt/IAdtScalarFunctionImplementation.d.ts +35 -0
- package/dist/adt/IAdtScalarFunctionImplementation.d.ts.map +1 -0
- package/dist/adt/IAdtScalarFunctionImplementation.js +5 -0
- package/dist/adt/IAdtServiceBinding.d.ts +61 -0
- package/dist/adt/IAdtServiceBinding.d.ts.map +1 -0
- package/dist/adt/IAdtServiceBinding.js +33 -0
- package/dist/adt/IAdtServiceDefinition.d.ts +30 -0
- package/dist/adt/IAdtServiceDefinition.d.ts.map +1 -0
- package/dist/adt/IAdtServiceDefinition.js +5 -0
- package/dist/adt/IAdtShared.d.ts +110 -0
- package/dist/adt/IAdtShared.d.ts.map +1 -0
- package/dist/adt/IAdtShared.js +5 -0
- package/dist/adt/IAdtStructure.d.ts +48 -0
- package/dist/adt/IAdtStructure.d.ts.map +1 -0
- package/dist/adt/IAdtStructure.js +5 -0
- package/dist/adt/IAdtTable.d.ts +30 -0
- package/dist/adt/IAdtTable.d.ts.map +1 -0
- package/dist/adt/IAdtTable.js +5 -0
- package/dist/adt/IAdtTableType.d.ts +61 -0
- package/dist/adt/IAdtTableType.d.ts.map +1 -0
- package/dist/adt/IAdtTableType.js +5 -0
- package/dist/adt/IAdtTransformation.d.ts +33 -0
- package/dist/adt/IAdtTransformation.d.ts.map +1 -0
- package/dist/adt/IAdtTransformation.js +7 -0
- package/dist/adt/IAdtTransport.d.ts +104 -0
- package/dist/adt/IAdtTransport.d.ts.map +1 -0
- package/dist/adt/IAdtTransport.js +8 -0
- package/dist/adt/IAdtUnitTest.d.ts +125 -0
- package/dist/adt/IAdtUnitTest.d.ts.map +1 -0
- package/dist/adt/IAdtUnitTest.js +5 -0
- package/dist/adt/IAdtUtilities.d.ts +310 -0
- package/dist/adt/IAdtUtilities.d.ts.map +1 -0
- package/dist/adt/IAdtUtilities.js +92 -0
- package/dist/auth/AuthType.d.ts +5 -0
- package/dist/auth/AuthType.d.ts.map +1 -0
- package/dist/auth/AuthType.js +2 -0
- package/dist/auth/IAuthorizationConfig.d.ts +15 -0
- package/dist/auth/IAuthorizationConfig.d.ts.map +1 -0
- package/dist/auth/IAuthorizationConfig.js +2 -0
- package/dist/auth/IAuthorizationStrategy.d.ts +59 -0
- package/dist/auth/IAuthorizationStrategy.d.ts.map +1 -0
- package/dist/auth/IAuthorizationStrategy.js +12 -0
- package/dist/auth/ICallbackServer.d.ts +139 -0
- package/dist/auth/ICallbackServer.d.ts.map +1 -0
- package/dist/auth/ICallbackServer.js +2 -0
- package/dist/auth/ICertificateMaterialLoader.d.ts +7 -0
- package/dist/auth/ICertificateMaterialLoader.d.ts.map +1 -0
- package/dist/auth/ICertificateMaterialLoader.js +2 -0
- package/dist/auth/IConfig.d.ts +8 -0
- package/dist/auth/IConfig.d.ts.map +1 -0
- package/dist/auth/IConfig.js +2 -0
- package/dist/auth/IConnectionConfig.d.ts +23 -0
- package/dist/auth/IConnectionConfig.d.ts.map +1 -0
- package/dist/auth/IConnectionConfig.js +2 -0
- package/dist/connection/CalmService.d.ts +3 -0
- package/dist/connection/CalmService.d.ts.map +1 -0
- package/dist/connection/CalmService.js +14 -0
- package/dist/connection/IAbapConnection.d.ts +73 -0
- package/dist/connection/IAbapConnection.d.ts.map +1 -0
- package/dist/connection/IAbapConnection.js +2 -0
- package/dist/connection/IAbapRequestOptions.d.ts +9 -0
- package/dist/connection/IAbapRequestOptions.d.ts.map +1 -0
- package/dist/connection/IAbapRequestOptions.js +2 -0
- package/dist/connection/ICalmConnection.d.ts +29 -0
- package/dist/connection/ICalmConnection.d.ts.map +1 -0
- package/dist/connection/ICalmConnection.js +2 -0
- package/dist/connection/ICalmRequestOptions.d.ts +11 -0
- package/dist/connection/ICalmRequestOptions.d.ts.map +1 -0
- package/dist/connection/ICalmRequestOptions.js +2 -0
- package/dist/connection/IConnectionCapabilities.d.ts +217 -0
- package/dist/connection/IConnectionCapabilities.d.ts.map +1 -0
- package/dist/connection/IConnectionCapabilities.js +29 -0
- package/dist/execution/IAdtExecutors.d.ts +78 -0
- package/dist/execution/IAdtExecutors.d.ts.map +1 -0
- package/dist/execution/IAdtExecutors.js +9 -0
- package/dist/execution/IAdtRunnable.d.ts +61 -0
- package/dist/execution/IAdtRunnable.d.ts.map +1 -0
- package/dist/execution/IAdtRunnable.js +2 -0
- package/dist/execution/ITraceScheduling.d.ts +39 -0
- package/dist/execution/ITraceScheduling.d.ts.map +1 -0
- package/dist/execution/ITraceScheduling.js +15 -0
- package/dist/feeds/IFeedRepository.d.ts +32 -0
- package/dist/feeds/IFeedRepository.d.ts.map +1 -0
- package/dist/feeds/IFeedRepository.js +8 -0
- package/dist/feeds/types.d.ts +18 -0
- package/dist/feeds/types.d.ts.map +1 -0
- package/dist/feeds/types.js +9 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/runtime/IApplicationLog.d.ts +21 -0
- package/dist/runtime/IApplicationLog.d.ts.map +1 -0
- package/dist/runtime/IApplicationLog.js +2 -0
- package/dist/runtime/IAtcLog.d.ts +15 -0
- package/dist/runtime/IAtcLog.d.ts.map +1 -0
- package/dist/runtime/IAtcLog.js +2 -0
- package/dist/runtime/IAtcRun.d.ts +99 -0
- package/dist/runtime/IAtcRun.d.ts.map +1 -0
- package/dist/runtime/IAtcRun.js +10 -0
- package/dist/runtime/ICrossTrace.d.ts +32 -0
- package/dist/runtime/ICrossTrace.d.ts.map +1 -0
- package/dist/runtime/ICrossTrace.js +2 -0
- package/dist/runtime/IDdicActivation.d.ts +12 -0
- package/dist/runtime/IDdicActivation.d.ts.map +1 -0
- package/dist/runtime/IDdicActivation.js +2 -0
- package/dist/runtime/IGatewayErrorLog.d.ts +10 -0
- package/dist/runtime/IGatewayErrorLog.d.ts.map +1 -0
- package/dist/runtime/IGatewayErrorLog.js +2 -0
- package/dist/runtime/IProfiler.d.ts +65 -0
- package/dist/runtime/IProfiler.d.ts.map +1 -0
- package/dist/runtime/IProfiler.js +2 -0
- package/dist/runtime/IRuntimeDumps.d.ts +23 -0
- package/dist/runtime/IRuntimeDumps.d.ts.map +1 -0
- package/dist/runtime/IRuntimeDumps.js +2 -0
- package/dist/runtime/ISt05Trace.d.ts +8 -0
- package/dist/runtime/ISt05Trace.d.ts.map +1 -0
- package/dist/runtime/ISt05Trace.js +2 -0
- package/dist/runtime/ISystemMessages.d.ts +10 -0
- package/dist/runtime/ISystemMessages.d.ts.map +1 -0
- package/dist/runtime/ISystemMessages.js +2 -0
- package/dist/runtime/ITrace.d.ts +170 -0
- package/dist/runtime/ITrace.d.ts.map +1 -0
- package/dist/runtime/ITrace.js +14 -0
- package/dist/sap/ISapConfig.d.ts +22 -0
- package/dist/sap/ISapConfig.d.ts.map +1 -0
- package/dist/sap/ISapConfig.js +2 -0
- package/dist/sap/SapAuthType.d.ts +3 -0
- package/dist/sap/SapAuthType.d.ts.map +1 -0
- package/dist/sap/SapAuthType.js +2 -0
- package/dist/service/IAdtService.d.ts +84 -0
- package/dist/service/IAdtService.d.ts.map +1 -0
- package/dist/service/IAdtService.js +27 -0
- package/dist/serviceKey/IServiceKeyStore.d.ts +31 -0
- package/dist/serviceKey/IServiceKeyStore.d.ts.map +1 -0
- package/dist/serviceKey/IServiceKeyStore.js +7 -0
- package/dist/session/ISessionStore.d.ts +59 -0
- package/dist/session/ISessionStore.d.ts.map +1 -0
- package/dist/session/ISessionStore.js +7 -0
- package/dist/shared/IReadOptions.d.ts +9 -0
- package/dist/shared/IReadOptions.d.ts.map +1 -0
- package/dist/shared/IReadOptions.js +2 -0
- package/dist/store/StoreErrorCodes.d.ts +12 -0
- package/dist/store/StoreErrorCodes.d.ts.map +1 -0
- package/dist/store/StoreErrorCodes.js +13 -0
- package/dist/token/AuthType.d.ts +43 -0
- package/dist/token/AuthType.d.ts.map +1 -0
- package/dist/token/AuthType.js +41 -0
- package/dist/token/ITokenProvider.d.ts +27 -0
- package/dist/token/ITokenProvider.d.ts.map +1 -0
- package/dist/token/ITokenProvider.js +8 -0
- package/dist/token/ITokenProviderOptions.d.ts +23 -0
- package/dist/token/ITokenProviderOptions.d.ts.map +1 -0
- package/dist/token/ITokenProviderOptions.js +2 -0
- package/dist/token/ITokenRefresher.d.ts +39 -0
- package/dist/token/ITokenRefresher.d.ts.map +1 -0
- package/dist/token/ITokenRefresher.js +12 -0
- package/dist/token/ITokenResult.d.ts +36 -0
- package/dist/token/ITokenResult.d.ts.map +1 -0
- package/dist/token/ITokenResult.js +7 -0
- package/dist/token/TokenProviderErrorCodes.d.ts +26 -0
- package/dist/token/TokenProviderErrorCodes.d.ts.map +1 -0
- package/dist/token/TokenProviderErrorCodes.js +24 -0
- package/dist/utils/ITokenRefreshResult.d.ts +8 -0
- package/dist/utils/ITokenRefreshResult.d.ts.map +1 -0
- package/dist/utils/ITokenRefreshResult.js +2 -0
- package/dist/validation/IHeaderValidationResult.d.ts +15 -0
- package/dist/validation/IHeaderValidationResult.d.ts.map +1 -0
- package/dist/validation/IHeaderValidationResult.js +2 -0
- package/dist/validation/IValidatedAuthConfig.d.ts +46 -0
- package/dist/validation/IValidatedAuthConfig.d.ts.map +1 -0
- package/dist/validation/IValidatedAuthConfig.js +15 -0
- package/package.json +42 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { ILogger } from '@mcp-abap-adt/interfaces-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Local callback server used by interactive authorization flows.
|
|
4
|
+
*
|
|
5
|
+
* This interface is intentionally domain-agnostic: it describes the lifetime of
|
|
6
|
+
* a short-lived local listener that receives a redirect, not what the redirect
|
|
7
|
+
* carries. OAuth authorization codes, OIDC `code` + `state` and SAML
|
|
8
|
+
* `SAMLResponse` all fit through the same contract, parameterised by result.
|
|
9
|
+
*
|
|
10
|
+
* The handle is borrowed: it exists for the duration of the factory's callback,
|
|
11
|
+
* and the port is released on the first terminal outcome. Releasing the socket
|
|
12
|
+
* is therefore never a consequence of a wait settling — which is exactly what
|
|
13
|
+
* lets an abandoned login hold a port for the lifetime of a process.
|
|
14
|
+
*/
|
|
15
|
+
export interface ICallbackServerOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Port for the local listener. Must be an integer in 0..65535.
|
|
18
|
+
*
|
|
19
|
+
* `0` means "bind an ephemeral port": the handle then reports what the OS
|
|
20
|
+
* actually gave, and the authorization URL must be built from
|
|
21
|
+
* `handle.redirectUri` rather than from anything known beforehand. A flow
|
|
22
|
+
* that assembles its URL before binding — or one whose redirect is
|
|
23
|
+
* registered with the identity provider, as a SAML ACS always is — cannot
|
|
24
|
+
* use it, because the redirect would advertise a port nobody is listening on.
|
|
25
|
+
*/
|
|
26
|
+
readonly port: number;
|
|
27
|
+
/**
|
|
28
|
+
* How long to wait for the callback. Mandatory: there is no such thing as
|
|
29
|
+
* waiting forever, and the absence of this bound is a known way to strand a
|
|
30
|
+
* port.
|
|
31
|
+
*
|
|
32
|
+
* Must satisfy `Number.isFinite(timeoutMs) && timeoutMs > 0 && timeoutMs <=
|
|
33
|
+
* 2_147_483_647`. The upper bound is Node's rather than this contract's:
|
|
34
|
+
* `setTimeout` takes a 32-bit signed delay, and a larger value fires after
|
|
35
|
+
* 1 ms with a `TimeoutOverflowWarning` — so a generous-looking timeout would
|
|
36
|
+
* end the login almost instantly. Implementations reject such a value rather
|
|
37
|
+
* than clamping it, because clamping hides the mistake.
|
|
38
|
+
*/
|
|
39
|
+
readonly timeoutMs: number;
|
|
40
|
+
/**
|
|
41
|
+
* External cancellation — "this login is no longer needed". Honoured whether
|
|
42
|
+
* it fires before the bind, during it, or while waiting for the callback.
|
|
43
|
+
*/
|
|
44
|
+
readonly signal?: AbortSignal;
|
|
45
|
+
/**
|
|
46
|
+
* Where the transport reports what it did — an ignored request that was not
|
|
47
|
+
* our redirect, for instance. Absent means silence; never stdout.
|
|
48
|
+
*/
|
|
49
|
+
readonly logger?: ILogger;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Borrowed handle on a listening callback server.
|
|
53
|
+
*
|
|
54
|
+
* Valid until the scope reaches its first terminal outcome, which may be before
|
|
55
|
+
* the factory's callback has finished: a timeout or an abort ends the scope
|
|
56
|
+
* without stopping an already-running callback. Members behave differently once
|
|
57
|
+
* that has happened, so a still-running body cannot be harmed by touching it:
|
|
58
|
+
*
|
|
59
|
+
* - `fail()` becomes a silent no-op and never throws;
|
|
60
|
+
* - `waitForResult()` returns a rejected promise, never throwing synchronously;
|
|
61
|
+
* - `port` and `redirectUri` remain readable, being values rather than
|
|
62
|
+
* operations.
|
|
63
|
+
*/
|
|
64
|
+
export interface ICallbackServerHandle<TResult> {
|
|
65
|
+
/** The port actually bound. */
|
|
66
|
+
readonly port: number;
|
|
67
|
+
/** Redirect URI the authorization request must use. */
|
|
68
|
+
readonly redirectUri: string;
|
|
69
|
+
/**
|
|
70
|
+
* The result delivered to the callback endpoint.
|
|
71
|
+
*
|
|
72
|
+
* Returns the same promise on every call, so it is safe to call repeatedly.
|
|
73
|
+
* Rejects on timeout, on cancellation, on `fail`, and when the scope ends
|
|
74
|
+
* while it is still pending — the last of which is why an implementation must
|
|
75
|
+
* mark the promise handled on creation, so a body that creates it and walks
|
|
76
|
+
* away cannot raise `unhandledRejection`.
|
|
77
|
+
*
|
|
78
|
+
* Receiving a result does **not** end the scope. It hands the value to
|
|
79
|
+
* whoever is awaiting; the scope ends when the factory's callback returns.
|
|
80
|
+
*/
|
|
81
|
+
waitForResult(): Promise<TResult>;
|
|
82
|
+
/**
|
|
83
|
+
* End the wait with an error — typically because the browser could not be
|
|
84
|
+
* launched.
|
|
85
|
+
*
|
|
86
|
+
* Safe to call at any time, including after the scope has ended, because it
|
|
87
|
+
* is meant to be used fire-and-forget:
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* launchBrowser(url).catch((e) => server.fail(e));
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* A launcher that rejects after the login has already timed out must not turn
|
|
94
|
+
* that into a fresh unhandled rejection.
|
|
95
|
+
*/
|
|
96
|
+
fail(error: Error): void;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The only way to obtain a callback server.
|
|
100
|
+
*
|
|
101
|
+
* There is deliberately no `close` on the handle: closing belongs to the
|
|
102
|
+
* factory, so it cannot be forgotten.
|
|
103
|
+
*
|
|
104
|
+
* The factory settles on the first terminal outcome — the callback returning or
|
|
105
|
+
* throwing, `fail`, the timeout, or an abort — and only once the listening
|
|
106
|
+
* socket has been released, so a settled result always means the port is free.
|
|
107
|
+
* On success it resolves with whatever the callback returned — which need not be
|
|
108
|
+
* the payload itself, so `transform(await server.waitForResult())` resolves with
|
|
109
|
+
* the transformed value.
|
|
110
|
+
*
|
|
111
|
+
* It does **not** promise to stop the callback: an arbitrary async function
|
|
112
|
+
* cannot be force-terminated. A failure outcome ends the scope without waiting
|
|
113
|
+
* for it, and a later settlement from the abandoned body is discarded.
|
|
114
|
+
*
|
|
115
|
+
* There are two type parameters, and the split matters:
|
|
116
|
+
*
|
|
117
|
+
* - `TResult` is on the alias, because the payload a flow's callback endpoint
|
|
118
|
+
* delivers is fixed by that flow. Were it generic per call, a browser-code
|
|
119
|
+
* factory would type-check against a caller expecting something it can never
|
|
120
|
+
* yield.
|
|
121
|
+
* - `TReturn` is generic per call, because the scope resolves with whatever the
|
|
122
|
+
* callback returned. Tying it to `TResult` would forbid the transformation
|
|
123
|
+
* shown above — `transform(await server.waitForResult())` may legitimately
|
|
124
|
+
* produce a token, a session, or anything else built from the payload.
|
|
125
|
+
*
|
|
126
|
+
* ```ts
|
|
127
|
+
* const code = await withBrowserCallbackServer(
|
|
128
|
+
* { port, timeoutMs, signal },
|
|
129
|
+
* async (server) => {
|
|
130
|
+
* const waiting = server.waitForResult();
|
|
131
|
+
* launchBrowser(buildAuthUrl(server.redirectUri)).catch((e) => server.fail(e));
|
|
132
|
+
* return await waiting;
|
|
133
|
+
* },
|
|
134
|
+
* );
|
|
135
|
+
* // reached only once the port is free — whatever the outcome
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export type CallbackServerFactory<TResult> = <TReturn>(options: ICallbackServerOptions, use: (server: ICallbackServerHandle<TResult>) => Promise<TReturn>) => Promise<TReturn>;
|
|
139
|
+
//# sourceMappingURL=ICallbackServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICallbackServer.d.ts","sourceRoot":"","sources":["../../src/auth/ICallbackServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAE9D;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,qBAAqB,CAAC,OAAO;IAC5C,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,uDAAuD;IACvD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;;;;;;;;;;OAWG;IACH,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAElC;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,MAAM,qBAAqB,CAAC,OAAO,IAAI,CAAC,OAAO,EACnD,OAAO,EAAE,sBAAsB,EAC/B,GAAG,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,KAC9D,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ICertificateMaterial } from '@mcp-abap-adt/interfaces-auth';
|
|
2
|
+
import type { ISapConfig } from '../sap/ISapConfig';
|
|
3
|
+
/** Loads client-certificate material from a connection config (file paths, etc.). */
|
|
4
|
+
export interface ICertificateMaterialLoader {
|
|
5
|
+
load(config: ISapConfig): Promise<ICertificateMaterial>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=ICertificateMaterialLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICertificateMaterialLoader.d.ts","sourceRoot":"","sources":["../../src/auth/ICertificateMaterialLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,qFAAqF;AACrF,MAAM,WAAW,0BAA0B;IACzC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACzD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration - optional composition of authorization and connection configuration
|
|
3
|
+
* Can contain either authorization config, or connection config, or both
|
|
4
|
+
*/
|
|
5
|
+
import type { IAuthorizationConfig } from './IAuthorizationConfig';
|
|
6
|
+
import type { IConnectionConfig } from './IConnectionConfig';
|
|
7
|
+
export type IConfig = Partial<IAuthorizationConfig> & Partial<IConnectionConfig>;
|
|
8
|
+
//# sourceMappingURL=IConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IConfig.d.ts","sourceRoot":"","sources":["../../src/auth/IConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,GACjD,OAAO,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection configuration - values needed for connecting to services
|
|
3
|
+
* Returned by stores with actual values (not file paths)
|
|
4
|
+
*/
|
|
5
|
+
export interface IConnectionConfig {
|
|
6
|
+
/** Service URL (SAP/ABAP/MCP URL) - undefined for XSUAA if not provided */
|
|
7
|
+
serviceUrl?: string;
|
|
8
|
+
/** Authorization token (JWT token) - required for JWT auth, optional for basic auth */
|
|
9
|
+
authorizationToken?: string;
|
|
10
|
+
/** Username for basic authentication - required for basic auth, optional for JWT auth */
|
|
11
|
+
username?: string;
|
|
12
|
+
/** Password for basic authentication - required for basic auth, optional for JWT auth */
|
|
13
|
+
password?: string;
|
|
14
|
+
/** Authentication type - 'basic' for on-premise, 'jwt' for cloud */
|
|
15
|
+
authType?: 'basic' | 'jwt' | 'saml';
|
|
16
|
+
/** SAP client number (optional, for ABAP/BTP) */
|
|
17
|
+
sapClient?: string;
|
|
18
|
+
/** Language (optional, for ABAP/BTP) */
|
|
19
|
+
language?: string;
|
|
20
|
+
/** Session cookies for SAML authentication (raw Cookie header value) */
|
|
21
|
+
sessionCookies?: string;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=IConnectionConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IConnectionConfig.d.ts","sourceRoot":"","sources":["../../src/auth/IConnectionConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uFAAuF;IACvF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IACpC,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalmService.d.ts","sourceRoot":"","sources":["../../src/connection/CalmService.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,kIAUhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CALM_SERVICES = void 0;
|
|
4
|
+
exports.CALM_SERVICES = [
|
|
5
|
+
'features',
|
|
6
|
+
'documents',
|
|
7
|
+
'tasks',
|
|
8
|
+
'projects',
|
|
9
|
+
'testManagement',
|
|
10
|
+
'hierarchy',
|
|
11
|
+
'analytics',
|
|
12
|
+
'processMonitoring',
|
|
13
|
+
'logs',
|
|
14
|
+
];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { IAbapRequestOptions } from './IAbapRequestOptions';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal response type for ADT requests.
|
|
4
|
+
*/
|
|
5
|
+
export type IAdtHeaderValue = string | string[] | number | boolean | null | undefined | object;
|
|
6
|
+
/**
|
|
7
|
+
* The transport frame: status, headers, body — what HTTP or RFC hands back.
|
|
8
|
+
*
|
|
9
|
+
* Renamed from `IAdtWireResponse`, which now names the **answer** a member gives
|
|
10
|
+
* (`adt/IAdtResponse.ts`). This is the wire, and it belongs exactly here: at the
|
|
11
|
+
* connection boundary, where decision 14 says an envelope is legitimate and
|
|
12
|
+
* everywhere above it is not.
|
|
13
|
+
*
|
|
14
|
+
* The old name was the whole problem in miniature — the same type served as
|
|
15
|
+
* "what came off the wire" and "what a caller gets", so 94 members answered a
|
|
16
|
+
* frame and no member could name its result.
|
|
17
|
+
*/
|
|
18
|
+
export interface IAdtWireResponse<T = any, D = any> {
|
|
19
|
+
data: T;
|
|
20
|
+
status: number;
|
|
21
|
+
statusText: string;
|
|
22
|
+
headers: Record<string, IAdtHeaderValue> & {
|
|
23
|
+
location?: string;
|
|
24
|
+
Location?: string;
|
|
25
|
+
'content-location'?: IAdtHeaderValue;
|
|
26
|
+
'Content-Location'?: IAdtHeaderValue;
|
|
27
|
+
'sap-adt-location'?: IAdtHeaderValue;
|
|
28
|
+
};
|
|
29
|
+
config?: D;
|
|
30
|
+
request?: unknown;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* ABAP Connection interface
|
|
34
|
+
*
|
|
35
|
+
* Minimal interface for consumers to interact with SAP ADT.
|
|
36
|
+
* Implementation details (auth, token refresh, CSRF, cookies) are encapsulated.
|
|
37
|
+
*
|
|
38
|
+
* For JWT connections, token refresh is handled internally via ITokenRefresher.
|
|
39
|
+
* For Basic connections, no token refresh is needed.
|
|
40
|
+
*/
|
|
41
|
+
export interface IAbapConnection {
|
|
42
|
+
/**
|
|
43
|
+
* Initialize connection: fetch CSRF token and establish session cookies.
|
|
44
|
+
* Must be called before making any ADT requests.
|
|
45
|
+
*/
|
|
46
|
+
connect(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Get base URL of SAP system
|
|
49
|
+
*/
|
|
50
|
+
getBaseUrl(): Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Get current session ID (for stateful connections)
|
|
53
|
+
*/
|
|
54
|
+
getSessionId(): string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Set session type for subsequent requests
|
|
57
|
+
* @param type - "stateful" for persistent session, "stateless" for independent requests
|
|
58
|
+
*/
|
|
59
|
+
setSessionType(type: 'stateful' | 'stateless'): void;
|
|
60
|
+
/**
|
|
61
|
+
* Make ADT request to SAP system
|
|
62
|
+
*
|
|
63
|
+
* Handles all auth concerns internally:
|
|
64
|
+
* - Adds authorization header (Basic or Bearer)
|
|
65
|
+
* - Manages CSRF token
|
|
66
|
+
* - Retries on 401/403 with token refresh (JWT only)
|
|
67
|
+
*
|
|
68
|
+
* @param options - Request options (url, method, data, etc.)
|
|
69
|
+
* @returns Promise with Axios response
|
|
70
|
+
*/
|
|
71
|
+
makeAdtRequest<T = any, D = any>(options: IAbapRequestOptions): Promise<IAdtWireResponse<T, D>>;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=IAbapConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAbapConnection.d.ts","sourceRoot":"","sources":["../../src/connection/IAbapConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,MAAM,EAAE,GACR,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,MAAM,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IAChD,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG;QACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,kBAAkB,CAAC,EAAE,eAAe,CAAC;QACrC,kBAAkB,CAAC,EAAE,eAAe,CAAC;QACrC,kBAAkB,CAAC,EAAE,eAAe,CAAC;KACtC,CAAC;IACF,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9B;;OAEG;IACH,YAAY,IAAI,MAAM,GAAG,IAAI,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,IAAI,CAAC;IAErD;;;;;;;;;;OAUG;IACH,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAC7B,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAbapRequestOptions.d.ts","sourceRoot":"","sources":["../../src/connection/IAbapRequestOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CalmService } from './CalmService';
|
|
2
|
+
import type { IAdtWireResponse } from './IAbapConnection';
|
|
3
|
+
import type { ICalmRequestOptions } from './ICalmRequestOptions';
|
|
4
|
+
export type ICalmResponse<T = unknown, D = unknown> = IAdtWireResponse<T, D>;
|
|
5
|
+
/**
|
|
6
|
+
* Minimal connection interface for SAP Cloud ALM HTTP APIs.
|
|
7
|
+
*
|
|
8
|
+
* Implementations encapsulate auth, token refresh, service route resolution,
|
|
9
|
+
* and request execution so resource clients depend on one narrow contract.
|
|
10
|
+
*/
|
|
11
|
+
export interface ICalmConnection {
|
|
12
|
+
/**
|
|
13
|
+
* Initialize the connection and prepare any internal auth state.
|
|
14
|
+
*/
|
|
15
|
+
connect(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Get the tenant-level base URL.
|
|
18
|
+
*/
|
|
19
|
+
getBaseUrl(): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the effective base URL for a concrete Cloud ALM service.
|
|
22
|
+
*/
|
|
23
|
+
getServiceUrl(service: CalmService): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Execute a request against Cloud ALM.
|
|
26
|
+
*/
|
|
27
|
+
makeRequest<T = unknown, D = unknown>(options: ICalmRequestOptions): Promise<ICalmResponse<T, D>>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ICalmConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICalmConnection.d.ts","sourceRoot":"","sources":["../../src/connection/ICalmConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9B;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAErD;;OAEG;IACH,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAClC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACjC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CalmService } from './CalmService';
|
|
2
|
+
export interface ICalmRequestOptions {
|
|
3
|
+
url: string;
|
|
4
|
+
method: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
service?: CalmService;
|
|
7
|
+
data?: unknown;
|
|
8
|
+
params?: unknown;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ICalmRequestOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICalmRequestOptions.d.ts","sourceRoot":"","sources":["../../src/connection/ICalmRequestOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability atoms for the connection.
|
|
3
|
+
*
|
|
4
|
+
* The same shape as the ADT capability atoms, for the same reason:
|
|
5
|
+
* `IAbapConnection` is the minimum every transport can honour, and this is a
|
|
6
|
+
* thing only some can. An RFC connection, a batch recorder and a test stub are
|
|
7
|
+
* all legitimate `IAbapConnection`s that own no HTTP session; making these
|
|
8
|
+
* methods mandatory would force each of them to implement a lie.
|
|
9
|
+
*
|
|
10
|
+
* ADDITIVE to `IAbapConnection`, which is unchanged — an implementation adds the
|
|
11
|
+
* atom when it genuinely supports it, and a consumer narrows to it.
|
|
12
|
+
*/
|
|
13
|
+
/** Error codes a session-aware connection raises. Match on these, not on messages. */
|
|
14
|
+
export declare const ADT_SESSION_ERROR: {
|
|
15
|
+
/** No usable session: never connected, or torn down since. */
|
|
16
|
+
readonly NOT_CONNECTED: "ADT_NOT_CONNECTED";
|
|
17
|
+
/**
|
|
18
|
+
* The server put us on a DIFFERENT session than the one we were using.
|
|
19
|
+
*
|
|
20
|
+
* Anything locked over the old session is orphaned: the lock handle refers to
|
|
21
|
+
* a session that no longer exists, so it can be neither used nor released.
|
|
22
|
+
*/
|
|
23
|
+
readonly SESSION_REPLACED: "ADT_SESSION_REPLACED";
|
|
24
|
+
/** A transport release is still pending; the session cannot yet be reused. */
|
|
25
|
+
readonly RELEASE_PENDING: "ADT_RELEASE_PENDING";
|
|
26
|
+
};
|
|
27
|
+
export type AdtSessionErrorCode = (typeof ADT_SESSION_ERROR)[keyof typeof ADT_SESSION_ERROR];
|
|
28
|
+
/**
|
|
29
|
+
* A connection whose session is owned, observable and explicitly torn down.
|
|
30
|
+
*
|
|
31
|
+
* Without this, "is my session still the one I locked over?" is unanswerable
|
|
32
|
+
* from the consumer's side: a connection can be handed a new server session
|
|
33
|
+
* silently, and a caller holding a lock has no way to notice.
|
|
34
|
+
*/
|
|
35
|
+
export interface ISessionLifecycleAware {
|
|
36
|
+
/**
|
|
37
|
+
* Tells the server this session is finished.
|
|
38
|
+
*
|
|
39
|
+
* **It notifies; it does not confirm.** Whether and when the session is
|
|
40
|
+
* actually freed is the server's affair, and nothing here checks afterwards.
|
|
41
|
+
* That is why there is no deadline to pass: waiting for the answer to a
|
|
42
|
+
* message whose answer is not acted on buys the caller nothing, and a
|
|
43
|
+
* goodbye carries no request timeout by design — so waiting is the one thing
|
|
44
|
+
* that could make a teardown unbounded.
|
|
45
|
+
*
|
|
46
|
+
* Resolves rather than throws, and **always settles**: whatever it could not
|
|
47
|
+
* finish is the connection's own state, not the caller's problem. A repeat
|
|
48
|
+
* call performs whatever is still owed.
|
|
49
|
+
*
|
|
50
|
+
* **Calling it again does not wait for the goodbye either**, which is what
|
|
51
|
+
* {@link flushGoodbye} is for. A caller about to reconnect wants both, in
|
|
52
|
+
* this order:
|
|
53
|
+
*
|
|
54
|
+
* ```typescript
|
|
55
|
+
* await conn.disconnect();
|
|
56
|
+
* await conn.flushGoodbye();
|
|
57
|
+
* await conn.connect();
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Without the middle line the next session opens while the previous one's
|
|
61
|
+
* goodbye is still being assembled, and the server keeps both. With it, the
|
|
62
|
+
* goodbye is given up to the budget to finish first.
|
|
63
|
+
*
|
|
64
|
+
* In-flight requests are NOT waited for. They continue as their caller
|
|
65
|
+
* arranged and nothing is aborted; their results can no longer affect this
|
|
66
|
+
* connection.
|
|
67
|
+
*/
|
|
68
|
+
disconnect(): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Wait for the goodbye {@link disconnect} sent, within a budget.
|
|
71
|
+
*
|
|
72
|
+
* `disconnect()` dispatches the logoff and does not await it, deliberately: a
|
|
73
|
+
* goodbye carries no request timeout, and a server that never answers must
|
|
74
|
+
* not hold a teardown open. That is right for teardown and wrong for the one
|
|
75
|
+
* caller who reconnects — `disconnect()` then `connect()` opens the next
|
|
76
|
+
* session while the previous one's goodbye is still being assembled, and the
|
|
77
|
+
* server keeps both.
|
|
78
|
+
*
|
|
79
|
+
* Measured on E19 through `@mcp-abap-adt/adt-clients`, whose harness recycled
|
|
80
|
+
* the session after each test: a new ABAP session every one to two seconds
|
|
81
|
+
* for the length of a run, none released, each living to its own thirty
|
|
82
|
+
* minute idle timeout. Turning the recycling off left one session for the
|
|
83
|
+
* whole run, which is what the harness intended all along.
|
|
84
|
+
*
|
|
85
|
+
* **Bounded, and it resolves rather than throws.** The reason not to await
|
|
86
|
+
* inside `disconnect()` applies here too, so the wait has a budget and gives
|
|
87
|
+
* up quietly: "the goodbye has not arrived yet" is not a failure of whatever
|
|
88
|
+
* the caller does next. A goodbye that failed is likewise not the caller's
|
|
89
|
+
* problem — it is absorbed, not rethrown.
|
|
90
|
+
*
|
|
91
|
+
* **So a return is not a confirmation, and not even of dispatch.** Waiting out
|
|
92
|
+
* the budget resolves the same way as the goodbye finishing, and at that
|
|
93
|
+
* point the request may not have reached the wire at all — the promise it
|
|
94
|
+
* waits on covers assembling and sending, not just answering.
|
|
95
|
+
*
|
|
96
|
+
* The guarantee is exactly this: **the caller gives the goodbye up to the
|
|
97
|
+
* budget to finish before carrying on.** If it finishes in time there is no
|
|
98
|
+
* overlap with the next `connect()`. If it does not, the caller proceeds and
|
|
99
|
+
* the goodbye stays outstanding for as long as it takes — the budget bounds
|
|
100
|
+
* the waiting, not the overlap. Whether the server then releases the session
|
|
101
|
+
* is the server's affair, exactly as it is for `disconnect()`.
|
|
102
|
+
*
|
|
103
|
+
* Returns immediately when nothing was dispatched.
|
|
104
|
+
*
|
|
105
|
+
* @param timeoutMs how long to wait; an implementation chooses its default.
|
|
106
|
+
*/
|
|
107
|
+
flushGoodbye(timeoutMs?: number): Promise<void>;
|
|
108
|
+
/** Whether a caller may start work. False throughout a pending teardown. */
|
|
109
|
+
isConnected(): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Which server session the connection is on — or `null`, which says nothing
|
|
112
|
+
* about whether the connection is usable. **Use {@link isConnected} for that.**
|
|
113
|
+
*
|
|
114
|
+
* `null` means only that no identity is known, and there are two ways to get
|
|
115
|
+
* there: no session exists, or the connection is live over a server that
|
|
116
|
+
* issued no session cookie — some do not. So a live, working connection can
|
|
117
|
+
* return `null` here, and a consumer that reads `null` as "session lost"
|
|
118
|
+
* would tear down a connection that was fine.
|
|
119
|
+
*
|
|
120
|
+
* What it does identify is the SESSION, not the conversation: a stable
|
|
121
|
+
* client-side conversation id says nothing about whether the server replaced
|
|
122
|
+
* the session underneath it, which is precisely the failure this exists to
|
|
123
|
+
* expose. Compare two readings across an operation to detect a replacement.
|
|
124
|
+
*
|
|
125
|
+
* Only a CHANGED value is a replacement. `null` → non-null is an identity
|
|
126
|
+
* being learned, not a new session: the LOCK response is often the first to
|
|
127
|
+
* carry a session cookie, and reading that as a replacement would condemn the
|
|
128
|
+
* operation it just covered.
|
|
129
|
+
*/
|
|
130
|
+
getSessionIdentity(): string | null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A connection whose responses resolve only after a later flush.
|
|
134
|
+
*
|
|
135
|
+
* A batch recorder collects requests and settles their promises when the batch
|
|
136
|
+
* executes. Awaiting one of those promises mid-recording deadlocks: the caller
|
|
137
|
+
* is blocked inside the very code that would have reached `execute()`.
|
|
138
|
+
*
|
|
139
|
+
* Deferral belongs to the connection, not to how a client was configured —
|
|
140
|
+
* which is why it is declared here rather than passed as an option. A consumer
|
|
141
|
+
* that wraps a recorder itself, without going through the batch client, still
|
|
142
|
+
* gets the guard.
|
|
143
|
+
*/
|
|
144
|
+
export interface IDeferredResponseConnection {
|
|
145
|
+
/** Always `true`. "Sometimes deferred" is not a state a caller could act on. */
|
|
146
|
+
readonly responsesAreDeferred: true;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A connection whose ordinary per-request deadline can be suspended.
|
|
150
|
+
*
|
|
151
|
+
* A `lock` → write → `unlock` sequence wants to run to completion. Aborting one
|
|
152
|
+
* of its requests part way ends nothing on the server — the server ends an ABAP
|
|
153
|
+
* session on its own idle timeout, which this side cannot see — it ends what
|
|
154
|
+
* this side *knows*: whether the write was applied becomes unanswerable, and
|
|
155
|
+
* the handle `unlock` needs is lost while the lock lives on in that session.
|
|
156
|
+
*
|
|
157
|
+
* Measured on a BTP trial: a `POST /sap/bc/adt/deletion/delete` abandoned at
|
|
158
|
+
* 45 s was followed by `400 … Session Timed Out or Not Found` carrying a *new*
|
|
159
|
+
* session cookie. Over HTTP a session is two layers — the ICF one the cookie
|
|
160
|
+
* addresses and the ABAP one beneath it holding the enqueue locks — and the
|
|
161
|
+
* abort replaces the first while stranding the second.
|
|
162
|
+
*
|
|
163
|
+
* **What this promises, exactly.** Inside a section the connection's ordinary
|
|
164
|
+
* per-request deadline does not apply. It does **not** promise that no request
|
|
165
|
+
* can ever be cut short: an implementation is free to keep a far larger ceiling
|
|
166
|
+
* — `@mcp-abap-adt/connection` raises it to `SAP_TIMEOUT_CRITICAL`, ten minutes
|
|
167
|
+
* by default — and a socket, a proxy or the process itself ends a request
|
|
168
|
+
* whatever a contract says. The guarantee is that the short deadline is out of
|
|
169
|
+
* the way, not that time is.
|
|
170
|
+
*
|
|
171
|
+
* Sections nest: the ceiling lifts on the outermost `begin` and ordinary
|
|
172
|
+
* deadlines resume after the matching `end`.
|
|
173
|
+
*
|
|
174
|
+
* Separate from {@link ISessionLifecycleAware} because it answers a different
|
|
175
|
+
* question: that one is *whose session is this*, this one is *may this request
|
|
176
|
+
* be cut short*. A batch recorder honours the first and has nothing to protect.
|
|
177
|
+
*/
|
|
178
|
+
export interface ICriticalSection {
|
|
179
|
+
/**
|
|
180
|
+
* Enter a section in which the ordinary per-request deadline is suspended.
|
|
181
|
+
*
|
|
182
|
+
* Nests. Every call needs its own {@link endCriticalSection}, and the usual
|
|
183
|
+
* shape is a `try`/`finally` so a throw inside the window still ends it.
|
|
184
|
+
*/
|
|
185
|
+
beginCriticalSection(): void;
|
|
186
|
+
/** Leave it. Ordinary deadlines resume when the outermost section ends. */
|
|
187
|
+
endCriticalSection(): void;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* A connection that can be told what to ask the server to report about itself.
|
|
191
|
+
*
|
|
192
|
+
* `X-sap-adt-profiling` asks the server for its own processing time, and
|
|
193
|
+
* Eclipse sends it on every request. It is a per-connection default: a single
|
|
194
|
+
* request overrides it through `headers` on the request options, which every
|
|
195
|
+
* connection already accepts, so this atom exists for the *default* and not for
|
|
196
|
+
* the one-off.
|
|
197
|
+
*
|
|
198
|
+
* `null` asks for nothing. The value is a string rather than an enum because
|
|
199
|
+
* what a server accepts there is the server's business and grows without this
|
|
200
|
+
* package: `'server-time'` is what Eclipse asks for and is the sensible
|
|
201
|
+
* default.
|
|
202
|
+
*
|
|
203
|
+
* Worth stating: an implementation is not expected to read the answer back.
|
|
204
|
+
* The measurement is for whoever is looking at the wire, and being able to turn
|
|
205
|
+
* it off matters more than being able to consume it.
|
|
206
|
+
*/
|
|
207
|
+
export interface IRequestProfiling {
|
|
208
|
+
/**
|
|
209
|
+
* What to ask for on every request from now on, or `null` to ask nothing.
|
|
210
|
+
*
|
|
211
|
+
* @param what the `X-sap-adt-profiling` value; `'server-time'` is Eclipse's.
|
|
212
|
+
*/
|
|
213
|
+
setProfilingRequest(what: string | null): void;
|
|
214
|
+
/** What this connection is currently asking for. */
|
|
215
|
+
getProfilingRequest(): string | null;
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=IConnectionCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IConnectionCapabilities.d.ts","sourceRoot":"","sources":["../../src/connection/IConnectionCapabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,sFAAsF;AACtF,eAAO,MAAM,iBAAiB;IAC5B,8DAA8D;;IAE9D;;;;;OAKG;;IAEH,8EAA8E;;CAEtE,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD,4EAA4E;IAC5E,WAAW,IAAI,OAAO,CAAC;IAEvB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,2BAA2B;IAC1C,gFAAgF;IAChF,QAAQ,CAAC,oBAAoB,EAAE,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,oBAAoB,IAAI,IAAI,CAAC;IAE7B,2EAA2E;IAC3E,kBAAkB,IAAI,IAAI,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAE/C,oDAAoD;IACpD,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAAC;CACtC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Capability atoms for the connection.
|
|
4
|
+
*
|
|
5
|
+
* The same shape as the ADT capability atoms, for the same reason:
|
|
6
|
+
* `IAbapConnection` is the minimum every transport can honour, and this is a
|
|
7
|
+
* thing only some can. An RFC connection, a batch recorder and a test stub are
|
|
8
|
+
* all legitimate `IAbapConnection`s that own no HTTP session; making these
|
|
9
|
+
* methods mandatory would force each of them to implement a lie.
|
|
10
|
+
*
|
|
11
|
+
* ADDITIVE to `IAbapConnection`, which is unchanged — an implementation adds the
|
|
12
|
+
* atom when it genuinely supports it, and a consumer narrows to it.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ADT_SESSION_ERROR = void 0;
|
|
16
|
+
/** Error codes a session-aware connection raises. Match on these, not on messages. */
|
|
17
|
+
exports.ADT_SESSION_ERROR = {
|
|
18
|
+
/** No usable session: never connected, or torn down since. */
|
|
19
|
+
NOT_CONNECTED: 'ADT_NOT_CONNECTED',
|
|
20
|
+
/**
|
|
21
|
+
* The server put us on a DIFFERENT session than the one we were using.
|
|
22
|
+
*
|
|
23
|
+
* Anything locked over the old session is orphaned: the lock handle refers to
|
|
24
|
+
* a session that no longer exists, so it can be neither used nor released.
|
|
25
|
+
*/
|
|
26
|
+
SESSION_REPLACED: 'ADT_SESSION_REPLACED',
|
|
27
|
+
/** A transport release is still pending; the session cannot yet be reused. */
|
|
28
|
+
RELEASE_PENDING: 'ADT_RELEASE_PENDING',
|
|
29
|
+
};
|