@sanity/runtime-cli 11.1.4 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/dist/config.js +1 -1
- package/dist/cores/blueprints/deploy.js +11 -6
- package/dist/server/static/vendor/vendor.bundle.js +3 -1
- package/dist/utils/types.d.ts +3 -0
- package/dist/utils/types.js +4 -2
- package/oclif.manifest.json +1 -1
- package/package.json +17 -17
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @sanity/runtime-cli
|
|
|
20
20
|
$ sanity-run COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ sanity-run (--version)
|
|
23
|
-
@sanity/runtime-cli/11.
|
|
23
|
+
@sanity/runtime-cli/11.2.0 linux-x64 node-v24.11.1
|
|
24
24
|
$ sanity-run --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ sanity-run COMMAND
|
|
@@ -92,7 +92,7 @@ EXAMPLES
|
|
|
92
92
|
$ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
95
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/blueprints/add.ts)_
|
|
96
96
|
|
|
97
97
|
## `sanity-run blueprints config`
|
|
98
98
|
|
|
@@ -124,7 +124,7 @@ EXAMPLES
|
|
|
124
124
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack-id <stackId>
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
127
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/blueprints/config.ts)_
|
|
128
128
|
|
|
129
129
|
## `sanity-run blueprints deploy`
|
|
130
130
|
|
|
@@ -146,7 +146,7 @@ EXAMPLES
|
|
|
146
146
|
$ sanity-run blueprints deploy --no-wait
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
149
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/blueprints/deploy.ts)_
|
|
150
150
|
|
|
151
151
|
## `sanity-run blueprints destroy`
|
|
152
152
|
|
|
@@ -173,7 +173,7 @@ EXAMPLES
|
|
|
173
173
|
$ sanity-run blueprints destroy --stack-id <stackId> --project-id <projectId> --force --no-wait
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
176
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/blueprints/destroy.ts)_
|
|
177
177
|
|
|
178
178
|
## `sanity-run blueprints doctor`
|
|
179
179
|
|
|
@@ -191,7 +191,7 @@ DESCRIPTION
|
|
|
191
191
|
Diagnose potential issues with Blueprint configuration
|
|
192
192
|
```
|
|
193
193
|
|
|
194
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
194
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/blueprints/doctor.ts)_
|
|
195
195
|
|
|
196
196
|
## `sanity-run blueprints info`
|
|
197
197
|
|
|
@@ -213,7 +213,7 @@ EXAMPLES
|
|
|
213
213
|
$ sanity-run blueprints info --stack-id <stackId>
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
216
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/blueprints/info.ts)_
|
|
217
217
|
|
|
218
218
|
## `sanity-run blueprints init [DIR]`
|
|
219
219
|
|
|
@@ -252,7 +252,7 @@ EXAMPLES
|
|
|
252
252
|
$ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
|
|
253
253
|
```
|
|
254
254
|
|
|
255
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
255
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/blueprints/init.ts)_
|
|
256
256
|
|
|
257
257
|
## `sanity-run blueprints logs`
|
|
258
258
|
|
|
@@ -274,7 +274,7 @@ EXAMPLES
|
|
|
274
274
|
$ sanity-run blueprints logs --watch
|
|
275
275
|
```
|
|
276
276
|
|
|
277
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
277
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/blueprints/logs.ts)_
|
|
278
278
|
|
|
279
279
|
## `sanity-run blueprints plan`
|
|
280
280
|
|
|
@@ -291,7 +291,7 @@ EXAMPLES
|
|
|
291
291
|
$ sanity-run blueprints plan
|
|
292
292
|
```
|
|
293
293
|
|
|
294
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
294
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/blueprints/plan.ts)_
|
|
295
295
|
|
|
296
296
|
## `sanity-run blueprints stacks`
|
|
297
297
|
|
|
@@ -316,7 +316,7 @@ EXAMPLES
|
|
|
316
316
|
$ sanity-run blueprints stacks --organization-id <organizationId>
|
|
317
317
|
```
|
|
318
318
|
|
|
319
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
319
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/blueprints/stacks.ts)_
|
|
320
320
|
|
|
321
321
|
## `sanity-run functions add`
|
|
322
322
|
|
|
@@ -358,7 +358,7 @@ EXAMPLES
|
|
|
358
358
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
359
359
|
```
|
|
360
360
|
|
|
361
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
361
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/functions/add.ts)_
|
|
362
362
|
|
|
363
363
|
## `sanity-run functions dev`
|
|
364
364
|
|
|
@@ -381,7 +381,7 @@ EXAMPLES
|
|
|
381
381
|
$ sanity-run functions dev --host 127.0.0.1 --port 8974
|
|
382
382
|
```
|
|
383
383
|
|
|
384
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
384
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/functions/dev.ts)_
|
|
385
385
|
|
|
386
386
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
387
387
|
|
|
@@ -403,7 +403,7 @@ EXAMPLES
|
|
|
403
403
|
$ sanity-run functions env add MyFunction API_URL https://api.example.com/
|
|
404
404
|
```
|
|
405
405
|
|
|
406
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
406
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/functions/env/add.ts)_
|
|
407
407
|
|
|
408
408
|
## `sanity-run functions env list NAME`
|
|
409
409
|
|
|
@@ -423,7 +423,7 @@ EXAMPLES
|
|
|
423
423
|
$ sanity-run functions env list MyFunction
|
|
424
424
|
```
|
|
425
425
|
|
|
426
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
426
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/functions/env/list.ts)_
|
|
427
427
|
|
|
428
428
|
## `sanity-run functions env remove NAME KEY`
|
|
429
429
|
|
|
@@ -444,7 +444,7 @@ EXAMPLES
|
|
|
444
444
|
$ sanity-run functions env remove MyFunction API_URL
|
|
445
445
|
```
|
|
446
446
|
|
|
447
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
447
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/functions/env/remove.ts)_
|
|
448
448
|
|
|
449
449
|
## `sanity-run functions logs NAME`
|
|
450
450
|
|
|
@@ -478,7 +478,7 @@ EXAMPLES
|
|
|
478
478
|
$ sanity-run functions logs <name> --delete
|
|
479
479
|
```
|
|
480
480
|
|
|
481
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
481
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/functions/logs.ts)_
|
|
482
482
|
|
|
483
483
|
## `sanity-run functions test NAME`
|
|
484
484
|
|
|
@@ -527,7 +527,7 @@ EXAMPLES
|
|
|
527
527
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
528
528
|
```
|
|
529
529
|
|
|
530
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v11.
|
|
530
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v11.2.0/src/commands/functions/test.ts)_
|
|
531
531
|
|
|
532
532
|
## `sanity-run help [COMMAND]`
|
|
533
533
|
|
|
@@ -547,5 +547,5 @@ DESCRIPTION
|
|
|
547
547
|
Display help for sanity-run.
|
|
548
548
|
```
|
|
549
549
|
|
|
550
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.
|
|
550
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.36/src/commands/help.ts)_
|
|
551
551
|
<!-- commandsstop -->
|
package/dist/config.js
CHANGED
|
@@ -13,7 +13,7 @@ const apiUrls = {
|
|
|
13
13
|
staging: 'https://api.sanity.work/',
|
|
14
14
|
default: 'http://api.sanity/',
|
|
15
15
|
};
|
|
16
|
-
const apiUrl = apiUrls[sanityEnv] ?? apiUrls.default;
|
|
16
|
+
const apiUrl = sanityEnv ? (apiUrls[sanityEnv] ?? sanityEnv) : apiUrls.default;
|
|
17
17
|
let _token;
|
|
18
18
|
function loadToken() {
|
|
19
19
|
let token = null;
|
|
@@ -5,7 +5,7 @@ import { stashAsset } from '../../actions/blueprints/assets.js';
|
|
|
5
5
|
import { setupLogStreaming } from '../../actions/blueprints/logs-streaming.js';
|
|
6
6
|
import { getStack, updateStack } from '../../actions/blueprints/stacks.js';
|
|
7
7
|
import { niceId } from '../../utils/display/presenters.js';
|
|
8
|
-
import { isLocalFunctionResource } from '../../utils/types.js';
|
|
8
|
+
import { isLocalFunctionCollection, isLocalFunctionResource } from '../../utils/types.js';
|
|
9
9
|
export async function blueprintDeployCore(options) {
|
|
10
10
|
const { bin = 'sanity', log, auth, stackId, scopeType, scopeId, deployedStack, blueprint, flags, } = options;
|
|
11
11
|
const { verbose } = flags;
|
|
@@ -13,10 +13,15 @@ export async function blueprintDeployCore(options) {
|
|
|
13
13
|
log(`Deploying "${deployedStack.name}" ${niceId(deployedStack.id)}...`);
|
|
14
14
|
try {
|
|
15
15
|
const { resources } = blueprint.parsedBlueprint;
|
|
16
|
-
const validResources = resources?.filter((r) => r.type);
|
|
17
|
-
|
|
16
|
+
const validResources = resources?.filter((r) => r.type) || [];
|
|
17
|
+
let functionResources = validResources.filter(isLocalFunctionResource);
|
|
18
|
+
const experimentalFunctionCollections = validResources.filter(isLocalFunctionCollection);
|
|
19
|
+
if (experimentalFunctionCollections.length > 0) {
|
|
20
|
+
const allFunctionResources = experimentalFunctionCollections.flatMap((r) => r.functions);
|
|
21
|
+
functionResources = [...functionResources, ...allFunctionResources];
|
|
22
|
+
}
|
|
18
23
|
// First stash all function assets
|
|
19
|
-
if (functionResources
|
|
24
|
+
if (functionResources.length > 0) {
|
|
20
25
|
log('Processing function assets...');
|
|
21
26
|
for (const resource of functionResources) {
|
|
22
27
|
const fnSpinner = ora({ text: `Processing ${resource.name}...`, prefixText: ' ' }).start();
|
|
@@ -66,7 +71,7 @@ export async function blueprintDeployCore(options) {
|
|
|
66
71
|
if (noWait) {
|
|
67
72
|
log(chalk.bold.green('Deployment started!'));
|
|
68
73
|
log(`Use \`${bin} blueprints info\` to check status`);
|
|
69
|
-
return { success: true };
|
|
74
|
+
return { success: true, data: { resources } };
|
|
70
75
|
}
|
|
71
76
|
log(chalk.dim('Deployment progress:'));
|
|
72
77
|
let logStreamCleanup = null;
|
|
@@ -99,7 +104,7 @@ export async function blueprintDeployCore(options) {
|
|
|
99
104
|
if (logStreamCleanup)
|
|
100
105
|
logStreamCleanup();
|
|
101
106
|
log(chalk.bold.green('Deployment completed!'));
|
|
102
|
-
return { success: true };
|
|
107
|
+
return { success: true, data: { resources } };
|
|
103
108
|
}
|
|
104
109
|
await setTimeout(1500);
|
|
105
110
|
}
|
|
@@ -3728,7 +3728,7 @@ const ruleNodeProp = new NodeProp({
|
|
|
3728
3728
|
combine(a, b) {
|
|
3729
3729
|
let cur, root, take;
|
|
3730
3730
|
while (a || b) {
|
|
3731
|
-
if (!a || a.depth
|
|
3731
|
+
if (!a || b && a.depth >= b.depth) {
|
|
3732
3732
|
take = b;
|
|
3733
3733
|
b = b.next;
|
|
3734
3734
|
}
|
|
@@ -3736,6 +3736,8 @@ const ruleNodeProp = new NodeProp({
|
|
|
3736
3736
|
take = a;
|
|
3737
3737
|
a = a.next;
|
|
3738
3738
|
}
|
|
3739
|
+
if (cur && cur.mode == take.mode && !take.context && !cur.context)
|
|
3740
|
+
continue;
|
|
3739
3741
|
let copy = new Rule(take.tags, take.mode, take.context);
|
|
3740
3742
|
if (cur)
|
|
3741
3743
|
cur.next = copy;
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -50,6 +50,9 @@ export interface DeployedResource extends Resource {
|
|
|
50
50
|
export declare function isLocalFunctionResource<T extends Resource>(r: T): r is T & FunctionResourceBase;
|
|
51
51
|
export declare function isDocumentFunctionResource<T extends Resource>(r: T): r is T & FunctionResourceDocument;
|
|
52
52
|
export declare function isMediaLibraryAssetFunctionResource<T extends Resource>(r: T): r is T & FunctionResourceMediaLibraryAsset;
|
|
53
|
+
export declare function isLocalFunctionCollection<T extends Resource>(r: T): r is T & {
|
|
54
|
+
functions: Array<FunctionResourceBase>;
|
|
55
|
+
};
|
|
53
56
|
/** @internal */
|
|
54
57
|
export type FunctionResource = FunctionResourceDocument | FunctionResourceMediaLibraryAsset | FunctionResourceBase;
|
|
55
58
|
export interface FunctionResourceBase extends Resource {
|
package/dist/utils/types.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
// type narrowing with predicate functions
|
|
1
2
|
export function isLocalFunctionResource(r) {
|
|
2
3
|
return r.type.startsWith('sanity.function.');
|
|
3
4
|
}
|
|
4
|
-
// annoyed that checking for equality on `type` isnt sufficient to narrow down to a specific type from a union
|
|
5
|
-
// instead need to use these type predicated
|
|
6
5
|
export function isDocumentFunctionResource(r) {
|
|
7
6
|
return r.type === 'sanity.function.document';
|
|
8
7
|
}
|
|
9
8
|
export function isMediaLibraryAssetFunctionResource(r) {
|
|
10
9
|
return r.type === 'sanity.function.media-library.asset';
|
|
11
10
|
}
|
|
11
|
+
export function isLocalFunctionCollection(r) {
|
|
12
|
+
return r.type === 'sanity.experimental.functions-collection';
|
|
13
|
+
}
|
|
12
14
|
export function isEventType(arg) {
|
|
13
15
|
return ['create', 'update', 'delete'].includes(arg);
|
|
14
16
|
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/runtime-cli",
|
|
3
3
|
"description": "Sanity's Runtime CLI for Blueprints and Functions",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.2.0",
|
|
5
5
|
"author": "Sanity Runtime Team",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -77,39 +77,39 @@
|
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@architect/hydrate": "^4.0.10",
|
|
79
79
|
"@architect/inventory": "^4.0.9",
|
|
80
|
-
"@oclif/core": "^4.
|
|
81
|
-
"@oclif/plugin-help": "^6.2.
|
|
80
|
+
"@oclif/core": "^4.8.0",
|
|
81
|
+
"@oclif/plugin-help": "^6.2.36",
|
|
82
82
|
"@sanity/blueprints-parser": "^0.3.0",
|
|
83
|
-
"@sanity/client": "^7.
|
|
83
|
+
"@sanity/client": "^7.13.0",
|
|
84
84
|
"adm-zip": "^0.5.16",
|
|
85
85
|
"array-treeify": "^0.1.5",
|
|
86
86
|
"cardinal": "^2.1.1",
|
|
87
87
|
"chalk": "^5.6.2",
|
|
88
|
-
"eventsource": "^4.
|
|
88
|
+
"eventsource": "^4.1.0",
|
|
89
89
|
"find-up": "^8.0.0",
|
|
90
90
|
"get-folder-size": "^5.0.0",
|
|
91
|
-
"groq-js": "^1.
|
|
92
|
-
"inquirer": "^12.
|
|
91
|
+
"groq-js": "^1.21.0",
|
|
92
|
+
"inquirer": "^12.11.1",
|
|
93
93
|
"jiti": "^2.6.1",
|
|
94
|
-
"mime-types": "^3.0.
|
|
94
|
+
"mime-types": "^3.0.2",
|
|
95
95
|
"ora": "^9.0.0",
|
|
96
96
|
"tar-stream": "^3.1.7",
|
|
97
|
-
"vite": "^7.
|
|
97
|
+
"vite": "^7.2.4",
|
|
98
98
|
"vite-tsconfig-paths": "^5.1.4",
|
|
99
99
|
"ws": "^8.18.3",
|
|
100
100
|
"xdg-basedir": "^5.1.0"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@biomejs/biome": "2.3.
|
|
103
|
+
"@biomejs/biome": "2.3.7",
|
|
104
104
|
"@codemirror/lang-json": "^6.0.2",
|
|
105
105
|
"@codemirror/state": "^6.5.2",
|
|
106
106
|
"@enhance/store": "^1.0.2",
|
|
107
|
-
"@lezer/highlight": "^1.2.
|
|
108
|
-
"@oclif/test": "^4.1.
|
|
107
|
+
"@lezer/highlight": "^1.2.3",
|
|
108
|
+
"@oclif/test": "^4.1.15",
|
|
109
109
|
"@playwright/test": "^1.56.1",
|
|
110
110
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
111
|
-
"@sanity/blueprints": "^0.
|
|
112
|
-
"@sanity/functions": "^1.0
|
|
111
|
+
"@sanity/blueprints": "^0.6.0",
|
|
112
|
+
"@sanity/functions": "^1.1.0",
|
|
113
113
|
"@types/adm-zip": "^0.5.7",
|
|
114
114
|
"@types/cardinal": "^2.1.1",
|
|
115
115
|
"@types/mime-types": "^3.0.1",
|
|
@@ -118,14 +118,14 @@
|
|
|
118
118
|
"@types/ws": "^8.18.1",
|
|
119
119
|
"codemirror": "^6.0.2",
|
|
120
120
|
"mentoss": "^0.12.0",
|
|
121
|
-
"oclif": "^4.22.
|
|
121
|
+
"oclif": "^4.22.50",
|
|
122
122
|
"pretty-bytes": "^7.1.0",
|
|
123
123
|
"pretty-ms": "^9.3.0",
|
|
124
|
-
"rollup": "^4.
|
|
124
|
+
"rollup": "^4.53.3",
|
|
125
125
|
"shx": "^0.4.0",
|
|
126
126
|
"ts-node": "^10.9.2",
|
|
127
127
|
"typescript": "^5.9.3",
|
|
128
|
-
"vitest": "
|
|
128
|
+
"vitest": "4.0.13"
|
|
129
129
|
},
|
|
130
130
|
"oclif": {
|
|
131
131
|
"bin": "sanity-run",
|