@mcp-abap-adt/core 19.0.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.
Files changed (107) hide show
  1. package/README.md +13 -1
  2. package/bin/mcp-abap-adt.js +7 -2
  3. package/dist/auth/index.d.ts +5 -12
  4. package/dist/auth/index.d.ts.map +1 -1
  5. package/dist/auth/index.js +20 -34
  6. package/dist/auth/index.js.map +1 -1
  7. package/dist/coreVersion.d.ts +2 -12
  8. package/dist/coreVersion.d.ts.map +1 -1
  9. package/dist/coreVersion.js +5 -2
  10. package/dist/coreVersion.js.map +1 -1
  11. package/dist/index.d.ts +14 -6
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +33 -17
  14. package/dist/index.js.map +1 -1
  15. package/dist/launcher.d.ts +18 -134
  16. package/dist/launcher.d.ts.map +1 -1
  17. package/dist/launcher.js +32 -689
  18. package/dist/launcher.js.map +1 -1
  19. package/package.json +5 -15
  20. package/dist/StdioServer.d.ts +0 -87
  21. package/dist/StdioServer.d.ts.map +0 -1
  22. package/dist/StdioServer.js +0 -132
  23. package/dist/StdioServer.js.map +0 -1
  24. package/dist/auth/IAuthBrokerFactory.d.ts +0 -62
  25. package/dist/auth/IAuthBrokerFactory.d.ts.map +0 -1
  26. package/dist/auth/IAuthBrokerFactory.js +0 -8
  27. package/dist/auth/IAuthBrokerFactory.js.map +0 -1
  28. package/dist/auth/IAuthBrokerFactoryConfig.d.ts +0 -90
  29. package/dist/auth/IAuthBrokerFactoryConfig.d.ts.map +0 -1
  30. package/dist/auth/IAuthBrokerFactoryConfig.js +0 -8
  31. package/dist/auth/IAuthBrokerFactoryConfig.js.map +0 -1
  32. package/dist/auth/brokerFactory.d.ts +0 -93
  33. package/dist/auth/brokerFactory.d.ts.map +0 -1
  34. package/dist/auth/brokerFactory.js +0 -341
  35. package/dist/auth/brokerFactory.js.map +0 -1
  36. package/dist/auth/browser.d.ts +0 -60
  37. package/dist/auth/browser.d.ts.map +0 -1
  38. package/dist/auth/browser.js +0 -116
  39. package/dist/auth/browser.js.map +0 -1
  40. package/dist/auth/countedProvider.d.ts +0 -43
  41. package/dist/auth/countedProvider.d.ts.map +0 -1
  42. package/dist/auth/countedProvider.js +0 -105
  43. package/dist/auth/countedProvider.js.map +0 -1
  44. package/dist/auth/destinationFailure.d.ts +0 -69
  45. package/dist/auth/destinationFailure.d.ts.map +0 -1
  46. package/dist/auth/destinationFailure.js +0 -183
  47. package/dist/auth/destinationFailure.js.map +0 -1
  48. package/dist/auth/destinationStores.d.ts +0 -55
  49. package/dist/auth/destinationStores.d.ts.map +0 -1
  50. package/dist/auth/destinationStores.js +0 -158
  51. package/dist/auth/destinationStores.js.map +0 -1
  52. package/dist/auth/handlers/basic.d.ts +0 -3
  53. package/dist/auth/handlers/basic.d.ts.map +0 -1
  54. package/dist/auth/handlers/basic.js +0 -8
  55. package/dist/auth/handlers/basic.js.map +0 -1
  56. package/dist/auth/handlers/index.d.ts +0 -15
  57. package/dist/auth/handlers/index.d.ts.map +0 -1
  58. package/dist/auth/handlers/index.js +0 -32
  59. package/dist/auth/handlers/index.js.map +0 -1
  60. package/dist/auth/handlers/jwtAuthorizationCode.d.ts +0 -8
  61. package/dist/auth/handlers/jwtAuthorizationCode.d.ts.map +0 -1
  62. package/dist/auth/handlers/jwtAuthorizationCode.js +0 -32
  63. package/dist/auth/handlers/jwtAuthorizationCode.js.map +0 -1
  64. package/dist/auth/handlers/snc.d.ts +0 -3
  65. package/dist/auth/handlers/snc.d.ts.map +0 -1
  66. package/dist/auth/handlers/snc.js +0 -14
  67. package/dist/auth/handlers/snc.js.map +0 -1
  68. package/dist/auth/handlers/types.d.ts +0 -30
  69. package/dist/auth/handlers/types.d.ts.map +0 -1
  70. package/dist/auth/handlers/types.js +0 -3
  71. package/dist/auth/handlers/types.js.map +0 -1
  72. package/dist/auth/serverLogin.d.ts +0 -75
  73. package/dist/auth/serverLogin.d.ts.map +0 -1
  74. package/dist/auth/serverLogin.js +0 -138
  75. package/dist/auth/serverLogin.js.map +0 -1
  76. package/dist/auth/serverSentences.d.ts +0 -39
  77. package/dist/auth/serverSentences.d.ts.map +0 -1
  78. package/dist/auth/serverSentences.js +0 -49
  79. package/dist/auth/serverSentences.js.map +0 -1
  80. package/dist/auth/vocabulary.d.ts +0 -28
  81. package/dist/auth/vocabulary.d.ts.map +0 -1
  82. package/dist/auth/vocabulary.js +0 -67
  83. package/dist/auth/vocabulary.js.map +0 -1
  84. package/dist/config/coreParameters.d.ts +0 -125
  85. package/dist/config/coreParameters.d.ts.map +0 -1
  86. package/dist/config/coreParameters.js +0 -331
  87. package/dist/config/coreParameters.js.map +0 -1
  88. package/dist/config/envFileContext.d.ts +0 -26
  89. package/dist/config/envFileContext.d.ts.map +0 -1
  90. package/dist/config/envFileContext.js +0 -90
  91. package/dist/config/envFileContext.js.map +0 -1
  92. package/dist/config/envResolver.d.ts +0 -6
  93. package/dist/config/envResolver.d.ts.map +0 -1
  94. package/dist/config/envResolver.js +0 -81
  95. package/dist/config/envResolver.js.map +0 -1
  96. package/dist/config/platformPaths.d.ts +0 -28
  97. package/dist/config/platformPaths.d.ts.map +0 -1
  98. package/dist/config/platformPaths.js +0 -152
  99. package/dist/config/platformPaths.js.map +0 -1
  100. package/dist/destinationSource.d.ts +0 -26
  101. package/dist/destinationSource.d.ts.map +0 -1
  102. package/dist/destinationSource.js +0 -43
  103. package/dist/destinationSource.js.map +0 -1
  104. package/dist/shutdown.d.ts +0 -97
  105. package/dist/shutdown.d.ts.map +0 -1
  106. package/dist/shutdown.js +0 -136
  107. package/dist/shutdown.js.map +0 -1
@@ -1,341 +0,0 @@
1
- "use strict";
2
- /**
3
- * AuthBrokerFactory — one broker per destination, built on first use.
4
- *
5
- * Building a destination's broker decides three things, each before anything
6
- * is built: is what the destination states well formed (`vetMeans`), is
7
- * there a handler for it (`handlerFor`), and then the broker with exactly the
8
- * destination's stores, the options the server states for every destination
9
- * (`renewal`, `onWriteFailure` by store, `authDebug`) and that handler's
10
- * options. A failure reaches the caller as the error it is.
11
- *
12
- * Its providers are handed out counted, behind one gate: `settle` closes the
13
- * gate, disposes the logins it composed, waits for the calls already
14
- * running, then flushes every broker.
15
- *
16
- * The settings are read once per process; the provider is asked of the
17
- * broker on every call, with the caller's signal — the factory keeps no
18
- * provider cache, the broker does.
19
- */
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.AuthBrokerFactory = void 0;
22
- const auth_broker_1 = require("@mcp-abap-adt/auth-broker");
23
- const auth_errors_1 = require("@mcp-abap-adt/auth-errors");
24
- const auth_providers_1 = require("@mcp-abap-adt/auth-providers");
25
- const auth_1 = require("@mcp-abap-adt/lib/auth");
26
- const config_1 = require("@mcp-abap-adt/lib/config");
27
- const platformPaths_1 = require("../config/platformPaths");
28
- const countedProvider_1 = require("./countedProvider");
29
- const destinationStores_1 = require("./destinationStores");
30
- const handlers_1 = require("./handlers");
31
- const serverLogin_1 = require("./serverLogin");
32
- const serverSentences_1 = require("./serverSentences");
33
- const vocabulary_1 = require("./vocabulary");
34
- /** The destination an `--env` file is served as. */
35
- const ENV_FILE_DESTINATION = 'default';
36
- /** An own data property of a foreign value, never a getter; `undefined` otherwise. */
37
- function ownValue(value, key) {
38
- if (value === null || typeof value !== 'object')
39
- return undefined;
40
- try {
41
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
42
- return descriptor && 'value' in descriptor ? descriptor.value : undefined;
43
- }
44
- catch {
45
- return undefined;
46
- }
47
- }
48
- /**
49
- * A rejecting `flush()` as `"<destination>": <reason>` lines. The broker
50
- * rejects with an `AggregateError` of `SessionWriteFailure`s, each carrying
51
- * its destination and its store error classified; every entry — and anything
52
- * else a flush rejects with — is read with auth-errors'
53
- * `classify(entry, 'persisting-tokens')`, never by its message or class.
54
- */
55
- function unstoredLines(destination, error) {
56
- const entries = ownValue(error, 'errors');
57
- const lines = Array.isArray(entries)
58
- ? entries.map((entry) => {
59
- const named = ownValue(entry, 'destination');
60
- const where = typeof named === 'string' ? named : destination;
61
- return `"${where}": ${(0, auth_errors_1.classify)(entry, 'persisting-tokens').reason}`;
62
- })
63
- : [];
64
- return lines.length > 0
65
- ? lines
66
- : [`"${destination}": ${(0, auth_errors_1.classify)(error, 'persisting-tokens').reason}`];
67
- }
68
- /** The broker's diagnostics when the factory was given no logger. */
69
- const SILENT = {
70
- info: () => { },
71
- warn: () => { },
72
- error: () => { },
73
- debug: () => { },
74
- };
75
- const RENEWALS = {
76
- 'refresh-then-login': auth_providers_1.refreshThenLogin,
77
- 'refresh-only': auth_providers_1.refreshOnly,
78
- };
79
- class AuthBrokerFactory {
80
- defaultDestination;
81
- config;
82
- context;
83
- gate = new countedProvider_1.ProviderGate();
84
- /** The shutdown began: no interactive login starts, `aborted` is the shutdown's. */
85
- shutdownBegan = false;
86
- renewal;
87
- /** `--login-timeout`: the bound every composed login runs under. */
88
- bound;
89
- /** The build of each destination, set before its first await. */
90
- built = new Map();
91
- /** One counted wrapper per inner provider the brokers answered. */
92
- counted = new WeakMap();
93
- /** Every login strategy composed, disposed at shutdown. */
94
- logins = new Set();
95
- settings = new Map();
96
- systemContexts = new Map();
97
- constructor(config) {
98
- this.config = config;
99
- this.defaultDestination =
100
- config.mcpDestination ??
101
- (config.envFile ? ENV_FILE_DESTINATION : undefined);
102
- this.renewal = config.renewal ?? 'refresh-then-login';
103
- this.bound =
104
- config.loginTimeoutMs === undefined
105
- ? undefined
106
- : (0, serverLogin_1.loginBound)(config.loginTimeoutMs, config.loginTimeoutStated);
107
- this.context = {
108
- ...(config.browser !== undefined && { browser: config.browser }),
109
- ...(config.browserUnavailable !== undefined && {
110
- browserUnavailable: config.browserUnavailable,
111
- }),
112
- ...(config.browserAuthPort !== undefined && {
113
- browserAuthPort: config.browserAuthPort,
114
- }),
115
- browserStrategy: config.browserStrategy,
116
- login: {
117
- logger: config.promptLogger,
118
- record: (strategy) => {
119
- this.logins.add(strategy);
120
- },
121
- shuttingDown: () => this.shutdownBegan || this.gate.closed,
122
- ...(this.bound !== undefined && { bound: this.bound }),
123
- },
124
- };
125
- }
126
- /**
127
- * The server's own sentence for a chain failure, keyed on its
128
- * `kind` and this factory's state: the renewal it was started with, and
129
- * whether the shutdown closed its gate.
130
- */
131
- sentenceFor(error) {
132
- return (0, serverSentences_1.serverSentence)(error, this.state());
133
- }
134
- /** The server's own state a sentence is keyed on. */
135
- state() {
136
- return {
137
- renewal: this.renewal,
138
- shuttingDown: this.shutdownBegan || this.gate.closed,
139
- ...(this.bound !== undefined && { loginBound: this.bound }),
140
- };
141
- }
142
- /**
143
- * The destination's broker. A consumer that connects must use
144
- * `getProvider` instead: the broker's own provider is not counted and
145
- * bypasses the shutdown gate that `settle` closes.
146
- */
147
- async getBroker(destination) {
148
- return (await this.buildOf(destination)).broker;
149
- }
150
- /**
151
- * The destination's settings, read once per process like its provider:
152
- * a change to the files applies on restart. A failed read is dropped, so
153
- * fixing the file lets the next call answer.
154
- */
155
- settingsFor(destination) {
156
- const cached = this.settings.get(destination);
157
- if (cached)
158
- return cached;
159
- const settings = this.readSettings(destination);
160
- this.settings.set(destination, settings);
161
- settings.catch(() => {
162
- if (this.settings.get(destination) === settings) {
163
- this.settings.delete(destination);
164
- }
165
- });
166
- return settings;
167
- }
168
- /** The message-server fields the server was started with, each only when set. */
169
- messageServer() {
170
- const out = {};
171
- for (const field of config_1.MESSAGE_SERVER_FIELDS) {
172
- const value = this.config[field];
173
- if (value !== undefined)
174
- out[field] = value;
175
- }
176
- return out;
177
- }
178
- async readSettings(destination) {
179
- const { broker, handler, vetted, stores } = await this.buildOf(destination);
180
- const means = await broker.getConnectionConfig(destination);
181
- // An XSUAA destination's URL is XSUAA_MCP_URL alone, never the key's url.
182
- const url = (await stores.urlStore.getConnectionConfig(destination))
183
- ?.serviceUrl;
184
- if (!url) {
185
- throw new auth_broker_1.DestinationConfigError(destination, [stores.urlKey], 'the destination states no system URL');
186
- }
187
- const settings = {
188
- url,
189
- ...(means?.sapClient ? { client: means.sapClient } : {}),
190
- authType: vetted.authType,
191
- ...(this.config.connectionType
192
- ? { connectionType: this.config.connectionType }
193
- : {}),
194
- // RFC through a message server: as configured, an absent field no key.
195
- ...this.messageServer(),
196
- };
197
- try {
198
- handler.checkSettings?.(settings, this.context);
199
- }
200
- catch (error) {
201
- if (error instanceof auth_1.SettingsError) {
202
- throw new auth_broker_1.DestinationConfigError(destination, [error.setting], 'its authentication cannot use these settings');
203
- }
204
- throw error;
205
- }
206
- return settings;
207
- }
208
- /**
209
- * The responsible, the login and the master system the destination's own
210
- * `.env` states, read once per process like its settings. The process environment is not
211
- * read here: it is the server's fallback, after the destination.
212
- */
213
- systemContextFor(destination) {
214
- const cached = this.systemContexts.get(destination);
215
- if (cached)
216
- return cached;
217
- const context = (async () => (0, destinationStores_1.readDestinationSystemContext)((await this.buildOf(destination)).stores.destinationFile))();
218
- this.systemContexts.set(destination, context);
219
- context.catch(() => {
220
- if (this.systemContexts.get(destination) === context) {
221
- this.systemContexts.delete(destination);
222
- }
223
- });
224
- return context;
225
- }
226
- /**
227
- * The destination's provider, asked of its broker on every call with the
228
- * caller's `signal` (the broker answers its cached provider while the
229
- * destination is unchanged), handed out counted: one wrapper per inner
230
- * provider, so the same inner answers the same wrapper.
231
- */
232
- async getProvider(destination, options = {}) {
233
- const broker = await this.getBroker(destination);
234
- const inner = await broker.getProvider(destination, {
235
- signal: options.signal,
236
- });
237
- const known = this.counted.get(inner);
238
- if (known)
239
- return known;
240
- const wrapper = (0, countedProvider_1.countedProvider)(inner, this.gate);
241
- this.counted.set(inner, wrapper);
242
- return wrapper;
243
- }
244
- beginShutdown() {
245
- this.shutdownBegan = true;
246
- }
247
- /**
248
- * Every login composed ends (`disposed`): its listener is released, and a
249
- * call waiting on it answers. A shutdown before the transport opened calls
250
- * it beside its logoffs: the start's own login ends with it.
251
- */
252
- async endLogins() {
253
- await Promise.allSettled([...this.logins].map((login) => login.dispose?.()));
254
- }
255
- async settle(options = {}) {
256
- this.shutdownBegan = true;
257
- // Closed first, before any await: a 401 answered from here on gets the
258
- // shutdown refusal instead of a renewal that would land after the flush.
259
- this.gate.close();
260
- await this.endLogins();
261
- // No deadline: the shutdown's forced close is the one escape.
262
- await this.gate.drained(options.signal);
263
- const builds = await Promise.allSettled([...this.built.entries()].map(async ([destination, build]) => ({
264
- destination,
265
- built: await build,
266
- })));
267
- const notStored = [];
268
- await Promise.all(builds.map(async (outcome) => {
269
- if (outcome.status !== 'fulfilled')
270
- return;
271
- const { destination, built } = outcome.value;
272
- try {
273
- await built.broker.flush({ signal: options.signal });
274
- }
275
- catch (error) {
276
- notStored.push(...unstoredLines(destination, error));
277
- }
278
- }));
279
- return { notStored };
280
- }
281
- /** The build of a destination, cached as a promise; a failed one is dropped. */
282
- buildOf(destination) {
283
- try {
284
- // Before any file is touched: the name is joined into keysDir/sessionsDir.
285
- (0, auth_1.assertDestinationName)(destination, 'destination');
286
- }
287
- catch (error) {
288
- return Promise.reject(error);
289
- }
290
- const cached = this.built.get(destination);
291
- if (cached)
292
- return cached;
293
- const build = this.build(destination);
294
- this.built.set(destination, build);
295
- build.catch(() => {
296
- if (this.built.get(destination) === build) {
297
- this.built.delete(destination);
298
- }
299
- });
300
- return build;
301
- }
302
- async build(destination) {
303
- const mode = this.modeOf(destination);
304
- const stores = (0, destinationStores_1.storesFor)(mode, this.config.logger);
305
- // The failed write under 'continue' reaches stderr whatever
306
- // DEBUG_AUTH_LOG says; the rest stays the gated diagnostics.
307
- const logger = (0, serverLogin_1.brokerLogger)((line) => this.config.promptLogger.info(line), this.config.logger ?? SILENT);
308
- const means = await stores.serviceKeyStore.getConnectionConfig(destination);
309
- const vetted = (0, vocabulary_1.vetMeans)(destination, means);
310
- const handler = (0, handlers_1.handlerFor)(destination, vetted);
311
- const renewal = RENEWALS[this.renewal];
312
- const broker = new auth_broker_1.AuthBroker({
313
- serviceKeyStore: stores.serviceKeyStore,
314
- sessionStore: stores.sessionStore,
315
- // Every token row renews this way; basic, snc and none ignore it.
316
- renewal: () => renewal(),
317
- // The user's own --env file must see a write that did not land;
318
- // a named destination (in memory, or sessions/ under --unsafe) goes on.
319
- onWriteFailure: mode.kind === 'envFile' ? 'fail' : 'continue',
320
- // On from --auth-debug only, never from the environment.
321
- authDebug: this.config.authDebug === true,
322
- ...handler.brokerOptions(this.context),
323
- }, logger);
324
- return { broker, handler, vetted, stores };
325
- }
326
- modeOf(destination) {
327
- const { envFile } = this.config;
328
- if (envFile && destination === ENV_FILE_DESTINATION) {
329
- return { kind: 'envFile', path: envFile.path, source: envFile.source };
330
- }
331
- return {
332
- kind: 'named',
333
- name: destination,
334
- keysDir: (0, platformPaths_1.getPlatformPaths)(this.config.authBrokerPath, 'service-keys')[0],
335
- sessionsDir: (0, platformPaths_1.getPlatformPaths)(this.config.authBrokerPath, 'sessions')[0],
336
- unsafe: this.config.unsafe,
337
- };
338
- }
339
- }
340
- exports.AuthBrokerFactory = AuthBrokerFactory;
341
- //# sourceMappingURL=brokerFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"brokerFactory.js","sourceRoot":"","sources":["../../src/auth/brokerFactory.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,2DAImC;AACnC,2DAAqD;AACrD,iEAA6E;AAS7E,iDAIgC;AAChC,qDAGkC;AAClC,2DAA2D;AAC3D,uDAAkE;AAClE,2DAK6B;AAC7B,yCAIoB;AAGpB,+CAA0E;AAC1E,uDAI2B;AAC3B,6CAAmE;AAEnE,oDAAoD;AACpD,MAAM,oBAAoB,GAAG,SAAS,CAAC;AASvC,sFAAsF;AACtF,SAAS,QAAQ,CAAC,KAAc,EAAE,GAAW;IAC3C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAClE,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC/D,OAAO,UAAU,IAAI,OAA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, `--browser-program`), mapped by the
3
- * platform to one of auth-providers' six shipped browsers.
4
- *
5
- * `browserFor` is a pure function: it answers which factory and which
6
- * argument, and constructs nothing — so the table is tested cell by cell
7
- * without a browser. `browserOf` builds the one it answered. A word outside
8
- * the table, or `--browser-program` beside `--browser`, is refused at start on
9
- * every platform. A browser on a platform with none is *unavailable*: only a
10
- * destination that logs in (`jwt` / `authorization_code`) is refused for it,
11
- * at the startup check.
12
- */
13
- import type { IBrowser } from '@mcp-abap-adt/interfaces-auth';
14
- /** The `--browser` words, in the order the help lists them. */
15
- export declare const BROWSER_NAMES: readonly ["system", "auto", "chrome", "edge", "firefox", "none", "headless"];
16
- export type BrowserName = (typeof BROWSER_NAMES)[number];
17
- /** What the user chose: `--browser`, or `--browser-program`, never both. */
18
- export interface BrowserChoice {
19
- readonly browser?: string | undefined;
20
- readonly program?: string | undefined;
21
- }
22
- /**
23
- * Which shipped factory and its argument. No factory: no browser — the URL
24
- * is shown on stderr and the login waits for the callback. `unavailable`:
25
- * the browser named has none on this platform; the words say what to do.
26
- */
27
- export type BrowserMapping = {
28
- readonly factory: () => IBrowser;
29
- readonly argument?: undefined;
30
- readonly unavailable?: undefined;
31
- } | {
32
- readonly factory: (argument: string) => IBrowser;
33
- readonly argument: string;
34
- readonly unavailable?: undefined;
35
- } | {
36
- readonly factory?: undefined;
37
- readonly argument?: undefined;
38
- readonly unavailable?: undefined;
39
- } | {
40
- readonly factory?: undefined;
41
- readonly unavailable: string;
42
- };
43
- /** A choice that cannot be served; its words name parameters only. */
44
- export declare class BrowserChoiceError extends Error {
45
- /** The refusal's words: parameter names only, safe to print. */
46
- readonly words: string;
47
- constructor(words: string);
48
- }
49
- /**
50
- * The factory and argument for `choice` on `platform` (`process.platform`).
51
- * Throws `BrowserChoiceError` for a name outside the table and for
52
- * `--browser-program` beside `--browser`, on every platform. A browser on a
53
- * platform with none answers `{ unavailable }`; `--browser-program` there runs
54
- * the program as `linuxBrowser` does — a plain spawn of it. No `--browser`:
55
- * `system`.
56
- */
57
- export declare function browserFor(choice: BrowserChoice, platform: string): BrowserMapping;
58
- /** The browser a mapping names, built; `undefined` for no browser or an unavailable one. */
59
- export declare function browserOf(mapping: BrowserMapping): IBrowser | undefined;
60
- //# sourceMappingURL=browser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/auth/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D,+DAA+D;AAC/D,eAAO,MAAM,aAAa,8EAQhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB;IACE,QAAQ,CAAC,OAAO,EAAE,MAAM,QAAQ,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC;CAClC,GACD;IACE,QAAQ,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,QAAQ,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC;CAClC,GACD;IACE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC;CAClC,GACD;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,sEAAsE;AACtE,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAEX,KAAK,EAAE,MAAM;CAK1B;AAmDD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,GACf,cAAc,CAqBhB;AAED,4FAA4F;AAC5F,wBAAgB,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,QAAQ,GAAG,SAAS,CAMvE"}
@@ -1,116 +0,0 @@
1
- "use strict";
2
- /**
3
- * The browser of a login (`--browser`, `--browser-program`), mapped by the
4
- * platform to one of auth-providers' six shipped browsers.
5
- *
6
- * `browserFor` is a pure function: it answers which factory and which
7
- * argument, and constructs nothing — so the table is tested cell by cell
8
- * without a browser. `browserOf` builds the one it answered. A word outside
9
- * the table, or `--browser-program` beside `--browser`, is refused at start on
10
- * every platform. A browser on a platform with none is *unavailable*: only a
11
- * destination that logs in (`jwt` / `authorization_code`) is refused for it,
12
- * at the startup check.
13
- */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.BrowserChoiceError = exports.BROWSER_NAMES = void 0;
16
- exports.browserFor = browserFor;
17
- exports.browserOf = browserOf;
18
- const auth_providers_1 = require("@mcp-abap-adt/auth-providers");
19
- /** The `--browser` words, in the order the help lists them. */
20
- exports.BROWSER_NAMES = [
21
- 'system',
22
- 'auto',
23
- 'chrome',
24
- 'edge',
25
- 'firefox',
26
- 'none',
27
- 'headless',
28
- ];
29
- /** A choice that cannot be served; its words name parameters only. */
30
- class BrowserChoiceError extends Error {
31
- /** The refusal's words: parameter names only, safe to print. */
32
- words;
33
- constructor(words) {
34
- super(words);
35
- this.name = 'BrowserChoiceError';
36
- this.words = words;
37
- }
38
- }
39
- exports.BrowserChoiceError = BrowserChoiceError;
40
- const DEFAULT = {
41
- linux: auth_providers_1.linuxDefaultBrowser,
42
- darwin: auth_providers_1.macDefaultBrowser,
43
- win32: auth_providers_1.windowsDefaultBrowser,
44
- };
45
- const NAMED = {
46
- linux: auth_providers_1.linuxBrowser,
47
- darwin: auth_providers_1.macBrowser,
48
- win32: auth_providers_1.windowsBrowser,
49
- };
50
- /** Each named browser's program, per platform (auth-providers' README). */
51
- const PROGRAMS = {
52
- chrome: {
53
- linux: 'google-chrome',
54
- darwin: 'Google Chrome',
55
- win32: 'chrome',
56
- },
57
- edge: {
58
- linux: 'microsoft-edge',
59
- darwin: 'Microsoft Edge',
60
- win32: 'msedge',
61
- },
62
- firefox: { linux: 'firefox', darwin: 'Firefox', win32: 'firefox' },
63
- };
64
- const NO_BROWSER = Object.freeze({});
65
- function isBrowserName(word) {
66
- return exports.BROWSER_NAMES.includes(word);
67
- }
68
- function knownPlatform(platform) {
69
- return platform === 'linux' || platform === 'darwin' || platform === 'win32'
70
- ? platform
71
- : undefined;
72
- }
73
- function noBrowserOnThisPlatform(platform) {
74
- return {
75
- unavailable: `No browser is known on this platform (${platform}): use --browser=none, and open the URL the login prints on stderr, or --browser-program=<program>`,
76
- };
77
- }
78
- /**
79
- * The factory and argument for `choice` on `platform` (`process.platform`).
80
- * Throws `BrowserChoiceError` for a name outside the table and for
81
- * `--browser-program` beside `--browser`, on every platform. A browser on a
82
- * platform with none answers `{ unavailable }`; `--browser-program` there runs
83
- * the program as `linuxBrowser` does — a plain spawn of it. No `--browser`:
84
- * `system`.
85
- */
86
- function browserFor(choice, platform) {
87
- const { browser, program } = choice;
88
- if (program !== undefined && browser !== undefined) {
89
- throw new BrowserChoiceError('--browser-program excludes --browser: give one of them');
90
- }
91
- const known = knownPlatform(platform);
92
- if (program !== undefined) {
93
- return { factory: NAMED[known ?? 'linux'], argument: program };
94
- }
95
- const word = (browser ?? 'system').trim().toLowerCase();
96
- if (!isBrowserName(word)) {
97
- throw new BrowserChoiceError(`--browser must be one of ${exports.BROWSER_NAMES.join(', ')}: use --browser=none to open the URL yourself, or --browser-program=<program>`);
98
- }
99
- if (word === 'none' || word === 'headless')
100
- return NO_BROWSER;
101
- if (!known)
102
- return noBrowserOnThisPlatform(platform);
103
- if (word === 'system' || word === 'auto')
104
- return { factory: DEFAULT[known] };
105
- return { factory: NAMED[known], argument: PROGRAMS[word][known] };
106
- }
107
- /** The browser a mapping names, built; `undefined` for no browser or an unavailable one. */
108
- function browserOf(mapping) {
109
- if (!mapping.factory)
110
- return undefined;
111
- if (mapping.argument === undefined) {
112
- return mapping.factory();
113
- }
114
- return mapping.factory(mapping.argument);
115
- }
116
- //# sourceMappingURL=browser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/auth/browser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AA2HH,gCAwBC;AAGD,8BAMC;AA1JD,iEAOsC;AAGtC,+DAA+D;AAClD,QAAA,aAAa,GAAG;IAC3B,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;IACN,SAAS;IACT,MAAM;IACN,UAAU;CACF,CAAC;AAiCX,sEAAsE;AACtE,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,gEAAgE;IACvD,KAAK,CAAS;IAEvB,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AATD,gDASC;AAID,MAAM,OAAO,GAA+C;IAC1D,KAAK,EAAE,oCAAmB;IAC1B,MAAM,EAAE,kCAAiB;IACzB,KAAK,EAAE,sCAAqB;CAC7B,CAAC;AAEF,MAAM,KAAK,GAA+D;IACxE,KAAK,EAAE,6BAAY;IACnB,MAAM,EAAE,2BAAU;IAClB,KAAK,EAAE,+BAAc;CACtB,CAAC;AAEF,2EAA2E;AAC3E,MAAM,QAAQ,GAEV;IACF,MAA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AM,IAAI,GAAG,CAAC,OAAO,IAAI,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACxD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,kBAAkB,CAC1B,4BAA4B,qBAAa,CAAC,IAAI,CAAC,IAAI,CAAC,+EAA+E,CACpI,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,UAAU;QAAE,OAAO,UAAU,CAAC;IAC9D,IAAI,CAAC,KAAK;QAAE,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;IAC7E,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;AACpE,CAAC;AAED,4FAA4F;AAC5F,SAAgB,SAAS,CAAC,OAAuB;IAC/C,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IACvC,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnC,OAAQ,OAAO,CAAC,OAA0B,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC"}
@@ -1,43 +0,0 @@
1
- /**
2
- * Work in progress, counted at the provider.
3
- *
4
- * `countedProvider` forwards each of the four `IAuthProvider` calls unchanged
5
- * and counts the ones not yet answered. A renewal happens inside one of those
6
- * calls and its `onTokens` write is submitted before the call answers
7
- * (broker 4), so once the count is zero every renewal has reached the
8
- * broker's writer and `flush()` covers it.
9
- *
10
- * Behind a closed gate no call starts: each answers the shutdown refusal
11
- * (`interactive-login` `aborted`, minted) at once, without reaching the inner provider — Oops, never a throw. A call
12
- * admitted before the gate closed runs to its answer and is waited for.
13
- * Nothing opens the gate again.
14
- */
15
- import type { AuthOutcome, IAuthProvider } from '@mcp-abap-adt/interfaces-auth';
16
- /**
17
- * The closed gate's answer: auth-errors' `interactive-login` `aborted`,
18
- * minted — the server's shutdown sentence goes beside it (`serverSentence`),
19
- * never into the refusal.
20
- */
21
- export declare const SHUTDOWN_REFUSAL: AuthOutcome;
22
- export declare class ProviderGate {
23
- private isClosed;
24
- private count;
25
- private waiters;
26
- /** Closes the gate for good: no provider call starts after this. */
27
- close(): void;
28
- get closed(): boolean;
29
- /** Provider calls admitted and not yet answered. */
30
- get inFlight(): number;
31
- /** @internal Admits one call; `false` behind a closed gate. */
32
- enter(): boolean;
33
- /** @internal One admitted call answered (or threw). */
34
- leave(): void;
35
- /**
36
- * Resolves when no call is in flight — no deadline, no timer: a
37
- * shutdown's forced close is what ends this waiting early, and it does not
38
- * await it. `signal` (the shutdown's) releases this wait when it aborts.
39
- */
40
- drained(signal?: AbortSignal): Promise<void>;
41
- }
42
- export declare function countedProvider(inner: IAuthProvider, gate: ProviderGate): IAuthProvider;
43
- //# sourceMappingURL=countedProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"countedProvider.d.ts","sourceRoot":"","sources":["../../src/auth/countedProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EAId,MAAM,+BAA+B,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAG7B,CAAC;AAEH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,OAAO,CAAyB;IAExC,oEAAoE;IACpE,KAAK,IAAI,IAAI;IAIb,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,oDAAoD;IACpD,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,+DAA+D;IAC/D,KAAK,IAAI,OAAO;IAMhB,uDAAuD;IACvD,KAAK,IAAI,IAAI;IASb;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAe7C;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,YAAY,GACjB,aAAa,CAsBf"}