@sanity/runtime-cli 14.7.1 → 14.8.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 +140 -97
- package/dist/actions/blueprints/assets.d.ts +4 -3
- package/dist/actions/blueprints/assets.js +69 -101
- package/dist/actions/blueprints/blueprint.d.ts +2 -2
- package/dist/actions/blueprints/blueprint.js +1 -8
- package/dist/actions/blueprints/config.d.ts +2 -2
- package/dist/actions/blueprints/logs-streaming.d.ts +2 -2
- package/dist/actions/blueprints/logs.d.ts +2 -4
- package/dist/actions/blueprints/resources.d.ts +1 -1
- package/dist/actions/blueprints/stacks.d.ts +15 -25
- package/dist/actions/functions/dev.d.ts +1 -1
- package/dist/actions/functions/env/list.d.ts +1 -1
- package/dist/actions/functions/env/remove.d.ts +1 -1
- package/dist/actions/functions/env/update.d.ts +1 -1
- package/dist/actions/functions/logs.d.ts +3 -3
- package/dist/actions/node.d.ts +1 -1
- package/dist/actions/sanity/examples.d.ts +2 -2
- package/dist/actions/sanity/projects.d.ts +7 -13
- package/dist/baseCommands.js +2 -4
- package/dist/commands/blueprints/config.d.ts +1 -1
- package/dist/commands/blueprints/config.js +2 -1
- package/dist/commands/blueprints/deploy.d.ts +1 -1
- package/dist/commands/blueprints/deploy.js +2 -1
- package/dist/commands/blueprints/destroy.d.ts +1 -1
- package/dist/commands/blueprints/destroy.js +2 -1
- package/dist/commands/blueprints/doctor.js +2 -2
- package/dist/commands/blueprints/info.d.ts +1 -1
- package/dist/commands/blueprints/info.js +2 -1
- package/dist/commands/blueprints/plan.d.ts +1 -1
- package/dist/commands/blueprints/plan.js +2 -1
- package/dist/commands/blueprints/promote.js +2 -2
- package/dist/commands/blueprints/stacks.d.ts +1 -1
- package/dist/commands/blueprints/stacks.js +2 -1
- package/dist/commands/functions/build.d.ts +1 -1
- package/dist/commands/functions/build.js +2 -1
- package/dist/commands/functions/env/add.d.ts +1 -1
- package/dist/commands/functions/env/add.js +2 -1
- package/dist/commands/functions/env/list.d.ts +1 -1
- package/dist/commands/functions/env/list.js +2 -1
- package/dist/commands/functions/env/remove.d.ts +1 -1
- package/dist/commands/functions/env/remove.js +2 -1
- package/dist/commands/functions/logs.d.ts +0 -1
- package/dist/commands/functions/logs.js +0 -5
- package/dist/commands/functions/test.d.ts +1 -1
- package/dist/commands/functions/test.js +2 -1
- package/dist/cores/blueprints/config.js +5 -5
- package/dist/cores/blueprints/deploy.js +62 -74
- package/dist/cores/blueprints/destroy.js +3 -3
- package/dist/cores/blueprints/doctor.js +5 -1
- package/dist/cores/blueprints/info.js +1 -1
- package/dist/cores/blueprints/init.d.ts +4 -3
- package/dist/cores/blueprints/plan.js +7 -1
- package/dist/cores/blueprints/promote.js +4 -1
- package/dist/cores/blueprints/stacks.js +6 -2
- package/dist/cores/functions/build.js +2 -2
- package/dist/cores/functions/env/add.js +1 -1
- package/dist/cores/functions/env/list.js +1 -1
- package/dist/cores/functions/env/remove.js +1 -1
- package/dist/cores/functions/test.js +4 -4
- package/dist/cores/index.d.ts +9 -2
- package/dist/cores/index.js +3 -2
- package/dist/server/app.d.ts +1 -1
- package/dist/server/handlers/invoke.d.ts +1 -1
- package/dist/utils/display/prompt.d.ts +2 -2
- package/dist/utils/display/prompt.js +1 -1
- package/dist/utils/functions/detect-native-modules.js +4 -1
- package/dist/utils/functions/fetch-document.d.ts +2 -2
- package/dist/utils/functions/prepare-asset.d.ts +2 -7
- package/dist/utils/functions/prepare-asset.js +2 -2
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/logger.js +2 -0
- package/dist/utils/other/github.d.ts +1 -1
- package/dist/utils/other/npmjs.d.ts +1 -1
- package/dist/utils/traced-fetch.d.ts +1 -1
- package/dist/utils/types.d.ts +16 -2
- package/dist/utils/types.js +5 -4
- package/dist/utils/validate/resource.d.ts +0 -3
- package/dist/utils/validate/resource.js +0 -270
- package/dist/utils/validated-token.d.ts +2 -2
- package/oclif.manifest.json +20 -58
- package/package.json +2 -2
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/14.
|
|
23
|
+
@sanity/runtime-cli/14.8.0 linux-x64 node-v24.14.0
|
|
24
24
|
$ sanity-run --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ sanity-run COMMAND
|
|
@@ -54,7 +54,7 @@ Add a function resource to a Blueprint
|
|
|
54
54
|
|
|
55
55
|
```
|
|
56
56
|
USAGE
|
|
57
|
-
$ sanity-run blueprints add TYPE [--example <value> | -n <value> | --fn-type
|
|
57
|
+
$ sanity-run blueprints add TYPE [--json] [--validate-resources] [--example <value> | -n <value> | --fn-type
|
|
58
58
|
document-publish|document-create|document-update|document-delete|media-library-asset-create|media-library-asset-upda
|
|
59
59
|
te|media-library-asset-delete|scheduled-function... | --language ts|js | --javascript | --fn-helpers |
|
|
60
60
|
--fn-installer skip|npm|pnpm|yarn] [-i | ]
|
|
@@ -63,20 +63,23 @@ ARGUMENTS
|
|
|
63
63
|
TYPE (function) Type of resource to add (only "function" is supported)
|
|
64
64
|
|
|
65
65
|
FLAGS
|
|
66
|
-
-i, --install
|
|
67
|
-
-n, --name=<value>
|
|
68
|
-
--example=<value>
|
|
69
|
-
|
|
70
|
-
--[no-]fn-helpers
|
|
71
|
-
--fn-installer=<option>
|
|
72
|
-
|
|
73
|
-
--fn-type=<option>...
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
--
|
|
79
|
-
|
|
66
|
+
-i, --install Shortcut for --fn-installer npm
|
|
67
|
+
-n, --name=<value> Name of the resource to add
|
|
68
|
+
--example=<value> Example to use for the function resource. Discover examples at
|
|
69
|
+
https://www.sanity.io/exchange/type=recipes/by=sanity
|
|
70
|
+
--[no-]fn-helpers Add helpers to the new function
|
|
71
|
+
--fn-installer=<option> Which package manager to use when installing the @sanity/functions helpers
|
|
72
|
+
<options: skip|npm|pnpm|yarn>
|
|
73
|
+
--fn-type=<option>... Document change event(s) that should trigger the function; you can specify multiple
|
|
74
|
+
events by specifying this flag multiple times
|
|
75
|
+
<options:
|
|
76
|
+
document-publish|document-create|document-update|document-delete|media-library-asset-cr
|
|
77
|
+
eate|media-library-asset-update|media-library-asset-delete|scheduled-function>
|
|
78
|
+
--javascript Use JavaScript instead of TypeScript
|
|
79
|
+
--json Format output as json
|
|
80
|
+
--language=<option> [default: ts] Language of the new function
|
|
81
|
+
<options: ts|js>
|
|
82
|
+
--[no-]validate-resources Validate resources
|
|
80
83
|
|
|
81
84
|
DESCRIPTION
|
|
82
85
|
Add a function resource to a Blueprint
|
|
@@ -98,7 +101,7 @@ EXAMPLES
|
|
|
98
101
|
$ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
|
|
99
102
|
```
|
|
100
103
|
|
|
101
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
104
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/blueprints/add.ts)_
|
|
102
105
|
|
|
103
106
|
## `sanity-run blueprints config`
|
|
104
107
|
|
|
@@ -106,12 +109,14 @@ View or edit the local Blueprint configuration
|
|
|
106
109
|
|
|
107
110
|
```
|
|
108
111
|
USAGE
|
|
109
|
-
$ sanity-run blueprints config [--project-id <value> -e] [--stack <value> ]
|
|
112
|
+
$ sanity-run blueprints config [--json] [--validate-resources] [--project-id <value> -e] [--stack <value> ]
|
|
110
113
|
|
|
111
114
|
FLAGS
|
|
112
|
-
-e, --edit
|
|
113
|
-
--
|
|
114
|
-
--
|
|
115
|
+
-e, --edit Modify the configuration interactively, or directly when combined with ID flags.
|
|
116
|
+
--json Format output as json
|
|
117
|
+
--project-id=<value> Directly set the project ID in the configuration. Requires --edit flag
|
|
118
|
+
--stack=<value> Stack name or ID to set in the configuration. Requires --edit flag
|
|
119
|
+
--[no-]validate-resources Validate resources
|
|
115
120
|
|
|
116
121
|
DESCRIPTION
|
|
117
122
|
View or edit the local Blueprint configuration
|
|
@@ -133,7 +138,7 @@ EXAMPLES
|
|
|
133
138
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
|
|
134
139
|
```
|
|
135
140
|
|
|
136
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
141
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/blueprints/config.ts)_
|
|
137
142
|
|
|
138
143
|
## `sanity-run blueprints deploy`
|
|
139
144
|
|
|
@@ -141,11 +146,13 @@ Deploy the local Blueprint to the remote Stack
|
|
|
141
146
|
|
|
142
147
|
```
|
|
143
148
|
USAGE
|
|
144
|
-
$ sanity-run blueprints deploy [--stack <value>] [--no-wait]
|
|
149
|
+
$ sanity-run blueprints deploy [--json] [--validate-resources] [--stack <value>] [--no-wait]
|
|
145
150
|
|
|
146
151
|
FLAGS
|
|
147
|
-
--
|
|
148
|
-
--
|
|
152
|
+
--json Format output as json
|
|
153
|
+
--no-wait Do not wait for Stack deployment to complete
|
|
154
|
+
--stack=<value> Stack name or ID to use instead of the locally configured Stack
|
|
155
|
+
--[no-]validate-resources Validate resources
|
|
149
156
|
|
|
150
157
|
DESCRIPTION
|
|
151
158
|
Deploy the local Blueprint to the remote Stack
|
|
@@ -170,7 +177,7 @@ EXAMPLES
|
|
|
170
177
|
$ sanity-run blueprints deploy --fn-installer npm
|
|
171
178
|
```
|
|
172
179
|
|
|
173
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
180
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/blueprints/deploy.ts)_
|
|
174
181
|
|
|
175
182
|
## `sanity-run blueprints destroy`
|
|
176
183
|
|
|
@@ -178,13 +185,16 @@ Destroy the remote Stack deployment and its resources (will not delete local fil
|
|
|
178
185
|
|
|
179
186
|
```
|
|
180
187
|
USAGE
|
|
181
|
-
$ sanity-run blueprints destroy [--project-id <value> --stack <value> --force]
|
|
188
|
+
$ sanity-run blueprints destroy [--json] [--validate-resources] [--project-id <value> --stack <value> --force]
|
|
189
|
+
[--no-wait]
|
|
182
190
|
|
|
183
191
|
FLAGS
|
|
184
|
-
--force
|
|
185
|
-
--
|
|
186
|
-
--
|
|
187
|
-
--
|
|
192
|
+
--force Force Stack destruction (skip confirmation)
|
|
193
|
+
--json Format output as json
|
|
194
|
+
--no-wait Do not wait for Stack destruction to complete
|
|
195
|
+
--project-id=<value> Project associated with the Stack
|
|
196
|
+
--stack=<value> Stack name or ID to destroy (defaults to the locally configured Stack)
|
|
197
|
+
--[no-]validate-resources Validate resources
|
|
188
198
|
|
|
189
199
|
DESCRIPTION
|
|
190
200
|
Destroy the remote Stack deployment and its resources (will not delete local files)
|
|
@@ -202,7 +212,7 @@ EXAMPLES
|
|
|
202
212
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
203
213
|
```
|
|
204
214
|
|
|
205
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
215
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/blueprints/destroy.ts)_
|
|
206
216
|
|
|
207
217
|
## `sanity-run blueprints doctor`
|
|
208
218
|
|
|
@@ -210,13 +220,14 @@ Diagnose potential issues with local Blueprint and remote Stack configuration
|
|
|
210
220
|
|
|
211
221
|
```
|
|
212
222
|
USAGE
|
|
213
|
-
$ sanity-run blueprints doctor [--json] [-p <value>] [--verbose] [--fix]
|
|
223
|
+
$ sanity-run blueprints doctor [--json] [-p <value>] [--validate-resources] [--verbose] [--fix]
|
|
214
224
|
|
|
215
225
|
FLAGS
|
|
216
|
-
-p, --path=<value>
|
|
217
|
-
--fix
|
|
218
|
-
--json
|
|
219
|
-
--[no-]
|
|
226
|
+
-p, --path=<value> [env: SANITY_BLUEPRINT_PATH] Path to a Blueprint file or directory containing one
|
|
227
|
+
--fix Interactively fix configuration issues
|
|
228
|
+
--json Format output as json
|
|
229
|
+
--[no-]validate-resources Validate resources
|
|
230
|
+
--[no-]verbose Verbose output; defaults to true
|
|
220
231
|
|
|
221
232
|
DESCRIPTION
|
|
222
233
|
Diagnose potential issues with local Blueprint and remote Stack configuration
|
|
@@ -228,7 +239,7 @@ DESCRIPTION
|
|
|
228
239
|
issues.
|
|
229
240
|
```
|
|
230
241
|
|
|
231
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
242
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/blueprints/doctor.ts)_
|
|
232
243
|
|
|
233
244
|
## `sanity-run blueprints info`
|
|
234
245
|
|
|
@@ -236,10 +247,12 @@ Show information about the local Blueprint's remote Stack deployment
|
|
|
236
247
|
|
|
237
248
|
```
|
|
238
249
|
USAGE
|
|
239
|
-
$ sanity-run blueprints info [--stack <value>]
|
|
250
|
+
$ sanity-run blueprints info [--json] [--validate-resources] [--stack <value>]
|
|
240
251
|
|
|
241
252
|
FLAGS
|
|
242
|
-
--
|
|
253
|
+
--json Format output as json
|
|
254
|
+
--stack=<value> Stack name or ID to use instead of the locally configured Stack
|
|
255
|
+
--[no-]validate-resources Validate resources
|
|
243
256
|
|
|
244
257
|
DESCRIPTION
|
|
245
258
|
Show information about the local Blueprint's remote Stack deployment
|
|
@@ -258,7 +271,7 @@ EXAMPLES
|
|
|
258
271
|
$ sanity-run blueprints info --stack <name-or-id>
|
|
259
272
|
```
|
|
260
273
|
|
|
261
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
274
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/blueprints/info.ts)_
|
|
262
275
|
|
|
263
276
|
## `sanity-run blueprints init [DIR]`
|
|
264
277
|
|
|
@@ -266,8 +279,8 @@ Initialize a local Blueprint and optionally provision a remote Stack deployment
|
|
|
266
279
|
|
|
267
280
|
```
|
|
268
281
|
USAGE
|
|
269
|
-
$ sanity-run blueprints init [DIR] [--verbose] [--dir <value>] [--example <value> |
|
|
270
|
-
--stack-id <value> | --stack-name <value>] [--project-id <value>]
|
|
282
|
+
$ sanity-run blueprints init [DIR] [--json] [--validate-resources] [--verbose] [--dir <value>] [--example <value> |
|
|
283
|
+
--blueprint-type json|js|ts | --stack-id <value> | --stack-name <value>] [--project-id <value>]
|
|
271
284
|
|
|
272
285
|
ARGUMENTS
|
|
273
286
|
[DIR] Directory to create the local Blueprint in
|
|
@@ -277,9 +290,11 @@ FLAGS
|
|
|
277
290
|
<options: json|js|ts>
|
|
278
291
|
--dir=<value> Directory to create the local Blueprint in
|
|
279
292
|
--example=<value> Example to use for the local Blueprint
|
|
293
|
+
--json Format output as json
|
|
280
294
|
--project-id=<value> Sanity project ID used to scope local Blueprint and remote Stack
|
|
281
295
|
--stack-id=<value> Existing Stack ID used to scope local Blueprint
|
|
282
296
|
--stack-name=<value> Name to use for a new Stack provisioned during initialization
|
|
297
|
+
--[no-]validate-resources Validate resources
|
|
283
298
|
--verbose Verbose output
|
|
284
299
|
|
|
285
300
|
DESCRIPTION
|
|
@@ -308,7 +323,7 @@ EXAMPLES
|
|
|
308
323
|
$ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
|
|
309
324
|
```
|
|
310
325
|
|
|
311
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
326
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/blueprints/init.ts)_
|
|
312
327
|
|
|
313
328
|
## `sanity-run blueprints logs`
|
|
314
329
|
|
|
@@ -316,11 +331,13 @@ Display logs for the current Blueprint's Stack deployment
|
|
|
316
331
|
|
|
317
332
|
```
|
|
318
333
|
USAGE
|
|
319
|
-
$ sanity-run blueprints logs [--stack <value>] [-w]
|
|
334
|
+
$ sanity-run blueprints logs [--json] [--validate-resources] [--stack <value>] [-w]
|
|
320
335
|
|
|
321
336
|
FLAGS
|
|
322
|
-
-w, --watch
|
|
323
|
-
--
|
|
337
|
+
-w, --watch Watch for new Stack logs (streaming mode)
|
|
338
|
+
--json Format output as json
|
|
339
|
+
--stack=<value> Stack name or ID to use instead of the locally configured Stack
|
|
340
|
+
--[no-]validate-resources Validate resources
|
|
324
341
|
|
|
325
342
|
DESCRIPTION
|
|
326
343
|
Display logs for the current Blueprint's Stack deployment
|
|
@@ -337,7 +354,7 @@ EXAMPLES
|
|
|
337
354
|
$ sanity-run blueprints logs --watch
|
|
338
355
|
```
|
|
339
356
|
|
|
340
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
357
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/blueprints/logs.ts)_
|
|
341
358
|
|
|
342
359
|
## `sanity-run blueprints plan`
|
|
343
360
|
|
|
@@ -345,10 +362,12 @@ Enumerate resources to be deployed to the remote Stack - will not modify any res
|
|
|
345
362
|
|
|
346
363
|
```
|
|
347
364
|
USAGE
|
|
348
|
-
$ sanity-run blueprints plan [--stack <value>]
|
|
365
|
+
$ sanity-run blueprints plan [--json] [--validate-resources] [--stack <value>]
|
|
349
366
|
|
|
350
367
|
FLAGS
|
|
351
|
-
--
|
|
368
|
+
--json Format output as json
|
|
369
|
+
--stack=<value> Stack name or ID to use instead of the locally configured Stack
|
|
370
|
+
--[no-]validate-resources Validate resources
|
|
352
371
|
|
|
353
372
|
DESCRIPTION
|
|
354
373
|
Enumerate resources to be deployed to the remote Stack - will not modify any resources
|
|
@@ -363,7 +382,7 @@ EXAMPLES
|
|
|
363
382
|
$ sanity-run blueprints plan
|
|
364
383
|
```
|
|
365
384
|
|
|
366
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
385
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/blueprints/plan.ts)_
|
|
367
386
|
|
|
368
387
|
## `sanity-run blueprints stacks`
|
|
369
388
|
|
|
@@ -371,10 +390,12 @@ List all remote Stack deployments (defaults to the current Blueprint's project s
|
|
|
371
390
|
|
|
372
391
|
```
|
|
373
392
|
USAGE
|
|
374
|
-
$ sanity-run blueprints stacks [--project-id <value> | ]
|
|
393
|
+
$ sanity-run blueprints stacks [--json] [--validate-resources] [--project-id <value> | ]
|
|
375
394
|
|
|
376
395
|
FLAGS
|
|
377
|
-
--
|
|
396
|
+
--json Format output as json
|
|
397
|
+
--project-id=<value> Project ID to show Stack deployments for
|
|
398
|
+
--[no-]validate-resources Validate resources
|
|
378
399
|
|
|
379
400
|
DESCRIPTION
|
|
380
401
|
List all remote Stack deployments (defaults to the current Blueprint's project scope)
|
|
@@ -392,7 +413,7 @@ EXAMPLES
|
|
|
392
413
|
$ sanity-run blueprints stacks --organization-id <organizationId>
|
|
393
414
|
```
|
|
394
415
|
|
|
395
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
416
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/blueprints/stacks.ts)_
|
|
396
417
|
|
|
397
418
|
## `sanity-run functions add`
|
|
398
419
|
|
|
@@ -400,24 +421,28 @@ Add a Function to your Blueprint
|
|
|
400
421
|
|
|
401
422
|
```
|
|
402
423
|
USAGE
|
|
403
|
-
$ sanity-run functions add [--example <value> | -n <value> | | --language ts|js
|
|
404
|
-
document-publish|document-create|document-update|document-delete|media-library-asset-
|
|
405
|
-
|
|
424
|
+
$ sanity-run functions add [--json] [--validate-resources] [--example <value> | -n <value> | | --language ts|js
|
|
425
|
+
| --javascript | | ] [--type document-publish|document-create|document-update|document-delete|media-library-asset-c
|
|
426
|
+
reate|media-library-asset-update|media-library-asset-delete|scheduled-function... ] [--helpers] [--installer
|
|
427
|
+
skip|npm|pnpm|yarn] [-i | ]
|
|
406
428
|
|
|
407
429
|
FLAGS
|
|
408
|
-
-i, --install
|
|
409
|
-
-n, --name=<value>
|
|
410
|
-
--example=<value>
|
|
411
|
-
--[no-]helpers
|
|
412
|
-
--installer=<option>
|
|
413
|
-
|
|
414
|
-
--javascript
|
|
415
|
-
--
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
430
|
+
-i, --install Shortcut for --fn-installer npm
|
|
431
|
+
-n, --name=<value> Name of the Function to add
|
|
432
|
+
--example=<value> Example to use for the Function
|
|
433
|
+
--[no-]helpers Add helpers to the new Function
|
|
434
|
+
--installer=<option> How to install the @sanity/functions helpers
|
|
435
|
+
<options: skip|npm|pnpm|yarn>
|
|
436
|
+
--javascript Use JavaScript instead of TypeScript
|
|
437
|
+
--json Format output as json
|
|
438
|
+
--language=<option> [default: ts] Language of the new Function
|
|
439
|
+
<options: ts|js>
|
|
440
|
+
--type=<option>... Document change event(s) that should trigger the function; you can specify multiple
|
|
441
|
+
events by specifying this flag multiple times
|
|
442
|
+
<options:
|
|
443
|
+
document-publish|document-create|document-update|document-delete|media-library-asset-cr
|
|
444
|
+
eate|media-library-asset-update|media-library-asset-delete|scheduled-function>
|
|
445
|
+
--[no-]validate-resources Validate resources
|
|
421
446
|
|
|
422
447
|
DESCRIPTION
|
|
423
448
|
Add a Function to your Blueprint
|
|
@@ -441,7 +466,7 @@ EXAMPLES
|
|
|
441
466
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
442
467
|
```
|
|
443
468
|
|
|
444
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
469
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/functions/add.ts)_
|
|
445
470
|
|
|
446
471
|
## `sanity-run functions dev`
|
|
447
472
|
|
|
@@ -449,13 +474,15 @@ Start the Sanity Function emulator
|
|
|
449
474
|
|
|
450
475
|
```
|
|
451
476
|
USAGE
|
|
452
|
-
$ sanity-run functions dev [-h <value>] [-p <value>] [-t <value>]
|
|
477
|
+
$ sanity-run functions dev [--json] [--validate-resources] [-h <value>] [-p <value>] [-t <value>]
|
|
453
478
|
|
|
454
479
|
FLAGS
|
|
455
|
-
-h, --host=<value>
|
|
456
|
-
-p, --port=<value>
|
|
457
|
-
-t, --timeout=<value>
|
|
458
|
-
|
|
480
|
+
-h, --host=<value> The local network interface at which to listen. [default: "localhost"]
|
|
481
|
+
-p, --port=<value> TCP port to start emulator on. [default: 8080]
|
|
482
|
+
-t, --timeout=<value> Maximum execution time for all functions, in seconds. Takes precedence over
|
|
483
|
+
function-specific `timeout`
|
|
484
|
+
--json Format output as json
|
|
485
|
+
--[no-]validate-resources Validate resources
|
|
459
486
|
|
|
460
487
|
DESCRIPTION
|
|
461
488
|
Start the Sanity Function emulator
|
|
@@ -475,7 +502,7 @@ EXAMPLES
|
|
|
475
502
|
$ sanity-run functions dev --timeout 60
|
|
476
503
|
```
|
|
477
504
|
|
|
478
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
505
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/functions/dev.ts)_
|
|
479
506
|
|
|
480
507
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
481
508
|
|
|
@@ -483,13 +510,17 @@ Add or set an environment variable for a deployed function
|
|
|
483
510
|
|
|
484
511
|
```
|
|
485
512
|
USAGE
|
|
486
|
-
$ sanity-run functions env add NAME KEY VALUE
|
|
513
|
+
$ sanity-run functions env add NAME KEY VALUE [--json] [--validate-resources]
|
|
487
514
|
|
|
488
515
|
ARGUMENTS
|
|
489
516
|
NAME The name of the Sanity Function
|
|
490
517
|
KEY The name of the environment variable
|
|
491
518
|
VALUE The value of the environment variable
|
|
492
519
|
|
|
520
|
+
FLAGS
|
|
521
|
+
--json Format output as json
|
|
522
|
+
--[no-]validate-resources Validate resources
|
|
523
|
+
|
|
493
524
|
DESCRIPTION
|
|
494
525
|
Add or set an environment variable for a deployed function
|
|
495
526
|
|
|
@@ -502,7 +533,7 @@ EXAMPLES
|
|
|
502
533
|
$ sanity-run functions env add MyFunction API_URL https://api.example.com/
|
|
503
534
|
```
|
|
504
535
|
|
|
505
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
536
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/functions/env/add.ts)_
|
|
506
537
|
|
|
507
538
|
## `sanity-run functions env list NAME`
|
|
508
539
|
|
|
@@ -510,11 +541,15 @@ List environment variables for a deployed function
|
|
|
510
541
|
|
|
511
542
|
```
|
|
512
543
|
USAGE
|
|
513
|
-
$ sanity-run functions env list NAME
|
|
544
|
+
$ sanity-run functions env list NAME [--json] [--validate-resources]
|
|
514
545
|
|
|
515
546
|
ARGUMENTS
|
|
516
547
|
NAME The name of the Sanity Function
|
|
517
548
|
|
|
549
|
+
FLAGS
|
|
550
|
+
--json Format output as json
|
|
551
|
+
--[no-]validate-resources Validate resources
|
|
552
|
+
|
|
518
553
|
DESCRIPTION
|
|
519
554
|
List environment variables for a deployed function
|
|
520
555
|
|
|
@@ -526,7 +561,7 @@ EXAMPLES
|
|
|
526
561
|
$ sanity-run functions env list MyFunction
|
|
527
562
|
```
|
|
528
563
|
|
|
529
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
564
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/functions/env/list.ts)_
|
|
530
565
|
|
|
531
566
|
## `sanity-run functions env remove NAME KEY`
|
|
532
567
|
|
|
@@ -534,12 +569,16 @@ Remove an environment variable from a deployed function
|
|
|
534
569
|
|
|
535
570
|
```
|
|
536
571
|
USAGE
|
|
537
|
-
$ sanity-run functions env remove NAME KEY
|
|
572
|
+
$ sanity-run functions env remove NAME KEY [--json] [--validate-resources]
|
|
538
573
|
|
|
539
574
|
ARGUMENTS
|
|
540
575
|
NAME The name of the Sanity Function
|
|
541
576
|
KEY The name of the environment variable
|
|
542
577
|
|
|
578
|
+
FLAGS
|
|
579
|
+
--json Format output as json
|
|
580
|
+
--[no-]validate-resources Validate resources
|
|
581
|
+
|
|
543
582
|
DESCRIPTION
|
|
544
583
|
Remove an environment variable from a deployed function
|
|
545
584
|
|
|
@@ -552,7 +591,7 @@ EXAMPLES
|
|
|
552
591
|
$ sanity-run functions env remove MyFunction API_URL
|
|
553
592
|
```
|
|
554
593
|
|
|
555
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
594
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/functions/env/remove.ts)_
|
|
556
595
|
|
|
557
596
|
## `sanity-run functions logs [NAME]`
|
|
558
597
|
|
|
@@ -560,19 +599,21 @@ Retrieve or delete logs for a Sanity Function
|
|
|
560
599
|
|
|
561
600
|
```
|
|
562
601
|
USAGE
|
|
563
|
-
$ sanity-run functions logs [NAME] [--stack <value>] [-u] [-f [-d | -l <value> |
|
|
602
|
+
$ sanity-run functions logs [NAME] [--validate-resources] [--stack <value>] [-u] [-f [-d | -l <value> | --json]]
|
|
603
|
+
[-w]
|
|
564
604
|
|
|
565
605
|
ARGUMENTS
|
|
566
606
|
[NAME] The name of the Sanity Function
|
|
567
607
|
|
|
568
608
|
FLAGS
|
|
569
|
-
-d, --delete
|
|
570
|
-
-f, --force
|
|
571
|
-
-
|
|
572
|
-
-
|
|
573
|
-
-
|
|
574
|
-
|
|
575
|
-
--stack=<value>
|
|
609
|
+
-d, --delete Delete all logs for the function
|
|
610
|
+
-f, --force Skip confirmation for deleting logs
|
|
611
|
+
-l, --limit=<value> [default: 50] Total number of log entries to retrieve
|
|
612
|
+
-u, --utc Show dates in UTC time zone
|
|
613
|
+
-w, --watch Watch for new logs (streaming mode)
|
|
614
|
+
--json Format output as json
|
|
615
|
+
--stack=<value> Stack name or ID to use instead of the locally configured Stack
|
|
616
|
+
--[no-]validate-resources Validate resources
|
|
576
617
|
|
|
577
618
|
DESCRIPTION
|
|
578
619
|
Retrieve or delete logs for a Sanity Function
|
|
@@ -592,7 +633,7 @@ EXAMPLES
|
|
|
592
633
|
$ sanity-run functions logs <name> --delete
|
|
593
634
|
```
|
|
594
635
|
|
|
595
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
636
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/functions/logs.ts)_
|
|
596
637
|
|
|
597
638
|
## `sanity-run functions test [NAME]`
|
|
598
639
|
|
|
@@ -600,10 +641,10 @@ Invoke a local Sanity Function
|
|
|
600
641
|
|
|
601
642
|
```
|
|
602
643
|
USAGE
|
|
603
|
-
$ sanity-run functions test [NAME] [--data-before <value> | [-d <value> | -f
|
|
604
|
-
| --
|
|
605
|
-
[--data-after <value> | | | | | | | ] [-e create|update|delete] [-t <value>]
|
|
606
|
-
[--media-library-id <value> | --project-id <value> | --dataset <value>]
|
|
644
|
+
$ sanity-run functions test [NAME] [--json] [--validate-resources] [--data-before <value> | [-d <value> | -f
|
|
645
|
+
<value> | --document-id <value>] | | | --file-before <value> | --file-after <value> | --document-id-before <value>
|
|
646
|
+
| --document-id-after <value>] [--data-after <value> | | | | | | | ] [-e create|update|delete] [-t <value>]
|
|
647
|
+
[-a <value>] [--with-user-token] [--media-library-id <value> | --project-id <value> | --dataset <value>]
|
|
607
648
|
|
|
608
649
|
ARGUMENTS
|
|
609
650
|
[NAME] The name of the Sanity Function
|
|
@@ -623,8 +664,10 @@ FLAGS
|
|
|
623
664
|
--document-id-before=<value> Original document
|
|
624
665
|
--file-after=<value> Current document
|
|
625
666
|
--file-before=<value> Original document
|
|
667
|
+
--json Format output as json
|
|
626
668
|
--media-library-id=<value> Sanity Media Library ID to use
|
|
627
669
|
--project-id=<value> Sanity Project ID to use
|
|
670
|
+
--[no-]validate-resources Validate resources
|
|
628
671
|
--with-user-token Prime access token from CLI config
|
|
629
672
|
|
|
630
673
|
DESCRIPTION
|
|
@@ -646,7 +689,7 @@ EXAMPLES
|
|
|
646
689
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
647
690
|
```
|
|
648
691
|
|
|
649
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
692
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.0/src/commands/functions/test.ts)_
|
|
650
693
|
|
|
651
694
|
## `sanity-run help [COMMAND]`
|
|
652
695
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import type { Resource } from '@sanity/blueprints-parser';
|
|
1
2
|
import AdmZip from 'adm-zip';
|
|
2
3
|
import type { Logger } from '../../utils/logger.js';
|
|
3
|
-
import type { AuthParams,
|
|
4
|
+
import type { AuthParams, InstallerType } from '../../utils/types.js';
|
|
4
5
|
export declare const ASSET_CHECK_URL: string;
|
|
5
6
|
export declare const ASSET_STASH_URL: string;
|
|
6
7
|
export declare function stashAsset({ resource, auth, logger, installer, }: {
|
|
7
|
-
resource:
|
|
8
|
+
resource: Resource;
|
|
8
9
|
auth: AuthParams;
|
|
9
|
-
logger:
|
|
10
|
+
logger: Logger;
|
|
10
11
|
installer?: InstallerType;
|
|
11
12
|
}): Promise<{
|
|
12
13
|
success: boolean;
|