@sanity/cli-core 0.1.0-alpha.3 → 0.1.0-alpha.5

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.
@@ -13,6 +13,8 @@ export declare abstract class SanityCommand<T extends typeof Command> extends Co
13
13
  *
14
14
  * @param args - The global API client options.
15
15
  * @returns The global API client.
16
+ *
17
+ * @deprecated use `getGlobalCliClient` function directly instead.
16
18
  */
17
19
  protected getGlobalApiClient: (args: GlobalCliClientOptions) => Promise<import("@sanity/client").SanityClient>;
18
20
  /**
@@ -20,6 +22,8 @@ export declare abstract class SanityCommand<T extends typeof Command> extends Co
20
22
  *
21
23
  * @param args - The project API client options.
22
24
  * @returns The project API client.
25
+ *
26
+ * @deprecated use `getProjectCliClient` function directly instead.
23
27
  */
24
28
  protected getProjectApiClient: (args: ProjectCliClientOptions) => Promise<import("@sanity/client").SanityClient>;
25
29
  /**
@@ -48,7 +52,7 @@ export declare abstract class SanityCommand<T extends typeof Command> extends Co
48
52
  /**
49
53
  * Get the project's root directory by resolving the config
50
54
  *
51
- * @returns The root project root.
55
+ * @returns The project root result.
52
56
  */
53
57
  protected getProjectRoot(): Promise<ProjectRootResult>;
54
58
  init(): Promise<void>;
@@ -64,5 +68,11 @@ export declare abstract class SanityCommand<T extends typeof Command> extends Co
64
68
  * (eg when running in a CI environment).
65
69
  */
66
70
  protected isUnattended(): boolean;
71
+ /**
72
+ * Resolver for checking if the terminal is interactive. Override in tests to provide mock values.
73
+ *
74
+ * @returns Whether the terminal is interactive.
75
+ */
76
+ protected resolveIsInteractive(): boolean;
67
77
  }
68
78
  export {};
@@ -11,12 +11,16 @@ export class SanityCommand extends Command {
11
11
  *
12
12
  * @param args - The global API client options.
13
13
  * @returns The global API client.
14
+ *
15
+ * @deprecated use `getGlobalCliClient` function directly instead.
14
16
  */ getGlobalApiClient = (args)=>getGlobalCliClient(args);
15
17
  /**
16
18
  * Get the project API client.
17
19
  *
18
20
  * @param args - The project API client options.
19
21
  * @returns The project API client.
22
+ *
23
+ * @deprecated use `getProjectCliClient` function directly instead.
20
24
  */ getProjectApiClient = (args)=>getProjectCliClient(args);
21
25
  /**
22
26
  * Helper for outputting to the console.
@@ -38,8 +42,7 @@ export class SanityCommand extends Command {
38
42
  * @returns The CLI config.
39
43
  */ async getCliConfig() {
40
44
  const root = await this.getProjectRoot();
41
- const config = await getCliConfig(root.directory);
42
- return config;
45
+ return getCliConfig(root.directory);
43
46
  }
44
47
  /**
45
48
  * Get the project ID from the CLI config.
@@ -52,7 +55,7 @@ export class SanityCommand extends Command {
52
55
  /**
53
56
  * Get the project's root directory by resolving the config
54
57
  *
55
- * @returns The root project root.
58
+ * @returns The project root result.
56
59
  */ getProjectRoot() {
57
60
  return findProjectRoot(process.cwd());
58
61
  }
@@ -79,7 +82,14 @@ export class SanityCommand extends Command {
79
82
  * some commands may also be run in unattended mode if `process.stdin` is not a TTY
80
83
  * (eg when running in a CI environment).
81
84
  */ isUnattended() {
82
- return this.flags.yes || !isInteractive();
85
+ return this.flags.yes || !this.resolveIsInteractive();
86
+ }
87
+ /**
88
+ * Resolver for checking if the terminal is interactive. Override in tests to provide mock values.
89
+ *
90
+ * @returns Whether the terminal is interactive.
91
+ */ resolveIsInteractive() {
92
+ return isInteractive();
83
93
  }
84
94
  }
85
95
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/SanityCommand.ts"],"sourcesContent":["import {Command, Interfaces} from '@oclif/core'\n\nimport {getCliConfig} from './config/cli/getCliConfig.js'\nimport {type CliConfig} from './config/cli/types/cliConfig.js'\nimport {findProjectRoot} from './config/findProjectRoot.js'\nimport {type ProjectRootResult} from './config/util/recursivelyResolveProjectRoot.js'\nimport {\n getGlobalCliClient,\n getProjectCliClient,\n type GlobalCliClientOptions,\n type ProjectCliClientOptions,\n} from './services/apiClient.js'\nimport {type Output} from './types.js'\nimport {isInteractive} from './util/isInteractive.js'\n\ntype Flags<T extends typeof Command> = Interfaces.InferredFlags<\n (typeof SanityCommand)['baseFlags'] & T['flags']\n>\n\ntype Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>\n\nexport abstract class SanityCommand<T extends typeof Command> extends Command {\n protected args!: Args<T>\n protected flags!: Flags<T>\n\n /**\n * Get the global API client.\n *\n * @param args - The global API client options.\n * @returns The global API client.\n */\n protected getGlobalApiClient = (args: GlobalCliClientOptions) => getGlobalCliClient(args)\n\n /**\n * Get the project API client.\n *\n * @param args - The project API client options.\n * @returns The project API client.\n */\n protected getProjectApiClient = (args: ProjectCliClientOptions) => getProjectCliClient(args)\n\n /**\n * Helper for outputting to the console.\n *\n * @example\n * ```ts\n * this.output.log('Hello')\n * this.output.warn('Warning')\n * this.output.error('Error')\n * ```\n */\n protected output: Output = {\n error: this.error.bind(this),\n log: this.log.bind(this),\n warn: this.warn.bind(this),\n }\n\n /**\n * Get the CLI config.\n *\n * @returns The CLI config.\n */\n protected async getCliConfig(): Promise<CliConfig> {\n const root = await this.getProjectRoot()\n const config = await getCliConfig(root.directory)\n\n return config\n }\n\n /**\n * Get the project ID from the CLI config.\n *\n * @returns The project ID or `undefined` if it's not set.\n */\n protected async getProjectId(): Promise<string | undefined> {\n const config = await this.getCliConfig()\n\n return config.api?.projectId\n }\n\n /**\n * Get the project's root directory by resolving the config\n *\n * @returns The root project root.\n */\n protected getProjectRoot(): Promise<ProjectRootResult> {\n return findProjectRoot(process.cwd())\n }\n\n public async init(): Promise<void> {\n const {args, flags} = await this.parse({\n args: this.ctor.args,\n baseFlags: (super.ctor as typeof SanityCommand).baseFlags,\n enableJsonFlag: this.ctor.enableJsonFlag,\n flags: this.ctor.flags,\n strict: this.ctor.strict,\n })\n\n this.args = args as Args<T>\n this.flags = flags as Flags<T>\n\n await super.init()\n }\n\n /**\n * Check if the command is running in unattended mode.\n *\n * This means the command should not ask for user input, instead using defaults where\n * possible, and if that does not make sense (eg there's missing information), then we\n * should error out (remember to exit with a non-zero code).\n *\n * Most commands should take an explicit `--yes` flag to enable unattended mode, but\n * some commands may also be run in unattended mode if `process.stdin` is not a TTY\n * (eg when running in a CI environment).\n */\n protected isUnattended(): boolean {\n return this.flags.yes || !isInteractive()\n }\n}\n"],"names":["Command","getCliConfig","findProjectRoot","getGlobalCliClient","getProjectCliClient","isInteractive","SanityCommand","args","flags","getGlobalApiClient","getProjectApiClient","output","error","bind","log","warn","root","getProjectRoot","config","directory","getProjectId","api","projectId","process","cwd","init","parse","ctor","baseFlags","enableJsonFlag","strict","isUnattended","yes"],"mappings":"AAAA,SAAQA,OAAO,QAAmB,cAAa;AAE/C,SAAQC,YAAY,QAAO,+BAA8B;AAEzD,SAAQC,eAAe,QAAO,8BAA6B;AAE3D,SACEC,kBAAkB,EAClBC,mBAAmB,QAGd,0BAAyB;AAEhC,SAAQC,aAAa,QAAO,0BAAyB;AAQrD,OAAO,MAAeC,sBAAgDN;IAC1DO,KAAc;IACdC,MAAgB;IAE1B;;;;;GAKC,GACD,AAAUC,qBAAqB,CAACF,OAAiCJ,mBAAmBI,MAAK;IAEzF;;;;;GAKC,GACD,AAAUG,sBAAsB,CAACH,OAAkCH,oBAAoBG,MAAK;IAE5F;;;;;;;;;GASC,GACD,AAAUI,SAAiB;QACzBC,OAAO,IAAI,CAACA,KAAK,CAACC,IAAI,CAAC,IAAI;QAC3BC,KAAK,IAAI,CAACA,GAAG,CAACD,IAAI,CAAC,IAAI;QACvBE,MAAM,IAAI,CAACA,IAAI,CAACF,IAAI,CAAC,IAAI;IAC3B,EAAC;IAED;;;;GAIC,GACD,MAAgBZ,eAAmC;QACjD,MAAMe,OAAO,MAAM,IAAI,CAACC,cAAc;QACtC,MAAMC,SAAS,MAAMjB,aAAae,KAAKG,SAAS;QAEhD,OAAOD;IACT;IAEA;;;;GAIC,GACD,MAAgBE,eAA4C;QAC1D,MAAMF,SAAS,MAAM,IAAI,CAACjB,YAAY;QAEtC,OAAOiB,OAAOG,GAAG,EAAEC;IACrB;IAEA;;;;GAIC,GACD,AAAUL,iBAA6C;QACrD,OAAOf,gBAAgBqB,QAAQC,GAAG;IACpC;IAEA,MAAaC,OAAsB;QACjC,MAAM,EAAClB,IAAI,EAAEC,KAAK,EAAC,GAAG,MAAM,IAAI,CAACkB,KAAK,CAAC;YACrCnB,MAAM,IAAI,CAACoB,IAAI,CAACpB,IAAI;YACpBqB,WAAW,AAAC,KAAK,CAACD,KAA8BC,SAAS;YACzDC,gBAAgB,IAAI,CAACF,IAAI,CAACE,cAAc;YACxCrB,OAAO,IAAI,CAACmB,IAAI,CAACnB,KAAK;YACtBsB,QAAQ,IAAI,CAACH,IAAI,CAACG,MAAM;QAC1B;QAEA,IAAI,CAACvB,IAAI,GAAGA;QACZ,IAAI,CAACC,KAAK,GAAGA;QAEb,MAAM,KAAK,CAACiB;IACd;IAEA;;;;;;;;;;GAUC,GACD,AAAUM,eAAwB;QAChC,OAAO,IAAI,CAACvB,KAAK,CAACwB,GAAG,IAAI,CAAC3B;IAC5B;AACF"}
1
+ {"version":3,"sources":["../src/SanityCommand.ts"],"sourcesContent":["import {Command, Interfaces} from '@oclif/core'\n\nimport {getCliConfig} from './config/cli/getCliConfig.js'\nimport {type CliConfig} from './config/cli/types/cliConfig.js'\nimport {findProjectRoot} from './config/findProjectRoot.js'\nimport {type ProjectRootResult} from './config/util/recursivelyResolveProjectRoot.js'\nimport {\n getGlobalCliClient,\n getProjectCliClient,\n type GlobalCliClientOptions,\n type ProjectCliClientOptions,\n} from './services/apiClient.js'\nimport {type Output} from './types.js'\nimport {isInteractive} from './util/isInteractive.js'\n\ntype Flags<T extends typeof Command> = Interfaces.InferredFlags<\n (typeof SanityCommand)['baseFlags'] & T['flags']\n>\n\ntype Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>\n\nexport abstract class SanityCommand<T extends typeof Command> extends Command {\n protected args!: Args<T>\n protected flags!: Flags<T>\n\n /**\n * Get the global API client.\n *\n * @param args - The global API client options.\n * @returns The global API client.\n *\n * @deprecated use `getGlobalCliClient` function directly instead.\n */\n protected getGlobalApiClient = (args: GlobalCliClientOptions) => getGlobalCliClient(args)\n\n /**\n * Get the project API client.\n *\n * @param args - The project API client options.\n * @returns The project API client.\n *\n * @deprecated use `getProjectCliClient` function directly instead.\n */\n protected getProjectApiClient = (args: ProjectCliClientOptions) => getProjectCliClient(args)\n\n /**\n * Helper for outputting to the console.\n *\n * @example\n * ```ts\n * this.output.log('Hello')\n * this.output.warn('Warning')\n * this.output.error('Error')\n * ```\n */\n protected output: Output = {\n error: this.error.bind(this),\n log: this.log.bind(this),\n warn: this.warn.bind(this),\n }\n\n /**\n * Get the CLI config.\n *\n * @returns The CLI config.\n */\n protected async getCliConfig(): Promise<CliConfig> {\n const root = await this.getProjectRoot()\n\n return getCliConfig(root.directory)\n }\n\n /**\n * Get the project ID from the CLI config.\n *\n * @returns The project ID or `undefined` if it's not set.\n */\n protected async getProjectId(): Promise<string | undefined> {\n const config = await this.getCliConfig()\n\n return config.api?.projectId\n }\n\n /**\n * Get the project's root directory by resolving the config\n *\n * @returns The project root result.\n */\n protected getProjectRoot(): Promise<ProjectRootResult> {\n return findProjectRoot(process.cwd())\n }\n\n public async init(): Promise<void> {\n const {args, flags} = await this.parse({\n args: this.ctor.args,\n baseFlags: (super.ctor as typeof SanityCommand).baseFlags,\n enableJsonFlag: this.ctor.enableJsonFlag,\n flags: this.ctor.flags,\n strict: this.ctor.strict,\n })\n\n this.args = args as Args<T>\n this.flags = flags as Flags<T>\n\n await super.init()\n }\n\n /**\n * Check if the command is running in unattended mode.\n *\n * This means the command should not ask for user input, instead using defaults where\n * possible, and if that does not make sense (eg there's missing information), then we\n * should error out (remember to exit with a non-zero code).\n *\n * Most commands should take an explicit `--yes` flag to enable unattended mode, but\n * some commands may also be run in unattended mode if `process.stdin` is not a TTY\n * (eg when running in a CI environment).\n */\n protected isUnattended(): boolean {\n return this.flags.yes || !this.resolveIsInteractive()\n }\n\n /**\n * Resolver for checking if the terminal is interactive. Override in tests to provide mock values.\n *\n * @returns Whether the terminal is interactive.\n */\n protected resolveIsInteractive(): boolean {\n return isInteractive()\n }\n}\n"],"names":["Command","getCliConfig","findProjectRoot","getGlobalCliClient","getProjectCliClient","isInteractive","SanityCommand","args","flags","getGlobalApiClient","getProjectApiClient","output","error","bind","log","warn","root","getProjectRoot","directory","getProjectId","config","api","projectId","process","cwd","init","parse","ctor","baseFlags","enableJsonFlag","strict","isUnattended","yes","resolveIsInteractive"],"mappings":"AAAA,SAAQA,OAAO,QAAmB,cAAa;AAE/C,SAAQC,YAAY,QAAO,+BAA8B;AAEzD,SAAQC,eAAe,QAAO,8BAA6B;AAE3D,SACEC,kBAAkB,EAClBC,mBAAmB,QAGd,0BAAyB;AAEhC,SAAQC,aAAa,QAAO,0BAAyB;AAQrD,OAAO,MAAeC,sBAAgDN;IAC1DO,KAAc;IACdC,MAAgB;IAE1B;;;;;;;GAOC,GACD,AAAUC,qBAAqB,CAACF,OAAiCJ,mBAAmBI,MAAK;IAEzF;;;;;;;GAOC,GACD,AAAUG,sBAAsB,CAACH,OAAkCH,oBAAoBG,MAAK;IAE5F;;;;;;;;;GASC,GACD,AAAUI,SAAiB;QACzBC,OAAO,IAAI,CAACA,KAAK,CAACC,IAAI,CAAC,IAAI;QAC3BC,KAAK,IAAI,CAACA,GAAG,CAACD,IAAI,CAAC,IAAI;QACvBE,MAAM,IAAI,CAACA,IAAI,CAACF,IAAI,CAAC,IAAI;IAC3B,EAAC;IAED;;;;GAIC,GACD,MAAgBZ,eAAmC;QACjD,MAAMe,OAAO,MAAM,IAAI,CAACC,cAAc;QAEtC,OAAOhB,aAAae,KAAKE,SAAS;IACpC;IAEA;;;;GAIC,GACD,MAAgBC,eAA4C;QAC1D,MAAMC,SAAS,MAAM,IAAI,CAACnB,YAAY;QAEtC,OAAOmB,OAAOC,GAAG,EAAEC;IACrB;IAEA;;;;GAIC,GACD,AAAUL,iBAA6C;QACrD,OAAOf,gBAAgBqB,QAAQC,GAAG;IACpC;IAEA,MAAaC,OAAsB;QACjC,MAAM,EAAClB,IAAI,EAAEC,KAAK,EAAC,GAAG,MAAM,IAAI,CAACkB,KAAK,CAAC;YACrCnB,MAAM,IAAI,CAACoB,IAAI,CAACpB,IAAI;YACpBqB,WAAW,AAAC,KAAK,CAACD,KAA8BC,SAAS;YACzDC,gBAAgB,IAAI,CAACF,IAAI,CAACE,cAAc;YACxCrB,OAAO,IAAI,CAACmB,IAAI,CAACnB,KAAK;YACtBsB,QAAQ,IAAI,CAACH,IAAI,CAACG,MAAM;QAC1B;QAEA,IAAI,CAACvB,IAAI,GAAGA;QACZ,IAAI,CAACC,KAAK,GAAGA;QAEb,MAAM,KAAK,CAACiB;IACd;IAEA;;;;;;;;;;GAUC,GACD,AAAUM,eAAwB;QAChC,OAAO,IAAI,CAACvB,KAAK,CAACwB,GAAG,IAAI,CAAC,IAAI,CAACC,oBAAoB;IACrD;IAEA;;;;GAIC,GACD,AAAUA,uBAAgC;QACxC,OAAO5B;IACT;AACF"}
@@ -7,89 +7,47 @@ export declare const cliConfigSchema: z.ZodObject<{
7
7
  api: z.ZodOptional<z.ZodObject<{
8
8
  dataset: z.ZodOptional<z.ZodString>;
9
9
  projectId: z.ZodOptional<z.ZodString>;
10
- }, "strip", z.ZodTypeAny, {
11
- dataset?: string | undefined;
12
- projectId?: string | undefined;
13
- }, {
14
- dataset?: string | undefined;
15
- projectId?: string | undefined;
16
- }>>;
10
+ }, z.core.$strip>>;
17
11
  app: z.ZodOptional<z.ZodObject<{
18
12
  entry: z.ZodOptional<z.ZodString>;
19
13
  id: z.ZodOptional<z.ZodString>;
20
14
  organizationId: z.ZodOptional<z.ZodString>;
21
- }, "strip", z.ZodTypeAny, {
22
- entry?: string | undefined;
23
- id?: string | undefined;
24
- organizationId?: string | undefined;
25
- }, {
26
- entry?: string | undefined;
27
- id?: string | undefined;
28
- organizationId?: string | undefined;
29
- }>>;
15
+ }, z.core.$strip>>;
30
16
  autoUpdates: z.ZodOptional<z.ZodBoolean>;
31
17
  deployment: z.ZodOptional<z.ZodObject<{
32
18
  appId: z.ZodOptional<z.ZodString>;
33
19
  autoUpdates: z.ZodOptional<z.ZodBoolean>;
34
- }, "strip", z.ZodTypeAny, {
35
- autoUpdates?: boolean | undefined;
36
- appId?: string | undefined;
37
- }, {
38
- autoUpdates?: boolean | undefined;
39
- appId?: string | undefined;
40
- }>>;
20
+ }, z.core.$strip>>;
41
21
  graphql: z.ZodOptional<z.ZodArray<z.ZodObject<{
42
22
  filterSuffix: z.ZodOptional<z.ZodString>;
43
- generation: z.ZodOptional<z.ZodEnum<["gen1", "gen2", "gen3"]>>;
23
+ generation: z.ZodOptional<z.ZodEnum<{
24
+ gen1: "gen1";
25
+ gen2: "gen2";
26
+ gen3: "gen3";
27
+ }>>;
44
28
  id: z.ZodOptional<z.ZodString>;
45
29
  nonNullDocumentFields: z.ZodOptional<z.ZodBoolean>;
46
30
  playground: z.ZodOptional<z.ZodBoolean>;
47
31
  source: z.ZodOptional<z.ZodString>;
48
32
  tag: z.ZodOptional<z.ZodString>;
49
33
  workspace: z.ZodOptional<z.ZodString>;
50
- }, "strip", z.ZodTypeAny, {
51
- id?: string | undefined;
52
- filterSuffix?: string | undefined;
53
- generation?: "gen1" | "gen2" | "gen3" | undefined;
54
- nonNullDocumentFields?: boolean | undefined;
55
- playground?: boolean | undefined;
56
- source?: string | undefined;
57
- tag?: string | undefined;
58
- workspace?: string | undefined;
59
- }, {
60
- id?: string | undefined;
61
- filterSuffix?: string | undefined;
62
- generation?: "gen1" | "gen2" | "gen3" | undefined;
63
- nonNullDocumentFields?: boolean | undefined;
64
- playground?: boolean | undefined;
65
- source?: string | undefined;
66
- tag?: string | undefined;
67
- workspace?: string | undefined;
68
- }>, "many">>;
34
+ }, z.core.$strip>>>;
69
35
  mediaLibrary: z.ZodOptional<z.ZodObject<{
70
36
  aspectsPath: z.ZodOptional<z.ZodString>;
71
- }, "strip", z.ZodTypeAny, {
72
- aspectsPath?: string | undefined;
73
- }, {
74
- aspectsPath?: string | undefined;
75
- }>>;
37
+ }, z.core.$strip>>;
76
38
  project: z.ZodOptional<z.ZodObject<{
77
39
  basePath: z.ZodOptional<z.ZodString>;
78
- }, "strip", z.ZodTypeAny, {
79
- basePath?: string | undefined;
80
- }, {
81
- basePath?: string | undefined;
82
- }>>;
83
- reactCompiler: z.ZodOptional<z.ZodType<Partial<{
40
+ }, z.core.$strip>>;
41
+ reactCompiler: z.ZodOptional<z.ZodCustom<Partial<{
84
42
  environment: Partial<import("babel-plugin-react-compiler").EnvironmentConfig>;
85
43
  logger: import("babel-plugin-react-compiler").Logger | null;
86
44
  gating: import("babel-plugin-react-compiler").ExternalFunction | null;
87
45
  dynamicGating: {
88
46
  source: string;
89
47
  } | null;
90
- panicThreshold: unknown;
48
+ panicThreshold: "none" | "all_errors" | "critical_errors";
91
49
  noEmit: boolean;
92
- compilationMode: unknown;
50
+ compilationMode: "syntax" | "infer" | "annotation" | "all";
93
51
  eslintSuppressionRules: Array<string> | null | undefined;
94
52
  flowSuppressions: boolean;
95
53
  ignoreUseNoForget: boolean;
@@ -100,16 +58,16 @@ export declare const cliConfigSchema: z.ZodObject<{
100
58
  kind: "donotuse_meta_internal";
101
59
  runtimeModule: string;
102
60
  };
103
- }>, z.ZodTypeDef, Partial<{
61
+ }>, Partial<{
104
62
  environment: Partial<import("babel-plugin-react-compiler").EnvironmentConfig>;
105
63
  logger: import("babel-plugin-react-compiler").Logger | null;
106
64
  gating: import("babel-plugin-react-compiler").ExternalFunction | null;
107
65
  dynamicGating: {
108
66
  source: string;
109
67
  } | null;
110
- panicThreshold: unknown;
68
+ panicThreshold: "none" | "all_errors" | "critical_errors";
111
69
  noEmit: boolean;
112
- compilationMode: unknown;
70
+ compilationMode: "syntax" | "infer" | "annotation" | "all";
113
71
  eslintSuppressionRules: Array<string> | null | undefined;
114
72
  flowSuppressions: boolean;
115
73
  ignoreUseNoForget: boolean;
@@ -125,131 +83,7 @@ export declare const cliConfigSchema: z.ZodObject<{
125
83
  server: z.ZodOptional<z.ZodObject<{
126
84
  hostname: z.ZodOptional<z.ZodString>;
127
85
  port: z.ZodOptional<z.ZodNumber>;
128
- }, "strip", z.ZodTypeAny, {
129
- hostname?: string | undefined;
130
- port?: number | undefined;
131
- }, {
132
- hostname?: string | undefined;
133
- port?: number | undefined;
134
- }>>;
86
+ }, z.core.$strip>>;
135
87
  studioHost: z.ZodOptional<z.ZodString>;
136
- vite: z.ZodOptional<z.ZodType<UserViteConfig, z.ZodTypeDef, UserViteConfig>>;
137
- }, "strip", z.ZodTypeAny, {
138
- api?: {
139
- dataset?: string | undefined;
140
- projectId?: string | undefined;
141
- } | undefined;
142
- app?: {
143
- entry?: string | undefined;
144
- id?: string | undefined;
145
- organizationId?: string | undefined;
146
- } | undefined;
147
- autoUpdates?: boolean | undefined;
148
- deployment?: {
149
- autoUpdates?: boolean | undefined;
150
- appId?: string | undefined;
151
- } | undefined;
152
- graphql?: {
153
- id?: string | undefined;
154
- filterSuffix?: string | undefined;
155
- generation?: "gen1" | "gen2" | "gen3" | undefined;
156
- nonNullDocumentFields?: boolean | undefined;
157
- playground?: boolean | undefined;
158
- source?: string | undefined;
159
- tag?: string | undefined;
160
- workspace?: string | undefined;
161
- }[] | undefined;
162
- mediaLibrary?: {
163
- aspectsPath?: string | undefined;
164
- } | undefined;
165
- project?: {
166
- basePath?: string | undefined;
167
- } | undefined;
168
- reactCompiler?: Partial<{
169
- environment: Partial<import("babel-plugin-react-compiler").EnvironmentConfig>;
170
- logger: import("babel-plugin-react-compiler").Logger | null;
171
- gating: import("babel-plugin-react-compiler").ExternalFunction | null;
172
- dynamicGating: {
173
- source: string;
174
- } | null;
175
- panicThreshold: unknown;
176
- noEmit: boolean;
177
- compilationMode: unknown;
178
- eslintSuppressionRules: Array<string> | null | undefined;
179
- flowSuppressions: boolean;
180
- ignoreUseNoForget: boolean;
181
- customOptOutDirectives: string[] | null;
182
- sources: Array<string> | ((filename: string) => boolean) | null;
183
- enableReanimatedCheck: boolean;
184
- target: "17" | "18" | "19" | {
185
- kind: "donotuse_meta_internal";
186
- runtimeModule: string;
187
- };
188
- }> | undefined;
189
- reactStrictMode?: boolean | undefined;
190
- server?: {
191
- hostname?: string | undefined;
192
- port?: number | undefined;
193
- } | undefined;
194
- studioHost?: string | undefined;
195
- vite?: UserViteConfig | undefined;
196
- }, {
197
- api?: {
198
- dataset?: string | undefined;
199
- projectId?: string | undefined;
200
- } | undefined;
201
- app?: {
202
- entry?: string | undefined;
203
- id?: string | undefined;
204
- organizationId?: string | undefined;
205
- } | undefined;
206
- autoUpdates?: boolean | undefined;
207
- deployment?: {
208
- autoUpdates?: boolean | undefined;
209
- appId?: string | undefined;
210
- } | undefined;
211
- graphql?: {
212
- id?: string | undefined;
213
- filterSuffix?: string | undefined;
214
- generation?: "gen1" | "gen2" | "gen3" | undefined;
215
- nonNullDocumentFields?: boolean | undefined;
216
- playground?: boolean | undefined;
217
- source?: string | undefined;
218
- tag?: string | undefined;
219
- workspace?: string | undefined;
220
- }[] | undefined;
221
- mediaLibrary?: {
222
- aspectsPath?: string | undefined;
223
- } | undefined;
224
- project?: {
225
- basePath?: string | undefined;
226
- } | undefined;
227
- reactCompiler?: Partial<{
228
- environment: Partial<import("babel-plugin-react-compiler").EnvironmentConfig>;
229
- logger: import("babel-plugin-react-compiler").Logger | null;
230
- gating: import("babel-plugin-react-compiler").ExternalFunction | null;
231
- dynamicGating: {
232
- source: string;
233
- } | null;
234
- panicThreshold: unknown;
235
- noEmit: boolean;
236
- compilationMode: unknown;
237
- eslintSuppressionRules: Array<string> | null | undefined;
238
- flowSuppressions: boolean;
239
- ignoreUseNoForget: boolean;
240
- customOptOutDirectives: string[] | null;
241
- sources: Array<string> | ((filename: string) => boolean) | null;
242
- enableReanimatedCheck: boolean;
243
- target: "17" | "18" | "19" | {
244
- kind: "donotuse_meta_internal";
245
- runtimeModule: string;
246
- };
247
- }> | undefined;
248
- reactStrictMode?: boolean | undefined;
249
- server?: {
250
- hostname?: string | undefined;
251
- port?: number | undefined;
252
- } | undefined;
253
- studioHost?: string | undefined;
254
- vite?: UserViteConfig | undefined;
255
- }>;
88
+ vite: z.ZodOptional<z.ZodCustom<UserViteConfig, UserViteConfig>>;
89
+ }, z.core.$strip>;
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
- declare const rawConfigSchema: z.ZodUnion<[z.ZodArray<z.ZodObject<{
2
+ declare const rawConfigSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
3
3
  basePath: z.ZodString;
4
4
  name: z.ZodString;
5
- plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
5
+ plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
6
6
  title: z.ZodString;
7
7
  unstable_sources: z.ZodArray<z.ZodObject<{
8
8
  dataset: z.ZodString;
@@ -10,128 +10,26 @@ declare const rawConfigSchema: z.ZodUnion<[z.ZodArray<z.ZodObject<{
10
10
  schema: z.ZodObject<{
11
11
  _original: z.ZodObject<{
12
12
  name: z.ZodOptional<z.ZodString>;
13
- types: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
14
- }, "strip", z.ZodTypeAny, {
15
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
16
- name?: string | undefined;
17
- }, {
18
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
19
- name?: string | undefined;
20
- }>;
21
- }, "strip", z.ZodTypeAny, {
22
- _original: {
23
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
24
- name?: string | undefined;
25
- };
26
- }, {
27
- _original: {
28
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
29
- name?: string | undefined;
30
- };
31
- }>;
32
- }, "strip", z.ZodTypeAny, {
33
- dataset: string;
34
- projectId: string;
35
- schema: {
36
- _original: {
37
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
38
- name?: string | undefined;
39
- };
40
- };
41
- }, {
42
- dataset: string;
43
- projectId: string;
44
- schema: {
45
- _original: {
46
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
47
- name?: string | undefined;
48
- };
49
- };
50
- }>, "many">;
13
+ types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
14
+ }, z.core.$strip>;
15
+ }, z.core.$strip>;
16
+ }, z.core.$strip>>;
51
17
  dataset: z.ZodString;
52
18
  projectId: z.ZodString;
53
19
  schema: z.ZodObject<{
54
20
  _original: z.ZodObject<{
55
21
  name: z.ZodOptional<z.ZodString>;
56
- types: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
57
- }, "strip", z.ZodTypeAny, {
58
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
59
- name?: string | undefined;
60
- }, {
61
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
62
- name?: string | undefined;
63
- }>;
64
- }, "strip", z.ZodTypeAny, {
65
- _original: {
66
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
67
- name?: string | undefined;
68
- };
69
- }, {
70
- _original: {
71
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
72
- name?: string | undefined;
73
- };
74
- }>;
75
- }, "strip", z.ZodTypeAny, {
76
- name: string;
77
- dataset: string;
78
- projectId: string;
79
- basePath: string;
80
- schema: {
81
- _original: {
82
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
83
- name?: string | undefined;
84
- };
85
- };
86
- title: string;
87
- unstable_sources: {
88
- dataset: string;
89
- projectId: string;
90
- schema: {
91
- _original: {
92
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
93
- name?: string | undefined;
94
- };
95
- };
96
- }[];
97
- plugins?: unknown[] | undefined;
98
- }, {
99
- name: string;
100
- dataset: string;
101
- projectId: string;
102
- basePath: string;
103
- schema: {
104
- _original: {
105
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
106
- name?: string | undefined;
107
- };
108
- };
109
- title: string;
110
- unstable_sources: {
111
- dataset: string;
112
- projectId: string;
113
- schema: {
114
- _original: {
115
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
116
- name?: string | undefined;
117
- };
118
- };
119
- }[];
120
- plugins?: unknown[] | undefined;
121
- }>, "many">, z.ZodObject<{
22
+ types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
23
+ }, z.core.$strip>;
24
+ }, z.core.$strip>;
25
+ }, z.core.$strip>>, z.ZodObject<{
122
26
  basePath: z.ZodOptional<z.ZodString>;
123
27
  name: z.ZodOptional<z.ZodString>;
124
- plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
28
+ plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
125
29
  schema: z.ZodOptional<z.ZodObject<{
126
30
  name: z.ZodOptional<z.ZodString>;
127
- types: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
128
- }, "strip", z.ZodTypeAny, {
129
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
130
- name?: string | undefined;
131
- }, {
132
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
133
- name?: string | undefined;
134
- }>>;
31
+ types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
32
+ }, z.core.$strip>>;
135
33
  title: z.ZodOptional<z.ZodString>;
136
34
  unstable_sources: z.ZodArray<z.ZodObject<{
137
35
  dataset: z.ZodString;
@@ -139,173 +37,17 @@ declare const rawConfigSchema: z.ZodUnion<[z.ZodArray<z.ZodObject<{
139
37
  schema: z.ZodObject<{
140
38
  _original: z.ZodObject<{
141
39
  name: z.ZodOptional<z.ZodString>;
142
- types: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
143
- }, "strip", z.ZodTypeAny, {
144
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
145
- name?: string | undefined;
146
- }, {
147
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
148
- name?: string | undefined;
149
- }>;
150
- }, "strip", z.ZodTypeAny, {
151
- _original: {
152
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
153
- name?: string | undefined;
154
- };
155
- }, {
156
- _original: {
157
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
158
- name?: string | undefined;
159
- };
160
- }>;
161
- }, "strip", z.ZodTypeAny, {
162
- dataset: string;
163
- projectId: string;
164
- schema: {
165
- _original: {
166
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
167
- name?: string | undefined;
168
- };
169
- };
170
- }, {
171
- dataset: string;
172
- projectId: string;
173
- schema: {
174
- _original: {
175
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
176
- name?: string | undefined;
177
- };
178
- };
179
- }>, "many">;
40
+ types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
41
+ }, z.core.$strip>;
42
+ }, z.core.$strip>;
43
+ }, z.core.$strip>>;
180
44
  dataset: z.ZodString;
181
45
  projectId: z.ZodString;
182
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
183
- basePath: z.ZodOptional<z.ZodString>;
184
- name: z.ZodOptional<z.ZodString>;
185
- plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
186
- schema: z.ZodOptional<z.ZodObject<{
187
- name: z.ZodOptional<z.ZodString>;
188
- types: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
189
- }, "strip", z.ZodTypeAny, {
190
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
191
- name?: string | undefined;
192
- }, {
193
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
194
- name?: string | undefined;
195
- }>>;
196
- title: z.ZodOptional<z.ZodString>;
197
- unstable_sources: z.ZodArray<z.ZodObject<{
198
- dataset: z.ZodString;
199
- projectId: z.ZodString;
200
- schema: z.ZodObject<{
201
- _original: z.ZodObject<{
202
- name: z.ZodOptional<z.ZodString>;
203
- types: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
204
- }, "strip", z.ZodTypeAny, {
205
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
206
- name?: string | undefined;
207
- }, {
208
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
209
- name?: string | undefined;
210
- }>;
211
- }, "strip", z.ZodTypeAny, {
212
- _original: {
213
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
214
- name?: string | undefined;
215
- };
216
- }, {
217
- _original: {
218
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
219
- name?: string | undefined;
220
- };
221
- }>;
222
- }, "strip", z.ZodTypeAny, {
223
- dataset: string;
224
- projectId: string;
225
- schema: {
226
- _original: {
227
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
228
- name?: string | undefined;
229
- };
230
- };
231
- }, {
232
- dataset: string;
233
- projectId: string;
234
- schema: {
235
- _original: {
236
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
237
- name?: string | undefined;
238
- };
239
- };
240
- }>, "many">;
241
- dataset: z.ZodString;
242
- projectId: z.ZodString;
243
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
244
- basePath: z.ZodOptional<z.ZodString>;
245
- name: z.ZodOptional<z.ZodString>;
246
- plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
247
- schema: z.ZodOptional<z.ZodObject<{
248
- name: z.ZodOptional<z.ZodString>;
249
- types: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
250
- }, "strip", z.ZodTypeAny, {
251
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
252
- name?: string | undefined;
253
- }, {
254
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
255
- name?: string | undefined;
256
- }>>;
257
- title: z.ZodOptional<z.ZodString>;
258
- unstable_sources: z.ZodArray<z.ZodObject<{
259
- dataset: z.ZodString;
260
- projectId: z.ZodString;
261
- schema: z.ZodObject<{
262
- _original: z.ZodObject<{
263
- name: z.ZodOptional<z.ZodString>;
264
- types: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
265
- }, "strip", z.ZodTypeAny, {
266
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
267
- name?: string | undefined;
268
- }, {
269
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
270
- name?: string | undefined;
271
- }>;
272
- }, "strip", z.ZodTypeAny, {
273
- _original: {
274
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
275
- name?: string | undefined;
276
- };
277
- }, {
278
- _original: {
279
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
280
- name?: string | undefined;
281
- };
282
- }>;
283
- }, "strip", z.ZodTypeAny, {
284
- dataset: string;
285
- projectId: string;
286
- schema: {
287
- _original: {
288
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
289
- name?: string | undefined;
290
- };
291
- };
292
- }, {
293
- dataset: string;
294
- projectId: string;
295
- schema: {
296
- _original: {
297
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
298
- name?: string | undefined;
299
- };
300
- };
301
- }>, "many">;
302
- dataset: z.ZodString;
303
- projectId: z.ZodString;
304
- }, z.ZodTypeAny, "passthrough">>]>;
46
+ }, z.core.$loose>]>;
305
47
  declare const resolvedConfigSchema: z.ZodArray<z.ZodObject<{
306
48
  basePath: z.ZodString;
307
49
  name: z.ZodString;
308
- plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
50
+ plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
309
51
  title: z.ZodString;
310
52
  unstable_sources: z.ZodArray<z.ZodObject<{
311
53
  dataset: z.ZodString;
@@ -313,115 +55,19 @@ declare const resolvedConfigSchema: z.ZodArray<z.ZodObject<{
313
55
  schema: z.ZodObject<{
314
56
  _original: z.ZodObject<{
315
57
  name: z.ZodOptional<z.ZodString>;
316
- types: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
317
- }, "strip", z.ZodTypeAny, {
318
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
319
- name?: string | undefined;
320
- }, {
321
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
322
- name?: string | undefined;
323
- }>;
324
- }, "strip", z.ZodTypeAny, {
325
- _original: {
326
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
327
- name?: string | undefined;
328
- };
329
- }, {
330
- _original: {
331
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
332
- name?: string | undefined;
333
- };
334
- }>;
335
- }, "strip", z.ZodTypeAny, {
336
- dataset: string;
337
- projectId: string;
338
- schema: {
339
- _original: {
340
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
341
- name?: string | undefined;
342
- };
343
- };
344
- }, {
345
- dataset: string;
346
- projectId: string;
347
- schema: {
348
- _original: {
349
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
350
- name?: string | undefined;
351
- };
352
- };
353
- }>, "many">;
58
+ types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
59
+ }, z.core.$strip>;
60
+ }, z.core.$strip>;
61
+ }, z.core.$strip>>;
354
62
  dataset: z.ZodString;
355
63
  projectId: z.ZodString;
356
64
  schema: z.ZodObject<{
357
65
  _original: z.ZodObject<{
358
66
  name: z.ZodOptional<z.ZodString>;
359
- types: z.ZodArray<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, "many">;
360
- }, "strip", z.ZodTypeAny, {
361
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
362
- name?: string | undefined;
363
- }, {
364
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
365
- name?: string | undefined;
366
- }>;
367
- }, "strip", z.ZodTypeAny, {
368
- _original: {
369
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
370
- name?: string | undefined;
371
- };
372
- }, {
373
- _original: {
374
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
375
- name?: string | undefined;
376
- };
377
- }>;
378
- }, "strip", z.ZodTypeAny, {
379
- name: string;
380
- dataset: string;
381
- projectId: string;
382
- basePath: string;
383
- schema: {
384
- _original: {
385
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
386
- name?: string | undefined;
387
- };
388
- };
389
- title: string;
390
- unstable_sources: {
391
- dataset: string;
392
- projectId: string;
393
- schema: {
394
- _original: {
395
- types: z.objectOutputType<{}, z.ZodTypeAny, "passthrough">[];
396
- name?: string | undefined;
397
- };
398
- };
399
- }[];
400
- plugins?: unknown[] | undefined;
401
- }, {
402
- name: string;
403
- dataset: string;
404
- projectId: string;
405
- basePath: string;
406
- schema: {
407
- _original: {
408
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
409
- name?: string | undefined;
410
- };
411
- };
412
- title: string;
413
- unstable_sources: {
414
- dataset: string;
415
- projectId: string;
416
- schema: {
417
- _original: {
418
- types: z.objectInputType<{}, z.ZodTypeAny, "passthrough">[];
419
- name?: string | undefined;
420
- };
421
- };
422
- }[];
423
- plugins?: unknown[] | undefined;
424
- }>, "many">;
67
+ types: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
68
+ }, z.core.$strip>;
69
+ }, z.core.$strip>;
70
+ }, z.core.$strip>>;
425
71
  export type RawStudioConfig = z.infer<typeof rawConfigSchema>;
426
72
  export type ResolvedStudioConfig = z.infer<typeof resolvedConfigSchema>;
427
73
  export interface ReadStudioConfigOptions {
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export * from './util/getUserConfig.js';
26
26
  export * from './util/isCi.js';
27
27
  export * from './util/isInteractive.js';
28
28
  export * from './util/isTrueish.js';
29
+ export * from './util/parseStringFlag.js';
29
30
  export * from './util/resolveLocalPackage.js';
30
31
  export * from './util/tryGetDefaultExport.js';
31
32
  export * from './ux/colorizeJson.js';
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ export * from './util/getUserConfig.js';
22
22
  export * from './util/isCi.js';
23
23
  export * from './util/isInteractive.js';
24
24
  export * from './util/isTrueish.js';
25
+ export * from './util/parseStringFlag.js';
25
26
  export * from './util/resolveLocalPackage.js';
26
27
  export * from './util/tryGetDefaultExport.js';
27
28
  export * from './ux/colorizeJson.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './config/cli/getCliConfig.js'\nexport * from './config/cli/getCliConfigSync.js'\nexport {cliConfigSchema} from './config/cli/schemas.js'\nexport {type CliConfig} from './config/cli/types/cliConfig.js'\nexport {type UserViteConfig} from './config/cli/types/userViteConfig.js'\nexport * from './config/findProjectRoot.js'\nexport * from './config/findProjectRootSync.js'\nexport * from './config/studio/getStudioConfig.js'\nexport * from './config/util/findConfigsPaths.js'\nexport * from './config/util/findStudioConfigPath.js'\nexport {type ProjectRootResult} from './config/util/recursivelyResolveProjectRoot.js'\nexport * from './debug.js'\nexport * from './loaders/tsx/tsxWorkerTask.js'\nexport * from './SanityCommand.js'\nexport * from './services/apiClient.js'\nexport * from './services/cliUserConfig.js'\nexport * from './services/getCliToken.js'\nexport {type Output, type SanityOrgUser} from './types.js'\nexport * from './util/createExpiringConfig.js'\nexport * from './util/environment/mockBrowserEnvironment.js'\nexport * from './util/fileExists.js'\nexport * from './util/getEmptyAuth.js'\nexport * from './util/getSanityEnvVar.js'\nexport * from './util/getSanityUrl.js'\nexport * from './util/getUserConfig.js'\nexport * from './util/isCi.js'\nexport * from './util/isInteractive.js'\nexport * from './util/isTrueish.js'\nexport * from './util/resolveLocalPackage.js'\nexport * from './util/tryGetDefaultExport.js'\nexport * from './ux/colorizeJson.js'\nexport * from './ux/formatObject.js'\nexport * from './ux/printKeyValue.js'\nexport * from './ux/timer.js'\n"],"names":["cliConfigSchema"],"mappings":"AAAA,cAAc,+BAA8B;AAC5C,cAAc,mCAAkC;AAChD,SAAQA,eAAe,QAAO,0BAAyB;AAGvD,cAAc,8BAA6B;AAC3C,cAAc,kCAAiC;AAC/C,cAAc,qCAAoC;AAClD,cAAc,oCAAmC;AACjD,cAAc,wCAAuC;AAErD,cAAc,aAAY;AAC1B,cAAc,iCAAgC;AAC9C,cAAc,qBAAoB;AAClC,cAAc,0BAAyB;AACvC,cAAc,8BAA6B;AAC3C,cAAc,4BAA2B;AAEzC,cAAc,iCAAgC;AAC9C,cAAc,+CAA8C;AAC5D,cAAc,uBAAsB;AACpC,cAAc,yBAAwB;AACtC,cAAc,4BAA2B;AACzC,cAAc,yBAAwB;AACtC,cAAc,0BAAyB;AACvC,cAAc,iBAAgB;AAC9B,cAAc,0BAAyB;AACvC,cAAc,sBAAqB;AACnC,cAAc,gCAA+B;AAC7C,cAAc,gCAA+B;AAC7C,cAAc,uBAAsB;AACpC,cAAc,uBAAsB;AACpC,cAAc,wBAAuB;AACrC,cAAc,gBAAe"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './config/cli/getCliConfig.js'\nexport * from './config/cli/getCliConfigSync.js'\nexport {cliConfigSchema} from './config/cli/schemas.js'\nexport {type CliConfig} from './config/cli/types/cliConfig.js'\nexport {type UserViteConfig} from './config/cli/types/userViteConfig.js'\nexport * from './config/findProjectRoot.js'\nexport * from './config/findProjectRootSync.js'\nexport * from './config/studio/getStudioConfig.js'\nexport * from './config/util/findConfigsPaths.js'\nexport * from './config/util/findStudioConfigPath.js'\nexport {type ProjectRootResult} from './config/util/recursivelyResolveProjectRoot.js'\nexport * from './debug.js'\nexport * from './loaders/tsx/tsxWorkerTask.js'\nexport * from './SanityCommand.js'\nexport * from './services/apiClient.js'\nexport * from './services/cliUserConfig.js'\nexport * from './services/getCliToken.js'\nexport {type Output, type SanityOrgUser} from './types.js'\nexport * from './util/createExpiringConfig.js'\nexport * from './util/environment/mockBrowserEnvironment.js'\nexport * from './util/fileExists.js'\nexport * from './util/getEmptyAuth.js'\nexport * from './util/getSanityEnvVar.js'\nexport * from './util/getSanityUrl.js'\nexport * from './util/getUserConfig.js'\nexport * from './util/isCi.js'\nexport * from './util/isInteractive.js'\nexport * from './util/isTrueish.js'\nexport * from './util/parseStringFlag.js'\nexport * from './util/resolveLocalPackage.js'\nexport * from './util/tryGetDefaultExport.js'\nexport * from './ux/colorizeJson.js'\nexport * from './ux/formatObject.js'\nexport * from './ux/printKeyValue.js'\nexport * from './ux/timer.js'\n"],"names":["cliConfigSchema"],"mappings":"AAAA,cAAc,+BAA8B;AAC5C,cAAc,mCAAkC;AAChD,SAAQA,eAAe,QAAO,0BAAyB;AAGvD,cAAc,8BAA6B;AAC3C,cAAc,kCAAiC;AAC/C,cAAc,qCAAoC;AAClD,cAAc,oCAAmC;AACjD,cAAc,wCAAuC;AAErD,cAAc,aAAY;AAC1B,cAAc,iCAAgC;AAC9C,cAAc,qBAAoB;AAClC,cAAc,0BAAyB;AACvC,cAAc,8BAA6B;AAC3C,cAAc,4BAA2B;AAEzC,cAAc,iCAAgC;AAC9C,cAAc,+CAA8C;AAC5D,cAAc,uBAAsB;AACpC,cAAc,yBAAwB;AACtC,cAAc,4BAA2B;AACzC,cAAc,yBAAwB;AACtC,cAAc,0BAAyB;AACvC,cAAc,iBAAgB;AAC9B,cAAc,0BAAyB;AACvC,cAAc,sBAAqB;AACnC,cAAc,4BAA2B;AACzC,cAAc,gCAA+B;AAC7C,cAAc,gCAA+B;AAC7C,cAAc,uBAAsB;AACpC,cAAc,uBAAsB;AACpC,cAAc,wBAAuB;AACrC,cAAc,gBAAe"}
@@ -20,7 +20,7 @@ export interface GlobalCliClientOptions extends ClientConfig {
20
20
  * @param options - The options to use for the client.
21
21
  * @returns Promise that resolves to a configured Sanity API client.
22
22
  */
23
- export declare function getGlobalCliClient({ requireUser, ...config }: GlobalCliClientOptions): Promise<SanityClient>;
23
+ export declare function getGlobalCliClient({ requireUser, token: providedToken, ...config }: GlobalCliClientOptions): Promise<SanityClient>;
24
24
  /**
25
25
  * @internal
26
26
  */
@@ -50,4 +50,4 @@ export interface ProjectCliClientOptions extends ClientConfig {
50
50
  * @param options - The options to use for the client.
51
51
  * @returns Promise that resolves to a configured Sanity API client.
52
52
  */
53
- export declare function getProjectCliClient({ requireUser, ...config }: ProjectCliClientOptions): Promise<SanityClient>;
53
+ export declare function getProjectCliClient({ requireUser, token: providedToken, ...config }: ProjectCliClientOptions): Promise<SanityClient>;
@@ -11,13 +11,13 @@ const CLI_REQUEST_TAG_PREFIX = 'sanity.cli';
11
11
  *
12
12
  * @param options - The options to use for the client.
13
13
  * @returns Promise that resolves to a configured Sanity API client.
14
- */ export async function getGlobalCliClient({ requireUser, ...config }) {
14
+ */ export async function getGlobalCliClient({ requireUser, token: providedToken, ...config }) {
15
15
  const requester = defaultRequester.clone();
16
16
  requester.use(authErrors());
17
17
  const sanityEnv = process.env.SANITY_INTERNAL_ENV || 'production';
18
18
  const apiHost = apiHosts[sanityEnv];
19
- let token;
20
- if (requireUser) {
19
+ let token = providedToken;
20
+ if (!token && requireUser) {
21
21
  token = await getCliToken();
22
22
  if (!token) {
23
23
  throw new Error('You must login first - run "sanity login"');
@@ -40,13 +40,13 @@ const CLI_REQUEST_TAG_PREFIX = 'sanity.cli';
40
40
  *
41
41
  * @param options - The options to use for the client.
42
42
  * @returns Promise that resolves to a configured Sanity API client.
43
- */ export async function getProjectCliClient({ requireUser, ...config }) {
43
+ */ export async function getProjectCliClient({ requireUser, token: providedToken, ...config }) {
44
44
  const requester = defaultRequester.clone();
45
45
  requester.use(authErrors());
46
46
  const sanityEnv = process.env.SANITY_INTERNAL_ENV || 'production';
47
47
  const apiHost = apiHosts[sanityEnv];
48
- let token;
49
- if (requireUser) {
48
+ let token = providedToken;
49
+ if (!token && requireUser) {
50
50
  token = await getCliToken();
51
51
  if (!token) {
52
52
  throw new Error('You must login first - run "sanity login"');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/services/apiClient.ts"],"sourcesContent":["import {ux} from '@oclif/core'\nimport {\n type ClientConfig,\n type ClientError,\n createClient,\n requester as defaultRequester,\n isHttpError,\n type SanityClient,\n type ServerError,\n} from '@sanity/client'\n\nimport {generateHelpUrl} from '../util/generateHelpUrl.js'\nimport {getCliToken} from './getCliToken.js'\n\nconst apiHosts: Record<string, string | undefined> = {\n staging: 'https://api.sanity.work',\n}\n\nconst CLI_REQUEST_TAG_PREFIX = 'sanity.cli'\n\n/**\n * @internal\n */\nexport interface GlobalCliClientOptions extends ClientConfig {\n /**\n * The API version to use for this client.\n */\n apiVersion: string\n\n /**\n * Whether to require a user to be authenticated to use this client.\n * Default: `false`.\n * Throws an error if `true` and user is not authenticated.\n */\n requireUser?: boolean\n}\n\n/**\n * Create a \"global\" (unscoped) Sanity API client.\n *\n * @param options - The options to use for the client.\n * @returns Promise that resolves to a configured Sanity API client.\n */\nexport async function getGlobalCliClient({\n requireUser,\n ...config\n}: GlobalCliClientOptions): Promise<SanityClient> {\n const requester = defaultRequester.clone()\n requester.use(authErrors())\n\n const sanityEnv = process.env.SANITY_INTERNAL_ENV || 'production'\n\n const apiHost = apiHosts[sanityEnv]\n\n let token: string | undefined\n if (requireUser) {\n token = await getCliToken()\n if (!token) {\n throw new Error('You must login first - run \"sanity login\"')\n }\n }\n\n return createClient({\n ...(apiHost ? {apiHost} : {}),\n requester,\n requestTagPrefix: CLI_REQUEST_TAG_PREFIX,\n token,\n useCdn: false,\n useProjectHostname: false,\n ...config,\n })\n}\n\n/**\n * @internal\n */\nexport interface ProjectCliClientOptions extends ClientConfig {\n /**\n * The API version to use for this client.\n */\n apiVersion: string\n\n /**\n * The project ID to use for this client.\n */\n projectId: string\n\n /**\n * The dataset to use for this client.\n */\n dataset?: string\n\n /**\n * Whether to require a user to be authenticated to use this client.\n * Default: `false`.\n * Throws an error if `true` and user is not authenticated.\n */\n requireUser?: boolean\n}\n\n/**\n * Create a \"global\" (unscoped) Sanity API client.\n *\n * @param options - The options to use for the client.\n * @returns Promise that resolves to a configured Sanity API client.\n */\nexport async function getProjectCliClient({\n requireUser,\n ...config\n}: ProjectCliClientOptions): Promise<SanityClient> {\n const requester = defaultRequester.clone()\n requester.use(authErrors())\n\n const sanityEnv = process.env.SANITY_INTERNAL_ENV || 'production'\n\n const apiHost = apiHosts[sanityEnv]\n\n let token: string | undefined\n if (requireUser) {\n token = await getCliToken()\n if (!token) {\n throw new Error('You must login first - run \"sanity login\"')\n }\n }\n\n return createClient({\n ...(apiHost ? {apiHost} : {}),\n requester,\n requestTagPrefix: CLI_REQUEST_TAG_PREFIX,\n token,\n useCdn: false,\n useProjectHostname: true,\n ...config,\n })\n}\n\n/**\n * `get-it` middleware that checks for 401 authentication errors and extends the error with more\n * helpful guidance on what to do next.\n *\n * @returns get-it middleware with `onError` handler\n * @internal\n */\nfunction authErrors() {\n return {\n onError: (err: Error | null) => {\n if (!err || !isReqResError(err)) {\n return err\n }\n\n const statusCode = isHttpError(err) && err.response.body.statusCode\n if (statusCode === 401) {\n err.message = `${err.message}. You may need to login again with ${ux.colorize('cyan', 'sanity login')}.\\nFor more information, see ${generateHelpUrl('cli-errors')}.`\n }\n\n return err\n },\n }\n}\n\nfunction isReqResError(err: Error): err is ClientError | ServerError {\n return Object.prototype.hasOwnProperty.call(err, 'response')\n}\n"],"names":["ux","createClient","requester","defaultRequester","isHttpError","generateHelpUrl","getCliToken","apiHosts","staging","CLI_REQUEST_TAG_PREFIX","getGlobalCliClient","requireUser","config","clone","use","authErrors","sanityEnv","process","env","SANITY_INTERNAL_ENV","apiHost","token","Error","requestTagPrefix","useCdn","useProjectHostname","getProjectCliClient","onError","err","isReqResError","statusCode","response","body","message","colorize","Object","prototype","hasOwnProperty","call"],"mappings":"AAAA,SAAQA,EAAE,QAAO,cAAa;AAC9B,SAGEC,YAAY,EACZC,aAAaC,gBAAgB,EAC7BC,WAAW,QAGN,iBAAgB;AAEvB,SAAQC,eAAe,QAAO,6BAA4B;AAC1D,SAAQC,WAAW,QAAO,mBAAkB;AAE5C,MAAMC,WAA+C;IACnDC,SAAS;AACX;AAEA,MAAMC,yBAAyB;AAmB/B;;;;;CAKC,GACD,OAAO,eAAeC,mBAAmB,EACvCC,WAAW,EACX,GAAGC,QACoB;IACvB,MAAMV,YAAYC,iBAAiBU,KAAK;IACxCX,UAAUY,GAAG,CAACC;IAEd,MAAMC,YAAYC,QAAQC,GAAG,CAACC,mBAAmB,IAAI;IAErD,MAAMC,UAAUb,QAAQ,CAACS,UAAU;IAEnC,IAAIK;IACJ,IAAIV,aAAa;QACfU,QAAQ,MAAMf;QACd,IAAI,CAACe,OAAO;YACV,MAAM,IAAIC,MAAM;QAClB;IACF;IAEA,OAAOrB,aAAa;QAClB,GAAImB,UAAU;YAACA;QAAO,IAAI,CAAC,CAAC;QAC5BlB;QACAqB,kBAAkBd;QAClBY;QACAG,QAAQ;QACRC,oBAAoB;QACpB,GAAGb,MAAM;IACX;AACF;AA6BA;;;;;CAKC,GACD,OAAO,eAAec,oBAAoB,EACxCf,WAAW,EACX,GAAGC,QACqB;IACxB,MAAMV,YAAYC,iBAAiBU,KAAK;IACxCX,UAAUY,GAAG,CAACC;IAEd,MAAMC,YAAYC,QAAQC,GAAG,CAACC,mBAAmB,IAAI;IAErD,MAAMC,UAAUb,QAAQ,CAACS,UAAU;IAEnC,IAAIK;IACJ,IAAIV,aAAa;QACfU,QAAQ,MAAMf;QACd,IAAI,CAACe,OAAO;YACV,MAAM,IAAIC,MAAM;QAClB;IACF;IAEA,OAAOrB,aAAa;QAClB,GAAImB,UAAU;YAACA;QAAO,IAAI,CAAC,CAAC;QAC5BlB;QACAqB,kBAAkBd;QAClBY;QACAG,QAAQ;QACRC,oBAAoB;QACpB,GAAGb,MAAM;IACX;AACF;AAEA;;;;;;CAMC,GACD,SAASG;IACP,OAAO;QACLY,SAAS,CAACC;YACR,IAAI,CAACA,OAAO,CAACC,cAAcD,MAAM;gBAC/B,OAAOA;YACT;YAEA,MAAME,aAAa1B,YAAYwB,QAAQA,IAAIG,QAAQ,CAACC,IAAI,CAACF,UAAU;YACnE,IAAIA,eAAe,KAAK;gBACtBF,IAAIK,OAAO,GAAG,GAAGL,IAAIK,OAAO,CAAC,mCAAmC,EAAEjC,GAAGkC,QAAQ,CAAC,QAAQ,gBAAgB,6BAA6B,EAAE7B,gBAAgB,cAAc,CAAC,CAAC;YACvK;YAEA,OAAOuB;QACT;IACF;AACF;AAEA,SAASC,cAAcD,GAAU;IAC/B,OAAOO,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACV,KAAK;AACnD"}
1
+ {"version":3,"sources":["../../src/services/apiClient.ts"],"sourcesContent":["import {ux} from '@oclif/core'\nimport {\n type ClientConfig,\n type ClientError,\n createClient,\n requester as defaultRequester,\n isHttpError,\n type SanityClient,\n type ServerError,\n} from '@sanity/client'\n\nimport {generateHelpUrl} from '../util/generateHelpUrl.js'\nimport {getCliToken} from './getCliToken.js'\n\nconst apiHosts: Record<string, string | undefined> = {\n staging: 'https://api.sanity.work',\n}\n\nconst CLI_REQUEST_TAG_PREFIX = 'sanity.cli'\n\n/**\n * @internal\n */\nexport interface GlobalCliClientOptions extends ClientConfig {\n /**\n * The API version to use for this client.\n */\n apiVersion: string\n\n /**\n * Whether to require a user to be authenticated to use this client.\n * Default: `false`.\n * Throws an error if `true` and user is not authenticated.\n */\n requireUser?: boolean\n}\n\n/**\n * Create a \"global\" (unscoped) Sanity API client.\n *\n * @param options - The options to use for the client.\n * @returns Promise that resolves to a configured Sanity API client.\n */\nexport async function getGlobalCliClient({\n requireUser,\n token: providedToken,\n ...config\n}: GlobalCliClientOptions): Promise<SanityClient> {\n const requester = defaultRequester.clone()\n requester.use(authErrors())\n\n const sanityEnv = process.env.SANITY_INTERNAL_ENV || 'production'\n\n const apiHost = apiHosts[sanityEnv]\n\n let token: string | undefined = providedToken\n if (!token && requireUser) {\n token = await getCliToken()\n if (!token) {\n throw new Error('You must login first - run \"sanity login\"')\n }\n }\n\n return createClient({\n ...(apiHost ? {apiHost} : {}),\n requester,\n requestTagPrefix: CLI_REQUEST_TAG_PREFIX,\n token,\n useCdn: false,\n useProjectHostname: false,\n ...config,\n })\n}\n\n/**\n * @internal\n */\nexport interface ProjectCliClientOptions extends ClientConfig {\n /**\n * The API version to use for this client.\n */\n apiVersion: string\n\n /**\n * The project ID to use for this client.\n */\n projectId: string\n\n /**\n * The dataset to use for this client.\n */\n dataset?: string\n\n /**\n * Whether to require a user to be authenticated to use this client.\n * Default: `false`.\n * Throws an error if `true` and user is not authenticated.\n */\n requireUser?: boolean\n}\n\n/**\n * Create a \"global\" (unscoped) Sanity API client.\n *\n * @param options - The options to use for the client.\n * @returns Promise that resolves to a configured Sanity API client.\n */\nexport async function getProjectCliClient({\n requireUser,\n token: providedToken,\n ...config\n}: ProjectCliClientOptions): Promise<SanityClient> {\n const requester = defaultRequester.clone()\n requester.use(authErrors())\n\n const sanityEnv = process.env.SANITY_INTERNAL_ENV || 'production'\n\n const apiHost = apiHosts[sanityEnv]\n\n let token: string | undefined = providedToken\n if (!token && requireUser) {\n token = await getCliToken()\n if (!token) {\n throw new Error('You must login first - run \"sanity login\"')\n }\n }\n\n return createClient({\n ...(apiHost ? {apiHost} : {}),\n requester,\n requestTagPrefix: CLI_REQUEST_TAG_PREFIX,\n token,\n useCdn: false,\n useProjectHostname: true,\n ...config,\n })\n}\n\n/**\n * `get-it` middleware that checks for 401 authentication errors and extends the error with more\n * helpful guidance on what to do next.\n *\n * @returns get-it middleware with `onError` handler\n * @internal\n */\nfunction authErrors() {\n return {\n onError: (err: Error | null) => {\n if (!err || !isReqResError(err)) {\n return err\n }\n\n const statusCode = isHttpError(err) && err.response.body.statusCode\n if (statusCode === 401) {\n err.message = `${err.message}. You may need to login again with ${ux.colorize('cyan', 'sanity login')}.\\nFor more information, see ${generateHelpUrl('cli-errors')}.`\n }\n\n return err\n },\n }\n}\n\nfunction isReqResError(err: Error): err is ClientError | ServerError {\n return Object.prototype.hasOwnProperty.call(err, 'response')\n}\n"],"names":["ux","createClient","requester","defaultRequester","isHttpError","generateHelpUrl","getCliToken","apiHosts","staging","CLI_REQUEST_TAG_PREFIX","getGlobalCliClient","requireUser","token","providedToken","config","clone","use","authErrors","sanityEnv","process","env","SANITY_INTERNAL_ENV","apiHost","Error","requestTagPrefix","useCdn","useProjectHostname","getProjectCliClient","onError","err","isReqResError","statusCode","response","body","message","colorize","Object","prototype","hasOwnProperty","call"],"mappings":"AAAA,SAAQA,EAAE,QAAO,cAAa;AAC9B,SAGEC,YAAY,EACZC,aAAaC,gBAAgB,EAC7BC,WAAW,QAGN,iBAAgB;AAEvB,SAAQC,eAAe,QAAO,6BAA4B;AAC1D,SAAQC,WAAW,QAAO,mBAAkB;AAE5C,MAAMC,WAA+C;IACnDC,SAAS;AACX;AAEA,MAAMC,yBAAyB;AAmB/B;;;;;CAKC,GACD,OAAO,eAAeC,mBAAmB,EACvCC,WAAW,EACXC,OAAOC,aAAa,EACpB,GAAGC,QACoB;IACvB,MAAMZ,YAAYC,iBAAiBY,KAAK;IACxCb,UAAUc,GAAG,CAACC;IAEd,MAAMC,YAAYC,QAAQC,GAAG,CAACC,mBAAmB,IAAI;IAErD,MAAMC,UAAUf,QAAQ,CAACW,UAAU;IAEnC,IAAIN,QAA4BC;IAChC,IAAI,CAACD,SAASD,aAAa;QACzBC,QAAQ,MAAMN;QACd,IAAI,CAACM,OAAO;YACV,MAAM,IAAIW,MAAM;QAClB;IACF;IAEA,OAAOtB,aAAa;QAClB,GAAIqB,UAAU;YAACA;QAAO,IAAI,CAAC,CAAC;QAC5BpB;QACAsB,kBAAkBf;QAClBG;QACAa,QAAQ;QACRC,oBAAoB;QACpB,GAAGZ,MAAM;IACX;AACF;AA6BA;;;;;CAKC,GACD,OAAO,eAAea,oBAAoB,EACxChB,WAAW,EACXC,OAAOC,aAAa,EACpB,GAAGC,QACqB;IACxB,MAAMZ,YAAYC,iBAAiBY,KAAK;IACxCb,UAAUc,GAAG,CAACC;IAEd,MAAMC,YAAYC,QAAQC,GAAG,CAACC,mBAAmB,IAAI;IAErD,MAAMC,UAAUf,QAAQ,CAACW,UAAU;IAEnC,IAAIN,QAA4BC;IAChC,IAAI,CAACD,SAASD,aAAa;QACzBC,QAAQ,MAAMN;QACd,IAAI,CAACM,OAAO;YACV,MAAM,IAAIW,MAAM;QAClB;IACF;IAEA,OAAOtB,aAAa;QAClB,GAAIqB,UAAU;YAACA;QAAO,IAAI,CAAC,CAAC;QAC5BpB;QACAsB,kBAAkBf;QAClBG;QACAa,QAAQ;QACRC,oBAAoB;QACpB,GAAGZ,MAAM;IACX;AACF;AAEA;;;;;;CAMC,GACD,SAASG;IACP,OAAO;QACLW,SAAS,CAACC;YACR,IAAI,CAACA,OAAO,CAACC,cAAcD,MAAM;gBAC/B,OAAOA;YACT;YAEA,MAAME,aAAa3B,YAAYyB,QAAQA,IAAIG,QAAQ,CAACC,IAAI,CAACF,UAAU;YACnE,IAAIA,eAAe,KAAK;gBACtBF,IAAIK,OAAO,GAAG,GAAGL,IAAIK,OAAO,CAAC,mCAAmC,EAAElC,GAAGmC,QAAQ,CAAC,QAAQ,gBAAgB,6BAA6B,EAAE9B,gBAAgB,cAAc,CAAC,CAAC;YACvK;YAEA,OAAOwB;QACT;IACF;AACF;AAEA,SAASC,cAAcD,GAAU;IAC/B,OAAOO,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACV,KAAK;AACnD"}
@@ -4,32 +4,15 @@ declare const cliUserConfigSchema: {
4
4
  telemetryConsent: z.ZodOptional<z.ZodObject<{
5
5
  updatedAt: z.ZodOptional<z.ZodNumber>;
6
6
  value: z.ZodObject<{
7
- status: z.ZodEnum<["undetermined", "unset", "granted", "denied"]>;
7
+ status: z.ZodEnum<{
8
+ undetermined: "undetermined";
9
+ unset: "unset";
10
+ granted: "granted";
11
+ denied: "denied";
12
+ }>;
8
13
  type: z.ZodString;
9
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
10
- status: z.ZodEnum<["undetermined", "unset", "granted", "denied"]>;
11
- type: z.ZodString;
12
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
13
- status: z.ZodEnum<["undetermined", "unset", "granted", "denied"]>;
14
- type: z.ZodString;
15
- }, z.ZodTypeAny, "passthrough">>;
16
- }, "strip", z.ZodTypeAny, {
17
- value: {
18
- type: string;
19
- status: "undetermined" | "unset" | "granted" | "denied";
20
- } & {
21
- [k: string]: unknown;
22
- };
23
- updatedAt?: number | undefined;
24
- }, {
25
- value: {
26
- type: string;
27
- status: "undetermined" | "unset" | "granted" | "denied";
28
- } & {
29
- [k: string]: unknown;
30
- };
31
- updatedAt?: number | undefined;
32
- }>>;
14
+ }, z.core.$loose>;
15
+ }, z.core.$strip>>;
33
16
  };
34
17
  /**
35
18
  * The CLI user configuration schema.
@@ -0,0 +1,43 @@
1
+ import { describe, expect, test } from 'vitest';
2
+ import { parseStringFlag } from '../parseStringFlag.js';
3
+ describe('parseStringFlag', ()=>{
4
+ test.each([
5
+ {
6
+ desc: 'returns undefined when input is undefined',
7
+ expected: undefined,
8
+ flagName: 'dataset',
9
+ input: undefined
10
+ },
11
+ {
12
+ desc: 'returns valid string when input is non-empty',
13
+ expected: 'my-workspace',
14
+ flagName: 'workspace',
15
+ input: 'my-workspace'
16
+ },
17
+ {
18
+ desc: 'returns string with spaces',
19
+ expected: 'test value',
20
+ flagName: 'tag',
21
+ input: 'test value'
22
+ }
23
+ ])('$desc', async ({ expected, flagName, input })=>{
24
+ const result = await parseStringFlag(flagName, input);
25
+ expect(result).toBe(expected);
26
+ });
27
+ test.each([
28
+ {
29
+ desc: 'empty string',
30
+ expectedError: 'dataset argument is empty',
31
+ flagName: 'dataset',
32
+ input: ''
33
+ }
34
+ ])('throws error when $desc', async ({ expectedError, flagName, input })=>{
35
+ await expect(parseStringFlag(flagName, input)).rejects.toThrow(expectedError);
36
+ });
37
+ test('returns whitespace string as-is (no trimming)', async ()=>{
38
+ const result = await parseStringFlag('workspace', ' ');
39
+ expect(result).toBe(' ');
40
+ });
41
+ });
42
+
43
+ //# sourceMappingURL=parseStringFlag.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/util/__tests__/parseStringFlag.test.ts"],"sourcesContent":["import {describe, expect, test} from 'vitest'\n\nimport {parseStringFlag} from '../parseStringFlag.js'\n\ndescribe('parseStringFlag', () => {\n test.each([\n {\n desc: 'returns undefined when input is undefined',\n expected: undefined,\n flagName: 'dataset',\n input: undefined,\n },\n {\n desc: 'returns valid string when input is non-empty',\n expected: 'my-workspace',\n flagName: 'workspace',\n input: 'my-workspace',\n },\n {\n desc: 'returns string with spaces',\n expected: 'test value',\n flagName: 'tag',\n input: 'test value',\n },\n ])('$desc', async ({expected, flagName, input}) => {\n const result = await parseStringFlag(flagName, input)\n expect(result).toBe(expected)\n })\n\n test.each([\n {\n desc: 'empty string',\n expectedError: 'dataset argument is empty',\n flagName: 'dataset',\n input: '',\n },\n ])('throws error when $desc', async ({expectedError, flagName, input}) => {\n await expect(parseStringFlag(flagName, input)).rejects.toThrow(expectedError)\n })\n\n test('returns whitespace string as-is (no trimming)', async () => {\n const result = await parseStringFlag('workspace', ' ')\n expect(result).toBe(' ')\n })\n})\n"],"names":["describe","expect","test","parseStringFlag","each","desc","expected","undefined","flagName","input","result","toBe","expectedError","rejects","toThrow"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,MAAM,EAAEC,IAAI,QAAO,SAAQ;AAE7C,SAAQC,eAAe,QAAO,wBAAuB;AAErDH,SAAS,mBAAmB;IAC1BE,KAAKE,IAAI,CAAC;QACR;YACEC,MAAM;YACNC,UAAUC;YACVC,UAAU;YACVC,OAAOF;QACT;QACA;YACEF,MAAM;YACNC,UAAU;YACVE,UAAU;YACVC,OAAO;QACT;QACA;YACEJ,MAAM;YACNC,UAAU;YACVE,UAAU;YACVC,OAAO;QACT;KACD,EAAE,SAAS,OAAO,EAACH,QAAQ,EAAEE,QAAQ,EAAEC,KAAK,EAAC;QAC5C,MAAMC,SAAS,MAAMP,gBAAgBK,UAAUC;QAC/CR,OAAOS,QAAQC,IAAI,CAACL;IACtB;IAEAJ,KAAKE,IAAI,CAAC;QACR;YACEC,MAAM;YACNO,eAAe;YACfJ,UAAU;YACVC,OAAO;QACT;KACD,EAAE,2BAA2B,OAAO,EAACG,aAAa,EAAEJ,QAAQ,EAAEC,KAAK,EAAC;QACnE,MAAMR,OAAOE,gBAAgBK,UAAUC,QAAQI,OAAO,CAACC,OAAO,CAACF;IACjE;IAEAV,KAAK,iDAAiD;QACpD,MAAMQ,SAAS,MAAMP,gBAAgB,aAAa;QAClDF,OAAOS,QAAQC,IAAI,CAAC;IACtB;AACF"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Parses an optional string flag from oclif.
3
+ * If the input is undefined, return undefined
4
+ * but if the input is empty, throw an error.
5
+ *
6
+ *
7
+ * @param input - The input to parse
8
+ * Throws an error if the input is empty
9
+ */
10
+ export declare function parseStringFlag(flagName: string, input?: string): Promise<string | undefined>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Parses an optional string flag from oclif.
3
+ * If the input is undefined, return undefined
4
+ * but if the input is empty, throw an error.
5
+ *
6
+ *
7
+ * @param input - The input to parse
8
+ * Throws an error if the input is empty
9
+ */ export async function parseStringFlag(flagName, input) {
10
+ if (input === undefined) {
11
+ return input;
12
+ }
13
+ if (!input) {
14
+ throw new Error(`${flagName} argument is empty`);
15
+ }
16
+ return input;
17
+ }
18
+
19
+ //# sourceMappingURL=parseStringFlag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/util/parseStringFlag.ts"],"sourcesContent":["/**\n * Parses an optional string flag from oclif.\n * If the input is undefined, return undefined\n * but if the input is empty, throw an error.\n *\n *\n * @param input - The input to parse\n * Throws an error if the input is empty\n */\nexport async function parseStringFlag(flagName: string, input?: string) {\n if (input === undefined) {\n return input\n }\n\n if (!input) {\n throw new Error(`${flagName} argument is empty`)\n }\n\n return input\n}\n"],"names":["parseStringFlag","flagName","input","undefined","Error"],"mappings":"AAAA;;;;;;;;CAQC,GACD,OAAO,eAAeA,gBAAgBC,QAAgB,EAAEC,KAAc;IACpE,IAAIA,UAAUC,WAAW;QACvB,OAAOD;IACT;IAEA,IAAI,CAACA,OAAO;QACV,MAAM,IAAIE,MAAM,GAAGH,SAAS,kBAAkB,CAAC;IACjD;IAEA,OAAOC;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli-core",
3
- "version": "0.1.0-alpha.3",
3
+ "version": "0.1.0-alpha.5",
4
4
  "description": "Sanity CLI core package",
5
5
  "keywords": [
6
6
  "sanity",
@@ -13,7 +13,11 @@
13
13
  ],
14
14
  "homepage": "https://github.com/sanity-io/cli",
15
15
  "bugs": "https://github.com/sanity-io/cli/issues",
16
- "repository": "sanity-io/cli",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/sanity-io/cli.git",
19
+ "directory": "packages/@sanity/cli-core"
20
+ },
17
21
  "license": "MIT",
18
22
  "author": "Sanity.io <hello@sanity.io>",
19
23
  "type": "module",
@@ -43,36 +47,35 @@
43
47
  "dependencies": {
44
48
  "@inquirer/prompts": "^8.1.0",
45
49
  "@oclif/core": "^4.8.0",
46
- "@sanity/client": "^7.11.2",
47
- "@sanity/types": "^4.21.0",
50
+ "@sanity/client": "^7.14.0",
51
+ "@sanity/types": "^5.2.0",
48
52
  "babel-plugin-react-compiler": "^1.0.0",
49
53
  "chalk": "^5.6.2",
50
54
  "configstore": "^7.0.0",
51
55
  "debug": "^4.4.3",
52
- "get-tsconfig": "^4.10.1",
56
+ "get-tsconfig": "^4.13.0",
53
57
  "import-meta-resolve": "^4.1.0",
54
- "jsdom": "^26.0.0",
58
+ "jsdom": "^27.4.0",
55
59
  "json-lexer": "^1.2.0",
56
60
  "log-symbols": "^7.0.1",
57
61
  "ora": "^9.0.0",
58
- "tsx": "^4.20.3",
59
- "vite": "^7.1.6",
62
+ "tsx": "^4.21.0",
63
+ "vite": "^7.3.0",
60
64
  "vite-node": "^3.0.8",
61
- "zod": "^3.24.2"
65
+ "zod": "^4.3.5"
62
66
  },
63
67
  "devDependencies": {
64
68
  "@eslint/compat": "^2.0.0",
65
- "@swc/cli": "^0.7.8",
66
- "@swc/core": "^1.14.0",
67
- "@types/configstore": "^6.0.2",
69
+ "@swc/cli": "^0.7.9",
70
+ "@swc/core": "^1.15.8",
68
71
  "@types/debug": "^4.1.12",
69
- "@types/jsdom": "^21.1.7",
70
- "@types/node": "^20.19.24",
71
- "eslint": "^9.39.1",
72
- "typescript": "^5.8.3",
72
+ "@types/jsdom": "^27.0.0",
73
+ "@types/node": "^20.19.27",
74
+ "eslint": "^9.39.2",
75
+ "typescript": "^5.9.3",
73
76
  "vitest": "^3.2.4",
74
- "@repo/eslint-config": "0.0.0",
75
- "@repo/tsconfig": "3.70.0"
77
+ "@repo/tsconfig": "3.70.0",
78
+ "@sanity/eslint-config-cli": "0.0.0-alpha.1"
76
79
  },
77
80
  "engines": {
78
81
  "node": ">=20.19.1 <22 || >=22.12"