@sanity/cli 8.31.0 → 8.32.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.
Files changed (49) hide show
  1. package/README.md +179 -103
  2. package/bin/run.js +1 -1
  3. package/dist/actions/context/waitForSourceSync.js +1 -1
  4. package/dist/actions/context/waitForSourceSync.js.map +1 -1
  5. package/dist/actions/cors/filterAndValidateOrigin.js +1 -1
  6. package/dist/actions/cors/filterAndValidateOrigin.js.map +1 -1
  7. package/dist/actions/deploy/deployStudioSchemasAndManifestsWorker.js +13 -1
  8. package/dist/actions/deploy/deployStudioSchemasAndManifestsWorker.js.map +1 -1
  9. package/dist/actions/documents/validateDocuments.worker.js +2 -1
  10. package/dist/actions/documents/validateDocuments.worker.js.map +1 -1
  11. package/dist/actions/graphql/extractFromSanitySchema.js +1 -1
  12. package/dist/actions/graphql/extractFromSanitySchema.js.map +1 -1
  13. package/dist/actions/init/initStudio.js +1 -1
  14. package/dist/actions/init/initStudio.js.map +1 -1
  15. package/dist/actions/init/processTemplate.js +1 -1
  16. package/dist/actions/init/processTemplate.js.map +1 -1
  17. package/dist/actions/init/remoteTemplate.js +1 -1
  18. package/dist/actions/init/remoteTemplate.js.map +1 -1
  19. package/dist/actions/media/pullAspects.js +1 -1
  20. package/dist/actions/media/pullAspects.js.map +1 -1
  21. package/dist/actions/organizations/readOrganizationLogo.js +49 -0
  22. package/dist/actions/organizations/readOrganizationLogo.js.map +1 -0
  23. package/dist/actions/preview/previewAction.js +1 -1
  24. package/dist/actions/preview/previewAction.js.map +1 -1
  25. package/dist/actions/skills/readSkillState.js +1 -1
  26. package/dist/actions/skills/readSkillState.js.map +1 -1
  27. package/dist/actions/skills/setupSkills.js +1 -1
  28. package/dist/actions/skills/setupSkills.js.map +1 -1
  29. package/dist/commands/organizations/create.js +43 -3
  30. package/dist/commands/organizations/create.js.map +1 -1
  31. package/dist/commands/organizations/update.js +67 -14
  32. package/dist/commands/organizations/update.js.map +1 -1
  33. package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js +7 -2
  34. package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js.map +1 -1
  35. package/dist/generated/contextOperations.js +2 -2
  36. package/dist/generated/contextOperations.js.map +1 -1
  37. package/dist/hooks/commandNotFound/topicAliases.js +1 -1
  38. package/dist/hooks/commandNotFound/topicAliases.js.map +1 -1
  39. package/dist/server/devServer.js +8 -10
  40. package/dist/server/devServer.js.map +1 -1
  41. package/dist/services/organizations.js +30 -0
  42. package/dist/services/organizations.js.map +1 -1
  43. package/dist/util/telemetry/cliCommandIdentity.js +3 -2
  44. package/dist/util/telemetry/cliCommandIdentity.js.map +1 -1
  45. package/dist/util/update/updateChecker.js +1 -1
  46. package/dist/util/update/updateChecker.js.map +1 -1
  47. package/oclif.config.js +1 -1
  48. package/oclif.manifest.json +2665 -2623
  49. package/package.json +25 -26
package/README.md CHANGED
@@ -173,6 +173,7 @@ Code for sanity cli
173
173
  - [`sanity whoami`](#sanity-whoami)
174
174
  - [`sanity workflows abort INSTANCEID`](#sanity-workflows-abort-instanceid)
175
175
  - [`sanity workflows blueprints generate`](#sanity-workflows-blueprints-generate)
176
+ - [`sanity workflows codemod packages [PATH]`](#sanity-workflows-codemod-packages-path)
176
177
  - [`sanity workflows definitions delete NAME`](#sanity-workflows-definitions-delete-name)
177
178
  - [`sanity workflows definitions diff NAME`](#sanity-workflows-definitions-diff-name)
178
179
  - [`sanity workflows definitions list`](#sanity-workflows-definitions-list)
@@ -184,10 +185,10 @@ Code for sanity cli
184
185
  - [`sanity workflows list`](#sanity-workflows-list)
185
186
  - [`sanity workflows nuke`](#sanity-workflows-nuke)
186
187
  - [`sanity workflows reset-activity INSTANCEID ACTIVITY`](#sanity-workflows-reset-activity-instanceid-activity)
187
- - [`sanity workflows set-stage INSTANCEID`](#sanity-workflows-set-stage-instanceid)
188
188
  - [`sanity workflows show INSTANCEID`](#sanity-workflows-show-instanceid)
189
189
  - [`sanity workflows start NAME`](#sanity-workflows-start-name)
190
190
  - [`sanity workflows tail INSTANCEID`](#sanity-workflows-tail-instanceid)
191
+ - [`sanity workflows whoami`](#sanity-workflows-whoami)
191
192
 
192
193
  ## `sanity api ENDPOINT`
193
194
 
@@ -616,7 +617,7 @@ DESCRIPTION
616
617
  Destroy a remote Stack deployment and its resources
617
618
 
618
619
  Permanently removes the remote Stack and all its provisioned resources. Your Blueprint manifest and resource files
619
- remain intact; "stackId" is unset in your local config.
620
+ remain intact; "stackId" is unset in your local config once destruction completes (or immediately with --no-wait).
620
621
 
621
622
  This is a destructive operation. You will be prompted to confirm unless --force is specified.
622
623
 
@@ -1791,7 +1792,7 @@ DESCRIPTION
1791
1792
  Get a job
1792
1793
 
1793
1794
  Returns the status of a background job, such as a build, sync, or refresh. The endpoint that starts the work returns
1794
- the job ID.
1795
+ the job ID. A job cancelled before it started never ran, so it returns 404.
1795
1796
 
1796
1797
  EXAMPLES
1797
1798
  Get a job
@@ -2612,7 +2613,10 @@ DESCRIPTION
2612
2613
  Sync every source
2613
2614
 
2614
2615
  Queues a sync of every website and dataset source, which starts once any sync of the source that is running ends.
2615
- `files` sources sync when you upload a file.
2616
+ `files` sources sync when you upload a file. New documents, from these syncs or waiting from earlier ones, are then
2617
+ placed in the knowledge base right away instead of waiting to be placed together with the documents that follow them.
2618
+ This covers the documents that arrive within an hour of the request. A refresh writes a limited number of entries, so
2619
+ a large batch is placed over several refreshes.
2616
2620
 
2617
2621
  EXAMPLES
2618
2622
  Sync every source
@@ -4911,10 +4915,12 @@ Create a new organization
4911
4915
 
4912
4916
  ```
4913
4917
  USAGE
4914
- $ sanity organizations create [--default-role <value>] [--name <value>]
4918
+ $ sanity organizations create [--default-role <value>] [--logo <path>] [--name <value>]
4915
4919
 
4916
4920
  FLAGS
4917
4921
  --default-role=<value> Default role assigned to new members
4922
+ --logo=<path> Image file to use as the logo: PNG, JPEG, GIF, WebP, SVG, BMP, TIFF, HEIF or AVIF, at most 5
4923
+ MB
4918
4924
  --name=<value> Organization name
4919
4925
 
4920
4926
  DESCRIPTION
@@ -4932,6 +4938,10 @@ EXAMPLES
4932
4938
  Create an organization with a default member role
4933
4939
 
4934
4940
  $ sanity organizations create --name "Acme Corp" --default-role member
4941
+
4942
+ Create an organization with a logo
4943
+
4944
+ $ sanity organizations create --name "Acme Corp" --logo ./logo.png
4935
4945
  ```
4936
4946
 
4937
4947
  ## `sanity organizations delete ORGANIZATIONID`
@@ -5004,13 +5014,16 @@ Update an organization
5004
5014
 
5005
5015
  ```
5006
5016
  USAGE
5007
- $ sanity organizations update ORGANIZATIONID [--default-role <value>] [--name <value>] [--slug <value>]
5017
+ $ sanity organizations update ORGANIZATIONID [--default-role <value>] [--logo <path>] [--name <value>] [--slug
5018
+ <value>]
5008
5019
 
5009
5020
  ARGUMENTS
5010
5021
  ORGANIZATIONID Organization ID
5011
5022
 
5012
5023
  FLAGS
5013
5024
  --default-role=<value> New default role for new members
5025
+ --logo=<path> Image file to use as the logo: PNG, JPEG, GIF, WebP, SVG, BMP, TIFF, HEIF or AVIF, at most 5
5026
+ MB ("" removes it)
5014
5027
  --name=<value> New organization name
5015
5028
  --slug=<value> New URL slug (requires authSAML feature on the organization)
5016
5029
 
@@ -5029,6 +5042,14 @@ EXAMPLES
5029
5042
  Change the default member role
5030
5043
 
5031
5044
  $ sanity organizations update org-abc123 --default-role viewer
5045
+
5046
+ Set or replace the organization logo
5047
+
5048
+ $ sanity organizations update org-abc123 --logo ./logo.png
5049
+
5050
+ Remove the organization logo
5051
+
5052
+ $ sanity organizations update org-abc123 --logo ""
5032
5053
  ```
5033
5054
 
5034
5055
  ## `sanity preview [OUTPUTDIR]`
@@ -5813,30 +5834,70 @@ EXAMPLES
5813
5834
 
5814
5835
  ## `sanity workflows blueprints generate`
5815
5836
 
5816
- Experimental: generate the Sanity Blueprints runtime the definitions require, next to sanity.workflow.ts. Writes the workflow resources, one function per derived need, the effect-handler registry, and a handler stub per declared effect. Covers every deployment in the config, because the emitted resources module declares them all. These flags and this output may change before the Blueprints backend accepts the sanity.workflow resource.
5837
+ Generate the Sanity Blueprints runtime the definitions require, next to sanity.workflow.ts. Writes the workflow resources, one function per derived need, the effect-handler registry, and a handler stub per declared effect. Covers every deployment in the config, because the emitted resources module declares them all. Document functions deploy from sanity.blueprint.ts to a project stack with a project token; a generated heartbeat deploys from workflows-heartbeat/ to an organization stack with an organization deploy token.
5817
5838
 
5818
5839
  ```
5819
5840
  USAGE
5820
- $ sanity workflows blueprints generate [--path <file|dir>] [--check]
5841
+ $ sanity workflows blueprints generate [--path <file|dir>] [--verbose | --check]
5821
5842
 
5822
5843
  FLAGS
5823
- --check Experimental: verify the tree on disk still matches the definitions; write nothing and exit
5824
- non-zero on any difference. The CI drift gate.
5844
+ --check Verify the tree on disk still matches the definitions; write nothing and exit non-zero on any
5845
+ difference. The CI drift gate.
5825
5846
  --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents. Defaults
5826
5847
  to the current directory.
5848
+ --verbose Print the full runtime-needs report, every file written, and the heartbeat stack instructions even
5849
+ when its files are unchanged, in place of the summary of what changed and what needs you.
5827
5850
 
5828
5851
  DESCRIPTION
5829
- Experimental: generate the Sanity Blueprints runtime the definitions require, next to sanity.workflow.ts. Writes the
5830
- workflow resources, one function per derived need, the effect-handler registry, and a handler stub per declared
5831
- effect. Covers every deployment in the config, because the emitted resources module declares them all. These flags and
5832
- this output may change before the Blueprints backend accepts the sanity.workflow resource.
5852
+ Generate the Sanity Blueprints runtime the definitions require, next to sanity.workflow.ts. Writes the workflow
5853
+ resources, one function per derived need, the effect-handler registry, and a handler stub per declared effect. Covers
5854
+ every deployment in the config, because the emitted resources module declares them all. Document functions deploy from
5855
+ sanity.blueprint.ts to a project stack with a project token; a generated heartbeat deploys from workflows-heartbeat/
5856
+ to an organization stack with an organization deploy token.
5833
5857
 
5834
5858
  EXAMPLES
5835
5859
  $ sanity workflows blueprints generate
5836
5860
 
5861
+ $ sanity workflows blueprints generate --verbose
5862
+
5837
5863
  $ sanity workflows blueprints generate --check
5838
5864
  ```
5839
5865
 
5866
+ ## `sanity workflows codemod packages [PATH]`
5867
+
5868
+ Move imports and package.json dependencies from the retired Workflows packages to @sanity/workflows, @sanity/workflows-ui, @sanity/workflows-cli, and @sanity/workflows-test. Rewrites module specifiers in import, export, dynamic import(), require(), and vi.mock() calls, and replaces the old packages in every package.json dependency field. Imports of exports renamed in the same release, such as workflowStudioPlugin, are renamed with every reference to them, as are names after an import() type. A name read through export *, require(), import x = require(), a dynamic import(), a mocked module factory, a computed member, or destructuring from a namespace keeps its old name, so check require() calls, plain JavaScript files, and test mocks by hand. Package names in other strings, comments, and built-up specifiers are listed for you to fix by hand, as are members read through a namespace name the file declares again: rename one if it reads the import. Generated blueprint files are skipped: run blueprints generate after installing. Lockfiles are never edited.
5869
+
5870
+ ```
5871
+ USAGE
5872
+ $ sanity workflows codemod packages [PATH...] [--dry-run]
5873
+
5874
+ ARGUMENTS
5875
+ [PATH...] File or directory to rewrite. Pass several to limit the run; defaults to the current directory. Directories
5876
+ skip node_modules, dist, and files git ignores.
5877
+
5878
+ FLAGS
5879
+ --dry-run Print what would change and write nothing.
5880
+
5881
+ DESCRIPTION
5882
+ Move imports and package.json dependencies from the retired Workflows packages to @sanity/workflows,
5883
+ @sanity/workflows-ui, @sanity/workflows-cli, and @sanity/workflows-test. Rewrites module specifiers in import, export,
5884
+ dynamic import(), require(), and vi.mock() calls, and replaces the old packages in every package.json dependency
5885
+ field. Imports of exports renamed in the same release, such as workflowStudioPlugin, are renamed with every reference
5886
+ to them, as are names after an import() type. A name read through export *, require(), import x = require(), a dynamic
5887
+ import(), a mocked module factory, a computed member, or destructuring from a namespace keeps its old name, so check
5888
+ require() calls, plain JavaScript files, and test mocks by hand. Package names in other strings, comments, and
5889
+ built-up specifiers are listed for you to fix by hand, as are members read through a namespace name the file declares
5890
+ again: rename one if it reads the import. Generated blueprint files are skipped: run blueprints generate after
5891
+ installing. Lockfiles are never edited.
5892
+
5893
+ EXAMPLES
5894
+ $ sanity workflows codemod packages --dry-run
5895
+
5896
+ $ sanity workflows codemod packages
5897
+
5898
+ $ sanity workflows codemod packages apps/studio packages/shared
5899
+ ```
5900
+
5840
5901
  ## `sanity workflows definitions delete NAME`
5841
5902
 
5842
5903
  Delete a deployed workflow definition (every version, or one via --version). Refuses while non-terminal instances exist unless --cascade aborts them first — instances are aborted in place, never deleted.
@@ -5895,9 +5956,9 @@ DESCRIPTION
5895
5956
  Diff an in-code definition against the deployed version (latest by default).
5896
5957
 
5897
5958
  EXAMPLES
5898
- $ sanity workflows definitions diff productLaunch
5959
+ $ sanity workflows definitions diff product-launch
5899
5960
 
5900
- $ sanity workflows definitions diff productLaunch --version 2
5961
+ $ sanity workflows definitions diff product-launch --version 2
5901
5962
  ```
5902
5963
 
5903
5964
  ## `sanity workflows definitions list`
@@ -5906,8 +5967,8 @@ List deployed workflow definitions.
5906
5967
 
5907
5968
  ```
5908
5969
  USAGE
5909
- $ sanity workflows definitions list [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> | [--deployment
5910
- <value> | --partition <value>]] [--limit <value>] [--name <value>] [--json]
5970
+ $ sanity workflows definitions list [--workflow-resource <type>:<id> | -p <id> | -d <name> | | --path <file|dir> |
5971
+ [--deployment <value> | --partition <value>]] [--limit <value>] [--name <value>] [--json]
5911
5972
 
5912
5973
  FLAGS
5913
5974
  --deployment=<value> Deployment name — read only the resource and partition that deployment targets.
@@ -5920,9 +5981,10 @@ FLAGS
5920
5981
  Defaults to the current directory.
5921
5982
 
5922
5983
  OVERRIDE FLAGS
5923
- -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
5924
- -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
5925
- --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
5984
+ -d, --dataset=<name> Dataset to read, with --project-id (overrides sanity.workflow.ts)
5985
+ -p, --project-id=<id> Project ID of the dataset to read, with --dataset (overrides sanity.workflow.ts)
5986
+ --workflow-resource=<type>:<id> Resource to read, as <type>:<id>: dataset:<projectId>.<dataset>,
5987
+ media-library:<id>, canvas:<id> or dashboard:<id> (overrides sanity.workflow.ts)
5926
5988
 
5927
5989
  DESCRIPTION
5928
5990
  List deployed workflow definitions.
@@ -5941,8 +6003,8 @@ Show a deployed workflow definition.
5941
6003
 
5942
6004
  ```
5943
6005
  USAGE
5944
- $ sanity workflows definitions show NAME [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> | [--deployment
5945
- <value> | --partition <value>]] [--version <value>] [--json]
6006
+ $ sanity workflows definitions show NAME [--workflow-resource <type>:<id> | -p <id> | -d <name> | | --path <file|dir> |
6007
+ [--deployment <value> | --partition <value>]] [--version <value>] [--json]
5946
6008
 
5947
6009
  ARGUMENTS
5948
6010
  NAME Workflow definition name.
@@ -5957,9 +6019,10 @@ FLAGS
5957
6019
  --version=<value> Specific version (default: latest).
5958
6020
 
5959
6021
  OVERRIDE FLAGS
5960
- -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
5961
- -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
5962
- --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
6022
+ -d, --dataset=<name> Dataset to read, with --project-id (overrides sanity.workflow.ts)
6023
+ -p, --project-id=<id> Project ID of the dataset to read, with --dataset (overrides sanity.workflow.ts)
6024
+ --workflow-resource=<type>:<id> Resource to read, as <type>:<id>: dataset:<projectId>.<dataset>,
6025
+ media-library:<id>, canvas:<id> or dashboard:<id> (overrides sanity.workflow.ts)
5963
6026
 
5964
6027
  DESCRIPTION
5965
6028
  Show a deployed workflow definition.
@@ -6043,7 +6106,7 @@ EXAMPLES
6043
6106
 
6044
6107
  $ sanity workflows deploy --check --verbose
6045
6108
 
6046
- $ sanity workflows deploy --only productLaunch
6109
+ $ sanity workflows deploy --only product-launch
6047
6110
  ```
6048
6111
 
6049
6112
  ## `sanity workflows diagnose INSTANCEID`
@@ -6052,7 +6115,7 @@ Explain why a workflow instance is or isn't progressing, and what would unstick
6052
6115
 
6053
6116
  ```
6054
6117
  USAGE
6055
- $ sanity workflows diagnose INSTANCEID [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> |
6118
+ $ sanity workflows diagnose INSTANCEID [--workflow-resource <type>:<id> | -p <id> | -d <name> | | --path <file|dir> |
6056
6119
  [--deployment <value> | --partition <value>]] [--json]
6057
6120
 
6058
6121
  ARGUMENTS
@@ -6068,9 +6131,10 @@ FLAGS
6068
6131
  Defaults to the current directory.
6069
6132
 
6070
6133
  OVERRIDE FLAGS
6071
- -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
6072
- -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
6073
- --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
6134
+ -d, --dataset=<name> Dataset to read, with --project-id (overrides sanity.workflow.ts)
6135
+ -p, --project-id=<id> Project ID of the dataset to read, with --dataset (overrides sanity.workflow.ts)
6136
+ --workflow-resource=<type>:<id> Resource to read, as <type>:<id>: dataset:<projectId>.<dataset>,
6137
+ media-library:<id>, canvas:<id> or dashboard:<id> (overrides sanity.workflow.ts)
6074
6138
 
6075
6139
  DESCRIPTION
6076
6140
  Explain why a workflow instance is or isn't progressing, and what would unstick it.
@@ -6122,14 +6186,14 @@ EXAMPLES
6122
6186
 
6123
6187
  ## `sanity workflows list`
6124
6188
 
6125
- List workflow instances (in-flight by default) across the resources sanity.workflow.ts declares, or in the one resource --project-id/--dataset or --media-library-id names.
6189
+ List workflow instances (in-flight by default) across the resources sanity.workflow.ts declares, or in the one resource --workflow-resource (or --project-id with --dataset) names.
6126
6190
 
6127
6191
  ```
6128
6192
  USAGE
6129
- $ sanity workflows list [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> | [--deployment
6130
- <value> | --partition <value>]] [--include-completed] [--failed] [--definition <value>] [--document <value>]
6131
- [--assignment-user <value>] [--assignment-role <value>...] [--assignment-state unrouted|routed|held...] [--limit
6132
- <value>] [--json]
6193
+ $ sanity workflows list [--workflow-resource <type>:<id> | -p <id> | -d <name> | | --path <file|dir> |
6194
+ [--deployment <value> | --partition <value>]] [--include-completed] [--failed] [--definition <value>] [--document
6195
+ <value>] [--assignment-user <value>] [--assignment-role <value>...] [--assignment-state unrouted|routed|held...]
6196
+ [--limit <value>] [--json]
6133
6197
 
6134
6198
  FLAGS
6135
6199
  --assignment-role=<value>... A literal project role held by --assignment-user. Repeat for multiple roles.
@@ -6152,20 +6216,23 @@ FLAGS
6152
6216
  parents. Defaults to the current directory.
6153
6217
 
6154
6218
  OVERRIDE FLAGS
6155
- -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
6156
- -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
6157
- --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
6219
+ -d, --dataset=<name> Dataset to read, with --project-id (overrides sanity.workflow.ts)
6220
+ -p, --project-id=<id> Project ID of the dataset to read, with --dataset (overrides sanity.workflow.ts)
6221
+ --workflow-resource=<type>:<id> Resource to read, as <type>:<id>: dataset:<projectId>.<dataset>,
6222
+ media-library:<id>, canvas:<id> or dashboard:<id> (overrides sanity.workflow.ts)
6158
6223
 
6159
6224
  DESCRIPTION
6160
6225
  List workflow instances (in-flight by default) across the resources sanity.workflow.ts declares, or in the one
6161
- resource --project-id/--dataset or --media-library-id names.
6226
+ resource --workflow-resource (or --project-id with --dataset) names.
6162
6227
 
6163
6228
  EXAMPLES
6164
6229
  $ sanity workflows list
6165
6230
 
6166
6231
  $ sanity workflows list --include-completed
6167
6232
 
6168
- $ sanity workflows list --definition productLaunch
6233
+ $ sanity workflows list --workflow-resource media-library:mlAbc123
6234
+
6235
+ $ sanity workflows list --definition product-launch
6169
6236
 
6170
6237
  $ sanity workflows list --document dataset:proj:ds:article-1
6171
6238
 
@@ -6243,48 +6310,13 @@ EXAMPLES
6243
6310
  $ sanity workflows reset-activity wf-instance.abc123 legal-review --skip
6244
6311
  ```
6245
6312
 
6246
- ## `sanity workflows set-stage INSTANCEID`
6247
-
6248
- Force an instance into a stage, regardless of its declared transitions and filters — the engine's setStage admin override. The target stage's enter lifecycle still runs (auto-activities start, stage guards reconcile), and the post-move cascade can immediately auto-transition the instance onward.
6249
-
6250
- ```
6251
- USAGE
6252
- $ sanity workflows set-stage INSTANCEID [--path <file|dir>] [--deployment <value> | --partition <value>] [--to <value>]
6253
- [--reason <value>]
6254
-
6255
- ARGUMENTS
6256
- INSTANCEID Workflow instance id to move.
6257
-
6258
- FLAGS
6259
- --deployment=<value> Deployment name — narrow the instance search to the resource that deployment targets; the
6260
- partition still comes from the loaded instance.
6261
- --partition=<value> Workflow environment partition (e.g. prod, test) — narrows which resources are searched for the
6262
- instance; the instance's stored partition is what the command uses.
6263
- --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6264
- Defaults to the current directory.
6265
- --reason=<value> Free-text reason — recorded on the history entry for audit.
6266
- --to=<value> Target stage name. Omit on an interactive terminal to pick from the workflow’s stages.
6267
-
6268
- DESCRIPTION
6269
- Force an instance into a stage, regardless of its declared transitions and filters — the engine's setStage admin
6270
- override. The target stage's enter lifecycle still runs (auto-activities start, stage guards reconcile), and the
6271
- post-move cascade can immediately auto-transition the instance onward.
6272
-
6273
- EXAMPLES
6274
- $ sanity workflows set-stage wf-instance.abc123 --to ready
6275
-
6276
- $ sanity workflows set-stage wf-instance.abc123
6277
-
6278
- $ sanity workflows set-stage wf-instance.abc123 --to ready --reason 'unblock for demo'
6279
- ```
6280
-
6281
6313
  ## `sanity workflows show INSTANCEID`
6282
6314
 
6283
6315
  Show the state, activities, and effects of a workflow instance.
6284
6316
 
6285
6317
  ```
6286
6318
  USAGE
6287
- $ sanity workflows show INSTANCEID [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> |
6319
+ $ sanity workflows show INSTANCEID [--workflow-resource <type>:<id> | -p <id> | -d <name> | | --path <file|dir> |
6288
6320
  [--deployment <value> | --partition <value>]] [--include history...] [--json]
6289
6321
 
6290
6322
  ARGUMENTS
@@ -6303,9 +6335,10 @@ FLAGS
6303
6335
  Defaults to the current directory.
6304
6336
 
6305
6337
  OVERRIDE FLAGS
6306
- -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
6307
- -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
6308
- --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
6338
+ -d, --dataset=<name> Dataset to read, with --project-id (overrides sanity.workflow.ts)
6339
+ -p, --project-id=<id> Project ID of the dataset to read, with --dataset (overrides sanity.workflow.ts)
6340
+ --workflow-resource=<type>:<id> Resource to read, as <type>:<id>: dataset:<projectId>.<dataset>,
6341
+ media-library:<id>, canvas:<id> or dashboard:<id> (overrides sanity.workflow.ts)
6309
6342
 
6310
6343
  DESCRIPTION
6311
6344
  Show the state, activities, and effects of a workflow instance.
@@ -6325,47 +6358,53 @@ Start a workflow instance from a deployed definition. Supply values for the work
6325
6358
  ```
6326
6359
  USAGE
6327
6360
  $ sanity workflows start NAME [--path <file|dir>] [--deployment <value> | --partition <value>] [--version <value>]
6328
- [--field <value>...] [--instance-id <value>] [--json]
6361
+ [--field <value>...] [--release-resource <alias>] [--instance-id <value>] [--json]
6329
6362
 
6330
6363
  ARGUMENTS
6331
6364
  NAME Workflow definition name.
6332
6365
 
6333
6366
  FLAGS
6334
- --deployment=<value> Deployment name — the unique identity of one deployment in the config.
6335
- --field=<value>... [default: ] Initial value for a declared input-sourced field, as name=value (repeatable).
6336
- Values are JSON-parsed, falling back to a string; ref kinds take a JSON object with a GDR `id`
6337
- and doc `type`.
6338
- --instance-id=<value> Start under this instance id — for retries. The id is the start's idempotency key: pass the id
6339
- of a start that failed partway and the engine resumes it instead of creating a duplicate (an
6340
- already-settled start replays as a no-op). Omit to mint a fresh id.
6341
- --json Emit structured JSON instead of rendered output.
6342
- --partition=<value> Workflow environment partition (e.g. prod, test) — selects the deployment to act on while the
6343
- partition names exactly one; pass --deployment when it spans several.
6344
- --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6345
- Defaults to the current directory.
6346
- --version=<value> Definition version to start from (default: highest deployed).
6367
+ --deployment=<value> Deployment name — the unique identity of one deployment in the config.
6368
+ --field=<value>... [default: ] Initial value for a declared input-sourced field, as name=value (repeatable).
6369
+ Values are JSON-parsed, falling back to a string; ref kinds take a JSON object with a GDR
6370
+ `id` and doc `type`. A release ref also takes a bare Content Release name.
6371
+ --instance-id=<value> Start under this instance id — for retries. The id is the start's idempotency key: pass
6372
+ the id of a start that failed partway and the engine resumes it instead of creating a
6373
+ duplicate (an already-settled start replays as a no-op). Omit to mint a fresh id.
6374
+ --json Emit structured JSON instead of rendered output.
6375
+ --partition=<value> Workflow environment partition (e.g. prod, test) — selects the deployment to act on while
6376
+ the partition names exactly one; pass --deployment when it spans several.
6377
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6378
+ Defaults to the current directory.
6379
+ --release-resource=<alias> Resource alias (from the deployment's `resourceAliases`) that bare release names in
6380
+ --field point at. Needed when the deployment binds several other resources.
6381
+ --version=<value> Definition version to start from (default: highest deployed).
6347
6382
 
6348
6383
  DESCRIPTION
6349
6384
  Start a workflow instance from a deployed definition. Supply values for the workflow's input-sourced fields with
6350
6385
  --field (e.g. the subject document ref).
6351
6386
 
6352
6387
  EXAMPLES
6353
- $ sanity workflows start productLaunch
6388
+ $ sanity workflows start product-launch
6354
6389
 
6355
6390
  $ sanity workflows start article-review --field subject='{"id":"dataset:proj:ds:article-1","type":"article"}'
6356
6391
 
6357
- $ sanity workflows start productLaunch --version 2 --partition prod
6392
+ $ sanity workflows start release-review --field release=rA1b2C3d4
6393
+
6394
+ $ sanity workflows start release-review --field release=rA1b2C3d4 --release-resource content
6358
6395
 
6359
- $ sanity workflows start productLaunch --instance-id prod.wf-instance.a1b2c3d4e5f6
6396
+ $ sanity workflows start product-launch --version 2 --partition prod
6397
+
6398
+ $ sanity workflows start product-launch --instance-id prod.wf-instance.a1b2c3d4e5f6
6360
6399
  ```
6361
6400
 
6362
6401
  ## `sanity workflows tail INSTANCEID`
6363
6402
 
6364
- Stream new history entries on a workflow instance as they land in the dataset.
6403
+ Stream new history entries on a workflow instance as they land in its workflow resource.
6365
6404
 
6366
6405
  ```
6367
6406
  USAGE
6368
- $ sanity workflows tail INSTANCEID [--media-library-id <id> | [-p <id> -d <name>] | | --path <file|dir> |
6407
+ $ sanity workflows tail INSTANCEID [--workflow-resource <type>:<id> | -p <id> | -d <name> | | --path <file|dir> |
6369
6408
  [--deployment <value> | --partition <value>]]
6370
6409
 
6371
6410
  ARGUMENTS
@@ -6380,15 +6419,52 @@ FLAGS
6380
6419
  Defaults to the current directory.
6381
6420
 
6382
6421
  OVERRIDE FLAGS
6383
- -d, --dataset=<name> Dataset to read (overrides sanity.workflow.ts)
6384
- -p, --project-id=<id> Project ID of the dataset to read (overrides sanity.workflow.ts)
6385
- --media-library-id=<id> Media library to read (overrides sanity.workflow.ts)
6422
+ -d, --dataset=<name> Dataset to read, with --project-id (overrides sanity.workflow.ts)
6423
+ -p, --project-id=<id> Project ID of the dataset to read, with --dataset (overrides sanity.workflow.ts)
6424
+ --workflow-resource=<type>:<id> Resource to read, as <type>:<id>: dataset:<projectId>.<dataset>,
6425
+ media-library:<id>, canvas:<id> or dashboard:<id> (overrides sanity.workflow.ts)
6386
6426
 
6387
6427
  DESCRIPTION
6388
- Stream new history entries on a workflow instance as they land in the dataset.
6428
+ Stream new history entries on a workflow instance as they land in its workflow resource.
6389
6429
 
6390
6430
  EXAMPLES
6391
6431
  $ sanity workflows tail wf-instance.abc123
6392
6432
  ```
6393
6433
 
6434
+ ## `sanity workflows whoami`
6435
+
6436
+ Show the user ID Workflows records for your login. Put the Sanity user ID in user assignee fields.
6437
+
6438
+ ```
6439
+ USAGE
6440
+ $ sanity workflows whoami [--workflow-resource <type>:<id> | -p <id> | -d <name> | | --path <file|dir> |
6441
+ [--deployment <value> | --partition <value>]] [--json]
6442
+
6443
+ FLAGS
6444
+ --deployment=<value> Deployment name — read only the resource and partition that deployment targets.
6445
+ --json Emit structured JSON instead of rendered output.
6446
+ --partition=<value> Workflow environment partition (e.g. prod, test) — an optional query filter that also narrows
6447
+ which resources are searched; omit to span them all.
6448
+ --path=<file|dir> Path to a sanity.workflow file, or a directory to search from upward through its parents.
6449
+ Defaults to the current directory.
6450
+
6451
+ OVERRIDE FLAGS
6452
+ -d, --dataset=<name> Dataset to read, with --project-id (overrides sanity.workflow.ts)
6453
+ -p, --project-id=<id> Project ID of the dataset to read, with --dataset (overrides sanity.workflow.ts)
6454
+ --workflow-resource=<type>:<id> Resource to read, as <type>:<id>: dataset:<projectId>.<dataset>,
6455
+ media-library:<id>, canvas:<id> or dashboard:<id> (overrides sanity.workflow.ts)
6456
+
6457
+ DESCRIPTION
6458
+ Show the user ID Workflows records for your login. Put the Sanity user ID in user assignee fields.
6459
+
6460
+ EXAMPLES
6461
+ $ sanity workflows whoami
6462
+
6463
+ $ sanity workflows whoami --json
6464
+
6465
+ $ sanity workflows whoami --workflow-resource dataset:abc123.production
6466
+
6467
+ $ sanity workflows whoami --workflow-resource media-library:mlAbc123
6468
+ ```
6469
+
6394
6470
  <!-- commandsstop -->
package/bin/run.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- /* eslint-disable n/no-unsupported-features/node-builtins -- Supported by the Node version guard. */
2
+ /* eslint-disable n-js/no-unsupported-features/node-builtins -- Supported by the Node version guard. */
3
3
  import module from 'node:module'
4
4
 
5
5
  var err = '\u001B[31m\u001B[1mERROR:\u001B[22m\u001B[39m '
@@ -25,7 +25,7 @@ const SETTLED_SYNC_STATUSES = new Set([
25
25
  });
26
26
  const result = 'result' in job ? job.result : undefined;
27
27
  const id = typeof result === 'object' && result !== null && 'syncId' in result ? result.syncId : undefined;
28
- if (typeof id !== 'string') throw new Error(formatJobFailure('Sync', job));
28
+ if (typeof id !== 'string') throw new TypeError(formatJobFailure('Sync', job));
29
29
  syncId = id;
30
30
  }
31
31
  while(true){
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/context/waitForSourceSync.ts"],"sourcesContent":["import {setTimeout as sleep} from 'node:timers/promises'\n\nimport {getSource, getSync, type Sync} from '../../services/context.js'\nimport {waitForJob} from './waitForJob.js'\nimport {formatJobFailure} from './watchJob.js'\n\nconst SYNC_POLL_INTERVAL_MS = 5000\n\nconst SETTLED_SYNC_STATUSES: ReadonlySet<Sync['status']> = new Set([\n 'cancelled',\n 'completed',\n 'failed',\n 'held',\n])\n\n/** The sync to follow: the one a request created, the job a `files` sync runs in, or a website or dataset sync queued on the source */\nexport type SyncTarget =\n | {jobId: string; syncId?: undefined}\n | {jobId?: undefined; previousSyncId: string | null; syncId?: undefined}\n | {jobId?: undefined; syncId: string}\n\n/**\n * Poll until the sync a request created or queued settles (completed, failed,\n * cancelled, or held for confirmation), resolving with that sync. A known\n * sync is followed by its ID; a `files` sync through its job, whose result\n * names the sync. A website or dataset sync is queued behind any running sync\n * of its source and the request returns no ID for it, so it is the first\n * `latestSync` that isn't the one seen before the request.\n */\nexport async function waitForSourceSync(\n knowledgeBaseId: string,\n sourceId: string,\n target: SyncTarget,\n options: {onPoll?: (sync: Sync | null) => void; pollIntervalMs?: number} = {},\n): Promise<Sync> {\n const pollIntervalMs = options.pollIntervalMs ?? SYNC_POLL_INTERVAL_MS\n let syncId = target.syncId\n\n if (target.jobId !== undefined) {\n const job = await waitForJob(knowledgeBaseId, target.jobId, {pollIntervalMs})\n const result: unknown = 'result' in job ? job.result : undefined\n const id =\n typeof result === 'object' && result !== null && 'syncId' in result\n ? result.syncId\n : undefined\n if (typeof id !== 'string') throw new Error(formatJobFailure('Sync', job))\n syncId = id\n }\n\n while (true) {\n let sync: Sync | null\n if (syncId === undefined) {\n const {latestSync} = await getSource(knowledgeBaseId, sourceId)\n const previous = 'previousSyncId' in target ? target.previousSyncId : null\n sync = latestSync && latestSync.id !== previous ? latestSync : null\n } else {\n sync = await getSync(knowledgeBaseId, sourceId, syncId)\n }\n if (sync && SETTLED_SYNC_STATUSES.has(sync.status)) {\n return sync\n }\n options.onPoll?.(sync)\n await sleep(pollIntervalMs)\n }\n}\n"],"names":["setTimeout","sleep","getSource","getSync","waitForJob","formatJobFailure","SYNC_POLL_INTERVAL_MS","SETTLED_SYNC_STATUSES","Set","waitForSourceSync","knowledgeBaseId","sourceId","target","options","pollIntervalMs","syncId","jobId","undefined","job","result","id","Error","sync","latestSync","previous","previousSyncId","has","status","onPoll"],"mappings":"AAAA,SAAQA,cAAcC,KAAK,QAAO,uBAAsB;AAExD,SAAQC,SAAS,EAAEC,OAAO,QAAkB,4BAA2B;AACvE,SAAQC,UAAU,QAAO,kBAAiB;AAC1C,SAAQC,gBAAgB,QAAO,gBAAe;AAE9C,MAAMC,wBAAwB;AAE9B,MAAMC,wBAAqD,IAAIC,IAAI;IACjE;IACA;IACA;IACA;CACD;AAQD;;;;;;;CAOC,GACD,OAAO,eAAeC,kBACpBC,eAAuB,EACvBC,QAAgB,EAChBC,MAAkB,EAClBC,UAA2E,CAAC,CAAC;IAE7E,MAAMC,iBAAiBD,QAAQC,cAAc,IAAIR;IACjD,IAAIS,SAASH,OAAOG,MAAM;IAE1B,IAAIH,OAAOI,KAAK,KAAKC,WAAW;QAC9B,MAAMC,MAAM,MAAMd,WAAWM,iBAAiBE,OAAOI,KAAK,EAAE;YAACF;QAAc;QAC3E,MAAMK,SAAkB,YAAYD,MAAMA,IAAIC,MAAM,GAAGF;QACvD,MAAMG,KACJ,OAAOD,WAAW,YAAYA,WAAW,QAAQ,YAAYA,SACzDA,OAAOJ,MAAM,GACbE;QACN,IAAI,OAAOG,OAAO,UAAU,MAAM,IAAIC,MAAMhB,iBAAiB,QAAQa;QACrEH,SAASK;IACX;IAEA,MAAO,KAAM;QACX,IAAIE;QACJ,IAAIP,WAAWE,WAAW;YACxB,MAAM,EAACM,UAAU,EAAC,GAAG,MAAMrB,UAAUQ,iBAAiBC;YACtD,MAAMa,WAAW,oBAAoBZ,SAASA,OAAOa,cAAc,GAAG;YACtEH,OAAOC,cAAcA,WAAWH,EAAE,KAAKI,WAAWD,aAAa;QACjE,OAAO;YACLD,OAAO,MAAMnB,QAAQO,iBAAiBC,UAAUI;QAClD;QACA,IAAIO,QAAQf,sBAAsBmB,GAAG,CAACJ,KAAKK,MAAM,GAAG;YAClD,OAAOL;QACT;QACAT,QAAQe,MAAM,GAAGN;QACjB,MAAMrB,MAAMa;IACd;AACF"}
1
+ {"version":3,"sources":["../../../src/actions/context/waitForSourceSync.ts"],"sourcesContent":["import {setTimeout as sleep} from 'node:timers/promises'\n\nimport {getSource, getSync, type Sync} from '../../services/context.js'\nimport {waitForJob} from './waitForJob.js'\nimport {formatJobFailure} from './watchJob.js'\n\nconst SYNC_POLL_INTERVAL_MS = 5000\n\nconst SETTLED_SYNC_STATUSES: ReadonlySet<Sync['status']> = new Set([\n 'cancelled',\n 'completed',\n 'failed',\n 'held',\n])\n\n/** The sync to follow: the one a request created, the job a `files` sync runs in, or a website or dataset sync queued on the source */\nexport type SyncTarget =\n | {jobId: string; syncId?: undefined}\n | {jobId?: undefined; previousSyncId: string | null; syncId?: undefined}\n | {jobId?: undefined; syncId: string}\n\n/**\n * Poll until the sync a request created or queued settles (completed, failed,\n * cancelled, or held for confirmation), resolving with that sync. A known\n * sync is followed by its ID; a `files` sync through its job, whose result\n * names the sync. A website or dataset sync is queued behind any running sync\n * of its source and the request returns no ID for it, so it is the first\n * `latestSync` that isn't the one seen before the request.\n */\nexport async function waitForSourceSync(\n knowledgeBaseId: string,\n sourceId: string,\n target: SyncTarget,\n options: {onPoll?: (sync: Sync | null) => void; pollIntervalMs?: number} = {},\n): Promise<Sync> {\n const pollIntervalMs = options.pollIntervalMs ?? SYNC_POLL_INTERVAL_MS\n let syncId = target.syncId\n\n if (target.jobId !== undefined) {\n const job = await waitForJob(knowledgeBaseId, target.jobId, {pollIntervalMs})\n const result: unknown = 'result' in job ? job.result : undefined\n const id =\n typeof result === 'object' && result !== null && 'syncId' in result\n ? result.syncId\n : undefined\n if (typeof id !== 'string') throw new TypeError(formatJobFailure('Sync', job))\n syncId = id\n }\n\n while (true) {\n let sync: Sync | null\n if (syncId === undefined) {\n const {latestSync} = await getSource(knowledgeBaseId, sourceId)\n const previous = 'previousSyncId' in target ? target.previousSyncId : null\n sync = latestSync && latestSync.id !== previous ? latestSync : null\n } else {\n sync = await getSync(knowledgeBaseId, sourceId, syncId)\n }\n if (sync && SETTLED_SYNC_STATUSES.has(sync.status)) {\n return sync\n }\n options.onPoll?.(sync)\n await sleep(pollIntervalMs)\n }\n}\n"],"names":["setTimeout","sleep","getSource","getSync","waitForJob","formatJobFailure","SYNC_POLL_INTERVAL_MS","SETTLED_SYNC_STATUSES","Set","waitForSourceSync","knowledgeBaseId","sourceId","target","options","pollIntervalMs","syncId","jobId","undefined","job","result","id","TypeError","sync","latestSync","previous","previousSyncId","has","status","onPoll"],"mappings":"AAAA,SAAQA,cAAcC,KAAK,QAAO,uBAAsB;AAExD,SAAQC,SAAS,EAAEC,OAAO,QAAkB,4BAA2B;AACvE,SAAQC,UAAU,QAAO,kBAAiB;AAC1C,SAAQC,gBAAgB,QAAO,gBAAe;AAE9C,MAAMC,wBAAwB;AAE9B,MAAMC,wBAAqD,IAAIC,IAAI;IACjE;IACA;IACA;IACA;CACD;AAQD;;;;;;;CAOC,GACD,OAAO,eAAeC,kBACpBC,eAAuB,EACvBC,QAAgB,EAChBC,MAAkB,EAClBC,UAA2E,CAAC,CAAC;IAE7E,MAAMC,iBAAiBD,QAAQC,cAAc,IAAIR;IACjD,IAAIS,SAASH,OAAOG,MAAM;IAE1B,IAAIH,OAAOI,KAAK,KAAKC,WAAW;QAC9B,MAAMC,MAAM,MAAMd,WAAWM,iBAAiBE,OAAOI,KAAK,EAAE;YAACF;QAAc;QAC3E,MAAMK,SAAkB,YAAYD,MAAMA,IAAIC,MAAM,GAAGF;QACvD,MAAMG,KACJ,OAAOD,WAAW,YAAYA,WAAW,QAAQ,YAAYA,SACzDA,OAAOJ,MAAM,GACbE;QACN,IAAI,OAAOG,OAAO,UAAU,MAAM,IAAIC,UAAUhB,iBAAiB,QAAQa;QACzEH,SAASK;IACX;IAEA,MAAO,KAAM;QACX,IAAIE;QACJ,IAAIP,WAAWE,WAAW;YACxB,MAAM,EAACM,UAAU,EAAC,GAAG,MAAMrB,UAAUQ,iBAAiBC;YACtD,MAAMa,WAAW,oBAAoBZ,SAASA,OAAOa,cAAc,GAAG;YACtEH,OAAOC,cAAcA,WAAWH,EAAE,KAAKI,WAAWD,aAAa;QACjE,OAAO;YACLD,OAAO,MAAMnB,QAAQO,iBAAiBC,UAAUI;QAClD;QACA,IAAIO,QAAQf,sBAAsBmB,GAAG,CAACJ,KAAKK,MAAM,GAAG;YAClD,OAAOL;QACT;QACAT,QAAQe,MAAM,GAAGN;QACjB,MAAMrB,MAAMa;IACd;AACF"}
@@ -11,7 +11,7 @@ const portReplacement = ':7777777';
11
11
  return givenOrigin;
12
12
  }
13
13
  // Special validation for file:// protocols
14
- if (/^file:\/\//.test(givenOrigin)) {
14
+ if (givenOrigin.startsWith('file://')) {
15
15
  output.error('Only a local file wildcard is currently allowed: file:///*', {
16
16
  exit: exitCodes.RUNTIME_ERROR
17
17
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/cors/filterAndValidateOrigin.ts"],"sourcesContent":["import {exitCodes, type Output} from '@sanity/cli-core'\n\nconst wildcardReplacement = 'a-wild-card-r3pl4c3m3n7-a'\nconst portReplacement = ':7777777'\n\n/**\n * Filter and validate an origin, throwing an error if invalid.\n *\n * @internal\n */\nexport async function filterAndValidateOrigin(\n givenOrigin: string,\n output: Output,\n): Promise<string> {\n // Handle special cases that are always valid\n if (givenOrigin === '*' || givenOrigin === 'file:///*' || givenOrigin === 'null') {\n return givenOrigin\n }\n\n // Special validation for file:// protocols\n if (/^file:\\/\\//.test(givenOrigin)) {\n output.error('Only a local file wildcard is currently allowed: file:///*', {\n exit: exitCodes.RUNTIME_ERROR,\n })\n }\n\n try {\n const example = givenOrigin\n // Replace wildcards with placeholder values for URL parsing\n .replaceAll(/([^:])\\*/g, `$1${wildcardReplacement}`)\n // Replace port wildcards with placeholder value for URL parsing\n .replace(/:\\*/, portReplacement)\n\n const parsed = new URL(example)\n let host = parsed.host || ''\n\n // Remove default ports for http/https\n if (/^https?:$/.test(parsed.protocol || '')) {\n host = host.replace(/:(80|443)$/, '')\n }\n\n // Restore wildcards\n host = host.replaceAll(portReplacement, ':*').replaceAll(wildcardReplacement, '*')\n\n return `${parsed.protocol}//${host}`\n } catch {\n output.error(`Invalid origin \"${givenOrigin}\", must include protocol (https://some.host)`, {\n exit: exitCodes.RUNTIME_ERROR,\n })\n }\n}\n"],"names":["exitCodes","wildcardReplacement","portReplacement","filterAndValidateOrigin","givenOrigin","output","test","error","exit","RUNTIME_ERROR","example","replaceAll","replace","parsed","URL","host","protocol"],"mappings":"AAAA,SAAQA,SAAS,QAAoB,mBAAkB;AAEvD,MAAMC,sBAAsB;AAC5B,MAAMC,kBAAkB;AAExB;;;;CAIC,GACD,OAAO,eAAeC,wBACpBC,WAAmB,EACnBC,MAAc;IAEd,6CAA6C;IAC7C,IAAID,gBAAgB,OAAOA,gBAAgB,eAAeA,gBAAgB,QAAQ;QAChF,OAAOA;IACT;IAEA,2CAA2C;IAC3C,IAAI,aAAaE,IAAI,CAACF,cAAc;QAClCC,OAAOE,KAAK,CAAC,8DAA8D;YACzEC,MAAMR,UAAUS,aAAa;QAC/B;IACF;IAEA,IAAI;QACF,MAAMC,UAAUN,WACd,4DAA4D;SAC3DO,UAAU,CAAC,aAAa,CAAC,EAAE,EAAEV,qBAAqB,CACnD,gEAAgE;SAC/DW,OAAO,CAAC,OAAOV;QAElB,MAAMW,SAAS,IAAIC,IAAIJ;QACvB,IAAIK,OAAOF,OAAOE,IAAI,IAAI;QAE1B,sCAAsC;QACtC,IAAI,YAAYT,IAAI,CAACO,OAAOG,QAAQ,IAAI,KAAK;YAC3CD,OAAOA,KAAKH,OAAO,CAAC,cAAc;QACpC;QAEA,oBAAoB;QACpBG,OAAOA,KAAKJ,UAAU,CAACT,iBAAiB,MAAMS,UAAU,CAACV,qBAAqB;QAE9E,OAAO,GAAGY,OAAOG,QAAQ,CAAC,EAAE,EAAED,MAAM;IACtC,EAAE,OAAM;QACNV,OAAOE,KAAK,CAAC,CAAC,gBAAgB,EAAEH,YAAY,4CAA4C,CAAC,EAAE;YACzFI,MAAMR,UAAUS,aAAa;QAC/B;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/actions/cors/filterAndValidateOrigin.ts"],"sourcesContent":["import {exitCodes, type Output} from '@sanity/cli-core'\n\nconst wildcardReplacement = 'a-wild-card-r3pl4c3m3n7-a'\nconst portReplacement = ':7777777'\n\n/**\n * Filter and validate an origin, throwing an error if invalid.\n *\n * @internal\n */\nexport async function filterAndValidateOrigin(\n givenOrigin: string,\n output: Output,\n): Promise<string> {\n // Handle special cases that are always valid\n if (givenOrigin === '*' || givenOrigin === 'file:///*' || givenOrigin === 'null') {\n return givenOrigin\n }\n\n // Special validation for file:// protocols\n if (givenOrigin.startsWith('file://')) {\n output.error('Only a local file wildcard is currently allowed: file:///*', {\n exit: exitCodes.RUNTIME_ERROR,\n })\n }\n\n try {\n const example = givenOrigin\n // Replace wildcards with placeholder values for URL parsing\n .replaceAll(/([^:])\\*/g, `$1${wildcardReplacement}`)\n // Replace port wildcards with placeholder value for URL parsing\n .replace(/:\\*/, portReplacement)\n\n const parsed = new URL(example)\n let host = parsed.host || ''\n\n // Remove default ports for http/https\n if (/^https?:$/.test(parsed.protocol || '')) {\n host = host.replace(/:(80|443)$/, '')\n }\n\n // Restore wildcards\n host = host.replaceAll(portReplacement, ':*').replaceAll(wildcardReplacement, '*')\n\n return `${parsed.protocol}//${host}`\n } catch {\n output.error(`Invalid origin \"${givenOrigin}\", must include protocol (https://some.host)`, {\n exit: exitCodes.RUNTIME_ERROR,\n })\n }\n}\n"],"names":["exitCodes","wildcardReplacement","portReplacement","filterAndValidateOrigin","givenOrigin","output","startsWith","error","exit","RUNTIME_ERROR","example","replaceAll","replace","parsed","URL","host","test","protocol"],"mappings":"AAAA,SAAQA,SAAS,QAAoB,mBAAkB;AAEvD,MAAMC,sBAAsB;AAC5B,MAAMC,kBAAkB;AAExB;;;;CAIC,GACD,OAAO,eAAeC,wBACpBC,WAAmB,EACnBC,MAAc;IAEd,6CAA6C;IAC7C,IAAID,gBAAgB,OAAOA,gBAAgB,eAAeA,gBAAgB,QAAQ;QAChF,OAAOA;IACT;IAEA,2CAA2C;IAC3C,IAAIA,YAAYE,UAAU,CAAC,YAAY;QACrCD,OAAOE,KAAK,CAAC,8DAA8D;YACzEC,MAAMR,UAAUS,aAAa;QAC/B;IACF;IAEA,IAAI;QACF,MAAMC,UAAUN,WACd,4DAA4D;SAC3DO,UAAU,CAAC,aAAa,CAAC,EAAE,EAAEV,qBAAqB,CACnD,gEAAgE;SAC/DW,OAAO,CAAC,OAAOV;QAElB,MAAMW,SAAS,IAAIC,IAAIJ;QACvB,IAAIK,OAAOF,OAAOE,IAAI,IAAI;QAE1B,sCAAsC;QACtC,IAAI,YAAYC,IAAI,CAACH,OAAOI,QAAQ,IAAI,KAAK;YAC3CF,OAAOA,KAAKH,OAAO,CAAC,cAAc;QACpC;QAEA,oBAAoB;QACpBG,OAAOA,KAAKJ,UAAU,CAACT,iBAAiB,MAAMS,UAAU,CAACV,qBAAqB;QAE9E,OAAO,GAAGY,OAAOI,QAAQ,CAAC,EAAE,EAAEF,MAAM;IACtC,EAAE,OAAM;QACNV,OAAOE,KAAK,CAAC,CAAC,gBAAgB,EAAEH,YAAY,4CAA4C,CAAC,EAAE;YACzFI,MAAMR,UAAUS,aAAa;QAC/B;IACF;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { extractValidationFromSchemaError, workerBuildStudioSchemasAndManifests } from '@sanity/cli-build/_internal/extract';
2
2
  import { subdebug } from '@sanity/cli-core';
3
+ import { spinner } from '@sanity/cli-core/ux';
3
4
  import { updateWorkspacesSchemas } from '../schema/updateWorkspaceSchema.js';
4
5
  import { deployStudioSchemasAndManifestsWorkerData } from './types.js';
5
6
  const debug = subdebug('deployStudioSchemasAndManifests.worker');
@@ -24,7 +25,18 @@ const debug = subdebug('deployStudioSchemasAndManifests.worker');
24
25
  });
25
26
  };
26
27
  try {
27
- const result = await workerBuildStudioSchemasAndManifests(options);
28
+ const spin = spinner('Generating studio manifest');
29
+ const result = await workerBuildStudioSchemasAndManifests(options, {
30
+ onGenerateManifestDone () {
31
+ spin.succeed('Generated studio manifest');
32
+ },
33
+ onGenerateManifestFail (error) {
34
+ spin.fail(error instanceof Error ? error.message : 'Unknown error');
35
+ },
36
+ onGenerateManifestStart () {
37
+ spin.start();
38
+ }
39
+ });
28
40
  port.postMessage({
29
41
  studioManifest: result.studioManifest,
30
42
  type: 'success'