@sanity/workbench-cli 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_exports/build.d.ts +13 -253
- package/dist/_exports/contract-DyG11fQ7.d.ts +45 -0
- package/dist/_exports/defineApp-r_CmoZfS.d.ts +169 -0
- package/dist/_exports/deploy.d.ts +94 -427
- package/dist/_exports/dev.d.ts +26 -196
- package/dist/_exports/index.d.ts +74 -407
- package/dist/_exports/init.d.ts +5 -9
- package/dist/_exports/preview.d.ts +20 -187
- package/dist/_exports/registry-DI7hnTof.d.ts +102 -0
- package/dist/_exports/resolveWorkbenchApp-DqFqET9E.d.ts +41 -0
- package/dist/_exports/summarizeInterfaces-DBGiAwNT.d.ts +62 -0
- package/dist/_exports/undeploy.d.ts +15 -296
- package/dist/actions/dev/registry.js +9 -0
- package/dist/actions/dev/registry.js.map +1 -1
- package/dist/actions/dev/startDevServerRegistration.js +50 -3
- package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
- package/dist/actions/dev/startWorkbenchDevServer.js +3 -6
- package/dist/actions/dev/startWorkbenchDevServer.js.map +1 -1
- package/dist/services/applications.js +7 -7
- package/dist/services/applications.js.map +1 -1
- package/dist/services/installations.js +4 -4
- package/dist/services/installations.js.map +1 -1
- package/package.json +4 -4
package/dist/_exports/build.d.ts
CHANGED
|
@@ -1,248 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CliConfig } from "@sanity/cli-core";
|
|
1
|
+
import { n as WorkbenchExposes, r as resolveWorkbenchApp, t as ResolvedWorkbenchApp } from "./resolveWorkbenchApp-DqFqET9E.js";
|
|
3
2
|
import { PluginOption } from "vite";
|
|
4
|
-
import { z } from "zod/mini";
|
|
5
|
-
|
|
6
|
-
/** The `asset_source` variant of an app's `views`. @public */
|
|
7
|
-
declare type AssetSourceView = Extract<
|
|
8
|
-
NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
|
|
9
|
-
{
|
|
10
|
-
type: "asset_source";
|
|
11
|
-
}
|
|
12
|
-
>;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The `build`/`start` id — a hash of the app's declared shape (its identity, not
|
|
16
|
-
* its code), so the bundle inlined by `sanity build` and the registry entry
|
|
17
|
-
* advertised by `sanity start` resolve to the same id. `sanity deploy` resolves
|
|
18
|
-
* its own id from the applications API.
|
|
19
|
-
*/
|
|
20
|
-
export declare function buildAppId(app: ResolvedWorkbenchApp): Promise<string>;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* User-facing input for `unstable_defineApp`. Excludes the internal
|
|
24
|
-
* `applicationType`, `isSingleton`, and `config` — validated by the schema but
|
|
25
|
-
* not part of the public surface (Sanity-owned apps set them via
|
|
26
|
-
* `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
|
|
27
|
-
* panel `views`, never both — but `asset_source` and `tile` views are separate
|
|
28
|
-
* kinds and may accompany either.
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
declare type DefineAppInput = Omit<
|
|
32
|
-
z.output<typeof DefineAppInputSchema>,
|
|
33
|
-
"applicationType" | "config" | "entry" | "isSingleton" | "views"
|
|
34
|
-
> &
|
|
35
|
-
(
|
|
36
|
-
| {
|
|
37
|
-
entry?: never;
|
|
38
|
-
views?: NonNullable<z.output<typeof DefineAppInputSchema>["views"]>;
|
|
39
|
-
}
|
|
40
|
-
| {
|
|
41
|
-
entry?: string;
|
|
42
|
-
views?: (AssetSourceView | TileView)[];
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Runtime-validation schema for `unstable_defineApp`.
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
51
|
-
{
|
|
52
|
-
applicationType: z.ZodMiniOptional<
|
|
53
|
-
z.ZodMiniEnum<{
|
|
54
|
-
"media-library": "media-library";
|
|
55
|
-
coreApp: "coreApp";
|
|
56
|
-
studio: "studio";
|
|
57
|
-
canvas: "canvas";
|
|
58
|
-
dashboard: "dashboard";
|
|
59
|
-
}>
|
|
60
|
-
>;
|
|
61
|
-
config: z.ZodMiniOptional<
|
|
62
|
-
z.ZodMiniDiscriminatedUnion<
|
|
63
|
-
[
|
|
64
|
-
z.ZodMiniObject<
|
|
65
|
-
{
|
|
66
|
-
appType: z.ZodMiniLiteral<"media-library">;
|
|
67
|
-
fields: z.ZodMiniArray<
|
|
68
|
-
z.ZodMiniObject<
|
|
69
|
-
{
|
|
70
|
-
public: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
71
|
-
title: z.ZodMiniString<string>;
|
|
72
|
-
name: z.ZodMiniString<string>;
|
|
73
|
-
src: z.ZodMiniString<string>;
|
|
74
|
-
},
|
|
75
|
-
z.core.$strip
|
|
76
|
-
>
|
|
77
|
-
>;
|
|
78
|
-
},
|
|
79
|
-
z.core.$strip
|
|
80
|
-
>,
|
|
81
|
-
],
|
|
82
|
-
"appType"
|
|
83
|
-
>
|
|
84
|
-
>;
|
|
85
|
-
entry: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
86
|
-
group: z.ZodMiniOptional<
|
|
87
|
-
z.ZodMiniEnum<{
|
|
88
|
-
"dock.system": "dock.system";
|
|
89
|
-
"dock.applications": "dock.applications";
|
|
90
|
-
"dock.user": "dock.user";
|
|
91
|
-
}>
|
|
92
|
-
>;
|
|
93
|
-
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
94
|
-
isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
95
|
-
organizationId: z.ZodMiniString<string>;
|
|
96
|
-
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
97
|
-
services: z.ZodMiniOptional<
|
|
98
|
-
z.ZodMiniArray<
|
|
99
|
-
z.ZodMiniDiscriminatedUnion<
|
|
100
|
-
[
|
|
101
|
-
z.ZodMiniObject<
|
|
102
|
-
{
|
|
103
|
-
title: z.ZodMiniString<string>;
|
|
104
|
-
name: z.ZodMiniString<string>;
|
|
105
|
-
src: z.ZodMiniString<string>;
|
|
106
|
-
type: z.ZodMiniLiteral<"worker">;
|
|
107
|
-
},
|
|
108
|
-
z.core.$strip
|
|
109
|
-
>,
|
|
110
|
-
],
|
|
111
|
-
"type"
|
|
112
|
-
>
|
|
113
|
-
>
|
|
114
|
-
>;
|
|
115
|
-
slug: z.ZodMiniString<string>;
|
|
116
|
-
title: z.ZodMiniString<string>;
|
|
117
|
-
views: z.ZodMiniOptional<
|
|
118
|
-
z.ZodMiniArray<
|
|
119
|
-
z.ZodMiniDiscriminatedUnion<
|
|
120
|
-
[
|
|
121
|
-
z.ZodMiniObject<
|
|
122
|
-
{
|
|
123
|
-
title: z.ZodMiniString<string>;
|
|
124
|
-
name: z.ZodMiniString<string>;
|
|
125
|
-
src: z.ZodMiniString<string>;
|
|
126
|
-
type: z.ZodMiniLiteral<"panel">;
|
|
127
|
-
},
|
|
128
|
-
z.core.$strip
|
|
129
|
-
>,
|
|
130
|
-
z.ZodMiniObject<
|
|
131
|
-
{
|
|
132
|
-
title: z.ZodMiniString<string>;
|
|
133
|
-
name: z.ZodMiniString<string>;
|
|
134
|
-
src: z.ZodMiniString<string>;
|
|
135
|
-
type: z.ZodMiniLiteral<"asset_source">;
|
|
136
|
-
},
|
|
137
|
-
z.core.$strip
|
|
138
|
-
>,
|
|
139
|
-
z.ZodMiniObject<
|
|
140
|
-
{
|
|
141
|
-
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
142
|
-
size: z.ZodMiniEnum<{
|
|
143
|
-
small: "small";
|
|
144
|
-
large: "large";
|
|
145
|
-
banner: "banner";
|
|
146
|
-
}>;
|
|
147
|
-
title: z.ZodMiniString<string>;
|
|
148
|
-
name: z.ZodMiniString<string>;
|
|
149
|
-
src: z.ZodMiniString<string>;
|
|
150
|
-
type: z.ZodMiniLiteral<"tile">;
|
|
151
|
-
},
|
|
152
|
-
z.core.$strip
|
|
153
|
-
>,
|
|
154
|
-
],
|
|
155
|
-
"type"
|
|
156
|
-
>
|
|
157
|
-
>
|
|
158
|
-
>;
|
|
159
|
-
visibility: z.ZodMiniOptional<
|
|
160
|
-
z.ZodMiniEnum<{
|
|
161
|
-
default: "default";
|
|
162
|
-
unlisted: "unlisted";
|
|
163
|
-
disabled: "disabled";
|
|
164
|
-
}>
|
|
165
|
-
>;
|
|
166
|
-
},
|
|
167
|
-
z.core.$strip
|
|
168
|
-
>;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* The branded result of `unstable_defineApp`. Carries the same fields as the
|
|
172
|
-
* input plus the internal brand — users only ever see `DefineAppInput`.
|
|
173
|
-
* @public
|
|
174
|
-
*/
|
|
175
|
-
declare type DefineAppResult = DefineAppInput & {
|
|
176
|
-
readonly [WORKBENCH_APP]: true;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
/** @public */
|
|
180
|
-
declare interface ResolvedWorkbenchApp {
|
|
181
|
-
/** Organization that owns the app — part of its build-id identity. */
|
|
182
|
-
readonly organizationId: string;
|
|
183
|
-
/** Background worker services the app declares. */
|
|
184
|
-
readonly services: NonNullable<DefineAppInput["services"]>;
|
|
185
|
-
readonly slug: string;
|
|
186
|
-
/** Dock panel views the app declares. */
|
|
187
|
-
readonly views: NonNullable<DefineAppInput["views"]>;
|
|
188
|
-
/** Resolved app kind — `studio` or one of the SDK app types. */
|
|
189
|
-
readonly applicationType?: string;
|
|
190
|
-
/** Deploys on its own path, separate from the interfaces. */
|
|
191
|
-
readonly config?: WorkbenchApp["config"];
|
|
192
|
-
/** SDK app-view entrypoint, when declared. */
|
|
193
|
-
readonly entry?: string;
|
|
194
|
-
/** Path to the app's icon SVG, resolved and shipped to Brett on deploy. */
|
|
195
|
-
readonly icon?: string;
|
|
196
|
-
/** Explicit singleton flag (a Sanity-owned app); `undefined` when the app doesn't set it. */
|
|
197
|
-
readonly isSingleton?: boolean;
|
|
198
|
-
/** Dashboard visibility declared by the app; `undefined` when unset. */
|
|
199
|
-
readonly visibility?: AppVisibility;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Resolve the workbench app for a CLI config, or `null` for a plain project.
|
|
204
|
-
* @public
|
|
205
|
-
*/
|
|
206
|
-
export declare function resolveWorkbenchApp(
|
|
207
|
-
cliConfig: CliConfig | null | undefined,
|
|
208
|
-
): ResolvedWorkbenchApp | null;
|
|
209
|
-
|
|
210
|
-
/** The `tile` variant of an app's `views`. @public */
|
|
211
|
-
declare type TileView = Extract<
|
|
212
|
-
NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
|
|
213
|
-
{
|
|
214
|
-
type: "tile";
|
|
215
|
-
}
|
|
216
|
-
>;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Nominal brand the CLI discriminates on to enable the workbench build/deploy
|
|
220
|
-
* codepath. Registered via `Symbol.for` so the marker survives module-realm
|
|
221
|
-
* boundaries — `@sanity/cli-core` re-derives the same global symbol with
|
|
222
|
-
* `Symbol.for` rather than importing it, so it stays internal to this module.
|
|
223
|
-
*/
|
|
224
|
-
declare const WORKBENCH_APP: unique symbol;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* A branded app as the CLI reads it — the full schema shape, including the
|
|
228
|
-
* internal fields `DefineAppInput` omits. Schema-derived so the narrowing
|
|
229
|
-
* can't drift from what the schema validates.
|
|
230
|
-
* @public
|
|
231
|
-
*/
|
|
232
|
-
declare type WorkbenchApp = DefineAppResult &
|
|
233
|
-
z.output<typeof DefineAppInputSchema>;
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Bundled so adding a declaration family touches this type and the artifact
|
|
237
|
-
* expanders, not every hop of build/dev plumbing in between.
|
|
238
|
-
* @internal
|
|
239
|
-
*/
|
|
240
|
-
export declare interface WorkbenchExposes {
|
|
241
|
-
config?: WorkbenchApp["config"];
|
|
242
|
-
services?: DefineAppInput["services"];
|
|
243
|
-
views?: DefineAppInput["views"];
|
|
244
|
-
}
|
|
245
|
-
|
|
246
3
|
/**
|
|
247
4
|
* Dep pre-bundling inputs for a workbench app's dev server.
|
|
248
5
|
*
|
|
@@ -267,7 +24,7 @@ export declare interface WorkbenchExposes {
|
|
|
267
24
|
* @param exposes - The app's declared views/services/config.
|
|
268
25
|
* @internal
|
|
269
26
|
*/
|
|
270
|
-
|
|
27
|
+
declare function workbenchOptimizeDeps(options: {
|
|
271
28
|
appSources: readonly string[];
|
|
272
29
|
cwd: string;
|
|
273
30
|
exposes?: WorkbenchExposes;
|
|
@@ -275,8 +32,7 @@ export declare function workbenchOptimizeDeps(options: {
|
|
|
275
32
|
entries: string[];
|
|
276
33
|
include: string[];
|
|
277
34
|
};
|
|
278
|
-
|
|
279
|
-
declare interface WorkbenchViteOptions {
|
|
35
|
+
interface WorkbenchViteOptions {
|
|
280
36
|
/** Project root — read for the federation remote name, and the plugin workDir. */
|
|
281
37
|
cwd: string;
|
|
282
38
|
/**
|
|
@@ -294,10 +50,14 @@ declare interface WorkbenchViteOptions {
|
|
|
294
50
|
/** App (vs studio) build — selects the discriminated federation option shape. */
|
|
295
51
|
isApp?: boolean;
|
|
296
52
|
}
|
|
297
|
-
|
|
298
53
|
/** Build the Vite plugins for a workbench app's module-federation remote. */
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
54
|
+
declare function workbenchVitePlugins(options: WorkbenchViteOptions): Promise<PluginOption>;
|
|
55
|
+
/**
|
|
56
|
+
* The `build`/`start` id — a hash of the app's declared shape (its identity, not
|
|
57
|
+
* its code), so the bundle inlined by `sanity build` and the registry entry
|
|
58
|
+
* advertised by `sanity start` resolve to the same id. `sanity deploy` resolves
|
|
59
|
+
* its own id from the applications API.
|
|
60
|
+
*/
|
|
61
|
+
declare function buildAppId(app: ResolvedWorkbenchApp): Promise<string>;
|
|
62
|
+
export { type WorkbenchExposes, buildAppId, resolveWorkbenchApp, workbenchOptimizeDeps, workbenchVitePlugins };
|
|
63
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod/mini";
|
|
2
|
+
/** @internal */
|
|
3
|
+
declare const VIEW_CONTRACT_VERSION = 1;
|
|
4
|
+
/** @internal */
|
|
5
|
+
declare const SERVICE_CONTRACT_VERSION = 1;
|
|
6
|
+
/**
|
|
7
|
+
* A view component. The return is opaque so the runtime helpers carry no React
|
|
8
|
+
* dependency — the generated artifact renders it with the app's own React.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
type ViewComponent<TProps> = (props: TProps) => unknown;
|
|
12
|
+
/** @public */
|
|
13
|
+
interface ViewComponentBaseProps<TView> {
|
|
14
|
+
view: TView;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Component slots each interface type exposes, in render order. Source of truth
|
|
18
|
+
* for {@link InterfaceType} and the build; add a type by registering it here.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
declare const VIEW_COMPONENTS: {
|
|
22
|
+
readonly asset_source: readonly ["asset_source"];
|
|
23
|
+
readonly panel: readonly ["title", "panel"];
|
|
24
|
+
readonly tile: readonly ["tile"];
|
|
25
|
+
};
|
|
26
|
+
/** @public */
|
|
27
|
+
type InterfaceType = keyof typeof VIEW_COMPONENTS;
|
|
28
|
+
/**
|
|
29
|
+
* A tile's footprint family — the shape it occupies on the dashboard. Modelled
|
|
30
|
+
* on iOS WidgetKit families, not a linear scale: `banner` is full-width and
|
|
31
|
+
* shallow, which a `small`→`large` magnitude can't express. The host maps a
|
|
32
|
+
* family to a layout slot; the component reads it to render per footprint.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
declare const TileSizeSchema: z.ZodMiniEnum<{
|
|
36
|
+
small: "small";
|
|
37
|
+
large: "large";
|
|
38
|
+
banner: "banner";
|
|
39
|
+
}>;
|
|
40
|
+
/** @public */
|
|
41
|
+
type TileSize = z.infer<typeof TileSizeSchema>;
|
|
42
|
+
/** @public */
|
|
43
|
+
type ServiceType = 'worker';
|
|
44
|
+
export { VIEW_CONTRACT_VERSION as a, TileSize as i, SERVICE_CONTRACT_VERSION as n, ViewComponent as o, ServiceType as r, ViewComponentBaseProps as s, InterfaceType as t };
|
|
45
|
+
//# sourceMappingURL=contract-DyG11fQ7.d.ts.map
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { z } from "zod/mini";
|
|
2
|
+
/** Dock groups an app can place itself into. */
|
|
3
|
+
declare const DockGroupSchema: z.ZodMiniEnum<{
|
|
4
|
+
"dock.system": "dock.system";
|
|
5
|
+
"dock.applications": "dock.applications";
|
|
6
|
+
"dock.user": "dock.user";
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Dock group identifier. The API does not block a user app from declaring a
|
|
10
|
+
* reserved group (e.g. `dock.system`); priority conventions keep Sanity-owned
|
|
11
|
+
* apps ahead.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
type DockGroup = z.output<typeof DockGroupSchema>;
|
|
15
|
+
/**
|
|
16
|
+
* Runtime-validation schema for `unstable_defineApp`.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
declare const DefineAppInputSchema: z.ZodMiniObject<{
|
|
20
|
+
applicationType: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
21
|
+
coreApp: "coreApp";
|
|
22
|
+
studio: "studio";
|
|
23
|
+
canvas: "canvas";
|
|
24
|
+
dashboard: "dashboard";
|
|
25
|
+
"media-library": "media-library";
|
|
26
|
+
}>>;
|
|
27
|
+
config: z.ZodMiniOptional<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
28
|
+
appType: z.ZodMiniLiteral<"media-library">;
|
|
29
|
+
fields: z.ZodMiniArray<z.ZodMiniObject<{
|
|
30
|
+
public: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
31
|
+
title: z.ZodMiniString<string>;
|
|
32
|
+
name: z.ZodMiniString<string>;
|
|
33
|
+
src: z.ZodMiniString<string>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
}, z.core.$strip>], "appType">>;
|
|
36
|
+
entry: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
37
|
+
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
38
|
+
"dock.system": "dock.system";
|
|
39
|
+
"dock.applications": "dock.applications";
|
|
40
|
+
"dock.user": "dock.user";
|
|
41
|
+
}>>;
|
|
42
|
+
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
43
|
+
isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
44
|
+
organizationId: z.ZodMiniString<string>;
|
|
45
|
+
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
46
|
+
services: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
47
|
+
title: z.ZodMiniString<string>;
|
|
48
|
+
name: z.ZodMiniString<string>;
|
|
49
|
+
src: z.ZodMiniString<string>;
|
|
50
|
+
type: z.ZodMiniLiteral<"worker">;
|
|
51
|
+
}, z.core.$strip>], "type">>>;
|
|
52
|
+
slug: z.ZodMiniString<string>;
|
|
53
|
+
title: z.ZodMiniString<string>;
|
|
54
|
+
views: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
55
|
+
title: z.ZodMiniString<string>;
|
|
56
|
+
name: z.ZodMiniString<string>;
|
|
57
|
+
src: z.ZodMiniString<string>;
|
|
58
|
+
type: z.ZodMiniLiteral<"panel">;
|
|
59
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
60
|
+
title: z.ZodMiniString<string>;
|
|
61
|
+
name: z.ZodMiniString<string>;
|
|
62
|
+
src: z.ZodMiniString<string>;
|
|
63
|
+
type: z.ZodMiniLiteral<"asset_source">;
|
|
64
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
65
|
+
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
66
|
+
size: z.ZodMiniEnum<{
|
|
67
|
+
small: "small";
|
|
68
|
+
large: "large";
|
|
69
|
+
banner: "banner";
|
|
70
|
+
}>;
|
|
71
|
+
title: z.ZodMiniString<string>;
|
|
72
|
+
name: z.ZodMiniString<string>;
|
|
73
|
+
src: z.ZodMiniString<string>;
|
|
74
|
+
type: z.ZodMiniLiteral<"tile">;
|
|
75
|
+
}, z.core.$strip>], "type">>>;
|
|
76
|
+
visibility: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
77
|
+
default: "default";
|
|
78
|
+
unlisted: "unlisted";
|
|
79
|
+
disabled: "disabled";
|
|
80
|
+
}>>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
/** The `asset_source` variant of an app's `views`. @public */
|
|
83
|
+
type AssetSourceView = Extract<NonNullable<z.output<typeof DefineAppInputSchema>['views']>[number], {
|
|
84
|
+
type: 'asset_source';
|
|
85
|
+
}>;
|
|
86
|
+
/** The `tile` variant of an app's `views`. @public */
|
|
87
|
+
type TileView = Extract<NonNullable<z.output<typeof DefineAppInputSchema>['views']>[number], {
|
|
88
|
+
type: 'tile';
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* User-facing input for `unstable_defineApp`. Excludes the internal
|
|
92
|
+
* `applicationType`, `isSingleton`, and `config` — validated by the schema but
|
|
93
|
+
* not part of the public surface (Sanity-owned apps set them via
|
|
94
|
+
* `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
|
|
95
|
+
* panel `views`, never both — but `asset_source` and `tile` views are separate
|
|
96
|
+
* kinds and may accompany either.
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
type DefineAppInput = Omit<z.output<typeof DefineAppInputSchema>, 'applicationType' | 'config' | 'entry' | 'isSingleton' | 'views'> & ({
|
|
100
|
+
entry?: never;
|
|
101
|
+
views?: NonNullable<z.output<typeof DefineAppInputSchema>['views']>;
|
|
102
|
+
} | {
|
|
103
|
+
entry?: string;
|
|
104
|
+
views?: (AssetSourceView | TileView)[];
|
|
105
|
+
});
|
|
106
|
+
/**
|
|
107
|
+
* Nominal brand the CLI discriminates on to enable the workbench build/deploy
|
|
108
|
+
* codepath. Registered via `Symbol.for` so the marker survives module-realm
|
|
109
|
+
* boundaries — `@sanity/cli-core` re-derives the same global symbol with
|
|
110
|
+
* `Symbol.for` rather than importing it, so it stays internal to this module.
|
|
111
|
+
*/
|
|
112
|
+
declare const WORKBENCH_APP: unique symbol;
|
|
113
|
+
/**
|
|
114
|
+
* The branded result of `unstable_defineApp`. Carries the same fields as the
|
|
115
|
+
* input plus the internal brand — users only ever see `DefineAppInput`.
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
type DefineAppResult = DefineAppInput & {
|
|
119
|
+
readonly [WORKBENCH_APP]: true;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* A branded app as the CLI reads it — the full schema shape, including the
|
|
123
|
+
* internal fields `DefineAppInput` omits. Schema-derived so the narrowing
|
|
124
|
+
* can't drift from what the schema validates.
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
type WorkbenchApp = DefineAppResult & z.output<typeof DefineAppInputSchema>;
|
|
128
|
+
/**
|
|
129
|
+
* Whether `app` is a branded `unstable_defineApp(...)` result — the sole
|
|
130
|
+
* workbench opt-in.
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
declare function isWorkbenchApp(app: unknown): app is WorkbenchApp;
|
|
134
|
+
/**
|
|
135
|
+
* Declare a Sanity Workbench application. Identity at runtime — returns the same
|
|
136
|
+
* object reference, tagged with the workbench brand. Field validation (the
|
|
137
|
+
* `slug` pattern etc.) runs at build time in the CLI via `DefineAppInputSchema`;
|
|
138
|
+
* this helper stays a thin, pure identity wrapper.
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
declare function unstable_defineApp(input: DefineAppInput): DefineAppResult;
|
|
142
|
+
/**
|
|
143
|
+
* One custom field a media library exposes. `src` default-exports a `defineField(...)` schema type.
|
|
144
|
+
* @public
|
|
145
|
+
*/
|
|
146
|
+
interface MediaLibraryField {
|
|
147
|
+
/** Unique within the media library. */
|
|
148
|
+
name: string;
|
|
149
|
+
src: string;
|
|
150
|
+
title: string;
|
|
151
|
+
/** Readable outside the owning organization. */
|
|
152
|
+
public?: boolean;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Sanity-owned singleton, so authors don't name or title the app — only `organizationId` is required.
|
|
156
|
+
* @public
|
|
157
|
+
*/
|
|
158
|
+
interface DefineMediaLibraryInput {
|
|
159
|
+
/** Organization that owns the media library — the CLI runs and deploys against it. */
|
|
160
|
+
organizationId: string;
|
|
161
|
+
fields?: MediaLibraryField[];
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Declare the Sanity Media Library as a workbench app — a singleton whose `fields` become its config.
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
declare function unstable_defineMediaLibrary(input: DefineMediaLibraryInput): DefineAppResult;
|
|
168
|
+
export { MediaLibraryField as a, unstable_defineApp as c, DockGroup as i, unstable_defineMediaLibrary as l, DefineAppResult as n, WorkbenchApp as o, DefineMediaLibraryInput as r, isWorkbenchApp as s, DefineAppInput as t };
|
|
169
|
+
//# sourceMappingURL=defineApp-r_CmoZfS.d.ts.map
|