@sanity/runtime-cli 10.11.3 → 11.0.3
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 +84 -34
- package/dist/actions/blueprints/index.d.ts +2 -29
- package/dist/actions/blueprints/index.js +0 -42
- package/dist/baseCommands.d.ts +5 -4
- package/dist/baseCommands.js +6 -4
- package/dist/commands/blueprints/add.d.ts +5 -0
- package/dist/commands/blueprints/add.js +34 -8
- package/dist/commands/blueprints/config.d.ts +1 -0
- package/dist/commands/blueprints/config.js +5 -0
- package/dist/commands/blueprints/deploy.js +2 -1
- package/dist/commands/blueprints/destroy.d.ts +1 -0
- package/dist/commands/blueprints/destroy.js +6 -1
- package/dist/commands/blueprints/init.d.ts +1 -0
- package/dist/commands/blueprints/init.js +4 -0
- package/dist/commands/blueprints/stacks.d.ts +1 -0
- package/dist/commands/blueprints/stacks.js +7 -0
- package/dist/commands/functions/add.d.ts +16 -0
- package/dist/commands/functions/add.js +65 -0
- package/dist/commands/functions/env/add.js +2 -1
- package/dist/commands/functions/env/list.js +2 -1
- package/dist/commands/functions/env/remove.js +2 -1
- package/dist/commands/functions/logs.js +2 -1
- package/dist/commands/functions/test.d.ts +1 -0
- package/dist/commands/functions/test.js +5 -0
- package/dist/cores/blueprints/config.d.ts +1 -0
- package/dist/cores/blueprints/config.js +45 -149
- package/dist/cores/blueprints/deploy.d.ts +3 -2
- package/dist/cores/blueprints/deploy.js +3 -3
- package/dist/cores/blueprints/destroy.d.ts +1 -0
- package/dist/cores/blueprints/destroy.js +20 -7
- package/dist/cores/blueprints/doctor.js +43 -4
- package/dist/cores/blueprints/index.d.ts +0 -2
- package/dist/cores/blueprints/index.js +0 -1
- package/dist/cores/blueprints/init.d.ts +1 -0
- package/dist/cores/blueprints/init.js +3 -1
- package/dist/cores/blueprints/plan.js +3 -3
- package/dist/cores/blueprints/stacks.d.ts +1 -0
- package/dist/cores/blueprints/stacks.js +22 -7
- package/dist/cores/{blueprints → functions}/add.d.ts +5 -8
- package/dist/cores/{blueprints → functions}/add.js +22 -43
- package/dist/cores/functions/index.d.ts +2 -0
- package/dist/cores/functions/index.js +1 -0
- package/dist/cores/functions/test.d.ts +1 -0
- package/dist/cores/functions/test.js +2 -4
- package/dist/cores/index.d.ts +3 -2
- package/dist/cores/index.js +9 -8
- package/dist/server/static/index.html +1 -1
- package/dist/server/static/vendor/vendor.bundle.js +30 -5
- package/dist/utils/display/errors.js +5 -2
- package/dist/utils/display/presenters.d.ts +1 -0
- package/dist/utils/display/presenters.js +3 -0
- package/dist/utils/types.d.ts +1 -0
- package/oclif.manifest.json +212 -3
- package/package.json +23 -26
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/
|
|
23
|
+
@sanity/runtime-cli/11.0.3 linux-x64 node-v24.10.0
|
|
24
24
|
$ sanity-run --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ sanity-run COMMAND
|
|
@@ -39,6 +39,7 @@ USAGE
|
|
|
39
39
|
* [`sanity-run blueprints logs`](#sanity-run-blueprints-logs)
|
|
40
40
|
* [`sanity-run blueprints plan`](#sanity-run-blueprints-plan)
|
|
41
41
|
* [`sanity-run blueprints stacks`](#sanity-run-blueprints-stacks)
|
|
42
|
+
* [`sanity-run functions add`](#sanity-run-functions-add)
|
|
42
43
|
* [`sanity-run functions dev`](#sanity-run-functions-dev)
|
|
43
44
|
* [`sanity-run functions env add NAME KEY VALUE`](#sanity-run-functions-env-add-name-key-value)
|
|
44
45
|
* [`sanity-run functions env list NAME`](#sanity-run-functions-env-list-name)
|
|
@@ -89,7 +90,7 @@ EXAMPLES
|
|
|
89
90
|
$ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
|
|
90
91
|
```
|
|
91
92
|
|
|
92
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
93
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/blueprints/add.ts)_
|
|
93
94
|
|
|
94
95
|
## `sanity-run blueprints config`
|
|
95
96
|
|
|
@@ -97,13 +98,14 @@ View or edit Blueprint configuration
|
|
|
97
98
|
|
|
98
99
|
```
|
|
99
100
|
USAGE
|
|
100
|
-
$ sanity-run blueprints config [-t] [--project-id <value> -e] [--stack-id <value> ]
|
|
101
|
+
$ sanity-run blueprints config [-t] [--project-id <value> -e] [--organization-id <value> ] [--stack-id <value> ]
|
|
101
102
|
|
|
102
103
|
FLAGS
|
|
103
|
-
-e, --edit
|
|
104
|
-
-t, --test-config
|
|
105
|
-
--
|
|
106
|
-
--
|
|
104
|
+
-e, --edit Edit the configuration
|
|
105
|
+
-t, --test-config Validate the configuration
|
|
106
|
+
--organization-id=<value> Update the Organization ID in the configuration. Requires --edit flag
|
|
107
|
+
--project-id=<value> Update the Project ID in the configuration. Requires --edit flag
|
|
108
|
+
--stack-id=<value> Update the Stack ID in the configuration. Requires --edit flag
|
|
107
109
|
|
|
108
110
|
DESCRIPTION
|
|
109
111
|
View or edit Blueprint configuration
|
|
@@ -120,7 +122,7 @@ EXAMPLES
|
|
|
120
122
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack-id <stackId>
|
|
121
123
|
```
|
|
122
124
|
|
|
123
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
125
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/blueprints/config.ts)_
|
|
124
126
|
|
|
125
127
|
## `sanity-run blueprints deploy`
|
|
126
128
|
|
|
@@ -142,7 +144,7 @@ EXAMPLES
|
|
|
142
144
|
$ sanity-run blueprints deploy --no-wait
|
|
143
145
|
```
|
|
144
146
|
|
|
145
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
147
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/blueprints/deploy.ts)_
|
|
146
148
|
|
|
147
149
|
## `sanity-run blueprints destroy`
|
|
148
150
|
|
|
@@ -150,13 +152,15 @@ Destroy a Blueprint deployment (will not delete local files)
|
|
|
150
152
|
|
|
151
153
|
```
|
|
152
154
|
USAGE
|
|
153
|
-
$ sanity-run blueprints destroy [--project-id <value> --stack-id <value> --force] [--
|
|
155
|
+
$ sanity-run blueprints destroy [--project-id <value> --stack-id <value> --force] [--organization-id <value> ]
|
|
156
|
+
[--no-wait]
|
|
154
157
|
|
|
155
158
|
FLAGS
|
|
156
|
-
--force
|
|
157
|
-
--no-wait
|
|
158
|
-
--
|
|
159
|
-
--
|
|
159
|
+
--force Force destroy (skip confirmation)
|
|
160
|
+
--no-wait Do not wait for destruction to complete
|
|
161
|
+
--organization-id=<value> Organization associated with the Stack
|
|
162
|
+
--project-id=<value> Project associated with the Stack
|
|
163
|
+
--stack-id=<value> Stack ID to destroy (defaults to current Stack)
|
|
160
164
|
|
|
161
165
|
DESCRIPTION
|
|
162
166
|
Destroy a Blueprint deployment (will not delete local files)
|
|
@@ -167,7 +171,7 @@ EXAMPLES
|
|
|
167
171
|
$ sanity-run blueprints destroy --stack-id <stackId> --project-id <projectId> --force --no-wait
|
|
168
172
|
```
|
|
169
173
|
|
|
170
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
174
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/blueprints/destroy.ts)_
|
|
171
175
|
|
|
172
176
|
## `sanity-run blueprints doctor`
|
|
173
177
|
|
|
@@ -185,7 +189,7 @@ DESCRIPTION
|
|
|
185
189
|
Diagnose potential issues with Blueprint configuration
|
|
186
190
|
```
|
|
187
191
|
|
|
188
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
192
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/blueprints/doctor.ts)_
|
|
189
193
|
|
|
190
194
|
## `sanity-run blueprints info`
|
|
191
195
|
|
|
@@ -207,7 +211,7 @@ EXAMPLES
|
|
|
207
211
|
$ sanity-run blueprints info --stack-id <stackId>
|
|
208
212
|
```
|
|
209
213
|
|
|
210
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
214
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/blueprints/info.ts)_
|
|
211
215
|
|
|
212
216
|
## `sanity-run blueprints init [DIR]`
|
|
213
217
|
|
|
@@ -216,16 +220,17 @@ Initialize a new Blueprint
|
|
|
216
220
|
```
|
|
217
221
|
USAGE
|
|
218
222
|
$ sanity-run blueprints init [DIR] [--dir <value>] [--example <value> | --blueprint-type json|js|ts | --stack-id
|
|
219
|
-
<value> | --stack-name <value>] [--project-id <value>]
|
|
223
|
+
<value> | --stack-name <value>] [--project-id <value>] [--organization-id <value>]
|
|
220
224
|
|
|
221
225
|
ARGUMENTS
|
|
222
|
-
DIR Directory to create the Blueprint in
|
|
226
|
+
[DIR] Directory to create the Blueprint in
|
|
223
227
|
|
|
224
228
|
FLAGS
|
|
225
229
|
--blueprint-type=<option> Blueprint manifest type to use for the Blueprint
|
|
226
230
|
<options: json|js|ts>
|
|
227
231
|
--dir=<value> Directory to create the Blueprint in
|
|
228
232
|
--example=<value> Example to use for the Blueprint
|
|
233
|
+
--organization-id=<value> Sanity Organization ID to use for the Blueprint
|
|
229
234
|
--project-id=<value> Sanity Project ID to use for the Blueprint
|
|
230
235
|
--stack-id=<value> Existing Stack ID to use for the Blueprint
|
|
231
236
|
--stack-name=<value> Name to use for a NEW Stack
|
|
@@ -245,7 +250,7 @@ EXAMPLES
|
|
|
245
250
|
$ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
|
|
246
251
|
```
|
|
247
252
|
|
|
248
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
253
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/blueprints/init.ts)_
|
|
249
254
|
|
|
250
255
|
## `sanity-run blueprints logs`
|
|
251
256
|
|
|
@@ -267,7 +272,7 @@ EXAMPLES
|
|
|
267
272
|
$ sanity-run blueprints logs --watch
|
|
268
273
|
```
|
|
269
274
|
|
|
270
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
275
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/blueprints/logs.ts)_
|
|
271
276
|
|
|
272
277
|
## `sanity-run blueprints plan`
|
|
273
278
|
|
|
@@ -284,7 +289,7 @@ EXAMPLES
|
|
|
284
289
|
$ sanity-run blueprints plan
|
|
285
290
|
```
|
|
286
291
|
|
|
287
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
292
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/blueprints/plan.ts)_
|
|
288
293
|
|
|
289
294
|
## `sanity-run blueprints stacks`
|
|
290
295
|
|
|
@@ -292,10 +297,11 @@ List all Blueprint stacks
|
|
|
292
297
|
|
|
293
298
|
```
|
|
294
299
|
USAGE
|
|
295
|
-
$ sanity-run blueprints stacks [--project-id <value>]
|
|
300
|
+
$ sanity-run blueprints stacks [--project-id <value> | --organization-id <value>]
|
|
296
301
|
|
|
297
302
|
FLAGS
|
|
298
|
-
--
|
|
303
|
+
--organization-id=<value> Organization ID to show stacks for
|
|
304
|
+
--project-id=<value> Project ID to show stacks for
|
|
299
305
|
|
|
300
306
|
DESCRIPTION
|
|
301
307
|
List all Blueprint stacks
|
|
@@ -304,9 +310,52 @@ EXAMPLES
|
|
|
304
310
|
$ sanity-run blueprints stacks
|
|
305
311
|
|
|
306
312
|
$ sanity-run blueprints stacks --project-id <projectId>
|
|
313
|
+
|
|
314
|
+
$ sanity-run blueprints stacks --organization-id <organizationId>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/blueprints/stacks.ts)_
|
|
318
|
+
|
|
319
|
+
## `sanity-run functions add`
|
|
320
|
+
|
|
321
|
+
Add a Function to your Blueprint
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
USAGE
|
|
325
|
+
$ sanity-run functions add [--example <value> | -n <value> | | --language ts|js | --javascript | | ] [--type
|
|
326
|
+
document-create|document-delete|document-update|document-publish... ] [--helpers] [--installer skip|npm|pnpm|yarn]
|
|
327
|
+
[-i | ]
|
|
328
|
+
|
|
329
|
+
FLAGS
|
|
330
|
+
-i, --install Shortcut for --fn-installer npm
|
|
331
|
+
-n, --name=<value> Name of the Function to add
|
|
332
|
+
--example=<value> Example to use for the Function
|
|
333
|
+
--[no-]helpers Add helpers to the new Function
|
|
334
|
+
--installer=<option> How to install the @sanity/functions helpers
|
|
335
|
+
<options: skip|npm|pnpm|yarn>
|
|
336
|
+
--javascript Use JavaScript instead of TypeScript
|
|
337
|
+
--language=<option> [default: ts] Language of the new Function
|
|
338
|
+
<options: ts|js>
|
|
339
|
+
--type=<option>... Document change event(s) that should trigger the function; you can specify multiple events
|
|
340
|
+
by specifying this flag multiple times
|
|
341
|
+
<options: document-create|document-delete|document-update|document-publish>
|
|
342
|
+
|
|
343
|
+
DESCRIPTION
|
|
344
|
+
Add a Function to your Blueprint
|
|
345
|
+
|
|
346
|
+
EXAMPLES
|
|
347
|
+
$ sanity-run functions add
|
|
348
|
+
|
|
349
|
+
$ sanity-run functions add --helpers
|
|
350
|
+
|
|
351
|
+
$ sanity-run functions add --name my-function
|
|
352
|
+
|
|
353
|
+
$ sanity-run functions add --name my-function --type document-create
|
|
354
|
+
|
|
355
|
+
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
307
356
|
```
|
|
308
357
|
|
|
309
|
-
_See code: [src/commands/
|
|
358
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/functions/add.ts)_
|
|
310
359
|
|
|
311
360
|
## `sanity-run functions dev`
|
|
312
361
|
|
|
@@ -328,7 +377,7 @@ EXAMPLES
|
|
|
328
377
|
$ sanity-run functions dev --port 8974
|
|
329
378
|
```
|
|
330
379
|
|
|
331
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
380
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/functions/dev.ts)_
|
|
332
381
|
|
|
333
382
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
334
383
|
|
|
@@ -350,7 +399,7 @@ EXAMPLES
|
|
|
350
399
|
$ sanity-run functions env add MyFunction API_URL https://api.example.com/
|
|
351
400
|
```
|
|
352
401
|
|
|
353
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
402
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/functions/env/add.ts)_
|
|
354
403
|
|
|
355
404
|
## `sanity-run functions env list NAME`
|
|
356
405
|
|
|
@@ -370,7 +419,7 @@ EXAMPLES
|
|
|
370
419
|
$ sanity-run functions env list MyFunction
|
|
371
420
|
```
|
|
372
421
|
|
|
373
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
422
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/functions/env/list.ts)_
|
|
374
423
|
|
|
375
424
|
## `sanity-run functions env remove NAME KEY`
|
|
376
425
|
|
|
@@ -391,7 +440,7 @@ EXAMPLES
|
|
|
391
440
|
$ sanity-run functions env remove MyFunction API_URL
|
|
392
441
|
```
|
|
393
442
|
|
|
394
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
443
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/functions/env/remove.ts)_
|
|
395
444
|
|
|
396
445
|
## `sanity-run functions logs NAME`
|
|
397
446
|
|
|
@@ -425,7 +474,7 @@ EXAMPLES
|
|
|
425
474
|
$ sanity-run functions logs <name> --delete
|
|
426
475
|
```
|
|
427
476
|
|
|
428
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
477
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/functions/logs.ts)_
|
|
429
478
|
|
|
430
479
|
## `sanity-run functions test NAME`
|
|
431
480
|
|
|
@@ -436,7 +485,7 @@ USAGE
|
|
|
436
485
|
$ sanity-run functions test NAME [--data-before <value> | [-d <value> | -f <value> | --document-id <value>] | |
|
|
437
486
|
| --file-before <value> | --file-after <value> | --document-id-before <value> | --document-id-after <value>]
|
|
438
487
|
[--data-after <value> | | | | | | | ] [-e create|update|delete] [-t <value>] [-a <value>] [--dataset <value>]
|
|
439
|
-
[--project-id <value>] [--with-user-token]
|
|
488
|
+
[--project-id <value>] [--organization-id <value>] [--with-user-token]
|
|
440
489
|
|
|
441
490
|
ARGUMENTS
|
|
442
491
|
NAME The name of the Sanity Function
|
|
@@ -456,6 +505,7 @@ FLAGS
|
|
|
456
505
|
--document-id-before=<value> Original document
|
|
457
506
|
--file-after=<value> Current document
|
|
458
507
|
--file-before=<value> Original document
|
|
508
|
+
--organization-id=<value> Sanity Organization ID to use
|
|
459
509
|
--project-id=<value> Sanity Project ID to use
|
|
460
510
|
--with-user-token Prime access token from CLI config
|
|
461
511
|
|
|
@@ -472,7 +522,7 @@ EXAMPLES
|
|
|
472
522
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
473
523
|
```
|
|
474
524
|
|
|
475
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/
|
|
525
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v11.0.3/src/commands/functions/test.ts)_
|
|
476
526
|
|
|
477
527
|
## `sanity-run help [COMMAND]`
|
|
478
528
|
|
|
@@ -483,7 +533,7 @@ USAGE
|
|
|
483
533
|
$ sanity-run help [COMMAND...] [-n]
|
|
484
534
|
|
|
485
535
|
ARGUMENTS
|
|
486
|
-
COMMAND... Command to show help for.
|
|
536
|
+
[COMMAND...] Command to show help for.
|
|
487
537
|
|
|
488
538
|
FLAGS
|
|
489
539
|
-n, --nested-commands Include all nested commands in the output.
|
|
@@ -492,5 +542,5 @@ DESCRIPTION
|
|
|
492
542
|
Display help for sanity-run.
|
|
493
543
|
```
|
|
494
544
|
|
|
495
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.
|
|
545
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.34/src/commands/help.ts)_
|
|
496
546
|
<!-- commandsstop -->
|
|
@@ -8,36 +8,9 @@ export * as config from './config.js';
|
|
|
8
8
|
export * as logs from './logs.js';
|
|
9
9
|
export * as resources from './resources.js';
|
|
10
10
|
export * as stacks from './stacks.js';
|
|
11
|
-
import type { BlueprintParserError
|
|
12
|
-
import { type ReadBlueprintResult } from './blueprint.js';
|
|
11
|
+
import type { BlueprintParserError } from '../../utils/types.js';
|
|
13
12
|
export type BlueprintIssue = {
|
|
14
|
-
code: 'NO_STACK_ID' | '
|
|
13
|
+
code: 'NO_STACK_ID' | 'NO_SCOPE_TYPE' | 'NO_SCOPE_ID' | 'NO_STACK' | 'PARSE_ERROR';
|
|
15
14
|
message: string;
|
|
16
15
|
errors?: BlueprintParserError[];
|
|
17
16
|
};
|
|
18
|
-
type LocalBlueprintWithIds = ReadBlueprintResult & {
|
|
19
|
-
projectId: string;
|
|
20
|
-
stackId: string;
|
|
21
|
-
};
|
|
22
|
-
type BlueprintSuccess = {
|
|
23
|
-
localBlueprint: LocalBlueprintWithIds;
|
|
24
|
-
deployedStack: Stack;
|
|
25
|
-
issues?: never;
|
|
26
|
-
};
|
|
27
|
-
type BlueprintFailure = {
|
|
28
|
-
localBlueprint: ReadBlueprintResult;
|
|
29
|
-
issues: BlueprintIssue[];
|
|
30
|
-
deployedStack?: never;
|
|
31
|
-
};
|
|
32
|
-
type BlueprintResult = BlueprintSuccess | BlueprintFailure;
|
|
33
|
-
/**
|
|
34
|
-
* Get the local Blueprint and deployed Stack
|
|
35
|
-
* @deprecated Use initBlueprintConfig or initDeployedBlueprintConfig instead
|
|
36
|
-
* @param blueprintPath - The path of the Blueprint file or directory- will search up the directory tree if not provided
|
|
37
|
-
* @param token - The Sanity API token
|
|
38
|
-
* @returns The local Blueprint, issues, and maybe a deployed Stack
|
|
39
|
-
*/
|
|
40
|
-
export declare function getBlueprintAndStack({ token, blueprintPath, }: {
|
|
41
|
-
token: string;
|
|
42
|
-
blueprintPath?: string;
|
|
43
|
-
}): Promise<BlueprintResult>;
|
|
@@ -8,45 +8,3 @@ export * as config from './config.js';
|
|
|
8
8
|
export * as logs from './logs.js';
|
|
9
9
|
export * as resources from './resources.js';
|
|
10
10
|
export * as stacks from './stacks.js';
|
|
11
|
-
import { readLocalBlueprint } from './blueprint.js';
|
|
12
|
-
import { getStack } from './stacks.js';
|
|
13
|
-
/**
|
|
14
|
-
* Get the local Blueprint and deployed Stack
|
|
15
|
-
* @deprecated Use initBlueprintConfig or initDeployedBlueprintConfig instead
|
|
16
|
-
* @param blueprintPath - The path of the Blueprint file or directory- will search up the directory tree if not provided
|
|
17
|
-
* @param token - The Sanity API token
|
|
18
|
-
* @returns The local Blueprint, issues, and maybe a deployed Stack
|
|
19
|
-
*/
|
|
20
|
-
export async function getBlueprintAndStack({ token, blueprintPath, }) {
|
|
21
|
-
if (!token)
|
|
22
|
-
throw new Error('Auth is required');
|
|
23
|
-
const localBlueprint = await readLocalBlueprint(blueprintPath);
|
|
24
|
-
const { projectId, stackId, errors } = localBlueprint;
|
|
25
|
-
const issues = [];
|
|
26
|
-
if (errors.length > 0) {
|
|
27
|
-
issues.push({ code: 'PARSE_ERROR', message: 'Blueprint parse errors', errors });
|
|
28
|
-
}
|
|
29
|
-
if (!(stackId && projectId)) {
|
|
30
|
-
if (!projectId)
|
|
31
|
-
issues.push({ code: 'NO_PROJECT_ID', message: 'Project ID not found' });
|
|
32
|
-
if (!stackId)
|
|
33
|
-
issues.push({ code: 'NO_STACK_ID', message: 'Stack ID not found' });
|
|
34
|
-
return { localBlueprint, issues };
|
|
35
|
-
}
|
|
36
|
-
const stackResponse = await getStack({
|
|
37
|
-
stackId,
|
|
38
|
-
auth: {
|
|
39
|
-
scopeType: 'project',
|
|
40
|
-
scopeId: projectId,
|
|
41
|
-
token,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
if (!stackResponse.ok) {
|
|
45
|
-
issues.push({ code: 'NO_STACK', message: stackResponse.error || 'Unknown error' });
|
|
46
|
-
return { localBlueprint, issues };
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
localBlueprint: localBlueprint,
|
|
50
|
-
deployedStack: stackResponse.stack,
|
|
51
|
-
};
|
|
52
|
-
}
|
package/dist/baseCommands.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Interfaces } from '@oclif/core';
|
|
2
2
|
import { Command } from '@oclif/core';
|
|
3
3
|
import type { ReadBlueprintResult } from './actions/blueprints/blueprint.js';
|
|
4
|
-
import type { AuthParams, Stack } from './utils/types.js';
|
|
4
|
+
import type { AuthParams, ScopeType, Stack } from './utils/types.js';
|
|
5
5
|
export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BlueprintCommand)['baseFlags'] & T['flags']>;
|
|
6
6
|
export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
|
|
7
7
|
/**
|
|
@@ -24,14 +24,15 @@ export declare abstract class BlueprintCommand<T extends typeof Command> extends
|
|
|
24
24
|
protected finally(_: Error | undefined): Promise<unknown>;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* @description Guarantees flags, args, sanityToken, blueprint,
|
|
28
|
-
* If
|
|
27
|
+
* @description Guarantees flags, args, sanityToken, blueprint, scopeType, scopeId, stackId, auth, and deployedStack.
|
|
28
|
+
* If scope or stack is missing, the command exits with an error
|
|
29
29
|
* @extends BlueprintCommand
|
|
30
30
|
*/
|
|
31
31
|
export declare abstract class DeployedBlueprintCommand<T extends typeof Command> extends BlueprintCommand<T> {
|
|
32
32
|
protected auth: AuthParams;
|
|
33
33
|
protected deployedStack: Stack;
|
|
34
|
-
protected
|
|
34
|
+
protected scopeType: ScopeType;
|
|
35
|
+
protected scopeId: string;
|
|
35
36
|
protected stackId: string;
|
|
36
37
|
static baseFlags: {
|
|
37
38
|
verbose: Interfaces.BooleanFlag<boolean>;
|
package/dist/baseCommands.js
CHANGED
|
@@ -51,14 +51,15 @@ export class BlueprintCommand extends Command {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* @description Guarantees flags, args, sanityToken, blueprint,
|
|
55
|
-
* If
|
|
54
|
+
* @description Guarantees flags, args, sanityToken, blueprint, scopeType, scopeId, stackId, auth, and deployedStack.
|
|
55
|
+
* If scope or stack is missing, the command exits with an error
|
|
56
56
|
* @extends BlueprintCommand
|
|
57
57
|
*/
|
|
58
58
|
export class DeployedBlueprintCommand extends BlueprintCommand {
|
|
59
59
|
auth;
|
|
60
60
|
deployedStack;
|
|
61
|
-
|
|
61
|
+
scopeType;
|
|
62
|
+
scopeId;
|
|
62
63
|
stackId;
|
|
63
64
|
static baseFlags = baseFlags;
|
|
64
65
|
async init() {
|
|
@@ -73,7 +74,8 @@ export class DeployedBlueprintCommand extends BlueprintCommand {
|
|
|
73
74
|
if (!result.ok) {
|
|
74
75
|
this.error(result.error);
|
|
75
76
|
}
|
|
76
|
-
this.
|
|
77
|
+
this.scopeType = result.value.scopeType;
|
|
78
|
+
this.scopeId = result.value.scopeId;
|
|
77
79
|
this.stackId = result.value.stackId;
|
|
78
80
|
this.auth = result.value.auth;
|
|
79
81
|
this.deployedStack = result.value.deployedStack;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @deprecated Use `functions add` instead.
|
|
4
|
+
* We're in the process of deprecating the `blueprints add` command.
|
|
5
|
+
*/
|
|
1
6
|
import { BlueprintCommand } from '../../baseCommands.js';
|
|
2
7
|
export default class AddCommand extends BlueprintCommand<typeof AddCommand> {
|
|
3
8
|
static description: string;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* @deprecated Use `functions add` instead.
|
|
4
|
+
* We're in the process of deprecating the `blueprints add` command.
|
|
5
|
+
*/
|
|
1
6
|
import { Args, Flags } from '@oclif/core';
|
|
2
7
|
import { BlueprintCommand } from '../../baseCommands.js';
|
|
3
|
-
import {
|
|
8
|
+
import { functionAddCore } from '../../cores/functions/index.js';
|
|
9
|
+
// import {warn} from '../../utils/display/presenters.js'
|
|
4
10
|
export default class AddCommand extends BlueprintCommand {
|
|
11
|
+
// static state = 'deprecated'
|
|
12
|
+
// static deprecationOptions = {
|
|
13
|
+
// message: '`blueprints add` is deprecated. Use `functions add` instead.',
|
|
14
|
+
// }
|
|
5
15
|
static description = 'Add a Resource to a Blueprint';
|
|
6
16
|
static examples = [
|
|
7
17
|
'<%= config.bin %> <%= command.id %> function',
|
|
@@ -21,7 +31,7 @@ export default class AddCommand extends BlueprintCommand {
|
|
|
21
31
|
example: Flags.string({
|
|
22
32
|
description: 'Example to use for the Resource',
|
|
23
33
|
aliases: ['recipe'],
|
|
24
|
-
exclusive: ['name', 'fn-type', 'language', 'javascript', 'fn-helpers', 'fn-installer'],
|
|
34
|
+
exclusive: ['name', 'fn-type', 'language', 'javascript', 'fn-helpers', 'fn-installer'],
|
|
25
35
|
}),
|
|
26
36
|
name: Flags.string({
|
|
27
37
|
description: 'Name of the Resource to add',
|
|
@@ -49,7 +59,6 @@ export default class AddCommand extends BlueprintCommand {
|
|
|
49
59
|
'fn-helpers': Flags.boolean({
|
|
50
60
|
description: 'Add helpers to the new Function',
|
|
51
61
|
aliases: ['function-helpers', 'helpers'],
|
|
52
|
-
// default: true, // ask. for now
|
|
53
62
|
allowNo: true,
|
|
54
63
|
}),
|
|
55
64
|
'fn-installer': Flags.string({
|
|
@@ -64,12 +73,29 @@ export default class AddCommand extends BlueprintCommand {
|
|
|
64
73
|
}),
|
|
65
74
|
};
|
|
66
75
|
async run() {
|
|
67
|
-
const {
|
|
68
|
-
|
|
76
|
+
const { blueprint, flags, args: { type: resourceType }, config: { bin }, } = this;
|
|
77
|
+
if (resourceType !== 'function') {
|
|
78
|
+
this.error(`Unsupported Resource type: ${resourceType}`);
|
|
79
|
+
}
|
|
80
|
+
// log(
|
|
81
|
+
// warn(
|
|
82
|
+
// `\`${bin} blueprints add function\` is deprecated. Use \`${bin} functions add\` instead.`,
|
|
83
|
+
// ),
|
|
84
|
+
// )
|
|
85
|
+
const { success, error } = await functionAddCore({
|
|
86
|
+
bin,
|
|
69
87
|
log: (msg) => this.log(msg),
|
|
70
|
-
blueprint
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
blueprint,
|
|
89
|
+
flags: {
|
|
90
|
+
example: flags.example,
|
|
91
|
+
name: flags.name,
|
|
92
|
+
type: flags['fn-type'],
|
|
93
|
+
language: flags.language,
|
|
94
|
+
javascript: flags.javascript,
|
|
95
|
+
helpers: flags['fn-helpers'],
|
|
96
|
+
installer: flags['fn-installer'],
|
|
97
|
+
install: flags.install,
|
|
98
|
+
},
|
|
73
99
|
});
|
|
74
100
|
if (!success)
|
|
75
101
|
this.error(error);
|
|
@@ -6,6 +6,7 @@ export default class ConfigCommand extends BlueprintCommand<typeof ConfigCommand
|
|
|
6
6
|
'test-config': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
edit: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
8
|
'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'organization-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
'stack-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
};
|
|
11
12
|
run(): Promise<void>;
|
|
@@ -28,6 +28,11 @@ export default class ConfigCommand extends BlueprintCommand {
|
|
|
28
28
|
aliases: ['project', 'projectId'],
|
|
29
29
|
dependsOn: ['edit'],
|
|
30
30
|
}),
|
|
31
|
+
'organization-id': Flags.string({
|
|
32
|
+
description: 'Update the Organization ID in the configuration. Requires --edit flag',
|
|
33
|
+
aliases: ['organization', 'organizationId', 'org'],
|
|
34
|
+
dependsOn: ['edit'],
|
|
35
|
+
}),
|
|
31
36
|
'stack-id': Flags.string({
|
|
32
37
|
description: 'Update the Stack ID in the configuration. Requires --edit flag',
|
|
33
38
|
aliases: ['stack', 'stackId'],
|
|
@@ -19,7 +19,8 @@ export default class DeployCommand extends DeployedBlueprintCommand {
|
|
|
19
19
|
log: (message) => this.log(message),
|
|
20
20
|
auth: this.auth,
|
|
21
21
|
stackId: this.stackId,
|
|
22
|
-
|
|
22
|
+
scopeType: this.scopeType,
|
|
23
|
+
scopeId: this.scopeId,
|
|
23
24
|
deployedStack: this.deployedStack,
|
|
24
25
|
blueprint: this.blueprint,
|
|
25
26
|
flags: this.flags,
|
|
@@ -5,6 +5,7 @@ export default class DestroyCommand extends BlueprintCommand<typeof DestroyComma
|
|
|
5
5
|
static flags: {
|
|
6
6
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
'organization-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
'stack-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
'no-wait': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
};
|
|
@@ -14,10 +14,15 @@ export default class DestroyCommand extends BlueprintCommand {
|
|
|
14
14
|
default: false,
|
|
15
15
|
}),
|
|
16
16
|
'project-id': Flags.string({
|
|
17
|
-
description: 'Project associated with the Stack
|
|
17
|
+
description: 'Project associated with the Stack',
|
|
18
18
|
aliases: ['projectId', 'project'],
|
|
19
19
|
dependsOn: ['stack-id', 'force'],
|
|
20
20
|
}),
|
|
21
|
+
'organization-id': Flags.string({
|
|
22
|
+
description: 'Organization associated with the Stack',
|
|
23
|
+
aliases: ['organizationId', 'organization', 'org'],
|
|
24
|
+
dependsOn: ['stack-id', 'force'],
|
|
25
|
+
}),
|
|
21
26
|
'stack-id': Flags.string({
|
|
22
27
|
description: 'Stack ID to destroy (defaults to current Stack)',
|
|
23
28
|
aliases: ['stackId', 'stack'],
|
|
@@ -10,6 +10,7 @@ export default class InitCommand extends Command {
|
|
|
10
10
|
example: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
'blueprint-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'organization-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
'stack-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
15
|
'stack-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
16
|
};
|
|
@@ -33,6 +33,10 @@ export default class InitCommand extends Command {
|
|
|
33
33
|
description: 'Sanity Project ID to use for the Blueprint',
|
|
34
34
|
aliases: ['project', 'projectId'],
|
|
35
35
|
}),
|
|
36
|
+
'organization-id': Flags.string({
|
|
37
|
+
description: 'Sanity Organization ID to use for the Blueprint',
|
|
38
|
+
aliases: ['organization', 'organizationId', 'org'],
|
|
39
|
+
}),
|
|
36
40
|
'stack-id': Flags.string({
|
|
37
41
|
description: 'Existing Stack ID to use for the Blueprint',
|
|
38
42
|
aliases: ['stack', 'stackId'],
|
|
@@ -4,6 +4,7 @@ export default class StacksCommand extends BlueprintCommand<typeof StacksCommand
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'organization-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
};
|
|
8
9
|
run(): Promise<void>;
|
|
9
10
|
}
|
|
@@ -6,11 +6,18 @@ export default class StacksCommand extends BlueprintCommand {
|
|
|
6
6
|
static examples = [
|
|
7
7
|
'<%= config.bin %> <%= command.id %>',
|
|
8
8
|
'<%= config.bin %> <%= command.id %> --project-id <projectId>',
|
|
9
|
+
'<%= config.bin %> <%= command.id %> --organization-id <organizationId>',
|
|
9
10
|
];
|
|
10
11
|
static flags = {
|
|
11
12
|
'project-id': Flags.string({
|
|
12
13
|
description: 'Project ID to show stacks for',
|
|
13
14
|
aliases: ['projectId', 'project'],
|
|
15
|
+
exclusive: ['organization-id'],
|
|
16
|
+
}),
|
|
17
|
+
'organization-id': Flags.string({
|
|
18
|
+
description: 'Organization ID to show stacks for',
|
|
19
|
+
aliases: ['organizationId', 'organization', 'org'],
|
|
20
|
+
exclusive: ['project-id'],
|
|
14
21
|
}),
|
|
15
22
|
};
|
|
16
23
|
async run() {
|