@dereekb/dbx-cli 14.2.0 → 14.3.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/eslint/package.json +3 -3
- package/firebase-api-manifest/main.js +3 -3
- package/firebase-api-manifest/package.json +3 -3
- package/firestore-indexes/src/model-firebase-index-schema.d.ts +4 -4
- package/firestore-query-manifest/main.js +3 -3
- package/firestore-query-manifest/package.json +3 -3
- package/generate-firestore-indexes/main.js +2 -2
- package/generate-firestore-indexes/package.json +2 -2
- package/generate-mcp-manifest/package.json +3 -3
- package/generate-route-manifest/package.json +2 -2
- package/index.esm.js +976 -247
- package/lint-cache/package.json +2 -2
- package/manifest-extract/package.json +8 -8
- package/model-test/package.json +2 -2
- package/package.json +6 -6
- package/route/package.json +7 -7
- package/src/lib/auth/index.d.ts +1 -0
- package/src/lib/auth/oidc.loopback.d.ts +127 -0
- package/src/lib/config/env.d.ts +43 -7
- package/src/lib/config/env.resolve.d.ts +4 -3
- package/src/lib/util/browser.d.ts +23 -0
- package/src/lib/util/index.d.ts +1 -0
- package/src/lib/util/interactive.d.ts +10 -1
- package/test/package.json +9 -9
- package/validate/package.json +3 -3
package/lint-cache/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli-lint-cache",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"private": true,
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"eslint": "10.9.1"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@dereekb/util": "14.
|
|
12
|
+
"@dereekb/util": "14.3.0",
|
|
13
13
|
"yargs": "^18.0.0"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli/manifest-extract",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@dereekb/date": "14.
|
|
8
|
-
"@dereekb/dbx-cli": "14.
|
|
9
|
-
"@dereekb/firebase": "14.
|
|
10
|
-
"@dereekb/model": "14.
|
|
11
|
-
"@dereekb/nestjs": "14.
|
|
12
|
-
"@dereekb/rxjs": "14.
|
|
13
|
-
"@dereekb/util": "14.
|
|
7
|
+
"@dereekb/date": "14.3.0",
|
|
8
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
9
|
+
"@dereekb/firebase": "14.3.0",
|
|
10
|
+
"@dereekb/model": "14.3.0",
|
|
11
|
+
"@dereekb/nestjs": "14.3.0",
|
|
12
|
+
"@dereekb/rxjs": "14.3.0",
|
|
13
|
+
"@dereekb/util": "14.3.0",
|
|
14
14
|
"ts-morph": "^28.0.0"
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|
package/model-test/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli/model-test",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@dereekb/util": "14.
|
|
7
|
+
"@dereekb/util": "14.3.0",
|
|
8
8
|
"ts-morph": "^28.0.0"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"bin": {
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@dereekb/date": "14.
|
|
70
|
-
"@dereekb/firebase": "14.
|
|
71
|
-
"@dereekb/model": "14.
|
|
72
|
-
"@dereekb/nestjs": "14.
|
|
73
|
-
"@dereekb/util": "14.
|
|
69
|
+
"@dereekb/date": "14.3.0",
|
|
70
|
+
"@dereekb/firebase": "14.3.0",
|
|
71
|
+
"@dereekb/model": "14.3.0",
|
|
72
|
+
"@dereekb/nestjs": "14.3.0",
|
|
73
|
+
"@dereekb/util": "14.3.0",
|
|
74
74
|
"@nestjs/common": "^12.0.1",
|
|
75
75
|
"arktype": "^2.2.0",
|
|
76
76
|
"firebase": "^12.18.0",
|
package/route/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli/route",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@dereekb/date": "14.
|
|
8
|
-
"@dereekb/dbx-cli": "14.
|
|
9
|
-
"@dereekb/firebase": "14.
|
|
10
|
-
"@dereekb/model": "14.
|
|
11
|
-
"@dereekb/nestjs": "14.
|
|
12
|
-
"@dereekb/util": "14.
|
|
7
|
+
"@dereekb/date": "14.3.0",
|
|
8
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
9
|
+
"@dereekb/firebase": "14.3.0",
|
|
10
|
+
"@dereekb/model": "14.3.0",
|
|
11
|
+
"@dereekb/nestjs": "14.3.0",
|
|
12
|
+
"@dereekb/util": "14.3.0"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
"./package.json": "./package.json",
|
package/src/lib/auth/index.d.ts
CHANGED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type Maybe, type PortNumber, type WebsiteUrl } from '@dereekb/util';
|
|
2
|
+
/**
|
|
3
|
+
* Hostnames RFC 8252 §7.3 treats as the loopback interface, and the exact set `oidc-provider`
|
|
4
|
+
* recognizes as a loopback redirect host.
|
|
5
|
+
*
|
|
6
|
+
* `[::1]` carries its brackets because that is what `URL.hostname` returns for an IPv6 literal —
|
|
7
|
+
* the brackets are stripped again before the address is handed to `server.listen`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const LOOPBACK_REDIRECT_HOSTNAMES: readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
* The loopback port the CLI suggests when the configured redirect URI has no bindable port.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately outside the 9900-9910 block the Firebase emulators occupy, so a suggested redirect
|
|
14
|
+
* URI never collides with a running emulator.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SUGGESTED_CLI_LOOPBACK_REDIRECT_PORT: PortNumber;
|
|
17
|
+
/**
|
|
18
|
+
* Error code raised when the loopback listener cannot bind the redirect URI's port (e.g. the port
|
|
19
|
+
* is already in use, or is privileged).
|
|
20
|
+
*/
|
|
21
|
+
export declare const LOOPBACK_REDIRECT_LISTEN_FAILED_ERROR_CODE = "AUTH_REDIRECT_LISTEN_FAILED";
|
|
22
|
+
/**
|
|
23
|
+
* Error code raised when no redirect reached the loopback listener within the allotted time.
|
|
24
|
+
*/
|
|
25
|
+
export declare const LOOPBACK_REDIRECT_TIMEOUT_ERROR_CODE = "AUTH_REDIRECT_TIMEOUT";
|
|
26
|
+
/**
|
|
27
|
+
* A redirect URI the CLI can bind a local HTTP listener to, decomposed into its parts.
|
|
28
|
+
*/
|
|
29
|
+
export interface LoopbackRedirectTarget {
|
|
30
|
+
/**
|
|
31
|
+
* The normalized redirect URI to send as `redirect_uri`. Identical to the configured URI unless a
|
|
32
|
+
* port override was applied.
|
|
33
|
+
*/
|
|
34
|
+
readonly redirectUri: WebsiteUrl;
|
|
35
|
+
/**
|
|
36
|
+
* The loopback hostname, as `URL.hostname` reports it (so `[::1]` keeps its brackets).
|
|
37
|
+
*/
|
|
38
|
+
readonly hostname: string;
|
|
39
|
+
/**
|
|
40
|
+
* The port to bind. Always a positive integer — a `0`/absent port is not a capturable target.
|
|
41
|
+
*/
|
|
42
|
+
readonly port: PortNumber;
|
|
43
|
+
/**
|
|
44
|
+
* The path the provider redirects to. Requests to any other path are answered `404` so a stray
|
|
45
|
+
* `/favicon.ico` cannot be mistaken for the authorization redirect.
|
|
46
|
+
*/
|
|
47
|
+
readonly pathname: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ParseLoopbackRedirectUriInput {
|
|
50
|
+
/**
|
|
51
|
+
* The configured redirect URI.
|
|
52
|
+
*/
|
|
53
|
+
readonly redirectUri: Maybe<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Optional port override, replacing whatever port the redirect URI carries.
|
|
56
|
+
*
|
|
57
|
+
* The resulting URI is what gets sent as `redirect_uri`, so it must be registered with the OAuth
|
|
58
|
+
* client just like the configured one.
|
|
59
|
+
*/
|
|
60
|
+
readonly port?: Maybe<PortNumber>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Decomposes a redirect URI into a {@link LoopbackRedirectTarget} when the CLI can bind a local
|
|
64
|
+
* listener for it.
|
|
65
|
+
*
|
|
66
|
+
* A target is only produced for an `http:` loopback URI carrying a concrete, non-zero port. The
|
|
67
|
+
* conventional `http://127.0.0.1:0/callback` placeholder is deliberately NOT capturable: binding an
|
|
68
|
+
* ephemeral port would mean sending a `redirect_uri` that differs from the registered one, which
|
|
69
|
+
* every OAuth provider rejects unless the client is registered as a native app (where loopback
|
|
70
|
+
* ports are compared port-insensitively).
|
|
71
|
+
*
|
|
72
|
+
* @param input - The parse inputs.
|
|
73
|
+
* @param input.redirectUri - The configured redirect URI.
|
|
74
|
+
* @param input.port - Optional port override applied to the parsed URI.
|
|
75
|
+
* @returns The bindable target, or `undefined` when the URI cannot be captured locally.
|
|
76
|
+
* @__NO_SIDE_EFFECTS__
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseLoopbackRedirectUri(input: ParseLoopbackRedirectUriInput): Maybe<LoopbackRedirectTarget>;
|
|
79
|
+
export interface StartLoopbackRedirectCaptureInput {
|
|
80
|
+
/**
|
|
81
|
+
* The bindable target, from {@link parseLoopbackRedirectUri}.
|
|
82
|
+
*/
|
|
83
|
+
readonly target: LoopbackRedirectTarget;
|
|
84
|
+
/**
|
|
85
|
+
* Text shown in the browser tab once the redirect is captured.
|
|
86
|
+
*/
|
|
87
|
+
readonly successMessage?: Maybe<string>;
|
|
88
|
+
}
|
|
89
|
+
export interface LoopbackRedirectCapture {
|
|
90
|
+
/**
|
|
91
|
+
* The `redirect_uri` the listener is bound to. Send this value in the authorization request.
|
|
92
|
+
*/
|
|
93
|
+
readonly redirectUri: WebsiteUrl;
|
|
94
|
+
/**
|
|
95
|
+
* The bound port.
|
|
96
|
+
*/
|
|
97
|
+
readonly port: PortNumber;
|
|
98
|
+
/**
|
|
99
|
+
* Resolves with the full redirect URL (query string included) the browser was sent to.
|
|
100
|
+
*
|
|
101
|
+
* A provider error redirect resolves rather than rejects — the returned URL carries the `error`
|
|
102
|
+
* params, which the shared redirect parser already turns into an `AUTH_PROVIDER_ERROR`.
|
|
103
|
+
*
|
|
104
|
+
* @param timeoutMs - Optional milliseconds to wait before rejecting with
|
|
105
|
+
* {@link LOOPBACK_REDIRECT_TIMEOUT_ERROR_CODE}. Waits indefinitely when omitted.
|
|
106
|
+
*/
|
|
107
|
+
readonly waitForRedirect: (timeoutMs?: Maybe<number>) => Promise<WebsiteUrl>;
|
|
108
|
+
/**
|
|
109
|
+
* Closes the listener and destroys any open sockets, so the CLI's event loop can drain.
|
|
110
|
+
*/
|
|
111
|
+
readonly close: () => Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Binds a local HTTP listener to a loopback redirect URI so the authorization code can be read
|
|
115
|
+
* straight out of the browser redirect instead of being pasted back by hand.
|
|
116
|
+
*
|
|
117
|
+
* The listener answers exactly one path — the redirect URI's own — and serves a short "you can close
|
|
118
|
+
* this tab" page. Everything else is answered `404`, which is what keeps the browser's automatic
|
|
119
|
+
* `/favicon.ico` request from being mistaken for the redirect.
|
|
120
|
+
*
|
|
121
|
+
* @param input - The capture inputs.
|
|
122
|
+
* @param input.target - The bindable target, from {@link parseLoopbackRedirectUri}.
|
|
123
|
+
* @param input.successMessage - Optional override for the browser success page's body line.
|
|
124
|
+
* @returns The started {@link LoopbackRedirectCapture}.
|
|
125
|
+
* @throws {CliError} `AUTH_REDIRECT_LISTEN_FAILED` when the port cannot be bound.
|
|
126
|
+
*/
|
|
127
|
+
export declare function startLoopbackRedirectCapture(input: StartLoopbackRedirectCaptureInput): Promise<LoopbackRedirectCapture>;
|
package/src/lib/config/env.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Maybe } from '@dereekb/util';
|
|
1
|
+
import { type Maybe, type OidcClientAuthMethod } from '@dereekb/util';
|
|
2
2
|
import { type CliTokenEntry } from './token.cache';
|
|
3
3
|
/**
|
|
4
4
|
* The default OAuth/OIDC scopes requested by the CLI when none are configured.
|
|
@@ -15,7 +15,12 @@ export declare const MODEL_WRITE_OIDC_SCOPES: readonly ["model.create", "model.u
|
|
|
15
15
|
/**
|
|
16
16
|
* The default redirect URI used by the CLI.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* The `0` port is a placeholder, not a bindable port: the redirect resolves to nothing in the
|
|
19
|
+
* browser and the user copy/pastes the resulting URL back into the CLI.
|
|
20
|
+
*
|
|
21
|
+
* To have `auth login` capture the redirect automatically instead, configure a redirect URI with a
|
|
22
|
+
* concrete loopback port (e.g. `http://127.0.0.1:8976/callback`) and register that exact URI with
|
|
23
|
+
* the OAuth client — `auth login` binds it and reads the code straight out of the browser redirect.
|
|
19
24
|
*/
|
|
20
25
|
export declare const DEFAULT_CLI_REDIRECT_URI = "http://127.0.0.1:0/callback";
|
|
21
26
|
/**
|
|
@@ -193,6 +198,14 @@ export declare function isCliFirebaseConfigComplete(firebase: Maybe<CliFirebaseC
|
|
|
193
198
|
* @returns `true` when emulators are configured and not explicitly disabled.
|
|
194
199
|
*/
|
|
195
200
|
export declare function cliFirebaseEmulatorsInUse(firebase: Maybe<CliFirebaseConfig>): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* The OAuth client's registered `token_endpoint_auth_method`, as far as the CLI needs to model it.
|
|
203
|
+
*
|
|
204
|
+
* Wider than {@link OidcClientAuthMethod} by exactly one member: `'none'`, the public-client case.
|
|
205
|
+
* That value is meaningless to the protocol layer — a public client sends no credential, so there is
|
|
206
|
+
* no presentation to choose — but it is precisely what the CLI needs in order to stop asking for one.
|
|
207
|
+
*/
|
|
208
|
+
export type OidcCliTokenEndpointAuthMethod = OidcClientAuthMethod | 'none';
|
|
196
209
|
/**
|
|
197
210
|
* Environment-targeting config for a CLI invocation.
|
|
198
211
|
*
|
|
@@ -231,12 +244,30 @@ export interface CliEnvConfig {
|
|
|
231
244
|
readonly clientId?: string;
|
|
232
245
|
/**
|
|
233
246
|
* The OAuth client secret registered with the target app.
|
|
247
|
+
*
|
|
248
|
+
* Absent for a public client — see {@link tokenEndpointAuthMethod}.
|
|
234
249
|
*/
|
|
235
250
|
readonly clientSecret?: string;
|
|
236
251
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
252
|
+
* How the client authenticates at the token endpoint, mirroring the OAuth client's registered
|
|
253
|
+
* `token_endpoint_auth_method`.
|
|
254
|
+
*
|
|
255
|
+
* `'none'` marks a PUBLIC client: it holds no secret and proves itself with PKCE instead. Recording
|
|
256
|
+
* it lets `auth setup` skip the client-secret prompt outright rather than asking for a credential
|
|
257
|
+
* that must not exist — the prompt cannot infer this, since "no secret yet" and "never a secret"
|
|
258
|
+
* look identical from an empty config.
|
|
259
|
+
*
|
|
260
|
+
* Omit to leave it unknown, which keeps the existing prompt-and-accept-empty behaviour.
|
|
261
|
+
*/
|
|
262
|
+
readonly tokenEndpointAuthMethod?: OidcCliTokenEndpointAuthMethod;
|
|
263
|
+
/**
|
|
264
|
+
* The redirect URI registered with the OAuth client.
|
|
265
|
+
*
|
|
266
|
+
* When this is an `http:` loopback URI with a concrete, non-zero port (e.g.
|
|
267
|
+
* `http://127.0.0.1:8976/callback`), `auth login` binds that port and reads the authorization code
|
|
268
|
+
* straight out of the browser redirect. Any other value — including the
|
|
269
|
+
* {@link DEFAULT_CLI_REDIRECT_URI} `:0` placeholder and out-of-band URNs — falls back to the user
|
|
270
|
+
* pasting the redirect URL back into the CLI.
|
|
240
271
|
*
|
|
241
272
|
* Defaults to {@link DEFAULT_CLI_REDIRECT_URI}.
|
|
242
273
|
*/
|
|
@@ -312,10 +343,15 @@ export declare function applyEnvVarOverrides(input: EnvVarOverrideInput): Maybe<
|
|
|
312
343
|
/**
|
|
313
344
|
* Returns true when the env has the minimum fields needed to attempt an OAuth login or token refresh.
|
|
314
345
|
*
|
|
346
|
+
* `clientSecret` is NOT among them. A CLI is a public client in the usual case
|
|
347
|
+
* (`token_endpoint_auth_method: 'none'`), authenticating with PKCE rather than a secret, so requiring
|
|
348
|
+
* one here would report a correctly-configured public env as incomplete — and send the caller back to
|
|
349
|
+
* `auth setup` to supply a credential the provider would then reject.
|
|
350
|
+
*
|
|
315
351
|
* @param env - The env config to check.
|
|
316
|
-
* @returns `true` when `apiBaseUrl`, `oidcIssuer`, `clientId`,
|
|
352
|
+
* @returns `true` when `apiBaseUrl`, `oidcIssuer`, `clientId`, and `redirectUri` are all present and non-empty.
|
|
317
353
|
*/
|
|
318
|
-
export declare function isCliEnvConfigComplete(env: Maybe<CliEnvConfig>): env is Required<Pick<CliEnvConfig, 'apiBaseUrl' | 'oidcIssuer' | 'clientId' | '
|
|
354
|
+
export declare function isCliEnvConfigComplete(env: Maybe<CliEnvConfig>): env is Required<Pick<CliEnvConfig, 'apiBaseUrl' | 'oidcIssuer' | 'clientId' | 'redirectUri'>> & CliEnvConfig;
|
|
319
355
|
/**
|
|
320
356
|
* Inputs to {@link readEnvTokenEntry}.
|
|
321
357
|
*/
|
|
@@ -8,7 +8,7 @@ import { type CliPaths } from './paths';
|
|
|
8
8
|
* Guarantees that the OIDC client fields are present so callers can pass them through to the
|
|
9
9
|
* OIDC client/token helpers without a non-null assertion or extra runtime check.
|
|
10
10
|
*/
|
|
11
|
-
export type CliEnvConfigComplete = Required<Pick<CliEnvConfig, 'apiBaseUrl' | 'oidcIssuer' | 'clientId' | '
|
|
11
|
+
export type CliEnvConfigComplete = Required<Pick<CliEnvConfig, 'apiBaseUrl' | 'oidcIssuer' | 'clientId' | 'redirectUri'>> & CliEnvConfig;
|
|
12
12
|
/**
|
|
13
13
|
* Builds the conventional `<CLINAME>_ENV` env var name from the CLI binary name.
|
|
14
14
|
*
|
|
@@ -71,8 +71,9 @@ export declare function resolveCliEnv(input: ResolveCliEnvInput): Promise<Resolv
|
|
|
71
71
|
export interface ResolveCliEnvOrThrowInput extends ResolveCliEnvInput {
|
|
72
72
|
/**
|
|
73
73
|
* When `true`, throws `AUTH_ENV_INCOMPLETE` if the resolved env is missing OIDC fields
|
|
74
|
-
* (apiBaseUrl, oidcIssuer, clientId,
|
|
75
|
-
*
|
|
74
|
+
* (apiBaseUrl, oidcIssuer, clientId, redirectUri). `clientSecret` is not required — see
|
|
75
|
+
* {@link isCliEnvConfigComplete}. The returned env is narrowed to {@link CliEnvConfigComplete}.
|
|
76
|
+
* Defaults to `false`.
|
|
76
77
|
*/
|
|
77
78
|
readonly requireComplete?: boolean;
|
|
78
79
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type WebsiteUrl } from '@dereekb/util';
|
|
2
|
+
export interface OpenUrlInBrowserInput {
|
|
3
|
+
/**
|
|
4
|
+
* The URL to hand to the platform's default handler.
|
|
5
|
+
*/
|
|
6
|
+
readonly url: WebsiteUrl;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Opens a URL in the user's default browser.
|
|
10
|
+
*
|
|
11
|
+
* Shells out to the platform's URL handler (`open` on macOS, `start` on Windows, `xdg-open`
|
|
12
|
+
* elsewhere) rather than taking a dependency for what is a single spawn. The child is detached with
|
|
13
|
+
* its stdio ignored, so the browser neither holds the CLI's event loop open nor interleaves output
|
|
14
|
+
* into the CLI's own stdout/stderr.
|
|
15
|
+
*
|
|
16
|
+
* Never throws or rejects: a headless machine with no handler registered is an ordinary outcome, and
|
|
17
|
+
* the caller falls back to the printed URL.
|
|
18
|
+
*
|
|
19
|
+
* @param input - The open inputs.
|
|
20
|
+
* @param input.url - The URL to open.
|
|
21
|
+
* @returns `true` when the handler process was spawned, `false` when it could not be.
|
|
22
|
+
*/
|
|
23
|
+
export declare function openUrlInBrowser(input: OpenUrlInBrowserInput): Promise<boolean>;
|
package/src/lib/util/index.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
export interface PromptInput {
|
|
2
2
|
readonly question: string;
|
|
3
3
|
readonly mask?: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Optional signal that cancels the prompt, rejecting it with {@link PROMPT_CANCELLED_ERROR_CODE}
|
|
6
|
+
* and releasing stdin.
|
|
7
|
+
*
|
|
8
|
+
* Lets a prompt race another source of the same answer — `auth login` offers the paste prompt
|
|
9
|
+
* while its loopback listener waits, and aborts the prompt the moment the redirect lands.
|
|
10
|
+
*/
|
|
11
|
+
readonly signal?: AbortSignal;
|
|
4
12
|
}
|
|
5
13
|
/**
|
|
6
14
|
* Error code thrown by {@link promptLine} when the user cancels a masked prompt with Ctrl-C.
|
|
@@ -16,11 +24,12 @@ export declare const PROMPT_CANCELLED_ERROR_CODE = "PROMPT_CANCELLED";
|
|
|
16
24
|
* pasted redirect URL.
|
|
17
25
|
*
|
|
18
26
|
* Rejects with a {@link CliError} (`code: 'PROMPT_CANCELLED'`) when the user presses Ctrl-C
|
|
19
|
-
* during a masked prompt, instead of forcibly terminating the process.
|
|
27
|
+
* during a masked prompt, or when `signal` aborts, instead of forcibly terminating the process.
|
|
20
28
|
*
|
|
21
29
|
* @param input - The prompt inputs.
|
|
22
30
|
* @param input.question - The prompt text written to stdout (or stderr when masking).
|
|
23
31
|
* @param input.mask - When `true`, characters are echoed as `*` and Ctrl-C cancels the prompt.
|
|
32
|
+
* @param input.signal - Optional signal that cancels the prompt and releases stdin.
|
|
24
33
|
* @returns The line entered by the user (without the trailing newline).
|
|
25
34
|
*/
|
|
26
35
|
export declare function promptLine(input: PromptInput): Promise<string>;
|
package/test/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli/test",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@dereekb/date": "14.
|
|
8
|
-
"@dereekb/dbx-cli": "14.
|
|
9
|
-
"@dereekb/firebase": "14.
|
|
10
|
-
"@dereekb/firebase-server/test": "14.
|
|
11
|
-
"@dereekb/model": "14.
|
|
12
|
-
"@dereekb/nestjs": "14.
|
|
13
|
-
"@dereekb/rxjs": "14.
|
|
14
|
-
"@dereekb/util": "14.
|
|
7
|
+
"@dereekb/date": "14.3.0",
|
|
8
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
9
|
+
"@dereekb/firebase": "14.3.0",
|
|
10
|
+
"@dereekb/firebase-server/test": "14.3.0",
|
|
11
|
+
"@dereekb/model": "14.3.0",
|
|
12
|
+
"@dereekb/nestjs": "14.3.0",
|
|
13
|
+
"@dereekb/rxjs": "14.3.0",
|
|
14
|
+
"@dereekb/util": "14.3.0",
|
|
15
15
|
"@nestjs/common": "^12.0.1",
|
|
16
16
|
"arktype": "^2.2.0",
|
|
17
17
|
"vitest": "4.1.11",
|
package/validate/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli/validate",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@dereekb/dbx-cli": "14.
|
|
8
|
-
"@dereekb/util": "14.
|
|
7
|
+
"@dereekb/dbx-cli": "14.3.0",
|
|
8
|
+
"@dereekb/util": "14.3.0",
|
|
9
9
|
"ts-morph": "^28.0.0"
|
|
10
10
|
}
|
|
11
11
|
}
|