@sanity/runtime-cli 2.5.1 → 2.5.3

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/2.5.1 linux-x64 node-v22.14.0
23
+ @sanity/runtime-cli/2.5.3 linux-x64 node-v22.14.0
24
24
  $ sanity-run --help [COMMAND]
25
25
  USAGE
26
26
  $ sanity-run COMMAND
@@ -63,7 +63,7 @@ EXAMPLES
63
63
  $ sanity-run blueprints add function
64
64
  ```
65
65
 
66
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/blueprints/add.ts)_
66
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/blueprints/add.ts)_
67
67
 
68
68
  ## `sanity-run blueprints config`
69
69
 
@@ -85,7 +85,7 @@ EXAMPLES
85
85
  $ sanity-run blueprints config --edit
86
86
  ```
87
87
 
88
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/blueprints/config.ts)_
88
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/blueprints/config.ts)_
89
89
 
90
90
  ## `sanity-run blueprints deploy`
91
91
 
@@ -102,7 +102,7 @@ EXAMPLES
102
102
  $ sanity-run blueprints deploy
103
103
  ```
104
104
 
105
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/blueprints/deploy.ts)_
105
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/blueprints/deploy.ts)_
106
106
 
107
107
  ## `sanity-run blueprints info`
108
108
 
@@ -124,7 +124,7 @@ EXAMPLES
124
124
  $ sanity-run blueprints info --id abc123
125
125
  ```
126
126
 
127
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/blueprints/info.ts)_
127
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/blueprints/info.ts)_
128
128
 
129
129
  ## `sanity-run blueprints init`
130
130
 
@@ -141,7 +141,7 @@ EXAMPLES
141
141
  $ sanity-run blueprints init
142
142
  ```
143
143
 
144
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/blueprints/init.ts)_
144
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/blueprints/init.ts)_
145
145
 
146
146
  ## `sanity-run blueprints logs`
147
147
 
@@ -163,7 +163,7 @@ EXAMPLES
163
163
  $ sanity-run blueprints logs --watch
164
164
  ```
165
165
 
166
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/blueprints/logs.ts)_
166
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/blueprints/logs.ts)_
167
167
 
168
168
  ## `sanity-run blueprints plan`
169
169
 
@@ -180,7 +180,7 @@ EXAMPLES
180
180
  $ sanity-run blueprints plan
181
181
  ```
182
182
 
183
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/blueprints/plan.ts)_
183
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/blueprints/plan.ts)_
184
184
 
185
185
  ## `sanity-run blueprints stacks`
186
186
 
@@ -197,7 +197,7 @@ EXAMPLES
197
197
  $ sanity-run blueprints stacks
198
198
  ```
199
199
 
200
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/blueprints/stacks.ts)_
200
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/blueprints/stacks.ts)_
201
201
 
202
202
  ## `sanity-run functions dev`
203
203
 
@@ -217,7 +217,7 @@ EXAMPLES
217
217
  $ sanity-run functions dev --port 8974
218
218
  ```
219
219
 
220
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/functions/dev.ts)_
220
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/functions/dev.ts)_
221
221
 
222
222
  ## `sanity-run functions env add NAME KEY VALUE`
223
223
 
@@ -239,7 +239,7 @@ EXAMPLES
239
239
  $ sanity-run functions env add MyFunction API_URL https://api.example.com/
240
240
  ```
241
241
 
242
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/functions/env/add.ts)_
242
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/functions/env/add.ts)_
243
243
 
244
244
  ## `sanity-run functions env remove NAME KEY`
245
245
 
@@ -260,7 +260,7 @@ EXAMPLES
260
260
  $ sanity-run functions env remove MyFunction API_URL
261
261
  ```
262
262
 
263
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/functions/env/remove.ts)_
263
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/functions/env/remove.ts)_
264
264
 
265
265
  ## `sanity-run functions invoke NAME`
266
266
 
@@ -286,7 +286,7 @@ EXAMPLES
286
286
  $ sanity-run functions invoke <name> --file 'payload.json'
287
287
  ```
288
288
 
289
- _See code: [src/commands/functions/invoke.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/functions/invoke.ts)_
289
+ _See code: [src/commands/functions/invoke.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/functions/invoke.ts)_
290
290
 
291
291
  ## `sanity-run functions logs NAME`
292
292
 
@@ -314,7 +314,7 @@ EXAMPLES
314
314
  $ sanity-run functions logs <name> --limit 100
315
315
  ```
316
316
 
317
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/functions/logs.ts)_
317
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/functions/logs.ts)_
318
318
 
319
319
  ## `sanity-run functions test NAME`
320
320
 
@@ -343,7 +343,7 @@ EXAMPLES
343
343
  $ sanity-run functions test <name> --data '{ "id": 1 }' --timeout 60
344
344
  ```
345
345
 
346
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.1/src/commands/functions/test.ts)_
346
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v2.5.3/src/commands/functions/test.ts)_
347
347
 
348
348
  ## `sanity-run help [COMMAND]`
349
349
 
@@ -1,7 +1,21 @@
1
+ interface Project {
2
+ id: string;
3
+ displayName: string;
4
+ studioHost: string | null;
5
+ organizationId: string;
6
+ isBlocked: boolean;
7
+ isDisabled: boolean;
8
+ isDisabledByUser: boolean;
9
+ activityFeedEnabled: boolean;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ }
13
+ interface ListProjectsResponse {
14
+ ok: boolean;
15
+ error: string | null;
16
+ projects: Project[];
17
+ }
1
18
  export declare function listProjects({ token }: {
2
19
  token: string;
3
- }): Promise<{
4
- ok: boolean;
5
- error: any;
6
- projects: any;
7
- }>;
20
+ }): Promise<ListProjectsResponse>;
21
+ export {};
@@ -1,49 +1,49 @@
1
- import type { AuthParams, StackPayload } from '../../utils/types.js';
1
+ import type { AuthParams, Stack, StackPayload } from '../../utils/types.js';
2
2
  export declare const stacksUrl: string;
3
- export declare function listStacks(auth: AuthParams): Promise<{
3
+ interface ListStacksResponse {
4
4
  ok: boolean;
5
- error: any;
6
- stacks: any;
7
- }>;
5
+ error: string | null;
6
+ stacks: Stack[];
7
+ }
8
+ export declare function listStacks(auth: AuthParams): Promise<ListStacksResponse>;
9
+ interface GetStackByNameResponse {
10
+ ok: boolean;
11
+ error: string | null;
12
+ stack: Stack | null;
13
+ stackId: string | null;
14
+ availableStacks?: string[];
15
+ }
8
16
  /** @deprecated Use getStack instead */
9
- export declare function getStackByName({ name, auth }: {
17
+ export declare function getStackByName({ name, auth, }: {
10
18
  name: string;
11
19
  auth: AuthParams;
12
- }): Promise<{
13
- ok: boolean;
14
- error: null;
15
- stack: null;
16
- stackId: null;
17
- availableStacks: any;
18
- } | {
20
+ }): Promise<GetStackByNameResponse>;
21
+ interface GetStackResponse {
19
22
  ok: boolean;
20
- error: any;
21
- stack: any;
22
- stackId: any;
23
- availableStacks?: undefined;
24
- }>;
25
- export declare function getStack({ stackId, auth }: {
23
+ error: string | null;
24
+ stack: Stack;
25
+ }
26
+ export declare function getStack({ stackId, auth, }: {
26
27
  stackId: string;
27
28
  auth: AuthParams;
28
- }): Promise<{
29
+ }): Promise<GetStackResponse>;
30
+ interface CreateStackResponse {
29
31
  ok: boolean;
30
- error: any;
31
- stack: any;
32
- }>;
32
+ error: string | null;
33
+ stack: Stack;
34
+ }
33
35
  export declare function createStack({ stackPayload, auth, }: {
34
36
  stackPayload: StackPayload;
35
37
  auth: AuthParams;
36
- }): Promise<{
38
+ }): Promise<CreateStackResponse>;
39
+ interface UpdateStackResponse {
37
40
  ok: boolean;
38
- error: any;
39
- stack: any;
40
- }>;
41
+ error: string | null;
42
+ stack: Stack;
43
+ }
41
44
  export declare function updateStack({ stackId, stackPayload, auth, }: {
42
45
  stackId: string;
43
46
  stackPayload: StackPayload;
44
47
  auth: AuthParams;
45
- }): Promise<{
46
- ok: boolean;
47
- error: any;
48
- stack: any;
49
- }>;
48
+ }): Promise<UpdateStackResponse>;
49
+ export {};
@@ -15,7 +15,7 @@ export async function listStacks(auth) {
15
15
  };
16
16
  }
17
17
  /** @deprecated Use getStack instead */
18
- export async function getStackByName({ name, auth }) {
18
+ export async function getStackByName({ name, auth, }) {
19
19
  const { ok, stacks, error } = await listStacks(auth);
20
20
  if (!ok || !stacks) {
21
21
  return {
@@ -43,7 +43,7 @@ export async function getStackByName({ name, auth }) {
43
43
  stackId: foundStack.id,
44
44
  };
45
45
  }
46
- export async function getStack({ stackId, auth }) {
46
+ export async function getStack({ stackId, auth, }) {
47
47
  const response = await fetch(`${stacksUrl}/${stackId}`, {
48
48
  method: 'GET',
49
49
  headers: getHeaders(auth),
@@ -30,7 +30,7 @@ export default class Config extends Command {
30
30
  return;
31
31
  const { ok, projects, error } = await listProjects({ token });
32
32
  if (!ok)
33
- this.error(error);
33
+ this.error(error ?? 'Unknown error listing projects');
34
34
  if (projects.length === 0) {
35
35
  this.error('No projects found. Please create a project in Sanity.io first.');
36
36
  }
@@ -51,7 +51,7 @@ export default class Config extends Command {
51
51
  // get stacks for selected project
52
52
  const { ok: stacksOk, stacks, error: stacksError } = await listStacks(auth);
53
53
  if (!stacksOk)
54
- this.error(stacksError);
54
+ this.error(stacksError ?? 'Unknown error listing stacks');
55
55
  let stackId;
56
56
  if (stacks.length > 0) {
57
57
  const stackChoices = stacks.map(({ name, id }) => ({
@@ -29,7 +29,7 @@ export default class Init extends Command {
29
29
  ]);
30
30
  const { ok, projects, error } = await listProjects({ token });
31
31
  if (!ok)
32
- this.error(error);
32
+ this.error(error ?? 'Unknown error listing projects');
33
33
  if (projects.length === 0) {
34
34
  this.error('No projects found. Please create a project in Sanity.io first.');
35
35
  }
@@ -1,21 +1,22 @@
1
+ import chalk from 'chalk';
1
2
  export function bold(str) {
2
- return `\x1b[1m${str}\x1b[0m`;
3
+ return chalk.bold(str);
3
4
  }
4
5
  export function dim(str) {
5
- return `\x1b[2m${str}\x1b[0m`;
6
+ return chalk.dim(str);
6
7
  }
7
8
  export function blue(str) {
8
- return `\x1b[34m${str}\x1b[0m`;
9
+ return chalk.blue(str);
9
10
  }
10
11
  export function green(str) {
11
- return `\x1b[32m${str}\x1b[0m`;
12
+ return chalk.green(str);
12
13
  }
13
14
  export function red(str) {
14
- return `\x1b[31m${str}\x1b[0m`;
15
+ return chalk.red(str);
15
16
  }
16
17
  export function yellow(str) {
17
- return `\x1b[33m${str}\x1b[0m`;
18
+ return chalk.yellow(str);
18
19
  }
19
20
  export function boldnblue(str) {
20
- return bold(blue(str));
21
+ return chalk.bold.blue(str);
21
22
  }
@@ -502,5 +502,5 @@
502
502
  ]
503
503
  }
504
504
  },
505
- "version": "2.5.1"
505
+ "version": "2.5.3"
506
506
  }
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": "2.5.1",
4
+ "version": "2.5.3",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -44,6 +44,7 @@
44
44
  "@oclif/plugin-help": "^6.2.27",
45
45
  "adm-zip": "^0.5.16",
46
46
  "array-treeify": "^0.1.3",
47
+ "chalk": "^5.4.1",
47
48
  "color-json": "^3.0.5",
48
49
  "eventsource": "^3.0.6",
49
50
  "inquirer": "^12.5.2",