@sanity/runtime-cli 14.11.0 → 14.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -43
- package/dist/actions/blueprints/blueprint.d.ts +49 -16
- package/dist/actions/blueprints/blueprint.js +97 -139
- package/dist/actions/blueprints/resolve.d.ts +51 -0
- package/dist/actions/blueprints/resolve.js +52 -0
- package/dist/actions/blueprints/resources.js +35 -12
- package/dist/actions/functions/dev.d.ts +1 -2
- package/dist/actions/functions/dev.js +2 -2
- package/dist/baseCommands.d.ts +47 -30
- package/dist/baseCommands.js +187 -72
- package/dist/commands/blueprints/add.d.ts +3 -2
- package/dist/commands/blueprints/add.js +3 -2
- package/dist/commands/blueprints/config.d.ts +3 -2
- package/dist/commands/blueprints/config.js +3 -2
- package/dist/commands/blueprints/deploy.d.ts +3 -2
- package/dist/commands/blueprints/deploy.js +4 -3
- package/dist/commands/blueprints/destroy.d.ts +3 -2
- package/dist/commands/blueprints/destroy.js +3 -2
- package/dist/commands/blueprints/doctor.d.ts +0 -1
- package/dist/commands/blueprints/doctor.js +2 -3
- package/dist/commands/blueprints/info.d.ts +4 -2
- package/dist/commands/blueprints/info.js +6 -3
- package/dist/commands/blueprints/init.d.ts +0 -1
- package/dist/commands/blueprints/init.js +1 -2
- package/dist/commands/blueprints/logs.d.ts +3 -2
- package/dist/commands/blueprints/logs.js +4 -3
- package/dist/commands/blueprints/plan.d.ts +3 -2
- package/dist/commands/blueprints/plan.js +5 -3
- package/dist/commands/blueprints/promote.d.ts +3 -2
- package/dist/commands/blueprints/promote.js +3 -2
- package/dist/commands/blueprints/stacks.d.ts +3 -2
- package/dist/commands/blueprints/stacks.js +3 -2
- package/dist/commands/functions/add.d.ts +3 -2
- package/dist/commands/functions/add.js +4 -3
- package/dist/commands/functions/build.d.ts +3 -2
- package/dist/commands/functions/build.js +3 -2
- package/dist/commands/functions/dev.d.ts +3 -2
- package/dist/commands/functions/dev.js +3 -2
- package/dist/commands/functions/env/add.d.ts +3 -2
- package/dist/commands/functions/env/add.js +3 -2
- package/dist/commands/functions/env/list.d.ts +3 -2
- package/dist/commands/functions/env/list.js +3 -2
- package/dist/commands/functions/env/remove.d.ts +3 -2
- package/dist/commands/functions/env/remove.js +3 -2
- package/dist/commands/functions/logs.d.ts +3 -2
- package/dist/commands/functions/logs.js +4 -3
- package/dist/commands/functions/test.d.ts +3 -2
- package/dist/commands/functions/test.js +3 -2
- package/dist/constants.d.ts +15 -2
- package/dist/constants.js +14 -10
- package/dist/cores/blueprints/config.js +9 -4
- package/dist/cores/blueprints/destroy.js +78 -56
- package/dist/cores/blueprints/doctor.js +19 -5
- package/dist/cores/blueprints/init.js +2 -2
- package/dist/cores/functions/add.js +11 -7
- package/dist/cores/functions/dev.js +1 -1
- package/dist/server/app.d.ts +1 -2
- package/dist/server/app.js +16 -8
- package/dist/server/handlers/invoke.d.ts +1 -2
- package/dist/server/handlers/invoke.js +4 -4
- package/dist/server/static/components/rule-panel.js +8 -10
- package/oclif.manifest.json +503 -73
- 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.12.1 linux-x64 node-v24.14.1
|
|
24
24
|
$ sanity-run --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ sanity-run COMMAND
|
|
@@ -55,9 +55,9 @@ Add a function resource to a Blueprint
|
|
|
55
55
|
```
|
|
56
56
|
USAGE
|
|
57
57
|
$ sanity-run blueprints add TYPE [--json] [--validate-resources] [--example <value> | -n <value> | --fn-type
|
|
58
|
-
document-publish|document-create|document-
|
|
59
|
-
te|media-library-asset-
|
|
60
|
-
--fn-installer skip|npm|pnpm|yarn] [-i | ]
|
|
58
|
+
document-publish|document-create|document-delete|document-update|media-library-asset-create|media-library-asset-dele
|
|
59
|
+
te|media-library-asset-update|scheduled-function|sync-tag-invalidate... | --language ts|js | --javascript |
|
|
60
|
+
--fn-helpers | --fn-installer skip|npm|pnpm|yarn] [-i | ]
|
|
61
61
|
|
|
62
62
|
ARGUMENTS
|
|
63
63
|
TYPE (function) Type of resource to add (only "function" is supported)
|
|
@@ -72,9 +72,9 @@ FLAGS
|
|
|
72
72
|
<options: skip|npm|pnpm|yarn>
|
|
73
73
|
--fn-type=<option>... Document change event(s) that should trigger the function; you can specify multiple
|
|
74
74
|
events by specifying this flag multiple times
|
|
75
|
-
<options:
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
<options: document-publish|document-create|document-delete|document-update|media-librar
|
|
76
|
+
y-asset-create|media-library-asset-delete|media-library-asset-update|scheduled-function
|
|
77
|
+
|sync-tag-invalidate>
|
|
78
78
|
--javascript Use JavaScript instead of TypeScript
|
|
79
79
|
--json Format output as json
|
|
80
80
|
--language=<option> [default: ts] Language of the new function
|
|
@@ -101,7 +101,7 @@ EXAMPLES
|
|
|
101
101
|
$ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
_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.12.1/src/commands/blueprints/add.ts)_
|
|
105
105
|
|
|
106
106
|
## `sanity-run blueprints config`
|
|
107
107
|
|
|
@@ -109,8 +109,8 @@ View or edit the local Blueprint configuration
|
|
|
109
109
|
|
|
110
110
|
```
|
|
111
111
|
USAGE
|
|
112
|
-
$ sanity-run blueprints config [--json] [--validate-resources] [--
|
|
113
|
-
[--
|
|
112
|
+
$ sanity-run blueprints config [--json] [--validate-resources] [--stack <value> -e] [--project-id <value> ]
|
|
113
|
+
[--organization-id <value> ]
|
|
114
114
|
|
|
115
115
|
FLAGS
|
|
116
116
|
-e, --edit Modify the configuration interactively, or directly when combined with ID flags.
|
|
@@ -140,7 +140,7 @@ EXAMPLES
|
|
|
140
140
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
143
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/blueprints/config.ts)_
|
|
144
144
|
|
|
145
145
|
## `sanity-run blueprints deploy`
|
|
146
146
|
|
|
@@ -182,7 +182,7 @@ EXAMPLES
|
|
|
182
182
|
$ sanity-run blueprints deploy --fn-installer npm
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
185
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/blueprints/deploy.ts)_
|
|
186
186
|
|
|
187
187
|
## `sanity-run blueprints destroy`
|
|
188
188
|
|
|
@@ -218,7 +218,7 @@ EXAMPLES
|
|
|
218
218
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
219
219
|
```
|
|
220
220
|
|
|
221
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
221
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/blueprints/destroy.ts)_
|
|
222
222
|
|
|
223
223
|
## `sanity-run blueprints doctor`
|
|
224
224
|
|
|
@@ -250,7 +250,7 @@ EXAMPLES
|
|
|
250
250
|
$ sanity-run blueprints doctor --fix
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
253
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/blueprints/doctor.ts)_
|
|
254
254
|
|
|
255
255
|
## `sanity-run blueprints info`
|
|
256
256
|
|
|
@@ -258,11 +258,12 @@ Display the status and resources of the remote Stack deployment
|
|
|
258
258
|
|
|
259
259
|
```
|
|
260
260
|
USAGE
|
|
261
|
-
$ sanity-run blueprints info [--json] [--validate-resources] [--stack <value>]
|
|
261
|
+
$ sanity-run blueprints info [--json] [--validate-resources] [--stack <value>] [--project-id <value>]
|
|
262
262
|
|
|
263
263
|
FLAGS
|
|
264
264
|
--json Format output as json
|
|
265
|
-
--
|
|
265
|
+
--project-id=<value> Sanity project ID used to scope Blueprint and Stack
|
|
266
|
+
--stack=<value> Stack name or ID
|
|
266
267
|
--[no-]validate-resources Validate resources
|
|
267
268
|
|
|
268
269
|
DESCRIPTION
|
|
@@ -280,9 +281,11 @@ EXAMPLES
|
|
|
280
281
|
$ sanity-run blueprints info
|
|
281
282
|
|
|
282
283
|
$ sanity-run blueprints info --stack <name-or-id>
|
|
284
|
+
|
|
285
|
+
$ sanity-run blueprints info --project-id <id> --stack <name-or-id>
|
|
283
286
|
```
|
|
284
287
|
|
|
285
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
288
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/blueprints/info.ts)_
|
|
286
289
|
|
|
287
290
|
## `sanity-run blueprints init [DIR]`
|
|
288
291
|
|
|
@@ -290,7 +293,7 @@ Initialize a Blueprint and create a remote Stack
|
|
|
290
293
|
|
|
291
294
|
```
|
|
292
295
|
USAGE
|
|
293
|
-
$ sanity-run blueprints init [DIR] [--json] [--validate-resources] [--
|
|
296
|
+
$ sanity-run blueprints init [DIR] [--json] [--validate-resources] [--dir <value>] [--example <value> |
|
|
294
297
|
--blueprint-type json|js|ts | --stack-id <value> | --stack-name <value>] [--project-id <value>] [--organization-id
|
|
295
298
|
<value>]
|
|
296
299
|
|
|
@@ -308,7 +311,6 @@ FLAGS
|
|
|
308
311
|
--stack-id=<value> Existing Stack ID used to scope local Blueprint
|
|
309
312
|
--stack-name=<value> Name to use for a new Stack provisioned during initialization
|
|
310
313
|
--[no-]validate-resources Validate resources
|
|
311
|
-
--verbose Verbose output
|
|
312
314
|
|
|
313
315
|
DESCRIPTION
|
|
314
316
|
Initialize a Blueprint and create a remote Stack
|
|
@@ -336,7 +338,7 @@ EXAMPLES
|
|
|
336
338
|
$ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
|
|
337
339
|
```
|
|
338
340
|
|
|
339
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
341
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/blueprints/init.ts)_
|
|
340
342
|
|
|
341
343
|
## `sanity-run blueprints logs`
|
|
342
344
|
|
|
@@ -367,7 +369,7 @@ EXAMPLES
|
|
|
367
369
|
$ sanity-run blueprints logs --watch
|
|
368
370
|
```
|
|
369
371
|
|
|
370
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
372
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/blueprints/logs.ts)_
|
|
371
373
|
|
|
372
374
|
## `sanity-run blueprints plan`
|
|
373
375
|
|
|
@@ -395,7 +397,7 @@ EXAMPLES
|
|
|
395
397
|
$ sanity-run blueprints plan
|
|
396
398
|
```
|
|
397
399
|
|
|
398
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
400
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/blueprints/plan.ts)_
|
|
399
401
|
|
|
400
402
|
## `sanity-run blueprints stacks`
|
|
401
403
|
|
|
@@ -427,7 +429,7 @@ EXAMPLES
|
|
|
427
429
|
$ sanity-run blueprints stacks --organization-id <organizationId>
|
|
428
430
|
```
|
|
429
431
|
|
|
430
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
432
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/blueprints/stacks.ts)_
|
|
431
433
|
|
|
432
434
|
## `sanity-run functions add`
|
|
433
435
|
|
|
@@ -436,9 +438,9 @@ Add a Function to your Blueprint
|
|
|
436
438
|
```
|
|
437
439
|
USAGE
|
|
438
440
|
$ sanity-run functions add [--json] [--validate-resources] [--example <value> | -n <value> | | --language ts|js
|
|
439
|
-
| --javascript | | ] [--type document-publish|document-create|document-
|
|
440
|
-
reate|media-library-asset-
|
|
441
|
-
skip|npm|pnpm|yarn] [-i | ]
|
|
441
|
+
| --javascript | | ] [--type document-publish|document-create|document-delete|document-update|media-library-asset-c
|
|
442
|
+
reate|media-library-asset-delete|media-library-asset-update|scheduled-function|sync-tag-invalidate... ] [--helpers]
|
|
443
|
+
[--installer skip|npm|pnpm|yarn] [-i | ]
|
|
442
444
|
|
|
443
445
|
FLAGS
|
|
444
446
|
-i, --install Shortcut for --fn-installer npm
|
|
@@ -453,9 +455,9 @@ FLAGS
|
|
|
453
455
|
<options: ts|js>
|
|
454
456
|
--type=<option>... Document change event(s) that should trigger the function; you can specify multiple
|
|
455
457
|
events by specifying this flag multiple times
|
|
456
|
-
<options:
|
|
457
|
-
|
|
458
|
-
|
|
458
|
+
<options: document-publish|document-create|document-delete|document-update|media-librar
|
|
459
|
+
y-asset-create|media-library-asset-delete|media-library-asset-update|scheduled-function
|
|
460
|
+
|sync-tag-invalidate>
|
|
459
461
|
--[no-]validate-resources Validate resources
|
|
460
462
|
|
|
461
463
|
DESCRIPTION
|
|
@@ -463,8 +465,8 @@ DESCRIPTION
|
|
|
463
465
|
|
|
464
466
|
Scaffolds a new Function in the functions/ folder and templates a resource for your Blueprint manifest.
|
|
465
467
|
|
|
466
|
-
Functions are serverless handlers triggered by document events (create, update, delete,
|
|
467
|
-
|
|
468
|
+
Functions are serverless handlers triggered by document, live content or media-library events (create, update, delete,
|
|
469
|
+
publish).
|
|
468
470
|
|
|
469
471
|
After adding, use 'functions dev' to test locally, then 'blueprints deploy' to publish.
|
|
470
472
|
|
|
@@ -480,7 +482,7 @@ EXAMPLES
|
|
|
480
482
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
481
483
|
```
|
|
482
484
|
|
|
483
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
485
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/functions/add.ts)_
|
|
484
486
|
|
|
485
487
|
## `sanity-run functions dev`
|
|
486
488
|
|
|
@@ -516,7 +518,7 @@ EXAMPLES
|
|
|
516
518
|
$ sanity-run functions dev --timeout 60
|
|
517
519
|
```
|
|
518
520
|
|
|
519
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
521
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/functions/dev.ts)_
|
|
520
522
|
|
|
521
523
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
522
524
|
|
|
@@ -547,7 +549,7 @@ EXAMPLES
|
|
|
547
549
|
$ sanity-run functions env add MyFunction API_URL https://api.example.com/
|
|
548
550
|
```
|
|
549
551
|
|
|
550
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
552
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/functions/env/add.ts)_
|
|
551
553
|
|
|
552
554
|
## `sanity-run functions env list NAME`
|
|
553
555
|
|
|
@@ -575,7 +577,7 @@ EXAMPLES
|
|
|
575
577
|
$ sanity-run functions env list MyFunction
|
|
576
578
|
```
|
|
577
579
|
|
|
578
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
580
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/functions/env/list.ts)_
|
|
579
581
|
|
|
580
582
|
## `sanity-run functions env remove NAME KEY`
|
|
581
583
|
|
|
@@ -605,7 +607,7 @@ EXAMPLES
|
|
|
605
607
|
$ sanity-run functions env remove MyFunction API_URL
|
|
606
608
|
```
|
|
607
609
|
|
|
608
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
610
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/functions/env/remove.ts)_
|
|
609
611
|
|
|
610
612
|
## `sanity-run functions logs [NAME]`
|
|
611
613
|
|
|
@@ -647,7 +649,7 @@ EXAMPLES
|
|
|
647
649
|
$ sanity-run functions logs <name> --delete
|
|
648
650
|
```
|
|
649
651
|
|
|
650
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
652
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/functions/logs.ts)_
|
|
651
653
|
|
|
652
654
|
## `sanity-run functions test [NAME]`
|
|
653
655
|
|
|
@@ -655,11 +657,11 @@ Invoke a local Sanity Function
|
|
|
655
657
|
|
|
656
658
|
```
|
|
657
659
|
USAGE
|
|
658
|
-
$ sanity-run functions test [NAME] [--json] [--validate-resources] [--
|
|
659
|
-
<value> | --document-id <value>] | | | --file-before <value> | --file-after <value> |
|
|
660
|
-
| --document-id-after <value>] [--data-after <value> | | | | | | | ] [-e
|
|
661
|
-
[-
|
|
662
|
-
--dataset <value>]
|
|
660
|
+
$ sanity-run functions test [NAME] [--json] [--validate-resources] [--organization-id <value>] [--data-before
|
|
661
|
+
<value> | [-d <value> | -f <value> | --document-id <value>] | | | --file-before <value> | --file-after <value> |
|
|
662
|
+
--document-id-before <value> | --document-id-after <value>] [--data-after <value> | | | | | | | ] [-e
|
|
663
|
+
create|update|delete] [-t <value>] [-a <value>] [--with-user-token] [--media-library-id <value> | --project-id
|
|
664
|
+
<value> | --dataset <value>]
|
|
663
665
|
|
|
664
666
|
ARGUMENTS
|
|
665
667
|
[NAME] The name of the Sanity Function
|
|
@@ -705,7 +707,7 @@ EXAMPLES
|
|
|
705
707
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
706
708
|
```
|
|
707
709
|
|
|
708
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
710
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.12.1/src/commands/functions/test.ts)_
|
|
709
711
|
|
|
710
712
|
## `sanity-run help [COMMAND]`
|
|
711
713
|
|
|
@@ -3,6 +3,7 @@ import { type Blueprint } from '@sanity/blueprints-parser';
|
|
|
3
3
|
import type { Logger } from '../../utils/logger.js';
|
|
4
4
|
import type { BlueprintParserError, ScopeType } from '../../utils/types.js';
|
|
5
5
|
import { type LocatedBlueprintsConfig } from './config.js';
|
|
6
|
+
import { type ConfigSource } from './resolve.js';
|
|
6
7
|
declare const SUPPORTED_FILE_EXTENSIONS: readonly [".json", ".js", ".mjs", ".ts"];
|
|
7
8
|
type BlueprintFileExtension = (typeof SUPPORTED_FILE_EXTENSIONS)[number];
|
|
8
9
|
export declare const JSON_BLUEPRINT_CONTENT: {
|
|
@@ -23,18 +24,26 @@ type FileInfo = {
|
|
|
23
24
|
};
|
|
24
25
|
/**
|
|
25
26
|
* Finds the blueprint file in the given path or current working directory
|
|
26
|
-
* @param blueprintPath - The path of the blueprint file or directory
|
|
27
27
|
* @returns The path, file name, and extension of the blueprint file
|
|
28
28
|
*/
|
|
29
29
|
export declare function findBlueprintFile(blueprintPath?: string): FileInfo | null;
|
|
30
|
+
/** @see resolve.ts for the canonical definition */
|
|
31
|
+
export type { ConfigSource } from './resolve.js';
|
|
32
|
+
/** Result of loading a blueprint file from disk. */
|
|
33
|
+
export interface LoadedBlueprintFile {
|
|
34
|
+
rawBlueprint: Record<string, unknown>;
|
|
35
|
+
module?: BlueprintModule;
|
|
36
|
+
}
|
|
30
37
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* - env: from the environment - usually CLI var like `SANITY_ORGANIZATION_ID`
|
|
34
|
-
* - module: from the blueprint module - undocumented escape hatch
|
|
35
|
-
* - inferred: legacy `ST-<projectId>` stacks from launch
|
|
38
|
+
* Normalized result from the parser's {@link BlueprintOutput}
|
|
39
|
+
* to match the shape returned by {@link readLocalBlueprint}
|
|
36
40
|
*/
|
|
37
|
-
export
|
|
41
|
+
export interface ParsedBlueprintContent {
|
|
42
|
+
/** The validated blueprint, or the raw data as fallback when parsing fails */
|
|
43
|
+
parsedBlueprint: Blueprint | Record<string, unknown>;
|
|
44
|
+
errors: BlueprintParserError[];
|
|
45
|
+
resources: BlueprintResource[];
|
|
46
|
+
}
|
|
38
47
|
/** Result of the blueprint read operation */
|
|
39
48
|
export interface ReadBlueprintResult {
|
|
40
49
|
fileInfo: FileInfo;
|
|
@@ -46,8 +55,6 @@ export interface ReadBlueprintResult {
|
|
|
46
55
|
errors: BlueprintParserError[];
|
|
47
56
|
/** Validated resources escaped from parser types */
|
|
48
57
|
resources: BlueprintResource[];
|
|
49
|
-
/** @deprecated - use blueprintConfig.configPath instead */
|
|
50
|
-
configPath?: string;
|
|
51
58
|
scopeType?: ScopeType;
|
|
52
59
|
scopeId?: string;
|
|
53
60
|
organizationId?: string;
|
|
@@ -60,13 +67,40 @@ export interface ReadBlueprintResult {
|
|
|
60
67
|
};
|
|
61
68
|
}
|
|
62
69
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
|
|
70
|
+
* Load a blueprint file from disk: read JSON or import+execute a JS/TS module.
|
|
71
|
+
* Returns the raw blueprint data and the module reference (if dynamic).
|
|
72
|
+
*/
|
|
73
|
+
export declare function loadBlueprintFile(fileInfo: FileInfo): Promise<LoadedBlueprintFile>;
|
|
74
|
+
/**
|
|
75
|
+
* Run the blueprint parser/validator on raw blueprint data.
|
|
76
|
+
* Optionally validates function resources.
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseBlueprintContent(rawBlueprint: Record<string, unknown>, options: {
|
|
79
|
+
validateResources: boolean;
|
|
80
|
+
}): ParsedBlueprintContent;
|
|
81
|
+
/** Result of finding, loading, and parsing a blueprint file. */
|
|
82
|
+
export interface LocalBlueprint extends ParsedBlueprintContent {
|
|
83
|
+
fileInfo: FileInfo;
|
|
84
|
+
rawBlueprint: Record<string, unknown>;
|
|
85
|
+
module?: BlueprintModule;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Find, load, and parse a local blueprint file in one step.
|
|
89
|
+
* Does not read the config file or resolve IDs -- callers that need
|
|
90
|
+
* scope/stack information should use `readConfigFile` + `resolveIds` separately.
|
|
66
91
|
*
|
|
67
|
-
* @param
|
|
68
|
-
* @param validate
|
|
69
|
-
|
|
92
|
+
* @param blueprintPath Path to a blueprint file or directory containing one
|
|
93
|
+
* @param options.validateResources Whether to validate function resources
|
|
94
|
+
*/
|
|
95
|
+
export declare function loadAndParseBlueprint(blueprintPath?: string, options?: {
|
|
96
|
+
validateResources: boolean;
|
|
97
|
+
}): Promise<LocalBlueprint>;
|
|
98
|
+
/**
|
|
99
|
+
* Reads the blueprint file from disk and parses it.
|
|
100
|
+
* Resolves IDs from environment > blueprint module > config file.
|
|
101
|
+
* Can infer stackId from projectId for legacy ST-<projectId> stacks.
|
|
102
|
+
* @see {@link loadBlueprintFile} {@link readConfigFile} {@link resolveIds} {@link parseBlueprintContent}
|
|
103
|
+
* @todo deprecate in favor of decomposed functions
|
|
70
104
|
* @returns Known information about the Blueprint, config, and Stack
|
|
71
105
|
*/
|
|
72
106
|
export declare function readLocalBlueprint(logger: Logger, validate: {
|
|
@@ -80,4 +114,3 @@ export declare function addResourceToBlueprint<T extends BlueprintResource>({ bl
|
|
|
80
114
|
blueprintFilePath?: string;
|
|
81
115
|
resource: T;
|
|
82
116
|
}): T | undefined;
|
|
83
|
-
export {};
|