instant-cli 1.0.23-branch-codex-cli-args-combinators.25394030897.1 → 1.0.23-branch-codex-cli-args-combinators.25395572961.1
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/.turbo/turbo-build.log +1 -1
- package/__tests__/args.test.ts +89 -45
- package/__tests__/oauthMock.ts +3 -2
- package/dist/commands/auth/client/add.d.ts.map +1 -1
- package/dist/commands/auth/client/add.js +57 -28
- package/dist/commands/auth/client/add.js.map +1 -1
- package/dist/commands/auth/client/shared.d.ts +0 -4
- package/dist/commands/auth/client/shared.d.ts.map +1 -1
- package/dist/commands/auth/client/shared.js +0 -4
- package/dist/commands/auth/client/shared.js.map +1 -1
- package/dist/commands/auth/client/update.d.ts.map +1 -1
- package/dist/commands/auth/client/update.js +59 -29
- package/dist/commands/auth/client/update.js.map +1 -1
- package/dist/commands/auth/origin/add.d.ts.map +1 -1
- package/dist/commands/auth/origin/add.js +8 -4
- package/dist/commands/auth/origin/add.js.map +1 -1
- package/dist/lib/args.d.ts +42 -29
- package/dist/lib/args.d.ts.map +1 -1
- package/dist/lib/args.js +91 -73
- package/dist/lib/args.js.map +1 -1
- package/dist/lib/oauth.d.ts.map +1 -1
- package/dist/lib/oauth.js +2 -1
- package/dist/lib/oauth.js.map +1 -1
- package/package.json +4 -4
- package/src/commands/auth/client/add.ts +88 -78
- package/src/commands/auth/client/shared.ts +0 -12
- package/src/commands/auth/client/update.ts +106 -98
- package/src/commands/auth/origin/add.ts +12 -8
- package/src/lib/args.ts +175 -120
- package/src/lib/oauth.ts +3 -2
|
@@ -39,9 +39,6 @@ import {
|
|
|
39
39
|
clientSecretPrompt,
|
|
40
40
|
firebaseDiscoveryEndpoint,
|
|
41
41
|
firebaseProjectIdPrompt,
|
|
42
|
-
getFlag,
|
|
43
|
-
hasAnyFlag,
|
|
44
|
-
isTrueFlag,
|
|
45
42
|
readPrivateKeyFile,
|
|
46
43
|
redirectSetupMessages,
|
|
47
44
|
redirectUriPrompt,
|
|
@@ -151,8 +148,9 @@ const resolveGoogleCredentialMode = Effect.fn(function* ({
|
|
|
151
148
|
opts: Record<string, unknown>;
|
|
152
149
|
}): Effect.fn.Return<'custom' | 'dev', BadArgsError, GlobalOpts> {
|
|
153
150
|
const { yes } = yield* GlobalOpts;
|
|
154
|
-
const
|
|
155
|
-
const
|
|
151
|
+
const args = Args.from(opts);
|
|
152
|
+
const devCredentialsFlag = args.isTrue('dev-credentials');
|
|
153
|
+
const hasProvidedSomeCustomCredentials = args.hasAny([
|
|
156
154
|
'client-id',
|
|
157
155
|
'client-secret',
|
|
158
156
|
'custom-redirect-uri',
|
|
@@ -256,6 +254,7 @@ const printGoogleCustomCredentialsClient = Effect.fn(function* ({
|
|
|
256
254
|
});
|
|
257
255
|
|
|
258
256
|
const handleGoogleClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
257
|
+
const args = Args.from(opts);
|
|
259
258
|
// This one requires special logic for getting client name
|
|
260
259
|
// because the suggested name includes the app type
|
|
261
260
|
const appType = yield* selectGoogleAppType(opts['app-type']);
|
|
@@ -271,8 +270,8 @@ const handleGoogleClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
|
271
270
|
);
|
|
272
271
|
const suggestedClientName = findName(`google-${appType}`, usedClientNames);
|
|
273
272
|
|
|
274
|
-
const clientName = yield*
|
|
275
|
-
Args.
|
|
273
|
+
const clientName = yield* args.text('name').pipe(
|
|
274
|
+
Args.prompt({
|
|
276
275
|
prompt: 'Client Name:',
|
|
277
276
|
defaultValue: suggestedClientName,
|
|
278
277
|
placeholder: suggestedClientName,
|
|
@@ -291,39 +290,34 @@ const handleGoogleClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
|
291
290
|
});
|
|
292
291
|
}
|
|
293
292
|
|
|
294
|
-
const clientId = yield*
|
|
295
|
-
Args.
|
|
293
|
+
const clientId = yield* args.text('client-id').pipe(
|
|
294
|
+
Args.availableWhen(!useSharedCredentials, {
|
|
296
295
|
message:
|
|
297
296
|
'--client-id is not compatible with --dev-credentials. Drop one or the other.',
|
|
298
297
|
}),
|
|
299
|
-
Args.
|
|
300
|
-
|
|
301
|
-
clientIdPrompt({ providerUrl: googleConsoleUrl }),
|
|
302
|
-
),
|
|
303
|
-
Args.requiredIf(!useSharedCredentials),
|
|
298
|
+
Args.prompt(clientIdPrompt({ providerUrl: googleConsoleUrl })),
|
|
299
|
+
Args.required(),
|
|
304
300
|
);
|
|
305
301
|
|
|
306
302
|
const usesCustomWebCredentials = !useSharedCredentials && appType === 'web';
|
|
307
|
-
const clientSecret = yield*
|
|
308
|
-
Args.
|
|
303
|
+
const clientSecret = yield* args.text('client-secret').pipe(
|
|
304
|
+
Args.availableWhen(usesCustomWebCredentials, {
|
|
309
305
|
message: useSharedCredentials
|
|
310
306
|
? '--client-secret is not compatible with --dev-credentials. Drop one or the other.'
|
|
311
307
|
: undefined,
|
|
312
308
|
}),
|
|
313
|
-
Args.
|
|
314
|
-
|
|
315
|
-
clientSecretPrompt({ providerUrl: googleConsoleUrl }),
|
|
316
|
-
),
|
|
317
|
-
Args.requiredIf(usesCustomWebCredentials),
|
|
309
|
+
Args.prompt(clientSecretPrompt({ providerUrl: googleConsoleUrl })),
|
|
310
|
+
Args.required(),
|
|
318
311
|
);
|
|
319
312
|
|
|
320
|
-
const customRedirectUri = yield*
|
|
321
|
-
Args.
|
|
313
|
+
const customRedirectUri = yield* args.text('custom-redirect-uri').pipe(
|
|
314
|
+
Args.availableWhen(usesCustomWebCredentials, {
|
|
322
315
|
message: useSharedCredentials
|
|
323
316
|
? '--custom-redirect-uri is not compatible with --dev-credentials.'
|
|
324
317
|
: 'Provided custom redirect URI when not using web app type.',
|
|
325
318
|
}),
|
|
326
|
-
Args.
|
|
319
|
+
Args.prompt(optionalRedirectPrompt),
|
|
320
|
+
Args.optional(),
|
|
327
321
|
);
|
|
328
322
|
|
|
329
323
|
if (!clientName) {
|
|
@@ -367,24 +361,29 @@ const handleGoogleClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
|
367
361
|
});
|
|
368
362
|
|
|
369
363
|
const handleGithubClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
364
|
+
const args = Args.from(opts);
|
|
370
365
|
const { clientName, provider } = yield* getClientNameAndProvider(
|
|
371
366
|
'github',
|
|
372
367
|
opts,
|
|
373
368
|
);
|
|
374
369
|
|
|
375
|
-
const clientId = yield*
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
370
|
+
const clientId = yield* args
|
|
371
|
+
.text('client-id')
|
|
372
|
+
.pipe(
|
|
373
|
+
Args.prompt(clientIdPrompt({ providerUrl: githubDeveloperUrl })),
|
|
374
|
+
Args.required(),
|
|
375
|
+
);
|
|
379
376
|
|
|
380
|
-
const clientSecret = yield*
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
377
|
+
const clientSecret = yield* args
|
|
378
|
+
.text('client-secret')
|
|
379
|
+
.pipe(
|
|
380
|
+
Args.prompt(clientSecretPrompt({ providerUrl: githubDeveloperUrl })),
|
|
381
|
+
Args.required(),
|
|
382
|
+
);
|
|
384
383
|
|
|
385
|
-
const customRedirectUri = yield*
|
|
386
|
-
|
|
387
|
-
|
|
384
|
+
const customRedirectUri = yield* args
|
|
385
|
+
.text('custom-redirect-uri')
|
|
386
|
+
.pipe(Args.prompt(optionalRedirectPrompt), Args.optional());
|
|
388
387
|
|
|
389
388
|
if (!clientName) {
|
|
390
389
|
return yield* BadArgsError.make({ message: 'Client name is required.' });
|
|
@@ -425,24 +424,29 @@ const handleGithubClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
|
425
424
|
const handleLinkedInClient = Effect.fn(function* (
|
|
426
425
|
opts: Record<string, unknown>,
|
|
427
426
|
) {
|
|
427
|
+
const args = Args.from(opts);
|
|
428
428
|
const { clientName, provider } = yield* getClientNameAndProvider(
|
|
429
429
|
'linkedin',
|
|
430
430
|
opts,
|
|
431
431
|
);
|
|
432
432
|
|
|
433
|
-
const clientId = yield*
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
433
|
+
const clientId = yield* args
|
|
434
|
+
.text('client-id')
|
|
435
|
+
.pipe(
|
|
436
|
+
Args.prompt(clientIdPrompt({ providerUrl: linkedinDeveloperUrl })),
|
|
437
|
+
Args.required(),
|
|
438
|
+
);
|
|
437
439
|
|
|
438
|
-
const clientSecret = yield*
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
440
|
+
const clientSecret = yield* args
|
|
441
|
+
.text('client-secret')
|
|
442
|
+
.pipe(
|
|
443
|
+
Args.prompt(clientSecretPrompt({ providerUrl: linkedinDeveloperUrl })),
|
|
444
|
+
Args.required(),
|
|
445
|
+
);
|
|
442
446
|
|
|
443
|
-
const customRedirectUri = yield*
|
|
444
|
-
|
|
445
|
-
|
|
447
|
+
const customRedirectUri = yield* args
|
|
448
|
+
.text('custom-redirect-uri')
|
|
449
|
+
.pipe(Args.prompt(optionalRedirectPrompt), Args.optional());
|
|
446
450
|
|
|
447
451
|
if (!clientName) {
|
|
448
452
|
return yield* BadArgsError.make({ message: 'Client name is required.' });
|
|
@@ -482,20 +486,20 @@ const handleLinkedInClient = Effect.fn(function* (
|
|
|
482
486
|
|
|
483
487
|
const handleAppleClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
484
488
|
const { yes } = yield* GlobalOpts;
|
|
489
|
+
const args = Args.from(opts);
|
|
485
490
|
const { clientName, provider } = yield* getClientNameAndProvider(
|
|
486
491
|
'apple',
|
|
487
492
|
opts,
|
|
488
493
|
);
|
|
489
494
|
|
|
490
|
-
const servicesId = yield*
|
|
491
|
-
|
|
492
|
-
Args.required()
|
|
493
|
-
);
|
|
495
|
+
const servicesId = yield* args
|
|
496
|
+
.text('services-id')
|
|
497
|
+
.pipe(Args.prompt(appleServicesIdPrompt({})), Args.required());
|
|
494
498
|
|
|
495
499
|
// If any web-flow flag is provided, enable web flow; otherwise ask
|
|
496
500
|
// (non-interactively with --yes we default to native-only).
|
|
497
501
|
const anyWebFlagProvided = Boolean(
|
|
498
|
-
|
|
502
|
+
args.hasAny(['team-id', 'key-id', 'private-key-file']),
|
|
499
503
|
);
|
|
500
504
|
|
|
501
505
|
const configureWeb = anyWebFlagProvided
|
|
@@ -503,8 +507,8 @@ const handleAppleClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
|
503
507
|
: yes
|
|
504
508
|
? false
|
|
505
509
|
: Boolean(
|
|
506
|
-
yield*
|
|
507
|
-
Args.
|
|
510
|
+
yield* args.bool('configure-web').pipe(
|
|
511
|
+
Args.confirm({
|
|
508
512
|
promptText:
|
|
509
513
|
'Configure web redirect flow? ' +
|
|
510
514
|
chalk.dim(
|
|
@@ -512,6 +516,7 @@ const handleAppleClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
|
512
516
|
),
|
|
513
517
|
defaultValue: false,
|
|
514
518
|
}),
|
|
519
|
+
Args.optional(),
|
|
515
520
|
),
|
|
516
521
|
);
|
|
517
522
|
|
|
@@ -519,35 +524,40 @@ const handleAppleClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
|
519
524
|
const webSkipMessage =
|
|
520
525
|
'requires configuring the web redirect flow (also provide --team-id, --key-id, and --private-key-file).';
|
|
521
526
|
|
|
522
|
-
const teamId = yield*
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
+
const teamId = yield* args
|
|
528
|
+
.text('team-id')
|
|
529
|
+
.pipe(
|
|
530
|
+
Args.availableWhen(!skipWeb, { message: `--team-id ${webSkipMessage}` }),
|
|
531
|
+
Args.prompt(appleTeamIdPrompt({})),
|
|
532
|
+
Args.required(),
|
|
533
|
+
);
|
|
527
534
|
|
|
528
|
-
const keyId = yield*
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
535
|
+
const keyId = yield* args
|
|
536
|
+
.text('key-id')
|
|
537
|
+
.pipe(
|
|
538
|
+
Args.availableWhen(!skipWeb, { message: `--key-id ${webSkipMessage}` }),
|
|
539
|
+
Args.prompt(appleKeyIdPrompt({})),
|
|
540
|
+
Args.required(),
|
|
541
|
+
);
|
|
533
542
|
|
|
534
|
-
const privateKeyPath = yield*
|
|
535
|
-
Args.
|
|
543
|
+
const privateKeyPath = yield* args.text('private-key-file').pipe(
|
|
544
|
+
Args.availableWhen(!skipWeb, {
|
|
536
545
|
message: `--private-key-file ${webSkipMessage}`,
|
|
537
546
|
}),
|
|
538
|
-
Args.
|
|
539
|
-
Args.
|
|
547
|
+
Args.prompt(applePrivateKeyFilePrompt({})),
|
|
548
|
+
Args.required(),
|
|
540
549
|
);
|
|
541
550
|
|
|
542
551
|
const privateKey = privateKeyPath
|
|
543
552
|
? yield* readPrivateKeyFile(privateKeyPath)
|
|
544
553
|
: undefined;
|
|
545
554
|
|
|
546
|
-
const customRedirectUri = yield*
|
|
547
|
-
Args.
|
|
555
|
+
const customRedirectUri = yield* args.text('custom-redirect-uri').pipe(
|
|
556
|
+
Args.availableWhen(!skipWeb, {
|
|
548
557
|
message: `--custom-redirect-uri ${webSkipMessage}`,
|
|
549
558
|
}),
|
|
550
|
-
Args.
|
|
559
|
+
Args.prompt(optionalRedirectPrompt),
|
|
560
|
+
Args.optional(),
|
|
551
561
|
);
|
|
552
562
|
|
|
553
563
|
if (!clientName) {
|
|
@@ -600,15 +610,15 @@ const handleAppleClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
|
600
610
|
});
|
|
601
611
|
|
|
602
612
|
const handleClerkClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
613
|
+
const args = Args.from(opts);
|
|
603
614
|
const { clientName, provider } = yield* getClientNameAndProvider(
|
|
604
615
|
'clerk',
|
|
605
616
|
opts,
|
|
606
617
|
);
|
|
607
618
|
|
|
608
|
-
const publishableKey = yield*
|
|
609
|
-
|
|
610
|
-
Args.required()
|
|
611
|
-
);
|
|
619
|
+
const publishableKey = yield* args
|
|
620
|
+
.text('publishable-key')
|
|
621
|
+
.pipe(Args.prompt(clerkPublishableKeyPrompt({})), Args.required());
|
|
612
622
|
|
|
613
623
|
if (!clientName) {
|
|
614
624
|
return yield* BadArgsError.make({ message: 'Client name is required.' });
|
|
@@ -665,15 +675,15 @@ const handleClerkClient = Effect.fn(function* (opts: Record<string, unknown>) {
|
|
|
665
675
|
const handleFirebaseClient = Effect.fn(function* (
|
|
666
676
|
opts: OptsFromCommand<typeof authClientAddDef> & Record<string, unknown>,
|
|
667
677
|
) {
|
|
678
|
+
const args = Args.from(opts);
|
|
668
679
|
const { clientName, provider } = yield* getClientNameAndProvider(
|
|
669
680
|
'firebase',
|
|
670
681
|
opts,
|
|
671
682
|
);
|
|
672
683
|
|
|
673
|
-
const projectId = yield*
|
|
674
|
-
|
|
675
|
-
Args.required()
|
|
676
|
-
);
|
|
684
|
+
const projectId = yield* args
|
|
685
|
+
.text('project-id')
|
|
686
|
+
.pipe(Args.prompt(firebaseProjectIdPrompt({})), Args.required());
|
|
677
687
|
// typeguard
|
|
678
688
|
if (!clientName || !projectId) {
|
|
679
689
|
return yield* BadArgsError.make({
|
|
@@ -9,18 +9,6 @@ import { UI } from '../../../ui/index.ts';
|
|
|
9
9
|
|
|
10
10
|
type EmptyPromptArgs = Record<string, never>;
|
|
11
11
|
|
|
12
|
-
export const getFlag = (opts: Record<string, unknown>, flag: string) =>
|
|
13
|
-
opts[flag];
|
|
14
|
-
|
|
15
|
-
export const hasFlag = (opts: Record<string, unknown>, flag: string) =>
|
|
16
|
-
flag in opts;
|
|
17
|
-
|
|
18
|
-
export const hasAnyFlag = (opts: Record<string, unknown>, flags: string[]) =>
|
|
19
|
-
flags.some((flag) => hasFlag(opts, flag));
|
|
20
|
-
|
|
21
|
-
export const isTrueFlag = (value: unknown) =>
|
|
22
|
-
value === true || value === 'true';
|
|
23
|
-
|
|
24
12
|
export const getMetaString = (meta: unknown, key: string) => {
|
|
25
13
|
if (!meta || typeof meta !== 'object') return undefined;
|
|
26
14
|
const value = (meta as Record<string, unknown>)[key];
|
|
@@ -27,11 +27,7 @@ import {
|
|
|
27
27
|
clientSecretPrompt,
|
|
28
28
|
firebaseDiscoveryEndpoint,
|
|
29
29
|
firebaseProjectIdPrompt,
|
|
30
|
-
getFlag,
|
|
31
30
|
getMetaString,
|
|
32
|
-
hasAnyFlag,
|
|
33
|
-
hasFlag,
|
|
34
|
-
isTrueFlag,
|
|
35
31
|
readPrivateKeyFile,
|
|
36
32
|
redirectSetupMessages,
|
|
37
33
|
redirectUriPrompt,
|
|
@@ -149,10 +145,10 @@ const updateGoogleToDevCredentials = Effect.fn(function* (
|
|
|
149
145
|
type GoogleUpdateMode = 'dev' | 'custom' | 'redirect' | 'none';
|
|
150
146
|
|
|
151
147
|
const hasGoogleCustomCredentialFlags = (opts: Record<string, unknown>) =>
|
|
152
|
-
|
|
148
|
+
Args.from(opts).hasAny(['client-id', 'client-secret', 'custom-redirect-uri']);
|
|
153
149
|
|
|
154
150
|
const hasGoogleUpdateFlags = (opts: Record<string, unknown>) =>
|
|
155
|
-
|
|
151
|
+
Args.from(opts).isTrue('dev-credentials') ||
|
|
156
152
|
hasGoogleCustomCredentialFlags(opts);
|
|
157
153
|
|
|
158
154
|
const selectGoogleUpdateMode = Effect.fn(function* ({
|
|
@@ -211,7 +207,8 @@ const resolveGoogleUpdateMode = Effect.fn(function* ({
|
|
|
211
207
|
switchingFromShared: boolean;
|
|
212
208
|
}) {
|
|
213
209
|
const { yes } = yield* GlobalOpts;
|
|
214
|
-
const
|
|
210
|
+
const args = Args.from(opts);
|
|
211
|
+
const devCredentialsFlag = args.isTrue('dev-credentials');
|
|
215
212
|
const hasProvidedSomeCustomCredentials = hasGoogleCustomCredentialFlags(opts);
|
|
216
213
|
|
|
217
214
|
if (devCredentialsFlag && !isWeb) {
|
|
@@ -222,7 +219,7 @@ const resolveGoogleUpdateMode = Effect.fn(function* ({
|
|
|
222
219
|
|
|
223
220
|
if (
|
|
224
221
|
!isWeb &&
|
|
225
|
-
(
|
|
222
|
+
(args.has('client-secret') || args.has('custom-redirect-uri'))
|
|
226
223
|
) {
|
|
227
224
|
return yield* BadArgsError.make({
|
|
228
225
|
message:
|
|
@@ -254,7 +251,7 @@ const resolveGoogleUpdateMode = Effect.fn(function* ({
|
|
|
254
251
|
yes &&
|
|
255
252
|
isWeb &&
|
|
256
253
|
switchingFromShared &&
|
|
257
|
-
(!
|
|
254
|
+
(!args.has('client-id') || !args.has('client-secret'))
|
|
258
255
|
) {
|
|
259
256
|
return yield* BadArgsError.make({
|
|
260
257
|
message:
|
|
@@ -276,10 +273,10 @@ const updateGoogleRedirect = Effect.fn(function* ({
|
|
|
276
273
|
opts: Record<string, unknown>;
|
|
277
274
|
client: OAuthClientRow;
|
|
278
275
|
}) {
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
276
|
+
const args = Args.from(opts);
|
|
277
|
+
const redirectTo = yield* args
|
|
278
|
+
.text('custom-redirect-uri')
|
|
279
|
+
.pipe(Args.prompt(newRedirectPrompt), Args.required());
|
|
283
280
|
|
|
284
281
|
const response = yield* updateOAuthClient({
|
|
285
282
|
oauthClientId: client.id,
|
|
@@ -314,34 +311,37 @@ const updateGoogleCustomCredentials = Effect.fn(function* ({
|
|
|
314
311
|
switchingFromShared: boolean;
|
|
315
312
|
promptCredentials: boolean;
|
|
316
313
|
}) {
|
|
314
|
+
const args = Args.from(opts);
|
|
317
315
|
const mustCollectCredentials = promptCredentials || switchingFromShared;
|
|
318
|
-
const shouldPromptClientId =
|
|
319
|
-
promptCredentials || (switchingFromShared && !hasFlag(opts, 'client-id'));
|
|
320
|
-
const shouldPromptClientSecret =
|
|
321
|
-
isWeb &&
|
|
322
|
-
(promptCredentials ||
|
|
323
|
-
(switchingFromShared && !hasFlag(opts, 'client-secret')));
|
|
324
316
|
const shouldPromptRedirectUri =
|
|
325
317
|
isWeb && switchingFromShared && promptCredentials;
|
|
326
318
|
|
|
327
|
-
const clientId = yield*
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const clientSecret = yield*
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
319
|
+
const clientId = yield* args
|
|
320
|
+
.text('client-id')
|
|
321
|
+
.pipe(
|
|
322
|
+
Args.availableWhen(mustCollectCredentials || args.has('client-id')),
|
|
323
|
+
Args.prompt(clientIdPrompt({ providerUrl: googleConsoleUrl })),
|
|
324
|
+
Args.required(),
|
|
325
|
+
);
|
|
326
|
+
const clientSecret = yield* args
|
|
327
|
+
.text('client-secret')
|
|
328
|
+
.pipe(
|
|
329
|
+
Args.availableWhen(
|
|
330
|
+
isWeb && (mustCollectCredentials || args.has('client-secret')),
|
|
331
|
+
),
|
|
332
|
+
Args.prompt(clientSecretPrompt({ providerUrl: googleConsoleUrl })),
|
|
333
|
+
Args.required(),
|
|
334
|
+
);
|
|
341
335
|
const customRedirectUri = isWeb
|
|
342
|
-
? yield*
|
|
343
|
-
|
|
344
|
-
|
|
336
|
+
? yield* args
|
|
337
|
+
.text('custom-redirect-uri')
|
|
338
|
+
.pipe(
|
|
339
|
+
Args.availableWhen(
|
|
340
|
+
shouldPromptRedirectUri || args.has('custom-redirect-uri'),
|
|
341
|
+
),
|
|
342
|
+
Args.prompt(redirectPrompt),
|
|
343
|
+
Args.optional(),
|
|
344
|
+
)
|
|
345
345
|
: undefined;
|
|
346
346
|
|
|
347
347
|
const redirectTo = switchingFromShared
|
|
@@ -439,7 +439,8 @@ const handleClientIdSecretUpdate = Effect.fn(function* (params: {
|
|
|
439
439
|
redirectSetupPrompt: string;
|
|
440
440
|
}) {
|
|
441
441
|
const { yes } = yield* GlobalOpts;
|
|
442
|
-
const
|
|
442
|
+
const args = Args.from(params.opts);
|
|
443
|
+
const hasAnyUpdateFlag = args.hasAny([
|
|
443
444
|
'client-id',
|
|
444
445
|
'client-secret',
|
|
445
446
|
'custom-redirect-uri',
|
|
@@ -463,30 +464,27 @@ const handleClientIdSecretUpdate = Effect.fn(function* (params: {
|
|
|
463
464
|
promptRedirect = action === 'redirect';
|
|
464
465
|
}
|
|
465
466
|
|
|
466
|
-
const clientId = yield*
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
const clientSecret = yield*
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
const customRedirectUri = yield*
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
),
|
|
488
|
-
Args.requiredIf(promptRedirect),
|
|
489
|
-
);
|
|
467
|
+
const clientId = yield* args
|
|
468
|
+
.text('client-id')
|
|
469
|
+
.pipe(
|
|
470
|
+
Args.availableWhen(promptCredentials || args.has('client-id')),
|
|
471
|
+
Args.prompt(clientIdPrompt({ providerUrl: params.providerUrl })),
|
|
472
|
+
Args.required(),
|
|
473
|
+
);
|
|
474
|
+
const clientSecret = yield* args
|
|
475
|
+
.text('client-secret')
|
|
476
|
+
.pipe(
|
|
477
|
+
Args.availableWhen(promptCredentials || args.has('client-secret')),
|
|
478
|
+
Args.prompt(clientSecretPrompt({ providerUrl: params.providerUrl })),
|
|
479
|
+
Args.required(),
|
|
480
|
+
);
|
|
481
|
+
const customRedirectUri = yield* args
|
|
482
|
+
.text('custom-redirect-uri')
|
|
483
|
+
.pipe(
|
|
484
|
+
Args.availableWhen(promptRedirect || args.has('custom-redirect-uri')),
|
|
485
|
+
Args.prompt(promptRedirect ? newRedirectPrompt : redirectPrompt),
|
|
486
|
+
Args.required(),
|
|
487
|
+
);
|
|
490
488
|
|
|
491
489
|
const response = yield* updateOAuthClient({
|
|
492
490
|
oauthClientId: params.client.id,
|
|
@@ -527,10 +525,10 @@ const appleWebFlags = [
|
|
|
527
525
|
const appleUpdateFlags = ['services-id', ...appleWebFlags];
|
|
528
526
|
|
|
529
527
|
const hasAppleWebFlags = (opts: Record<string, unknown>) =>
|
|
530
|
-
|
|
528
|
+
Args.from(opts).hasAny(appleWebFlags);
|
|
531
529
|
|
|
532
530
|
const hasAppleUpdateFlags = (opts: Record<string, unknown>) =>
|
|
533
|
-
|
|
531
|
+
Args.from(opts).hasAny(appleUpdateFlags);
|
|
534
532
|
|
|
535
533
|
const appleClientHasWebConfig = (client: OAuthClientRow) =>
|
|
536
534
|
Boolean(
|
|
@@ -596,24 +594,38 @@ const readAppleWebUpdate = Effect.fn(function* ({
|
|
|
596
594
|
client: OAuthClientRow;
|
|
597
595
|
promptAll: boolean;
|
|
598
596
|
}) {
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
597
|
+
const args = Args.from(opts);
|
|
598
|
+
const teamId = yield* args
|
|
599
|
+
.text('team-id')
|
|
600
|
+
.pipe(
|
|
601
|
+
Args.availableWhen(promptAll || args.has('team-id')),
|
|
602
|
+
Args.prompt(appleTeamIdPrompt({})),
|
|
603
|
+
Args.required(),
|
|
604
|
+
);
|
|
605
|
+
const keyId = yield* args
|
|
606
|
+
.text('key-id')
|
|
607
|
+
.pipe(
|
|
608
|
+
Args.availableWhen(promptAll || args.has('key-id')),
|
|
609
|
+
Args.prompt(appleKeyIdPrompt({})),
|
|
610
|
+
Args.required(),
|
|
611
|
+
);
|
|
612
|
+
const privateKeyPath = yield* args
|
|
613
|
+
.text('private-key-file')
|
|
614
|
+
.pipe(
|
|
615
|
+
Args.availableWhen(promptAll || args.has('private-key-file')),
|
|
616
|
+
Args.prompt(applePrivateKeyFilePrompt({})),
|
|
617
|
+
Args.required(),
|
|
618
|
+
);
|
|
611
619
|
const privateKey = privateKeyPath
|
|
612
620
|
? yield* readPrivateKeyFile(privateKeyPath)
|
|
613
621
|
: undefined;
|
|
614
|
-
const customRedirectUri = yield*
|
|
615
|
-
|
|
616
|
-
|
|
622
|
+
const customRedirectUri = yield* args
|
|
623
|
+
.text('custom-redirect-uri')
|
|
624
|
+
.pipe(
|
|
625
|
+
Args.availableWhen(promptAll || args.has('custom-redirect-uri')),
|
|
626
|
+
Args.prompt(redirectPrompt),
|
|
627
|
+
Args.optional(),
|
|
628
|
+
);
|
|
617
629
|
|
|
618
630
|
const meta: Record<string, string> = {};
|
|
619
631
|
if (teamId) meta.teamId = teamId;
|
|
@@ -634,16 +646,20 @@ const handleAppleUpdate = Effect.fn(function* (
|
|
|
634
646
|
client: OAuthClientRow,
|
|
635
647
|
) {
|
|
636
648
|
const { yes } = yield* GlobalOpts;
|
|
649
|
+
const args = Args.from(opts);
|
|
637
650
|
const { promptAll, configureWeb } = yield* resolveAppleUpdateConfig({
|
|
638
651
|
opts,
|
|
639
652
|
client,
|
|
640
653
|
yes,
|
|
641
654
|
});
|
|
642
655
|
|
|
643
|
-
const servicesId = yield*
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
656
|
+
const servicesId = yield* args
|
|
657
|
+
.text('services-id')
|
|
658
|
+
.pipe(
|
|
659
|
+
Args.availableWhen(promptAll || args.has('services-id')),
|
|
660
|
+
Args.prompt(appleServicesIdPrompt({})),
|
|
661
|
+
Args.required(),
|
|
662
|
+
);
|
|
647
663
|
const webUpdate: AppleWebUpdate = configureWeb
|
|
648
664
|
? yield* readAppleWebUpdate({ opts, client, promptAll })
|
|
649
665
|
: {};
|
|
@@ -683,14 +699,10 @@ const handleClerkUpdate = Effect.fn(function* (
|
|
|
683
699
|
opts: Record<string, unknown>,
|
|
684
700
|
client: OAuthClientRow,
|
|
685
701
|
) {
|
|
686
|
-
const
|
|
687
|
-
const publishableKey = yield*
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
clerkPublishableKeyPrompt({}),
|
|
691
|
-
),
|
|
692
|
-
Args.required(),
|
|
693
|
-
);
|
|
702
|
+
const args = Args.from(opts);
|
|
703
|
+
const publishableKey = yield* args
|
|
704
|
+
.text('publishable-key')
|
|
705
|
+
.pipe(Args.prompt(clerkPublishableKeyPrompt({})), Args.required());
|
|
694
706
|
|
|
695
707
|
const domain = clerkDomainFromPublishableKey(publishableKey);
|
|
696
708
|
if (!domain) {
|
|
@@ -721,14 +733,10 @@ const handleFirebaseUpdate = Effect.fn(function* (
|
|
|
721
733
|
opts: Record<string, unknown>,
|
|
722
734
|
client: OAuthClientRow,
|
|
723
735
|
) {
|
|
724
|
-
const
|
|
725
|
-
const projectId = yield*
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
firebaseProjectIdPrompt({}),
|
|
729
|
-
),
|
|
730
|
-
Args.required(),
|
|
731
|
-
);
|
|
736
|
+
const args = Args.from(opts);
|
|
737
|
+
const projectId = yield* args
|
|
738
|
+
.text('project-id')
|
|
739
|
+
.pipe(Args.prompt(firebaseProjectIdPrompt({})), Args.required());
|
|
732
740
|
|
|
733
741
|
const validationError = validateFirebaseProjectId(projectId);
|
|
734
742
|
if (validationError) {
|