@sanity/workbench-cli 1.8.0 → 1.10.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 (53) hide show
  1. package/dist/_exports/build.d.ts +48 -11
  2. package/dist/_exports/deploy.d.ts +53 -72
  3. package/dist/_exports/deploy.js +1 -1
  4. package/dist/_exports/deploy.js.map +1 -1
  5. package/dist/_exports/dev.d.ts +36 -0
  6. package/dist/_exports/index.d.ts +118 -9
  7. package/dist/_exports/index.js.map +1 -1
  8. package/dist/_exports/init.d.ts +5 -3
  9. package/dist/_exports/init.js +2 -1
  10. package/dist/_exports/init.js.map +1 -1
  11. package/dist/_exports/preview.d.ts +36 -0
  12. package/dist/_exports/undeploy.d.ts +50 -11
  13. package/dist/actions/deploy/deployConfig.js +1 -1
  14. package/dist/actions/deploy/deployConfig.js.map +1 -1
  15. package/dist/actions/deploy/deployWorkbenchApp.js +10 -2
  16. package/dist/actions/deploy/deployWorkbenchApp.js.map +1 -1
  17. package/dist/actions/deploy/summarizeInterfaces.js +33 -0
  18. package/dist/actions/deploy/summarizeInterfaces.js.map +1 -0
  19. package/dist/actions/deploy/viewDeployment.js +3 -1
  20. package/dist/actions/deploy/viewDeployment.js.map +1 -1
  21. package/dist/actions/dev/{deriveInterfaces.js → deriveConfigs.js} +3 -54
  22. package/dist/actions/dev/deriveConfigs.js.map +1 -0
  23. package/dist/actions/dev/exposesSetId.js +1 -1
  24. package/dist/actions/dev/exposesSetId.js.map +1 -1
  25. package/dist/actions/dev/registry.js +12 -2
  26. package/dist/actions/dev/registry.js.map +1 -1
  27. package/dist/actions/dev/startDevManifestWatcher.js.map +1 -1
  28. package/dist/actions/dev/startDevServerRegistration.js +2 -1
  29. package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
  30. package/dist/actions/init/cliConfig.js +2 -4
  31. package/dist/actions/init/cliConfig.js.map +1 -1
  32. package/dist/actions/preview/startWorkbenchPreview.js +2 -1
  33. package/dist/actions/preview/startWorkbenchPreview.js.map +1 -1
  34. package/dist/actions/undeploy/workbenchUndeployAdapter.js +3 -3
  35. package/dist/actions/undeploy/workbenchUndeployAdapter.js.map +1 -1
  36. package/dist/appId.js +1 -1
  37. package/dist/appId.js.map +1 -1
  38. package/dist/appSlug.js +7 -0
  39. package/dist/appSlug.js.map +1 -0
  40. package/dist/contract.js +60 -4
  41. package/dist/contract.js.map +1 -1
  42. package/dist/defineApp.js +7 -7
  43. package/dist/defineApp.js.map +1 -1
  44. package/dist/defineView.js.map +1 -1
  45. package/dist/deriveInterfaces.js +63 -0
  46. package/dist/deriveInterfaces.js.map +1 -0
  47. package/dist/resolveWorkbenchApp.js +0 -1
  48. package/dist/resolveWorkbenchApp.js.map +1 -1
  49. package/dist/services/applications.js.map +1 -1
  50. package/package.json +7 -6
  51. package/dist/actions/deploy/buildExposes.js +0 -72
  52. package/dist/actions/deploy/buildExposes.js.map +0 -1
  53. package/dist/actions/dev/deriveInterfaces.js.map +0 -1
@@ -3,6 +3,14 @@ import { CliConfig } from "@sanity/cli-core";
3
3
  import { PluginOption } from "vite";
4
4
  import { z } from "zod/mini";
5
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
+
6
14
  /**
7
15
  * The `build`/`start` id — a hash of the app's declared shape (its identity, not
8
16
  * its code), so the bundle inlined by `sanity build` and the registry entry
@@ -14,10 +22,11 @@ export declare function buildAppId(app: ResolvedWorkbenchApp): Promise<string>;
14
22
 
15
23
  /**
16
24
  * User-facing input for `unstable_defineApp`. Excludes the internal
17
- * `applicationType`, `isSingleton`, and `config` — validated by the
18
- * schema but not part of the public surface (Sanity-owned apps set them via
19
- * `@ts-expect-error`). A union so an app declares an app `entry` or `views`,
20
- * never both.
25
+ * `applicationType`, `isSingleton`, and `config` — validated by the schema but
26
+ * not part of the public surface (Sanity-owned apps set them via
27
+ * `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
28
+ * panel `views`, never both — but `asset_source` and `tile` views are separate
29
+ * kinds and may accompany either.
21
30
  * @public
22
31
  */
23
32
  declare type DefineAppInput = Omit<
@@ -31,7 +40,7 @@ declare type DefineAppInput = Omit<
31
40
  }
32
41
  | {
33
42
  entry?: string;
34
- views?: never;
43
+ views?: (AssetSourceView | TileView)[];
35
44
  }
36
45
  );
37
46
 
@@ -84,7 +93,6 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
84
93
  >;
85
94
  icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
86
95
  isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
87
- name: z.ZodMiniString<string>;
88
96
  organizationId: z.ZodMiniString<string>;
89
97
  priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
90
98
  services: z.ZodMiniOptional<
@@ -93,7 +101,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
93
101
  [
94
102
  z.ZodMiniObject<
95
103
  {
96
- title: z.ZodMiniOptional<z.ZodMiniString<string>>;
104
+ title: z.ZodMiniString<string>;
97
105
  name: z.ZodMiniString<string>;
98
106
  src: z.ZodMiniString<string>;
99
107
  type: z.ZodMiniLiteral<"worker">;
@@ -113,13 +121,37 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
113
121
  [
114
122
  z.ZodMiniObject<
115
123
  {
116
- title: z.ZodMiniOptional<z.ZodMiniString<string>>;
124
+ title: z.ZodMiniString<string>;
117
125
  name: z.ZodMiniString<string>;
118
126
  src: z.ZodMiniString<string>;
119
127
  type: z.ZodMiniLiteral<"panel">;
120
128
  },
121
129
  z.core.$strip
122
130
  >,
131
+ z.ZodMiniObject<
132
+ {
133
+ title: z.ZodMiniString<string>;
134
+ name: z.ZodMiniString<string>;
135
+ src: z.ZodMiniString<string>;
136
+ type: z.ZodMiniLiteral<"asset_source">;
137
+ },
138
+ z.core.$strip
139
+ >,
140
+ z.ZodMiniObject<
141
+ {
142
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
143
+ size: z.ZodMiniEnum<{
144
+ small: "small";
145
+ large: "large";
146
+ banner: "banner";
147
+ }>;
148
+ title: z.ZodMiniString<string>;
149
+ name: z.ZodMiniString<string>;
150
+ src: z.ZodMiniString<string>;
151
+ type: z.ZodMiniLiteral<"tile">;
152
+ },
153
+ z.core.$strip
154
+ >,
123
155
  ],
124
156
  "type"
125
157
  >
@@ -147,13 +179,10 @@ declare type DefineAppResult = DefineAppInput & {
147
179
 
148
180
  /** @public */
149
181
  declare interface ResolvedWorkbenchApp {
150
- /** The app's unique `name` from `unstable_defineApp`. */
151
- readonly name: string;
152
182
  /** Organization that owns the app — part of its build-id identity. */
153
183
  readonly organizationId: string;
154
184
  /** Background worker services the app declares. */
155
185
  readonly services: NonNullable<DefineAppInput["services"]>;
156
- /** Hostname the application is created at on first deploy. */
157
186
  readonly slug: string;
158
187
  /** Dock panel views the app declares. */
159
188
  readonly views: NonNullable<DefineAppInput["views"]>;
@@ -179,6 +208,14 @@ export declare function resolveWorkbenchApp(
179
208
  cliConfig: CliConfig | null | undefined,
180
209
  ): ResolvedWorkbenchApp | null;
181
210
 
211
+ /** The `tile` variant of an app's `views`. @public */
212
+ declare type TileView = Extract<
213
+ NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
214
+ {
215
+ type: "tile";
216
+ }
217
+ >;
218
+
182
219
  /**
183
220
  * Nominal brand the CLI discriminates on to enable the workbench build/deploy
184
221
  * codepath. Registered via `Symbol.for` so the marker survives module-realm
@@ -3,22 +3,6 @@ import { CliConfig } from "@sanity/cli-core";
3
3
  import { Output } from "@sanity/cli-core";
4
4
  import { z } from "zod/mini";
5
5
 
6
- /** @internal */
7
- declare type AppInterfaceMetadata = z.infer<typeof AppInterfaceMetadataSchema>;
8
-
9
- /**
10
- * The `app` interface's dock-placement metadata. Interface metadata is
11
- * discriminated on `type`; `app` is the only type with a shape so far.
12
- * @internal
13
- */
14
- declare const AppInterfaceMetadataSchema: z.ZodMiniObject<
15
- {
16
- group: z.ZodMiniOptional<z.ZodMiniString<string>>;
17
- priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
18
- },
19
- z.core.$strip
20
- >;
21
-
22
6
  export declare interface Application {
23
7
  id: string;
24
8
  organizationId: string;
@@ -29,31 +13,13 @@ export declare interface Application {
29
13
 
30
14
  declare type ApplicationType = "coreApp" | "studio";
31
15
 
32
- /**
33
- * An interface as Brett stores it, discriminated on `type`. `moduleId` is
34
- * remote-relative — the host prepends the app's id. Brett assigns the id.
35
- * @internal
36
- */
37
- export declare type BrettInterface =
38
- | (BrettInterfaceBase & {
39
- metadata: AppInterfaceMetadata | null;
40
- type: "app";
41
- })
42
- | (BrettInterfaceBase & {
43
- metadata: null;
44
- type: "panel";
45
- })
46
- | (BrettInterfaceBase & {
47
- metadata: null;
48
- type: "worker";
49
- });
50
-
51
- declare interface BrettInterfaceBase {
52
- moduleId: string;
53
- name: string;
54
- title: string;
55
- version: string;
56
- }
16
+ /** The `asset_source` variant of an app's `views`. @public */
17
+ declare type AssetSourceView = Extract<
18
+ NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
19
+ {
20
+ type: "asset_source";
21
+ }
22
+ >;
57
23
 
58
24
  /** A studio workspace as Brett stores it. */
59
25
  export declare interface BrettWorkspace {
@@ -68,24 +34,6 @@ export declare interface BrettWorkspace {
68
34
  title?: string;
69
35
  }
70
36
 
71
- /**
72
- * The interface records deploy sends: the app view (only when `exposesAppView`),
73
- * every view, and every service.
74
- * @internal
75
- */
76
- export declare function buildExposes(
77
- exposes: WorkbenchExposes,
78
- { appName, appTitle, exposesAppView, version }: BuildExposesContext,
79
- ): BrettInterface[];
80
-
81
- declare interface BuildExposesContext {
82
- appName: string;
83
- appTitle: string;
84
- /** Whether the build exposes the app view (`./App`) — apps with an `entry`, and every studio. */
85
- exposesAppView: boolean;
86
- version: string;
87
- }
88
-
89
37
  /**
90
38
  * Throws unless `sourceDir` is a directory holding a federation build.
91
39
  * A workbench build always emits a module-federation remote, and may
@@ -128,14 +76,16 @@ export declare function createStudio(options: {
128
76
  projectId: string | undefined;
129
77
  slug: string;
130
78
  title: string;
79
+ visibility?: AppVisibility;
131
80
  }): Promise<CreatedApplication>;
132
81
 
133
82
  /**
134
83
  * User-facing input for `unstable_defineApp`. Excludes the internal
135
- * `applicationType`, `isSingleton`, and `config` — validated by the
136
- * schema but not part of the public surface (Sanity-owned apps set them via
137
- * `@ts-expect-error`). A union so an app declares an app `entry` or `views`,
138
- * never both.
84
+ * `applicationType`, `isSingleton`, and `config` — validated by the schema but
85
+ * not part of the public surface (Sanity-owned apps set them via
86
+ * `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
87
+ * panel `views`, never both — but `asset_source` and `tile` views are separate
88
+ * kinds and may accompany either.
139
89
  * @public
140
90
  */
141
91
  declare type DefineAppInput = Omit<
@@ -149,7 +99,7 @@ declare type DefineAppInput = Omit<
149
99
  }
150
100
  | {
151
101
  entry?: string;
152
- views?: never;
102
+ views?: (AssetSourceView | TileView)[];
153
103
  }
154
104
  );
155
105
 
@@ -202,7 +152,6 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
202
152
  >;
203
153
  icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
204
154
  isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
205
- name: z.ZodMiniString<string>;
206
155
  organizationId: z.ZodMiniString<string>;
207
156
  priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
208
157
  services: z.ZodMiniOptional<
@@ -211,7 +160,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
211
160
  [
212
161
  z.ZodMiniObject<
213
162
  {
214
- title: z.ZodMiniOptional<z.ZodMiniString<string>>;
163
+ title: z.ZodMiniString<string>;
215
164
  name: z.ZodMiniString<string>;
216
165
  src: z.ZodMiniString<string>;
217
166
  type: z.ZodMiniLiteral<"worker">;
@@ -231,13 +180,37 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
231
180
  [
232
181
  z.ZodMiniObject<
233
182
  {
234
- title: z.ZodMiniOptional<z.ZodMiniString<string>>;
183
+ title: z.ZodMiniString<string>;
235
184
  name: z.ZodMiniString<string>;
236
185
  src: z.ZodMiniString<string>;
237
186
  type: z.ZodMiniLiteral<"panel">;
238
187
  },
239
188
  z.core.$strip
240
189
  >,
190
+ z.ZodMiniObject<
191
+ {
192
+ title: z.ZodMiniString<string>;
193
+ name: z.ZodMiniString<string>;
194
+ src: z.ZodMiniString<string>;
195
+ type: z.ZodMiniLiteral<"asset_source">;
196
+ },
197
+ z.core.$strip
198
+ >,
199
+ z.ZodMiniObject<
200
+ {
201
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
202
+ size: z.ZodMiniEnum<{
203
+ small: "small";
204
+ large: "large";
205
+ banner: "banner";
206
+ }>;
207
+ title: z.ZodMiniString<string>;
208
+ name: z.ZodMiniString<string>;
209
+ src: z.ZodMiniString<string>;
210
+ type: z.ZodMiniLiteral<"tile">;
211
+ },
212
+ z.core.$strip
213
+ >,
241
214
  ],
242
215
  "type"
243
216
  >
@@ -319,9 +292,10 @@ export declare interface DeployedExpose {
319
292
  * @internal
320
293
  */
321
294
  export declare function deployWorkbenchApp(options: {
295
+ app: CliConfig["app"];
322
296
  applicationId: string;
323
297
  icon?: string;
324
- interfaces: readonly BrettInterface[];
298
+ isApp: boolean;
325
299
  isAutoUpdating: boolean;
326
300
  label?: string;
327
301
  onDeployed?: () => void;
@@ -354,13 +328,10 @@ export declare function listApplications(
354
328
 
355
329
  /** @public */
356
330
  declare interface ResolvedWorkbenchApp {
357
- /** The app's unique `name` from `unstable_defineApp`. */
358
- readonly name: string;
359
331
  /** Organization that owns the app — part of its build-id identity. */
360
332
  readonly organizationId: string;
361
333
  /** Background worker services the app declares. */
362
334
  readonly services: NonNullable<DefineAppInput["services"]>;
363
- /** Hostname the application is created at on first deploy. */
364
335
  readonly slug: string;
365
336
  /** Dock panel views the app declares. */
366
337
  readonly views: NonNullable<DefineAppInput["views"]>;
@@ -407,7 +378,7 @@ export declare function summarizeConfig(config: {
407
378
  * and one report line per non-empty group (for the human report).
408
379
  * @internal
409
380
  */
410
- export declare function summarizeExposes({
381
+ export declare function summarizeInterfaces({
411
382
  services,
412
383
  views,
413
384
  }: WorkbenchExposes): {
@@ -415,6 +386,14 @@ export declare function summarizeExposes({
415
386
  lines: string[];
416
387
  };
417
388
 
389
+ /** The `tile` variant of an app's `views`. @public */
390
+ declare type TileView = Extract<
391
+ NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
392
+ {
393
+ type: "tile";
394
+ }
395
+ >;
396
+
418
397
  declare type ViewDeploymentPayload = z.infer<
419
398
  typeof viewDeploymentPayloadSchema
420
399
  >;
@@ -435,7 +414,9 @@ declare const viewDeploymentPayloadSchema: z.ZodMiniObject<
435
414
  name: z.ZodMiniString<string>;
436
415
  src: z.ZodMiniString<string>;
437
416
  type: z.ZodMiniEnum<{
417
+ asset_source: "asset_source";
438
418
  panel: "panel";
419
+ tile: "tile";
439
420
  }>;
440
421
  },
441
422
  z.core.$loose
@@ -1,8 +1,8 @@
1
- export { buildExposes, summarizeExposes } from '../actions/deploy/buildExposes.js';
2
1
  export { checkBuiltOutput } from '../actions/deploy/checkBuiltOutput.js';
3
2
  export { deployConfig, resolveInstallationId, summarizeConfig } from '../actions/deploy/deployConfig.js';
4
3
  export { createCoreApp, createStudio, deployWorkbenchApp } from '../actions/deploy/deployWorkbenchApp.js';
5
4
  export { getWorkbench } from '../actions/deploy/getWorkbench.js';
5
+ export { summarizeInterfaces } from '../actions/deploy/summarizeInterfaces.js';
6
6
  export { getApplication, getApplicationUrl, getWorkbenchUrl, listApplications } from '../services/applications.js';
7
7
 
8
8
  //# sourceMappingURL=deploy.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/_exports/deploy.ts"],"sourcesContent":["export {\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 createCoreApp,\n type CreatedApplication,\n createStudio,\n deployWorkbenchApp,\n} from '../actions/deploy/deployWorkbenchApp.js'\nexport {getWorkbench} from '../actions/deploy/getWorkbench.js'\nexport {\n type Application,\n type BrettInterface,\n type BrettWorkspace,\n getApplication,\n getApplicationUrl,\n getWorkbenchUrl,\n listApplications,\n} from '../services/applications.js'\n"],"names":["buildExposes","summarizeExposes","checkBuiltOutput","deployConfig","resolveInstallationId","summarizeConfig","createCoreApp","createStudio","deployWorkbenchApp","getWorkbench","getApplication","getApplicationUrl","getWorkbenchUrl","listApplications"],"mappings":"AAAA,SACEA,YAAY,EAEZC,gBAAgB,QACX,oCAAmC;AAC1C,SAAQC,gBAAgB,QAAO,wCAAuC;AACtE,SACEC,YAAY,EACZC,qBAAqB,EACrBC,eAAe,QACV,oCAAmC;AAC1C,SACEC,aAAa,EAEbC,YAAY,EACZC,kBAAkB,QACb,0CAAyC;AAChD,SAAQC,YAAY,QAAO,oCAAmC;AAC9D,SAIEC,cAAc,EACdC,iBAAiB,EACjBC,eAAe,EACfC,gBAAgB,QACX,8BAA6B"}
1
+ {"version":3,"sources":["../../src/_exports/deploy.ts"],"sourcesContent":["export {checkBuiltOutput} from '../actions/deploy/checkBuiltOutput.js'\nexport {\n deployConfig,\n resolveInstallationId,\n summarizeConfig,\n} from '../actions/deploy/deployConfig.js'\nexport {\n createCoreApp,\n type CreatedApplication,\n createStudio,\n deployWorkbenchApp,\n} from '../actions/deploy/deployWorkbenchApp.js'\nexport {getWorkbench} from '../actions/deploy/getWorkbench.js'\nexport {type DeployedExpose, summarizeInterfaces} from '../actions/deploy/summarizeInterfaces.js'\nexport {\n type Application,\n type BrettWorkspace,\n getApplication,\n getApplicationUrl,\n getWorkbenchUrl,\n listApplications,\n} from '../services/applications.js'\n"],"names":["checkBuiltOutput","deployConfig","resolveInstallationId","summarizeConfig","createCoreApp","createStudio","deployWorkbenchApp","getWorkbench","summarizeInterfaces","getApplication","getApplicationUrl","getWorkbenchUrl","listApplications"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,wCAAuC;AACtE,SACEC,YAAY,EACZC,qBAAqB,EACrBC,eAAe,QACV,oCAAmC;AAC1C,SACEC,aAAa,EAEbC,YAAY,EACZC,kBAAkB,QACb,0CAAyC;AAChD,SAAQC,YAAY,QAAO,oCAAmC;AAC9D,SAA6BC,mBAAmB,QAAO,2CAA0C;AACjG,SAGEC,cAAc,EACdC,iBAAiB,EACjBC,eAAe,EACfC,gBAAgB,QACX,8BAA6B"}
@@ -94,6 +94,42 @@ declare const devServerManifestSchema: z.ZodMiniObject<
94
94
  },
95
95
  z.core.$strip
96
96
  >,
97
+ z.ZodMiniObject<
98
+ {
99
+ metadata: z.ZodMiniNull;
100
+ type: z.ZodMiniLiteral<"asset_source">;
101
+ id: z.ZodMiniString<string>;
102
+ moduleId: z.ZodMiniString<string>;
103
+ name: z.ZodMiniString<string>;
104
+ src: z.ZodMiniString<string>;
105
+ title: z.ZodMiniString<string>;
106
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
107
+ },
108
+ z.core.$strip
109
+ >,
110
+ z.ZodMiniObject<
111
+ {
112
+ metadata: z.ZodMiniObject<
113
+ {
114
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
115
+ size: z.ZodMiniEnum<{
116
+ small: "small";
117
+ large: "large";
118
+ banner: "banner";
119
+ }>;
120
+ },
121
+ z.core.$strip
122
+ >;
123
+ type: z.ZodMiniLiteral<"tile">;
124
+ id: z.ZodMiniString<string>;
125
+ moduleId: z.ZodMiniString<string>;
126
+ name: z.ZodMiniString<string>;
127
+ src: z.ZodMiniString<string>;
128
+ title: z.ZodMiniString<string>;
129
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
130
+ },
131
+ z.core.$strip
132
+ >,
97
133
  z.ZodMiniObject<
98
134
  {
99
135
  metadata: z.ZodMiniNull;
@@ -1,11 +1,39 @@
1
+ import { AssetSourceComponentProps } from "@sanity/types";
1
2
  import { z } from "zod/mini";
2
3
 
4
+ /**
5
+ * An asset source's view-component slot — the module-federation expose for its
6
+ * one island.
7
+ * @public
8
+ */
9
+ export declare type AssetSourceComponent = keyof AssetSourceViewComponents;
10
+
11
+ /** The `asset_source` variant of an app's `views`. @public */
12
+ declare type AssetSourceView = Extract<
13
+ NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
14
+ {
15
+ type: "asset_source";
16
+ }
17
+ >;
18
+
19
+ /**
20
+ * The component slots an `asset_source` view exposes — a single picker island,
21
+ * typed with the studio asset-source props it renders behind. The props are
22
+ * `@sanity/types`' `AssetSourceComponentProps` directly, so an authored picker
23
+ * receives exactly what a studio `AssetSource.component` does.
24
+ * @public
25
+ */
26
+ export declare interface AssetSourceViewComponents {
27
+ asset_source: ViewComponent<AssetSourceComponentProps>;
28
+ }
29
+
3
30
  /**
4
31
  * User-facing input for `unstable_defineApp`. Excludes the internal
5
- * `applicationType`, `isSingleton`, and `config` — validated by the
6
- * schema but not part of the public surface (Sanity-owned apps set them via
7
- * `@ts-expect-error`). A union so an app declares an app `entry` or `views`,
8
- * never both.
32
+ * `applicationType`, `isSingleton`, and `config` — validated by the schema but
33
+ * not part of the public surface (Sanity-owned apps set them via
34
+ * `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
35
+ * panel `views`, never both — but `asset_source` and `tile` views are separate
36
+ * kinds and may accompany either.
9
37
  * @public
10
38
  */
11
39
  export declare type DefineAppInput = Omit<
@@ -19,7 +47,7 @@ export declare type DefineAppInput = Omit<
19
47
  }
20
48
  | {
21
49
  entry?: string;
22
- views?: never;
50
+ views?: (AssetSourceView | TileView)[];
23
51
  }
24
52
  );
25
53
 
@@ -72,7 +100,6 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
72
100
  >;
73
101
  icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
74
102
  isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
75
- name: z.ZodMiniString<string>;
76
103
  organizationId: z.ZodMiniString<string>;
77
104
  priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
78
105
  services: z.ZodMiniOptional<
@@ -81,7 +108,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
81
108
  [
82
109
  z.ZodMiniObject<
83
110
  {
84
- title: z.ZodMiniOptional<z.ZodMiniString<string>>;
111
+ title: z.ZodMiniString<string>;
85
112
  name: z.ZodMiniString<string>;
86
113
  src: z.ZodMiniString<string>;
87
114
  type: z.ZodMiniLiteral<"worker">;
@@ -101,13 +128,37 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
101
128
  [
102
129
  z.ZodMiniObject<
103
130
  {
104
- title: z.ZodMiniOptional<z.ZodMiniString<string>>;
131
+ title: z.ZodMiniString<string>;
105
132
  name: z.ZodMiniString<string>;
106
133
  src: z.ZodMiniString<string>;
107
134
  type: z.ZodMiniLiteral<"panel">;
108
135
  },
109
136
  z.core.$strip
110
137
  >,
138
+ z.ZodMiniObject<
139
+ {
140
+ title: z.ZodMiniString<string>;
141
+ name: z.ZodMiniString<string>;
142
+ src: z.ZodMiniString<string>;
143
+ type: z.ZodMiniLiteral<"asset_source">;
144
+ },
145
+ z.core.$strip
146
+ >,
147
+ z.ZodMiniObject<
148
+ {
149
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
150
+ size: z.ZodMiniEnum<{
151
+ small: "small";
152
+ large: "large";
153
+ banner: "banner";
154
+ }>;
155
+ title: z.ZodMiniString<string>;
156
+ name: z.ZodMiniString<string>;
157
+ src: z.ZodMiniString<string>;
158
+ type: z.ZodMiniLiteral<"tile">;
159
+ },
160
+ z.core.$strip
161
+ >,
111
162
  ],
112
163
  "type"
113
164
  >
@@ -288,10 +339,64 @@ export declare interface ServiceInfo {
288
339
  /** @public */
289
340
  export declare type ServiceType = "worker";
290
341
 
342
+ /**
343
+ * A tile's view-component slot — the module-federation expose for its one island.
344
+ * @public
345
+ */
346
+ export declare type TileComponent = keyof TileViewComponents;
347
+
348
+ /** @public */
349
+ export declare type TileSize = z.infer<typeof TileSizeSchema>;
350
+
351
+ /**
352
+ * A tile's footprint family — the shape it occupies on the dashboard. Modelled
353
+ * on iOS WidgetKit families, not a linear scale: `banner` is full-width and
354
+ * shallow, which a `small`→`large` magnitude can't express. The host maps a
355
+ * family to a layout slot; the component reads it to render per footprint.
356
+ * @public
357
+ */
358
+ declare const TileSizeSchema: z.ZodMiniEnum<{
359
+ small: "small";
360
+ large: "large";
361
+ banner: "banner";
362
+ }>;
363
+
364
+ /** The `tile` variant of an app's `views`. @public */
365
+ declare type TileView = Extract<
366
+ NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
367
+ {
368
+ type: "tile";
369
+ }
370
+ >;
371
+
372
+ /**
373
+ * The component slot a `tile` view exposes — a single island, typed with the
374
+ * tile props.
375
+ * @public
376
+ */
377
+ export declare interface TileViewComponents {
378
+ tile: ViewComponent<TileViewProps>;
379
+ }
380
+
381
+ /**
382
+ * Props a tile component receives: its own interface record (name/src/title/
383
+ * type) plus its footprint `size`, so it can render per family. Mirrors the
384
+ * `tile` record the dashboard host renders from; drift is guarded by the stamped
385
+ * contract version. Placement `priority` is host-only metadata, not surfaced here.
386
+ * @public
387
+ */
388
+ export declare type TileViewProps = ViewComponentBaseProps<{
389
+ name: string;
390
+ size: TileSize;
391
+ src: string;
392
+ title: string;
393
+ type: "tile";
394
+ }>;
395
+
291
396
  /**
292
397
  * Declare a Sanity Workbench application. Identity at runtime — returns the same
293
398
  * object reference, tagged with the workbench brand. Field validation (the
294
- * `name` pattern etc.) runs at build time in the CLI via `DefineAppInputSchema`;
399
+ * `slug` pattern etc.) runs at build time in the CLI via `DefineAppInputSchema`;
295
400
  * this helper stays a thin, pure identity wrapper.
296
401
  * @public
297
402
  */
@@ -343,7 +448,9 @@ export declare function unstable_defineView<TType extends InterfaceType>(
343
448
  * @internal
344
449
  */
345
450
  declare const VIEW_COMPONENTS: {
451
+ readonly asset_source: readonly ["asset_source"];
346
452
  readonly panel: readonly ["title", "panel"];
453
+ readonly tile: readonly ["tile"];
347
454
  };
348
455
 
349
456
  /** @internal */
@@ -366,7 +473,9 @@ declare interface ViewComponentBaseProps<TView> {
366
473
  * @public
367
474
  */
368
475
  export declare interface ViewComponentsByType {
476
+ asset_source: AssetSourceViewComponents;
369
477
  panel: PanelViewComponents;
478
+ tile: TileViewComponents;
370
479
  }
371
480
 
372
481
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/_exports/index.ts"],"sourcesContent":["export {resolveAppId} from '../appId.js'\nexport type {InterfaceType, ServiceType} from '../contract.js'\nexport {isWorkbenchApp, unstable_defineApp, unstable_defineMediaLibrary} from '../defineApp.js'\nexport type {\n DefineAppInput,\n DefineAppResult,\n DefineMediaLibraryInput,\n DockGroup,\n MediaLibraryField,\n WorkbenchApp,\n} from '../defineApp.js'\nexport {unstable_defineService} from '../defineService.js'\nexport type {\n DefinedService,\n ServiceCallback,\n ServiceContext,\n ServiceInfo,\n} from '../defineService.js'\nexport {unstable_defineView} from '../defineView.js'\nexport type {\n DefinedView,\n PanelComponent,\n PanelViewComponents,\n PanelViewProps,\n ViewComponentsByType,\n} from '../defineView.js'\n"],"names":["resolveAppId","isWorkbenchApp","unstable_defineApp","unstable_defineMediaLibrary","unstable_defineService","unstable_defineView"],"mappings":"AAAA,SAAQA,YAAY,QAAO,cAAa;AAExC,SAAQC,cAAc,EAAEC,kBAAkB,EAAEC,2BAA2B,QAAO,kBAAiB;AAS/F,SAAQC,sBAAsB,QAAO,sBAAqB;AAO1D,SAAQC,mBAAmB,QAAO,mBAAkB"}
1
+ {"version":3,"sources":["../../src/_exports/index.ts"],"sourcesContent":["export {resolveAppId} from '../appId.js'\nexport type {InterfaceType, ServiceType, TileSize} from '../contract.js'\nexport {isWorkbenchApp, unstable_defineApp, unstable_defineMediaLibrary} from '../defineApp.js'\nexport type {\n DefineAppInput,\n DefineAppResult,\n DefineMediaLibraryInput,\n DockGroup,\n MediaLibraryField,\n WorkbenchApp,\n} from '../defineApp.js'\nexport {unstable_defineService} from '../defineService.js'\nexport type {\n DefinedService,\n ServiceCallback,\n ServiceContext,\n ServiceInfo,\n} from '../defineService.js'\nexport {unstable_defineView} from '../defineView.js'\nexport type {\n AssetSourceComponent,\n AssetSourceViewComponents,\n DefinedView,\n PanelComponent,\n PanelViewComponents,\n PanelViewProps,\n TileComponent,\n TileViewComponents,\n TileViewProps,\n ViewComponentsByType,\n} from '../defineView.js'\n"],"names":["resolveAppId","isWorkbenchApp","unstable_defineApp","unstable_defineMediaLibrary","unstable_defineService","unstable_defineView"],"mappings":"AAAA,SAAQA,YAAY,QAAO,cAAa;AAExC,SAAQC,cAAc,EAAEC,kBAAkB,EAAEC,2BAA2B,QAAO,kBAAiB;AAS/F,SAAQC,sBAAsB,QAAO,sBAAqB;AAO1D,SAAQC,mBAAmB,QAAO,mBAAkB"}
@@ -1,12 +1,14 @@
1
+ export declare function toAppSlug(value: string): string | null;
2
+
1
3
  /** App scaffold — `entry` auto-declares the navigable app view. */
2
4
  export declare const workbenchAppConfigTemplate =
3
- "\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n app: unstable_defineApp({\n name: '%name%',\n title: '%title%',\n slug: '%slug%',\n organizationId: '%organizationId%',\n entry: '%entry%',\n }),\n})\n";
5
+ "\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n app: unstable_defineApp({\n title: '%title%',\n slug: '%slug%',\n organizationId: '%organizationId%',\n entry: '%entry%',\n }),\n})\n";
4
6
 
5
7
  /**
6
- * Studio scaffold — brands with name/title only, no `entry` (studio app views
8
+ * Studio scaffold — brands with slug/title only, no `entry` (studio app views
7
9
  * aren't implemented yet).
8
10
  */
9
11
  export declare const workbenchStudioConfigTemplate =
10
- "\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n api: {\n projectId: '%projectId%',\n dataset: '%dataset%'\n },\n app: unstable_defineApp({\n name: '%name%',\n title: '%title%',\n slug: '%slug%',\n organizationId: '%organizationId%',\n }),\n deployment: {\n /**\n * Enable auto-updates for studios.\n * Learn more at https://www.sanity.io/docs/studio/latest-version-of-sanity#k47faf43faf56\n */\n autoUpdates: __BOOL__autoUpdates__,\n },\n})\n";
12
+ "\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n api: {\n projectId: '%projectId%',\n dataset: '%dataset%'\n },\n app: unstable_defineApp({\n title: '%title%',\n slug: '%slug%',\n organizationId: '%organizationId%',\n }),\n deployment: {\n /**\n * Enable auto-updates for studios.\n * Learn more at https://www.sanity.io/docs/studio/latest-version-of-sanity#k47faf43faf56\n */\n autoUpdates: __BOOL__autoUpdates__,\n },\n})\n";
11
13
 
12
14
  export {};
@@ -1,5 +1,6 @@
1
1
  // Browser-safe `init` entry: the workbench `sanity.cli.ts` config templates the
2
- // CLI's init scaffolding fills in. Plain strings no runtime deps.
2
+ // CLI's init scaffolding fills in, and the coercion that fills `%slug%`. No runtime deps.
3
3
  export { workbenchAppConfigTemplate, workbenchStudioConfigTemplate } from '../actions/init/cliConfig.js';
4
+ export { toAppSlug } from '../appSlug.js';
4
5
 
5
6
  //# sourceMappingURL=init.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/_exports/init.ts"],"sourcesContent":["// Browser-safe `init` entry: the workbench `sanity.cli.ts` config templates the\n// CLI's init scaffolding fills in. Plain strings no runtime deps.\nexport {\n workbenchAppConfigTemplate,\n workbenchStudioConfigTemplate,\n} from '../actions/init/cliConfig.js'\n"],"names":["workbenchAppConfigTemplate","workbenchStudioConfigTemplate"],"mappings":"AAAA,gFAAgF;AAChF,oEAAoE;AACpE,SACEA,0BAA0B,EAC1BC,6BAA6B,QACxB,+BAA8B"}
1
+ {"version":3,"sources":["../../src/_exports/init.ts"],"sourcesContent":["// Browser-safe `init` entry: the workbench `sanity.cli.ts` config templates the\n// CLI's init scaffolding fills in, and the coercion that fills `%slug%`. No runtime deps.\nexport {\n workbenchAppConfigTemplate,\n workbenchStudioConfigTemplate,\n} from '../actions/init/cliConfig.js'\nexport {toAppSlug} from '../appSlug.js'\n"],"names":["workbenchAppConfigTemplate","workbenchStudioConfigTemplate","toAppSlug"],"mappings":"AAAA,gFAAgF;AAChF,0FAA0F;AAC1F,SACEA,0BAA0B,EAC1BC,6BAA6B,QACxB,+BAA8B;AACrC,SAAQC,SAAS,QAAO,gBAAe"}