@sanity/workbench-cli 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_exports/build.d.ts +22 -17
- package/dist/_exports/deploy.d.ts +156 -20
- package/dist/_exports/deploy.js +3 -1
- package/dist/_exports/deploy.js.map +1 -1
- package/dist/_exports/dev.d.ts +6 -3
- package/dist/_exports/index.d.ts +16 -13
- package/dist/actions/build/artifact.js +2 -2
- package/dist/actions/build/artifact.js.map +1 -1
- package/dist/actions/build/configs/artifact.js +5 -5
- package/dist/actions/build/configs/artifact.js.map +1 -1
- package/dist/actions/deploy/apiVersion.js +5 -0
- package/dist/actions/deploy/apiVersion.js.map +1 -0
- package/dist/actions/deploy/buildExposes.js +56 -0
- package/dist/actions/deploy/buildExposes.js.map +1 -0
- package/dist/actions/deploy/{deployInstallationConfig.js → deployConfig.js} +10 -11
- package/dist/actions/deploy/deployConfig.js.map +1 -0
- package/dist/actions/deploy/deployWorkbenchApp.js +185 -0
- package/dist/actions/deploy/deployWorkbenchApp.js.map +1 -0
- package/dist/actions/deploy/getWorkbench.js +4 -4
- package/dist/actions/deploy/getWorkbench.js.map +1 -1
- package/dist/actions/dev/deriveInterfaces.js +33 -19
- package/dist/actions/dev/deriveInterfaces.js.map +1 -1
- package/dist/actions/dev/exposesSetId.js +6 -6
- package/dist/actions/dev/exposesSetId.js.map +1 -1
- package/dist/actions/dev/registry.js +14 -5
- package/dist/actions/dev/registry.js.map +1 -1
- package/dist/actions/dev/startDevManifestWatcher.js +2 -2
- package/dist/actions/dev/startDevManifestWatcher.js.map +1 -1
- package/dist/actions/dev/startDevServerRegistration.js +7 -7
- package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
- package/dist/actions/dev/startWorkbenchDevServer.js +9 -6
- package/dist/actions/dev/startWorkbenchDevServer.js.map +1 -1
- package/dist/actions/dev/writeWorkbenchRuntime.js +4 -1
- package/dist/actions/dev/writeWorkbenchRuntime.js.map +1 -1
- package/dist/contract.js +16 -8
- package/dist/contract.js.map +1 -1
- package/dist/defineApp.js +25 -20
- package/dist/defineApp.js.map +1 -1
- package/dist/resolveWorkbenchApp.js +4 -3
- package/dist/resolveWorkbenchApp.js.map +1 -1
- package/package.json +3 -3
- package/dist/actions/deploy/deployInstallationConfig.js.map +0 -1
package/dist/_exports/build.d.ts
CHANGED
|
@@ -4,14 +4,14 @@ import { z } from "zod/mini";
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* User-facing input for `unstable_defineApp`. Excludes the internal
|
|
7
|
-
* `applicationType`, `isSingleton`, and `
|
|
7
|
+
* `applicationType`, `isSingleton`, and `config` — validated by the
|
|
8
8
|
* schema but not part of the public surface (Sanity-owned apps set them via
|
|
9
9
|
* `@ts-expect-error`).
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
declare type DefineAppInput = Omit<
|
|
13
13
|
z.output<typeof DefineAppInputSchema>,
|
|
14
|
-
"applicationType" | "
|
|
14
|
+
"applicationType" | "config" | "isSingleton"
|
|
15
15
|
>;
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -31,16 +31,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
31
31
|
dashboard: "dashboard";
|
|
32
32
|
}>
|
|
33
33
|
>;
|
|
34
|
-
|
|
35
|
-
group: z.ZodMiniOptional<
|
|
36
|
-
z.ZodMiniEnum<{
|
|
37
|
-
"dock.system": "dock.system";
|
|
38
|
-
"dock.applications": "dock.applications";
|
|
39
|
-
"dock.user": "dock.user";
|
|
40
|
-
}>
|
|
41
|
-
>;
|
|
42
|
-
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
43
|
-
installationConfig: z.ZodMiniOptional<
|
|
34
|
+
config: z.ZodMiniOptional<
|
|
44
35
|
z.ZodMiniDiscriminatedUnion<
|
|
45
36
|
[
|
|
46
37
|
z.ZodMiniObject<
|
|
@@ -64,6 +55,15 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
64
55
|
"appType"
|
|
65
56
|
>
|
|
66
57
|
>;
|
|
58
|
+
entry: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
59
|
+
group: z.ZodMiniOptional<
|
|
60
|
+
z.ZodMiniEnum<{
|
|
61
|
+
"dock.system": "dock.system";
|
|
62
|
+
"dock.applications": "dock.applications";
|
|
63
|
+
"dock.user": "dock.user";
|
|
64
|
+
}>
|
|
65
|
+
>;
|
|
66
|
+
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
67
67
|
isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
68
68
|
name: z.ZodMiniString<string>;
|
|
69
69
|
organizationId: z.ZodMiniString<string>;
|
|
@@ -74,6 +74,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
74
74
|
[
|
|
75
75
|
z.ZodMiniObject<
|
|
76
76
|
{
|
|
77
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
77
78
|
name: z.ZodMiniString<string>;
|
|
78
79
|
src: z.ZodMiniString<string>;
|
|
79
80
|
type: z.ZodMiniLiteral<"worker">;
|
|
@@ -85,6 +86,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
85
86
|
>
|
|
86
87
|
>
|
|
87
88
|
>;
|
|
89
|
+
slug: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
88
90
|
title: z.ZodMiniString<string>;
|
|
89
91
|
views: z.ZodMiniOptional<
|
|
90
92
|
z.ZodMiniArray<
|
|
@@ -92,6 +94,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
92
94
|
[
|
|
93
95
|
z.ZodMiniObject<
|
|
94
96
|
{
|
|
97
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
95
98
|
name: z.ZodMiniString<string>;
|
|
96
99
|
src: z.ZodMiniString<string>;
|
|
97
100
|
type: z.ZodMiniLiteral<"panel">;
|
|
@@ -118,8 +121,6 @@ declare interface DefineAppResult extends DefineAppInput {
|
|
|
118
121
|
|
|
119
122
|
/** @public */
|
|
120
123
|
declare interface ResolvedWorkbenchApp {
|
|
121
|
-
/** A Sanity-owned singleton (e.g. the Media Library) — deploys its config, not an application. */
|
|
122
|
-
readonly isSingleton: boolean;
|
|
123
124
|
/** The app's unique `name` from `unstable_defineApp`. */
|
|
124
125
|
readonly name: string;
|
|
125
126
|
/** Background worker services the app declares. */
|
|
@@ -128,10 +129,14 @@ declare interface ResolvedWorkbenchApp {
|
|
|
128
129
|
readonly views: NonNullable<DefineAppInput["views"]>;
|
|
129
130
|
/** Resolved app kind — `studio` or one of the SDK app types. */
|
|
130
131
|
readonly applicationType?: string;
|
|
132
|
+
/** Deploys on its own path, separate from the interfaces. */
|
|
133
|
+
readonly config?: WorkbenchApp["config"];
|
|
131
134
|
/** SDK app-view entrypoint, when declared. */
|
|
132
135
|
readonly entry?: string;
|
|
133
|
-
/**
|
|
134
|
-
readonly
|
|
136
|
+
/** Explicit singleton flag (a Sanity-owned app); `undefined` when the app doesn't set it. */
|
|
137
|
+
readonly isSingleton?: boolean;
|
|
138
|
+
/** Hostname the application is created at on first deploy. */
|
|
139
|
+
readonly slug?: string;
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
/**
|
|
@@ -165,7 +170,7 @@ declare type WorkbenchApp = DefineAppResult &
|
|
|
165
170
|
* @internal
|
|
166
171
|
*/
|
|
167
172
|
export declare interface WorkbenchExposes {
|
|
168
|
-
|
|
173
|
+
config?: WorkbenchApp["config"];
|
|
169
174
|
services?: DefineAppInput["services"];
|
|
170
175
|
views?: DefineAppInput["views"];
|
|
171
176
|
}
|
|
@@ -2,6 +2,59 @@ import { CliConfig } from "@sanity/cli-core";
|
|
|
2
2
|
import { Output } from "@sanity/cli-core";
|
|
3
3
|
import { z } from "zod/mini";
|
|
4
4
|
|
|
5
|
+
export declare interface Application {
|
|
6
|
+
id: string;
|
|
7
|
+
organizationId: string;
|
|
8
|
+
slug: string | null;
|
|
9
|
+
title: string;
|
|
10
|
+
type: ApplicationType;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare type ApplicationType = "coreApp" | "studio";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* An interface as Brett stores it: the declared `type` (validated server-side,
|
|
17
|
+
* not here) and the remote-relative `moduleId` the workbench loads it by — the
|
|
18
|
+
* host prepends the app's own id.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare interface BrettInterface {
|
|
22
|
+
moduleId: string;
|
|
23
|
+
name: string;
|
|
24
|
+
title: string;
|
|
25
|
+
type: string;
|
|
26
|
+
version: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** A studio workspace as Brett stores it. */
|
|
30
|
+
export declare interface BrettWorkspace {
|
|
31
|
+
dataset: string;
|
|
32
|
+
projectId: string;
|
|
33
|
+
basePath?: string;
|
|
34
|
+
icon?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
subtitle?: string;
|
|
37
|
+
title?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The interface records deploy sends: the app view (only when `exposesAppView`),
|
|
42
|
+
* every view, and every service.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildExposes(
|
|
46
|
+
exposes: WorkbenchExposes,
|
|
47
|
+
{ appName, appTitle, exposesAppView, version }: BuildExposesContext,
|
|
48
|
+
): BrettInterface[];
|
|
49
|
+
|
|
50
|
+
declare interface BuildExposesContext {
|
|
51
|
+
appName: string;
|
|
52
|
+
appTitle: string;
|
|
53
|
+
/** Whether the build exposes the app view (`./App`) — apps with an `entry`, and every studio. */
|
|
54
|
+
exposesAppView: boolean;
|
|
55
|
+
version: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
5
58
|
/**
|
|
6
59
|
* Throws unless `sourceDir` is a directory holding a federation build.
|
|
7
60
|
* Workbench builds emit a module-federation remote instead of a static SPA,
|
|
@@ -12,14 +65,14 @@ export declare function checkBuiltOutput(sourceDir: string): Promise<void>;
|
|
|
12
65
|
|
|
13
66
|
/**
|
|
14
67
|
* User-facing input for `unstable_defineApp`. Excludes the internal
|
|
15
|
-
* `applicationType`, `isSingleton`, and `
|
|
68
|
+
* `applicationType`, `isSingleton`, and `config` — validated by the
|
|
16
69
|
* schema but not part of the public surface (Sanity-owned apps set them via
|
|
17
70
|
* `@ts-expect-error`).
|
|
18
71
|
* @public
|
|
19
72
|
*/
|
|
20
73
|
declare type DefineAppInput = Omit<
|
|
21
74
|
z.output<typeof DefineAppInputSchema>,
|
|
22
|
-
"applicationType" | "
|
|
75
|
+
"applicationType" | "config" | "isSingleton"
|
|
23
76
|
>;
|
|
24
77
|
|
|
25
78
|
/**
|
|
@@ -39,16 +92,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
39
92
|
dashboard: "dashboard";
|
|
40
93
|
}>
|
|
41
94
|
>;
|
|
42
|
-
|
|
43
|
-
group: z.ZodMiniOptional<
|
|
44
|
-
z.ZodMiniEnum<{
|
|
45
|
-
"dock.system": "dock.system";
|
|
46
|
-
"dock.applications": "dock.applications";
|
|
47
|
-
"dock.user": "dock.user";
|
|
48
|
-
}>
|
|
49
|
-
>;
|
|
50
|
-
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
51
|
-
installationConfig: z.ZodMiniOptional<
|
|
95
|
+
config: z.ZodMiniOptional<
|
|
52
96
|
z.ZodMiniDiscriminatedUnion<
|
|
53
97
|
[
|
|
54
98
|
z.ZodMiniObject<
|
|
@@ -72,6 +116,15 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
72
116
|
"appType"
|
|
73
117
|
>
|
|
74
118
|
>;
|
|
119
|
+
entry: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
120
|
+
group: z.ZodMiniOptional<
|
|
121
|
+
z.ZodMiniEnum<{
|
|
122
|
+
"dock.system": "dock.system";
|
|
123
|
+
"dock.applications": "dock.applications";
|
|
124
|
+
"dock.user": "dock.user";
|
|
125
|
+
}>
|
|
126
|
+
>;
|
|
127
|
+
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
75
128
|
isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
76
129
|
name: z.ZodMiniString<string>;
|
|
77
130
|
organizationId: z.ZodMiniString<string>;
|
|
@@ -82,6 +135,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
82
135
|
[
|
|
83
136
|
z.ZodMiniObject<
|
|
84
137
|
{
|
|
138
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
85
139
|
name: z.ZodMiniString<string>;
|
|
86
140
|
src: z.ZodMiniString<string>;
|
|
87
141
|
type: z.ZodMiniLiteral<"worker">;
|
|
@@ -93,6 +147,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
93
147
|
>
|
|
94
148
|
>
|
|
95
149
|
>;
|
|
150
|
+
slug: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
96
151
|
title: z.ZodMiniString<string>;
|
|
97
152
|
views: z.ZodMiniOptional<
|
|
98
153
|
z.ZodMiniArray<
|
|
@@ -100,6 +155,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
100
155
|
[
|
|
101
156
|
z.ZodMiniObject<
|
|
102
157
|
{
|
|
158
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
103
159
|
name: z.ZodMiniString<string>;
|
|
104
160
|
src: z.ZodMiniString<string>;
|
|
105
161
|
type: z.ZodMiniLiteral<"panel">;
|
|
@@ -136,11 +192,11 @@ declare interface DeployableWorkbenchApp extends ResolvedWorkbenchApp {
|
|
|
136
192
|
*/
|
|
137
193
|
buildViewDeploymentPayload(applicationId: string): ViewDeploymentPayload;
|
|
138
194
|
/**
|
|
139
|
-
* A singleton (the Media Library) that carries an
|
|
195
|
+
* A singleton (the Media Library) that carries an config — deploy
|
|
140
196
|
* persists the config to the org's installation. Independent of the interfaces,
|
|
141
197
|
* which register regardless; non-singletons never carry a config.
|
|
142
198
|
*/
|
|
143
|
-
|
|
199
|
+
deploySingletonConfig: boolean;
|
|
144
200
|
/** Declares something to host as an application — an entry, view, or service. */
|
|
145
201
|
hasInterfaces: boolean;
|
|
146
202
|
}
|
|
@@ -151,7 +207,7 @@ declare interface DeployableWorkbenchApp extends ResolvedWorkbenchApp {
|
|
|
151
207
|
* reaches this mutating step.
|
|
152
208
|
* @internal
|
|
153
209
|
*/
|
|
154
|
-
export declare function
|
|
210
|
+
export declare function deployConfig(options: {
|
|
155
211
|
appType: string;
|
|
156
212
|
installationId: string;
|
|
157
213
|
output: Output;
|
|
@@ -159,14 +215,66 @@ export declare function deployInstallationConfig(options: {
|
|
|
159
215
|
version: string;
|
|
160
216
|
}): Promise<void>;
|
|
161
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Deploy a workbench coreApp through Brett: redeploy when `appId` is set,
|
|
220
|
+
* otherwise create the application at `slug`. Returns the application id for the
|
|
221
|
+
* shell to report.
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
export declare function deployCoreApp(options: {
|
|
225
|
+
appId: string | undefined;
|
|
226
|
+
interfaces: readonly BrettInterface[];
|
|
227
|
+
isAutoUpdating: boolean;
|
|
228
|
+
isSingleton?: boolean;
|
|
229
|
+
organizationId: string;
|
|
230
|
+
slug: string;
|
|
231
|
+
sourceDir: string;
|
|
232
|
+
title: string;
|
|
233
|
+
version: string;
|
|
234
|
+
}): Promise<{
|
|
235
|
+
applicationId: string;
|
|
236
|
+
}>;
|
|
237
|
+
|
|
238
|
+
/** A view or service as the deploy report and `--json` output surface it. */
|
|
239
|
+
export declare interface DeployedExpose {
|
|
240
|
+
name: string;
|
|
241
|
+
src: string;
|
|
242
|
+
title: string;
|
|
243
|
+
type: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Deploy a workbench studio through Brett: redeploy when `appId` is set,
|
|
248
|
+
* otherwise create the studio at `studioHost`. Returns the application id for
|
|
249
|
+
* the shell to report; a missing `studioHost` on create is a usage error.
|
|
250
|
+
* @internal
|
|
251
|
+
*/
|
|
252
|
+
export declare function deployStudio(options: {
|
|
253
|
+
appId: string | undefined;
|
|
254
|
+
interfaces: readonly BrettInterface[];
|
|
255
|
+
isAutoUpdating: boolean;
|
|
256
|
+
organizationId: string;
|
|
257
|
+
output: Output;
|
|
258
|
+
projectId: string | undefined;
|
|
259
|
+
sourceDir: string;
|
|
260
|
+
studioHost: string | undefined;
|
|
261
|
+
title: string;
|
|
262
|
+
version: string;
|
|
263
|
+
workspaces: readonly BrettWorkspace[];
|
|
264
|
+
}): Promise<{
|
|
265
|
+
applicationId: string;
|
|
266
|
+
}>;
|
|
267
|
+
|
|
268
|
+
export declare function getApplication(
|
|
269
|
+
applicationId: string,
|
|
270
|
+
): Promise<Application | null>;
|
|
271
|
+
|
|
162
272
|
export declare function getWorkbench(
|
|
163
273
|
cliConfig: CliConfig | null | undefined,
|
|
164
274
|
): DeployableWorkbenchApp | null;
|
|
165
275
|
|
|
166
276
|
/** @public */
|
|
167
277
|
declare interface ResolvedWorkbenchApp {
|
|
168
|
-
/** A Sanity-owned singleton (e.g. the Media Library) — deploys its config, not an application. */
|
|
169
|
-
readonly isSingleton: boolean;
|
|
170
278
|
/** The app's unique `name` from `unstable_defineApp`. */
|
|
171
279
|
readonly name: string;
|
|
172
280
|
/** Background worker services the app declares. */
|
|
@@ -175,10 +283,14 @@ declare interface ResolvedWorkbenchApp {
|
|
|
175
283
|
readonly views: NonNullable<DefineAppInput["views"]>;
|
|
176
284
|
/** Resolved app kind — `studio` or one of the SDK app types. */
|
|
177
285
|
readonly applicationType?: string;
|
|
286
|
+
/** Deploys on its own path, separate from the interfaces. */
|
|
287
|
+
readonly config?: WorkbenchApp["config"];
|
|
178
288
|
/** SDK app-view entrypoint, when declared. */
|
|
179
289
|
readonly entry?: string;
|
|
180
|
-
/**
|
|
181
|
-
readonly
|
|
290
|
+
/** Explicit singleton flag (a Sanity-owned app); `undefined` when the app doesn't set it. */
|
|
291
|
+
readonly isSingleton?: boolean;
|
|
292
|
+
/** Hostname the application is created at on first deploy. */
|
|
293
|
+
readonly slug?: string;
|
|
182
294
|
}
|
|
183
295
|
|
|
184
296
|
/**
|
|
@@ -196,7 +308,7 @@ export declare function resolveInstallationId(options: {
|
|
|
196
308
|
* one of potentially many shapes.
|
|
197
309
|
* @internal
|
|
198
310
|
*/
|
|
199
|
-
export declare function
|
|
311
|
+
export declare function summarizeConfig(config: {
|
|
200
312
|
appType: string;
|
|
201
313
|
fields: {
|
|
202
314
|
name: string;
|
|
@@ -204,6 +316,19 @@ export declare function summarizeInstallationConfig(config: {
|
|
|
204
316
|
}[];
|
|
205
317
|
}): string;
|
|
206
318
|
|
|
319
|
+
/**
|
|
320
|
+
* The deploy summary of an app's exposes: the structured records (for `--json`)
|
|
321
|
+
* and one report line per non-empty group (for the human report).
|
|
322
|
+
* @internal
|
|
323
|
+
*/
|
|
324
|
+
export declare function summarizeExposes({
|
|
325
|
+
services,
|
|
326
|
+
views,
|
|
327
|
+
}: WorkbenchExposes): {
|
|
328
|
+
exposes: DeployedExpose[];
|
|
329
|
+
lines: string[];
|
|
330
|
+
};
|
|
331
|
+
|
|
207
332
|
declare type ViewDeploymentPayload = z.infer<
|
|
208
333
|
typeof viewDeploymentPayloadSchema
|
|
209
334
|
>;
|
|
@@ -251,4 +376,15 @@ declare const WORKBENCH_APP: unique symbol;
|
|
|
251
376
|
declare type WorkbenchApp = DefineAppResult &
|
|
252
377
|
z.output<typeof DefineAppInputSchema>;
|
|
253
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Bundled so adding a declaration family touches this type and the artifact
|
|
381
|
+
* expanders, not every hop of build/dev plumbing in between.
|
|
382
|
+
* @internal
|
|
383
|
+
*/
|
|
384
|
+
declare interface WorkbenchExposes {
|
|
385
|
+
config?: WorkbenchApp["config"];
|
|
386
|
+
services?: DefineAppInput["services"];
|
|
387
|
+
views?: DefineAppInput["views"];
|
|
388
|
+
}
|
|
389
|
+
|
|
254
390
|
export {};
|
package/dist/_exports/deploy.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export { buildExposes, summarizeExposes } from '../actions/deploy/buildExposes.js';
|
|
1
2
|
export { checkBuiltOutput } from '../actions/deploy/checkBuiltOutput.js';
|
|
2
|
-
export {
|
|
3
|
+
export { deployConfig, resolveInstallationId, summarizeConfig } from '../actions/deploy/deployConfig.js';
|
|
4
|
+
export { deployCoreApp, deployStudio, getApplication } from '../actions/deploy/deployWorkbenchApp.js';
|
|
3
5
|
export { getWorkbench } from '../actions/deploy/getWorkbench.js';
|
|
4
6
|
|
|
5
7
|
//# sourceMappingURL=deploy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/_exports/deploy.ts"],"sourcesContent":["export {checkBuiltOutput} from '../actions/deploy/checkBuiltOutput.js'\nexport {\n
|
|
1
|
+
{"version":3,"sources":["../../src/_exports/deploy.ts"],"sourcesContent":["export {\n type BrettInterface,\n buildExposes,\n type DeployedExpose,\n summarizeExposes,\n} from '../actions/deploy/buildExposes.js'\nexport {checkBuiltOutput} from '../actions/deploy/checkBuiltOutput.js'\nexport {\n deployConfig,\n resolveInstallationId,\n summarizeConfig,\n} from '../actions/deploy/deployConfig.js'\nexport {\n type Application,\n type BrettWorkspace,\n deployCoreApp,\n deployStudio,\n getApplication,\n} from '../actions/deploy/deployWorkbenchApp.js'\nexport {getWorkbench} from '../actions/deploy/getWorkbench.js'\n"],"names":["buildExposes","summarizeExposes","checkBuiltOutput","deployConfig","resolveInstallationId","summarizeConfig","deployCoreApp","deployStudio","getApplication","getWorkbench"],"mappings":"AAAA,SAEEA,YAAY,EAEZC,gBAAgB,QACX,oCAAmC;AAC1C,SAAQC,gBAAgB,QAAO,wCAAuC;AACtE,SACEC,YAAY,EACZC,qBAAqB,EACrBC,eAAe,QACV,oCAAmC;AAC1C,SAGEC,aAAa,EACbC,YAAY,EACZC,cAAc,QACT,0CAAyC;AAChD,SAAQC,YAAY,QAAO,oCAAmC"}
|
package/dist/_exports/dev.d.ts
CHANGED
|
@@ -30,9 +30,7 @@ declare type DevServerManifest = z.infer<typeof devServerManifestSchema>;
|
|
|
30
30
|
|
|
31
31
|
declare const devServerManifestSchema: z.ZodMiniObject<
|
|
32
32
|
{
|
|
33
|
-
|
|
34
|
-
id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
35
|
-
installationConfigs: z.ZodMiniOptional<
|
|
33
|
+
configs: z.ZodMiniOptional<
|
|
36
34
|
z.ZodMiniArray<
|
|
37
35
|
z.ZodMiniObject<
|
|
38
36
|
{
|
|
@@ -48,12 +46,16 @@ declare const devServerManifestSchema: z.ZodMiniObject<
|
|
|
48
46
|
z.core.$strip
|
|
49
47
|
>
|
|
50
48
|
>;
|
|
49
|
+
id: z.ZodMiniString<string>;
|
|
51
50
|
moduleName: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
51
|
+
version: z.ZodMiniNumber<number>;
|
|
52
52
|
},
|
|
53
53
|
z.core.$strip
|
|
54
54
|
>
|
|
55
55
|
>
|
|
56
56
|
>;
|
|
57
|
+
host: z.ZodMiniString<string>;
|
|
58
|
+
id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
57
59
|
interfaces: z.ZodMiniOptional<
|
|
58
60
|
z.ZodMiniArray<
|
|
59
61
|
z.ZodMiniObject<
|
|
@@ -61,6 +63,7 @@ declare const devServerManifestSchema: z.ZodMiniObject<
|
|
|
61
63
|
entry_point: z.ZodMiniString<string>;
|
|
62
64
|
interface_type: z.ZodMiniString<string>;
|
|
63
65
|
name: z.ZodMiniString<string>;
|
|
66
|
+
version: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
64
67
|
},
|
|
65
68
|
z.core.$strip
|
|
66
69
|
>
|
package/dist/_exports/index.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { z } from "zod/mini";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* User-facing input for `unstable_defineApp`. Excludes the internal
|
|
5
|
-
* `applicationType`, `isSingleton`, and `
|
|
5
|
+
* `applicationType`, `isSingleton`, and `config` — validated by the
|
|
6
6
|
* schema but not part of the public surface (Sanity-owned apps set them via
|
|
7
7
|
* `@ts-expect-error`).
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export declare type DefineAppInput = Omit<
|
|
11
11
|
z.output<typeof DefineAppInputSchema>,
|
|
12
|
-
"applicationType" | "
|
|
12
|
+
"applicationType" | "config" | "isSingleton"
|
|
13
13
|
>;
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -29,16 +29,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
29
29
|
dashboard: "dashboard";
|
|
30
30
|
}>
|
|
31
31
|
>;
|
|
32
|
-
|
|
33
|
-
group: z.ZodMiniOptional<
|
|
34
|
-
z.ZodMiniEnum<{
|
|
35
|
-
"dock.system": "dock.system";
|
|
36
|
-
"dock.applications": "dock.applications";
|
|
37
|
-
"dock.user": "dock.user";
|
|
38
|
-
}>
|
|
39
|
-
>;
|
|
40
|
-
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
41
|
-
installationConfig: z.ZodMiniOptional<
|
|
32
|
+
config: z.ZodMiniOptional<
|
|
42
33
|
z.ZodMiniDiscriminatedUnion<
|
|
43
34
|
[
|
|
44
35
|
z.ZodMiniObject<
|
|
@@ -62,6 +53,15 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
62
53
|
"appType"
|
|
63
54
|
>
|
|
64
55
|
>;
|
|
56
|
+
entry: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
57
|
+
group: z.ZodMiniOptional<
|
|
58
|
+
z.ZodMiniEnum<{
|
|
59
|
+
"dock.system": "dock.system";
|
|
60
|
+
"dock.applications": "dock.applications";
|
|
61
|
+
"dock.user": "dock.user";
|
|
62
|
+
}>
|
|
63
|
+
>;
|
|
64
|
+
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
65
65
|
isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
66
66
|
name: z.ZodMiniString<string>;
|
|
67
67
|
organizationId: z.ZodMiniString<string>;
|
|
@@ -72,6 +72,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
72
72
|
[
|
|
73
73
|
z.ZodMiniObject<
|
|
74
74
|
{
|
|
75
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
75
76
|
name: z.ZodMiniString<string>;
|
|
76
77
|
src: z.ZodMiniString<string>;
|
|
77
78
|
type: z.ZodMiniLiteral<"worker">;
|
|
@@ -83,6 +84,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
83
84
|
>
|
|
84
85
|
>
|
|
85
86
|
>;
|
|
87
|
+
slug: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
86
88
|
title: z.ZodMiniString<string>;
|
|
87
89
|
views: z.ZodMiniOptional<
|
|
88
90
|
z.ZodMiniArray<
|
|
@@ -90,6 +92,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
90
92
|
[
|
|
91
93
|
z.ZodMiniObject<
|
|
92
94
|
{
|
|
95
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
93
96
|
name: z.ZodMiniString<string>;
|
|
94
97
|
src: z.ZodMiniString<string>;
|
|
95
98
|
type: z.ZodMiniLiteral<"panel">;
|
|
@@ -269,7 +272,7 @@ export declare function unstable_defineApp(
|
|
|
269
272
|
): DefineAppResult;
|
|
270
273
|
|
|
271
274
|
/**
|
|
272
|
-
* Declare the Sanity Media Library as a workbench app — a singleton whose `fields` become its
|
|
275
|
+
* Declare the Sanity Media Library as a workbench app — a singleton whose `fields` become its config.
|
|
273
276
|
* @public
|
|
274
277
|
*/
|
|
275
278
|
export declare function unstable_defineMediaLibrary(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { configArtifacts } from './configs/artifact.js';
|
|
2
2
|
import { serviceArtifacts } from './services/artifact.js';
|
|
3
3
|
import { viewArtifacts } from './views/artifact.js';
|
|
4
4
|
/**
|
|
@@ -23,7 +23,7 @@ import { viewArtifacts } from './views/artifact.js';
|
|
|
23
23
|
return [
|
|
24
24
|
...viewArtifacts(exposes.views ?? []),
|
|
25
25
|
...serviceArtifacts(exposes.services ?? []),
|
|
26
|
-
...
|
|
26
|
+
...configArtifacts(exposes.config)
|
|
27
27
|
];
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/build/artifact.ts"],"sourcesContent":["import {type WorkbenchExposes} from '../../resolveWorkbenchApp.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/build/artifact.ts"],"sourcesContent":["import {type WorkbenchExposes} from '../../resolveWorkbenchApp.js'\nimport {configArtifacts} from './configs/artifact.js'\nimport {serviceArtifacts} from './services/artifact.js'\nimport {viewArtifacts} from './views/artifact.js'\n\n/**\n * What a {@link GeneratedArtifact.source} builder receives from the build — the\n * one thing it can't compute on its own, since only the build knows where the\n * runtime dir sits relative to the app's `src`.\n */\ninterface ArtifactContext {\n /** Import specifier for an app `src` file, relative to this artifact. */\n resolveImport: (src: string) => string\n}\n\n/**\n * One file the federation build generates into the runtime dir for a declared\n * interface. Each interface type — views, services — expands its declarations\n * into a flat list of these; the build then writes them and maps the ones the\n * host loads directly into the module-federation manifest.\n *\n * Adding an interface type is adding a builder that returns\n * `GeneratedArtifact[]` — the write loop and the expose mapping never change.\n */\nexport interface GeneratedArtifact {\n /** Path relative to the federation runtime dir, e.g. `views/feed/panel.js`. */\n path: string\n /** Build the file's contents. */\n source: (context: ArtifactContext) => string\n\n /**\n * Module-federation expose key when the host loads this artifact directly —\n * a view component `./views/feed/panel`, a service loader `./services/unread`.\n * Omitted for a file the host never loads on its own, like a worker bundle\n * (reached through its sibling loader).\n */\n expose?: string\n}\n\n/**\n * Map the artifacts the host loads directly (those with an `expose`) to their\n * runtime-dir paths, for the module-federation `exposes` field. `toExposePath`\n * turns a runtime-relative artifact path into the value federation wants — the\n * caller owns the runtime-dir location and any entry resolution.\n */\nexport function artifactExposes(\n artifacts: readonly GeneratedArtifact[],\n toExposePath: (artifactPath: string) => string,\n): Record<string, string> {\n const exposes: Record<string, string> = {}\n for (const artifact of artifacts) {\n if (artifact.expose) {\n exposes[artifact.expose] = toExposePath(artifact.path)\n }\n }\n return exposes\n}\n\n/**\n * Expand what the app exposes into the flat artifact set the federation build\n * writes — the single place that composes the per-type expanders, so the expose\n * mapping and the file writing read from one expansion.\n */\nexport function workbenchArtifacts(exposes: WorkbenchExposes): GeneratedArtifact[] {\n return [\n ...viewArtifacts(exposes.views ?? []),\n ...serviceArtifacts(exposes.services ?? []),\n ...configArtifacts(exposes.config),\n ]\n}\n"],"names":["configArtifacts","serviceArtifacts","viewArtifacts","artifactExposes","artifacts","toExposePath","exposes","artifact","expose","path","workbenchArtifacts","views","services","config"],"mappings":"AACA,SAAQA,eAAe,QAAO,wBAAuB;AACrD,SAAQC,gBAAgB,QAAO,yBAAwB;AACvD,SAAQC,aAAa,QAAO,sBAAqB;AAoCjD;;;;;CAKC,GACD,OAAO,SAASC,gBACdC,SAAuC,EACvCC,YAA8C;IAE9C,MAAMC,UAAkC,CAAC;IACzC,KAAK,MAAMC,YAAYH,UAAW;QAChC,IAAIG,SAASC,MAAM,EAAE;YACnBF,OAAO,CAACC,SAASC,MAAM,CAAC,GAAGH,aAAaE,SAASE,IAAI;QACvD;IACF;IACA,OAAOH;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASI,mBAAmBJ,OAAyB;IAC1D,OAAO;WACFJ,cAAcI,QAAQK,KAAK,IAAI,EAAE;WACjCV,iBAAiBK,QAAQM,QAAQ,IAAI,EAAE;WACvCZ,gBAAgBM,QAAQO,MAAM;KAClC;AACH"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { INSTALLATION_CONFIG_TYPE,
|
|
1
|
+
import { INSTALLATION_CONFIG_TYPE, MEDIA_LIBRARY_CONFIG_CONTRACT_VERSION } from '../../../contract.js';
|
|
2
2
|
const CONFIGS_DIR_NAME = 'configs';
|
|
3
|
-
/** Expand the
|
|
3
|
+
/** Expand the config into one federation module aggregating all fields, so the host imports one live config value. */ export function configArtifacts(config) {
|
|
4
4
|
if (!config) return [];
|
|
5
5
|
return [
|
|
6
6
|
{
|
|
7
7
|
expose: `./${CONFIGS_DIR_NAME}/${INSTALLATION_CONFIG_TYPE}`,
|
|
8
8
|
path: `${CONFIGS_DIR_NAME}/${INSTALLATION_CONFIG_TYPE}.js`,
|
|
9
|
-
source: ({ resolveImport })=>
|
|
9
|
+
source: ({ resolveImport })=>mediaLibraryConfigSource({
|
|
10
10
|
config,
|
|
11
11
|
resolveImport
|
|
12
12
|
})
|
|
@@ -17,7 +17,7 @@ const CONFIGS_DIR_NAME = 'configs';
|
|
|
17
17
|
* Emits `export const config`: each field's serializable `{name, title, public}`
|
|
18
18
|
* plus its live `defineField` value, the one thing the wire can't carry.
|
|
19
19
|
* `appType` stays off the module — the host assigns it from the wire record.
|
|
20
|
-
*/ function
|
|
20
|
+
*/ function mediaLibraryConfigSource(input) {
|
|
21
21
|
const { config, resolveImport } = input;
|
|
22
22
|
const imports = config.fields.map((field, index)=>`import field_${index} from ${JSON.stringify(resolveImport(field.src))}`).join('\n');
|
|
23
23
|
const entries = config.fields.map((field, index)=>` {name: ${JSON.stringify(field.name)}, title: ${JSON.stringify(field.title)}, ` + `public: ${JSON.stringify(Boolean(field.public))}, config: field_${index}},`).join('\n');
|
|
@@ -27,7 +27,7 @@ const CONFIGS_DIR_NAME = 'configs';
|
|
|
27
27
|
${imports}
|
|
28
28
|
|
|
29
29
|
export const type = ${JSON.stringify(INSTALLATION_CONFIG_TYPE)}
|
|
30
|
-
export const version = ${
|
|
30
|
+
export const version = ${MEDIA_LIBRARY_CONFIG_CONTRACT_VERSION}
|
|
31
31
|
export const config = {
|
|
32
32
|
fields: [
|
|
33
33
|
${entries}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/build/configs/artifact.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/build/configs/artifact.ts"],"sourcesContent":["import {INSTALLATION_CONFIG_TYPE, MEDIA_LIBRARY_CONFIG_CONTRACT_VERSION} from '../../../contract.js'\nimport {type GeneratedArtifact} from '../artifact.js'\n\nconst CONFIGS_DIR_NAME = 'configs'\n\n/**\n * The config to generate a module for.\n * @internal\n */\nexport interface ConfigArtifact {\n fields: {name: string; public?: boolean; src: string; title: string}[]\n}\n\n/** Expand the config into one federation module aggregating all fields, so the host imports one live config value. */\nexport function configArtifacts(config: ConfigArtifact | undefined): GeneratedArtifact[] {\n if (!config) return []\n return [\n {\n expose: `./${CONFIGS_DIR_NAME}/${INSTALLATION_CONFIG_TYPE}`,\n path: `${CONFIGS_DIR_NAME}/${INSTALLATION_CONFIG_TYPE}.js`,\n source: ({resolveImport}) => mediaLibraryConfigSource({config, resolveImport}),\n },\n ]\n}\n\n/**\n * Emits `export const config`: each field's serializable `{name, title, public}`\n * plus its live `defineField` value, the one thing the wire can't carry.\n * `appType` stays off the module — the host assigns it from the wire record.\n */\nfunction mediaLibraryConfigSource(input: {\n config: ConfigArtifact\n resolveImport: (src: string) => string\n}): string {\n const {config, resolveImport} = input\n const imports = config.fields\n .map((field, index) => `import field_${index} from ${JSON.stringify(resolveImport(field.src))}`)\n .join('\\n')\n const entries = config.fields\n .map(\n (field, index) =>\n ` {name: ${JSON.stringify(field.name)}, title: ${JSON.stringify(field.title)}, ` +\n `public: ${JSON.stringify(Boolean(field.public))}, config: field_${index}},`,\n )\n .join('\\n')\n return `\\\n// This file is auto-generated on 'sanity build' / 'sanity dev'\n// Modifications to this file are automatically discarded\n${imports}\n\nexport const type = ${JSON.stringify(INSTALLATION_CONFIG_TYPE)}\nexport const version = ${MEDIA_LIBRARY_CONFIG_CONTRACT_VERSION}\nexport const config = {\n fields: [\n${entries}\n ],\n}\n\nif (import.meta.hot) {\n // A config is data, not a rendered island with a live root to remount —\n // self-accept so a field edit swaps the module in place; the host re-reads it.\n import.meta.hot.accept()\n}\n`\n}\n"],"names":["INSTALLATION_CONFIG_TYPE","MEDIA_LIBRARY_CONFIG_CONTRACT_VERSION","CONFIGS_DIR_NAME","configArtifacts","config","expose","path","source","resolveImport","mediaLibraryConfigSource","input","imports","fields","map","field","index","JSON","stringify","src","join","entries","name","title","Boolean","public"],"mappings":"AAAA,SAAQA,wBAAwB,EAAEC,qCAAqC,QAAO,uBAAsB;AAGpG,MAAMC,mBAAmB;AAUzB,oHAAoH,GACpH,OAAO,SAASC,gBAAgBC,MAAkC;IAChE,IAAI,CAACA,QAAQ,OAAO,EAAE;IACtB,OAAO;QACL;YACEC,QAAQ,CAAC,EAAE,EAAEH,iBAAiB,CAAC,EAAEF,0BAA0B;YAC3DM,MAAM,GAAGJ,iBAAiB,CAAC,EAAEF,yBAAyB,GAAG,CAAC;YAC1DO,QAAQ,CAAC,EAACC,aAAa,EAAC,GAAKC,yBAAyB;oBAACL;oBAAQI;gBAAa;QAC9E;KACD;AACH;AAEA;;;;CAIC,GACD,SAASC,yBAAyBC,KAGjC;IACC,MAAM,EAACN,MAAM,EAAEI,aAAa,EAAC,GAAGE;IAChC,MAAMC,UAAUP,OAAOQ,MAAM,CAC1BC,GAAG,CAAC,CAACC,OAAOC,QAAU,CAAC,aAAa,EAAEA,MAAM,MAAM,EAAEC,KAAKC,SAAS,CAACT,cAAcM,MAAMI,GAAG,IAAI,EAC9FC,IAAI,CAAC;IACR,MAAMC,UAAUhB,OAAOQ,MAAM,CAC1BC,GAAG,CACF,CAACC,OAAOC,QACN,CAAC,WAAW,EAAEC,KAAKC,SAAS,CAACH,MAAMO,IAAI,EAAE,SAAS,EAAEL,KAAKC,SAAS,CAACH,MAAMQ,KAAK,EAAE,EAAE,CAAC,GACnF,CAAC,QAAQ,EAAEN,KAAKC,SAAS,CAACM,QAAQT,MAAMU,MAAM,GAAG,gBAAgB,EAAET,MAAM,EAAE,CAAC,EAE/EI,IAAI,CAAC;IACR,OAAO,CAAC;;;AAGV,EAAER,QAAQ;;oBAEU,EAAEK,KAAKC,SAAS,CAACjB,0BAA0B;uBACxC,EAAEC,sCAAsC;;;AAG/D,EAAEmB,QAAQ;;;;;;;;;AASV,CAAC;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/deploy/apiVersion.ts"],"sourcesContent":["// The app endpoints (applications + installations) live behind the\n// experimental `vX` version; a dated version returns 501.\nexport const APP_WORKBENCH_API_VERSION = 'vX'\n"],"names":["APP_WORKBENCH_API_VERSION"],"mappings":"AAAA,mEAAmE;AACnE,0DAA0D;AAC1D,OAAO,MAAMA,4BAA4B,KAAI"}
|