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