@sanity/runtime-cli 6.1.1 → 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.
Files changed (38) hide show
  1. package/README.md +16 -16
  2. package/dist/baseCommands.js +1 -1
  3. package/dist/commands/functions/env/add.js +5 -7
  4. package/dist/commands/functions/env/list.js +4 -4
  5. package/dist/commands/functions/env/remove.js +5 -7
  6. package/dist/commands/functions/logs.js +15 -15
  7. package/dist/cores/blueprints/config.js +5 -5
  8. package/dist/cores/blueprints/deploy.js +13 -13
  9. package/dist/cores/blueprints/destroy.js +9 -9
  10. package/dist/cores/blueprints/info.js +1 -1
  11. package/dist/cores/blueprints/init.js +1 -1
  12. package/dist/cores/blueprints/logs.js +10 -12
  13. package/dist/cores/blueprints/stacks.js +1 -1
  14. package/dist/server/static/components/app.css +18 -6
  15. package/dist/server/static/components/codemirror-theme.d.ts +6 -0
  16. package/dist/server/static/components/codemirror-theme.js +49 -0
  17. package/dist/server/static/components/function-list.js +1 -1
  18. package/dist/server/static/components/payload-panel.js +4 -2
  19. package/dist/server/static/components/response-panel.js +4 -2
  20. package/dist/server/static/favicon-dark.svg +17 -0
  21. package/dist/server/static/favicon.svg +17 -0
  22. package/dist/server/static/index.html +13 -1
  23. package/dist/server/static/vendor/vendor.bundle.d.ts +193 -0
  24. package/dist/server/static/vendor/vendor.bundle.js +51 -14
  25. package/dist/utils/display/blueprints-formatting.js +24 -17
  26. package/dist/utils/display/colors.d.ts +8 -4
  27. package/dist/utils/display/colors.js +8 -16
  28. package/dist/utils/display/index.d.ts +1 -0
  29. package/dist/utils/display/index.js +1 -0
  30. package/dist/utils/display/logs-formatting.js +3 -3
  31. package/dist/utils/display/presenters.d.ts +4 -0
  32. package/dist/utils/display/presenters.js +15 -0
  33. package/dist/utils/display/resources-formatting.d.ts +4 -0
  34. package/dist/utils/display/resources-formatting.js +52 -0
  35. package/dist/utils/types.d.ts +5 -0
  36. package/oclif.manifest.json +1 -1
  37. package/package.json +16 -15
  38. package/dist/server/static/sanity-logo-sm.svg +0 -1
@@ -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.1.1"
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.1.1",
4
+ "version": "6.2.1",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -64,43 +64,44 @@
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",
84
84
  "@codemirror/lang-json": "^6.0.1",
85
85
  "@codemirror/state": "^6.5.2",
86
86
  "@enhance/store": "^1.0.2",
87
+ "@lezer/highlight": "^1.2.1",
87
88
  "@oclif/test": "^4.1.12",
88
89
  "@rollup/plugin-node-resolve": "^16.0.1",
89
- "@sanity/client": "^6.29.0",
90
+ "@sanity/client": "^7.1.0",
90
91
  "@types/adm-zip": "^0.5.7",
91
92
  "@types/mime-types": "^2.1.4",
92
93
  "@types/node": "18",
93
94
  "codemirror": "^6.0.1",
94
- "mentoss": "^0.9.2",
95
- "oclif": "^4.17.44",
96
- "pretty-bytes": "^6.1.1",
95
+ "mentoss": "^0.11.0",
96
+ "oclif": "^4.17.46",
97
+ "pretty-bytes": "^7.0.0",
97
98
  "pretty-ms": "^9.2.0",
98
- "rollup": "^4.40.0",
99
+ "rollup": "^4.40.2",
99
100
  "shx": "^0.4.0",
100
101
  "ts-node": "^10.9.2",
101
- "tsx": "^4.19.3",
102
+ "tsx": "^4.19.4",
102
103
  "typescript": "^5.8.3",
103
- "vitest": "3.1.1"
104
+ "vitest": "3.1.3"
104
105
  },
105
106
  "oclif": {
106
107
  "bin": "sanity-run",
@@ -1 +0,0 @@
1
- <svg data-sanity-icon="sanity-monogram" width="1em" height="1em" viewBox="0 0 128 128" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="128" height="128" rx="8" fill="#ef4434"></rect><path d="M39.423 33.163C39.423 44.1615 46.3363 50.7056 60.1768 54.1564L74.843 57.4972C87.9418 60.453 95.9186 67.7945 95.9186 79.7554C96.0205 84.9662 94.2961 90.0531 91.0345 94.1635C91.0345 82.2301 84.751 75.7822 69.595 71.9052L55.1948 68.6882C43.6633 66.1035 34.7629 60.0681 34.7629 47.0761C34.7022 42.0589 36.3416 37.1644 39.423 33.163" fill="#ffffff"></path><path d="M82.0221 76.827C88.2776 80.759 91.0206 86.2582 91.0206 94.1497C85.8426 100.666 76.7462 104.323 66.0545 104.323C48.0576 104.323 35.4626 95.6207 32.6637 80.4977H49.9468C52.172 87.4406 58.0636 90.6576 65.9285 90.6576C75.5287 90.6576 81.9102 85.6258 82.0361 76.7995" fill="#ffdedc"></path><path d="M48.4075 49.4682C45.551 47.8004 43.2074 45.404 41.6256 42.5332C40.0437 39.6624 39.2826 36.4244 39.4231 33.1629C44.4191 26.7013 53.1096 22.7556 63.7034 22.7556C82.0362 22.7556 92.6439 32.2693 95.2609 45.66H78.6355C76.8022 40.3807 72.2121 36.27 63.8434 36.27C54.9009 36.27 48.7993 41.3843 48.4495 49.4682" fill="#ffdedc"></path></svg>