@sanity/cli-core 1.0.0 → 1.1.0
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/dist/SanityCommand.js +18 -1
- package/dist/SanityCommand.js.map +1 -1
- package/dist/_exports/package-manager.d.ts +33 -0
- package/dist/_exports/package-manager.js +3 -0
- package/dist/_exports/package-manager.js.map +1 -0
- package/dist/_exports/request.d.ts +36 -34
- package/dist/_exports/ux.d.ts +41 -41
- package/dist/config/cli/schemas.js.map +1 -1
- package/dist/config/cli/types/cliConfig.js.map +1 -1
- package/dist/index.d.ts +399 -355
- package/dist/services/apiClient.js +4 -0
- package/dist/services/apiClient.js.map +1 -1
- package/dist/util/getCliTelemetry.js +22 -9
- package/dist/util/getCliTelemetry.js.map +1 -1
- package/dist/util/packageManager.js +55 -0
- package/dist/util/packageManager.js.map +1 -0
- package/package.json +22 -19
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,39 @@
|
|
|
1
|
-
import {ClientConfig} from
|
|
2
|
-
import {CLIError} from
|
|
3
|
-
import {Command} from
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { ClientConfig } from "@sanity/client";
|
|
2
|
+
import { CLIError } from "@oclif/core/errors";
|
|
3
|
+
import { Command } from "@oclif/core";
|
|
4
|
+
import { CommandError } from "@oclif/core/interfaces";
|
|
5
|
+
import { ConfigEnv } from "vite";
|
|
6
|
+
import ConfigStore from "configstore";
|
|
7
|
+
import { ConsentStatus } from "@sanity/telemetry";
|
|
8
|
+
import debugIt from "debug";
|
|
9
|
+
import { InlineConfig } from "vite";
|
|
10
|
+
import { Interfaces } from "@oclif/core";
|
|
11
|
+
import { PluginOptions } from "babel-plugin-react-compiler";
|
|
12
|
+
import { SanityClient } from "sanity";
|
|
13
|
+
import { SanityClient as SanityClient_2 } from "@sanity/client";
|
|
14
|
+
import { TelemetryLogger } from "@sanity/telemetry";
|
|
15
|
+
import { URL as URL_2 } from "node:url";
|
|
16
|
+
import { Worker as Worker_2 } from "node:worker_threads";
|
|
17
|
+
import { WorkerOptions as WorkerOptions_2 } from "node:worker_threads";
|
|
18
|
+
import { Workspace } from "sanity";
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
|
|
21
|
+
declare type Args<T extends typeof Command> = Interfaces.InferredArgs<
|
|
22
|
+
T["args"]
|
|
23
|
+
>;
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Clears the global CLI telemetry store.
|
|
24
27
|
* @internal
|
|
25
28
|
*/
|
|
26
|
-
export declare function clearCliTelemetry(): void
|
|
29
|
+
export declare function clearCliTelemetry(): void;
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
32
|
* @public
|
|
30
|
-
* Symbol used to store
|
|
31
|
-
* Use
|
|
33
|
+
* Symbol used to store CLI telemetry state on globalThis.
|
|
34
|
+
* Use the accessor functions instead of accessing this directly.
|
|
32
35
|
*/
|
|
33
|
-
export declare const CLI_TELEMETRY_SYMBOL: unique symbol
|
|
36
|
+
export declare const CLI_TELEMETRY_SYMBOL: unique symbol;
|
|
34
37
|
|
|
35
38
|
/**
|
|
36
39
|
* @public
|
|
@@ -38,24 +41,27 @@ export declare const CLI_TELEMETRY_SYMBOL: unique symbol
|
|
|
38
41
|
export declare interface CliConfig {
|
|
39
42
|
/** The project ID and dataset the Sanity CLI should use to run its commands */
|
|
40
43
|
api?: {
|
|
41
|
-
dataset?: string
|
|
42
|
-
projectId?: string
|
|
43
|
-
}
|
|
44
|
+
dataset?: string;
|
|
45
|
+
projectId?: string;
|
|
46
|
+
};
|
|
44
47
|
/** Configuration for custom Sanity apps built with the App SDK */
|
|
45
48
|
app?: {
|
|
46
49
|
/** The entrypoint for your custom app. By default, `src/App.tsx` */
|
|
47
|
-
entry?: string
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
+
entry?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Path to an icon file relative to project root.
|
|
53
|
+
* The file must be an SVG.
|
|
54
|
+
*/
|
|
55
|
+
icon?: string;
|
|
50
56
|
/** @deprecated Use deployment.appId */
|
|
51
|
-
id?: string
|
|
57
|
+
id?: string;
|
|
52
58
|
/** The ID for the Sanity organization that manages this application */
|
|
53
|
-
organizationId?: string
|
|
54
|
-
/** The title of the custom app
|
|
55
|
-
title?: string
|
|
56
|
-
}
|
|
59
|
+
organizationId?: string;
|
|
60
|
+
/** The title of the custom app, as it is seen in Dashboard UI */
|
|
61
|
+
title?: string;
|
|
62
|
+
};
|
|
57
63
|
/** @deprecated Use deployment.autoUpdates */
|
|
58
|
-
autoUpdates?: boolean
|
|
64
|
+
autoUpdates?: boolean;
|
|
59
65
|
/** Options for custom app and Studio deployments */
|
|
60
66
|
deployment?: {
|
|
61
67
|
/**
|
|
@@ -67,37 +73,37 @@ export declare interface CliConfig {
|
|
|
67
73
|
* @remarks This is required for all custom app deployments, and for Studios opting in to fine grained version control.
|
|
68
74
|
* {@link https://www.sanity.io/docs/studio/latest-version-of-sanity#k0896ed4574b7}
|
|
69
75
|
*/
|
|
70
|
-
appId?: string
|
|
76
|
+
appId?: string;
|
|
71
77
|
/**
|
|
72
78
|
* Enable automatic updates for your Studio or custom app’s Sanity dependencies.
|
|
73
79
|
* {@link https://www.sanity.io/docs/studio/latest-version-of-sanity}
|
|
74
80
|
*/
|
|
75
|
-
autoUpdates?: boolean
|
|
76
|
-
}
|
|
81
|
+
autoUpdates?: boolean;
|
|
82
|
+
};
|
|
77
83
|
/** Define the GraphQL APIs that the CLI can deploy and interact with */
|
|
78
84
|
graphql?: Array<{
|
|
79
|
-
filterSuffix?: string
|
|
80
|
-
generation?:
|
|
81
|
-
id?: string
|
|
82
|
-
nonNullDocumentFields?: boolean
|
|
83
|
-
playground?: boolean
|
|
84
|
-
source?: string
|
|
85
|
-
tag?: string
|
|
86
|
-
workspace?: string
|
|
87
|
-
}
|
|
85
|
+
filterSuffix?: string;
|
|
86
|
+
generation?: "gen1" | "gen2" | "gen3";
|
|
87
|
+
id?: string;
|
|
88
|
+
nonNullDocumentFields?: boolean;
|
|
89
|
+
playground?: boolean;
|
|
90
|
+
source?: string;
|
|
91
|
+
tag?: string;
|
|
92
|
+
workspace?: string;
|
|
93
|
+
}>;
|
|
88
94
|
/** Configuration for the Media Library */
|
|
89
95
|
mediaLibrary?: {
|
|
90
96
|
/** The path to the Media Library aspects directory. When using the CLI to manage aspects, this is the directory they will be read from and written to. */
|
|
91
|
-
aspectsPath?: string
|
|
92
|
-
}
|
|
97
|
+
aspectsPath?: string;
|
|
98
|
+
};
|
|
93
99
|
/** Contains the property `basePath` which lets you change the top-level slug for the Studio. You typically need to set this if you embed the Studio in another application where it is one of many routes. Defaults to an empty string. */
|
|
94
100
|
project?: {
|
|
95
|
-
basePath?: string
|
|
96
|
-
}
|
|
101
|
+
basePath?: string;
|
|
102
|
+
};
|
|
97
103
|
/** Configuration options for React Compiler */
|
|
98
|
-
reactCompiler?: PluginOptions
|
|
104
|
+
reactCompiler?: PluginOptions;
|
|
99
105
|
/** Wraps the Studio in \<React.StrictMode\> root to aid in flagging potential problems related to concurrent features (startTransition, useTransition, useDeferredValue, Suspense). Can also be enabled by setting SANITY_STUDIO_REACT_STRICT_MODE="true"|"false". It only applies to sanity dev in development mode and is ignored in sanity build and in production. Defaults to false. */
|
|
100
|
-
reactStrictMode?: boolean
|
|
106
|
+
reactStrictMode?: boolean;
|
|
101
107
|
/**
|
|
102
108
|
* Configuration for schema extraction (`sanity schema extract`)
|
|
103
109
|
*/
|
|
@@ -105,37 +111,37 @@ export declare interface CliConfig {
|
|
|
105
111
|
/**
|
|
106
112
|
* Enable schema extraction as part of sanity dev and sanity build
|
|
107
113
|
*/
|
|
108
|
-
enabled?: boolean
|
|
114
|
+
enabled?: boolean;
|
|
109
115
|
/**
|
|
110
116
|
* When true, schema fields marked as required will be non-optional in the output.
|
|
111
117
|
* Defaults to `false`
|
|
112
118
|
*/
|
|
113
|
-
enforceRequiredFields?: boolean
|
|
119
|
+
enforceRequiredFields?: boolean;
|
|
114
120
|
/**
|
|
115
121
|
* Output path for the extracted schema file.
|
|
116
122
|
* Defaults to `schema.json` in the working directory.
|
|
117
123
|
*/
|
|
118
|
-
path?: string
|
|
124
|
+
path?: string;
|
|
119
125
|
/**
|
|
120
126
|
* Additional glob patterns to watch for schema changes in watch mode.
|
|
121
127
|
* These extend the default patterns:
|
|
122
128
|
* - `sanity.config.{js,jsx,ts,tsx,mjs}`
|
|
123
129
|
* - `schema*\/**\/*.{js,jsx,ts,tsx,mjs}`
|
|
124
130
|
*/
|
|
125
|
-
watchPatterns?: string[]
|
|
131
|
+
watchPatterns?: string[];
|
|
126
132
|
/**
|
|
127
133
|
* The name of the workspace to generate a schema for. Required if your Sanity project has more than one
|
|
128
134
|
* workspace.
|
|
129
135
|
*/
|
|
130
|
-
workspace?: string
|
|
131
|
-
}
|
|
136
|
+
workspace?: string;
|
|
137
|
+
};
|
|
132
138
|
/** Defines the hostname and port that the development server should run on. hostname defaults to localhost, and port to 3333. */
|
|
133
139
|
server?: {
|
|
134
|
-
hostname?: string
|
|
135
|
-
port?: number
|
|
136
|
-
}
|
|
140
|
+
hostname?: string;
|
|
141
|
+
port?: number;
|
|
142
|
+
};
|
|
137
143
|
/** @deprecated Use deployment.appId */
|
|
138
|
-
studioHost?: string
|
|
144
|
+
studioHost?: string;
|
|
139
145
|
/**
|
|
140
146
|
* Configuration for Sanity typegen
|
|
141
147
|
*/
|
|
@@ -145,81 +151,68 @@ export declare interface CliConfig {
|
|
|
145
151
|
* When enabled, types are generated on startup and when files change.
|
|
146
152
|
* Defaults to `false`
|
|
147
153
|
*/
|
|
148
|
-
enabled?: boolean
|
|
149
|
-
}
|
|
154
|
+
enabled?: boolean;
|
|
155
|
+
};
|
|
150
156
|
/** Exposes the default Vite configuration for custom apps and the Studio so it can be changed and extended. */
|
|
151
|
-
vite?: UserViteConfig
|
|
157
|
+
vite?: UserViteConfig;
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
/**
|
|
155
161
|
* @public
|
|
156
162
|
*/
|
|
157
|
-
export declare type CLITelemetryStore =
|
|
163
|
+
export declare type CLITelemetryStore =
|
|
164
|
+
TelemetryLogger<TelemetryUserProperties>;
|
|
158
165
|
|
|
159
166
|
/**
|
|
160
167
|
* The CLI user configuration schema.
|
|
161
168
|
*
|
|
162
169
|
* @internal
|
|
163
170
|
*/
|
|
164
|
-
declare type CliUserConfig =
|
|
171
|
+
declare type CliUserConfig = z.infer<z.ZodObject<typeof cliUserConfigSchema>>;
|
|
165
172
|
|
|
166
173
|
declare const cliUserConfigSchema: {
|
|
167
|
-
authToken:
|
|
168
|
-
telemetryConsent:
|
|
169
|
-
|
|
174
|
+
authToken: z.ZodOptional<z.ZodString>;
|
|
175
|
+
telemetryConsent: z.ZodOptional<
|
|
176
|
+
z.ZodObject<
|
|
170
177
|
{
|
|
171
|
-
updatedAt:
|
|
172
|
-
value:
|
|
178
|
+
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
179
|
+
value: z.ZodObject<
|
|
173
180
|
{
|
|
174
|
-
status:
|
|
175
|
-
undetermined:
|
|
176
|
-
unset:
|
|
177
|
-
granted:
|
|
178
|
-
denied:
|
|
179
|
-
}
|
|
180
|
-
type:
|
|
181
|
+
status: z.ZodEnum<{
|
|
182
|
+
undetermined: "undetermined";
|
|
183
|
+
unset: "unset";
|
|
184
|
+
granted: "granted";
|
|
185
|
+
denied: "denied";
|
|
186
|
+
}>;
|
|
187
|
+
type: z.ZodString;
|
|
181
188
|
},
|
|
182
|
-
|
|
183
|
-
|
|
189
|
+
z.core.$loose
|
|
190
|
+
>;
|
|
184
191
|
},
|
|
185
|
-
|
|
192
|
+
z.core.$strip
|
|
186
193
|
>
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export declare function colorizeJson(input: unknown): string
|
|
194
|
+
>;
|
|
195
|
+
};
|
|
191
196
|
|
|
192
|
-
|
|
193
|
-
* @internal
|
|
194
|
-
*/
|
|
195
|
-
declare const configDefinition: z.ZodObject<
|
|
196
|
-
{
|
|
197
|
-
formatGeneratedCode: z.ZodDefault<z.ZodBoolean>
|
|
198
|
-
generates: z.ZodDefault<z.ZodString>
|
|
199
|
-
overloadClientMethods: z.ZodDefault<z.ZodBoolean>
|
|
200
|
-
path: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString>]>>
|
|
201
|
-
schema: z.ZodDefault<z.ZodString>
|
|
202
|
-
},
|
|
203
|
-
z.core.$strip
|
|
204
|
-
>
|
|
197
|
+
export declare function colorizeJson(input: unknown): string;
|
|
205
198
|
|
|
206
199
|
export declare type ConsentInformation =
|
|
207
200
|
| {
|
|
208
|
-
reason:
|
|
209
|
-
status: Extract<ConsentStatus,
|
|
201
|
+
reason: "fetchError" | "unauthenticated";
|
|
202
|
+
status: Extract<ConsentStatus, "undetermined">;
|
|
210
203
|
}
|
|
211
204
|
| {
|
|
212
|
-
reason?:
|
|
213
|
-
status: Extract<ConsentStatus,
|
|
205
|
+
reason?: "localOverride";
|
|
206
|
+
status: Extract<ConsentStatus, "denied">;
|
|
214
207
|
}
|
|
215
208
|
| {
|
|
216
|
-
reason?: never
|
|
217
|
-
status: Extract<ConsentStatus,
|
|
209
|
+
reason?: never;
|
|
210
|
+
status: Extract<ConsentStatus, "granted">;
|
|
218
211
|
}
|
|
219
212
|
| {
|
|
220
|
-
reason?: never
|
|
221
|
-
status: Extract<ConsentStatus,
|
|
222
|
-
}
|
|
213
|
+
reason?: never;
|
|
214
|
+
status: Extract<ConsentStatus, "unset">;
|
|
215
|
+
};
|
|
223
216
|
|
|
224
217
|
/**
|
|
225
218
|
* Creates a new worker for a studio worker task.
|
|
@@ -252,15 +245,15 @@ export declare type ConsentInformation =
|
|
|
252
245
|
export declare function createStudioWorker(
|
|
253
246
|
filePath: URL,
|
|
254
247
|
options: StudioWorkerTaskOptions,
|
|
255
|
-
): Worker_2
|
|
248
|
+
): Worker_2;
|
|
256
249
|
|
|
257
250
|
/**
|
|
258
251
|
* `debug` instance for the CLI
|
|
259
252
|
*
|
|
260
253
|
* @internal
|
|
261
254
|
*/
|
|
262
|
-
declare const debug_2: debugIt.Debugger
|
|
263
|
-
export {debug_2 as debug}
|
|
255
|
+
declare const debug_2: debugIt.Debugger;
|
|
256
|
+
export { debug_2 as debug };
|
|
264
257
|
|
|
265
258
|
/**
|
|
266
259
|
* This function is a replacement for built in dynamic import
|
|
@@ -268,7 +261,7 @@ export {debug_2 as debug}
|
|
|
268
261
|
*
|
|
269
262
|
* @param source - File path
|
|
270
263
|
*/
|
|
271
|
-
export declare function doImport(source: string): Promise<any
|
|
264
|
+
export declare function doImport(source: string): Promise<any>;
|
|
272
265
|
|
|
273
266
|
/**
|
|
274
267
|
* Finds the path for a given set of files.
|
|
@@ -277,7 +270,10 @@ export declare function doImport(source: string): Promise<any>
|
|
|
277
270
|
* @param files - The files to search for.
|
|
278
271
|
* @internal
|
|
279
272
|
*/
|
|
280
|
-
export declare function findPathForFiles(
|
|
273
|
+
export declare function findPathForFiles(
|
|
274
|
+
basePath: string,
|
|
275
|
+
files: string[],
|
|
276
|
+
): Promise<PathResult[]>;
|
|
281
277
|
|
|
282
278
|
/**
|
|
283
279
|
* Resolve project root directory and type.
|
|
@@ -291,7 +287,9 @@ export declare function findPathForFiles(basePath: string, files: string[]): Pro
|
|
|
291
287
|
*
|
|
292
288
|
* @internal
|
|
293
289
|
*/
|
|
294
|
-
export declare function findProjectRoot(
|
|
290
|
+
export declare function findProjectRoot(
|
|
291
|
+
cwd: string,
|
|
292
|
+
): Promise<ProjectRootResult>;
|
|
295
293
|
|
|
296
294
|
/**
|
|
297
295
|
* Resolve project root directory and type synchronously.
|
|
@@ -307,7 +305,7 @@ export declare function findProjectRoot(cwd: string): Promise<ProjectRootResult>
|
|
|
307
305
|
* @returns Project root result
|
|
308
306
|
* @internal
|
|
309
307
|
*/
|
|
310
|
-
export declare function findProjectRootSync(cwd: string): ProjectRootResult
|
|
308
|
+
export declare function findProjectRootSync(cwd: string): ProjectRootResult;
|
|
311
309
|
|
|
312
310
|
/**
|
|
313
311
|
* Resolves to a string containing the found config path, otherwise throws an error.
|
|
@@ -318,11 +316,11 @@ export declare function findProjectRootSync(cwd: string): ProjectRootResult
|
|
|
318
316
|
* @throws On multiple config files found, if v2 studio root found, or no config found
|
|
319
317
|
* @internal
|
|
320
318
|
*/
|
|
321
|
-
export declare function findStudioConfigPath(basePath: string): Promise<string
|
|
319
|
+
export declare function findStudioConfigPath(basePath: string): Promise<string>;
|
|
322
320
|
|
|
323
321
|
declare type Flags<T extends typeof Command> = Interfaces.InferredFlags<
|
|
324
|
-
(typeof SanityCommand)[
|
|
325
|
-
|
|
322
|
+
(typeof SanityCommand)["baseFlags"] & T["flags"]
|
|
323
|
+
>;
|
|
326
324
|
|
|
327
325
|
/**
|
|
328
326
|
* Get the CLI config for a project, given the root path.
|
|
@@ -339,7 +337,7 @@ declare type Flags<T extends typeof Command> = Interfaces.InferredFlags<
|
|
|
339
337
|
* @returns The CLI config
|
|
340
338
|
* @internal
|
|
341
339
|
*/
|
|
342
|
-
export declare function getCliConfig(rootPath: string): Promise<CliConfig
|
|
340
|
+
export declare function getCliConfig(rootPath: string): Promise<CliConfig>;
|
|
343
341
|
|
|
344
342
|
/**
|
|
345
343
|
* Get the CLI config for a project synchronously, given the root path.
|
|
@@ -351,12 +349,12 @@ export declare function getCliConfig(rootPath: string): Promise<CliConfig>
|
|
|
351
349
|
* @returns The CLI config
|
|
352
350
|
* @internal
|
|
353
351
|
*/
|
|
354
|
-
export declare function getCliConfigSync(rootPath: string): CliConfig
|
|
352
|
+
export declare function getCliConfigSync(rootPath: string): CliConfig;
|
|
355
353
|
|
|
356
354
|
/**
|
|
357
355
|
* @public
|
|
358
356
|
*/
|
|
359
|
-
export declare function getCliTelemetry(): CLITelemetryStore
|
|
357
|
+
export declare function getCliTelemetry(): CLITelemetryStore;
|
|
360
358
|
|
|
361
359
|
/**
|
|
362
360
|
* Get the CLI authentication token from the environment or the config file
|
|
@@ -364,7 +362,7 @@ export declare function getCliTelemetry(): CLITelemetryStore
|
|
|
364
362
|
* @returns A promise that resolves to a CLI token, or undefined if no token is found
|
|
365
363
|
* @internal
|
|
366
364
|
*/
|
|
367
|
-
export declare function getCliToken(): Promise<string | undefined
|
|
365
|
+
export declare function getCliToken(): Promise<string | undefined>;
|
|
368
366
|
|
|
369
367
|
/**
|
|
370
368
|
* Get the config value for the given property
|
|
@@ -375,7 +373,7 @@ export declare function getCliToken(): Promise<string | undefined>
|
|
|
375
373
|
*/
|
|
376
374
|
export declare function getCliUserConfig<P extends keyof CliUserConfig>(
|
|
377
375
|
prop: P,
|
|
378
|
-
): Promise<CliUserConfig[P]
|
|
376
|
+
): Promise<CliUserConfig[P]>;
|
|
379
377
|
|
|
380
378
|
/**
|
|
381
379
|
* Create a "global" (unscoped) Sanity API client.
|
|
@@ -390,7 +388,7 @@ export declare function getGlobalCliClient({
|
|
|
390
388
|
token: providedToken,
|
|
391
389
|
unauthenticated,
|
|
392
390
|
...config
|
|
393
|
-
}: GlobalCliClientOptions): Promise<
|
|
391
|
+
}: GlobalCliClientOptions): Promise<SanityClient_2>;
|
|
394
392
|
|
|
395
393
|
/**
|
|
396
394
|
* Create a "project" (scoped) Sanity API client.
|
|
@@ -404,7 +402,7 @@ export declare function getProjectCliClient({
|
|
|
404
402
|
requireUser,
|
|
405
403
|
token: providedToken,
|
|
406
404
|
...config
|
|
407
|
-
}: ProjectCliClientOptions): Promise<
|
|
405
|
+
}: ProjectCliClientOptions): Promise<SanityClient_2>;
|
|
408
406
|
|
|
409
407
|
/**
|
|
410
408
|
* Gets an environment variable with the appropriate Sanity prefix based on whether it's an app or studio.
|
|
@@ -424,13 +422,16 @@ export declare function getProjectCliClient({
|
|
|
424
422
|
*
|
|
425
423
|
* @internal
|
|
426
424
|
*/
|
|
427
|
-
export declare function getSanityEnvVar(
|
|
425
|
+
export declare function getSanityEnvVar(
|
|
426
|
+
suffix: string,
|
|
427
|
+
isApp: boolean,
|
|
428
|
+
): string | undefined;
|
|
428
429
|
|
|
429
430
|
/**
|
|
430
431
|
* @internal
|
|
431
432
|
* @returns The Sanity URL for the given path, using the correct domain based on the environment
|
|
432
433
|
*/
|
|
433
|
-
export declare function getSanityUrl(path?: string): string
|
|
434
|
+
export declare function getSanityUrl(path?: string): string;
|
|
434
435
|
|
|
435
436
|
/**
|
|
436
437
|
* Get the studio config for a project, given the root path.
|
|
@@ -442,16 +443,16 @@ export declare function getSanityUrl(path?: string): string
|
|
|
442
443
|
export declare function getStudioConfig(
|
|
443
444
|
rootPath: string,
|
|
444
445
|
options: {
|
|
445
|
-
resolvePlugins: true
|
|
446
|
+
resolvePlugins: true;
|
|
446
447
|
},
|
|
447
|
-
): Promise<ResolvedStudioConfig
|
|
448
|
+
): Promise<ResolvedStudioConfig>;
|
|
448
449
|
|
|
449
450
|
export declare function getStudioConfig(
|
|
450
451
|
rootPath: string,
|
|
451
452
|
options: {
|
|
452
|
-
resolvePlugins: false
|
|
453
|
+
resolvePlugins: false;
|
|
453
454
|
},
|
|
454
|
-
): Promise<RawStudioConfig
|
|
455
|
+
): Promise<RawStudioConfig>;
|
|
455
456
|
|
|
456
457
|
/**
|
|
457
458
|
* Resolves the workspaces from the studio config.
|
|
@@ -462,7 +463,9 @@ export declare function getStudioConfig(
|
|
|
462
463
|
* @returns The workspaces
|
|
463
464
|
* @internal
|
|
464
465
|
*/
|
|
465
|
-
export declare function getStudioWorkspaces(
|
|
466
|
+
export declare function getStudioWorkspaces(
|
|
467
|
+
configPath: string,
|
|
468
|
+
): Promise<Workspace[]>;
|
|
466
469
|
|
|
467
470
|
/**
|
|
468
471
|
* Gets the base telemetry information needed for file operations.
|
|
@@ -475,16 +478,16 @@ export declare function getStudioWorkspaces(configPath: string): Promise<Workspa
|
|
|
475
478
|
* @throws Error if no auth token is found
|
|
476
479
|
* @internal
|
|
477
480
|
*/
|
|
478
|
-
export declare function getTelemetryBaseInfo(): Promise<TelemetryBaseInfo
|
|
481
|
+
export declare function getTelemetryBaseInfo(): Promise<TelemetryBaseInfo>;
|
|
479
482
|
|
|
480
483
|
/**
|
|
481
484
|
* Starts a terminal timer
|
|
482
485
|
*
|
|
483
486
|
* @internal
|
|
484
487
|
*/
|
|
485
|
-
export declare function getTimer(): TimeMeasurer
|
|
488
|
+
export declare function getTimer(): TimeMeasurer;
|
|
486
489
|
|
|
487
|
-
export declare const getUserConfig: () => ConfigStore
|
|
490
|
+
export declare const getUserConfig: () => ConfigStore;
|
|
488
491
|
|
|
489
492
|
/**
|
|
490
493
|
* @public
|
|
@@ -493,19 +496,19 @@ export declare interface GlobalCliClientOptions extends ClientConfig {
|
|
|
493
496
|
/**
|
|
494
497
|
* The API version to use for this client.
|
|
495
498
|
*/
|
|
496
|
-
apiVersion: string
|
|
499
|
+
apiVersion: string;
|
|
497
500
|
/**
|
|
498
501
|
* Whether to require a user to be authenticated to use this client.
|
|
499
502
|
* Default: `false`.
|
|
500
503
|
* Throws an error if `true` and user is not authenticated.
|
|
501
504
|
*/
|
|
502
|
-
requireUser?: boolean
|
|
505
|
+
requireUser?: boolean;
|
|
503
506
|
/**
|
|
504
507
|
* Whether to skip reading the stored CLI token. When `true`, the client will
|
|
505
508
|
* have no token unless one is explicitly provided.
|
|
506
509
|
* Default: `false`.
|
|
507
510
|
*/
|
|
508
|
-
unauthenticated?: boolean
|
|
511
|
+
unauthenticated?: boolean;
|
|
509
512
|
}
|
|
510
513
|
|
|
511
514
|
/**
|
|
@@ -521,24 +524,24 @@ export declare interface GlobalCliClientOptions extends ClientConfig {
|
|
|
521
524
|
export declare function importModule<T = unknown>(
|
|
522
525
|
filePath: string | URL,
|
|
523
526
|
options?: ImportModuleOptions,
|
|
524
|
-
): Promise<T
|
|
527
|
+
): Promise<T>;
|
|
525
528
|
|
|
526
529
|
declare interface ImportModuleOptions {
|
|
527
530
|
/**
|
|
528
531
|
* Whether to return the default export of the module.
|
|
529
532
|
* Default: true
|
|
530
533
|
*/
|
|
531
|
-
default?: boolean
|
|
534
|
+
default?: boolean;
|
|
532
535
|
/**
|
|
533
536
|
* Path to the tsconfig file to use for the import. If not provided, the tsconfig
|
|
534
537
|
* will be inferred from the nearest `tsconfig.json` file.
|
|
535
538
|
*/
|
|
536
|
-
tsconfigPath?: string
|
|
539
|
+
tsconfigPath?: string;
|
|
537
540
|
}
|
|
538
541
|
|
|
539
|
-
export declare const isCi: () => boolean
|
|
542
|
+
export declare const isCi: () => boolean;
|
|
540
543
|
|
|
541
|
-
export declare function isInteractive(): boolean
|
|
544
|
+
export declare function isInteractive(): boolean;
|
|
542
545
|
|
|
543
546
|
/**
|
|
544
547
|
* Returns whether or not the given error is a `NotFoundError`
|
|
@@ -547,7 +550,7 @@ export declare function isInteractive(): boolean
|
|
|
547
550
|
* @returns `true` if the error is a `NotFoundError`, `false` otherwise
|
|
548
551
|
* @internal
|
|
549
552
|
*/
|
|
550
|
-
export declare function isNotFoundError(err: unknown): err is NotFoundError
|
|
553
|
+
export declare function isNotFoundError(err: unknown): err is NotFoundError;
|
|
551
554
|
|
|
552
555
|
/**
|
|
553
556
|
* Returns whether or not the given error is a `ProjectRootNotFoundError`
|
|
@@ -556,7 +559,9 @@ export declare function isNotFoundError(err: unknown): err is NotFoundError
|
|
|
556
559
|
* @returns `true` if the error is a `ProjectRootNotFoundError`, `false` otherwise
|
|
557
560
|
* @internal
|
|
558
561
|
*/
|
|
559
|
-
export declare function isProjectRootNotFoundError(
|
|
562
|
+
export declare function isProjectRootNotFoundError(
|
|
563
|
+
err: unknown,
|
|
564
|
+
): err is ProjectRootNotFoundError;
|
|
560
565
|
|
|
561
566
|
/**
|
|
562
567
|
* Checks if the environment is staging.
|
|
@@ -564,7 +569,7 @@ export declare function isProjectRootNotFoundError(err: unknown): err is Project
|
|
|
564
569
|
* @returns True if the environment is staging, false otherwise
|
|
565
570
|
* @internal
|
|
566
571
|
*/
|
|
567
|
-
export declare function isStaging(): boolean
|
|
572
|
+
export declare function isStaging(): boolean;
|
|
568
573
|
|
|
569
574
|
/**
|
|
570
575
|
* Checks if the given value conforms to a minimum studio config shape.
|
|
@@ -573,7 +578,7 @@ export declare function isStaging(): boolean
|
|
|
573
578
|
* @returns Whether the value is a studio config
|
|
574
579
|
* @internal
|
|
575
580
|
*/
|
|
576
|
-
export declare function isStudioConfig(value: unknown): boolean
|
|
581
|
+
export declare function isStudioConfig(value: unknown): boolean;
|
|
577
582
|
|
|
578
583
|
/**
|
|
579
584
|
* Mocks a browser-like environment for processes in the main thread by:
|
|
@@ -591,7 +596,9 @@ export declare function isStudioConfig(value: unknown): boolean
|
|
|
591
596
|
* @returns A cleanup function that removes the injected globals and environment variables
|
|
592
597
|
* @internal
|
|
593
598
|
*/
|
|
594
|
-
export declare function mockBrowserEnvironment(
|
|
599
|
+
export declare function mockBrowserEnvironment(
|
|
600
|
+
basePath: string,
|
|
601
|
+
): Promise<() => void>;
|
|
595
602
|
|
|
596
603
|
/**
|
|
597
604
|
* Error thrown when a prompt is attempted in a non-interactive environment
|
|
@@ -601,7 +608,7 @@ export declare function mockBrowserEnvironment(basePath: string): Promise<() =>
|
|
|
601
608
|
* Extends `CLIError` to suppress stack traces in user-facing output.
|
|
602
609
|
*/
|
|
603
610
|
export declare class NonInteractiveError extends CLIError {
|
|
604
|
-
constructor(promptName: string)
|
|
611
|
+
constructor(promptName: string);
|
|
605
612
|
}
|
|
606
613
|
|
|
607
614
|
/**
|
|
@@ -612,7 +619,7 @@ export declare class NonInteractiveError extends CLIError {
|
|
|
612
619
|
* @returns Normalized path with forward slashes
|
|
613
620
|
* @public
|
|
614
621
|
*/
|
|
615
|
-
export declare function normalizePath(path: string): string
|
|
622
|
+
export declare function normalizePath(path: string): string;
|
|
616
623
|
|
|
617
624
|
/**
|
|
618
625
|
* Error thrown when a file or directory is not found
|
|
@@ -622,15 +629,15 @@ export declare function normalizePath(path: string): string
|
|
|
622
629
|
* @internal
|
|
623
630
|
*/
|
|
624
631
|
export declare class NotFoundError extends Error {
|
|
625
|
-
code: string
|
|
626
|
-
path?: string
|
|
627
|
-
constructor(message: string, path?: string)
|
|
632
|
+
code: string;
|
|
633
|
+
path?: string;
|
|
634
|
+
constructor(message: string, path?: string);
|
|
628
635
|
}
|
|
629
636
|
|
|
630
637
|
export declare interface Output {
|
|
631
|
-
error: Command[
|
|
632
|
-
log: Command[
|
|
633
|
-
warn: Command[
|
|
638
|
+
error: Command["error"];
|
|
639
|
+
log: Command["log"];
|
|
640
|
+
warn: Command["warn"];
|
|
634
641
|
}
|
|
635
642
|
|
|
636
643
|
/**
|
|
@@ -639,7 +646,7 @@ export declare interface Output {
|
|
|
639
646
|
*
|
|
640
647
|
* @public
|
|
641
648
|
*/
|
|
642
|
-
export declare type PackageJson =
|
|
649
|
+
export declare type PackageJson = z.infer<typeof packageJsonSchema>;
|
|
643
650
|
|
|
644
651
|
/**
|
|
645
652
|
* Comprehensive package.json schema including all common properties.
|
|
@@ -648,47 +655,47 @@ export declare type PackageJson = z_2.infer<typeof packageJsonSchema>
|
|
|
648
655
|
* 🟠ℹ️ SINCE THIS IS USED IN A NUMBER OF LOCATIONS WHERE ℹ️🟠
|
|
649
656
|
* 🟠ℹ️ WE CANNOT ENFORCE/GUARANTEE ANY PARTICULAR PROPS ℹ️🟠
|
|
650
657
|
*/
|
|
651
|
-
declare const packageJsonSchema:
|
|
658
|
+
declare const packageJsonSchema: z.ZodObject<
|
|
652
659
|
{
|
|
653
|
-
name:
|
|
654
|
-
version:
|
|
655
|
-
dependencies:
|
|
656
|
-
devDependencies:
|
|
657
|
-
peerDependencies:
|
|
658
|
-
exports:
|
|
659
|
-
main:
|
|
660
|
-
types:
|
|
661
|
-
author:
|
|
662
|
-
description:
|
|
663
|
-
engines:
|
|
664
|
-
license:
|
|
665
|
-
private:
|
|
666
|
-
repository:
|
|
667
|
-
|
|
660
|
+
name: z.ZodString;
|
|
661
|
+
version: z.ZodString;
|
|
662
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
663
|
+
devDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
664
|
+
peerDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
665
|
+
exports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
666
|
+
main: z.ZodOptional<z.ZodString>;
|
|
667
|
+
types: z.ZodOptional<z.ZodString>;
|
|
668
|
+
author: z.ZodOptional<z.ZodString>;
|
|
669
|
+
description: z.ZodOptional<z.ZodString>;
|
|
670
|
+
engines: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
671
|
+
license: z.ZodOptional<z.ZodString>;
|
|
672
|
+
private: z.ZodOptional<z.ZodBoolean>;
|
|
673
|
+
repository: z.ZodOptional<
|
|
674
|
+
z.ZodObject<
|
|
668
675
|
{
|
|
669
|
-
type:
|
|
670
|
-
url:
|
|
676
|
+
type: z.ZodString;
|
|
677
|
+
url: z.ZodString;
|
|
671
678
|
},
|
|
672
|
-
|
|
679
|
+
z.core.$strip
|
|
673
680
|
>
|
|
674
|
-
|
|
675
|
-
scripts:
|
|
676
|
-
type:
|
|
677
|
-
|
|
678
|
-
module:
|
|
679
|
-
commonjs:
|
|
681
|
+
>;
|
|
682
|
+
scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
683
|
+
type: z.ZodOptional<
|
|
684
|
+
z.ZodEnum<{
|
|
685
|
+
module: "module";
|
|
686
|
+
commonjs: "commonjs";
|
|
680
687
|
}>
|
|
681
|
-
|
|
688
|
+
>;
|
|
682
689
|
},
|
|
683
|
-
|
|
684
|
-
|
|
690
|
+
z.core.$loose
|
|
691
|
+
>;
|
|
685
692
|
|
|
686
693
|
/**
|
|
687
694
|
* @internal
|
|
688
695
|
*/
|
|
689
696
|
declare interface PathResult {
|
|
690
|
-
exists: boolean
|
|
691
|
-
path: string
|
|
697
|
+
exists: boolean;
|
|
698
|
+
path: string;
|
|
692
699
|
}
|
|
693
700
|
|
|
694
701
|
/**
|
|
@@ -698,21 +705,21 @@ export declare interface ProjectCliClientOptions extends ClientConfig {
|
|
|
698
705
|
/**
|
|
699
706
|
* The API version to use for this client.
|
|
700
707
|
*/
|
|
701
|
-
apiVersion: string
|
|
708
|
+
apiVersion: string;
|
|
702
709
|
/**
|
|
703
710
|
* The project ID to use for this client.
|
|
704
711
|
*/
|
|
705
|
-
projectId: string
|
|
712
|
+
projectId: string;
|
|
706
713
|
/**
|
|
707
714
|
* The dataset to use for this client.
|
|
708
715
|
*/
|
|
709
|
-
dataset?: string
|
|
716
|
+
dataset?: string;
|
|
710
717
|
/**
|
|
711
718
|
* Whether to require a user to be authenticated to use this client.
|
|
712
719
|
* Default: `false`.
|
|
713
720
|
* Throws an error if `true` and user is not authenticated.
|
|
714
721
|
*/
|
|
715
|
-
requireUser?: boolean
|
|
722
|
+
requireUser?: boolean;
|
|
716
723
|
}
|
|
717
724
|
|
|
718
725
|
/**
|
|
@@ -729,10 +736,10 @@ export declare class ProjectRootNotFoundError extends CLIError {
|
|
|
729
736
|
constructor(
|
|
730
737
|
message: string,
|
|
731
738
|
options?: {
|
|
732
|
-
cause?: Error
|
|
733
|
-
suggestions?: string[]
|
|
739
|
+
cause?: Error;
|
|
740
|
+
suggestions?: string[];
|
|
734
741
|
},
|
|
735
|
-
)
|
|
742
|
+
);
|
|
736
743
|
}
|
|
737
744
|
|
|
738
745
|
/**
|
|
@@ -741,15 +748,15 @@ export declare class ProjectRootNotFoundError extends CLIError {
|
|
|
741
748
|
* @public
|
|
742
749
|
*/
|
|
743
750
|
export declare interface ProjectRootResult {
|
|
744
|
-
directory: string
|
|
751
|
+
directory: string;
|
|
745
752
|
/**
|
|
746
753
|
* Path to the project configuration file, if found.
|
|
747
754
|
*/
|
|
748
|
-
path: string
|
|
755
|
+
path: string;
|
|
749
756
|
/**
|
|
750
757
|
* Type of project root.
|
|
751
758
|
*/
|
|
752
|
-
type:
|
|
759
|
+
type: "app" | "studio";
|
|
753
760
|
}
|
|
754
761
|
|
|
755
762
|
/**
|
|
@@ -767,106 +774,106 @@ export declare interface ProjectRootResult {
|
|
|
767
774
|
export declare function promisifyWorker<T = unknown>(
|
|
768
775
|
filePath: URL,
|
|
769
776
|
options?: PromisifyWorkerOptions,
|
|
770
|
-
): Promise<T
|
|
777
|
+
): Promise<T>;
|
|
771
778
|
|
|
772
779
|
declare interface PromisifyWorkerOptions extends WorkerOptions_2 {
|
|
773
780
|
/** Optional timeout in milliseconds. If the worker does not respond within this time, it will be terminated and the promise rejected. */
|
|
774
|
-
timeout?: number
|
|
781
|
+
timeout?: number;
|
|
775
782
|
}
|
|
776
783
|
|
|
777
|
-
declare const rawConfigSchema:
|
|
784
|
+
declare const rawConfigSchema: z.ZodUnion<
|
|
778
785
|
readonly [
|
|
779
|
-
|
|
780
|
-
|
|
786
|
+
z.ZodArray<
|
|
787
|
+
z.ZodObject<
|
|
781
788
|
{
|
|
782
|
-
basePath:
|
|
783
|
-
name:
|
|
784
|
-
plugins:
|
|
785
|
-
title:
|
|
786
|
-
unstable_sources:
|
|
787
|
-
|
|
789
|
+
basePath: z.ZodString;
|
|
790
|
+
name: z.ZodString;
|
|
791
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
792
|
+
title: z.ZodString;
|
|
793
|
+
unstable_sources: z.ZodArray<
|
|
794
|
+
z.ZodObject<
|
|
788
795
|
{
|
|
789
|
-
dataset:
|
|
790
|
-
projectId:
|
|
791
|
-
schema:
|
|
796
|
+
dataset: z.ZodString;
|
|
797
|
+
projectId: z.ZodString;
|
|
798
|
+
schema: z.ZodObject<
|
|
792
799
|
{
|
|
793
|
-
_original:
|
|
800
|
+
_original: z.ZodObject<
|
|
794
801
|
{
|
|
795
|
-
name:
|
|
796
|
-
types:
|
|
802
|
+
name: z.ZodOptional<z.ZodString>;
|
|
803
|
+
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
797
804
|
},
|
|
798
|
-
|
|
799
|
-
|
|
805
|
+
z.core.$strip
|
|
806
|
+
>;
|
|
800
807
|
},
|
|
801
|
-
|
|
802
|
-
|
|
808
|
+
z.core.$strip
|
|
809
|
+
>;
|
|
803
810
|
},
|
|
804
|
-
|
|
811
|
+
z.core.$strip
|
|
805
812
|
>
|
|
806
|
-
|
|
807
|
-
dataset:
|
|
808
|
-
projectId:
|
|
809
|
-
schema:
|
|
813
|
+
>;
|
|
814
|
+
dataset: z.ZodString;
|
|
815
|
+
projectId: z.ZodString;
|
|
816
|
+
schema: z.ZodObject<
|
|
810
817
|
{
|
|
811
|
-
_original:
|
|
818
|
+
_original: z.ZodObject<
|
|
812
819
|
{
|
|
813
|
-
name:
|
|
814
|
-
types:
|
|
820
|
+
name: z.ZodOptional<z.ZodString>;
|
|
821
|
+
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
815
822
|
},
|
|
816
|
-
|
|
817
|
-
|
|
823
|
+
z.core.$strip
|
|
824
|
+
>;
|
|
818
825
|
},
|
|
819
|
-
|
|
820
|
-
|
|
826
|
+
z.core.$strip
|
|
827
|
+
>;
|
|
821
828
|
},
|
|
822
|
-
|
|
829
|
+
z.core.$strip
|
|
823
830
|
>
|
|
824
831
|
>,
|
|
825
|
-
|
|
832
|
+
z.ZodObject<
|
|
826
833
|
{
|
|
827
|
-
basePath:
|
|
828
|
-
name:
|
|
829
|
-
plugins:
|
|
830
|
-
schema:
|
|
831
|
-
|
|
834
|
+
basePath: z.ZodOptional<z.ZodString>;
|
|
835
|
+
name: z.ZodOptional<z.ZodString>;
|
|
836
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
837
|
+
schema: z.ZodOptional<
|
|
838
|
+
z.ZodObject<
|
|
832
839
|
{
|
|
833
|
-
name:
|
|
834
|
-
types:
|
|
840
|
+
name: z.ZodOptional<z.ZodString>;
|
|
841
|
+
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
835
842
|
},
|
|
836
|
-
|
|
843
|
+
z.core.$strip
|
|
837
844
|
>
|
|
838
|
-
|
|
839
|
-
title:
|
|
840
|
-
unstable_sources:
|
|
841
|
-
|
|
845
|
+
>;
|
|
846
|
+
title: z.ZodOptional<z.ZodString>;
|
|
847
|
+
unstable_sources: z.ZodArray<
|
|
848
|
+
z.ZodObject<
|
|
842
849
|
{
|
|
843
|
-
dataset:
|
|
844
|
-
projectId:
|
|
845
|
-
schema:
|
|
850
|
+
dataset: z.ZodString;
|
|
851
|
+
projectId: z.ZodString;
|
|
852
|
+
schema: z.ZodObject<
|
|
846
853
|
{
|
|
847
|
-
_original:
|
|
854
|
+
_original: z.ZodObject<
|
|
848
855
|
{
|
|
849
|
-
name:
|
|
850
|
-
types:
|
|
856
|
+
name: z.ZodOptional<z.ZodString>;
|
|
857
|
+
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
851
858
|
},
|
|
852
|
-
|
|
853
|
-
|
|
859
|
+
z.core.$strip
|
|
860
|
+
>;
|
|
854
861
|
},
|
|
855
|
-
|
|
856
|
-
|
|
862
|
+
z.core.$strip
|
|
863
|
+
>;
|
|
857
864
|
},
|
|
858
|
-
|
|
865
|
+
z.core.$strip
|
|
859
866
|
>
|
|
860
|
-
|
|
861
|
-
dataset:
|
|
862
|
-
projectId:
|
|
867
|
+
>;
|
|
868
|
+
dataset: z.ZodString;
|
|
869
|
+
projectId: z.ZodString;
|
|
863
870
|
},
|
|
864
|
-
|
|
871
|
+
z.core.$loose
|
|
865
872
|
>,
|
|
866
873
|
]
|
|
867
|
-
|
|
874
|
+
>;
|
|
868
875
|
|
|
869
|
-
declare type RawStudioConfig =
|
|
876
|
+
declare type RawStudioConfig = z.infer<typeof rawConfigSchema>;
|
|
870
877
|
|
|
871
878
|
/**
|
|
872
879
|
* Read the `package.json` file at the given path
|
|
@@ -879,7 +886,7 @@ declare type RawStudioConfig = z_2.infer<typeof rawConfigSchema>
|
|
|
879
886
|
export declare function readPackageJson(
|
|
880
887
|
filePath: string | URL,
|
|
881
888
|
options?: ReadPackageJsonOptions,
|
|
882
|
-
): Promise<PackageJson
|
|
889
|
+
): Promise<PackageJson>;
|
|
883
890
|
|
|
884
891
|
/**
|
|
885
892
|
* Options for reading package.json files
|
|
@@ -891,64 +898,65 @@ export declare interface ReadPackageJsonOptions {
|
|
|
891
898
|
* Default values to merge with the parsed package.json.
|
|
892
899
|
* Parsed values take precedence over defaults.
|
|
893
900
|
*/
|
|
894
|
-
defaults?: Partial<PackageJson
|
|
901
|
+
defaults?: Partial<PackageJson>;
|
|
895
902
|
/**
|
|
896
903
|
* Skip Zod schema validation. When true, the file is parsed but not validated.
|
|
897
904
|
* Defaults to false.
|
|
898
905
|
*/
|
|
899
|
-
skipSchemaValidation?: boolean
|
|
906
|
+
skipSchemaValidation?: boolean;
|
|
900
907
|
}
|
|
901
908
|
|
|
902
|
-
declare type RequireProps<T, K extends keyof T> = Omit<T, K> &
|
|
909
|
+
declare type RequireProps<T, K extends keyof T> = Omit<T, K> &
|
|
910
|
+
Required<Pick<T, K>>;
|
|
903
911
|
|
|
904
|
-
declare const resolvedConfigSchema:
|
|
905
|
-
|
|
912
|
+
declare const resolvedConfigSchema: z.ZodArray<
|
|
913
|
+
z.ZodObject<
|
|
906
914
|
{
|
|
907
|
-
basePath:
|
|
908
|
-
name:
|
|
909
|
-
plugins:
|
|
910
|
-
title:
|
|
911
|
-
unstable_sources:
|
|
912
|
-
|
|
915
|
+
basePath: z.ZodString;
|
|
916
|
+
name: z.ZodString;
|
|
917
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
918
|
+
title: z.ZodString;
|
|
919
|
+
unstable_sources: z.ZodArray<
|
|
920
|
+
z.ZodObject<
|
|
913
921
|
{
|
|
914
|
-
dataset:
|
|
915
|
-
projectId:
|
|
916
|
-
schema:
|
|
922
|
+
dataset: z.ZodString;
|
|
923
|
+
projectId: z.ZodString;
|
|
924
|
+
schema: z.ZodObject<
|
|
917
925
|
{
|
|
918
|
-
_original:
|
|
926
|
+
_original: z.ZodObject<
|
|
919
927
|
{
|
|
920
|
-
name:
|
|
921
|
-
types:
|
|
928
|
+
name: z.ZodOptional<z.ZodString>;
|
|
929
|
+
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
922
930
|
},
|
|
923
|
-
|
|
924
|
-
|
|
931
|
+
z.core.$strip
|
|
932
|
+
>;
|
|
925
933
|
},
|
|
926
|
-
|
|
927
|
-
|
|
934
|
+
z.core.$strip
|
|
935
|
+
>;
|
|
928
936
|
},
|
|
929
|
-
|
|
937
|
+
z.core.$strip
|
|
930
938
|
>
|
|
931
|
-
|
|
932
|
-
dataset:
|
|
933
|
-
projectId:
|
|
934
|
-
schema:
|
|
939
|
+
>;
|
|
940
|
+
dataset: z.ZodString;
|
|
941
|
+
projectId: z.ZodString;
|
|
942
|
+
schema: z.ZodObject<
|
|
935
943
|
{
|
|
936
|
-
_original:
|
|
944
|
+
_original: z.ZodObject<
|
|
937
945
|
{
|
|
938
|
-
name:
|
|
939
|
-
types:
|
|
946
|
+
name: z.ZodOptional<z.ZodString>;
|
|
947
|
+
types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
940
948
|
},
|
|
941
|
-
|
|
942
|
-
|
|
949
|
+
z.core.$strip
|
|
950
|
+
>;
|
|
943
951
|
},
|
|
944
|
-
|
|
945
|
-
|
|
952
|
+
z.core.$strip
|
|
953
|
+
>;
|
|
946
954
|
},
|
|
947
|
-
|
|
955
|
+
z.core.$strip
|
|
948
956
|
>
|
|
949
|
-
|
|
957
|
+
>;
|
|
950
958
|
|
|
951
|
-
declare type ResolvedStudioConfig =
|
|
959
|
+
declare type ResolvedStudioConfig = z.infer<typeof resolvedConfigSchema>;
|
|
952
960
|
|
|
953
961
|
/**
|
|
954
962
|
* Resolves and imports a package from the local project's node_modules,
|
|
@@ -970,7 +978,7 @@ declare type ResolvedStudioConfig = z_2.infer<typeof resolvedConfigSchema>
|
|
|
970
978
|
export declare function resolveLocalPackage<T = unknown>(
|
|
971
979
|
packageName: string,
|
|
972
980
|
workDir: string,
|
|
973
|
-
): Promise<T
|
|
981
|
+
): Promise<T>;
|
|
974
982
|
|
|
975
983
|
/**
|
|
976
984
|
* `structuredClone()`, but doesn't throw on non-clonable values - instead it drops them.
|
|
@@ -979,11 +987,13 @@ export declare function resolveLocalPackage<T = unknown>(
|
|
|
979
987
|
* @returns The cloned object.
|
|
980
988
|
* @internal
|
|
981
989
|
*/
|
|
982
|
-
export declare function safeStructuredClone<T>(obj: T): T
|
|
990
|
+
export declare function safeStructuredClone<T>(obj: T): T;
|
|
983
991
|
|
|
984
|
-
export declare abstract class SanityCommand<
|
|
985
|
-
|
|
986
|
-
|
|
992
|
+
export declare abstract class SanityCommand<
|
|
993
|
+
T extends typeof Command,
|
|
994
|
+
> extends Command {
|
|
995
|
+
protected args: Args<T>;
|
|
996
|
+
protected flags: Flags<T>;
|
|
987
997
|
/**
|
|
988
998
|
* Get the global API client.
|
|
989
999
|
*
|
|
@@ -992,7 +1002,9 @@ export declare abstract class SanityCommand<T extends typeof Command> extends Co
|
|
|
992
1002
|
*
|
|
993
1003
|
* @deprecated use `getGlobalCliClient` function directly instead.
|
|
994
1004
|
*/
|
|
995
|
-
protected getGlobalApiClient: (
|
|
1005
|
+
protected getGlobalApiClient: (
|
|
1006
|
+
args: GlobalCliClientOptions,
|
|
1007
|
+
) => Promise<SanityClient>;
|
|
996
1008
|
/**
|
|
997
1009
|
* Get the project API client.
|
|
998
1010
|
*
|
|
@@ -1001,7 +1013,9 @@ export declare abstract class SanityCommand<T extends typeof Command> extends Co
|
|
|
1001
1013
|
*
|
|
1002
1014
|
* @deprecated use `getProjectCliClient` function directly instead.
|
|
1003
1015
|
*/
|
|
1004
|
-
protected getProjectApiClient: (
|
|
1016
|
+
protected getProjectApiClient: (
|
|
1017
|
+
args: ProjectCliClientOptions,
|
|
1018
|
+
) => Promise<SanityClient>;
|
|
1005
1019
|
/**
|
|
1006
1020
|
* Helper for outputting to the console.
|
|
1007
1021
|
*
|
|
@@ -1012,19 +1026,25 @@ export declare abstract class SanityCommand<T extends typeof Command> extends Co
|
|
|
1012
1026
|
* this.output.error('Error')
|
|
1013
1027
|
* ```
|
|
1014
1028
|
*/
|
|
1015
|
-
protected output: Output
|
|
1029
|
+
protected output: Output;
|
|
1016
1030
|
/**
|
|
1017
1031
|
* The telemetry store.
|
|
1018
1032
|
*
|
|
1019
1033
|
* @returns The telemetry store.
|
|
1020
1034
|
*/
|
|
1021
|
-
protected telemetry: CLITelemetryStore
|
|
1035
|
+
protected telemetry: CLITelemetryStore;
|
|
1036
|
+
/**
|
|
1037
|
+
* Report real command errors to the CLI command trace.
|
|
1038
|
+
* User aborts (SIGINT, ExitPromptError) are not reported — the trace is left
|
|
1039
|
+
* incomplete, which accurately represents that the command was interrupted.
|
|
1040
|
+
*/
|
|
1041
|
+
protected catch(err: CommandError): Promise<void>;
|
|
1022
1042
|
/**
|
|
1023
1043
|
* Get the CLI config.
|
|
1024
1044
|
*
|
|
1025
1045
|
* @returns The CLI config.
|
|
1026
1046
|
*/
|
|
1027
|
-
protected getCliConfig(): Promise<CliConfig
|
|
1047
|
+
protected getCliConfig(): Promise<CliConfig>;
|
|
1028
1048
|
/**
|
|
1029
1049
|
* Get the project ID from passed flags or (if not provided) the CLI config.
|
|
1030
1050
|
*
|
|
@@ -1042,16 +1062,16 @@ export declare abstract class SanityCommand<T extends typeof Command> extends Co
|
|
|
1042
1062
|
* @returns The project ID.
|
|
1043
1063
|
*/
|
|
1044
1064
|
protected getProjectId(options?: {
|
|
1045
|
-
deprecatedFlagName?: string
|
|
1046
|
-
fallback?: () => Promise<string
|
|
1047
|
-
}): Promise<string
|
|
1065
|
+
deprecatedFlagName?: string;
|
|
1066
|
+
fallback?: () => Promise<string>;
|
|
1067
|
+
}): Promise<string>;
|
|
1048
1068
|
/**
|
|
1049
1069
|
* Get the project's root directory by resolving the config
|
|
1050
1070
|
*
|
|
1051
1071
|
* @returns The project root result.
|
|
1052
1072
|
*/
|
|
1053
|
-
protected getProjectRoot(): Promise<ProjectRootResult
|
|
1054
|
-
init(): Promise<void
|
|
1073
|
+
protected getProjectRoot(): Promise<ProjectRootResult>;
|
|
1074
|
+
init(): Promise<void>;
|
|
1055
1075
|
/**
|
|
1056
1076
|
* Check if the command is running in unattended mode.
|
|
1057
1077
|
*
|
|
@@ -1063,13 +1083,13 @@ export declare abstract class SanityCommand<T extends typeof Command> extends Co
|
|
|
1063
1083
|
* some commands may also be run in unattended mode if `process.stdin` is not a TTY
|
|
1064
1084
|
* (eg when running in a CI environment).
|
|
1065
1085
|
*/
|
|
1066
|
-
protected isUnattended(): boolean
|
|
1086
|
+
protected isUnattended(): boolean;
|
|
1067
1087
|
/**
|
|
1068
1088
|
* Resolver for checking if the terminal is interactive. Override in tests to provide mock values.
|
|
1069
1089
|
*
|
|
1070
1090
|
* @returns Whether the terminal is interactive.
|
|
1071
1091
|
*/
|
|
1072
|
-
protected resolveIsInteractive(): boolean
|
|
1092
|
+
protected resolveIsInteractive(): boolean;
|
|
1073
1093
|
/**
|
|
1074
1094
|
* Get the CLI config, returning an empty config if no project root is found.
|
|
1075
1095
|
*
|
|
@@ -1078,23 +1098,28 @@ export declare abstract class SanityCommand<T extends typeof Command> extends Co
|
|
|
1078
1098
|
*
|
|
1079
1099
|
* @returns The CLI config, or an empty config object if no project root is found.
|
|
1080
1100
|
*/
|
|
1081
|
-
protected tryGetCliConfig(): Promise<CliConfig
|
|
1101
|
+
protected tryGetCliConfig(): Promise<CliConfig>;
|
|
1082
1102
|
}
|
|
1083
1103
|
|
|
1084
1104
|
export declare type SanityOrgUser = {
|
|
1085
|
-
email: string
|
|
1086
|
-
id: string
|
|
1087
|
-
name: string
|
|
1088
|
-
profileImage?: string
|
|
1089
|
-
provider:
|
|
1090
|
-
tosAcceptedAt?: string
|
|
1091
|
-
}
|
|
1105
|
+
email: string;
|
|
1106
|
+
id: string;
|
|
1107
|
+
name: string;
|
|
1108
|
+
profileImage?: string;
|
|
1109
|
+
provider: "github" | "google" | "sanity" | `saml-${string}`;
|
|
1110
|
+
tosAcceptedAt?: string;
|
|
1111
|
+
};
|
|
1092
1112
|
|
|
1093
1113
|
/**
|
|
1094
|
-
* Sets the global CLI telemetry
|
|
1114
|
+
* Sets the global CLI telemetry state.
|
|
1095
1115
|
* @internal
|
|
1096
1116
|
*/
|
|
1097
|
-
export declare function setCliTelemetry(
|
|
1117
|
+
export declare function setCliTelemetry(
|
|
1118
|
+
telemetry: CLITelemetryStore,
|
|
1119
|
+
options?: {
|
|
1120
|
+
reportTraceError?: TraceErrorReporter;
|
|
1121
|
+
},
|
|
1122
|
+
): void;
|
|
1098
1123
|
|
|
1099
1124
|
/**
|
|
1100
1125
|
* Set the config value for the given property.
|
|
@@ -1107,7 +1132,7 @@ export declare function setCliTelemetry(telemetry: CLITelemetryStore): void
|
|
|
1107
1132
|
export declare function setCliUserConfig<P extends keyof CliUserConfig>(
|
|
1108
1133
|
prop: P,
|
|
1109
1134
|
value: CliUserConfig[P],
|
|
1110
|
-
): Promise<void
|
|
1135
|
+
): Promise<void>;
|
|
1111
1136
|
|
|
1112
1137
|
/**
|
|
1113
1138
|
* Executes a worker file in a Sanity Studio browser context.
|
|
@@ -1140,17 +1165,20 @@ export declare function setCliUserConfig<P extends keyof CliUserConfig>(
|
|
|
1140
1165
|
export declare function studioWorkerTask<T = unknown>(
|
|
1141
1166
|
filePath: URL,
|
|
1142
1167
|
options: StudioWorkerTaskOptions,
|
|
1143
|
-
): Promise<T
|
|
1168
|
+
): Promise<T>;
|
|
1144
1169
|
|
|
1145
1170
|
/**
|
|
1146
1171
|
* Options for the studio worker task
|
|
1147
1172
|
*
|
|
1148
1173
|
* @internal
|
|
1149
1174
|
*/
|
|
1150
|
-
declare interface StudioWorkerTaskOptions extends RequireProps<
|
|
1151
|
-
|
|
1175
|
+
declare interface StudioWorkerTaskOptions extends RequireProps<
|
|
1176
|
+
WorkerOptions_2,
|
|
1177
|
+
"name"
|
|
1178
|
+
> {
|
|
1179
|
+
studioRootPath: string;
|
|
1152
1180
|
/** Optional timeout in milliseconds. If the worker does not respond within this time, it will be terminated and the promise rejected. */
|
|
1153
|
-
timeout?: number
|
|
1181
|
+
timeout?: number;
|
|
1154
1182
|
}
|
|
1155
1183
|
|
|
1156
1184
|
/**
|
|
@@ -1160,7 +1188,7 @@ declare interface StudioWorkerTaskOptions extends RequireProps<WorkerOptions_2,
|
|
|
1160
1188
|
* @param namespace - The namespace to extend the CLI debug instance with
|
|
1161
1189
|
* @returns The extended `debug` instance
|
|
1162
1190
|
*/
|
|
1163
|
-
export declare const subdebug: (namespace: string) => debugIt.Debugger
|
|
1191
|
+
export declare const subdebug: (namespace: string) => debugIt.Debugger;
|
|
1164
1192
|
|
|
1165
1193
|
/**
|
|
1166
1194
|
* Base information needed for telemetry file operations.
|
|
@@ -1168,34 +1196,36 @@ export declare const subdebug: (namespace: string) => debugIt.Debugger
|
|
|
1168
1196
|
*/
|
|
1169
1197
|
declare interface TelemetryBaseInfo {
|
|
1170
1198
|
/** Base filename pattern without sessionId suffix */
|
|
1171
|
-
basePattern: string
|
|
1199
|
+
basePattern: string;
|
|
1172
1200
|
/** Base directory where telemetry files are stored */
|
|
1173
|
-
directory: string
|
|
1201
|
+
directory: string;
|
|
1174
1202
|
/** Environment: 'staging' or 'production' */
|
|
1175
|
-
environment: string
|
|
1203
|
+
environment: string;
|
|
1176
1204
|
/** Hashed token (first 8 chars of SHA256) for privacy */
|
|
1177
|
-
hashedToken: string
|
|
1205
|
+
hashedToken: string;
|
|
1178
1206
|
}
|
|
1179
1207
|
|
|
1180
1208
|
/**
|
|
1181
1209
|
* @public
|
|
1182
1210
|
*/
|
|
1183
1211
|
export declare interface TelemetryUserProperties {
|
|
1184
|
-
cliVersion: string
|
|
1185
|
-
cpuArchitecture: string
|
|
1186
|
-
machinePlatform: string
|
|
1187
|
-
runtime: string
|
|
1188
|
-
runtimeVersion: string
|
|
1189
|
-
dataset?: string
|
|
1190
|
-
projectId?: string
|
|
1212
|
+
cliVersion: string;
|
|
1213
|
+
cpuArchitecture: string;
|
|
1214
|
+
machinePlatform: string;
|
|
1215
|
+
runtime: string;
|
|
1216
|
+
runtimeVersion: string;
|
|
1217
|
+
dataset?: string;
|
|
1218
|
+
projectId?: string;
|
|
1191
1219
|
}
|
|
1192
1220
|
|
|
1193
1221
|
declare interface TimeMeasurer {
|
|
1194
|
-
end: (name: string) => number
|
|
1195
|
-
getTimings: () => Record<string, number
|
|
1196
|
-
start: (name: string) => void
|
|
1222
|
+
end: (name: string) => number;
|
|
1223
|
+
getTimings: () => Record<string, number>;
|
|
1224
|
+
start: (name: string) => void;
|
|
1197
1225
|
}
|
|
1198
1226
|
|
|
1227
|
+
declare type TraceErrorReporter = (error: Error) => void;
|
|
1228
|
+
|
|
1199
1229
|
/**
|
|
1200
1230
|
* Tries to find the studio config path, returning `undefined` if not found.
|
|
1201
1231
|
*
|
|
@@ -1204,7 +1234,9 @@ declare interface TimeMeasurer {
|
|
|
1204
1234
|
* @throws On errors other than config not found
|
|
1205
1235
|
* @internal
|
|
1206
1236
|
*/
|
|
1207
|
-
export declare function tryFindStudioConfigPath(
|
|
1237
|
+
export declare function tryFindStudioConfigPath(
|
|
1238
|
+
basePath: string,
|
|
1239
|
+
): Promise<string | undefined>;
|
|
1208
1240
|
|
|
1209
1241
|
/**
|
|
1210
1242
|
* Executes a worker file with tsx registered. This means you can import other
|
|
@@ -1224,24 +1256,36 @@ export declare function tryFindStudioConfigPath(basePath: string): Promise<strin
|
|
|
1224
1256
|
export declare function tsxWorkerTask<T = unknown>(
|
|
1225
1257
|
filePath: URL_2,
|
|
1226
1258
|
options: TsxWorkerTaskOptions,
|
|
1227
|
-
): Promise<T
|
|
1259
|
+
): Promise<T>;
|
|
1228
1260
|
|
|
1229
1261
|
/**
|
|
1230
1262
|
* Options for the tsx worker task
|
|
1231
1263
|
*
|
|
1232
1264
|
* @internal
|
|
1233
1265
|
*/
|
|
1234
|
-
declare interface TsxWorkerTaskOptions extends RequireProps<
|
|
1235
|
-
|
|
1266
|
+
declare interface TsxWorkerTaskOptions extends RequireProps<
|
|
1267
|
+
WorkerOptions_2,
|
|
1268
|
+
"name"
|
|
1269
|
+
> {
|
|
1270
|
+
rootPath: string;
|
|
1236
1271
|
}
|
|
1237
1272
|
|
|
1238
|
-
declare
|
|
1273
|
+
declare interface TypeGenConfig {
|
|
1274
|
+
formatGeneratedCode: boolean;
|
|
1275
|
+
generates: string;
|
|
1276
|
+
overloadClientMethods: boolean;
|
|
1277
|
+
path: string | string[];
|
|
1278
|
+
schema: string;
|
|
1279
|
+
}
|
|
1239
1280
|
|
|
1240
1281
|
/**
|
|
1241
1282
|
* @public
|
|
1242
1283
|
*/
|
|
1243
1284
|
export declare type UserViteConfig =
|
|
1244
|
-
| ((
|
|
1245
|
-
|
|
1285
|
+
| ((
|
|
1286
|
+
config: InlineConfig,
|
|
1287
|
+
env: ConfigEnv,
|
|
1288
|
+
) => InlineConfig | Promise<InlineConfig>)
|
|
1289
|
+
| InlineConfig;
|
|
1246
1290
|
|
|
1247
|
-
export {}
|
|
1291
|
+
export {};
|