@sanity/runtime-cli 17.6.0 → 17.6.2

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 CHANGED
@@ -90,7 +90,7 @@ EXAMPLES
90
90
  $ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
91
91
  ```
92
92
 
93
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/add.ts)_
93
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/add.ts)_
94
94
 
95
95
  ## `sanity-run blueprints config`
96
96
 
@@ -127,7 +127,7 @@ EXAMPLES
127
127
  $ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
128
128
  ```
129
129
 
130
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/config.ts)_
130
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/config.ts)_
131
131
 
132
132
  ## `sanity-run blueprints deploy`
133
133
 
@@ -183,7 +183,7 @@ EXAMPLES
183
183
  $ sanity-run blueprints deploy --new-stack-name <new-name>
184
184
  ```
185
185
 
186
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/deploy.ts)_
186
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/deploy.ts)_
187
187
 
188
188
  ## `sanity-run blueprints destroy`
189
189
 
@@ -221,7 +221,7 @@ EXAMPLES
221
221
  $ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
222
222
  ```
223
223
 
224
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/destroy.ts)_
224
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/destroy.ts)_
225
225
 
226
226
  ## `sanity-run blueprints doctor`
227
227
 
@@ -253,7 +253,7 @@ EXAMPLES
253
253
  $ sanity-run blueprints doctor --fix
254
254
  ```
255
255
 
256
- _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/doctor.ts)_
256
+ _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/doctor.ts)_
257
257
 
258
258
  ## `sanity-run blueprints info`
259
259
 
@@ -291,7 +291,7 @@ EXAMPLES
291
291
  $ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
292
292
  ```
293
293
 
294
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/info.ts)_
294
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/info.ts)_
295
295
 
296
296
  ## `sanity-run blueprints init [DIR]`
297
297
 
@@ -355,7 +355,7 @@ EXAMPLES
355
355
  $ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
356
356
  ```
357
357
 
358
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/init.ts)_
358
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/init.ts)_
359
359
 
360
360
  ## `sanity-run blueprints logs`
361
361
 
@@ -401,7 +401,7 @@ EXAMPLES
401
401
  $ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
402
402
  ```
403
403
 
404
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/logs.ts)_
404
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/logs.ts)_
405
405
 
406
406
  ## `sanity-run blueprints mint-deploy-token`
407
407
 
@@ -446,7 +446,7 @@ EXAMPLES
446
446
  $ sanity-run blueprints mint-deploy-token --organization-id <orgId>
447
447
  ```
448
448
 
449
- _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/mint-deploy-token.ts)_
449
+ _See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/mint-deploy-token.ts)_
450
450
 
451
451
  ## `sanity-run blueprints plan`
452
452
 
@@ -479,7 +479,7 @@ EXAMPLES
479
479
  $ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
480
480
  ```
481
481
 
482
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/plan.ts)_
482
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/plan.ts)_
483
483
 
484
484
  ## `sanity-run blueprints promote`
485
485
 
@@ -515,7 +515,7 @@ EXAMPLES
515
515
  $ sanity-run blueprints promote --new-stack-name <new-name>
516
516
  ```
517
517
 
518
- _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/promote.ts)_
518
+ _See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/promote.ts)_
519
519
 
520
520
  ## `sanity-run blueprints stacks`
521
521
 
@@ -551,7 +551,7 @@ EXAMPLES
551
551
  $ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
552
552
  ```
553
553
 
554
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/blueprints/stacks.ts)_
554
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/blueprints/stacks.ts)_
555
555
 
556
556
  ## `sanity-run functions add`
557
557
 
@@ -603,7 +603,7 @@ EXAMPLES
603
603
  $ sanity-run functions add --name my-function --type document-create --type document-update --lang js
604
604
  ```
605
605
 
606
- _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/functions/add.ts)_
606
+ _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/functions/add.ts)_
607
607
 
608
608
  ## `sanity-run functions dev`
609
609
 
@@ -638,7 +638,7 @@ EXAMPLES
638
638
  $ sanity-run functions dev --timeout 60
639
639
  ```
640
640
 
641
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/functions/dev.ts)_
641
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/functions/dev.ts)_
642
642
 
643
643
  ## `sanity-run functions env add NAME KEY VALUE`
644
644
 
@@ -671,7 +671,7 @@ EXAMPLES
671
671
  $ sanity-run functions env add --stack <name-or-id> MyFunction API_URL https://api.example.com/
672
672
  ```
673
673
 
674
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/functions/env/add.ts)_
674
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/functions/env/add.ts)_
675
675
 
676
676
  ## `sanity-run functions env list NAME`
677
677
 
@@ -701,7 +701,7 @@ EXAMPLES
701
701
  $ sanity-run functions env list --stack <name-or-id> MyFunction
702
702
  ```
703
703
 
704
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/functions/env/list.ts)_
704
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/functions/env/list.ts)_
705
705
 
706
706
  ## `sanity-run functions env remove NAME KEY`
707
707
 
@@ -733,7 +733,7 @@ EXAMPLES
733
733
  $ sanity-run functions env remove --stack <name-or-id> MyFunction API_URL
734
734
  ```
735
735
 
736
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/functions/env/remove.ts)_
736
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/functions/env/remove.ts)_
737
737
 
738
738
  ## `sanity-run functions logs [NAME]`
739
739
 
@@ -773,7 +773,7 @@ EXAMPLES
773
773
  $ sanity-run functions logs <name> --delete
774
774
  ```
775
775
 
776
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/functions/logs.ts)_
776
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/functions/logs.ts)_
777
777
 
778
778
  ## `sanity-run functions test [NAME]`
779
779
 
@@ -830,7 +830,7 @@ EXAMPLES
830
830
  $ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
831
831
  ```
832
832
 
833
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.0/src/commands/functions/test.ts)_
833
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.6.2/src/commands/functions/test.ts)_
834
834
 
835
835
  ## `sanity-run help [COMMAND]`
836
836
 
@@ -1,4 +1,3 @@
1
- import { env } from 'node:process';
2
1
  import { resolveDeployedResources } from '../../utils/blueprints/resolve-deployed-resources.js';
3
2
  import { CODE_OPERATION_UNCONFIRMED, EXIT_OPERATION_UNCONFIRMED } from '../../utils/exit-codes.js';
4
3
  import { styleText } from '../../utils/style-text.js';
@@ -10,24 +9,18 @@ export async function preDeploy(options) {
10
9
  const { resources, stackId, auth, blueprintFileDir, installer, logger } = options;
11
10
  const hasAssetResources = resources.some(isAssetResource);
12
11
  if (hasAssetResources) {
13
- let assetResources;
14
- if (env.SANITY_BLUEPRINTS_PRE_DEPLOY_ENABLED === 'true') {
15
- const preDeployStackResult = await preDeployStack(options);
16
- if (!preDeployStackResult.success) {
17
- return preDeployStackResult;
18
- }
19
- /** Look up resources from the back-end and attach the externalId if possible */
20
- const resolvedResources = await resolveDeployedResources({
21
- resources,
22
- stackId,
23
- auth,
24
- logger,
25
- });
26
- assetResources = resolvedResources.filter(isAssetResource);
27
- }
28
- else {
29
- assetResources = resources.filter(isAssetResource);
12
+ const preDeployStackResult = await preDeployStack(options);
13
+ if (!preDeployStackResult.success) {
14
+ return preDeployStackResult;
30
15
  }
16
+ /** Look up resources from the back-end and attach the externalId if possible */
17
+ const resolvedResources = await resolveDeployedResources({
18
+ resources,
19
+ stackId,
20
+ auth,
21
+ logger,
22
+ });
23
+ const assetResources = resolvedResources.filter(isAssetResource);
31
24
  let processedAssets;
32
25
  try {
33
26
  processedAssets = await processAssets({
@@ -2,7 +2,7 @@ import type { BlueprintCorsOriginResource, BlueprintDatasetResource, BlueprintDo
2
2
  import type { TreeInput } from 'array-treeify';
3
3
  export declare function arrayifyFunction(fn: BlueprintResource): TreeInput;
4
4
  export declare function arrayifyCors(resource: BlueprintCorsOriginResource): TreeInput;
5
+ export declare function arrayifyDataset(resource: BlueprintDatasetResource): TreeInput;
5
6
  export declare function arrayifyRobot(resource: BlueprintRobotResource): TreeInput;
6
7
  export declare function arrayifyRole(resource: BlueprintRoleResource): TreeInput;
7
- export declare function arrayifyDataset(resource: BlueprintDatasetResource): TreeInput;
8
8
  export declare function arrayifyWebhook(resource: BlueprintDocumentWebhookResource): TreeInput;
@@ -58,6 +58,14 @@ export function arrayifyFunction(fn) {
58
58
  export function arrayifyCors(resource) {
59
59
  return [formatLabeledValue('origin', resource.origin)];
60
60
  }
61
+ export function arrayifyDataset(resource) {
62
+ const details = [formatLabeledValue('title', resource.datasetName)];
63
+ if (resource.aclMode)
64
+ details.push(formatLabeledValue('visibility', resource.aclMode));
65
+ if (resource.project)
66
+ details.push(formatLabeledValue('project', resource.project));
67
+ return details;
68
+ }
61
69
  export function arrayifyRobot(resource) {
62
70
  const details = [formatLabeledValue('label', resource.label)];
63
71
  if (resource.memberships.length > 0) {
@@ -107,12 +115,6 @@ export function arrayifyRole(resource) {
107
115
  }
108
116
  return details;
109
117
  }
110
- export function arrayifyDataset(resource) {
111
- const details = [];
112
- if (resource.aclMode)
113
- details.push(formatLabeledValue('aclMode', resource.aclMode));
114
- return details;
115
- }
116
118
  export function arrayifyWebhook(resource) {
117
119
  const details = [];
118
120
  if (resource.description)
@@ -1,3 +1,4 @@
1
+ export declare const HEARTBEAT_INTERVAL_MS = 5000;
1
2
  export declare function showProgress(percent: number): void;
2
3
  export declare function showBusy(): void;
3
4
  export declare function showError(): void;
@@ -1,6 +1,7 @@
1
1
  import { stderr } from 'node:process';
2
2
  import { onExit } from 'signal-exit';
3
3
  const ST = '\x1b\\';
4
+ export const HEARTBEAT_INTERVAL_MS = 5_000;
4
5
  const STATES = {
5
6
  clear: 0,
6
7
  normal: 1,
@@ -9,19 +10,46 @@ const STATES = {
9
10
  busy: 3,
10
11
  };
11
12
  let exitHookRegistered = false;
13
+ let heartbeat;
14
+ let heartbeatSequence;
15
+ function stopHeartbeat() {
16
+ if (heartbeat)
17
+ clearInterval(heartbeat);
18
+ heartbeat = undefined;
19
+ heartbeatSequence = undefined;
20
+ }
21
+ function startHeartbeat(sequence) {
22
+ heartbeatSequence = sequence;
23
+ if (heartbeat)
24
+ return;
25
+ heartbeat = setInterval(() => {
26
+ if (stderr.isTTY && heartbeatSequence)
27
+ stderr.write(heartbeatSequence);
28
+ }, HEARTBEAT_INTERVAL_MS);
29
+ heartbeat.unref();
30
+ }
12
31
  function write(state, value = 0) {
13
- if (!stderr.isTTY)
32
+ if (!stderr.isTTY) {
33
+ stopHeartbeat();
14
34
  return;
35
+ }
15
36
  if (!exitHookRegistered) {
16
37
  exitHookRegistered = true;
17
38
  function clear() {
39
+ stopHeartbeat();
18
40
  stderr.write(`\x1b]9;4;0;0${ST}`);
19
41
  }
20
42
  // arc/utils SIGINT handler clobbers our signal-exit; luckily it then calls process.exit()
21
43
  process.once('exit', clear); // triggered by arc/utils SIGINT handler
22
44
  onExit(clear); // triggered by all other exit paths
23
45
  }
24
- stderr.write(`\x1b]9;4;${STATES[state]};${Math.round(value)}${ST}`);
46
+ const sequence = `\x1b]9;4;${STATES[state]};${Math.round(value)}${ST}`;
47
+ const active = state === 'normal' || state === 'paused' || state === 'busy';
48
+ if (!active)
49
+ stopHeartbeat();
50
+ stderr.write(sequence);
51
+ if (active)
52
+ startHeartbeat(sequence);
25
53
  }
26
54
  export function showProgress(percent) {
27
55
  write('normal', Math.max(0, Math.min(100, percent)));
@@ -3127,5 +3127,5 @@
3127
3127
  ]
3128
3128
  }
3129
3129
  },
3130
- "version": "17.6.0"
3130
+ "version": "17.6.2"
3131
3131
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sanity/runtime-cli",
3
3
  "description": "Sanity's Runtime CLI for Blueprints and Functions",
4
- "version": "17.6.0",
4
+ "version": "17.6.2",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",