@sanity/cli-core 2.8.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +7 -6
  2. package/dist/NonInteractiveError-CSLT5y93.d.ts +13 -0
  3. package/dist/ProjectRootNotFoundError-RgthN9uy.d.ts +47 -0
  4. package/dist/SanityCommand.d.ts +26 -355
  5. package/dist/SanityCommand.js +5 -0
  6. package/dist/SanityCommand.js.map +1 -1
  7. package/dist/_exports/browser.d.ts +2 -21
  8. package/dist/_exports/config.d.ts +5 -661
  9. package/dist/_exports/debug.d.ts +4 -8
  10. package/dist/_exports/debug.js +3 -3
  11. package/dist/_exports/debug.js.map +1 -1
  12. package/dist/_exports/errors.d.ts +12 -77
  13. package/dist/_exports/index.d.ts +34 -1674
  14. package/dist/_exports/package-manager.d.ts +14 -207
  15. package/dist/_exports/request.d.ts +52 -69
  16. package/dist/_exports/request.js +5 -4
  17. package/dist/_exports/request.js.map +1 -1
  18. package/dist/_exports/schemas.d.ts +2 -235
  19. package/dist/_exports/tasks.d.ts +2 -120
  20. package/dist/_exports/telemetry.d.ts +2 -156
  21. package/dist/_exports/types.d.ts +9 -475
  22. package/dist/_exports/undeploy.d.ts +45 -62
  23. package/dist/_exports/undeploy.js +1 -3
  24. package/dist/_exports/undeploy.js.map +1 -1
  25. package/dist/_exports/util.d.ts +6 -137
  26. package/dist/_exports/ux.d.ts +31 -102
  27. package/dist/apiClient-DXlF5ZV3.d.ts +65 -0
  28. package/dist/apiClient.d.ts +2 -79
  29. package/dist/apiClient.js +69 -47
  30. package/dist/apiClient.js.map +1 -1
  31. package/dist/cliConfig-CbW8neMv.d.ts +171 -0
  32. package/dist/errors/enrichAuthError.js +48 -0
  33. package/dist/errors/enrichAuthError.js.map +1 -0
  34. package/dist/errors/getErrorMessage.js +3 -1
  35. package/dist/errors/getErrorMessage.js.map +1 -1
  36. package/dist/executionContext.d.ts +21 -20
  37. package/dist/executionContext.js.map +1 -1
  38. package/dist/exitCodes.d.ts +3 -3
  39. package/dist/findStudioConfigPath-DcKlHhyW.d.ts +265 -0
  40. package/dist/getWorkspace-CU32E6Uo.d.ts +54 -0
  41. package/dist/mockBrowserEnvironment-BjFQPb2W.d.ts +19 -0
  42. package/dist/noopTelemetry-BJRIvASI.d.ts +64 -0
  43. package/dist/readPackageJson-Cr_lbjVR.d.ts +67 -0
  44. package/dist/recursivelyResolveProjectRoot-BE54uEP6.d.ts +18 -0
  45. package/dist/request/createRequester.js +39 -50
  46. package/dist/request/createRequester.js.map +1 -1
  47. package/dist/request/nodeReadableFromWeb.js +64 -0
  48. package/dist/request/nodeReadableFromWeb.js.map +1 -0
  49. package/dist/resolveLocalPackage-Dr-TNTyk.d.ts +78 -0
  50. package/dist/safeStructuredClone-CWB0MXmH.d.ts +58 -0
  51. package/dist/schemas-DRCVXpyW.d.ts +140 -0
  52. package/dist/timer-Dwu2TIgB.d.ts +14 -0
  53. package/dist/tsxWorkerTask-CxG3fWbU.d.ts +97 -0
  54. package/dist/types-CwJLTYDj.d.ts +23 -0
  55. package/dist/types-ZNH3prAd.d.ts +91 -0
  56. package/dist/ux/spinner.js +70 -9
  57. package/dist/ux/spinner.js.map +1 -1
  58. package/dist/workbenchApp-Dhtbsuhn.d.ts +22 -0
  59. package/package.json +7 -8
  60. package/dist/request/createIsolatedRequester.js +0 -75
  61. package/dist/request/createIsolatedRequester.js.map +0 -1
@@ -0,0 +1,140 @@
1
+ import { a as TypeGenConfig, o as UserViteConfig } from "./cliConfig-CbW8neMv.js";
2
+ import { z } from "zod/mini";
3
+ /**
4
+ * @public
5
+ */
6
+ declare const cliConfigSchema: z.ZodMiniObject<{
7
+ api: z.ZodMiniOptional<z.ZodMiniObject<{
8
+ dataset: z.ZodMiniOptional<z.ZodMiniString<string>>;
9
+ projectId: z.ZodMiniOptional<z.ZodMiniString<string>>;
10
+ }, z.core.$strip>>;
11
+ app: z.ZodMiniOptional<z.ZodMiniObject<{
12
+ entry: z.ZodMiniOptional<z.ZodMiniString<string>>;
13
+ icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
14
+ id: z.ZodMiniOptional<z.ZodMiniString<string>>;
15
+ organizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
16
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
17
+ visibility: z.ZodMiniOptional<z.ZodMiniEnum<{
18
+ default: "default";
19
+ unlisted: "unlisted";
20
+ disabled: "disabled";
21
+ }>>;
22
+ }, z.core.$strip>>;
23
+ autoUpdates: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
24
+ deployment: z.ZodMiniOptional<z.ZodMiniObject<{
25
+ appId: z.ZodMiniOptional<z.ZodMiniString<string>>;
26
+ autoUpdates: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
27
+ }, z.core.$strip>>;
28
+ graphql: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
29
+ filterSuffix: z.ZodMiniOptional<z.ZodMiniString<string>>;
30
+ generation: z.ZodMiniOptional<z.ZodMiniEnum<{
31
+ gen1: "gen1";
32
+ gen2: "gen2";
33
+ gen3: "gen3";
34
+ }>>;
35
+ id: z.ZodMiniOptional<z.ZodMiniString<string>>;
36
+ nonNullDocumentFields: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
37
+ playground: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
38
+ source: z.ZodMiniOptional<z.ZodMiniString<string>>;
39
+ tag: z.ZodMiniOptional<z.ZodMiniString<string>>;
40
+ workspace: z.ZodMiniOptional<z.ZodMiniString<string>>;
41
+ }, z.core.$strip>>>;
42
+ mediaLibrary: z.ZodMiniOptional<z.ZodMiniObject<{
43
+ aspectsPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
44
+ }, z.core.$strip>>;
45
+ project: z.ZodMiniOptional<z.ZodMiniObject<{
46
+ basePath: z.ZodMiniOptional<z.ZodMiniString<string>>;
47
+ }, z.core.$strip>>;
48
+ reactCompiler: z.ZodMiniOptional<z.ZodMiniCustom<Partial<{
49
+ environment: Partial<import("babel-plugin-react-compiler").EnvironmentConfig>;
50
+ logger: import("babel-plugin-react-compiler").Logger | null;
51
+ gating: import("babel-plugin-react-compiler").ExternalFunction | null;
52
+ dynamicGating: {
53
+ source: string;
54
+ } | null;
55
+ panicThreshold: "none" | "all_errors" | "critical_errors";
56
+ noEmit: boolean;
57
+ compilationMode: "syntax" | "infer" | "annotation" | "all";
58
+ eslintSuppressionRules: Array<string> | null | undefined;
59
+ flowSuppressions: boolean;
60
+ ignoreUseNoForget: boolean;
61
+ customOptOutDirectives: string[] | null;
62
+ sources: Array<string> | ((filename: string) => boolean) | null;
63
+ enableReanimatedCheck: boolean;
64
+ target: "17" | "18" | "19" | {
65
+ kind: "donotuse_meta_internal";
66
+ runtimeModule: string;
67
+ };
68
+ }>, Partial<{
69
+ environment: Partial<import("babel-plugin-react-compiler").EnvironmentConfig>;
70
+ logger: import("babel-plugin-react-compiler").Logger | null;
71
+ gating: import("babel-plugin-react-compiler").ExternalFunction | null;
72
+ dynamicGating: {
73
+ source: string;
74
+ } | null;
75
+ panicThreshold: "none" | "all_errors" | "critical_errors";
76
+ noEmit: boolean;
77
+ compilationMode: "syntax" | "infer" | "annotation" | "all";
78
+ eslintSuppressionRules: Array<string> | null | undefined;
79
+ flowSuppressions: boolean;
80
+ ignoreUseNoForget: boolean;
81
+ customOptOutDirectives: string[] | null;
82
+ sources: Array<string> | ((filename: string) => boolean) | null;
83
+ enableReanimatedCheck: boolean;
84
+ target: "17" | "18" | "19" | {
85
+ kind: "donotuse_meta_internal";
86
+ runtimeModule: string;
87
+ };
88
+ }>>>;
89
+ reactStrictMode: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
90
+ schemaExtraction: z.ZodMiniOptional<z.ZodMiniObject<{
91
+ enabled: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
92
+ enforceRequiredFields: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
93
+ path: z.ZodMiniOptional<z.ZodMiniString<string>>;
94
+ watchPatterns: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
95
+ workspace: z.ZodMiniOptional<z.ZodMiniString<string>>;
96
+ }, z.core.$strip>>;
97
+ server: z.ZodMiniOptional<z.ZodMiniObject<{
98
+ hostname: z.ZodMiniOptional<z.ZodMiniString<string>>;
99
+ port: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
100
+ }, z.core.$strip>>;
101
+ studioHost: z.ZodMiniOptional<z.ZodMiniString<string>>;
102
+ unstable_bundledDev: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
103
+ vite: z.ZodMiniOptional<z.ZodMiniCustom<UserViteConfig, UserViteConfig>>;
104
+ typegen: z.ZodMiniOptional<z.ZodMiniCustom<Partial<TypeGenConfig> & {
105
+ enabled?: boolean;
106
+ }, Partial<TypeGenConfig> & {
107
+ enabled?: boolean;
108
+ }>>;
109
+ }, z.core.$strip>;
110
+ /**
111
+ * Studio/app manifest schemas. They live in cli-core because more than one
112
+ * package validates manifests: the CLI extracts and writes them, and the
113
+ * workbench dev-server registry stores and rebroadcasts them. Keeping the
114
+ * contract here lets both validate against the same schema without depending on
115
+ * each other.
116
+ */
117
+ /**
118
+ * Core-app application manifest. Mirrors the workbench's
119
+ * `CoreAppUserApplicationManifest` schema. Strictly validated via zod since the
120
+ * CLI produces the payload in full.
121
+ */
122
+ declare const coreAppManifestSchema: z.ZodMiniObject<{
123
+ group: z.ZodMiniOptional<z.ZodMiniString<string>>;
124
+ icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
125
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
126
+ slug: z.ZodMiniOptional<z.ZodMiniString<string>>;
127
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
128
+ version: z.ZodMiniString<string>;
129
+ }, z.core.$strip>;
130
+ type CoreAppManifest = z.infer<typeof coreAppManifestSchema>;
131
+ /**
132
+ * Studio application manifest (serialized `create-manifest.json`). Kept loose so
133
+ * the CLI isn't coupled to the workbench's evolving client-side schema — the
134
+ * workbench consumer is authoritative on the inner shape. See its
135
+ * `ClientManifest` for the fields clients expect.
136
+ */
137
+ declare const studioManifestSchema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
138
+ type StudioManifest = z.infer<typeof studioManifestSchema>;
139
+ export { cliConfigSchema as a, studioManifestSchema as i, StudioManifest as n, coreAppManifestSchema as r, CoreAppManifest as t };
140
+ //# sourceMappingURL=schemas-DRCVXpyW.d.ts.map
@@ -0,0 +1,14 @@
1
+ declare function colorizeJson(input: unknown): string;
2
+ interface TimeMeasurer {
3
+ end: (name: string) => number;
4
+ getTimings: () => Record<string, number>;
5
+ start: (name: string) => void;
6
+ }
7
+ /**
8
+ * Starts a terminal timer
9
+ *
10
+ * @internal
11
+ */
12
+ declare function getTimer(): TimeMeasurer;
13
+ export { colorizeJson as n, getTimer as t };
14
+ //# sourceMappingURL=timer-Dwu2TIgB.d.ts.map
@@ -0,0 +1,97 @@
1
+ import { n as RequireProps } from "./types-CwJLTYDj.js";
2
+ import { Worker, WorkerOptions } from "node:worker_threads";
3
+ import { URL as URL$1 } from "node:url";
4
+ /**
5
+ * Options for the studio worker task
6
+ *
7
+ * @internal
8
+ */
9
+ interface StudioWorkerTaskOptions extends RequireProps<WorkerOptions, 'name'> {
10
+ studioRootPath: string;
11
+ /** Optional timeout in milliseconds. If the worker does not respond within this time, the promise is rejected. */
12
+ timeout?: number;
13
+ }
14
+ /**
15
+ * Executes a worker file in a Sanity Studio browser context.
16
+ *
17
+ * This uses a combination of vite for "bundling" + jsdom for emulating a browser
18
+ * environment under the hood, which means that the same thing that will work in vite
19
+ * _should_ work in the worker - to a degree. If the user has defined any typescript
20
+ * path aliases, these will have to be added as aliases to the vite config - the same
21
+ * behavior as you would see with regular vite. Other things that are accounted for:
22
+ *
23
+ * - TypeScript support (+JSX, enums and other "compilation needed" features)
24
+ * - CSS, font and other file imports will resolve to a file path
25
+ * - CSS module imports will resolve to a javascript object of class names
26
+ * - Environment variables are available both as `import.meta.env` and `process.env`,
27
+ * and `.env` files are loaded in the same way that they would in a Sanity studio.
28
+ * - Browser globals not available in a Node.js environment but _are_ provided by JSDOM
29
+ * are defined directly to the Node environment as globals. While this polutes the
30
+ * global namespace, it is done only in the worker thread.
31
+ * - Certain browser globals that are _not_ available in JSDOM are also provided to the
32
+ * global namespace - things like `requestIdleCallback`, `IntersectionObserver` etc.
33
+ * These are provided with a minimal stub implementation to make them not crash.
34
+ *
35
+ * @param filePath - Path to the worker file (`.ts` works and is encouraged)
36
+ * @param options - Options to pass to the worker
37
+ * @returns A promise that resolves with the message from the worker
38
+ * @throws If the file does not exist
39
+ * @throws If the worker exits with a non-zero code
40
+ * @internal
41
+ */
42
+ declare function studioWorkerTask<T = unknown>(filePath: URL, options: StudioWorkerTaskOptions): Promise<T>;
43
+ /**
44
+ * Creates a new worker for a studio worker task.
45
+ *
46
+ * This uses a combination of vite for "bundling" + jsdom for emulating a browser
47
+ * environment under the hood, which means that the same thing that will work in vite
48
+ * _should_ work in the worker - to a degree. If the user has defined any typescript
49
+ * path aliases, these will have to be added as aliases to the vite config - the same
50
+ * behavior as you would see with regular vite. Other things that are accounted for:
51
+ *
52
+ * - TypeScript support (+JSX, enums and other "compilation needed" features)
53
+ * - CSS, font and other file imports will resolve to a file path
54
+ * - CSS module imports will resolve to a javascript object of class names
55
+ * - Environment variables are available both as `import.meta.env` and `process.env`,
56
+ * and `.env` files are loaded in the same way that they would in a Sanity studio.
57
+ * - Browser globals not available in a Node.js environment but _are_ provided by JSDOM
58
+ * are defined directly to the Node environment as globals. While this polutes the
59
+ * global namespace, it is done only in the worker thread.
60
+ * - Certain browser globals that are _not_ available in JSDOM are also provided to the
61
+ * global namespace - things like `requestIdleCallback`, `IntersectionObserver` etc.
62
+ * These are provided with a minimal stub implementation to make them not crash.
63
+ *
64
+ * @param filePath - Path to the worker file (`.ts` works and is encouraged)
65
+ * @param options - Options to pass to the worker
66
+ * @returns A promise that resolves with the message from the worker
67
+ * @throws If the file does not exist
68
+ * @throws If the worker exits with a non-zero code
69
+ * @internal
70
+ */
71
+ declare function createStudioWorker(filePath: URL, options: StudioWorkerTaskOptions): Worker;
72
+ /**
73
+ * Options for the tsx worker task
74
+ *
75
+ * @internal
76
+ */
77
+ interface TsxWorkerTaskOptions extends RequireProps<WorkerOptions, 'name'> {
78
+ rootPath: string;
79
+ }
80
+ /**
81
+ * Executes a worker file with tsx registered. This means you can import other
82
+ * typescript with fairly rich syntax, and still have that only apply to the worker
83
+ * thread instead of the full parent process. The worker should emit a message when
84
+ * complete using `parentPort`. Once it has received a single message will resolve the
85
+ * returned promise with that message. If you are expecting multiple messages, you will
86
+ * have to implement another method ;)
87
+ *
88
+ * @param filePath - Path to the worker file
89
+ * @param options - Options to pass to the worker
90
+ * @returns A promise that resolves with the message from the worker
91
+ * @throws If the file does not exist
92
+ * @throws If the worker exits with a non-zero code
93
+ * @internal
94
+ */
95
+ declare function tsxWorkerTask<T = unknown>(filePath: URL$1, options: TsxWorkerTaskOptions): Promise<T>;
96
+ export { createStudioWorker as n, studioWorkerTask as r, tsxWorkerTask as t };
97
+ //# sourceMappingURL=tsxWorkerTask-CxG3fWbU.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { Command } from "@oclif/core";
2
+ interface Output {
3
+ error: Command['error'];
4
+ log: Command['log'];
5
+ warn: Command['warn'];
6
+ }
7
+ type RequireProps<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
8
+ type SanityOrgUser = {
9
+ /**
10
+ * Null when authenticating with an API token rather than a user account —
11
+ * robot tokens resolve to a user whose `email` and `familyName` are null.
12
+ * Use `getUserDisplayName()` for anything user-facing.
13
+ */
14
+ email: string | null;
15
+ id: string;
16
+ name: string;
17
+ profileImage?: string;
18
+ /** `sanity-token` is returned when authenticating with an API token. */
19
+ provider: 'github' | 'google' | 'sanity' | 'sanity-token' | `saml-${string}`;
20
+ tosAcceptedAt?: string;
21
+ };
22
+ export { RequireProps as n, SanityOrgUser as r, Output as t };
23
+ //# sourceMappingURL=types-CwJLTYDj.d.ts.map
@@ -0,0 +1,91 @@
1
+ /**
2
+ * 'unknown' - we don't know if the user has consented or not (e.g. something went wrong)
3
+ * 'unset' - the user has not yet been asked for consent
4
+ * 'granted' - the user has consented
5
+ * 'denied' - the user has denied consent
6
+ */
7
+ declare type ConsentStatus = 'undetermined' | 'unset' | 'granted' | 'denied';
8
+ declare interface DeferredEvent<Data = unknown, Event extends DefinedTelemetryLog<Data> = DefinedTelemetryLog<Data>> {
9
+ createdAt: string;
10
+ event: Event;
11
+ data: Data;
12
+ }
13
+ declare interface DefinedTelemetryLog<Schema> {
14
+ type: 'log';
15
+ /** Unique name of the event */
16
+ name: string;
17
+ /** Event version. Increment this by 1 whenever the shape of the data changes in a non-backwards compatible way */
18
+ version: number;
19
+ /** Description of log event */
20
+ description?: string;
21
+ /**
22
+ * Max sample rate of this event.
23
+ * Calling telemetry.log(EventDefinition, data) repeatedly will submit at most one event every specified time interval (in milliseconds)
24
+ * */
25
+ maxSampleRate?: number;
26
+ /** Data schema. Will not be accessible at runtime */
27
+ schema: Schema;
28
+ }
29
+ declare interface DefinedTelemetryTrace<Data = void, Context = void> {
30
+ type: 'trace';
31
+ /** Unique name of the trace */
32
+ name: string;
33
+ /** Trace version. Increment this by 1 whenever the shape of the data changes in a non-backwards compatible way */
34
+ version: number;
35
+ /** Description of trace */
36
+ description?: string;
37
+ /** Data schema. Will not be accessible at runtime */
38
+ schema: Data;
39
+ /** Contextual data schema. Will not be accessible at runtime */
40
+ context: Context;
41
+ }
42
+ /**
43
+ * Note that `sessionId` is removed from the signature of these functions
44
+ */
45
+ declare interface TelemetryLogger<UserProperties> {
46
+ updateUserProperties(properties: UserProperties): void;
47
+ resume(events: DeferredEvent[]): void;
48
+ log<Data>(event: DefinedTelemetryLog<Data>, data: Data): void;
49
+ log<Data extends void>(event: DefinedTelemetryLog<Data>): void;
50
+ trace<Data>(event: DefinedTelemetryTrace<Data>, context?: unknown): TelemetryTrace<UserProperties, Data>;
51
+ }
52
+ declare interface TelemetryTrace<UserProperties, Data> {
53
+ start(): void;
54
+ log(data: Data): void;
55
+ error(error: Error): void;
56
+ complete(): void;
57
+ newContext(name: string): TelemetryLogger<UserProperties>;
58
+ await<P extends Promise<Data>>(promise: P): P;
59
+ await<P extends Promise<unknown>>(promise: P, finalData: Data): P;
60
+ }
61
+ type ConsentInformation = {
62
+ reason: 'fetchError' | 'unauthenticated';
63
+ status: Extract<ConsentStatus, 'undetermined'>;
64
+ } | {
65
+ reason?: 'localOverride';
66
+ status: Extract<ConsentStatus, 'denied'>;
67
+ } | {
68
+ reason?: never;
69
+ status: Extract<ConsentStatus, 'granted'>;
70
+ } | {
71
+ reason?: never;
72
+ status: Extract<ConsentStatus, 'unset'>;
73
+ };
74
+ /**
75
+ * @public
76
+ */
77
+ interface TelemetryUserProperties {
78
+ cliVersion: string;
79
+ cpuArchitecture: string;
80
+ machinePlatform: string;
81
+ runtime: string;
82
+ runtimeVersion: string;
83
+ dataset?: string;
84
+ projectId?: string;
85
+ }
86
+ /**
87
+ * @public
88
+ */
89
+ type CLITelemetryStore = TelemetryLogger<TelemetryUserProperties>;
90
+ export { ConsentInformation as n, TelemetryUserProperties as r, CLITelemetryStore as t };
91
+ //# sourceMappingURL=types-ZNH3prAd.d.ts.map
@@ -1,21 +1,82 @@
1
1
  import ora, { oraPromise } from 'ora';
2
2
  import { getCliExecutionContext } from '../executionContext.js';
3
- function silentSpinner(options) {
3
+ /**
4
+ * Uncolored counterparts of the `log-symbols` glyphs a real spinner persists
5
+ * with. Lines forwarded to an execution context are handed to the embedding
6
+ * host verbatim, so they should not carry ANSI codes the host has to strip.
7
+ */ const persistSymbols = {
8
+ error: '✖',
9
+ info: 'ℹ',
10
+ success: '✔',
11
+ warning: '⚠'
12
+ };
13
+ function resolveAffix(value1) {
14
+ const resolved = typeof value1 === 'function' ? value1() : value1;
15
+ return typeof resolved === 'string' ? resolved : '';
16
+ }
17
+ /**
18
+ * Stand-in for a real spinner, used when a CLI execution context is active.
19
+ *
20
+ * Frame animation and transient text updates have nowhere useful to go, so they
21
+ * are dropped. The lines a spinner *persists* (`succeed`, `fail`, `warn`,
22
+ * `info`, `stopAndPersist`) are the command's actual output rather than
23
+ * progress, so they are forwarded to the context's sink instead of being
24
+ * swallowed. Ora writes to `process.stderr` by default, so the `stderr` sink is
25
+ * preferred, falling back to `stdout`.
26
+ */ function silentSpinner(options) {
27
+ const resolved = typeof options === 'string' ? {
28
+ text: options
29
+ } : options ?? {};
30
+ const context = getCliExecutionContext();
31
+ const emit = resolved.isSilent ? undefined : context?.stderr ?? context?.stdout;
32
+ const prefixText = resolveAffix(resolved.prefixText);
33
+ const suffixText = resolveAffix(resolved.suffixText);
34
+ const state = {
35
+ text: resolved.text ?? ''
36
+ };
37
+ const persist = (symbol, text)=>{
38
+ if (!emit) return;
39
+ // Mirrors ora's own line layout, minus the trailing whitespace it leaves
40
+ // behind when only one of the symbol and the text is present.
41
+ const body = text ?? state.text;
42
+ const line = (prefixText ? `${prefixText} ` : '') + symbol + (symbol && body ? ` ${body}` : body) + (suffixText ? ` ${suffixText}` : '');
43
+ if (line.trim() !== '') emit(line);
44
+ };
4
45
  const instance = {
5
46
  clear: ()=>instance,
6
- fail: ()=>instance,
47
+ fail: (text)=>{
48
+ persist(persistSymbols.error, text);
49
+ return instance;
50
+ },
7
51
  frame: ()=>'',
8
- info: ()=>instance,
52
+ info: (text)=>{
53
+ persist(persistSymbols.info, text);
54
+ return instance;
55
+ },
9
56
  isSpinning: false,
10
- prefixText: typeof options === 'object' ? options.prefixText ?? '' : '',
57
+ prefixText,
11
58
  render: ()=>instance,
12
59
  start: ()=>instance,
13
60
  stop: ()=>instance,
14
- stopAndPersist: ()=>instance,
15
- succeed: ()=>instance,
16
- suffixText: typeof options === 'object' ? options.suffixText ?? '' : '',
17
- text: typeof options === 'string' ? options : options?.text ?? '',
18
- warn: ()=>instance
61
+ stopAndPersist: (persistOptions = {})=>{
62
+ persist(persistOptions.symbol ?? '', persistOptions.text);
63
+ return instance;
64
+ },
65
+ succeed: (text)=>{
66
+ persist(persistSymbols.success, text);
67
+ return instance;
68
+ },
69
+ suffixText,
70
+ get text () {
71
+ return state.text;
72
+ },
73
+ set text (value){
74
+ state.text = value;
75
+ },
76
+ warn: (text)=>{
77
+ persist(persistSymbols.warning, text);
78
+ return instance;
79
+ }
19
80
  };
20
81
  return instance;
21
82
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ux/spinner.ts"],"sourcesContent":["import ora, {\n type Options,\n type Ora,\n oraPromise,\n type Spinner as OraSpinner,\n type PromiseOptions,\n} from 'ora'\n\nimport {getCliExecutionContext} from '../executionContext.js'\n\nfunction silentSpinner(options?: Options | string): Ora {\n const instance = {\n clear: () => instance,\n fail: () => instance,\n frame: () => '',\n info: () => instance,\n isSpinning: false,\n prefixText: typeof options === 'object' ? (options.prefixText ?? '') : '',\n render: () => instance,\n start: () => instance,\n stop: () => instance,\n stopAndPersist: () => instance,\n succeed: () => instance,\n suffixText: typeof options === 'object' ? (options.suffixText ?? '') : '',\n text: typeof options === 'string' ? options : (options?.text ?? ''),\n warn: () => instance,\n }\n return instance as unknown as Ora\n}\n\nexport function spinner(options?: Options | string): Ora {\n return getCliExecutionContext() ? silentSpinner(options) : ora(options)\n}\n\nexport function spinnerPromise<T>(\n action: ((instance: Ora) => PromiseLike<T>) | PromiseLike<T>,\n options?: PromiseOptions<T> | string,\n): Promise<T> {\n if (!getCliExecutionContext()) return oraPromise(action, options)\n return Promise.resolve(typeof action === 'function' ? action(silentSpinner(options)) : action)\n}\n\nexport type Spinner = OraSpinner\nexport type SpinnerInstance = Ora\nexport type SpinnerOptions = Options\nexport type SpinnerPromiseOptions<T> = PromiseOptions<T>\n"],"names":["ora","oraPromise","getCliExecutionContext","silentSpinner","options","instance","clear","fail","frame","info","isSpinning","prefixText","render","start","stop","stopAndPersist","succeed","suffixText","text","warn","spinner","spinnerPromise","action","Promise","resolve"],"mappings":"AAAA,OAAOA,OAGLC,UAAU,QAGL,MAAK;AAEZ,SAAQC,sBAAsB,QAAO,yBAAwB;AAE7D,SAASC,cAAcC,OAA0B;IAC/C,MAAMC,WAAW;QACfC,OAAO,IAAMD;QACbE,MAAM,IAAMF;QACZG,OAAO,IAAM;QACbC,MAAM,IAAMJ;QACZK,YAAY;QACZC,YAAY,OAAOP,YAAY,WAAYA,QAAQO,UAAU,IAAI,KAAM;QACvEC,QAAQ,IAAMP;QACdQ,OAAO,IAAMR;QACbS,MAAM,IAAMT;QACZU,gBAAgB,IAAMV;QACtBW,SAAS,IAAMX;QACfY,YAAY,OAAOb,YAAY,WAAYA,QAAQa,UAAU,IAAI,KAAM;QACvEC,MAAM,OAAOd,YAAY,WAAWA,UAAWA,SAASc,QAAQ;QAChEC,MAAM,IAAMd;IACd;IACA,OAAOA;AACT;AAEA,OAAO,SAASe,QAAQhB,OAA0B;IAChD,OAAOF,2BAA2BC,cAAcC,WAAWJ,IAAII;AACjE;AAEA,OAAO,SAASiB,eACdC,MAA4D,EAC5DlB,OAAoC;IAEpC,IAAI,CAACF,0BAA0B,OAAOD,WAAWqB,QAAQlB;IACzD,OAAOmB,QAAQC,OAAO,CAAC,OAAOF,WAAW,aAAaA,OAAOnB,cAAcC,YAAYkB;AACzF"}
1
+ {"version":3,"sources":["../../src/ux/spinner.ts"],"sourcesContent":["import ora, {\n type Options,\n type Ora,\n oraPromise,\n type Spinner as OraSpinner,\n type PersistOptions,\n type PromiseOptions,\n} from 'ora'\n\nimport {getCliExecutionContext} from '../executionContext.js'\n\n/**\n * Uncolored counterparts of the `log-symbols` glyphs a real spinner persists\n * with. Lines forwarded to an execution context are handed to the embedding\n * host verbatim, so they should not carry ANSI codes the host has to strip.\n */\nconst persistSymbols = {\n error: '✖',\n info: 'ℹ',\n success: '✔',\n warning: '⚠',\n}\n\nfunction resolveAffix(value: Options['prefixText'] | Options['suffixText']): string {\n const resolved = typeof value === 'function' ? value() : value\n return typeof resolved === 'string' ? resolved : ''\n}\n\n/**\n * Stand-in for a real spinner, used when a CLI execution context is active.\n *\n * Frame animation and transient text updates have nowhere useful to go, so they\n * are dropped. The lines a spinner *persists* (`succeed`, `fail`, `warn`,\n * `info`, `stopAndPersist`) are the command's actual output rather than\n * progress, so they are forwarded to the context's sink instead of being\n * swallowed. Ora writes to `process.stderr` by default, so the `stderr` sink is\n * preferred, falling back to `stdout`.\n */\nfunction silentSpinner(options?: Options | string): Ora {\n const resolved = typeof options === 'string' ? {text: options} : (options ?? {})\n const context = getCliExecutionContext()\n const emit = resolved.isSilent ? undefined : (context?.stderr ?? context?.stdout)\n\n const prefixText = resolveAffix(resolved.prefixText)\n const suffixText = resolveAffix(resolved.suffixText)\n const state = {text: resolved.text ?? ''}\n\n const persist = (symbol: string, text?: string): void => {\n if (!emit) return\n\n // Mirrors ora's own line layout, minus the trailing whitespace it leaves\n // behind when only one of the symbol and the text is present.\n const body = text ?? state.text\n const line =\n (prefixText ? `${prefixText} ` : '') +\n symbol +\n (symbol && body ? ` ${body}` : body) +\n (suffixText ? ` ${suffixText}` : '')\n\n if (line.trim() !== '') emit(line)\n }\n\n const instance = {\n clear: () => instance,\n fail: (text?: string) => {\n persist(persistSymbols.error, text)\n return instance\n },\n frame: () => '',\n info: (text?: string) => {\n persist(persistSymbols.info, text)\n return instance\n },\n isSpinning: false,\n prefixText,\n render: () => instance,\n start: () => instance,\n stop: () => instance,\n stopAndPersist: (persistOptions: PersistOptions = {}) => {\n persist(persistOptions.symbol ?? '', persistOptions.text)\n return instance\n },\n succeed: (text?: string) => {\n persist(persistSymbols.success, text)\n return instance\n },\n suffixText,\n get text(): string {\n return state.text\n },\n set text(value: string) {\n state.text = value\n },\n warn: (text?: string) => {\n persist(persistSymbols.warning, text)\n return instance\n },\n }\n return instance as unknown as Ora\n}\n\nexport function spinner(options?: Options | string): Ora {\n return getCliExecutionContext() ? silentSpinner(options) : ora(options)\n}\n\nexport function spinnerPromise<T>(\n action: ((instance: Ora) => PromiseLike<T>) | PromiseLike<T>,\n options?: PromiseOptions<T> | string,\n): Promise<T> {\n if (!getCliExecutionContext()) return oraPromise(action, options)\n return Promise.resolve(typeof action === 'function' ? action(silentSpinner(options)) : action)\n}\n\nexport type Spinner = OraSpinner\nexport type SpinnerInstance = Ora\nexport type SpinnerOptions = Options\nexport type SpinnerPromiseOptions<T> = PromiseOptions<T>\n"],"names":["ora","oraPromise","getCliExecutionContext","persistSymbols","error","info","success","warning","resolveAffix","value","resolved","silentSpinner","options","text","context","emit","isSilent","undefined","stderr","stdout","prefixText","suffixText","state","persist","symbol","body","line","trim","instance","clear","fail","frame","isSpinning","render","start","stop","stopAndPersist","persistOptions","succeed","warn","spinner","spinnerPromise","action","Promise","resolve"],"mappings":"AAAA,OAAOA,OAGLC,UAAU,QAIL,MAAK;AAEZ,SAAQC,sBAAsB,QAAO,yBAAwB;AAE7D;;;;CAIC,GACD,MAAMC,iBAAiB;IACrBC,OAAO;IACPC,MAAM;IACNC,SAAS;IACTC,SAAS;AACX;AAEA,SAASC,aAAaC,MAAoD;IACxE,MAAMC,WAAW,OAAOD,WAAU,aAAaA,WAAUA;IACzD,OAAO,OAAOC,aAAa,WAAWA,WAAW;AACnD;AAEA;;;;;;;;;CASC,GACD,SAASC,cAAcC,OAA0B;IAC/C,MAAMF,WAAW,OAAOE,YAAY,WAAW;QAACC,MAAMD;IAAO,IAAKA,WAAW,CAAC;IAC9E,MAAME,UAAUZ;IAChB,MAAMa,OAAOL,SAASM,QAAQ,GAAGC,YAAaH,SAASI,UAAUJ,SAASK;IAE1E,MAAMC,aAAaZ,aAAaE,SAASU,UAAU;IACnD,MAAMC,aAAab,aAAaE,SAASW,UAAU;IACnD,MAAMC,QAAQ;QAACT,MAAMH,SAASG,IAAI,IAAI;IAAE;IAExC,MAAMU,UAAU,CAACC,QAAgBX;QAC/B,IAAI,CAACE,MAAM;QAEX,yEAAyE;QACzE,8DAA8D;QAC9D,MAAMU,OAAOZ,QAAQS,MAAMT,IAAI;QAC/B,MAAMa,OACJ,AAACN,CAAAA,aAAa,GAAGA,WAAW,CAAC,CAAC,GAAG,EAAC,IAClCI,SACCA,CAAAA,UAAUC,OAAO,CAAC,CAAC,EAAEA,MAAM,GAAGA,IAAG,IACjCJ,CAAAA,aAAa,CAAC,CAAC,EAAEA,YAAY,GAAG,EAAC;QAEpC,IAAIK,KAAKC,IAAI,OAAO,IAAIZ,KAAKW;IAC/B;IAEA,MAAME,WAAW;QACfC,OAAO,IAAMD;QACbE,MAAM,CAACjB;YACLU,QAAQpB,eAAeC,KAAK,EAAES;YAC9B,OAAOe;QACT;QACAG,OAAO,IAAM;QACb1B,MAAM,CAACQ;YACLU,QAAQpB,eAAeE,IAAI,EAAEQ;YAC7B,OAAOe;QACT;QACAI,YAAY;QACZZ;QACAa,QAAQ,IAAML;QACdM,OAAO,IAAMN;QACbO,MAAM,IAAMP;QACZQ,gBAAgB,CAACC,iBAAiC,CAAC,CAAC;YAClDd,QAAQc,eAAeb,MAAM,IAAI,IAAIa,eAAexB,IAAI;YACxD,OAAOe;QACT;QACAU,SAAS,CAACzB;YACRU,QAAQpB,eAAeG,OAAO,EAAEO;YAChC,OAAOe;QACT;QACAP;QACA,IAAIR,QAAe;YACjB,OAAOS,MAAMT,IAAI;QACnB;QACA,IAAIA,MAAKJ,MAAe;YACtBa,MAAMT,IAAI,GAAGJ;QACf;QACA8B,MAAM,CAAC1B;YACLU,QAAQpB,eAAeI,OAAO,EAAEM;YAChC,OAAOe;QACT;IACF;IACA,OAAOA;AACT;AAEA,OAAO,SAASY,QAAQ5B,OAA0B;IAChD,OAAOV,2BAA2BS,cAAcC,WAAWZ,IAAIY;AACjE;AAEA,OAAO,SAAS6B,eACdC,MAA4D,EAC5D9B,OAAoC;IAEpC,IAAI,CAACV,0BAA0B,OAAOD,WAAWyC,QAAQ9B;IACzD,OAAO+B,QAAQC,OAAO,CAAC,OAAOF,WAAW,aAAaA,OAAO/B,cAAcC,YAAY8B;AACzF"}
@@ -0,0 +1,22 @@
1
+ import { r as CliConfig } from "./cliConfig-CbW8neMv.js";
2
+ /**
3
+ * Boolean brand check — used for config-load routing, kept exported for
4
+ * backward compatibility. For the typed narrowing (the app's declared fields),
5
+ * use `isWorkbenchApp` from `@sanity/workbench-cli`, derived from the schema.
6
+ */
7
+ declare function isWorkbenchApp(app: CliConfig['app']): boolean;
8
+ declare const APPLICATION_TYPES: readonly ["coreApp", "studio", "canvas", "dashboard", "media-library"];
9
+ /** The resolved kind of a workbench app — `studio` or one of the SDK app types. */
10
+ type ApplicationType = (typeof APPLICATION_TYPES)[number];
11
+ /**
12
+ * Parse a config whose `app` is a branded `unstable_defineApp(...)` result. The
13
+ * branded `app` bypasses the legacy `app` schema (which would strip its identity
14
+ * fields and the brand); every other field is still validated.
15
+ *
16
+ * Resolves `applicationType` once, here, so studio-vs-app is settled everywhere
17
+ * downstream. The value lands on a clone, never the caller's object, so
18
+ * re-parsing the same `app` for another directory can't inherit a stale guess.
19
+ */
20
+ declare function parseWorkbenchCliConfig(cliConfig: unknown, projectDir: string): CliConfig;
21
+ export { isWorkbenchApp as n, parseWorkbenchCliConfig as r, ApplicationType as t };
22
+ //# sourceMappingURL=workbenchApp-Dhtbsuhn.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli-core",
3
- "version": "2.8.1",
3
+ "version": "3.1.0",
4
4
  "description": "Sanity CLI core package",
5
5
  "keywords": [
6
6
  "cli",
@@ -109,32 +109,31 @@
109
109
  "dependencies": {
110
110
  "@inquirer/prompts": "^8.5.2",
111
111
  "@oclif/core": "^4.11.14",
112
- "@sanity/client": "^7.25.0",
112
+ "@sanity/client": "^8.1.0",
113
113
  "boxen": "^8.0.1",
114
- "debug": "^4.4.3",
115
114
  "empathic": "^2.0.1",
116
- "get-it": "^8.8.0",
115
+ "get-it": "^9.5.0",
117
116
  "get-tsconfig": "^4.14.0",
118
117
  "import-meta-resolve": "^4.2.0",
119
118
  "jiti": "^2.7.0",
120
119
  "jsdom": "^29.1.1",
121
120
  "json-lexer": "^1.2.0",
122
121
  "log-symbols": "^7.0.1",
122
+ "obug": "^2.1.4",
123
123
  "ora": "^9.0.0",
124
124
  "rxjs": "^7.8.2",
125
- "tsx": "^4.23.1",
126
- "vite": "^8.2.0",
125
+ "tsx": "^4.23.12",
126
+ "vite": "^8.2.1",
127
127
  "vite-node": "^6.0.0",
128
128
  "wrap-ansi": "^9.0.2",
129
129
  "zod": "^4.4.3"
130
130
  },
131
131
  "devDependencies": {
132
132
  "@eslint/compat": "^2.1.0",
133
- "@sanity/pkg-utils": "^11.0.17",
133
+ "@sanity/pkg-utils": "^12.1.2",
134
134
  "@sanity/telemetry": "^1.1.0",
135
135
  "@swc/cli": "^0.8.1",
136
136
  "@swc/core": "^1.15.43",
137
- "@types/debug": "^4.1.13",
138
137
  "@types/jsdom": "^28.0.3",
139
138
  "@types/node": "^22.20.0",
140
139
  "babel-plugin-react-compiler": "^1.0.0",
@@ -1,75 +0,0 @@
1
- import { createRequire } from 'node:module';
2
- import { ClientError, isHttpError, ServerError } from '@sanity/client';
3
- import { getIt } from 'get-it';
4
- import { agent, headers, jsonRequest, jsonResponse, observable, progress, retry } from 'get-it/middleware';
5
- import { Observable } from 'rxjs';
6
- const requireFromHere = createRequire(import.meta.url);
7
- const clientPackage = requireFromHere('@sanity/client/package.json');
8
- const clientVersion = typeof clientPackage === 'object' && clientPackage !== null && 'version' in clientPackage && typeof clientPackage.version === 'string' ? clientPackage.version : 'unknown';
9
- /**
10
- * Create the requester used by Sanity clients inside a CLI execution context.
11
- *
12
- * This mirrors the Node requester from `@sanity/client`, except that it has no
13
- * debug or lineage middleware. The client requester's defaults cannot be
14
- * safely reused here because they read `DEBUG` and `X_SANITY_LINEAGE` from the
15
- * embedding process.
16
- */ export function createIsolatedRequester() {
17
- return getIt([
18
- retry({
19
- shouldRetry
20
- }),
21
- headers({
22
- 'User-Agent': `@sanity/client ${clientVersion}`
23
- }),
24
- removeLineage(),
25
- agent({
26
- keepAlive: true,
27
- maxSockets: 30,
28
- maxTotalSockets: 256
29
- }),
30
- jsonRequest(),
31
- jsonResponse(),
32
- progress(),
33
- httpErrors,
34
- observable({
35
- implementation: Observable
36
- })
37
- ]);
38
- }
39
- function removeLineage() {
40
- return {
41
- processOptions (options) {
42
- const requestHeaders = {
43
- ...options.headers
44
- };
45
- for (const name of Object.keys(requestHeaders)){
46
- if (name.toLowerCase() === 'x-sanity-lineage') delete requestHeaders[name];
47
- }
48
- return {
49
- ...options,
50
- headers: requestHeaders
51
- };
52
- }
53
- };
54
- }
55
- const httpErrors = {
56
- onResponse (response, context) {
57
- if (response.statusCode >= 500) throw new ServerError(response);
58
- if (response.statusCode >= 400) throw new ClientError(response, context);
59
- return response;
60
- }
61
- };
62
- function shouldRetry(error, attempt, options) {
63
- if (options.maxRetries === 0) return false;
64
- const isSafe = options.method === 'GET' || options.method === 'HEAD';
65
- const uri = 'uri' in options && typeof options.uri === 'string' ? options.uri : options.url;
66
- const isQuery = uri.startsWith('/data/query');
67
- const isRetriableResponse = isHttpError(error) && [
68
- 429,
69
- 502,
70
- 503
71
- ].includes(error.response.statusCode);
72
- return (isSafe || isQuery) && isRetriableResponse ? true : retry.shouldRetry(error, attempt, options);
73
- }
74
-
75
- //# sourceMappingURL=createIsolatedRequester.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/request/createIsolatedRequester.ts"],"sourcesContent":["import {createRequire} from 'node:module'\n\nimport {ClientError, isHttpError, ServerError} from '@sanity/client'\nimport {getIt, type HttpContext, type Middleware, type Requester, type RequestOptions} from 'get-it'\nimport {\n agent,\n headers,\n jsonRequest,\n jsonResponse,\n observable,\n progress,\n retry,\n} from 'get-it/middleware'\nimport {Observable} from 'rxjs'\n\nconst requireFromHere = createRequire(import.meta.url)\nconst clientPackage: unknown = requireFromHere('@sanity/client/package.json')\nconst clientVersion =\n typeof clientPackage === 'object' &&\n clientPackage !== null &&\n 'version' in clientPackage &&\n typeof clientPackage.version === 'string'\n ? clientPackage.version\n : 'unknown'\n\n/**\n * Create the requester used by Sanity clients inside a CLI execution context.\n *\n * This mirrors the Node requester from `@sanity/client`, except that it has no\n * debug or lineage middleware. The client requester's defaults cannot be\n * safely reused here because they read `DEBUG` and `X_SANITY_LINEAGE` from the\n * embedding process.\n */\nexport function createIsolatedRequester(): Requester {\n return getIt([\n retry({shouldRetry}),\n headers({'User-Agent': `@sanity/client ${clientVersion}`}),\n removeLineage(),\n agent({keepAlive: true, maxSockets: 30, maxTotalSockets: 256}),\n jsonRequest(),\n jsonResponse(),\n progress(),\n httpErrors,\n observable({implementation: Observable}),\n ])\n}\n\nfunction removeLineage(): Middleware {\n return {\n processOptions(options: RequestOptions) {\n const requestHeaders = {...options.headers}\n for (const name of Object.keys(requestHeaders)) {\n if (name.toLowerCase() === 'x-sanity-lineage') delete requestHeaders[name]\n }\n return {...options, headers: requestHeaders}\n },\n }\n}\n\nconst httpErrors: Middleware = {\n onResponse(response, context: HttpContext) {\n if (response.statusCode >= 500) throw new ServerError(response)\n if (response.statusCode >= 400) throw new ClientError(response, context)\n return response\n },\n}\n\nfunction shouldRetry(error: unknown, attempt: number, options: RequestOptions): boolean {\n if (options.maxRetries === 0) return false\n\n const isSafe = options.method === 'GET' || options.method === 'HEAD'\n const uri = 'uri' in options && typeof options.uri === 'string' ? options.uri : options.url\n const isQuery = uri.startsWith('/data/query')\n const isRetriableResponse =\n isHttpError(error) && [429, 502, 503].includes(error.response.statusCode)\n\n return (isSafe || isQuery) && isRetriableResponse\n ? true\n : retry.shouldRetry(error, attempt, options)\n}\n"],"names":["createRequire","ClientError","isHttpError","ServerError","getIt","agent","headers","jsonRequest","jsonResponse","observable","progress","retry","Observable","requireFromHere","url","clientPackage","clientVersion","version","createIsolatedRequester","shouldRetry","removeLineage","keepAlive","maxSockets","maxTotalSockets","httpErrors","implementation","processOptions","options","requestHeaders","name","Object","keys","toLowerCase","onResponse","response","context","statusCode","error","attempt","maxRetries","isSafe","method","uri","isQuery","startsWith","isRetriableResponse","includes"],"mappings":"AAAA,SAAQA,aAAa,QAAO,cAAa;AAEzC,SAAQC,WAAW,EAAEC,WAAW,EAAEC,WAAW,QAAO,iBAAgB;AACpE,SAAQC,KAAK,QAA+E,SAAQ;AACpG,SACEC,KAAK,EACLC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,QAAQ,EACRC,KAAK,QACA,oBAAmB;AAC1B,SAAQC,UAAU,QAAO,OAAM;AAE/B,MAAMC,kBAAkBb,cAAc,YAAYc,GAAG;AACrD,MAAMC,gBAAyBF,gBAAgB;AAC/C,MAAMG,gBACJ,OAAOD,kBAAkB,YACzBA,kBAAkB,QAClB,aAAaA,iBACb,OAAOA,cAAcE,OAAO,KAAK,WAC7BF,cAAcE,OAAO,GACrB;AAEN;;;;;;;CAOC,GACD,OAAO,SAASC;IACd,OAAOd,MAAM;QACXO,MAAM;YAACQ;QAAW;QAClBb,QAAQ;YAAC,cAAc,CAAC,eAAe,EAAEU,eAAe;QAAA;QACxDI;QACAf,MAAM;YAACgB,WAAW;YAAMC,YAAY;YAAIC,iBAAiB;QAAG;QAC5DhB;QACAC;QACAE;QACAc;QACAf,WAAW;YAACgB,gBAAgBb;QAAU;KACvC;AACH;AAEA,SAASQ;IACP,OAAO;QACLM,gBAAeC,OAAuB;YACpC,MAAMC,iBAAiB;gBAAC,GAAGD,QAAQrB,OAAO;YAAA;YAC1C,KAAK,MAAMuB,QAAQC,OAAOC,IAAI,CAACH,gBAAiB;gBAC9C,IAAIC,KAAKG,WAAW,OAAO,oBAAoB,OAAOJ,cAAc,CAACC,KAAK;YAC5E;YACA,OAAO;gBAAC,GAAGF,OAAO;gBAAErB,SAASsB;YAAc;QAC7C;IACF;AACF;AAEA,MAAMJ,aAAyB;IAC7BS,YAAWC,QAAQ,EAAEC,OAAoB;QACvC,IAAID,SAASE,UAAU,IAAI,KAAK,MAAM,IAAIjC,YAAY+B;QACtD,IAAIA,SAASE,UAAU,IAAI,KAAK,MAAM,IAAInC,YAAYiC,UAAUC;QAChE,OAAOD;IACT;AACF;AAEA,SAASf,YAAYkB,KAAc,EAAEC,OAAe,EAAEX,OAAuB;IAC3E,IAAIA,QAAQY,UAAU,KAAK,GAAG,OAAO;IAErC,MAAMC,SAASb,QAAQc,MAAM,KAAK,SAASd,QAAQc,MAAM,KAAK;IAC9D,MAAMC,MAAM,SAASf,WAAW,OAAOA,QAAQe,GAAG,KAAK,WAAWf,QAAQe,GAAG,GAAGf,QAAQb,GAAG;IAC3F,MAAM6B,UAAUD,IAAIE,UAAU,CAAC;IAC/B,MAAMC,sBACJ3C,YAAYmC,UAAU;QAAC;QAAK;QAAK;KAAI,CAACS,QAAQ,CAACT,MAAMH,QAAQ,CAACE,UAAU;IAE1E,OAAO,AAACI,CAAAA,UAAUG,OAAM,KAAME,sBAC1B,OACAlC,MAAMQ,WAAW,CAACkB,OAAOC,SAASX;AACxC"}