@mcp-abap-adt/core 19.1.0 → 19.2.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 +13 -1
- package/bin/mcp-abap-adt.js +7 -2
- package/dist/auth/index.d.ts +5 -12
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +20 -34
- package/dist/auth/index.js.map +1 -1
- package/dist/coreVersion.d.ts +2 -12
- package/dist/coreVersion.d.ts.map +1 -1
- package/dist/coreVersion.js +5 -2
- package/dist/coreVersion.js.map +1 -1
- package/dist/index.d.ts +14 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -17
- package/dist/index.js.map +1 -1
- package/dist/launcher.d.ts +18 -134
- package/dist/launcher.d.ts.map +1 -1
- package/dist/launcher.js +32 -689
- package/dist/launcher.js.map +1 -1
- package/package.json +5 -15
- package/dist/StdioServer.d.ts +0 -87
- package/dist/StdioServer.d.ts.map +0 -1
- package/dist/StdioServer.js +0 -132
- package/dist/StdioServer.js.map +0 -1
- package/dist/auth/IAuthBrokerFactory.d.ts +0 -62
- package/dist/auth/IAuthBrokerFactory.d.ts.map +0 -1
- package/dist/auth/IAuthBrokerFactory.js +0 -8
- package/dist/auth/IAuthBrokerFactory.js.map +0 -1
- package/dist/auth/IAuthBrokerFactoryConfig.d.ts +0 -90
- package/dist/auth/IAuthBrokerFactoryConfig.d.ts.map +0 -1
- package/dist/auth/IAuthBrokerFactoryConfig.js +0 -8
- package/dist/auth/IAuthBrokerFactoryConfig.js.map +0 -1
- package/dist/auth/brokerFactory.d.ts +0 -93
- package/dist/auth/brokerFactory.d.ts.map +0 -1
- package/dist/auth/brokerFactory.js +0 -341
- package/dist/auth/brokerFactory.js.map +0 -1
- package/dist/auth/browser.d.ts +0 -60
- package/dist/auth/browser.d.ts.map +0 -1
- package/dist/auth/browser.js +0 -116
- package/dist/auth/browser.js.map +0 -1
- package/dist/auth/countedProvider.d.ts +0 -43
- package/dist/auth/countedProvider.d.ts.map +0 -1
- package/dist/auth/countedProvider.js +0 -105
- package/dist/auth/countedProvider.js.map +0 -1
- package/dist/auth/destinationFailure.d.ts +0 -69
- package/dist/auth/destinationFailure.d.ts.map +0 -1
- package/dist/auth/destinationFailure.js +0 -183
- package/dist/auth/destinationFailure.js.map +0 -1
- package/dist/auth/destinationStores.d.ts +0 -55
- package/dist/auth/destinationStores.d.ts.map +0 -1
- package/dist/auth/destinationStores.js +0 -158
- package/dist/auth/destinationStores.js.map +0 -1
- package/dist/auth/handlers/basic.d.ts +0 -3
- package/dist/auth/handlers/basic.d.ts.map +0 -1
- package/dist/auth/handlers/basic.js +0 -8
- package/dist/auth/handlers/basic.js.map +0 -1
- package/dist/auth/handlers/index.d.ts +0 -15
- package/dist/auth/handlers/index.d.ts.map +0 -1
- package/dist/auth/handlers/index.js +0 -32
- package/dist/auth/handlers/index.js.map +0 -1
- package/dist/auth/handlers/jwtAuthorizationCode.d.ts +0 -8
- package/dist/auth/handlers/jwtAuthorizationCode.d.ts.map +0 -1
- package/dist/auth/handlers/jwtAuthorizationCode.js +0 -32
- package/dist/auth/handlers/jwtAuthorizationCode.js.map +0 -1
- package/dist/auth/handlers/snc.d.ts +0 -3
- package/dist/auth/handlers/snc.d.ts.map +0 -1
- package/dist/auth/handlers/snc.js +0 -14
- package/dist/auth/handlers/snc.js.map +0 -1
- package/dist/auth/handlers/types.d.ts +0 -30
- package/dist/auth/handlers/types.d.ts.map +0 -1
- package/dist/auth/handlers/types.js +0 -3
- package/dist/auth/handlers/types.js.map +0 -1
- package/dist/auth/serverLogin.d.ts +0 -75
- package/dist/auth/serverLogin.d.ts.map +0 -1
- package/dist/auth/serverLogin.js +0 -138
- package/dist/auth/serverLogin.js.map +0 -1
- package/dist/auth/serverSentences.d.ts +0 -39
- package/dist/auth/serverSentences.d.ts.map +0 -1
- package/dist/auth/serverSentences.js +0 -49
- package/dist/auth/serverSentences.js.map +0 -1
- package/dist/auth/vocabulary.d.ts +0 -28
- package/dist/auth/vocabulary.d.ts.map +0 -1
- package/dist/auth/vocabulary.js +0 -67
- package/dist/auth/vocabulary.js.map +0 -1
- package/dist/config/coreParameters.d.ts +0 -125
- package/dist/config/coreParameters.d.ts.map +0 -1
- package/dist/config/coreParameters.js +0 -331
- package/dist/config/coreParameters.js.map +0 -1
- package/dist/config/envFileContext.d.ts +0 -26
- package/dist/config/envFileContext.d.ts.map +0 -1
- package/dist/config/envFileContext.js +0 -90
- package/dist/config/envFileContext.js.map +0 -1
- package/dist/config/envResolver.d.ts +0 -6
- package/dist/config/envResolver.d.ts.map +0 -1
- package/dist/config/envResolver.js +0 -81
- package/dist/config/envResolver.js.map +0 -1
- package/dist/config/platformPaths.d.ts +0 -28
- package/dist/config/platformPaths.d.ts.map +0 -1
- package/dist/config/platformPaths.js +0 -152
- package/dist/config/platformPaths.js.map +0 -1
- package/dist/destinationSource.d.ts +0 -26
- package/dist/destinationSource.d.ts.map +0 -1
- package/dist/destinationSource.js +0 -43
- package/dist/destinationSource.js.map +0 -1
- package/dist/shutdown.d.ts +0 -97
- package/dist/shutdown.d.ts.map +0 -1
- package/dist/shutdown.js +0 -136
- package/dist/shutdown.js.map +0 -1
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.resolveEnvFilePath = resolveEnvFilePath;
|
|
37
|
-
const path = __importStar(require("node:path"));
|
|
38
|
-
const platformPaths_1 = require("./platformPaths");
|
|
39
|
-
function normalizeEnvFileName(input) {
|
|
40
|
-
const trimmed = input.trim();
|
|
41
|
-
if (!trimmed)
|
|
42
|
-
return trimmed;
|
|
43
|
-
return trimmed.toLowerCase().endsWith('.env') ? trimmed : `${trimmed}.env`;
|
|
44
|
-
}
|
|
45
|
-
function isLikelyPath(input) {
|
|
46
|
-
if (!input)
|
|
47
|
-
return false;
|
|
48
|
-
if (input.includes('/') || input.includes('\\'))
|
|
49
|
-
return true;
|
|
50
|
-
if (input.startsWith('.') || input.startsWith('~'))
|
|
51
|
-
return true;
|
|
52
|
-
if (path.isAbsolute(input))
|
|
53
|
-
return true;
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
function resolvePathLike(input) {
|
|
57
|
-
if (path.isAbsolute(input))
|
|
58
|
-
return input;
|
|
59
|
-
return path.resolve(process.cwd(), input);
|
|
60
|
-
}
|
|
61
|
-
function firstPlatformSessionsDir(customPath) {
|
|
62
|
-
return (0, platformPaths_1.getPlatformPaths)(customPath, 'sessions')[0];
|
|
63
|
-
}
|
|
64
|
-
function resolveEnvFilePath(options) {
|
|
65
|
-
const envPath = options.envPath?.trim();
|
|
66
|
-
if (envPath) {
|
|
67
|
-
return resolvePathLike(envPath);
|
|
68
|
-
}
|
|
69
|
-
const envDestination = options.envDestination?.trim();
|
|
70
|
-
if (!envDestination) {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
// Backward compatibility: if --env was passed with a path, treat it as a path.
|
|
74
|
-
if (isLikelyPath(envDestination)) {
|
|
75
|
-
return resolvePathLike(envDestination);
|
|
76
|
-
}
|
|
77
|
-
const fileName = normalizeEnvFileName(envDestination);
|
|
78
|
-
const sessionsDir = firstPlatformSessionsDir(options.authBrokerPath);
|
|
79
|
-
return path.join(sessionsDir, fileName);
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=envResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"envResolver.js","sourceRoot":"","sources":["../../src/config/envResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,gDAuBC;AAjDD,gDAAkC;AAClC,mDAAmD;AAEnD,SAAS,oBAAoB,CAAC,KAAa;IACzC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC;IAC7B,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,MAAM,CAAC;AAC7E,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,IAAI,CAAC,KAAK;QA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c,CAAC,CAAC;IACrE,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Platform-specific path resolution for mcp-abap-adt
|
|
3
|
-
*
|
|
4
|
-
* Defines default paths for service keys and sessions:
|
|
5
|
-
* - Unix: ~/.config/mcp-abap-adt/service-keys, ~/.config/mcp-abap-adt/sessions
|
|
6
|
-
* - Windows: %USERPROFILE%\Documents\mcp-abap-adt\service-keys, %USERPROFILE%\Documents\mcp-abap-adt\sessions
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Get platform-specific default paths for service keys and sessions
|
|
10
|
-
*
|
|
11
|
-
* Priority:
|
|
12
|
-
* 1. Custom path (if provided)
|
|
13
|
-
* 2. AUTH_BROKER_PATH environment variable
|
|
14
|
-
* 3. Platform-specific standard paths:
|
|
15
|
-
* - Unix: ~/.config/mcp-abap-adt/service-keys, ~/.config/mcp-abap-adt/sessions
|
|
16
|
-
* - Windows: %USERPROFILE%\Documents\mcp-abap-adt\service-keys, %USERPROFILE%\Documents\mcp-abap-adt\sessions
|
|
17
|
-
*
|
|
18
|
-
* Never the working directory: nothing is looked up where the process happens
|
|
19
|
-
* to start (a server started inside someone else's project must not take
|
|
20
|
-
* their stores). A relative custom path or AUTH_BROKER_PATH entry is named by
|
|
21
|
-
* the user, so it still resolves against the working directory.
|
|
22
|
-
*
|
|
23
|
-
* @param customPath Optional custom path (highest priority)
|
|
24
|
-
* @param subfolder Subfolder name ('service-keys' or 'sessions')
|
|
25
|
-
* @returns Array of resolved absolute paths
|
|
26
|
-
*/
|
|
27
|
-
export declare function getPlatformPaths(customPath?: string | string[], subfolder?: 'service-keys' | 'sessions'): string[];
|
|
28
|
-
//# sourceMappingURL=platformPaths.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platformPaths.d.ts","sourceRoot":"","sources":["../../src/config/platformPaths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC9B,SAAS,CAAC,EAAE,cAAc,GAAG,UAAU,GACtC,MAAM,EAAE,CA4FV"}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Platform-specific path resolution for mcp-abap-adt
|
|
4
|
-
*
|
|
5
|
-
* Defines default paths for service keys and sessions:
|
|
6
|
-
* - Unix: ~/.config/mcp-abap-adt/service-keys, ~/.config/mcp-abap-adt/sessions
|
|
7
|
-
* - Windows: %USERPROFILE%\Documents\mcp-abap-adt\service-keys, %USERPROFILE%\Documents\mcp-abap-adt\sessions
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
})();
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.getPlatformPaths = getPlatformPaths;
|
|
44
|
-
const os = __importStar(require("node:os"));
|
|
45
|
-
const path = __importStar(require("node:path"));
|
|
46
|
-
/**
|
|
47
|
-
* Get platform-specific default paths for service keys and sessions
|
|
48
|
-
*
|
|
49
|
-
* Priority:
|
|
50
|
-
* 1. Custom path (if provided)
|
|
51
|
-
* 2. AUTH_BROKER_PATH environment variable
|
|
52
|
-
* 3. Platform-specific standard paths:
|
|
53
|
-
* - Unix: ~/.config/mcp-abap-adt/service-keys, ~/.config/mcp-abap-adt/sessions
|
|
54
|
-
* - Windows: %USERPROFILE%\Documents\mcp-abap-adt\service-keys, %USERPROFILE%\Documents\mcp-abap-adt\sessions
|
|
55
|
-
*
|
|
56
|
-
* Never the working directory: nothing is looked up where the process happens
|
|
57
|
-
* to start (a server started inside someone else's project must not take
|
|
58
|
-
* their stores). A relative custom path or AUTH_BROKER_PATH entry is named by
|
|
59
|
-
* the user, so it still resolves against the working directory.
|
|
60
|
-
*
|
|
61
|
-
* @param customPath Optional custom path (highest priority)
|
|
62
|
-
* @param subfolder Subfolder name ('service-keys' or 'sessions')
|
|
63
|
-
* @returns Array of resolved absolute paths
|
|
64
|
-
*/
|
|
65
|
-
function getPlatformPaths(customPath, subfolder) {
|
|
66
|
-
const paths = [];
|
|
67
|
-
const isWindows = process.platform === 'win32';
|
|
68
|
-
// Priority 1: Custom path from constructor
|
|
69
|
-
// customPath is ALWAYS a base path - we add subfolder to it
|
|
70
|
-
if (customPath) {
|
|
71
|
-
if (Array.isArray(customPath)) {
|
|
72
|
-
// For arrays, add subfolder to each path if subfolder is specified
|
|
73
|
-
paths.push(...customPath.map((p) => {
|
|
74
|
-
let resolved = path.resolve(p);
|
|
75
|
-
// If path already ends with subfolder, use parent directory as base
|
|
76
|
-
if (subfolder && path.basename(resolved) === subfolder) {
|
|
77
|
-
resolved = path.dirname(resolved);
|
|
78
|
-
}
|
|
79
|
-
return subfolder ? path.join(resolved, subfolder) : resolved;
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
// For single path, add subfolder if specified
|
|
84
|
-
// customPath is ALWAYS a base path - we add subfolder to it
|
|
85
|
-
let resolved = path.resolve(customPath);
|
|
86
|
-
// If path already ends with subfolder, use parent directory as base
|
|
87
|
-
if (subfolder && path.basename(resolved) === subfolder) {
|
|
88
|
-
resolved = path.dirname(resolved);
|
|
89
|
-
}
|
|
90
|
-
paths.push(subfolder ? path.join(resolved, subfolder) : resolved);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
// Priority 2: AUTH_BROKER_PATH environment variable
|
|
94
|
-
// AUTH_BROKER_PATH is ALWAYS a base path - we add subfolder to it
|
|
95
|
-
const envPath = process.env.AUTH_BROKER_PATH;
|
|
96
|
-
if (envPath) {
|
|
97
|
-
// Only semicolon separates paths on Windows. Splitting on ':' as well
|
|
98
|
-
// tears an absolute path in two at its drive letter: "D:\tools\project"
|
|
99
|
-
// becomes "D" and "\tools\project", the second resolving against
|
|
100
|
-
// whatever drive the process is on — a bogus directory added beside the
|
|
101
|
-
// real one, or no match at all when run from another drive.
|
|
102
|
-
const envPaths = envPath
|
|
103
|
-
.split(isWindows ? /;/ : /[:;]/)
|
|
104
|
-
.map((p) => p.trim())
|
|
105
|
-
.filter((p) => p.length > 0);
|
|
106
|
-
paths.push(...envPaths.map((p) => {
|
|
107
|
-
let resolved = path.resolve(p);
|
|
108
|
-
// If path already ends with subfolder, use parent directory as base
|
|
109
|
-
if (subfolder && path.basename(resolved) === subfolder) {
|
|
110
|
-
resolved = path.dirname(resolved);
|
|
111
|
-
}
|
|
112
|
-
return subfolder ? path.join(resolved, subfolder) : resolved;
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
// Priority 3: Platform-specific standard paths
|
|
116
|
-
if (paths.length === 0) {
|
|
117
|
-
// Only add platform-specific paths if no custom paths were provided
|
|
118
|
-
const homeDir = os.homedir();
|
|
119
|
-
if (isWindows) {
|
|
120
|
-
// Windows: %USERPROFILE%\Documents\mcp-abap-adt\{subfolder}
|
|
121
|
-
const basePath = path.join(homeDir, 'Documents', 'mcp-abap-adt');
|
|
122
|
-
if (subfolder) {
|
|
123
|
-
paths.push(path.join(basePath, subfolder));
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
paths.push(basePath);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
// Unix (Linux/macOS): ~/.config/mcp-abap-adt/{subfolder}
|
|
131
|
-
const basePath = path.join(homeDir, '.config', 'mcp-abap-adt');
|
|
132
|
-
if (subfolder) {
|
|
133
|
-
paths.push(path.join(basePath, subfolder));
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
paths.push(basePath);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
// Remove duplicates while preserving order
|
|
141
|
-
const uniquePaths = [];
|
|
142
|
-
const seen = new Set();
|
|
143
|
-
for (const p of paths) {
|
|
144
|
-
const normalized = path.normalize(p);
|
|
145
|
-
if (!seen.has(normalized)) {
|
|
146
|
-
seen.add(normalized);
|
|
147
|
-
uniquePaths.push(normalized);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return uniquePaths;
|
|
151
|
-
}
|
|
152
|
-
//#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CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* core's `ConnectionSource`: the destination the process serves,
|
|
3
|
-
* through the destination layer. Per request — with the request's signal —
|
|
4
|
-
* the settings (read once per process by the factory), the provider
|
|
5
|
-
* (`getProvider(destination, { signal })`: the broker's provider, the same
|
|
6
|
-
* one for the process's life) and what the destination's own `.env` states
|
|
7
|
-
* about who creates objects.
|
|
8
|
-
*
|
|
9
|
-
* Each of the three waits races the request's signal: they are shared
|
|
10
|
-
* work (one read, one build, one lookup for every caller), so a cancelled
|
|
11
|
-
* caller settles at once while the work runs on for the others, and a late
|
|
12
|
-
* rejection is handled.
|
|
13
|
-
*
|
|
14
|
-
* The server keeps no provider: asking `getProvider` per request is what
|
|
15
|
-
* carries renewal, a failed session write's refusal and the cancel of a
|
|
16
|
-
* login. On stdio the user is fixed for the process: the session is renewed
|
|
17
|
-
* (refresh token, or a new login when the refresh fails) and written back by
|
|
18
|
-
* that same provider — the same user. The instance's connection is kept
|
|
19
|
-
* while the source answers the same provider, and replaced only when
|
|
20
|
-
* SAP already lost the session, built with the provider `getProvider`
|
|
21
|
-
* answers — the same one.
|
|
22
|
-
*/
|
|
23
|
-
import { type ConnectionSource } from '@mcp-abap-adt/lib/embeddable';
|
|
24
|
-
import type { IDestinations } from './auth/IAuthBrokerFactory.js';
|
|
25
|
-
export declare function destinationSource(destination: string, destinations: IDestinations): ConnectionSource;
|
|
26
|
-
//# sourceMappingURL=destinationSource.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"destinationSource.d.ts","sourceRoot":"","sources":["../src/destinationSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,aAAa,GAC1B,gBAAgB,CAyBlB"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* core's `ConnectionSource`: the destination the process serves,
|
|
4
|
-
* through the destination layer. Per request — with the request's signal —
|
|
5
|
-
* the settings (read once per process by the factory), the provider
|
|
6
|
-
* (`getProvider(destination, { signal })`: the broker's provider, the same
|
|
7
|
-
* one for the process's life) and what the destination's own `.env` states
|
|
8
|
-
* about who creates objects.
|
|
9
|
-
*
|
|
10
|
-
* Each of the three waits races the request's signal: they are shared
|
|
11
|
-
* work (one read, one build, one lookup for every caller), so a cancelled
|
|
12
|
-
* caller settles at once while the work runs on for the others, and a late
|
|
13
|
-
* rejection is handled.
|
|
14
|
-
*
|
|
15
|
-
* The server keeps no provider: asking `getProvider` per request is what
|
|
16
|
-
* carries renewal, a failed session write's refusal and the cancel of a
|
|
17
|
-
* login. On stdio the user is fixed for the process: the session is renewed
|
|
18
|
-
* (refresh token, or a new login when the refresh fails) and written back by
|
|
19
|
-
* that same provider — the same user. The instance's connection is kept
|
|
20
|
-
* while the source answers the same provider, and replaced only when
|
|
21
|
-
* SAP already lost the session, built with the provider `getProvider`
|
|
22
|
-
* answers — the same one.
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.destinationSource = destinationSource;
|
|
26
|
-
const embeddable_1 = require("@mcp-abap-adt/lib/embeddable");
|
|
27
|
-
function destinationSource(destination, destinations) {
|
|
28
|
-
return {
|
|
29
|
-
async resolve(signal) {
|
|
30
|
-
const settings = await (0, embeddable_1.raceRequestSignal)(destinations.settingsFor(destination), signal);
|
|
31
|
-
const credential = await (0, embeddable_1.raceRequestSignal)(destinations.getProvider(destination, { signal }), signal);
|
|
32
|
-
const systemContext = destinations.systemContextFor === undefined
|
|
33
|
-
? undefined
|
|
34
|
-
: await (0, embeddable_1.raceRequestSignal)(destinations.systemContextFor(destination), signal);
|
|
35
|
-
return {
|
|
36
|
-
settings: { ...settings },
|
|
37
|
-
credential,
|
|
38
|
-
...(systemContext !== undefined ? { systemContext } : {}),
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=destinationSource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"destinationSource.js","sourceRoot":"","sources":["../src/destinationSource.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;AAQH,8CA4BC;AAlCD,6DAGsC;AAGtC,SAAgB,iBAAiB,CAC/B,WAAmB,EACnB,YAA2B;IAE3B,OAAO;QACL,KAAK,CAAC,OAAO,CAAC,MAAmB;YAC/B,MAAM,QAAQ,GAAG,MAAM,IAAA,8BAAiB,EACtC,YAAY,CAAC,WAAW,CAAC,WAAW,CAAC,EACrC,MAAM,CACP,CAAC;YACF,MAAM,UAAU,GAAG,MAAM,IAAA,8BAAiB,EACxC,YAAY,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,EACjD,MAAM,CACP,CAAC;YACF,MAAM,aAAa,GACjB,YAAY,CAAC,gBAAgB,KAAK,SAAS;gBACzC,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,MAAM,IAAA,8BAAiB,EACrB,YAAY,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAC1C,MAAM,CACP,CAAC;YACR,OAAO;gBACL,QAAQ,EAAE,EAAE,GAAG,QAAQ,EAAE;gBACzB,UAAU;gBACV,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC1D,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/shutdown.d.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The program's shutdown, stdio. Installed by the launcher
|
|
3
|
-
* only — the program, not the library — so an embedder's process is never
|
|
4
|
-
* taken over.
|
|
5
|
-
*
|
|
6
|
-
* The first trigger — `SIGTERM`, `SIGINT`, stdin's `end` or `close` (one
|
|
7
|
-
* start: the client closed the transport) — starts one sequence, in
|
|
8
|
-
* this order:
|
|
9
|
-
*
|
|
10
|
-
* 1. the registry's latch, in the trigger's tick: a call read from here on
|
|
11
|
-
* is answered with the shutdown refusal and reaches no tool — that is how
|
|
12
|
-
* the server stops taking input; the factory's `beginShutdown()`: no
|
|
13
|
-
* interactive login starts any more;
|
|
14
|
-
* 2. **the logoffs at once** (lib's `logOffAtOnce`): every connection the
|
|
15
|
-
* process owns — the instance's connector, held state's (the debugger's),
|
|
16
|
-
* long reads' and lock sessions' fresh ones, background runs' — gets its
|
|
17
|
-
* logoff, which releases the locks, and every running call is
|
|
18
|
-
* interrupted; nothing waits for a running tool, and a queued call never
|
|
19
|
-
* sends. Held state ends with its connections: no state undo is sent;
|
|
20
|
-
* 3. the MCP server closed;
|
|
21
|
-
* 4. `settle({ signal })`: the gate closes, the composed logins are
|
|
22
|
-
* disposed, the counted calls drain, every broker is flushed — no
|
|
23
|
-
* deadline of the server's choosing; then the logoff of any connection
|
|
24
|
-
* opened meanwhile;
|
|
25
|
-
* 5. exit `0`, or `1` with one stderr line per fact. A shutdown that began
|
|
26
|
-
* before the transport opened (`startBirth`: the connector still being
|
|
27
|
-
* born) ends the composed logins beside the logoffs (`endLogins`: an
|
|
28
|
-
* interactive login at the start ends with them), waits for the start to
|
|
29
|
-
* end and exits `1` — the start failed; it is the process's one exit.
|
|
30
|
-
*
|
|
31
|
-
* Only a `SIGTERM` / `SIGINT` after the start, or `--shutdown-timeout` (no
|
|
32
|
-
* default), ends the waiting early: the forced close (lib's
|
|
33
|
-
* `shutdownSequence.ts`) — no further wait on the flush; every owned
|
|
34
|
-
* connection's logoff written; exit `1` naming what was pending.
|
|
35
|
-
*
|
|
36
|
-
* Nothing is written to stdout (H3), and no line carries an error's message:
|
|
37
|
-
* fixed words, a destination and auth-errors' reason only.
|
|
38
|
-
*/
|
|
39
|
-
import { type ShutdownProcess } from '@mcp-abap-adt/lib/state';
|
|
40
|
-
import type { SettleReport } from './auth/IAuthBrokerFactory.js';
|
|
41
|
-
export type { ShutdownProcess };
|
|
42
|
-
export interface ShutdownOptions {
|
|
43
|
-
factory: {
|
|
44
|
-
beginShutdown(): void;
|
|
45
|
-
/** Ends every login it composed: a start waiting on one ends with it. */
|
|
46
|
-
endLogins(): Promise<void>;
|
|
47
|
-
settle(options?: {
|
|
48
|
-
signal?: AbortSignal;
|
|
49
|
-
}): Promise<SettleReport>;
|
|
50
|
-
};
|
|
51
|
-
/** The stdio instance: its MCP server closed after the logoffs, before the gate. */
|
|
52
|
-
instance: {
|
|
53
|
-
close(): Promise<void>;
|
|
54
|
-
};
|
|
55
|
-
/** Whether the end of stdin is a trigger (stdio). */
|
|
56
|
-
onStdinEnd?: boolean;
|
|
57
|
-
exit: (code: number) => void;
|
|
58
|
-
stderr: (line: string) => void;
|
|
59
|
-
processLike: ShutdownProcess;
|
|
60
|
-
/** `--shutdown-timeout` in milliseconds; absent: none. */
|
|
61
|
-
shutdownTimeoutMs?: number | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* The start: whether the transport opened. A shutdown before it ends the
|
|
64
|
-
* start and exits `1` (`startBirth`); absent: the transport is open.
|
|
65
|
-
*/
|
|
66
|
-
birth?: StartBirth | undefined;
|
|
67
|
-
}
|
|
68
|
-
/** The line of a shutdown that came before the transport opened. */
|
|
69
|
-
export declare const SHUTDOWN_BEFORE_START_LINE = "[MCP] The shutdown began before the server started: the start failed";
|
|
70
|
-
/**
|
|
71
|
-
* The start as the shutdown sees it: the connector's birth, then the
|
|
72
|
-
* transport's opening. The launcher hands its birth over (`joining`) and
|
|
73
|
-
* asks, once the birth settled, whether it may still open the transport
|
|
74
|
-
* (`open`) — `false` once the shutdown began. A shutdown that began before
|
|
75
|
-
* the transport opened waits for the birth to settle (its logoffs at once
|
|
76
|
-
* end it), then exits `1`: the start failed. The launcher then exits
|
|
77
|
-
* nothing itself (`shutdownBegan`): the shutdown's exit is the process's
|
|
78
|
-
* one exit.
|
|
79
|
-
*/
|
|
80
|
-
export interface StartBirth {
|
|
81
|
-
/** Whether the shutdown began. */
|
|
82
|
-
shutdownBegan(): boolean;
|
|
83
|
-
/** The birth under way; the shutdown joins it. */
|
|
84
|
-
joining<T>(birth: Promise<T>): Promise<T>;
|
|
85
|
-
/** The transport opens now — `false` (nothing opened) once the shutdown began. */
|
|
86
|
-
open(): boolean;
|
|
87
|
-
}
|
|
88
|
-
/** A new start, not yet opened. */
|
|
89
|
-
export declare function startBirth(): StartBirth;
|
|
90
|
-
/** The line of a session secret not stored. */
|
|
91
|
-
export declare function notStoredLine(entry: string): string;
|
|
92
|
-
/**
|
|
93
|
-
* Installs the triggers and answers the sequence itself, for a caller that
|
|
94
|
-
* shuts down for its own reason. Every call answers the same run.
|
|
95
|
-
*/
|
|
96
|
-
export declare function installShutdown(options: ShutdownOptions): () => Promise<void>;
|
|
97
|
-
//# sourceMappingURL=shutdown.d.ts.map
|
package/dist/shutdown.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../src/shutdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE;QACP,aAAa,IAAI,IAAI,CAAC;QACtB,yEAAyE;QACzE,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,MAAM,CAAC,OAAO,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;KACnE,CAAC;IACF,oFAAoF;IACpF,QAAQ,EAAE;QAAE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC;IACrC,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,WAAW,EAAE,eAAe,CAAC;IAC7B,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CAChC;AAED,oEAAoE;AACpE,eAAO,MAAM,0BAA0B,yEACiC,CAAC;AAEzE;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACzB,kCAAkC;IAClC,aAAa,IAAI,OAAO,CAAC;IACzB,kDAAkD;IAClD,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1C,kFAAkF;IAClF,IAAI,IAAI,OAAO,CAAC;CACjB;AAYD,mCAAmC;AACnC,wBAAgB,UAAU,IAAI,UAAU,CA0BvC;AAED,+CAA+C;AAC/C,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAkD7E"}
|
package/dist/shutdown.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The program's shutdown, stdio. Installed by the launcher
|
|
4
|
-
* only — the program, not the library — so an embedder's process is never
|
|
5
|
-
* taken over.
|
|
6
|
-
*
|
|
7
|
-
* The first trigger — `SIGTERM`, `SIGINT`, stdin's `end` or `close` (one
|
|
8
|
-
* start: the client closed the transport) — starts one sequence, in
|
|
9
|
-
* this order:
|
|
10
|
-
*
|
|
11
|
-
* 1. the registry's latch, in the trigger's tick: a call read from here on
|
|
12
|
-
* is answered with the shutdown refusal and reaches no tool — that is how
|
|
13
|
-
* the server stops taking input; the factory's `beginShutdown()`: no
|
|
14
|
-
* interactive login starts any more;
|
|
15
|
-
* 2. **the logoffs at once** (lib's `logOffAtOnce`): every connection the
|
|
16
|
-
* process owns — the instance's connector, held state's (the debugger's),
|
|
17
|
-
* long reads' and lock sessions' fresh ones, background runs' — gets its
|
|
18
|
-
* logoff, which releases the locks, and every running call is
|
|
19
|
-
* interrupted; nothing waits for a running tool, and a queued call never
|
|
20
|
-
* sends. Held state ends with its connections: no state undo is sent;
|
|
21
|
-
* 3. the MCP server closed;
|
|
22
|
-
* 4. `settle({ signal })`: the gate closes, the composed logins are
|
|
23
|
-
* disposed, the counted calls drain, every broker is flushed — no
|
|
24
|
-
* deadline of the server's choosing; then the logoff of any connection
|
|
25
|
-
* opened meanwhile;
|
|
26
|
-
* 5. exit `0`, or `1` with one stderr line per fact. A shutdown that began
|
|
27
|
-
* before the transport opened (`startBirth`: the connector still being
|
|
28
|
-
* born) ends the composed logins beside the logoffs (`endLogins`: an
|
|
29
|
-
* interactive login at the start ends with them), waits for the start to
|
|
30
|
-
* end and exits `1` — the start failed; it is the process's one exit.
|
|
31
|
-
*
|
|
32
|
-
* Only a `SIGTERM` / `SIGINT` after the start, or `--shutdown-timeout` (no
|
|
33
|
-
* default), ends the waiting early: the forced close (lib's
|
|
34
|
-
* `shutdownSequence.ts`) — no further wait on the flush; every owned
|
|
35
|
-
* connection's logoff written; exit `1` naming what was pending.
|
|
36
|
-
*
|
|
37
|
-
* Nothing is written to stdout (H3), and no line carries an error's message:
|
|
38
|
-
* fixed words, a destination and auth-errors' reason only.
|
|
39
|
-
*/
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.SHUTDOWN_BEFORE_START_LINE = void 0;
|
|
42
|
-
exports.startBirth = startBirth;
|
|
43
|
-
exports.notStoredLine = notStoredLine;
|
|
44
|
-
exports.installShutdown = installShutdown;
|
|
45
|
-
const auth_1 = require("@mcp-abap-adt/lib/auth");
|
|
46
|
-
const state_1 = require("@mcp-abap-adt/lib/state");
|
|
47
|
-
/** The line of a shutdown that came before the transport opened. */
|
|
48
|
-
exports.SHUTDOWN_BEFORE_START_LINE = '[MCP] The shutdown began before the server started: the start failed';
|
|
49
|
-
/** A new start, not yet opened. */
|
|
50
|
-
function startBirth() {
|
|
51
|
-
let began = false;
|
|
52
|
-
let opened = false;
|
|
53
|
-
let birth = Promise.resolve();
|
|
54
|
-
const state = {
|
|
55
|
-
shutdownBegan: () => began,
|
|
56
|
-
joining: (pending) => {
|
|
57
|
-
birth = pending;
|
|
58
|
-
return pending;
|
|
59
|
-
},
|
|
60
|
-
open: () => {
|
|
61
|
-
if (began)
|
|
62
|
-
return false;
|
|
63
|
-
opened = true;
|
|
64
|
-
return true;
|
|
65
|
-
},
|
|
66
|
-
began: () => {
|
|
67
|
-
began = true;
|
|
68
|
-
},
|
|
69
|
-
opened: () => opened,
|
|
70
|
-
settled: () => birth.then(() => undefined, () => undefined),
|
|
71
|
-
};
|
|
72
|
-
return state;
|
|
73
|
-
}
|
|
74
|
-
/** The line of a session secret not stored. */
|
|
75
|
-
function notStoredLine(entry) {
|
|
76
|
-
return `[MCP] Session secrets not stored: ${entry}`;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Installs the triggers and answers the sequence itself, for a caller that
|
|
80
|
-
* shuts down for its own reason. Every call answers the same run.
|
|
81
|
-
*/
|
|
82
|
-
function installShutdown(options) {
|
|
83
|
-
const { factory, instance } = options;
|
|
84
|
-
const birth = options.birth;
|
|
85
|
-
return (0, state_1.installShutdownSequence)({
|
|
86
|
-
begin: () => {
|
|
87
|
-
birth?.began();
|
|
88
|
-
factory.beginShutdown();
|
|
89
|
-
},
|
|
90
|
-
run: async (step, signal) => {
|
|
91
|
-
const lines = [];
|
|
92
|
-
// Read in the trigger's turn: the transport cannot open after it.
|
|
93
|
-
const beforeStart = birth !== undefined && !birth.opened();
|
|
94
|
-
step('the logoffs');
|
|
95
|
-
// Before the start: the logoff of the connection being born is queued
|
|
96
|
-
// behind its connect (connection 17), and an interactive login holds
|
|
97
|
-
// that connect until the login ends — so the logins end now, beside
|
|
98
|
-
// the logoffs, not at the session writes.
|
|
99
|
-
await Promise.all([
|
|
100
|
-
(0, state_1.logOffAtOnce)(),
|
|
101
|
-
beforeStart ? factory.endLogins() : undefined,
|
|
102
|
-
]);
|
|
103
|
-
if (beforeStart) {
|
|
104
|
-
// The start ends with the logoffs; its own failure line first.
|
|
105
|
-
step('the start');
|
|
106
|
-
await birth.settled();
|
|
107
|
-
lines.push(exports.SHUTDOWN_BEFORE_START_LINE);
|
|
108
|
-
}
|
|
109
|
-
step('the instance close');
|
|
110
|
-
try {
|
|
111
|
-
await instance.close();
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
// The MCP server's own close: its transport is gone either way.
|
|
115
|
-
}
|
|
116
|
-
step('the session writes');
|
|
117
|
-
try {
|
|
118
|
-
const report = await factory.settle({ signal });
|
|
119
|
-
for (const entry of report.notStored)
|
|
120
|
-
lines.push(notStoredLine(entry));
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
lines.push(`[MCP] Shutdown did not settle: ${(0, auth_1.errorClassOf)(error)}`);
|
|
124
|
-
}
|
|
125
|
-
// A connection opened while the writes settled is logged off too.
|
|
126
|
-
await (0, state_1.logOffAtOnce)();
|
|
127
|
-
return { lines };
|
|
128
|
-
},
|
|
129
|
-
onStdinEnd: options.onStdinEnd,
|
|
130
|
-
exit: options.exit,
|
|
131
|
-
stderr: options.stderr,
|
|
132
|
-
processLike: options.processLike,
|
|
133
|
-
shutdownTimeoutMs: options.shutdownTimeoutMs,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
//# sourceMappingURL=shutdown.js.map
|
package/dist/shutdown.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../src/shutdown.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;;AAqEH,gCA0BC;AAGD,sCAEC;AAMD,0CAkDC;AA1JD,iDAAsD;AACtD,mDAIiC;AA4BjC,oEAAoE;AACvD,QAAA,0BAA0B,GACrC,sEAAsE,CAAC;AA+BzE,mCAAmC;AACnC,SAAgB,UAAU;IACxB,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,KAAK,GAAqB,OAAO,CAAC,OAAO,EAAE,CAAC;IAChD,MAAM,KAAK,GAAoB;QAC7B,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;QAC1B,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE;YACnB,KAAK,GAAG,OAAO,CAAC;YAChB,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,IAAI,EAAE,GAAG,EAAE;YACT,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC;YACxB,MAAM,GAAG,IAAI,CAAC;YACd,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,EAAE,GAAG,EAAE;YACV,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;QACD,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;QACpB,OAAO,EAAE,GAAG,EAAE,CACZ,KAAK,CAAC,IAAI,CACR,GAAG,EAAE,CAAC,SAAS,EACf,GAAG,EAAE,CAAC,SAAS,CAChB;KACJ,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC;AAED,+CAA+C;AAC/C,SAAgB,aAAa,CAAC,KAAa;IAC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