@mcp-abap-adt/core 18.1.0 → 19.1.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/README.md +26 -5
- package/bin/mcp-abap-adt.js +15 -15
- package/dist/StdioServer.d.ts +68 -14
- package/dist/StdioServer.d.ts.map +1 -1
- package/dist/StdioServer.js +101 -31
- package/dist/StdioServer.js.map +1 -1
- package/dist/auth/IAuthBrokerFactory.d.ts +62 -0
- package/dist/auth/IAuthBrokerFactory.d.ts.map +1 -0
- package/dist/auth/IAuthBrokerFactory.js +8 -0
- package/dist/auth/IAuthBrokerFactory.js.map +1 -0
- package/dist/auth/IAuthBrokerFactoryConfig.d.ts +90 -0
- package/dist/auth/IAuthBrokerFactoryConfig.d.ts.map +1 -0
- package/dist/auth/IAuthBrokerFactoryConfig.js +8 -0
- package/dist/auth/IAuthBrokerFactoryConfig.js.map +1 -0
- package/dist/auth/brokerFactory.d.ts +93 -0
- package/dist/auth/brokerFactory.d.ts.map +1 -0
- package/dist/auth/brokerFactory.js +341 -0
- package/dist/auth/brokerFactory.js.map +1 -0
- package/dist/auth/browser.d.ts +60 -0
- package/dist/auth/browser.d.ts.map +1 -0
- package/dist/auth/browser.js +116 -0
- package/dist/auth/browser.js.map +1 -0
- package/dist/auth/countedProvider.d.ts +43 -0
- package/dist/auth/countedProvider.d.ts.map +1 -0
- package/dist/auth/countedProvider.js +105 -0
- package/dist/auth/countedProvider.js.map +1 -0
- package/dist/auth/destinationFailure.d.ts +69 -0
- package/dist/auth/destinationFailure.d.ts.map +1 -0
- package/dist/auth/destinationFailure.js +183 -0
- package/dist/auth/destinationFailure.js.map +1 -0
- package/dist/auth/destinationStores.d.ts +55 -0
- package/dist/auth/destinationStores.d.ts.map +1 -0
- package/dist/auth/destinationStores.js +158 -0
- package/dist/auth/destinationStores.js.map +1 -0
- package/dist/auth/handlers/basic.d.ts +3 -0
- package/dist/auth/handlers/basic.d.ts.map +1 -0
- package/dist/auth/handlers/basic.js +8 -0
- package/dist/auth/handlers/basic.js.map +1 -0
- package/dist/auth/handlers/index.d.ts +15 -0
- package/dist/auth/handlers/index.d.ts.map +1 -0
- package/dist/auth/handlers/index.js +32 -0
- package/dist/auth/handlers/index.js.map +1 -0
- package/dist/auth/handlers/jwtAuthorizationCode.d.ts +8 -0
- package/dist/auth/handlers/jwtAuthorizationCode.d.ts.map +1 -0
- package/dist/auth/handlers/jwtAuthorizationCode.js +32 -0
- package/dist/auth/handlers/jwtAuthorizationCode.js.map +1 -0
- package/dist/auth/handlers/snc.d.ts +3 -0
- package/dist/auth/handlers/snc.d.ts.map +1 -0
- package/dist/auth/handlers/snc.js +14 -0
- package/dist/auth/handlers/snc.js.map +1 -0
- package/dist/auth/handlers/types.d.ts +30 -0
- package/dist/auth/handlers/types.d.ts.map +1 -0
- package/dist/auth/handlers/types.js +3 -0
- package/dist/auth/handlers/types.js.map +1 -0
- package/dist/auth/index.d.ts +15 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +38 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/serverLogin.d.ts +75 -0
- package/dist/auth/serverLogin.d.ts.map +1 -0
- package/dist/auth/serverLogin.js +138 -0
- package/dist/auth/serverLogin.js.map +1 -0
- package/dist/auth/serverSentences.d.ts +39 -0
- package/dist/auth/serverSentences.d.ts.map +1 -0
- package/dist/auth/serverSentences.js +49 -0
- package/dist/auth/serverSentences.js.map +1 -0
- package/dist/auth/vocabulary.d.ts +28 -0
- package/dist/auth/vocabulary.d.ts.map +1 -0
- package/dist/auth/vocabulary.js +67 -0
- package/dist/auth/vocabulary.js.map +1 -0
- package/dist/config/coreParameters.d.ts +125 -0
- package/dist/config/coreParameters.d.ts.map +1 -0
- package/dist/config/coreParameters.js +331 -0
- package/dist/config/coreParameters.js.map +1 -0
- package/dist/config/envFileContext.d.ts +26 -0
- package/dist/config/envFileContext.d.ts.map +1 -0
- package/dist/config/envFileContext.js +90 -0
- package/dist/config/envFileContext.js.map +1 -0
- package/dist/config/envResolver.d.ts +6 -0
- package/dist/config/envResolver.d.ts.map +1 -0
- package/dist/config/envResolver.js +81 -0
- package/dist/config/envResolver.js.map +1 -0
- package/dist/config/platformPaths.d.ts +28 -0
- package/dist/config/platformPaths.d.ts.map +1 -0
- package/dist/config/platformPaths.js +152 -0
- package/dist/config/platformPaths.js.map +1 -0
- package/dist/destinationSource.d.ts +26 -0
- package/dist/destinationSource.d.ts.map +1 -0
- package/dist/destinationSource.js +43 -0
- package/dist/destinationSource.js.map +1 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -11
- package/dist/index.js.map +1 -1
- package/dist/launcher.d.ts +102 -59
- package/dist/launcher.d.ts.map +1 -1
- package/dist/launcher.js +419 -286
- package/dist/launcher.js.map +1 -1
- package/dist/shutdown.d.ts +76 -24
- package/dist/shutdown.d.ts.map +1 -1
- package/dist/shutdown.js +114 -57
- package/dist/shutdown.js.map +1 -1
- package/package.json +22 -39
- package/dist/InstancePool.d.ts +0 -87
- package/dist/InstancePool.d.ts.map +0 -1
- package/dist/InstancePool.js +0 -240
- package/dist/InstancePool.js.map +0 -1
- package/dist/SseServer.d.ts +0 -144
- package/dist/SseServer.d.ts.map +0 -1
- package/dist/SseServer.js +0 -359
- package/dist/SseServer.js.map +0 -1
- package/dist/StreamableHttpServer.d.ts +0 -143
- package/dist/StreamableHttpServer.d.ts.map +0 -1
- package/dist/StreamableHttpServer.js +0 -349
- package/dist/StreamableHttpServer.js.map +0 -1
- package/dist/destinationRequest.d.ts +0 -38
- package/dist/destinationRequest.d.ts.map +0 -1
- package/dist/destinationRequest.js +0 -85
- package/dist/destinationRequest.js.map +0 -1
- package/dist/dnsRebindingProtection.d.ts +0 -21
- package/dist/dnsRebindingProtection.d.ts.map +0 -1
- package/dist/dnsRebindingProtection.js +0 -45
- package/dist/dnsRebindingProtection.js.map +0 -1
- package/dist/stateClose.d.ts +0 -8
- package/dist/stateClose.d.ts.map +0 -1
- package/dist/stateClose.js +0 -14
- package/dist/stateClose.js.map +0 -1
- package/dist/tlsUtils.d.ts +0 -19
- package/dist/tlsUtils.d.ts.map +0 -1
- package/dist/tlsUtils.js +0 -77
- package/dist/tlsUtils.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
# @mcp-abap-adt/core
|
|
2
2
|
|
|
3
|
-
The standalone MCP server for SAP ABAP ADT
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The standalone MCP server for SAP ABAP ADT over **stdio**: the `mcp-abap-adt` CLI, one
|
|
4
|
+
destination per process through the auth broker — a service key, a session, an `--env` file, the
|
|
5
|
+
browser login — and the launcher.
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g @mcp-abap-adt/core
|
|
9
|
-
mcp-abap-adt
|
|
10
|
-
mcp-abap-adt --
|
|
9
|
+
mcp-abap-adt --mcp=TRIAL --system-type=cloud # a destination from the service-keys folder
|
|
10
|
+
mcp-abap-adt --env-path=./mcp.env # a .env written by mcp-auth, SAP_SYSTEM_TYPE in it
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
**The system type is required (19.0.0)** — `--system-type`, `SAP_SYSTEM_TYPE` (the environment or
|
|
14
|
+
the `--env` file) or YAML `system-type`: `onprem`, `cloud` or `legacy`; a destination does not
|
|
15
|
+
start without it. **The server connects at its start**, before the MCP transport opens — the
|
|
16
|
+
browser login included, and the destination's one leftover session of a killed process taken
|
|
17
|
+
up —; any failure ends it with exit `1`. Coming from 18.x:
|
|
18
|
+
[MIGRATION-19.0](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/MIGRATION-19.0.md).
|
|
19
|
+
|
|
20
|
+
Streamable HTTP and HTTP+SSE are packages of their own, serving credentials from each request's
|
|
21
|
+
`x-sap-*` headers: [`@mcp-abap-adt/http`](https://www.npmjs.com/package/@mcp-abap-adt/http)
|
|
22
|
+
(`mcp-abap-adt-http`) and [`@mcp-abap-adt/sse`](https://www.npmjs.com/package/@mcp-abap-adt/sse)
|
|
23
|
+
(`mcp-abap-adt-sse`). There is no `--transport` option: it, and any option of those binaries, stops
|
|
24
|
+
this one naming the binary to run. Only this package depends on `@mcp-abap-adt/auth-broker` and `@mcp-abap-adt/auth-stores`.
|
|
25
|
+
|
|
13
26
|
It connects to the ABAP system over **HTTP** (basic or JWT), **RFC** (basic) or **SNC**
|
|
14
27
|
(passwordless, over RFC). HTTP needs nothing more. **RFC and SNC need the SAP NW RFC SDK, a C++
|
|
15
28
|
toolchain and `SAPNWRFC_HOME` set before `npm install`**: the RFC module is compiled during the
|
|
@@ -21,6 +34,14 @@ RFC and SNC: [RFC Setup](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/
|
|
|
21
34
|
From 17.0.0 the HTTPS server certificate is verified — see the
|
|
22
35
|
[migration note](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/MIGRATION-17.0.md).
|
|
23
36
|
|
|
37
|
+
**The binary fixes the tool set (19.0.0).** `mcp-abap-adt` serves readonly (with system and search),
|
|
38
|
+
high, the debugger, the leftover sessions (list, logoff) and background runs; the readonly
|
|
39
|
+
tools alone are [`@mcp-abap-adt/core-ro`](https://www.npmjs.com/package/@mcp-abap-adt/core-ro) (`mcp-abap-adt-ro`). There is no
|
|
40
|
+
`--exposition`: passing it, or a config file's `exposition`, stops the start with a sentence naming
|
|
41
|
+
the binary to install instead.
|
|
42
|
+
|
|
43
|
+
**No low set (19.0.0).** `--exposition=…,low` stops the start with this sentence: *"the low set is gone from mcp-abap-adt / -http / -sse; use mcp-abap-adt-compact (or -compact-http / -compact-sse)"*. Its single-step operations are compact's — see [MIGRATION-19.0](https://github.com/fr0ster/mcp-abap-adt/blob/main/docs/MIGRATION-19.0.md#the-low-set-leaves-the-full-binaries).
|
|
44
|
+
|
|
24
45
|
The tools themselves are not here. They live in
|
|
25
46
|
[`@mcp-abap-adt/lib`](https://www.npmjs.com/package/@mcp-abap-adt/lib), which
|
|
26
47
|
this package depends on.
|
package/bin/mcp-abap-adt.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* MCP ABAP ADT
|
|
5
|
-
*
|
|
6
|
-
* Main entry point that runs the v2 server from dist/server/v2/launcher.js
|
|
4
|
+
* mcp-abap-adt — the MCP ABAP ADT server over stdio, with the full tool set.
|
|
7
5
|
*
|
|
8
6
|
* NOTE: Using direct require() instead of spawn() to ensure proper stdio handling.
|
|
9
7
|
* spawn() with stdio: 'inherit' can cause issues with MCP protocol
|
|
10
8
|
* because the parent process becomes an unnecessary intermediate layer.
|
|
9
|
+
*
|
|
10
|
+
* The launcher is required and started in THIS process, so stdin/stdout stay
|
|
11
|
+
* wired to the MCP protocol with no intermediate layer. It starts nothing on
|
|
12
|
+
* import: `main` is called here with the tool set this command serves, and a
|
|
13
|
+
* sibling command (@mcp-abap-adt/compact) calls the same `main` with its own.
|
|
11
14
|
*/
|
|
15
|
+
const { main, launcherFailedLine } = require('../dist/launcher.js');
|
|
16
|
+
const { CORE_VERSION } = require('../dist/coreVersion.js');
|
|
17
|
+
const { fullToolSet } = require('@mcp-abap-adt/lib/tool-set');
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
void main().catch((err) => {
|
|
21
|
-
console.error(
|
|
22
|
-
'[MCP] launcher failed:',
|
|
23
|
-
err instanceof Error ? err.message : String(err),
|
|
24
|
-
);
|
|
19
|
+
void main({
|
|
20
|
+
toolSet: fullToolSet,
|
|
21
|
+
program: 'mcp-abap-adt',
|
|
22
|
+
version: CORE_VERSION,
|
|
23
|
+
}).catch((err) => {
|
|
24
|
+
console.error(launcherFailedLine(err));
|
|
25
25
|
process.exit(1);
|
|
26
26
|
});
|
package/dist/StdioServer.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { AbapConnection } from '@mcp-abap-adt/connection';
|
|
2
|
+
import type { IAuthProviderError } from '@mcp-abap-adt/interfaces-auth';
|
|
3
|
+
import { type ReadFailure } from '@mcp-abap-adt/lib/auth';
|
|
4
|
+
import { BaseMcpServer, type IBackgroundRuns, type InstanceBatch, type LeftoverSessions, type ResolvedConnection, type StartedConnection } from '@mcp-abap-adt/lib/embeddable';
|
|
3
5
|
import type { IHandlersRegistry } from '@mcp-abap-adt/lib/handlers';
|
|
4
6
|
import { type StateLogger } from '@mcp-abap-adt/lib/state';
|
|
5
7
|
import type { Logger } from '@mcp-abap-adt/logger';
|
|
8
|
+
import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
9
|
+
import type { IDestinations } from './auth/IAuthBrokerFactory.js';
|
|
6
10
|
export interface StdioServerOptions {
|
|
7
11
|
name?: string;
|
|
8
12
|
version?: string;
|
|
@@ -11,23 +15,73 @@ export interface StdioServerOptions {
|
|
|
11
15
|
stateIdleMinutes?: number;
|
|
12
16
|
/** Where the state's lifecycle lines go; default stderr, always on. */
|
|
13
17
|
stateLogger?: StateLogger;
|
|
18
|
+
/** The server's own sentence beside a chain failure: the factory's `sentenceFor`. */
|
|
19
|
+
sentenceFor?: (error: IAuthProviderError) => string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The owner of the process's runtime session files (the launcher's): the
|
|
22
|
+
* SAP sessions this server holds, kept until their logoff completed (written and answered), and
|
|
23
|
+
* the leftover-session tools. Absent: none kept, the tools not available.
|
|
24
|
+
*/
|
|
25
|
+
leftoverSessions?: LeftoverSessions;
|
|
26
|
+
/**
|
|
27
|
+
* Where background runs and their answers are kept (the launcher's
|
|
28
|
+
* `InMemoryBackgroundRuns` of
|
|
29
|
+
* `@mcp-abap-adt/background-runs-memory`). Absent: `background: true` is refused.
|
|
30
|
+
*/
|
|
31
|
+
backgroundRuns?: IBackgroundRuns;
|
|
32
|
+
/**
|
|
33
|
+
* The owner of this instance's batch state (the launcher's, one for the
|
|
34
|
+
* process's one instance). Absent: the batch tools answer
|
|
35
|
+
* `batch_mode_unavailable`.
|
|
36
|
+
*/
|
|
37
|
+
batch?: InstanceBatch;
|
|
14
38
|
}
|
|
15
39
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
40
|
+
* The stdio server: one instance, one destination. Its source is the
|
|
41
|
+
* destination (`destinationSource`), set once at startup; the settings and
|
|
42
|
+
* the provider come from `IDestinations` — the factory — per request. The
|
|
43
|
+
* launcher has its connection born before the transport opens
|
|
44
|
+
* (`connectAtStart`): the destination's one leftover session taken up, or a
|
|
45
|
+
* logon, and the system information with it.
|
|
46
|
+
* Without destinations the server is in inspection-only mode: the tools are
|
|
47
|
+
* listed, and a tool call answers the server's own `inspection_only` refusal
|
|
48
|
+
* before any connection is built.
|
|
20
49
|
*/
|
|
21
50
|
export declare class StdioServer extends BaseMcpServer {
|
|
22
51
|
private readonly handlersRegistry;
|
|
23
52
|
private readonly destinations;
|
|
24
|
-
|
|
25
|
-
|
|
53
|
+
private readonly sentenceFor;
|
|
54
|
+
/** The destination served, named by a refusal whose error does not carry it. */
|
|
55
|
+
private destination;
|
|
56
|
+
constructor(handlersRegistry: IHandlersRegistry, destinations: IDestinations | undefined, opts?: StdioServerOptions);
|
|
57
|
+
/** The destination layer's failures first, then lib's reader. */
|
|
58
|
+
protected readFailure(thrown: unknown): ReadFailure | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* The connection to `destination` born before the transport opens: the
|
|
61
|
+
* destination's one leftover session taken up, or a logon (an interactive
|
|
62
|
+
* login included: its prompts go to stderr), and the system information
|
|
63
|
+
* (BaseMcpServer's `bornAtStart`). Rejects with what failed; the
|
|
64
|
+
* launcher ends the process with it. The start's own signal, aborted once
|
|
65
|
+
* the birth ended, as the startup check's.
|
|
66
|
+
*/
|
|
67
|
+
connectAtStart(destination: string): Promise<StartedConnection>;
|
|
68
|
+
/**
|
|
69
|
+
* Serves `destination` (none: inspection-only mode) over `transport` —
|
|
70
|
+
* stdio unless a host passes its own. Its connection is the one
|
|
71
|
+
* `connectAtStart` made, when the launcher called it; otherwise the first
|
|
72
|
+
* tool call makes it.
|
|
73
|
+
*/
|
|
74
|
+
start(destination: string | undefined, transport?: Transport): Promise<void>;
|
|
75
|
+
/** The destination's source, set once. */
|
|
76
|
+
private serve;
|
|
77
|
+
/**
|
|
78
|
+
* Inspection-only mode refuses here, before any connection is built. A
|
|
79
|
+
* login ends with its result, the server (the bound, the shutdown) or the
|
|
80
|
+
* session — never by another call's cancel, since a tool call cannot be
|
|
81
|
+
* cancelled — so nothing is retried.
|
|
82
|
+
*/
|
|
83
|
+
protected getConnection(signal: AbortSignal): Promise<AbapConnection>;
|
|
84
|
+
/** Inspection-only mode refuses the leftover-session tools too, before anything is read. */
|
|
85
|
+
protected resolveCaller(signal: AbortSignal): Promise<ResolvedConnection>;
|
|
26
86
|
}
|
|
27
|
-
/**
|
|
28
|
-
* The destinations of inspection-only mode (stdio with neither `--mcp` nor an
|
|
29
|
-
* `--env` file): the tools can be listed, and a tool call answers with the
|
|
30
|
-
* refusal of a provider that has no credential, instead of dialling anywhere.
|
|
31
|
-
*/
|
|
32
|
-
export declare function inspectionOnlyDestinations(): IDestinations;
|
|
33
87
|
//# sourceMappingURL=StdioServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StdioServer.d.ts","sourceRoot":"","sources":["../src/StdioServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"StdioServer.d.ts","sourceRoot":"","sources":["../src/StdioServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,wB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AAS,EACxD,IAAI,CAAC,EAAE,kBAAkB;IAuB3B,iEAAiE;cAC9C,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS;IAOxE;;;;;;;OAOG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAWrE;;;;;OAKG;IACG,KAAK,CACT,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,SAAS,GAAE,SAAsC,GAChD,OAAO,CAAC,IAAI,CAAC;IAQhB,0CAA0C;IAC1C,OAAO,CAAC,KAAK;IAkBb;;;;;OAKG;cACsB,aAAa,CACpC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,cAAc,CAAC;IAK1B,4FAA4F;cACzE,aAAa,CAC9B,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,kBAAkB,CAAC;CAI/B"}
|
package/dist/StdioServer.js
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StdioServer = void 0;
|
|
4
|
-
|
|
4
|
+
const auth_1 = require("@mcp-abap-adt/lib/auth");
|
|
5
5
|
const embeddable_1 = require("@mcp-abap-adt/lib/embeddable");
|
|
6
6
|
const logger_1 = require("@mcp-abap-adt/lib/logger");
|
|
7
|
+
const request_context_1 = require("@mcp-abap-adt/lib/request-context");
|
|
7
8
|
const state_1 = require("@mcp-abap-adt/lib/state");
|
|
9
|
+
const responsible_rules_1 = require("@mcp-abap-adt/responsible-rules");
|
|
8
10
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
11
|
+
const destinationFailure_1 = require("./auth/destinationFailure");
|
|
9
12
|
const coreVersion_js_1 = require("./coreVersion.js");
|
|
13
|
+
const destinationSource_js_1 = require("./destinationSource.js");
|
|
10
14
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* The stdio server: one instance, one destination. Its source is the
|
|
16
|
+
* destination (`destinationSource`), set once at startup; the settings and
|
|
17
|
+
* the provider come from `IDestinations` — the factory — per request. The
|
|
18
|
+
* launcher has its connection born before the transport opens
|
|
19
|
+
* (`connectAtStart`): the destination's one leftover session taken up, or a
|
|
20
|
+
* logon, and the system information with it.
|
|
21
|
+
* Without destinations the server is in inspection-only mode: the tools are
|
|
22
|
+
* listed, and a tool call answers the server's own `inspection_only` refusal
|
|
23
|
+
* before any connection is built.
|
|
15
24
|
*/
|
|
16
25
|
class StdioServer extends embeddable_1.BaseMcpServer {
|
|
17
26
|
handlersRegistry;
|
|
18
27
|
destinations;
|
|
28
|
+
sentenceFor;
|
|
29
|
+
/** The destination served, named by a refusal whose error does not carry it. */
|
|
30
|
+
destination;
|
|
19
31
|
constructor(handlersRegistry, destinations, opts) {
|
|
20
32
|
super({
|
|
21
33
|
name: opts?.name ?? 'mcp-abap-adt',
|
|
@@ -24,39 +36,97 @@ class StdioServer extends embeddable_1.BaseMcpServer {
|
|
|
24
36
|
stateIdleMinutes: opts?.stateIdleMinutes,
|
|
25
37
|
// From the options as given: the silent default above is never the state's.
|
|
26
38
|
stateLogger: (0, state_1.stateLoggerOf)(opts ?? {}),
|
|
39
|
+
...(opts?.leftoverSessions !== undefined && {
|
|
40
|
+
leftoverSessions: opts.leftoverSessions,
|
|
41
|
+
}),
|
|
42
|
+
...(opts?.backgroundRuns !== undefined && {
|
|
43
|
+
backgroundRuns: opts.backgroundRuns,
|
|
44
|
+
}),
|
|
45
|
+
...(opts?.batch !== undefined && { batch: opts.batch }),
|
|
46
|
+
// The responsible rules, once, at the start (`connectAtStart`).
|
|
47
|
+
systemContextResolver: request_context_1.defaultSystemContextResolver,
|
|
48
|
+
systemContextRules: responsible_rules_1.responsibleRules,
|
|
27
49
|
});
|
|
28
50
|
this.handlersRegistry = handlersRegistry;
|
|
29
51
|
this.destinations = destinations;
|
|
52
|
+
this.sentenceFor = opts?.sentenceFor;
|
|
30
53
|
}
|
|
31
|
-
|
|
32
|
-
|
|
54
|
+
/** The destination layer's failures first, then lib's reader. */
|
|
55
|
+
readFailure(thrown) {
|
|
56
|
+
return (0, destinationFailure_1.destinationFailureOf)(thrown, {
|
|
57
|
+
sentenceFor: this.sentenceFor,
|
|
58
|
+
...(this.destination !== undefined && { destination: this.destination }),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The connection to `destination` born before the transport opens: the
|
|
63
|
+
* destination's one leftover session taken up, or a logon (an interactive
|
|
64
|
+
* login included: its prompts go to stderr), and the system information
|
|
65
|
+
* (BaseMcpServer's `bornAtStart`). Rejects with what failed; the
|
|
66
|
+
* launcher ends the process with it. The start's own signal, aborted once
|
|
67
|
+
* the birth ended, as the startup check's.
|
|
68
|
+
*/
|
|
69
|
+
async connectAtStart(destination) {
|
|
70
|
+
if (!this.destinations)
|
|
71
|
+
throw new auth_1.ServerRefusal('inspection_only');
|
|
72
|
+
this.serve(destination);
|
|
73
|
+
const startup = new AbortController();
|
|
74
|
+
try {
|
|
75
|
+
return await this.bornAtStart(startup.signal);
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
startup.abort();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Serves `destination` (none: inspection-only mode) over `transport` —
|
|
83
|
+
* stdio unless a host passes its own. Its connection is the one
|
|
84
|
+
* `connectAtStart` made, when the launcher called it; otherwise the first
|
|
85
|
+
* tool call makes it.
|
|
86
|
+
*/
|
|
87
|
+
async start(destination, transport = new stdio_js_1.StdioServerTransport()) {
|
|
88
|
+
if (destination !== undefined && this.destinations) {
|
|
89
|
+
this.serve(destination);
|
|
90
|
+
}
|
|
33
91
|
this.registerHandlers(this.handlersRegistry);
|
|
34
|
-
const transport = new stdio_js_1.StdioServerTransport();
|
|
35
92
|
await this.connect(transport);
|
|
36
93
|
}
|
|
94
|
+
/** The destination's source, set once. */
|
|
95
|
+
serve(destination) {
|
|
96
|
+
if (this.destination !== undefined || !this.destinations)
|
|
97
|
+
return;
|
|
98
|
+
this.destination = destination;
|
|
99
|
+
this.setConnectionContext({
|
|
100
|
+
kind: 'built',
|
|
101
|
+
// The user is fixed for the process: getProvider answers the same
|
|
102
|
+
// provider while the session is renewed (refresh, or a new login when
|
|
103
|
+
// the refresh fails) and written back, so the connection is replaced
|
|
104
|
+
// only when SAP lost its session.
|
|
105
|
+
source: (0, destinationSource_js_1.destinationSource)(destination, this.destinations),
|
|
106
|
+
sessionId: destination,
|
|
107
|
+
// Who calls, for the leftover sessions: on stdio the destination —
|
|
108
|
+
// its user and credential are fixed for the process.
|
|
109
|
+
destination,
|
|
110
|
+
metadata: { destination },
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Inspection-only mode refuses here, before any connection is built. A
|
|
115
|
+
* login ends with its result, the server (the bound, the shutdown) or the
|
|
116
|
+
* session — never by another call's cancel, since a tool call cannot be
|
|
117
|
+
* cancelled — so nothing is retried.
|
|
118
|
+
*/
|
|
119
|
+
async getConnection(signal) {
|
|
120
|
+
if (!this.destinations)
|
|
121
|
+
throw new auth_1.ServerRefusal('inspection_only');
|
|
122
|
+
return super.getConnection(signal);
|
|
123
|
+
}
|
|
124
|
+
/** Inspection-only mode refuses the leftover-session tools too, before anything is read. */
|
|
125
|
+
resolveCaller(signal) {
|
|
126
|
+
if (!this.destinations)
|
|
127
|
+
throw new auth_1.ServerRefusal('inspection_only');
|
|
128
|
+
return super.resolveCaller(signal);
|
|
129
|
+
}
|
|
37
130
|
}
|
|
38
131
|
exports.StdioServer = StdioServer;
|
|
39
|
-
const INSPECTION_ONLY = 'inspection-only mode: no connection parameters. To connect to an SAP system, use --mcp=<destination> or --env-path=<path>.';
|
|
40
|
-
/**
|
|
41
|
-
* The destinations of inspection-only mode (stdio with neither `--mcp` nor an
|
|
42
|
-
* `--env` file): the tools can be listed, and a tool call answers with the
|
|
43
|
-
* refusal of a provider that has no credential, instead of dialling anywhere.
|
|
44
|
-
*/
|
|
45
|
-
function inspectionOnlyDestinations() {
|
|
46
|
-
const refused = async () => ({
|
|
47
|
-
ok: false,
|
|
48
|
-
refusal: { reason: INSPECTION_ONLY },
|
|
49
|
-
});
|
|
50
|
-
const provider = {
|
|
51
|
-
kind: 'inspection-only',
|
|
52
|
-
prepare: refused,
|
|
53
|
-
establish: refused,
|
|
54
|
-
authorize: refused,
|
|
55
|
-
rejected: refused,
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
settingsFor: async () => ({ url: 'http://mock', authType: 'basic' }),
|
|
59
|
-
getProvider: async () => provider,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
132
|
//# sourceMappingURL=StdioServer.js.map
|
package/dist/StdioServer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StdioServer.js","sourceRoot":"","sources":["../src/StdioServer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"StdioServer.js","sourceRoot":"","sources":["../src/StdioServer.ts"],"names":[],"mappings":";;;AAEA,iDAAyE;AACzE,6DAOsC;AAEtC,qDAAsD;AACtD,uEAAiF;AACjF,mDAA0E;AAE1E,uEAAmE;AACnE,wEAAiF;AAEjF,kEAAiE;AAEjE,qDAAgD;AAChD,iEAA2D;AAgC3D;;;;;;;;;;GAUG;AACH,MAAa,WAAY,SAAQ,0BAAa;IAQzB;IACA;IARF,WAAW,CAEd;IACd,gFAAgF;IACxE,WAAW,CAAqB;IAExC,YACmB,gBAAmC,EACnC,YAAuC,EACxD,IAAyB;QAEzB,KAAK,CAAC;YACJ,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,cAAc;YAClC,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,6BAAY;YACtC,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,mBAAU;YAClC,gBAAgB,EAAE,IAAI,EAAE,gBAAgB;YACxC,4EAA4E;YAC5E,WAAW,EAAE,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AC,CAAC;IACrC,CAAC;CACF;AApHD,kCAoHC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What core's stdio server needs from the destinations, and the factory's
|
|
3
|
+
* whole surface. `DestinationSystemContext` stays lib's: the sources fill it,
|
|
4
|
+
* and lib's server reads it for each call's scope.
|
|
5
|
+
*/
|
|
6
|
+
import type { AuthBroker } from '@mcp-abap-adt/auth-broker';
|
|
7
|
+
import type { SapConfig } from '@mcp-abap-adt/connection';
|
|
8
|
+
import type { IAuthProvider } from '@mcp-abap-adt/interfaces-auth';
|
|
9
|
+
import type { DestinationSystemContext } from '@mcp-abap-adt/lib/auth';
|
|
10
|
+
export interface IDestinations {
|
|
11
|
+
/** The connector's settings: URL, client, auth type, connection type — no secret. */
|
|
12
|
+
settingsFor(destination: string): Promise<SapConfig>;
|
|
13
|
+
/**
|
|
14
|
+
* The destination's provider, counted while it works. Asked per request,
|
|
15
|
+
* with the request's `signal`: the broker answers its cached provider while
|
|
16
|
+
* the destination is unchanged, and the signal releases this caller alone.
|
|
17
|
+
*/
|
|
18
|
+
getProvider(destination: string, options?: {
|
|
19
|
+
readonly signal?: AbortSignal | undefined;
|
|
20
|
+
}): Promise<IAuthProvider>;
|
|
21
|
+
/**
|
|
22
|
+
* The responsible and master system the destination's own `.env` states
|
|
23
|
+
* (the `--env` file, or `sessions/<destination>.env`). Optional: a server
|
|
24
|
+
* whose destinations do not answer it falls back to the process
|
|
25
|
+
* configuration.
|
|
26
|
+
*/
|
|
27
|
+
systemContextFor?(destination: string): Promise<DestinationSystemContext>;
|
|
28
|
+
}
|
|
29
|
+
/** What `settle` found. */
|
|
30
|
+
export interface SettleReport {
|
|
31
|
+
/**
|
|
32
|
+
* `"<destination>": <reason>` for each session secret not stored, the
|
|
33
|
+
* reason auth-errors' `classify(entry, 'persisting-tokens')`.
|
|
34
|
+
*/
|
|
35
|
+
notStored: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface IAuthBrokerFactory extends IDestinations {
|
|
38
|
+
/** The destination the process serves when a request names none. */
|
|
39
|
+
readonly defaultDestination: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* One broker per destination, built on first use, then cached.
|
|
42
|
+
* A consumer that connects must use `getProvider` instead: the broker's own
|
|
43
|
+
* `getProvider` is not counted and bypasses the shutdown gate.
|
|
44
|
+
*/
|
|
45
|
+
getBroker(destination: string): Promise<AuthBroker>;
|
|
46
|
+
/**
|
|
47
|
+
* The shutdown began (in the latch's tick): no interactive login starts
|
|
48
|
+
* from here on, and an `aborted` login is answered with the shutdown
|
|
49
|
+
* sentence. The gate stays open: a tool still running is authorized with
|
|
50
|
+
* the credential held, a refresh included.
|
|
51
|
+
*/
|
|
52
|
+
beginShutdown(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Closes the gate on provider calls, disposes the login strategies it
|
|
55
|
+
* composed, waits for the calls in progress — no deadline — then
|
|
56
|
+
* `flush({ signal })`es every broker built.
|
|
57
|
+
*/
|
|
58
|
+
settle(options?: {
|
|
59
|
+
readonly signal?: AbortSignal | undefined;
|
|
60
|
+
}): Promise<SettleReport>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=IAuthBrokerFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAuthBrokerFactory.d.ts","sourceRoot":"","sources":["../../src/auth/IAuthBrokerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,MAAM,WAAW,aAAa;IAC5B,qFAAqF;IACrF,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACrD;;;;OAIG;IACH,WAAW,CACT,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;KAAE,GACtD,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1B;;;;;OAKG;IACH,gBAAgB,CAAC,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC3E;AAED,2BAA2B;AAC3B,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,oEAAoE;IACpE,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD;;;;OAIG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD;;;;;OAKG;IACH,aAAa,IAAI,IAAI,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE;QACf,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;KAC3C,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC3B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* What core's stdio server needs from the destinations, and the factory's
|
|
4
|
+
* whole surface. `DestinationSystemContext` stays lib's: the sources fill it,
|
|
5
|
+
* and lib's server reads it for each call's scope.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
//# sourceMappingURL=IAuthBrokerFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAuthBrokerFactory.js","sourceRoot":"","sources":["../../src/auth/IAuthBrokerFactory.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration of `AuthBrokerFactory`: where destinations live and what an
|
|
3
|
+
* interactive login needs. The launcher builds it from the parameters; the
|
|
4
|
+
* factory adds no default collaborator.
|
|
5
|
+
*/
|
|
6
|
+
import type { IAuthorizationStrategy, IBrowser } from '@mcp-abap-adt/interfaces-auth';
|
|
7
|
+
import type { ILogger } from '@mcp-abap-adt/interfaces-utils';
|
|
8
|
+
import type { RenewalMode } from './serverSentences.js';
|
|
9
|
+
/** What the login strategy is built from: auth-providers' `CallbackStrategyOptions`. */
|
|
10
|
+
export interface LoginStrategyOptions {
|
|
11
|
+
/** The browser that opens the URL; absent: the URL is shown on stderr. */
|
|
12
|
+
browser?: IBrowser;
|
|
13
|
+
/** The callback port; absent: the strategy's own (61001). */
|
|
14
|
+
port?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface IAuthBrokerFactoryConfig {
|
|
17
|
+
/**
|
|
18
|
+
* The `.env` file served as the destination `default`, and the parameter it
|
|
19
|
+
* came from as the user gave it (`--env`, `--env-path`, `MCP_ENV_PATH`, the
|
|
20
|
+
* YAML key): the source names the refusal of a
|
|
21
|
+
* file that does not exist. No default: whoever sets the path knows where it
|
|
22
|
+
* came from.
|
|
23
|
+
*/
|
|
24
|
+
envFile?: {
|
|
25
|
+
path: string;
|
|
26
|
+
source: string;
|
|
27
|
+
};
|
|
28
|
+
/** `--mcp=X`: the destination served when a request names none. */
|
|
29
|
+
mcpDestination?: string;
|
|
30
|
+
/** Base of `service-keys/` and `sessions/` (`--auth-broker-path`). */
|
|
31
|
+
authBrokerPath?: string;
|
|
32
|
+
/** Whether a named destination's secret is written to `sessions/`. */
|
|
33
|
+
unsafe: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The browser of an interactive login (`--browser`, `--browser-program`,
|
|
36
|
+
* mapped by `browserFor`); absent: none — the URL on stderr.
|
|
37
|
+
*/
|
|
38
|
+
browser?: IBrowser;
|
|
39
|
+
/**
|
|
40
|
+
* `--browser` names a browser this platform has none of (`browserFor`'s
|
|
41
|
+
* `unavailable` words): a `jwt` / `authorization_code` destination is
|
|
42
|
+
* refused for it at the startup check; the others never log in.
|
|
43
|
+
*/
|
|
44
|
+
browserUnavailable?: string;
|
|
45
|
+
/** The callback port of an interactive login; the strategy's default when absent. */
|
|
46
|
+
browserAuthPort?: number;
|
|
47
|
+
/** How the connector reaches the system (`--connection-type`). */
|
|
48
|
+
connectionType?: 'http' | 'rfc';
|
|
49
|
+
/**
|
|
50
|
+
* RFC through a message server and a logon group (`--mshost`, `--msserv`,
|
|
51
|
+
* `--sysid`, `--group`, `--saprouter` and their `SAP_*` / YAML forms):
|
|
52
|
+
* each reaches the destination's `SapConfig` as configured; an absent one
|
|
53
|
+
* has no key. No default and no check here — connection's.
|
|
54
|
+
*/
|
|
55
|
+
mshost?: string;
|
|
56
|
+
msserv?: string;
|
|
57
|
+
sysid?: string;
|
|
58
|
+
group?: string;
|
|
59
|
+
saprouter?: string;
|
|
60
|
+
/** `--renewal`; absent: `refresh-then-login`. */
|
|
61
|
+
renewal?: RenewalMode;
|
|
62
|
+
/**
|
|
63
|
+
* `--login-timeout` in milliseconds: each browser login is ended
|
|
64
|
+
* `aborted` once it has run this long. Absent: no bound — a login ends on
|
|
65
|
+
* its result, the user's refusal or its request's end.
|
|
66
|
+
*/
|
|
67
|
+
loginTimeoutMs?: number;
|
|
68
|
+
/**
|
|
69
|
+
* How the bound was set, as the login-bound sentence names it — the launcher's form
|
|
70
|
+
* as the user gave it (`` `--login-timeout=300` ``). Absent: the option
|
|
71
|
+
* itself, `` `loginTimeoutMs: <ms>` ``.
|
|
72
|
+
*/
|
|
73
|
+
loginTimeoutStated?: string;
|
|
74
|
+
/**
|
|
75
|
+
* `--auth-debug`: the brokers are built with `authDebug: true`, so a
|
|
76
|
+
* refused token request's debug line names its secrets' first and last four
|
|
77
|
+
* characters. Absent: off. The caller routes `logger` to stderr with it.
|
|
78
|
+
*/
|
|
79
|
+
authDebug?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Builds the login strategy of the `authorization_code` handler. The
|
|
82
|
+
* launcher passes auth-providers' `browserCallbackStrategy`; there is no
|
|
83
|
+
* default here. The factory wraps it in `serverLogin`.
|
|
84
|
+
*/
|
|
85
|
+
browserStrategy: (options: LoginStrategyOptions) => IAuthorizationStrategy<string>;
|
|
86
|
+
/** The logger a login prompts through (`promptLogger`: `info` on stderr). */
|
|
87
|
+
promptLogger: ILogger;
|
|
88
|
+
logger?: ILogger;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=IAuthBrokerFactoryConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAuthBrokerFactoryConfig.d.ts","sourceRoot":"","sources":["../../src/auth/IAuthBrokerFactoryConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,sBAAsB,EACtB,QAAQ,EACT,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,wFAAwF;AACxF,MAAM,WAAW,oBAAoB;IACnC,0EAA0E;IAC1E,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qFAAqF;IACrF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAChC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,eAAe,EAAE,CACf,OAAO,EAAE,oBAAoB,KAC1B,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACpC,6EAA6E;IAC7E,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration of `AuthBrokerFactory`: where destinations live and what an
|
|
4
|
+
* interactive login needs. The launcher builds it from the parameters; the
|
|
5
|
+
* factory adds no default collaborator.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
//# sourceMappingURL=IAuthBrokerFactoryConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAuthBrokerFactoryConfig.js","sourceRoot":"","sources":["../../src/auth/IAuthBrokerFactoryConfig.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|