@sanity/runtime-cli 17.8.0 → 17.10.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 +28 -22
- package/dist/actions/blueprints/pre-deploy.js +2 -0
- package/dist/actions/blueprints/stacks.d.ts +3 -0
- package/dist/actions/blueprints/stacks.js +1 -0
- package/dist/actions/sanity/projects.d.ts +11 -0
- package/dist/actions/sanity/projects.js +48 -22
- package/dist/baseCommands.d.ts +6 -0
- package/dist/baseCommands.js +9 -1
- package/dist/commands/blueprints/stacks.d.ts +2 -1
- package/dist/commands/blueprints/stacks.js +14 -6
- package/dist/commands/functions/test.d.ts +1 -0
- package/dist/commands/functions/test.js +5 -0
- package/dist/cores/blueprints/stacks.d.ts +8 -3
- package/dist/cores/blueprints/stacks.js +282 -85
- package/dist/cores/functions/test.d.ts +2 -19
- package/dist/cores/functions/test.js +63 -138
- package/dist/server/app.js +4 -6
- package/dist/server/static/components/payload-panel.js +1 -1
- package/dist/utils/display/prompt.d.ts +4 -1
- package/dist/utils/display/prompt.js +16 -2
- package/dist/utils/functions/child-process-wrapper.js +3 -2
- package/dist/utils/functions/child-runtime/durable.d.ts +2 -2
- package/dist/utils/functions/child-runtime/durable.js +70 -3
- package/dist/utils/functions/durable-logs.d.ts +16 -0
- package/dist/utils/functions/durable-logs.js +52 -0
- package/dist/utils/functions/invoke/local.js +16 -8
- package/dist/utils/functions/invoke/resolve-invoke-type.d.ts +51 -0
- package/dist/utils/functions/invoke/resolve-invoke-type.js +131 -0
- package/dist/utils/types.d.ts +39 -6
- package/oclif.manifest.json +26 -5
- package/package.json +1 -1
- package/skills/blueprints-stacks.md +14 -2
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ EXAMPLES
|
|
|
90
90
|
$ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
93
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/add.ts)_
|
|
94
94
|
|
|
95
95
|
## `sanity-run blueprints config`
|
|
96
96
|
|
|
@@ -127,7 +127,7 @@ EXAMPLES
|
|
|
127
127
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
130
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/config.ts)_
|
|
131
131
|
|
|
132
132
|
## `sanity-run blueprints deploy`
|
|
133
133
|
|
|
@@ -183,7 +183,7 @@ EXAMPLES
|
|
|
183
183
|
$ sanity-run blueprints deploy --new-stack-name <new-name>
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
186
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/deploy.ts)_
|
|
187
187
|
|
|
188
188
|
## `sanity-run blueprints destroy`
|
|
189
189
|
|
|
@@ -221,7 +221,7 @@ EXAMPLES
|
|
|
221
221
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
224
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/destroy.ts)_
|
|
225
225
|
|
|
226
226
|
## `sanity-run blueprints doctor`
|
|
227
227
|
|
|
@@ -253,7 +253,7 @@ EXAMPLES
|
|
|
253
253
|
$ sanity-run blueprints doctor --fix
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
256
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/doctor.ts)_
|
|
257
257
|
|
|
258
258
|
## `sanity-run blueprints info`
|
|
259
259
|
|
|
@@ -291,7 +291,7 @@ EXAMPLES
|
|
|
291
291
|
$ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
|
|
292
292
|
```
|
|
293
293
|
|
|
294
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
294
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/info.ts)_
|
|
295
295
|
|
|
296
296
|
## `sanity-run blueprints init [DIR]`
|
|
297
297
|
|
|
@@ -355,7 +355,7 @@ EXAMPLES
|
|
|
355
355
|
$ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
|
|
356
356
|
```
|
|
357
357
|
|
|
358
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
358
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/init.ts)_
|
|
359
359
|
|
|
360
360
|
## `sanity-run blueprints logs`
|
|
361
361
|
|
|
@@ -401,7 +401,7 @@ EXAMPLES
|
|
|
401
401
|
$ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
|
|
402
402
|
```
|
|
403
403
|
|
|
404
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
404
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/logs.ts)_
|
|
405
405
|
|
|
406
406
|
## `sanity-run blueprints mint-deploy-token`
|
|
407
407
|
|
|
@@ -446,7 +446,7 @@ EXAMPLES
|
|
|
446
446
|
$ sanity-run blueprints mint-deploy-token --organization-id <orgId>
|
|
447
447
|
```
|
|
448
448
|
|
|
449
|
-
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
449
|
+
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/mint-deploy-token.ts)_
|
|
450
450
|
|
|
451
451
|
## `sanity-run blueprints plan`
|
|
452
452
|
|
|
@@ -479,7 +479,7 @@ EXAMPLES
|
|
|
479
479
|
$ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
|
|
480
480
|
```
|
|
481
481
|
|
|
482
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
482
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/plan.ts)_
|
|
483
483
|
|
|
484
484
|
## `sanity-run blueprints promote`
|
|
485
485
|
|
|
@@ -515,7 +515,7 @@ EXAMPLES
|
|
|
515
515
|
$ sanity-run blueprints promote --new-stack-name <new-name>
|
|
516
516
|
```
|
|
517
517
|
|
|
518
|
-
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
518
|
+
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/promote.ts)_
|
|
519
519
|
|
|
520
520
|
## `sanity-run blueprints stacks`
|
|
521
521
|
|
|
@@ -523,9 +523,11 @@ List remote Stack deployments for your project or organization
|
|
|
523
523
|
|
|
524
524
|
```
|
|
525
525
|
USAGE
|
|
526
|
-
$ sanity-run blueprints stacks [--json] [--project-id <value> | --organization-id <value> | --include-projects
|
|
526
|
+
$ sanity-run blueprints stacks [--json] [--project-id <value> | --organization-id <value> | --include-projects |
|
|
527
|
+
--all]
|
|
527
528
|
|
|
528
529
|
FLAGS
|
|
530
|
+
--all List Stacks from every organization and project you have access to
|
|
529
531
|
--include-projects Include Stacks from all projects within the organization. Requires --organization-id.
|
|
530
532
|
--json Format output as json
|
|
531
533
|
--organization-id=<value> Sanity organization ID used to scope Blueprint and Stack
|
|
@@ -539,11 +541,14 @@ DESCRIPTION
|
|
|
539
541
|
Use this to discover existing Stacks you can scope a local Blueprint to (using 'blueprints config --edit'), or to
|
|
540
542
|
audit what's deployed across your project.
|
|
541
543
|
|
|
542
|
-
|
|
544
|
+
Without a scope, prompts for an organization or project. Use --all to list Stacks across every organization and
|
|
545
|
+
project you can access, or --include-projects with --organization-id for one organization and its projects.
|
|
543
546
|
|
|
544
547
|
EXAMPLES
|
|
545
548
|
$ sanity-run blueprints stacks
|
|
546
549
|
|
|
550
|
+
$ sanity-run blueprints stacks --all
|
|
551
|
+
|
|
547
552
|
$ sanity-run blueprints stacks --project-id <projectId>
|
|
548
553
|
|
|
549
554
|
$ sanity-run blueprints stacks --organization-id <organizationId>
|
|
@@ -551,7 +556,7 @@ EXAMPLES
|
|
|
551
556
|
$ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
|
|
552
557
|
```
|
|
553
558
|
|
|
554
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
559
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/blueprints/stacks.ts)_
|
|
555
560
|
|
|
556
561
|
## `sanity-run functions add`
|
|
557
562
|
|
|
@@ -603,7 +608,7 @@ EXAMPLES
|
|
|
603
608
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
604
609
|
```
|
|
605
610
|
|
|
606
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
611
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/functions/add.ts)_
|
|
607
612
|
|
|
608
613
|
## `sanity-run functions dev`
|
|
609
614
|
|
|
@@ -638,7 +643,7 @@ EXAMPLES
|
|
|
638
643
|
$ sanity-run functions dev --timeout 60
|
|
639
644
|
```
|
|
640
645
|
|
|
641
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
646
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/functions/dev.ts)_
|
|
642
647
|
|
|
643
648
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
644
649
|
|
|
@@ -671,7 +676,7 @@ EXAMPLES
|
|
|
671
676
|
$ sanity-run functions env add --stack <name-or-id> MyFunction API_URL https://api.example.com/
|
|
672
677
|
```
|
|
673
678
|
|
|
674
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
679
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/functions/env/add.ts)_
|
|
675
680
|
|
|
676
681
|
## `sanity-run functions env list NAME`
|
|
677
682
|
|
|
@@ -701,7 +706,7 @@ EXAMPLES
|
|
|
701
706
|
$ sanity-run functions env list --stack <name-or-id> MyFunction
|
|
702
707
|
```
|
|
703
708
|
|
|
704
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
709
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/functions/env/list.ts)_
|
|
705
710
|
|
|
706
711
|
## `sanity-run functions env remove NAME KEY`
|
|
707
712
|
|
|
@@ -733,7 +738,7 @@ EXAMPLES
|
|
|
733
738
|
$ sanity-run functions env remove --stack <name-or-id> MyFunction API_URL
|
|
734
739
|
```
|
|
735
740
|
|
|
736
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
741
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/functions/env/remove.ts)_
|
|
737
742
|
|
|
738
743
|
## `sanity-run functions logs [NAME]`
|
|
739
744
|
|
|
@@ -773,7 +778,7 @@ EXAMPLES
|
|
|
773
778
|
$ sanity-run functions logs <name> --delete
|
|
774
779
|
```
|
|
775
780
|
|
|
776
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
781
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/functions/logs.ts)_
|
|
777
782
|
|
|
778
783
|
## `sanity-run functions test [NAME]`
|
|
779
784
|
|
|
@@ -785,7 +790,7 @@ USAGE
|
|
|
785
790
|
<value>] | | | --file-before <value> | --file-after <value> | --document-id-before <value> | --document-id-after
|
|
786
791
|
<value>] [--data-after <value> | | | | | | | ] [-e create|update|delete] [-t <value>] [-a <value>]
|
|
787
792
|
[--with-user-token] [--media-library-id <value> | [--project-id <value> | --organization-id <value>] | --dataset
|
|
788
|
-
<value>]
|
|
793
|
+
<value>] [--no-wait]
|
|
789
794
|
|
|
790
795
|
ARGUMENTS
|
|
791
796
|
[NAME] The name of the Sanity Function
|
|
@@ -807,6 +812,7 @@ FLAGS
|
|
|
807
812
|
--file-before=<value> Original document
|
|
808
813
|
--json Format output as json
|
|
809
814
|
--media-library-id=<value> Sanity Media Library ID to use
|
|
815
|
+
--no-wait Skip durable wait delays instead of sleeping
|
|
810
816
|
--organization-id=<value> Sanity organization ID used to scope Blueprint and Stack
|
|
811
817
|
--project-id=<value> Sanity project ID used to scope Blueprint and Stack
|
|
812
818
|
--with-user-token Prime access token from CLI config
|
|
@@ -830,7 +836,7 @@ EXAMPLES
|
|
|
830
836
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
831
837
|
```
|
|
832
838
|
|
|
833
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
839
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.10.0/src/commands/functions/test.ts)_
|
|
834
840
|
|
|
835
841
|
## `sanity-run help [COMMAND]`
|
|
836
842
|
|
|
@@ -6,10 +6,12 @@ type ListStacksResponse = {
|
|
|
6
6
|
ok: true;
|
|
7
7
|
error: null;
|
|
8
8
|
stacks: StackSummary[];
|
|
9
|
+
response?: Response;
|
|
9
10
|
} | {
|
|
10
11
|
ok: false;
|
|
11
12
|
error: string;
|
|
12
13
|
stacks?: unknown;
|
|
14
|
+
response?: Response;
|
|
13
15
|
};
|
|
14
16
|
export declare function listStacks(auth: AuthParams, logger: Logger): Promise<ListStacksResponse>;
|
|
15
17
|
type GetStackResponse = {
|
|
@@ -46,6 +48,7 @@ type UpdateStackResponse = {
|
|
|
46
48
|
error: null;
|
|
47
49
|
stack: Stack & {
|
|
48
50
|
operationId: string;
|
|
51
|
+
changeCount?: number;
|
|
49
52
|
};
|
|
50
53
|
} | {
|
|
51
54
|
ok: false;
|
|
@@ -22,6 +22,17 @@ export declare function listProjects({ token, organizationId, logger, }: {
|
|
|
22
22
|
organizationId?: string;
|
|
23
23
|
logger: Logger;
|
|
24
24
|
}): Promise<ListProjectsResponse>;
|
|
25
|
+
export interface Organization {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
}
|
|
29
|
+
interface ListOrganizationsResponse extends ActionResponse {
|
|
30
|
+
organizations: Organization[];
|
|
31
|
+
}
|
|
32
|
+
export declare function listOrganizations({ token, logger, }: {
|
|
33
|
+
token: string;
|
|
34
|
+
logger: Logger;
|
|
35
|
+
}): Promise<ListOrganizationsResponse>;
|
|
25
36
|
interface GroupedProjectsByOrganizationResponse extends ActionResponse {
|
|
26
37
|
organizations: GroupedProjects[];
|
|
27
38
|
}
|
|
@@ -8,22 +8,52 @@ export async function listProjects({ token, organizationId, logger, }) {
|
|
|
8
8
|
const url = organizationId
|
|
9
9
|
? `${projectsApiPath}?organizationId=${encodeURIComponent(organizationId)}`
|
|
10
10
|
: projectsApiPath;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
try {
|
|
12
|
+
const projectsFetch = await fetchFn(url, {
|
|
13
|
+
method: 'GET',
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${token}`,
|
|
16
|
+
'Content-Type': 'application/json',
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
const projects = await projectsFetch.json();
|
|
20
|
+
return {
|
|
21
|
+
ok: projectsFetch.ok,
|
|
22
|
+
error: projectsFetch.ok ? null : projects.error?.message,
|
|
23
|
+
projects,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return {
|
|
28
|
+
ok: false,
|
|
29
|
+
error: error instanceof Error ? error.message : String(error),
|
|
30
|
+
projects: [],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
24
33
|
}
|
|
25
|
-
export async function
|
|
34
|
+
export async function listOrganizations({ token, logger, }) {
|
|
26
35
|
const fetchFn = createTracedFetch(logger);
|
|
36
|
+
try {
|
|
37
|
+
const response = await fetchFn(orgsApiPath, {
|
|
38
|
+
method: 'GET',
|
|
39
|
+
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
|
40
|
+
});
|
|
41
|
+
const organizations = await response.json();
|
|
42
|
+
return {
|
|
43
|
+
ok: response.ok,
|
|
44
|
+
error: response.ok ? null : organizations.error?.message,
|
|
45
|
+
organizations,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return {
|
|
50
|
+
ok: false,
|
|
51
|
+
error: error instanceof Error ? error.message : String(error),
|
|
52
|
+
organizations: [],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export async function groupProjectsByOrganization({ token, logger, }) {
|
|
27
57
|
const projectsResponse = await listProjects({ token, logger });
|
|
28
58
|
if (!projectsResponse.ok) {
|
|
29
59
|
return {
|
|
@@ -32,19 +62,15 @@ export async function groupProjectsByOrganization({ token, logger, }) {
|
|
|
32
62
|
organizations: [],
|
|
33
63
|
};
|
|
34
64
|
}
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
|
38
|
-
});
|
|
39
|
-
if (!orgsFetch.ok) {
|
|
65
|
+
const orgsResponse = await listOrganizations({ token, logger });
|
|
66
|
+
if (!orgsResponse.ok) {
|
|
40
67
|
return {
|
|
41
68
|
ok: false,
|
|
42
|
-
error:
|
|
69
|
+
error: orgsResponse.error,
|
|
43
70
|
organizations: [],
|
|
44
71
|
};
|
|
45
72
|
}
|
|
46
|
-
const
|
|
47
|
-
const orgsWithProjects = organizations.map(({ name, id }) => {
|
|
73
|
+
const orgsWithProjects = orgsResponse.organizations.map(({ name, id }) => {
|
|
48
74
|
const projects = projectsResponse.projects.filter((project) => project.organizationId === id);
|
|
49
75
|
return { organization: { name, id }, projects };
|
|
50
76
|
});
|
package/dist/baseCommands.d.ts
CHANGED
|
@@ -131,6 +131,12 @@ export declare abstract class ResolvedCommand<T extends typeof Command> extends
|
|
|
131
131
|
* populated regardless of `needs` and is never required
|
|
132
132
|
*/
|
|
133
133
|
protected resolvedStackId?: string;
|
|
134
|
+
/**
|
|
135
|
+
* locally-resolved scope (flags > env > module > config)
|
|
136
|
+
* populated regardless of `needs` and is never required
|
|
137
|
+
*/
|
|
138
|
+
protected resolvedScopeType?: ScopeType;
|
|
139
|
+
protected resolvedScopeId?: string;
|
|
134
140
|
/**
|
|
135
141
|
* the located `.sanity/blueprint.config.json` (if any), populated regardless of
|
|
136
142
|
* `needs`. Lets commands read/update local config without requiring a manifest.
|
package/dist/baseCommands.js
CHANGED
|
@@ -213,6 +213,12 @@ export class ResolvedCommand extends RuntimeCommand {
|
|
|
213
213
|
* populated regardless of `needs` and is never required
|
|
214
214
|
*/
|
|
215
215
|
resolvedStackId;
|
|
216
|
+
/**
|
|
217
|
+
* locally-resolved scope (flags > env > module > config)
|
|
218
|
+
* populated regardless of `needs` and is never required
|
|
219
|
+
*/
|
|
220
|
+
resolvedScopeType;
|
|
221
|
+
resolvedScopeId;
|
|
216
222
|
/**
|
|
217
223
|
* the located `.sanity/blueprint.config.json` (if any), populated regardless of
|
|
218
224
|
* `needs`. Lets commands read/update local config without requiring a manifest.
|
|
@@ -308,8 +314,10 @@ export class ResolvedCommand extends RuntimeCommand {
|
|
|
308
314
|
// assumption was wrong; leave stackId undefined
|
|
309
315
|
}
|
|
310
316
|
}
|
|
311
|
-
// Expose the resolved Stack ID regardless of `needs` (optional, for listings/highlighting)
|
|
317
|
+
// Expose the resolved Stack ID and scope regardless of `needs` (optional, for listings/highlighting)
|
|
312
318
|
this.resolvedStackId = resolved.stackId;
|
|
319
|
+
this.resolvedScopeType = resolved.scopeType;
|
|
320
|
+
this.resolvedScopeId = resolved.scopeId;
|
|
313
321
|
// Backfill resolved IDs onto the blueprint result if it was loaded
|
|
314
322
|
if (this.blueprint) {
|
|
315
323
|
Object.assign(this.blueprint, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
2
|
export default class StacksCommand extends ResolvedCommand<typeof StacksCommand> {
|
|
3
|
-
static needs: readonly ['
|
|
3
|
+
static needs: readonly ['token'];
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
@@ -8,6 +8,7 @@ export default class StacksCommand extends ResolvedCommand<typeof StacksCommand>
|
|
|
8
8
|
'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
'organization-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
'include-projects': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
12
|
};
|
|
12
13
|
run(): Promise<Record<string, unknown> | undefined>;
|
|
13
14
|
}
|
|
@@ -3,15 +3,16 @@ import { organizationIdFlagConfig, projectIdFlagConfig, ResolvedCommand } from '
|
|
|
3
3
|
import { blueprintStacksCore } from '../../cores/blueprints/stacks.js';
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
5
|
export default class StacksCommand extends ResolvedCommand {
|
|
6
|
-
static needs = ['
|
|
6
|
+
static needs = ['token'];
|
|
7
7
|
static summary = 'List remote Stack deployments for your project or organization';
|
|
8
8
|
static description = `Shows all Stacks associated with a project or organization. By default, lists Stacks scoped to the local Blueprint.
|
|
9
9
|
|
|
10
10
|
Use this to discover existing Stacks you can scope a local Blueprint to (using 'blueprints config --edit'), or to audit what's deployed across your project.
|
|
11
11
|
|
|
12
|
-
Use --include-projects with --organization-id
|
|
12
|
+
Without a scope, prompts for an organization or project. Use --all to list Stacks across every organization and project you can access, or --include-projects with --organization-id for one organization and its projects.`;
|
|
13
13
|
static examples = [
|
|
14
14
|
'<%= config.bin %> <%= command.id %>',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> --all',
|
|
15
16
|
'<%= config.bin %> <%= command.id %> --project-id <projectId>',
|
|
16
17
|
'<%= config.bin %> <%= command.id %> --organization-id <organizationId>',
|
|
17
18
|
'<%= config.bin %> <%= command.id %> --organization-id <organizationId> --include-projects',
|
|
@@ -19,21 +20,28 @@ Use --include-projects with --organization-id to also list Stacks from all proje
|
|
|
19
20
|
static flags = {
|
|
20
21
|
'project-id': Flags.string({
|
|
21
22
|
...projectIdFlagConfig,
|
|
22
|
-
exclusive: ['organization-id', 'include-projects'],
|
|
23
|
+
exclusive: ['organization-id', 'include-projects', 'all'],
|
|
24
|
+
}),
|
|
25
|
+
'organization-id': Flags.string({
|
|
26
|
+
...organizationIdFlagConfig,
|
|
27
|
+
exclusive: ['project-id', 'all'],
|
|
23
28
|
}),
|
|
24
|
-
'organization-id': Flags.string({ ...organizationIdFlagConfig }),
|
|
25
29
|
'include-projects': Flags.boolean({
|
|
26
30
|
description: 'Include Stacks from all projects within the organization. Requires --organization-id.',
|
|
27
31
|
dependsOn: ['organization-id'],
|
|
28
32
|
}),
|
|
33
|
+
all: Flags.boolean({
|
|
34
|
+
description: 'List Stacks from every organization and project you have access to',
|
|
35
|
+
exclusive: ['project-id', 'organization-id', 'include-projects'],
|
|
36
|
+
}),
|
|
29
37
|
};
|
|
30
38
|
async run() {
|
|
31
39
|
const result = await blueprintStacksCore({
|
|
32
40
|
bin: this.config.bin,
|
|
33
41
|
log: Logger(this.log.bind(this), this.flags),
|
|
34
42
|
token: this.sanityToken,
|
|
35
|
-
scopeType: this.
|
|
36
|
-
scopeId: this.
|
|
43
|
+
scopeType: this.resolvedScopeType,
|
|
44
|
+
scopeId: this.resolvedScopeId,
|
|
37
45
|
localStackId: this.resolvedStackId,
|
|
38
46
|
flags: this.flags,
|
|
39
47
|
});
|
|
@@ -25,6 +25,7 @@ export default class TestCommand extends ResolvedCommand<typeof TestCommand> {
|
|
|
25
25
|
'document-id-after': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
26
|
'with-user-token': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
27
|
'media-library-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
'no-wait': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
29
|
};
|
|
29
30
|
run(): Promise<Record<string, unknown> | undefined>;
|
|
30
31
|
}
|
|
@@ -146,6 +146,11 @@ Provide test data via --data (inline JSON), --file (JSON file), or --document-id
|
|
|
146
146
|
exclusive: ['project-id', 'dataset'],
|
|
147
147
|
required: false,
|
|
148
148
|
}),
|
|
149
|
+
'no-wait': Flags.boolean({
|
|
150
|
+
description: 'Skip durable wait delays instead of sleeping',
|
|
151
|
+
default: false,
|
|
152
|
+
required: false,
|
|
153
|
+
}),
|
|
149
154
|
};
|
|
150
155
|
async run() {
|
|
151
156
|
const { name } = this.args;
|
|
@@ -2,13 +2,18 @@ import type { ScopeType } from '../../utils/types.js';
|
|
|
2
2
|
import type { CoreConfig, CoreResult } from '../index.js';
|
|
3
3
|
export interface BlueprintStacksOptions extends CoreConfig {
|
|
4
4
|
token: string;
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Scope to list Stacks for, resolved by the base command (flags > env > config).
|
|
7
|
+
* Prompted for when absent.
|
|
8
|
+
*/
|
|
9
|
+
scopeType?: ScopeType;
|
|
10
|
+
scopeId?: string;
|
|
8
11
|
/** Locally-configured Stack ID, used only to highlight the current Stack in listings. */
|
|
9
12
|
localStackId?: string;
|
|
10
13
|
flags: {
|
|
14
|
+
all?: boolean;
|
|
11
15
|
'include-projects'?: boolean;
|
|
16
|
+
json?: boolean;
|
|
12
17
|
verbose?: boolean;
|
|
13
18
|
};
|
|
14
19
|
}
|