@sanity/runtime-cli 4.3.3 → 4.3.4

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/4.3.3 linux-x64 node-v22.14.0
23
+ @sanity/runtime-cli/4.3.4 linux-x64 node-v22.14.0
24
24
  $ sanity-run --help [COMMAND]
25
25
  USAGE
26
26
  $ sanity-run COMMAND
@@ -74,7 +74,7 @@ EXAMPLES
74
74
  $ sanity-run blueprints add function --name my-function --function-type document-publish
75
75
  ```
76
76
 
77
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/blueprints/add.ts)_
77
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/blueprints/add.ts)_
78
78
 
79
79
  ## `sanity-run blueprints config`
80
80
 
@@ -103,7 +103,7 @@ EXAMPLES
103
103
  $ sanity-run blueprints config --edit --project-id <projectId> --stack-id <stackId>
104
104
  ```
105
105
 
106
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/blueprints/config.ts)_
106
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/blueprints/config.ts)_
107
107
 
108
108
  ## `sanity-run blueprints deploy`
109
109
 
@@ -123,7 +123,7 @@ EXAMPLES
123
123
  $ sanity-run blueprints deploy
124
124
  ```
125
125
 
126
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/blueprints/deploy.ts)_
126
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/blueprints/deploy.ts)_
127
127
 
128
128
  ## `sanity-run blueprints destroy`
129
129
 
@@ -146,7 +146,7 @@ EXAMPLES
146
146
  $ sanity-run blueprints destroy --id ST-a1b2c3
147
147
  ```
148
148
 
149
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/blueprints/destroy.ts)_
149
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/blueprints/destroy.ts)_
150
150
 
151
151
  ## `sanity-run blueprints info`
152
152
 
@@ -168,7 +168,7 @@ EXAMPLES
168
168
  $ sanity-run blueprints info --id ST-a1b2c3
169
169
  ```
170
170
 
171
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/blueprints/info.ts)_
171
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/blueprints/info.ts)_
172
172
 
173
173
  ## `sanity-run blueprints init`
174
174
 
@@ -198,7 +198,7 @@ EXAMPLES
198
198
  $ sanity-run blueprints init --blueprint-type <json|js|ts> --project-id <projectId> --stack-name <stackName>
199
199
  ```
200
200
 
201
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/blueprints/init.ts)_
201
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/blueprints/init.ts)_
202
202
 
203
203
  ## `sanity-run blueprints logs`
204
204
 
@@ -220,7 +220,7 @@ EXAMPLES
220
220
  $ sanity-run blueprints logs --watch
221
221
  ```
222
222
 
223
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/blueprints/logs.ts)_
223
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/blueprints/logs.ts)_
224
224
 
225
225
  ## `sanity-run blueprints plan`
226
226
 
@@ -237,7 +237,7 @@ EXAMPLES
237
237
  $ sanity-run blueprints plan
238
238
  ```
239
239
 
240
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/blueprints/plan.ts)_
240
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/blueprints/plan.ts)_
241
241
 
242
242
  ## `sanity-run blueprints stacks`
243
243
 
@@ -259,7 +259,7 @@ EXAMPLES
259
259
  $ sanity-run blueprints stacks --projectId a1b2c3
260
260
  ```
261
261
 
262
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/blueprints/stacks.ts)_
262
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/blueprints/stacks.ts)_
263
263
 
264
264
  ## `sanity-run functions dev`
265
265
 
@@ -279,7 +279,7 @@ EXAMPLES
279
279
  $ sanity-run functions dev --port 8974
280
280
  ```
281
281
 
282
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/functions/dev.ts)_
282
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/functions/dev.ts)_
283
283
 
284
284
  ## `sanity-run functions env add NAME KEY VALUE`
285
285
 
@@ -301,7 +301,7 @@ EXAMPLES
301
301
  $ sanity-run functions env add MyFunction API_URL https://api.example.com/
302
302
  ```
303
303
 
304
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/functions/env/add.ts)_
304
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/functions/env/add.ts)_
305
305
 
306
306
  ## `sanity-run functions env list NAME`
307
307
 
@@ -321,7 +321,7 @@ EXAMPLES
321
321
  $ sanity-run functions env list MyFunction
322
322
  ```
323
323
 
324
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/functions/env/list.ts)_
324
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/functions/env/list.ts)_
325
325
 
326
326
  ## `sanity-run functions env remove NAME KEY`
327
327
 
@@ -342,7 +342,7 @@ EXAMPLES
342
342
  $ sanity-run functions env remove MyFunction API_URL
343
343
  ```
344
344
 
345
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/functions/env/remove.ts)_
345
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/functions/env/remove.ts)_
346
346
 
347
347
  ## `sanity-run functions invoke NAME`
348
348
 
@@ -368,7 +368,7 @@ EXAMPLES
368
368
  $ sanity-run functions invoke <name> --file 'payload.json'
369
369
  ```
370
370
 
371
- _See code: [src/commands/functions/invoke.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/functions/invoke.ts)_
371
+ _See code: [src/commands/functions/invoke.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/functions/invoke.ts)_
372
372
 
373
373
  ## `sanity-run functions logs NAME`
374
374
 
@@ -400,7 +400,7 @@ EXAMPLES
400
400
  $ sanity-run functions logs <name> --delete
401
401
  ```
402
402
 
403
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/functions/logs.ts)_
403
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/functions/logs.ts)_
404
404
 
405
405
  ## `sanity-run functions test NAME`
406
406
 
@@ -433,7 +433,7 @@ EXAMPLES
433
433
  $ sanity-run functions test <name> --data '{ "id": 1 }' --timeout 60
434
434
  ```
435
435
 
436
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.3/src/commands/functions/test.ts)_
436
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v4.3.4/src/commands/functions/test.ts)_
437
437
 
438
438
  ## `sanity-run help [COMMAND]`
439
439
 
@@ -1,6 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export default class Config extends Command {
3
- token: string | undefined;
4
3
  static description: string;
5
4
  static examples: string[];
6
5
  static flags: {
@@ -9,6 +8,7 @@ export default class Config extends Command {
9
8
  'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
9
  'stack-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
10
  };
11
+ sanityToken: string | undefined;
12
12
  run(): Promise<void>;
13
13
  promptForProjectId({ knownProjectId }: {
14
14
  knownProjectId?: string;
@@ -8,7 +8,6 @@ import { getStack, listStacks } from '../../actions/blueprints/stacks.js';
8
8
  import { bold, dim, niceId } from '../../utils/display/colors.js';
9
9
  import { validTokenOrErrorMessage } from '../../utils/validated-token.js';
10
10
  export default class Config extends Command {
11
- token;
12
11
  static description = 'View or edit Blueprint configuration';
13
12
  static examples = [
14
13
  '<%= config.bin %> <%= command.id %>',
@@ -39,6 +38,7 @@ export default class Config extends Command {
39
38
  dependsOn: ['edit'],
40
39
  }),
41
40
  };
41
+ sanityToken;
42
42
  async run() {
43
43
  const { flags } = await this.parse(Config);
44
44
  const { edit: editConfig, 'project-id': editProjectId, 'stack-id': editStackId, 'test-config': testConfig, } = flags;
@@ -59,7 +59,7 @@ export default class Config extends Command {
59
59
  const { token, error: tokenErr } = await validTokenOrErrorMessage();
60
60
  if (tokenErr)
61
61
  this.error(tokenErr.message);
62
- this.token = token;
62
+ this.sanityToken = token;
63
63
  if (testConfig && !editConfig) {
64
64
  if (configStackId && configProjectId) {
65
65
  await this.testConfigAndReport({ stackId: configStackId, projectId: configProjectId });
@@ -96,9 +96,9 @@ export default class Config extends Command {
96
96
  }
97
97
  }
98
98
  async promptForProjectId({ knownProjectId }) {
99
- if (!this.token)
99
+ if (!this.sanityToken)
100
100
  this.error('Unable to list projects. Missing API token.');
101
- const { ok, projects, error } = await listProjects({ token: this.token });
101
+ const { ok, projects, error } = await listProjects({ token: this.sanityToken });
102
102
  if (!ok)
103
103
  this.error(error ?? 'Unknown error listing projects');
104
104
  if (projects.length === 0) {
@@ -120,9 +120,9 @@ export default class Config extends Command {
120
120
  return pickedProjectId;
121
121
  }
122
122
  async promptForStackId({ projectId, knownStackId, }) {
123
- if (!this.token)
123
+ if (!this.sanityToken)
124
124
  this.error('Unable to list Stacks. Missing API token.');
125
- const auth = { token: this.token, projectId };
125
+ const auth = { token: this.sanityToken, projectId };
126
126
  // get stacks for selected project
127
127
  const { ok: stacksOk, stacks, error: stacksError } = await listStacks(auth);
128
128
  if (!stacksOk)
@@ -147,12 +147,12 @@ export default class Config extends Command {
147
147
  return undefined;
148
148
  }
149
149
  async testConfigAndReport({ stackId, projectId }) {
150
- if (!this.token)
150
+ if (!this.sanityToken)
151
151
  this.error('Unable to test the configuration. Missing API token.');
152
152
  const spinner = Spinner({ text: 'Testing the configuration...' }).start();
153
153
  const { ok, error } = await getStack({
154
154
  stackId,
155
- auth: { token: this.token, projectId },
155
+ auth: { token: this.sanityToken, projectId },
156
156
  });
157
157
  if (!ok) {
158
158
  spinner.error(error ?? 'Unknown error testing the configuration');
@@ -9,7 +9,7 @@ export default class Init extends Command {
9
9
  'stack-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
10
  'stack-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
11
  };
12
- token: string | undefined;
12
+ sanityToken: string | undefined;
13
13
  run(): Promise<void>;
14
14
  promptForBlueprintType(): Promise<string>;
15
15
  promptForProjectId(): Promise<string>;
@@ -39,7 +39,7 @@ export default class Init extends Command {
39
39
  exclusive: ['stack-id'],
40
40
  }),
41
41
  };
42
- token;
42
+ sanityToken;
43
43
  async run() {
44
44
  const { flags } = await this.parse(Init);
45
45
  const { 'blueprint-type': flagBlueprintType, 'project-id': flagProjectId, 'stack-id': flagStackId, 'stack-name': flagStackName, } = flags;
@@ -50,7 +50,7 @@ export default class Init extends Command {
50
50
  const { token, error: tokenErr } = await validTokenOrErrorMessage();
51
51
  if (tokenErr)
52
52
  this.error(tokenErr.message);
53
- this.token = token;
53
+ this.sanityToken = token;
54
54
  const blueprintExtension = flagBlueprintType || (await this.promptForBlueprintType());
55
55
  if (!blueprintExtension)
56
56
  this.error('Blueprint type is required.');
@@ -62,7 +62,7 @@ export default class Init extends Command {
62
62
  if (flagStackName) {
63
63
  const stack = await this.createEmptyStack({
64
64
  stackPayload: { name: flagStackName, projectId, document: { resources: [] } },
65
- auth: { token: this.token, projectId },
65
+ auth: { token: this.sanityToken, projectId },
66
66
  });
67
67
  stackId = stack.id;
68
68
  }
@@ -97,9 +97,9 @@ export default class Init extends Command {
97
97
  return pickedBlueprintsType;
98
98
  }
99
99
  async promptForProjectId() {
100
- if (!this.token)
100
+ if (!this.sanityToken)
101
101
  this.error('Unable to list projects. Missing API token.');
102
- const { ok: projectsOk, error: projectsErr, projects } = await listProjects({ token: this.token });
102
+ const { ok: projectsOk, error: projectsErr, projects, } = await listProjects({ token: this.sanityToken });
103
103
  if (!projectsOk)
104
104
  this.error(projectsErr ?? 'Unknown error listing projects');
105
105
  if (projects.length === 0) {
@@ -120,9 +120,9 @@ export default class Init extends Command {
120
120
  return pickedProjectId;
121
121
  }
122
122
  async promptForStackId({ projectId }) {
123
- if (!this.token)
123
+ if (!this.sanityToken)
124
124
  this.error('Unable to list Stacks. Missing API token.');
125
- const { ok: stacksOk, error: stacksErr, stacks, } = await listStacks({ token: this.token, projectId });
125
+ const { ok: stacksOk, error: stacksErr, stacks, } = await listStacks({ token: this.sanityToken, projectId });
126
126
  if (!stacksOk)
127
127
  this.error(stacksErr || 'Failed to list Stacks');
128
128
  const stackChoices = [{ name: bold('✨ Create a new Stack'), value: 'new' }];
@@ -152,7 +152,7 @@ export default class Init extends Command {
152
152
  ]);
153
153
  const stack = await this.createEmptyStack({
154
154
  stackPayload: { name: stackName, projectId, document: { resources: [] } },
155
- auth: { token: this.token, projectId },
155
+ auth: { token: this.sanityToken, projectId },
156
156
  });
157
157
  return stack.id;
158
158
  }
@@ -18,7 +18,7 @@ export default class Logs extends Command {
18
18
  delete: import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
19
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
20
  };
21
- token: string | undefined;
21
+ sanityToken: string | undefined;
22
22
  run(): Promise<void>;
23
23
  runDeleteLogs(name: string, options: RunDeleteOptions): Promise<void>;
24
24
  runGetLogs(name: string, options: RunGetOptions): Promise<void>;
@@ -52,12 +52,12 @@ export default class Logs extends Command {
52
52
  required: false,
53
53
  }),
54
54
  };
55
- token;
55
+ sanityToken;
56
56
  async run() {
57
57
  const { token, error: tokenErr } = await validTokenOrErrorMessage();
58
58
  if (tokenErr)
59
59
  this.error(tokenErr.message);
60
- this.token = token;
60
+ this.sanityToken = token;
61
61
  const { args, flags } = await this.parse(Logs);
62
62
  if (flags.delete === true) {
63
63
  await this.runDeleteLogs(args.name, flags);
@@ -81,10 +81,10 @@ export default class Logs extends Command {
81
81
  if (!projectId || !externalId) {
82
82
  this.error('Stack not found');
83
83
  }
84
- if (!this.token)
84
+ if (!this.sanityToken)
85
85
  this.error('Unable to delete logs. Missing API token.');
86
86
  const spinner = Spinner({ text: `Deleting logs for function ${yellow(name)}` }).start();
87
- const { ok, error } = await deleteLogsAction(externalId, { token: this.token, projectId });
87
+ const { ok, error } = await deleteLogsAction(externalId, { token: this.sanityToken, projectId });
88
88
  if (!ok) {
89
89
  spinner.error(`${red('Failed')} to retrieve logs`);
90
90
  this.log(`Error: ${error || 'Unknown error'}`);
@@ -98,9 +98,9 @@ export default class Logs extends Command {
98
98
  if (!projectId || !externalId) {
99
99
  this.error('Stack not found');
100
100
  }
101
- if (!this.token)
101
+ if (!this.sanityToken)
102
102
  this.error('Unable to retrieve logs. Missing API token.');
103
- const { ok, error, logs, total } = await logsAction(externalId, { limit: options.limit }, { token: this.token, projectId });
103
+ const { ok, error, logs, total } = await logsAction(externalId, { limit: options.limit }, { token: this.sanityToken, projectId });
104
104
  if (!ok) {
105
105
  spinner.error(`${red('Failed')} to retrieve logs`);
106
106
  this.log(`Error: ${error || 'Unknown error'}`);
@@ -129,9 +129,9 @@ export default class Logs extends Command {
129
129
  }
130
130
  }
131
131
  async getProjectAndExternalId(name) {
132
- if (!this.token)
132
+ if (!this.sanityToken)
133
133
  this.error('Missing API token.');
134
- const { deployedStack } = await readBlueprintOnDisk({ getStack: true, token: this.token });
134
+ const { deployedStack } = await readBlueprintOnDisk({ getStack: true, token: this.sanityToken });
135
135
  if (!deployedStack) {
136
136
  return {};
137
137
  }