@sanity/runtime-cli 6.2.0 → 6.2.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 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/6.2.0 linux-x64 node-v22.15.0
23
+ @sanity/runtime-cli/6.2.1 linux-x64 node-v22.15.0
24
24
  $ sanity-run --help [COMMAND]
25
25
  USAGE
26
26
  $ sanity-run COMMAND
@@ -77,7 +77,7 @@ EXAMPLES
77
77
  $ sanity-run blueprints add function --name my-function --fn-type document-publish --lang js
78
78
  ```
79
79
 
80
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/blueprints/add.ts)_
80
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/add.ts)_
81
81
 
82
82
  ## `sanity-run blueprints config`
83
83
 
@@ -105,7 +105,7 @@ EXAMPLES
105
105
  $ sanity-run blueprints config --edit --project-id <projectId>
106
106
  ```
107
107
 
108
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/blueprints/config.ts)_
108
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/config.ts)_
109
109
 
110
110
  ## `sanity-run blueprints deploy`
111
111
 
@@ -127,7 +127,7 @@ EXAMPLES
127
127
  $ sanity-run blueprints deploy --no-wait
128
128
  ```
129
129
 
130
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/blueprints/deploy.ts)_
130
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/deploy.ts)_
131
131
 
132
132
  ## `sanity-run blueprints destroy`
133
133
 
@@ -148,7 +148,7 @@ EXAMPLES
148
148
  $ sanity-run blueprints destroy
149
149
  ```
150
150
 
151
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/blueprints/destroy.ts)_
151
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/destroy.ts)_
152
152
 
153
153
  ## `sanity-run blueprints info`
154
154
 
@@ -165,7 +165,7 @@ EXAMPLES
165
165
  $ sanity-run blueprints info
166
166
  ```
167
167
 
168
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/blueprints/info.ts)_
168
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/info.ts)_
169
169
 
170
170
  ## `sanity-run blueprints init [DIR]`
171
171
 
@@ -197,7 +197,7 @@ EXAMPLES
197
197
  $ sanity-run blueprints init --blueprint-type <json|js|ts> --project-id <projectId>
198
198
  ```
199
199
 
200
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/blueprints/init.ts)_
200
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/init.ts)_
201
201
 
202
202
  ## `sanity-run blueprints logs`
203
203
 
@@ -219,7 +219,7 @@ EXAMPLES
219
219
  $ sanity-run blueprints logs --watch
220
220
  ```
221
221
 
222
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/blueprints/logs.ts)_
222
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/logs.ts)_
223
223
 
224
224
  ## `sanity-run blueprints plan`
225
225
 
@@ -236,7 +236,7 @@ EXAMPLES
236
236
  $ sanity-run blueprints plan
237
237
  ```
238
238
 
239
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/blueprints/plan.ts)_
239
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/plan.ts)_
240
240
 
241
241
  ## `sanity-run functions dev`
242
242
 
@@ -256,7 +256,7 @@ EXAMPLES
256
256
  $ sanity-run functions dev --port 8974
257
257
  ```
258
258
 
259
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/functions/dev.ts)_
259
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/dev.ts)_
260
260
 
261
261
  ## `sanity-run functions env add NAME KEY VALUE`
262
262
 
@@ -278,7 +278,7 @@ EXAMPLES
278
278
  $ sanity-run functions env add MyFunction API_URL https://api.example.com/
279
279
  ```
280
280
 
281
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/functions/env/add.ts)_
281
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/env/add.ts)_
282
282
 
283
283
  ## `sanity-run functions env list NAME`
284
284
 
@@ -298,7 +298,7 @@ EXAMPLES
298
298
  $ sanity-run functions env list MyFunction
299
299
  ```
300
300
 
301
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/functions/env/list.ts)_
301
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/env/list.ts)_
302
302
 
303
303
  ## `sanity-run functions env remove NAME KEY`
304
304
 
@@ -319,7 +319,7 @@ EXAMPLES
319
319
  $ sanity-run functions env remove MyFunction API_URL
320
320
  ```
321
321
 
322
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/functions/env/remove.ts)_
322
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/env/remove.ts)_
323
323
 
324
324
  ## `sanity-run functions logs NAME`
325
325
 
@@ -352,7 +352,7 @@ EXAMPLES
352
352
  $ sanity-run functions logs <name> --delete
353
353
  ```
354
354
 
355
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/functions/logs.ts)_
355
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/logs.ts)_
356
356
 
357
357
  ## `sanity-run functions test NAME`
358
358
 
@@ -385,7 +385,7 @@ EXAMPLES
385
385
  $ sanity-run functions test <name> --data '{ "id": 1 }' --timeout 60
386
386
  ```
387
387
 
388
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.0/src/commands/functions/test.ts)_
388
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/test.ts)_
389
389
 
390
390
  ## `sanity-run help [COMMAND]`
391
391
 
@@ -405,5 +405,5 @@ DESCRIPTION
405
405
  Display help for sanity-run.
406
406
  ```
407
407
 
408
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.27/src/commands/help.ts)_
408
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.28/src/commands/help.ts)_
409
409
  <!-- commandsstop -->
@@ -2,8 +2,8 @@
2
2
  import { Command } from '@oclif/core';
3
3
  import { readLocalBlueprint } from './actions/blueprints/blueprint.js';
4
4
  import { getStack } from './actions/blueprints/stacks.js';
5
- import { niceId } from './utils/display/colors.js';
6
5
  import { presentBlueprintParserErrors } from './utils/display/errors.js';
6
+ import { niceId } from './utils/display/presenters.js';
7
7
  import { validTokenOrErrorMessage } from './utils/validated-token.js';
8
8
  /**
9
9
  * @description Guarantees flags, args, sanityToken, and blueprint.
@@ -1,8 +1,8 @@
1
1
  import { Args } from '@oclif/core';
2
- import Spinner from 'yocto-spinner';
2
+ import chalk from 'chalk';
3
+ import ora from 'ora';
3
4
  import { update } from '../../../actions/functions/env/update.js';
4
5
  import { DeployedBlueprintCommand } from '../../../baseCommands.js';
5
- import { red } from '../../../utils/display/colors.js';
6
6
  import { findFunctionByName } from '../../../utils/find-function.js';
7
7
  export default class EnvAddCommand extends DeployedBlueprintCommand {
8
8
  static args = {
@@ -16,16 +16,14 @@ export default class EnvAddCommand extends DeployedBlueprintCommand {
16
16
  ];
17
17
  async run() {
18
18
  const args = this.args;
19
- const spinner = Spinner({
20
- text: `Updating "${args.key}" environment variable in "${args.name}"`,
21
- }).start();
19
+ const spinner = ora(`Updating "${args.key}" environment variable in "${args.name}"`).start();
22
20
  const { externalId } = findFunctionByName(this.deployedStack, args.name);
23
21
  const result = await update(externalId, args.key, args.value, this.auth);
24
22
  if (result.ok) {
25
- spinner.success(`Update of ${args.key} succeeded`);
23
+ spinner.succeed(`Update of ${args.key} succeeded`);
26
24
  }
27
25
  else {
28
- spinner.error(`${red('Failed')} to update ${args.key}`);
26
+ spinner.fail(`${chalk.red('Failed')} to update ${args.key}`);
29
27
  this.log(`Error: ${result.error || 'Unknown error'}`);
30
28
  }
31
29
  }
@@ -1,5 +1,5 @@
1
1
  import { Args } from '@oclif/core';
2
- import Spinner from 'yocto-spinner';
2
+ import ora from 'ora';
3
3
  import { list } from '../../../actions/functions/env/list.js';
4
4
  import { DeployedBlueprintCommand } from '../../../baseCommands.js';
5
5
  import { findFunctionByName } from '../../../utils/find-function.js';
@@ -11,14 +11,14 @@ export default class EnvListCommand extends DeployedBlueprintCommand {
11
11
  static examples = ['<%= config.bin %> <%= command.id %> MyFunction'];
12
12
  async run() {
13
13
  const args = this.args;
14
- const spinner = Spinner({ text: `Listing environment variables for "${args.name}"` }).start();
14
+ const spinner = ora(`Listing environment variables for "${args.name}"`).start();
15
15
  const { externalId } = findFunctionByName(this.deployedStack, args.name);
16
16
  const result = await list(externalId, this.auth);
17
17
  if (!result.ok) {
18
- spinner.stop().clear();
18
+ spinner.stop();
19
19
  this.error(`Error: ${result.error || 'Unknown error'}`);
20
20
  }
21
- spinner.success(`Environment variables for "${args.name}"`);
21
+ spinner.succeed(`Environment variables for "${args.name}"`);
22
22
  for (const key of result.envvars) {
23
23
  this.log(key);
24
24
  }
@@ -1,8 +1,8 @@
1
1
  import { Args } from '@oclif/core';
2
- import Spinner from 'yocto-spinner';
2
+ import chalk from 'chalk';
3
+ import ora from 'ora';
3
4
  import { remove } from '../../../actions/functions/env/remove.js';
4
5
  import { DeployedBlueprintCommand } from '../../../baseCommands.js';
5
- import { red } from '../../../utils/display/colors.js';
6
6
  import { findFunctionByName } from '../../../utils/find-function.js';
7
7
  export default class EnvRemoveCommand extends DeployedBlueprintCommand {
8
8
  static args = {
@@ -13,16 +13,14 @@ export default class EnvRemoveCommand extends DeployedBlueprintCommand {
13
13
  static examples = ['<%= config.bin %> <%= command.id %> MyFunction API_URL'];
14
14
  async run() {
15
15
  const args = this.args;
16
- const spinner = Spinner({
17
- text: `Removing "${args.key}" environment variable in "${args.name}"`,
18
- }).start();
16
+ const spinner = ora(`Removing "${args.key}" environment variable in "${args.name}"`).start();
19
17
  const { externalId } = findFunctionByName(this.deployedStack, args.name);
20
18
  const result = await remove(externalId, args.key, this.auth);
21
19
  if (result.ok) {
22
- spinner.success(`Removal of ${args.key} succeeded`);
20
+ spinner.succeed(`Removal of ${args.key} succeeded`);
23
21
  }
24
22
  else {
25
- spinner.error(`${red('Failed')} to remove ${args.key}`);
23
+ spinner.fail(`${chalk.red('Failed')} to remove ${args.key}`);
26
24
  this.log(`Error: ${result.error || 'Unknown error'}`);
27
25
  }
28
26
  }
@@ -1,19 +1,19 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
+ import chalk from 'chalk';
2
3
  import inquirer from 'inquirer';
3
- import Spinner from 'yocto-spinner';
4
+ import ora from 'ora';
4
5
  import { deleteLogs as deleteLogsAction, logs as getLogsAction, } from '../../actions/functions/logs.js';
5
6
  import { DeployedBlueprintCommand } from '../../baseCommands.js';
6
7
  import { formatTitle } from '../../utils/display/blueprints-formatting.js';
7
- import { blue, bold, green, red, yellow } from '../../utils/display/colors.js';
8
8
  import { findFunctionByName } from '../../utils/find-function.js';
9
9
  function logLevel(level) {
10
10
  if (level === 'ERROR') {
11
- return red(level);
11
+ return chalk.red(level);
12
12
  }
13
13
  if (level === 'WARN') {
14
- return yellow(level);
14
+ return chalk.yellow(level);
15
15
  }
16
- return green(level);
16
+ return chalk.green(level);
17
17
  }
18
18
  export default class LogsCommand extends DeployedBlueprintCommand {
19
19
  static args = {
@@ -76,28 +76,28 @@ export default class LogsCommand extends DeployedBlueprintCommand {
76
76
  const { certain } = await inquirer.prompt({
77
77
  type: 'confirm',
78
78
  name: 'certain',
79
- message: `Are you sure you want to delete ${bold('all')} logs for function ${yellow(name)}?`,
79
+ message: `Are you sure you want to delete ${chalk.bold('all')} logs for function ${chalk.yellow(name)}?`,
80
80
  default: false,
81
81
  });
82
82
  if (!certain)
83
83
  return;
84
84
  }
85
- const spinner = Spinner({ text: `Deleting logs for function ${yellow(name)}` }).start();
85
+ const spinner = ora(`Deleting logs for function ${chalk.yellow(name)}`).start();
86
86
  const { ok, error } = await deleteLogsAction(this.externalId, this.auth);
87
87
  if (!ok) {
88
- spinner.error(`${red('Failed')} to retrieve logs`);
88
+ spinner.fail(`${chalk.red('Failed')} to retrieve logs`);
89
89
  this.log(`Error: ${error || 'Unknown error'}`);
90
90
  return;
91
91
  }
92
- spinner.success('Logs deleted');
92
+ spinner.succeed('Logs deleted');
93
93
  }
94
94
  async runGetLogs(name, options) {
95
95
  if (!this.externalId)
96
96
  this.error('Unable to retrieve logs. Unable to determine function ID.');
97
- const spinner = Spinner({ text: `Finding logs for function "${name}"` }).start();
97
+ const spinner = ora(`Finding logs for function "${name}"`).start();
98
98
  const { ok, error, logs, total } = await getLogsAction(this.externalId, { limit: options.limit }, this.auth);
99
99
  if (!ok) {
100
- spinner.error(`${red('Failed')} to retrieve logs`);
100
+ spinner.fail(`${chalk.red('Failed')} to retrieve logs`);
101
101
  this.log(`Error: ${error || 'Unknown error'}`);
102
102
  return;
103
103
  }
@@ -106,11 +106,11 @@ export default class LogsCommand extends DeployedBlueprintCommand {
106
106
  spinner.info(`No logs found for function ${name}`);
107
107
  return;
108
108
  }
109
- spinner.success(`${formatTitle('Function', name)} Logs`);
109
+ spinner.succeed(`${formatTitle('Function', name)} Logs`);
110
110
  if (!options.json) {
111
- this.log(`Found ${bold(total)} log entries for function ${yellow(name)}`);
111
+ this.log(`Found ${chalk.bold(total)} log entries for function ${chalk.yellow(name)}`);
112
112
  if (logs.length < total) {
113
- this.log(`Here are the last ${bold(filteredLogs.length.toString())} entries`);
113
+ this.log(`Here are the last ${chalk.bold(filteredLogs.length.toString())} entries`);
114
114
  }
115
115
  this.log('\n');
116
116
  for (const log of filteredLogs) {
@@ -119,7 +119,7 @@ export default class LogsCommand extends DeployedBlueprintCommand {
119
119
  const [dateString, timeString] = options.utc
120
120
  ? date.toISOString().slice(0, 19).split('T')
121
121
  : [date.toLocaleDateString(), date.toLocaleTimeString()];
122
- this.log([bold(dateString), bold(blue(timeString)), logLevel(level), message].join(' '));
122
+ this.log([chalk.bold(dateString), chalk.bold.blue(timeString), logLevel(level), message].join(' '));
123
123
  }
124
124
  }
125
125
  else {
@@ -1,11 +1,11 @@
1
1
  import chalk from 'chalk';
2
2
  import highlight from 'color-json';
3
3
  import inquirer from 'inquirer';
4
- import Spinner from 'yocto-spinner';
4
+ import ora from 'ora';
5
5
  import { BLUEPRINT_CONFIG_FILE, BLUEPRINT_DIR, writeConfigFile, } from '../../actions/blueprints/blueprint.js';
6
6
  import { getProject, listProjects } from '../../actions/blueprints/projects.js';
7
7
  import { createStack, getStack, listStacks } from '../../actions/blueprints/stacks.js';
8
- import { niceId, warn } from '../../utils/display/colors.js';
8
+ import { niceId, warn } from '../../utils/display/presenters.js';
9
9
  export async function blueprintConfigCore(options) {
10
10
  const { bin = 'sanity', log, token, flags } = options;
11
11
  const { edit: editConfig = false, 'test-config': testConfig = false, 'project-id': flagProjectId, 'stack-id': flagStackId, } = flags;
@@ -183,16 +183,16 @@ async function promptForStackId({ token, projectId, knownStackId, }) {
183
183
  return undefined;
184
184
  }
185
185
  async function testConfigAndReport({ token, stackId, projectId, }) {
186
- const spinner = Spinner({ text: 'Testing the configuration...' }).start();
186
+ const spinner = ora('Testing the configuration...').start();
187
187
  const { ok, error } = await getStack({
188
188
  stackId,
189
189
  auth: { token, projectId },
190
190
  });
191
191
  if (!ok) {
192
- spinner.error('Configuration test failed.');
192
+ spinner.fail('Configuration test failed.');
193
193
  }
194
194
  else {
195
- spinner.success('Configuration is valid.');
195
+ spinner.succeed('Configuration is valid.');
196
196
  }
197
197
  return { ok, error };
198
198
  }
@@ -1,9 +1,9 @@
1
1
  import { setTimeout } from 'node:timers/promises';
2
2
  import chalk from 'chalk';
3
- import Spinner from 'yocto-spinner';
3
+ import ora from 'ora';
4
4
  import { stashAsset } from '../../actions/blueprints/assets.js';
5
5
  import { getStack, updateStack } from '../../actions/blueprints/stacks.js';
6
- import { bold, niceId } from '../../utils/display/colors.js';
6
+ import { niceId } from '../../utils/display/presenters.js';
7
7
  import { isLocalFunctionResource } from '../../utils/types.js';
8
8
  export async function blueprintDeployCore(options) {
9
9
  const { bin = 'sanity', log, auth, stackId, projectId, deployedStack, blueprint, flags } = options;
@@ -15,16 +15,16 @@ export async function blueprintDeployCore(options) {
15
15
  // First stash all function assets
16
16
  if (functionResources?.length) {
17
17
  for (const resource of functionResources) {
18
- const fnSpinner = Spinner({ text: `Processing ${resource.name}...` }).start();
18
+ const fnSpinner = ora(`Processing ${resource.name}...`).start();
19
19
  const result = await stashAsset({ resource, auth });
20
20
  if (result.success && result.assetId) {
21
21
  const src = resource.src;
22
22
  resource.src = result.assetId; // TODO: properly reference asset - for now, the API expects the assetId
23
- fnSpinner.success(`${resource.name} ${niceId(result.assetId)}`);
23
+ fnSpinner.succeed(`${resource.name} ${niceId(result.assetId)}`);
24
24
  log(` Source: ${src}`);
25
25
  }
26
26
  else {
27
- fnSpinner.error(`Failed to process ${resource.name}`);
27
+ fnSpinner.fail(`Failed to process ${resource.name}`);
28
28
  log(` Error: ${result.error}`);
29
29
  return { success: false, error: result.error || 'Failed to process function resource' };
30
30
  }
@@ -35,30 +35,30 @@ export async function blueprintDeployCore(options) {
35
35
  name: deployedStack.name,
36
36
  document: { resources: validResources },
37
37
  };
38
- const spinner = Spinner({ text: 'Deploying...' }).start();
38
+ const spinner = ora('Deploying...').start();
39
39
  const { ok: deployOk, stack, error: deployError, } = await updateStack({ stackId, stackPayload, auth });
40
40
  if (deployOk) {
41
- spinner.success(`Deployment "${bold(stack.name)}" ${niceId(stack.id)} started!`);
41
+ spinner.succeed(`Deployment "${chalk.bold(stack.name)}" ${niceId(stack.id)} started!`);
42
42
  if (!noWait) {
43
- const waitSpinner = Spinner({ text: 'Waiting for deployment to complete...' }).start();
43
+ const waitSpinner = ora('Waiting for deployment to complete...').start();
44
44
  while (true) {
45
45
  // TODO: watch logs and print those while polling
46
46
  const { ok, stack: currentStack } = await getStack({ stackId: stack.id, auth });
47
47
  if (!ok) {
48
- waitSpinner.error('Failed to check deployment status');
48
+ waitSpinner.fail('Failed to check deployment status');
49
49
  return { success: false, error: 'Failed to check deployment status' };
50
50
  }
51
51
  const operation = currentStack.recentOperation;
52
52
  if (!operation) {
53
- waitSpinner.error('No operation found');
53
+ waitSpinner.fail('No operation found');
54
54
  return { success: false, error: 'No operation found' };
55
55
  }
56
56
  if (operation.status === 'COMPLETED') {
57
- waitSpinner.success('Deployment completed successfully');
57
+ waitSpinner.succeed('Deployment completed successfully');
58
58
  break;
59
59
  }
60
60
  if (operation.status === 'FAILED') {
61
- waitSpinner.error('Deployment failed');
61
+ waitSpinner.fail('Deployment failed');
62
62
  return { success: false, error: 'Deployment failed' };
63
63
  }
64
64
  await setTimeout(1000);
@@ -69,7 +69,7 @@ export async function blueprintDeployCore(options) {
69
69
  }
70
70
  return { success: true };
71
71
  }
72
- spinner.error(`${chalk.red('Failed')} to update deployment`);
72
+ spinner.fail(`${chalk.red('Failed')} to update deployment`);
73
73
  log(`Error: ${deployError || JSON.stringify(stack, null, 2) || 'Unknown error'}`);
74
74
  return { success: false, error: deployError || 'Failed to update deployment' };
75
75
  }
@@ -1,9 +1,9 @@
1
1
  import { setTimeout } from 'node:timers/promises';
2
2
  import chalk from 'chalk';
3
3
  import inquirer from 'inquirer';
4
- import Spinner from 'yocto-spinner';
4
+ import ora from 'ora';
5
5
  import { destroyStack, getStack } from '../../actions/blueprints/stacks.js';
6
- import { niceId } from '../../utils/display/colors.js';
6
+ import { niceId } from '../../utils/display/presenters.js';
7
7
  export async function blueprintDestroyCore(options) {
8
8
  const { bin = 'sanity', log, token, blueprint, flags } = options;
9
9
  const { force = false, 'project-id': flagProjectId, 'stack-id': flagStackId, 'no-wait': noWait = false, } = flags;
@@ -38,7 +38,7 @@ export async function blueprintDestroyCore(options) {
38
38
  }
39
39
  if (!stack)
40
40
  return { success: false, error: 'Deployment not found' };
41
- const destroySpinner = Spinner({
41
+ const destroySpinner = ora({
42
42
  text: `Destroying ${chalk.bold(stack.name)} ${niceId(stack.id)}...`,
43
43
  color: 'red',
44
44
  });
@@ -70,27 +70,27 @@ export async function blueprintDestroyCore(options) {
70
70
  }
71
71
  const { ok, error } = await destroyStack({ stackId: stack.id, auth });
72
72
  if (!ok) {
73
- destroySpinner.error('Failed to destroy deployment');
73
+ destroySpinner.fail('Failed to destroy deployment');
74
74
  return { success: false, error: error || 'Failed to destroy deployment' };
75
75
  }
76
76
  if (noWait) {
77
- destroySpinner.success(`Deployment "${stack.name}" ${niceId(stack.id)} destroy started!`);
77
+ destroySpinner.succeed(`Deployment "${stack.name}" ${niceId(stack.id)} destroy started!`);
78
78
  log(`Use \`${bin} blueprints info\` to check status`);
79
79
  return { success: true };
80
80
  }
81
- destroySpinner.stop().clear();
82
- const waitSpinner = Spinner({ text: 'Waiting for destruction to complete...' }).start();
81
+ destroySpinner.stop();
82
+ const waitSpinner = ora('Waiting for destruction to complete...').start();
83
83
  while (true) {
84
84
  const { ok: pollOk, stack: currentStack } = await getStack({ stackId: stack.id, auth });
85
85
  const operation = currentStack?.recentOperation;
86
86
  if (!pollOk || !operation || operation?.status === 'COMPLETED') {
87
87
  // Operation is also marked destroyed when stack is deleted
88
88
  // It's possible that the operation is "gone" or available and "COMPLETED"
89
- waitSpinner.success(`Deployment "${stack.name}" ${niceId(stack.id)} destroyed`);
89
+ waitSpinner.succeed(`Deployment "${stack.name}" ${niceId(stack.id)} destroyed`);
90
90
  break;
91
91
  }
92
92
  if (operation.status === 'FAILED') {
93
- waitSpinner.error('Destruction failed');
93
+ waitSpinner.fail('Destruction failed');
94
94
  log(`Run \`${bin} blueprints logs\` for more details`);
95
95
  return { success: false, error: 'Destruction failed' };
96
96
  }
@@ -1,6 +1,6 @@
1
1
  import { getStack } from '../../actions/blueprints/stacks.js';
2
2
  import { formatResourceTree, formatStackInfo } from '../../utils/display/blueprints-formatting.js';
3
- import { niceId } from '../../utils/display/colors.js';
3
+ import { niceId } from '../../utils/display/presenters.js';
4
4
  export async function blueprintInfoCore(options) {
5
5
  const { log, auth, stackId, flags, deployedStack } = options;
6
6
  try {
@@ -5,7 +5,7 @@ import inquirer from 'inquirer';
5
5
  import { BLUEPRINT_CONFIG_FILE, BLUEPRINT_DIR, findBlueprintFile, writeBlueprintToDisk, writeConfigFile, } from '../../actions/blueprints/blueprint.js';
6
6
  import { getProject, listProjects } from '../../actions/blueprints/projects.js';
7
7
  import { createStack, getStack, listStacks } from '../../actions/blueprints/stacks.js';
8
- import { niceId } from '../../utils/display/colors.js';
8
+ import { niceId } from '../../utils/display/presenters.js';
9
9
  const LAUNCH_LIMIT_STACK_PER_PROJECT = true;
10
10
  export async function blueprintInitCore(options) {
11
11
  const { log, token, args, flags } = options;
@@ -1,24 +1,22 @@
1
1
  import chalk from 'chalk';
2
- import Spinner from 'yocto-spinner';
2
+ import ora from 'ora';
3
3
  import { findNewestLogTimestamp, getLogs, getRecentLogs, isNewerLog, streamLogs, } from '../../actions/blueprints/logs.js';
4
4
  import { formatTitle } from '../../utils/display/blueprints-formatting.js';
5
- import { bold, niceId } from '../../utils/display/colors.js';
6
5
  import { formatLogEntry, formatLogsByDay, organizeLogsByDay, } from '../../utils/display/logs-formatting.js';
6
+ import { niceId } from '../../utils/display/presenters.js';
7
7
  export async function blueprintLogsCore(options) {
8
8
  const { log, auth, stackId, deployedStack, flags } = options;
9
9
  const { watch = false } = flags;
10
- const spinner = Spinner({
11
- text: `Fetching recent logs for deployment ${niceId(stackId)}`,
12
- }).start();
10
+ const spinner = ora(`Fetching recent logs for deployment ${niceId(stackId)}`).start();
13
11
  try {
14
12
  if (watch) {
15
13
  const { ok, logs, error } = await getLogs(stackId, auth);
16
14
  if (!ok) {
17
- spinner.error(`${chalk.red('Failed')} to retrieve logs`);
15
+ spinner.fail(`${chalk.red('Failed')} to retrieve logs`);
18
16
  log(`Error: ${error || 'Unknown error'}`);
19
17
  return { success: false, error: error || 'Failed to retrieve logs' };
20
18
  }
21
- spinner.stop().clear();
19
+ spinner.stop();
22
20
  log(`${formatTitle('Blueprint', deployedStack.name)} ${niceId(stackId)} logs`);
23
21
  if (logs.length > 0) {
24
22
  log('\nMost recent logs:');
@@ -31,7 +29,7 @@ export async function blueprintLogsCore(options) {
31
29
  log(`No recent logs found for deployment ${niceId(stackId)}`);
32
30
  }
33
31
  const onOpen = () => {
34
- log(`Watching for new logs... ${bold('ctrl+c')} to stop`);
32
+ log(`Watching for new logs... ${chalk.bold('ctrl+c')} to stop`);
35
33
  };
36
34
  let newestTimestamp = findNewestLogTimestamp(logs);
37
35
  const renderLog = (logEntry) => {
@@ -50,7 +48,7 @@ export async function blueprintLogsCore(options) {
50
48
  // Regular non-streaming logs
51
49
  const { ok, logs, error } = await getLogs(stackId, auth);
52
50
  if (!ok) {
53
- spinner.error(`${chalk.red('Failed')} to retrieve logs`);
51
+ spinner.fail(`${chalk.red('Failed')} to retrieve logs`);
54
52
  log(`Error: ${error || 'Unknown error'}`);
55
53
  return { success: false, error: error || 'Failed to retrieve logs' };
56
54
  }
@@ -58,15 +56,15 @@ export async function blueprintLogsCore(options) {
58
56
  spinner.info(`No logs found for deployment ${stackId}`);
59
57
  return { success: true };
60
58
  }
61
- spinner.success(`${formatTitle('Blueprint', deployedStack.name)} Logs`);
62
- log(`Found ${bold(logs.length.toString())} log entries for deployment ${niceId(stackId)}\n`);
59
+ spinner.succeed(`${formatTitle('Blueprint', deployedStack.name)} Logs`);
60
+ log(`Found ${chalk.bold(logs.length.toString())} log entries for deployment ${niceId(stackId)}\n`);
63
61
  // Organize and format logs by day
64
62
  const logsByDay = organizeLogsByDay(logs);
65
63
  log(formatLogsByDay(logsByDay));
66
64
  return { success: true };
67
65
  }
68
66
  catch (err) {
69
- spinner.error('Failed to retrieve logs');
67
+ spinner.fail('Failed to retrieve logs');
70
68
  const errorMessage = err instanceof Error ? err.message : String(err);
71
69
  log(`Error: ${errorMessage}`);
72
70
  return { success: false, error: errorMessage };
@@ -1,7 +1,7 @@
1
1
  import chalk from 'chalk';
2
2
  import { listStacks } from '../../actions/blueprints/stacks.js';
3
3
  import { formatStacksListing } from '../../utils/display/blueprints-formatting.js';
4
- import { niceId } from '../../utils/display/colors.js';
4
+ import { niceId } from '../../utils/display/presenters.js';
5
5
  export async function blueprintStacksCore(options) {
6
6
  const { log, token, blueprint, flags } = options;
7
7
  const { projectId: blueprintProjectId, stackId: blueprintStackId } = blueprint;
@@ -12311,17 +12311,26 @@ function isSuspiciousChromeCaretResult(node, offset, x) {
12311
12311
  : textRange(node, 0, Math.max(node.nodeValue.length, 1)).getBoundingClientRect();
12312
12312
  return x - rect.left > 5;
12313
12313
  }
12314
- function blockAt(view, pos) {
12314
+ function blockAt(view, pos, side) {
12315
12315
  let line = view.lineBlockAt(pos);
12316
- if (Array.isArray(line.type))
12316
+ if (Array.isArray(line.type)) {
12317
+ let best;
12317
12318
  for (let l of line.type) {
12318
- if (l.to > pos || l.to == pos && (l.to == line.to || l.type == BlockType.Text))
12319
+ if (l.from > pos)
12320
+ break;
12321
+ if (l.to < pos)
12322
+ continue;
12323
+ if (l.from < pos && l.to > pos)
12319
12324
  return l;
12325
+ if (!best || (l.type == BlockType.Text && (best.type != l.type || (side < 0 ? l.from < pos : l.to > pos))))
12326
+ best = l;
12320
12327
  }
12328
+ return best || line;
12329
+ }
12321
12330
  return line;
12322
12331
  }
12323
12332
  function moveToLineBoundary(view, start, forward, includeWrap) {
12324
- let line = blockAt(view, start.head);
12333
+ let line = blockAt(view, start.head, start.assoc || -1);
12325
12334
  let coords = !includeWrap || line.type != BlockType.Text || !(view.lineWrapping || line.widgetLineBreaks) ? null
12326
12335
  : view.coordsAtPos(start.assoc < 0 && start.head > line.from ? start.head - 1 : start.head);
12327
12336
  if (coords) {
@@ -13556,7 +13565,7 @@ function focusChangeTransaction(state, focus) {
13556
13565
  if (effect)
13557
13566
  effects.push(effect);
13558
13567
  }
13559
- return effects ? state.update({ effects, annotations: isFocusChange.of(true) }) : null;
13568
+ return effects.length ? state.update({ effects, annotations: isFocusChange.of(true) }) : null;
13560
13569
  }
13561
13570
  function updateForFocusChange(view) {
13562
13571
  setTimeout(() => {
@@ -14591,7 +14600,7 @@ class ViewState {
14591
14600
  }
14592
14601
  else {
14593
14602
  this.scrollAnchorPos = -1;
14594
- this.scrollAnchorHeight = this.heightMap.height;
14603
+ this.scrollAnchorHeight = prevHeight;
14595
14604
  }
14596
14605
  let viewport = heightChanges.length ? this.mapViewport(this.viewport, update.changes) : this.viewport;
14597
14606
  if (scrollTarget && (scrollTarget.range.head < viewport.from || scrollTarget.range.head > viewport.to) ||
@@ -16087,14 +16096,14 @@ class EditorView {
16087
16096
  [IME](https://en.wikipedia.org/wiki/Input_method), and at least
16088
16097
  one change has been made in the current composition.
16089
16098
  */
16090
- get composing() { return this.inputState.composing > 0; }
16099
+ get composing() { return !!this.inputState && this.inputState.composing > 0; }
16091
16100
  /**
16092
16101
  Indicates whether the user is currently in composing state. Note
16093
16102
  that on some platforms, like Android, this will be the case a
16094
16103
  lot, since just putting the cursor on a word starts a
16095
16104
  composition there.
16096
16105
  */
16097
- get compositionStarted() { return this.inputState.composing >= 0; }
16106
+ get compositionStarted() { return !!this.inputState && this.inputState.composing >= 0; }
16098
16107
  /**
16099
16108
  The document or shadow root that the view lives in.
16100
16109
  */
@@ -17521,7 +17530,7 @@ function rectanglesForRange(view, className, range) {
17521
17530
  let leftSide = contentRect.left +
17522
17531
  (lineStyle ? parseInt(lineStyle.paddingLeft) + Math.min(0, parseInt(lineStyle.textIndent)) : 0);
17523
17532
  let rightSide = contentRect.right - (lineStyle ? parseInt(lineStyle.paddingRight) : 0);
17524
- let startBlock = blockAt(view, from), endBlock = blockAt(view, to);
17533
+ let startBlock = blockAt(view, from, 1), endBlock = blockAt(view, to, -1);
17525
17534
  let visualStart = startBlock.type == BlockType.Text ? startBlock : null;
17526
17535
  let visualEnd = endBlock.type == BlockType.Text ? endBlock : null;
17527
17536
  if (visualStart && (view.lineWrapping || startBlock.widgetLineBreaks))
@@ -26625,8 +26634,36 @@ const toLocaleString = (number, locale, options) => {
26625
26634
  return result;
26626
26635
  };
26627
26636
 
26637
+ const log10 = numberOrBigInt => {
26638
+ if (typeof numberOrBigInt === 'number') {
26639
+ return Math.log10(numberOrBigInt);
26640
+ }
26641
+
26642
+ const string = numberOrBigInt.toString(10);
26643
+
26644
+ return string.length + Math.log10('0.' + string.slice(0, 15));
26645
+ };
26646
+
26647
+ const log = numberOrBigInt => {
26648
+ if (typeof numberOrBigInt === 'number') {
26649
+ return Math.log(numberOrBigInt);
26650
+ }
26651
+
26652
+ return log10(numberOrBigInt) * Math.log(10);
26653
+ };
26654
+
26655
+ const divide = (numberOrBigInt, divisor) => {
26656
+ if (typeof numberOrBigInt === 'number') {
26657
+ return numberOrBigInt / divisor;
26658
+ }
26659
+
26660
+ const integerPart = numberOrBigInt / BigInt(divisor);
26661
+ const remainder = numberOrBigInt % BigInt(divisor);
26662
+ return Number(integerPart) + (Number(remainder) / divisor);
26663
+ };
26664
+
26628
26665
  function prettyBytes(number, options) {
26629
- if (!Number.isFinite(number)) {
26666
+ if (typeof number !== 'bigint' && !Number.isFinite(number)) {
26630
26667
  throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
26631
26668
  }
26632
26669
 
@@ -26643,7 +26680,7 @@ function prettyBytes(number, options) {
26643
26680
 
26644
26681
  const separator = options.space ? ' ' : '';
26645
26682
 
26646
- if (options.signed && number === 0) {
26683
+ if (options.signed && (typeof number === 'number' ? number === 0 : number === 0n)) {
26647
26684
  return ` 0${separator}${UNITS[0]}`;
26648
26685
  }
26649
26686
 
@@ -26669,8 +26706,8 @@ function prettyBytes(number, options) {
26669
26706
  return prefix + numberString + separator + UNITS[0];
26670
26707
  }
26671
26708
 
26672
- const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
26673
- number /= (options.binary ? 1024 : 1000) ** exponent;
26709
+ const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
26710
+ number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
26674
26711
 
26675
26712
  if (!localeOptions) {
26676
26713
  number = number.toPrecision(3);
@@ -1,33 +1,40 @@
1
1
  import { treeify } from 'array-treeify';
2
2
  import chalk from 'chalk';
3
- import { niceId } from './colors.js';
4
3
  import { formatDate, formatDuration } from './dates.js';
4
+ import { niceId } from './presenters.js';
5
+ import { arrayifyLocalFunction, arrayifyStackFunction } from './resources-formatting.js';
5
6
  export function formatTitle(title, name) {
6
7
  return `${chalk.bold.blue(title)} ${chalk.bold(`"${name}"`)}`;
7
8
  }
8
9
  export function formatResourceTree(resources) {
9
- if (!resources || resources.length === 0) {
10
+ if (!resources || resources.length === 0)
10
11
  return ' Zero resources';
11
- }
12
- const output = [];
13
- output.push(`${chalk.blue('Blueprint Resources')} [${resources.length}]`);
12
+ const output = [`${chalk.blue('Blueprint Resources')} [${resources.length}]`];
14
13
  const functionResources = resources.filter((r) => r.type?.startsWith('sanity.function.'));
15
14
  const otherResources = resources.filter((r) => !r.type?.startsWith('sanity.function.'));
16
15
  const hasOtherResources = otherResources.length > 0;
17
16
  if (functionResources.length > 0) {
18
- const functionsOutput = [];
19
- functionsOutput.push(`${chalk.bold('Functions')} [${functionResources.length}]`);
20
- const functionResourcesOutput = functionResources.map((fn) => {
17
+ const fnsOutput = [`${chalk.bold('Functions')} [${functionResources.length}]`];
18
+ const fnDetails = [];
19
+ for (const fn of functionResources) {
21
20
  const name = chalk.green(fn.displayName || fn.name);
22
- const externalId = fn.externalId ? `Fn${niceId(fn.externalId)}` : '';
23
- return `"${name}" ${externalId}`;
24
- });
25
- functionsOutput.push(functionResourcesOutput);
26
- output.push(functionsOutput);
21
+ const ids = [
22
+ 'id' in fn && fn.id ? `${niceId(fn.id)}` : '',
23
+ 'externalId' in fn && fn.externalId ? `<${niceId(fn.externalId)}>` : '',
24
+ ].join(' ');
25
+ fnDetails.push(`"${name}" ${ids}`);
26
+ if ('parameters' in fn && fn.parameters) {
27
+ fnDetails.push(arrayifyStackFunction(fn));
28
+ }
29
+ else {
30
+ fnDetails.push(arrayifyLocalFunction(fn));
31
+ }
32
+ }
33
+ fnsOutput.push(fnDetails);
34
+ output.push(fnsOutput);
27
35
  }
28
36
  if (hasOtherResources) {
29
- const otherOutput = [];
30
- otherOutput.push(`${chalk.bold('Other Resources')} [${otherResources.length}]`);
37
+ const otherOutput = [`${chalk.bold('Other Resources')} [${otherResources.length}]`];
31
38
  const otherResourcesOutput = otherResources.map((other) => {
32
39
  return `"${chalk.yellow(other.displayName ?? other.name ?? 'unnamed')}"`;
33
40
  });
@@ -37,9 +44,8 @@ export function formatResourceTree(resources) {
37
44
  return treeify(output);
38
45
  }
39
46
  export function formatStackInfo(stack, isCurrentStack = false) {
40
- const output = [];
41
47
  const isStack = 'id' in stack;
42
- const infoOutput = [];
48
+ const output = [];
43
49
  if (isStack) {
44
50
  const stackName = isCurrentStack ? chalk.bold.blue(stack.name) : chalk.bold(stack.name);
45
51
  output.push(`"${stackName}" ${niceId(stack.id)}${isCurrentStack ? ' (current)' : ''}`);
@@ -47,6 +53,7 @@ export function formatStackInfo(stack, isCurrentStack = false) {
47
53
  else {
48
54
  output.push('Local Blueprint');
49
55
  }
56
+ const infoOutput = [];
50
57
  if (stack.resources) {
51
58
  infoOutput.push(`${stack.resources.length} resource${stack.resources.length === 1 ? '' : 's'}`);
52
59
  }
@@ -1,11 +1,15 @@
1
+ export { info, niceId, warn, severe } from './presenters.js';
2
+ /** @deprecated Use `chalk.bold` directly */
1
3
  export declare function bold(str: string): string;
4
+ /** @deprecated Use `chalk.underline` directly */
2
5
  export declare function underline(str: string): string;
6
+ /** @deprecated Use `chalk.dim` directly */
3
7
  export declare function dim(str: string): string;
8
+ /** @deprecated Use `chalk.blue` directly */
4
9
  export declare function blue(str: string): string;
10
+ /** @deprecated Use `chalk.green` directly */
5
11
  export declare function green(str: string): string;
12
+ /** @deprecated Use `chalk.red` directly */
6
13
  export declare function red(str: string): string;
14
+ /** @deprecated Use `chalk.yellow` directly */
7
15
  export declare function yellow(str: string): string;
8
- export declare function info(str: string): string;
9
- export declare function warn(str: string): string;
10
- export declare function severe(str: string): string;
11
- export declare function niceId(id: string | undefined): string;
@@ -1,38 +1,30 @@
1
1
  import chalk from 'chalk';
2
- // TODO: remove simple exports and use chalk directly
3
- // move compound styling like niceId to formatters
2
+ export { info, niceId, warn, severe } from './presenters.js';
3
+ /** @deprecated Use `chalk.bold` directly */
4
4
  export function bold(str) {
5
5
  return chalk.bold(str);
6
6
  }
7
+ /** @deprecated Use `chalk.underline` directly */
7
8
  export function underline(str) {
8
9
  return chalk.underline(str);
9
10
  }
11
+ /** @deprecated Use `chalk.dim` directly */
10
12
  export function dim(str) {
11
13
  return chalk.dim(str);
12
14
  }
15
+ /** @deprecated Use `chalk.blue` directly */
13
16
  export function blue(str) {
14
17
  return chalk.blue(str);
15
18
  }
19
+ /** @deprecated Use `chalk.green` directly */
16
20
  export function green(str) {
17
21
  return chalk.green(str);
18
22
  }
23
+ /** @deprecated Use `chalk.red` directly */
19
24
  export function red(str) {
20
25
  return chalk.red(str);
21
26
  }
27
+ /** @deprecated Use `chalk.yellow` directly */
22
28
  export function yellow(str) {
23
29
  return chalk.yellow(str);
24
30
  }
25
- export function info(str) {
26
- return `${chalk.blue('❯')} ${str}`;
27
- }
28
- export function warn(str) {
29
- return `${chalk.yellow('❯')} ${str}`;
30
- }
31
- export function severe(str) {
32
- return `${chalk.red('❯')} ${str}`;
33
- }
34
- export function niceId(id) {
35
- if (!id)
36
- return '';
37
- return `<${yellow(id)}>`;
38
- }
@@ -1,5 +1,6 @@
1
1
  export * as blueprintsFormatting from './blueprints-formatting.js';
2
2
  export * as colors from './colors.js';
3
+ export * as presenters from './presenters.js';
3
4
  export * as dates from './dates.js';
4
5
  export * as logsFormatting from './logs-formatting.js';
5
6
  export * as errors from './errors.js';
@@ -1,5 +1,6 @@
1
1
  export * as blueprintsFormatting from './blueprints-formatting.js';
2
2
  export * as colors from './colors.js';
3
+ export * as presenters from './presenters.js';
3
4
  export * as dates from './dates.js';
4
5
  export * as logsFormatting from './logs-formatting.js';
5
6
  export * as errors from './errors.js';
@@ -1,10 +1,10 @@
1
1
  import { treeify } from 'array-treeify';
2
- import { blue, bold, dim, green } from './colors.js';
2
+ import chalk from 'chalk';
3
3
  export function formatLogEntry(log, withDate = true, isNewest = false) {
4
4
  const date = new Date(log.timestamp);
5
5
  const time = date.toLocaleTimeString();
6
6
  const day = date.toLocaleDateString();
7
- return `${isNewest ? `${green('>')} ` : ''}${withDate ? `${day} ` : ''}${dim(time)} ${log.message}`;
7
+ return `${isNewest ? `${chalk.green('>')} ` : ''}${withDate ? `${day} ` : ''}${chalk.dim(time)} ${log.message}`;
8
8
  }
9
9
  export function formatRecentLogs(logs) {
10
10
  if (logs.length === 0)
@@ -33,7 +33,7 @@ export function formatLogsByDay(logsByDay) {
33
33
  return new Date(a).getTime() - new Date(b).getTime();
34
34
  });
35
35
  for (const day of sortedDays) {
36
- output.push(`${blue('Date:')} ${bold(day)}`);
36
+ output.push(`${chalk.blue('Date:')} ${chalk.bold(day)}`);
37
37
  const dayLogs = logsByDay.get(day) || [];
38
38
  dayLogs.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
39
39
  const dayLogsOutput = dayLogs.map((log) => formatLogEntry(log, false));
@@ -0,0 +1,4 @@
1
+ export declare function info(str: string): string;
2
+ export declare function warn(str: string): string;
3
+ export declare function severe(str: string): string;
4
+ export declare function niceId(id: string | undefined): string;
@@ -0,0 +1,15 @@
1
+ import chalk from 'chalk';
2
+ export function info(str) {
3
+ return `${chalk.blue('❯')} ${str}`;
4
+ }
5
+ export function warn(str) {
6
+ return `${chalk.yellow('❯')} ${str}`;
7
+ }
8
+ export function severe(str) {
9
+ return `${chalk.red('❯')} ${str}`;
10
+ }
11
+ export function niceId(id) {
12
+ if (!id)
13
+ return '';
14
+ return `<${chalk.yellow(id)}>`;
15
+ }
@@ -0,0 +1,4 @@
1
+ import type { TreeInput } from 'array-treeify';
2
+ import type { LocalFunctionResource, StackFunctionResource } from '../../utils/types.js';
3
+ export declare function arrayifyLocalFunction(fn: LocalFunctionResource): TreeInput;
4
+ export declare function arrayifyStackFunction(fn: StackFunctionResource): TreeInput;
@@ -0,0 +1,52 @@
1
+ import chalk from 'chalk';
2
+ function formatMemory(memory) {
3
+ return `${chalk.dim('memory:')} ${memory}`;
4
+ }
5
+ function formatTimeout(timeout) {
6
+ return `${chalk.dim('timeout:')} ${timeout}`;
7
+ }
8
+ function arrayifyEvent(event) {
9
+ if (!event)
10
+ return undefined;
11
+ const details = [];
12
+ if (event.on) {
13
+ details.push(`${chalk.dim('on:')} ${event.on.map((o) => `"${o}"`).join(', ')}`);
14
+ }
15
+ if (event.filter) {
16
+ details.push(`${chalk.dim('filter:')} ${event.filter}`);
17
+ }
18
+ if (event.projection) {
19
+ details.push(`${chalk.dim('projection:')} ${event.projection}`);
20
+ }
21
+ return details;
22
+ }
23
+ export function arrayifyLocalFunction(fn) {
24
+ const details = [`${chalk.dim('type:')} "${fn.type}"`];
25
+ if (fn.memory)
26
+ details.push(formatMemory(fn.memory));
27
+ if (fn.timeout)
28
+ details.push(formatTimeout(fn.timeout));
29
+ if (fn.event) {
30
+ const eventDetails = arrayifyEvent(fn.event);
31
+ if (eventDetails) {
32
+ details.push(`${chalk.dim('event:')}`);
33
+ details.push(eventDetails);
34
+ }
35
+ }
36
+ return details;
37
+ }
38
+ export function arrayifyStackFunction(fn) {
39
+ const details = [`${chalk.dim('type:')} "${fn.type}"`];
40
+ if (fn.parameters.memory)
41
+ details.push(formatMemory(fn.parameters.memory));
42
+ if (fn.parameters.timeout)
43
+ details.push(formatTimeout(fn.parameters.timeout));
44
+ if (fn.parameters.event) {
45
+ const eventDetails = arrayifyEvent(fn.parameters.event);
46
+ if (eventDetails) {
47
+ details.push(`${chalk.dim('event:')}`);
48
+ details.push(eventDetails);
49
+ }
50
+ }
51
+ return details;
52
+ }
@@ -87,6 +87,11 @@ export interface StackFunctionResource extends StackResource {
87
87
  memory?: number;
88
88
  timeout?: number;
89
89
  env?: Record<string, string>;
90
+ event?: {
91
+ on: Array<string>;
92
+ filter?: string;
93
+ projection?: string;
94
+ };
90
95
  };
91
96
  }
92
97
  /** @internal */
@@ -790,5 +790,5 @@
790
790
  ]
791
791
  }
792
792
  },
793
- "version": "6.2.0"
793
+ "version": "6.2.1"
794
794
  }
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": "6.2.0",
4
+ "version": "6.2.1",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -64,20 +64,20 @@
64
64
  "test:watch": "vitest"
65
65
  },
66
66
  "dependencies": {
67
- "@oclif/core": "^4.2.10",
68
- "@oclif/plugin-help": "^6.2.27",
67
+ "@oclif/core": "^4.3.0",
68
+ "@oclif/plugin-help": "^6.2.28",
69
69
  "adm-zip": "^0.5.16",
70
- "array-treeify": "^0.1.3",
70
+ "array-treeify": "^0.1.5",
71
71
  "chalk": "^5.4.1",
72
72
  "color-json": "^3.0.5",
73
73
  "eventsource": "^3.0.6",
74
74
  "find-up": "^7.0.0",
75
- "inquirer": "^12.5.2",
75
+ "inquirer": "^12.6.0",
76
76
  "mime-types": "^3.0.1",
77
- "vite": "^6.3.3",
77
+ "ora": "^8.2.0",
78
+ "vite": "^6.3.5",
78
79
  "vite-tsconfig-paths": "^5.1.4",
79
- "xdg-basedir": "^5.1.0",
80
- "yocto-spinner": "^0.2.1"
80
+ "xdg-basedir": "^5.1.0"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@biomejs/biome": "1.9.4",
@@ -87,21 +87,21 @@
87
87
  "@lezer/highlight": "^1.2.1",
88
88
  "@oclif/test": "^4.1.12",
89
89
  "@rollup/plugin-node-resolve": "^16.0.1",
90
- "@sanity/client": "^6.29.0",
90
+ "@sanity/client": "^7.1.0",
91
91
  "@types/adm-zip": "^0.5.7",
92
92
  "@types/mime-types": "^2.1.4",
93
93
  "@types/node": "18",
94
94
  "codemirror": "^6.0.1",
95
- "mentoss": "^0.9.2",
96
- "oclif": "^4.17.44",
97
- "pretty-bytes": "^6.1.1",
95
+ "mentoss": "^0.11.0",
96
+ "oclif": "^4.17.46",
97
+ "pretty-bytes": "^7.0.0",
98
98
  "pretty-ms": "^9.2.0",
99
- "rollup": "^4.40.0",
99
+ "rollup": "^4.40.2",
100
100
  "shx": "^0.4.0",
101
101
  "ts-node": "^10.9.2",
102
- "tsx": "^4.19.3",
102
+ "tsx": "^4.19.4",
103
103
  "typescript": "^5.8.3",
104
- "vitest": "3.1.1"
104
+ "vitest": "3.1.3"
105
105
  },
106
106
  "oclif": {
107
107
  "bin": "sanity-run",