@sanity/workbench-cli 1.9.0 → 2.0.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 (39) hide show
  1. package/dist/_exports/build.d.ts +28 -6
  2. package/dist/_exports/deploy.d.ts +75 -11
  3. package/dist/_exports/deploy.js +1 -0
  4. package/dist/_exports/deploy.js.map +1 -1
  5. package/dist/_exports/dev.d.ts +23 -0
  6. package/dist/_exports/index.d.ts +74 -14
  7. package/dist/_exports/index.js +0 -1
  8. package/dist/_exports/index.js.map +1 -1
  9. package/dist/_exports/preview.d.ts +23 -0
  10. package/dist/_exports/undeploy.d.ts +39 -12
  11. package/dist/actions/deploy/deployConfig.js +2 -2
  12. package/dist/actions/deploy/deployConfig.js.map +1 -1
  13. package/dist/actions/deploy/deployPayload.js +29 -0
  14. package/dist/actions/deploy/deployPayload.js.map +1 -0
  15. package/dist/actions/deploy/deployWorkbenchApp.js +8 -7
  16. package/dist/actions/deploy/deployWorkbenchApp.js.map +1 -1
  17. package/dist/actions/deploy/summarizeInterfaces.js +10 -13
  18. package/dist/actions/deploy/summarizeInterfaces.js.map +1 -1
  19. package/dist/actions/deploy/viewDeployment.js +2 -1
  20. package/dist/actions/deploy/viewDeployment.js.map +1 -1
  21. package/dist/actions/dev/registry.js +6 -1
  22. package/dist/actions/dev/registry.js.map +1 -1
  23. package/dist/actions/dev/startDevServerRegistration.js +13 -10
  24. package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
  25. package/dist/actions/preview/startWorkbenchPreview.js +2 -5
  26. package/dist/actions/preview/startWorkbenchPreview.js.map +1 -1
  27. package/dist/actions/undeploy/workbenchUndeployAdapter.js +20 -24
  28. package/dist/actions/undeploy/workbenchUndeployAdapter.js.map +1 -1
  29. package/dist/appId.js +2 -11
  30. package/dist/appId.js.map +1 -1
  31. package/dist/contract.js +34 -1
  32. package/dist/contract.js.map +1 -1
  33. package/dist/defineApp.js.map +1 -1
  34. package/dist/defineView.js.map +1 -1
  35. package/dist/deriveInterfaces.js +17 -2
  36. package/dist/deriveInterfaces.js.map +1 -1
  37. package/dist/services/applications.js +5 -2
  38. package/dist/services/applications.js.map +1 -1
  39. package/package.json +5 -5
@@ -14,9 +14,8 @@ declare type AssetSourceView = Extract<
14
14
  /**
15
15
  * The `build`/`start` id — a hash of the app's declared shape (its identity, not
16
16
  * its code), so the bundle inlined by `sanity build` and the registry entry
17
- * advertised by `sanity start` resolve to the same id. Hashed with the Web Crypto
18
- * API rather than `node:crypto` for parity with `resolveAppId`'s browser-safe
19
- * home. `sanity deploy` resolves its own id from the applications API.
17
+ * advertised by `sanity start` resolve to the same id. `sanity deploy` resolves
18
+ * its own id from the applications API.
20
19
  */
21
20
  export declare function buildAppId(app: ResolvedWorkbenchApp): Promise<string>;
22
21
 
@@ -25,8 +24,8 @@ export declare function buildAppId(app: ResolvedWorkbenchApp): Promise<string>;
25
24
  * `applicationType`, `isSingleton`, and `config` — validated by the schema but
26
25
  * not part of the public surface (Sanity-owned apps set them via
27
26
  * `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
28
- * panel `views`, never both — but an `asset_source` view is a separate kind and
29
- * may accompany either.
27
+ * panel `views`, never both — but `asset_source` and `tile` views are separate
28
+ * kinds and may accompany either.
30
29
  * @public
31
30
  */
32
31
  declare type DefineAppInput = Omit<
@@ -40,7 +39,7 @@ declare type DefineAppInput = Omit<
40
39
  }
41
40
  | {
42
41
  entry?: string;
43
- views?: AssetSourceView[];
42
+ views?: (AssetSourceView | TileView)[];
44
43
  }
45
44
  );
46
45
 
@@ -137,6 +136,21 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
137
136
  },
138
137
  z.core.$strip
139
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
+ >,
140
154
  ],
141
155
  "type"
142
156
  >
@@ -193,6 +207,14 @@ export declare function resolveWorkbenchApp(
193
207
  cliConfig: CliConfig | null | undefined,
194
208
  ): ResolvedWorkbenchApp | null;
195
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
+
196
218
  /**
197
219
  * Nominal brand the CLI discriminates on to enable the workbench build/deploy
198
220
  * codepath. Registered via `Symbol.for` so the marker survives module-realm
@@ -21,6 +21,15 @@ declare type AssetSourceView = Extract<
21
21
  }
22
22
  >;
23
23
 
24
+ /**
25
+ * A resource a deployment may interact with, as Brett stores it. Per-deployment
26
+ * and forbidden for singletons (the server 400s).
27
+ */
28
+ export declare interface BrettAccess {
29
+ resourceId: string;
30
+ resourceType: "canvas" | "dashboard" | "dataset" | "media-library";
31
+ }
32
+
24
33
  /** A studio workspace as Brett stores it. */
25
34
  export declare interface BrettWorkspace {
26
35
  dataset: string;
@@ -57,13 +66,11 @@ export declare function createCoreApp(options: {
57
66
  }): Promise<CreatedApplication>;
58
67
 
59
68
  /**
60
- * A freshly created application record: its id, plus a way to undo the creation.
61
- * The caller builds and deploys with the id, and calls `rollback` if a later
62
- * step fails so the record isn't stranded at its slug.
69
+ * `rollback` undoes the creation, so a later failure leaves no record stranded at the slug.
63
70
  * @internal
64
71
  */
65
72
  export declare interface CreatedApplication {
66
- applicationId: string;
73
+ application: Application;
67
74
  rollback: () => Promise<void>;
68
75
  }
69
76
 
@@ -84,8 +91,8 @@ export declare function createStudio(options: {
84
91
  * `applicationType`, `isSingleton`, and `config` — validated by the schema but
85
92
  * not part of the public surface (Sanity-owned apps set them via
86
93
  * `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
87
- * panel `views`, never both — but an `asset_source` view is a separate kind and
88
- * may accompany either.
94
+ * panel `views`, never both — but `asset_source` and `tile` views are separate
95
+ * kinds and may accompany either.
89
96
  * @public
90
97
  */
91
98
  declare type DefineAppInput = Omit<
@@ -99,7 +106,7 @@ declare type DefineAppInput = Omit<
99
106
  }
100
107
  | {
101
108
  entry?: string;
102
- views?: AssetSourceView[];
109
+ views?: (AssetSourceView | TileView)[];
103
110
  }
104
111
  );
105
112
 
@@ -196,6 +203,21 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
196
203
  },
197
204
  z.core.$strip
198
205
  >,
206
+ z.ZodMiniObject<
207
+ {
208
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
209
+ size: z.ZodMiniEnum<{
210
+ small: "small";
211
+ large: "large";
212
+ banner: "banner";
213
+ }>;
214
+ title: z.ZodMiniString<string>;
215
+ name: z.ZodMiniString<string>;
216
+ src: z.ZodMiniString<string>;
217
+ type: z.ZodMiniLiteral<"tile">;
218
+ },
219
+ z.core.$strip
220
+ >,
199
221
  ],
200
222
  "type"
201
223
  >
@@ -258,7 +280,7 @@ export declare function deployConfig(options: {
258
280
  }): Promise<void>;
259
281
 
260
282
  /** A view or service as the deploy report and `--json` output surface it. */
261
- export declare interface DeployedExpose {
283
+ export declare interface DeployedInterface {
262
284
  name: string;
263
285
  src: string;
264
286
  title: string;
@@ -277,6 +299,7 @@ export declare interface DeployedExpose {
277
299
  * @internal
278
300
  */
279
301
  export declare function deployWorkbenchApp(options: {
302
+ access?: readonly BrettAccess[];
280
303
  app: CliConfig["app"];
281
304
  applicationId: string;
282
305
  icon?: string;
@@ -359,18 +382,46 @@ export declare function summarizeConfig(config: {
359
382
  }): string;
360
383
 
361
384
  /**
362
- * The deploy summary of an app's exposes: the structured records (for `--json`)
363
- * and one report line per non-empty group (for the human report).
385
+ * One report line per non-empty group, alongside the records `--json` reports.
364
386
  * @internal
365
387
  */
366
388
  export declare function summarizeInterfaces({
367
389
  services,
368
390
  views,
369
391
  }: WorkbenchExposes): {
370
- exposes: DeployedExpose[];
371
392
  lines: string[];
393
+ services: DeployedInterface[];
394
+ views: DeployedInterface[];
372
395
  };
373
396
 
397
+ /** The `tile` variant of an app's `views`. @public */
398
+ declare type TileView = Extract<
399
+ NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
400
+ {
401
+ type: "tile";
402
+ }
403
+ >;
404
+
405
+ /**
406
+ * Gated once so a plain app can't pick up a stray key: without a workbench
407
+ * there is nothing to contribute. `views` and `services` travel together.
408
+ */
409
+ export declare function toWorkbenchPayload(
410
+ workbench: DeployableWorkbenchApp | null,
411
+ {
412
+ config,
413
+ interfaces,
414
+ title,
415
+ }: {
416
+ config?: string;
417
+ interfaces: {
418
+ services: DeployedInterface[];
419
+ views: DeployedInterface[];
420
+ } | null;
421
+ title: string;
422
+ },
423
+ ): Partial<WorkbenchDeployPayload>;
424
+
374
425
  declare type ViewDeploymentPayload = z.infer<
375
426
  typeof viewDeploymentPayloadSchema
376
427
  >;
@@ -393,6 +444,7 @@ declare const viewDeploymentPayloadSchema: z.ZodMiniObject<
393
444
  type: z.ZodMiniEnum<{
394
445
  asset_source: "asset_source";
395
446
  panel: "panel";
447
+ tile: "tile";
396
448
  }>;
397
449
  },
398
450
  z.core.$loose
@@ -419,6 +471,18 @@ declare const WORKBENCH_APP: unique symbol;
419
471
  declare type WorkbenchApp = DefineAppResult &
420
472
  z.output<typeof DefineAppInputSchema>;
421
473
 
474
+ /** What a workbench app contributes to a deploy payload. */
475
+ export declare interface WorkbenchDeployPayload {
476
+ slug: string;
477
+ title: string;
478
+ /** Media-library config summary. */
479
+ config?: string;
480
+ isSingleton?: boolean;
481
+ services?: DeployedInterface[];
482
+ views?: DeployedInterface[];
483
+ visibility?: string;
484
+ }
485
+
422
486
  /**
423
487
  * Bundled so adding a declaration family touches this type and the artifact
424
488
  * expanders, not every hop of build/dev plumbing in between.
@@ -1,5 +1,6 @@
1
1
  export { checkBuiltOutput } from '../actions/deploy/checkBuiltOutput.js';
2
2
  export { deployConfig, resolveInstallationId, summarizeConfig } from '../actions/deploy/deployConfig.js';
3
+ export { toWorkbenchPayload } from '../actions/deploy/deployPayload.js';
3
4
  export { createCoreApp, createStudio, deployWorkbenchApp } from '../actions/deploy/deployWorkbenchApp.js';
4
5
  export { getWorkbench } from '../actions/deploy/getWorkbench.js';
5
6
  export { summarizeInterfaces } from '../actions/deploy/summarizeInterfaces.js';
@@ -1 +1 @@
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"}
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 {toWorkbenchPayload, type WorkbenchDeployPayload} from '../actions/deploy/deployPayload.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 DeployedInterface, summarizeInterfaces} from '../actions/deploy/summarizeInterfaces.js'\nexport {\n type Application,\n type BrettAccess,\n type BrettWorkspace,\n getApplication,\n getApplicationUrl,\n getWorkbenchUrl,\n listApplications,\n} from '../services/applications.js'\n"],"names":["checkBuiltOutput","deployConfig","resolveInstallationId","summarizeConfig","toWorkbenchPayload","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,SAAQC,kBAAkB,QAAoC,qCAAoC;AAClG,SACEC,aAAa,EAEbC,YAAY,EACZC,kBAAkB,QACb,0CAAyC;AAChD,SAAQC,YAAY,QAAO,oCAAmC;AAC9D,SAAgCC,mBAAmB,QAAO,2CAA0C;AACpG,SAIEC,cAAc,EACdC,iBAAiB,EACjBC,eAAe,EACfC,gBAAgB,QACX,8BAA6B"}
@@ -107,6 +107,29 @@ declare const devServerManifestSchema: z.ZodMiniObject<
107
107
  },
108
108
  z.core.$strip
109
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
+ >,
110
133
  z.ZodMiniObject<
111
134
  {
112
135
  metadata: z.ZodMiniNull;
@@ -32,8 +32,8 @@ export declare interface AssetSourceViewComponents {
32
32
  * `applicationType`, `isSingleton`, and `config` — validated by the schema but
33
33
  * not part of the public surface (Sanity-owned apps set them via
34
34
  * `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
35
- * panel `views`, never both — but an `asset_source` view is a separate kind and
36
- * may accompany either.
35
+ * panel `views`, never both — but `asset_source` and `tile` views are separate
36
+ * kinds and may accompany either.
37
37
  * @public
38
38
  */
39
39
  export declare type DefineAppInput = Omit<
@@ -47,7 +47,7 @@ export declare type DefineAppInput = Omit<
47
47
  }
48
48
  | {
49
49
  entry?: string;
50
- views?: AssetSourceView[];
50
+ views?: (AssetSourceView | TileView)[];
51
51
  }
52
52
  );
53
53
 
@@ -144,6 +144,21 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
144
144
  },
145
145
  z.core.$strip
146
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
+ >,
147
162
  ],
148
163
  "type"
149
164
  >
@@ -275,17 +290,6 @@ export declare type PanelViewProps = ViewComponentBaseProps<{
275
290
  type: "panel";
276
291
  }>;
277
292
 
278
- /**
279
- * The dev id for a workbench app — the address the server bound. `sanity dev`
280
- * keys on where the app is served so a running app can't collide with its
281
- * deployed twin. Sync and dependency-free: it's re-exported from the package's
282
- * browser-facing entry, so it must not pull in `node:crypto`.
283
- */
284
- export declare function resolveAppId(source: {
285
- host: string;
286
- port: number;
287
- }): string;
288
-
289
293
  /** @internal */
290
294
  declare const SERVICE_CONTRACT_VERSION = 1;
291
295
 
@@ -324,6 +328,60 @@ export declare interface ServiceInfo {
324
328
  /** @public */
325
329
  export declare type ServiceType = "worker";
326
330
 
331
+ /**
332
+ * A tile's view-component slot — the module-federation expose for its one island.
333
+ * @public
334
+ */
335
+ export declare type TileComponent = keyof TileViewComponents;
336
+
337
+ /** @public */
338
+ export declare type TileSize = z.infer<typeof TileSizeSchema>;
339
+
340
+ /**
341
+ * A tile's footprint family — the shape it occupies on the dashboard. Modelled
342
+ * on iOS WidgetKit families, not a linear scale: `banner` is full-width and
343
+ * shallow, which a `small`→`large` magnitude can't express. The host maps a
344
+ * family to a layout slot; the component reads it to render per footprint.
345
+ * @public
346
+ */
347
+ declare const TileSizeSchema: z.ZodMiniEnum<{
348
+ small: "small";
349
+ large: "large";
350
+ banner: "banner";
351
+ }>;
352
+
353
+ /** The `tile` variant of an app's `views`. @public */
354
+ declare type TileView = Extract<
355
+ NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
356
+ {
357
+ type: "tile";
358
+ }
359
+ >;
360
+
361
+ /**
362
+ * The component slot a `tile` view exposes — a single island, typed with the
363
+ * tile props.
364
+ * @public
365
+ */
366
+ export declare interface TileViewComponents {
367
+ tile: ViewComponent<TileViewProps>;
368
+ }
369
+
370
+ /**
371
+ * Props a tile component receives: its own interface record (name/src/title/
372
+ * type) plus its footprint `size`, so it can render per family. Mirrors the
373
+ * `tile` record the dashboard host renders from; drift is guarded by the stamped
374
+ * contract version. Placement `priority` is host-only metadata, not surfaced here.
375
+ * @public
376
+ */
377
+ export declare type TileViewProps = ViewComponentBaseProps<{
378
+ name: string;
379
+ size: TileSize;
380
+ src: string;
381
+ title: string;
382
+ type: "tile";
383
+ }>;
384
+
327
385
  /**
328
386
  * Declare a Sanity Workbench application. Identity at runtime — returns the same
329
387
  * object reference, tagged with the workbench brand. Field validation (the
@@ -381,6 +439,7 @@ export declare function unstable_defineView<TType extends InterfaceType>(
381
439
  declare const VIEW_COMPONENTS: {
382
440
  readonly asset_source: readonly ["asset_source"];
383
441
  readonly panel: readonly ["title", "panel"];
442
+ readonly tile: readonly ["tile"];
384
443
  };
385
444
 
386
445
  /** @internal */
@@ -405,6 +464,7 @@ declare interface ViewComponentBaseProps<TView> {
405
464
  export declare interface ViewComponentsByType {
406
465
  asset_source: AssetSourceViewComponents;
407
466
  panel: PanelViewComponents;
467
+ tile: TileViewComponents;
408
468
  }
409
469
 
410
470
  /**
@@ -1,4 +1,3 @@
1
- export { resolveAppId } from '../appId.js';
2
1
  export { isWorkbenchApp, unstable_defineApp, unstable_defineMediaLibrary } from '../defineApp.js';
3
2
  export { unstable_defineService } from '../defineService.js';
4
3
  export { unstable_defineView } from '../defineView.js';
@@ -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 AssetSourceComponent,\n AssetSourceViewComponents,\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 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":["isWorkbenchApp","unstable_defineApp","unstable_defineMediaLibrary","unstable_defineService","unstable_defineView"],"mappings":"AACA,SAAQA,cAAc,EAAEC,kBAAkB,EAAEC,2BAA2B,QAAO,kBAAiB;AAS/F,SAAQC,sBAAsB,QAAO,sBAAqB;AAO1D,SAAQC,mBAAmB,QAAO,mBAAkB"}
@@ -90,6 +90,29 @@ declare const devServerManifestSchema: z.ZodMiniObject<
90
90
  },
91
91
  z.core.$strip
92
92
  >,
93
+ z.ZodMiniObject<
94
+ {
95
+ metadata: z.ZodMiniObject<
96
+ {
97
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
98
+ size: z.ZodMiniEnum<{
99
+ small: "small";
100
+ large: "large";
101
+ banner: "banner";
102
+ }>;
103
+ },
104
+ z.core.$strip
105
+ >;
106
+ type: z.ZodMiniLiteral<"tile">;
107
+ id: z.ZodMiniString<string>;
108
+ moduleId: z.ZodMiniString<string>;
109
+ name: z.ZodMiniString<string>;
110
+ src: z.ZodMiniString<string>;
111
+ title: z.ZodMiniString<string>;
112
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
113
+ },
114
+ z.core.$strip
115
+ >,
93
116
  z.ZodMiniObject<
94
117
  {
95
118
  metadata: z.ZodMiniNull;
@@ -12,6 +12,14 @@ declare type AssetSourceView = Extract<
12
12
  }
13
13
  >;
14
14
 
15
+ declare interface ConfigSnapshot {
16
+ id: string;
17
+ createdAt?: string;
18
+ deployedBy?: string;
19
+ /** Whether this snapshot is the one being served; at most one per installation. */
20
+ isActive?: boolean;
21
+ }
22
+
15
23
  /**
16
24
  * The undeploy adapter for workbench apps, mirroring what a workbench deploy
17
25
  * creates: apps that expose interfaces delete their Brett application (the
@@ -31,8 +39,8 @@ export declare function createWorkbenchUndeployAdapter(options: {
31
39
  * `applicationType`, `isSingleton`, and `config` — validated by the schema but
32
40
  * not part of the public surface (Sanity-owned apps set them via
33
41
  * `@ts-expect-error`). A union: an app declares an app `entry` (navigable) or
34
- * panel `views`, never both — but an `asset_source` view is a separate kind and
35
- * may accompany either.
42
+ * panel `views`, never both — but `asset_source` and `tile` views are separate
43
+ * kinds and may accompany either.
36
44
  * @public
37
45
  */
38
46
  declare type DefineAppInput = Omit<
@@ -46,7 +54,7 @@ declare type DefineAppInput = Omit<
46
54
  }
47
55
  | {
48
56
  entry?: string;
49
- views?: AssetSourceView[];
57
+ views?: (AssetSourceView | TileView)[];
50
58
  }
51
59
  );
52
60
 
@@ -143,6 +151,21 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
143
151
  },
144
152
  z.core.$strip
145
153
  >,
154
+ z.ZodMiniObject<
155
+ {
156
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
157
+ size: z.ZodMiniEnum<{
158
+ small: "small";
159
+ large: "large";
160
+ banner: "banner";
161
+ }>;
162
+ title: z.ZodMiniString<string>;
163
+ name: z.ZodMiniString<string>;
164
+ src: z.ZodMiniString<string>;
165
+ type: z.ZodMiniLiteral<"tile">;
166
+ },
167
+ z.core.$strip
168
+ >,
146
169
  ],
147
170
  "type"
148
171
  >
@@ -190,7 +213,7 @@ declare interface DeployableWorkbenchApp extends ResolvedWorkbenchApp {
190
213
  }
191
214
 
192
215
  /** A view or service as the deploy report and `--json` output surface it. */
193
- declare interface DeployedExpose {
216
+ declare interface DeployedInterface {
194
217
  name: string;
195
218
  src: string;
196
219
  title: string;
@@ -220,6 +243,14 @@ declare interface ResolvedWorkbenchApp {
220
243
  readonly visibility?: AppVisibility;
221
244
  }
222
245
 
246
+ /** The `tile` variant of an app's `views`. @public */
247
+ declare type TileView = Extract<
248
+ NonNullable<z.output<typeof DefineAppInputSchema>["views"]>[number],
249
+ {
250
+ type: "tile";
251
+ }
252
+ >;
253
+
223
254
  declare type ViewDeploymentPayload = z.infer<
224
255
  typeof viewDeploymentPayloadSchema
225
256
  >;
@@ -242,6 +273,7 @@ declare const viewDeploymentPayloadSchema: z.ZodMiniObject<
242
273
  type: z.ZodMiniEnum<{
243
274
  asset_source: "asset_source";
244
275
  panel: "panel";
276
+ tile: "tile";
245
277
  }>;
246
278
  },
247
279
  z.core.$loose
@@ -271,16 +303,11 @@ declare type WorkbenchApp = DefineAppResult &
271
303
  /** The workbench extension of the shared target; serializes into `--json` as-is. */
272
304
  declare type WorkbenchUndeployTarget =
273
305
  | (UndeployApplicationTarget & {
274
- /** Interfaces (views and services) registered by the application. */
275
- interfaces: DeployedExpose[];
306
+ services: DeployedInterface[];
307
+ views: DeployedInterface[];
276
308
  })
277
309
  | (UndeployConfigTarget & {
278
- /** The deployed config snapshots an undeploy deletes. */
279
- configs: {
280
- createdAt: string | null;
281
- deployedBy: string | null;
282
- id: string;
283
- }[];
310
+ configs: ConfigSnapshot[];
284
311
  });
285
312
 
286
313
  export {};
@@ -5,7 +5,7 @@ import { subdebug } from '@sanity/cli-core';
5
5
  import { pack } from 'tar-fs';
6
6
  import { getWorkbenchUrl } from '../../services/applications.js';
7
7
  import { createConfig, resolveSingletonInstallationId } from '../../services/installations.js';
8
- import { summarizeExposeGroup } from './summarizeInterfaces.js';
8
+ import { summarizeGroup } from './summarizeInterfaces.js';
9
9
  const debug = subdebug('deploy');
10
10
  /**
11
11
  * The org's active installation for an app type, or `undefined` when none is
@@ -31,7 +31,7 @@ const debug = subdebug('deploy');
31
31
  switch(config.appType){
32
32
  case 'media-library':
33
33
  {
34
- return summarizeExposeGroup('Media library fields', config.fields);
34
+ return summarizeGroup('Media library fields', config.fields);
35
35
  }
36
36
  default:
37
37
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/deploy/deployConfig.ts"],"sourcesContent":["import {basename, dirname} from 'node:path'\nimport {styleText} from 'node:util'\nimport {createGzip} from 'node:zlib'\n\nimport {type Output, subdebug} from '@sanity/cli-core'\nimport {pack} from 'tar-fs'\n\nimport {getWorkbenchUrl} from '../../services/applications.js'\nimport {createConfig, resolveSingletonInstallationId} from '../../services/installations.js'\nimport {summarizeExposeGroup} from './summarizeInterfaces.js'\n\nconst debug = subdebug('deploy')\n\n/**\n * The org's active installation for an app type, or `undefined` when none is\n * installed. Read-only, so `--dry-run` can report deployability.\n * @internal\n */\nexport async function resolveInstallationId(options: {\n appType: string\n organizationId: string\n}): Promise<string | undefined> {\n switch (options.appType) {\n case 'media-library': {\n return resolveSingletonInstallationId(options.organizationId, 'media-library')\n }\n default: {\n throw new Error(`Cannot create config for unknown app type: ${options.appType}`)\n }\n }\n}\n\n/**\n * A report heading and item list for a config; a media library's `fields` are\n * one of potentially many shapes.\n * @internal\n */\nexport function summarizeConfig(config: {\n appType: string\n fields: {name: string; src: string; title: string}[]\n}): string {\n switch (config.appType) {\n case 'media-library': {\n return summarizeExposeGroup('Media library fields', config.fields)\n }\n default: {\n throw new Error(`Cannot create config for unknown app type: ${config.appType}`)\n }\n }\n}\n\n/**\n * Upload the built module-federation remote to the installation as its config\n * snapshot. `installationId` is resolved by the caller so `--dry-run` never\n * reaches this mutating step.\n * @internal\n */\nexport async function deployConfig(options: {\n appType: string\n installationId: string\n organizationId: string\n output: Output\n sourceDir: string\n version: string\n}): Promise<void> {\n const {appType, installationId, organizationId, output, sourceDir, version} = options\n const tarball = pack(dirname(sourceDir), {entries: [basename(sourceDir)]}).pipe(createGzip())\n await createConfig(installationId, {tarball, version})\n\n debug('Deployed config for app type: %s', appType)\n const url = getWorkbenchUrl(organizationId)\n output.log(`\\n🚀 ${styleText('bold', 'Success!')} Config deployed to ${styleText('cyan', url)}`)\n}\n"],"names":["basename","dirname","styleText","createGzip","subdebug","pack","getWorkbenchUrl","createConfig","resolveSingletonInstallationId","summarizeExposeGroup","debug","resolveInstallationId","options","appType","organizationId","Error","summarizeConfig","config","fields","deployConfig","installationId","output","sourceDir","version","tarball","entries","pipe","url","log"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,OAAO,QAAO,YAAW;AAC3C,SAAQC,SAAS,QAAO,YAAW;AACnC,SAAQC,UAAU,QAAO,YAAW;AAEpC,SAAqBC,QAAQ,QAAO,mBAAkB;AACtD,SAAQC,IAAI,QAAO,SAAQ;AAE3B,SAAQC,eAAe,QAAO,iCAAgC;AAC9D,SAAQC,YAAY,EAAEC,8BAA8B,QAAO,kCAAiC;AAC5F,SAAQC,oBAAoB,QAAO,2BAA0B;AAE7D,MAAMC,QAAQN,SAAS;AAEvB;;;;CAIC,GACD,OAAO,eAAeO,sBAAsBC,OAG3C;IACC,OAAQA,QAAQC,OAAO;QACrB,KAAK;YAAiB;gBACpB,OAAOL,+BAA+BI,QAAQE,cAAc,EAAE;YAChE;QACA;YAAS;gBACP,MAAM,IAAIC,MAAM,CAAC,2CAA2C,EAAEH,QAAQC,OAAO,EAAE;YACjF;IACF;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASG,gBAAgBC,MAG/B;IACC,OAAQA,OAAOJ,OAAO;QACpB,KAAK;YAAiB;gBACpB,OAAOJ,qBAAqB,wBAAwBQ,OAAOC,MAAM;YACnE;QACA;YAAS;gBACP,MAAM,IAAIH,MAAM,CAAC,2CAA2C,EAAEE,OAAOJ,OAAO,EAAE;YAChF;IACF;AACF;AAEA;;;;;CAKC,GACD,OAAO,eAAeM,aAAaP,OAOlC;IACC,MAAM,EAACC,OAAO,EAAEO,cAAc,EAAEN,cAAc,EAAEO,MAAM,EAAEC,SAAS,EAAEC,OAAO,EAAC,GAAGX;IAC9E,MAAMY,UAAUnB,KAAKJ,QAAQqB,YAAY;QAACG,SAAS;YAACzB,SAASsB;SAAW;IAAA,GAAGI,IAAI,CAACvB;IAChF,MAAMI,aAAaa,gBAAgB;QAACI;QAASD;IAAO;IAEpDb,MAAM,oCAAoCG;IAC1C,MAAMc,MAAMrB,gBAAgBQ;IAC5BO,OAAOO,GAAG,CAAC,CAAC,KAAK,EAAE1B,UAAU,QAAQ,YAAY,oBAAoB,EAAEA,UAAU,QAAQyB,MAAM;AACjG"}
1
+ {"version":3,"sources":["../../../src/actions/deploy/deployConfig.ts"],"sourcesContent":["import {basename, dirname} from 'node:path'\nimport {styleText} from 'node:util'\nimport {createGzip} from 'node:zlib'\n\nimport {type Output, subdebug} from '@sanity/cli-core'\nimport {pack} from 'tar-fs'\n\nimport {getWorkbenchUrl} from '../../services/applications.js'\nimport {createConfig, resolveSingletonInstallationId} from '../../services/installations.js'\nimport {summarizeGroup} from './summarizeInterfaces.js'\n\nconst debug = subdebug('deploy')\n\n/**\n * The org's active installation for an app type, or `undefined` when none is\n * installed. Read-only, so `--dry-run` can report deployability.\n * @internal\n */\nexport async function resolveInstallationId(options: {\n appType: string\n organizationId: string\n}): Promise<string | undefined> {\n switch (options.appType) {\n case 'media-library': {\n return resolveSingletonInstallationId(options.organizationId, 'media-library')\n }\n default: {\n throw new Error(`Cannot create config for unknown app type: ${options.appType}`)\n }\n }\n}\n\n/**\n * A report heading and item list for a config; a media library's `fields` are\n * one of potentially many shapes.\n * @internal\n */\nexport function summarizeConfig(config: {\n appType: string\n fields: {name: string; src: string; title: string}[]\n}): string {\n switch (config.appType) {\n case 'media-library': {\n return summarizeGroup('Media library fields', config.fields)\n }\n default: {\n throw new Error(`Cannot create config for unknown app type: ${config.appType}`)\n }\n }\n}\n\n/**\n * Upload the built module-federation remote to the installation as its config\n * snapshot. `installationId` is resolved by the caller so `--dry-run` never\n * reaches this mutating step.\n * @internal\n */\nexport async function deployConfig(options: {\n appType: string\n installationId: string\n organizationId: string\n output: Output\n sourceDir: string\n version: string\n}): Promise<void> {\n const {appType, installationId, organizationId, output, sourceDir, version} = options\n const tarball = pack(dirname(sourceDir), {entries: [basename(sourceDir)]}).pipe(createGzip())\n await createConfig(installationId, {tarball, version})\n\n debug('Deployed config for app type: %s', appType)\n const url = getWorkbenchUrl(organizationId)\n output.log(`\\n🚀 ${styleText('bold', 'Success!')} Config deployed to ${styleText('cyan', url)}`)\n}\n"],"names":["basename","dirname","styleText","createGzip","subdebug","pack","getWorkbenchUrl","createConfig","resolveSingletonInstallationId","summarizeGroup","debug","resolveInstallationId","options","appType","organizationId","Error","summarizeConfig","config","fields","deployConfig","installationId","output","sourceDir","version","tarball","entries","pipe","url","log"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,OAAO,QAAO,YAAW;AAC3C,SAAQC,SAAS,QAAO,YAAW;AACnC,SAAQC,UAAU,QAAO,YAAW;AAEpC,SAAqBC,QAAQ,QAAO,mBAAkB;AACtD,SAAQC,IAAI,QAAO,SAAQ;AAE3B,SAAQC,eAAe,QAAO,iCAAgC;AAC9D,SAAQC,YAAY,EAAEC,8BAA8B,QAAO,kCAAiC;AAC5F,SAAQC,cAAc,QAAO,2BAA0B;AAEvD,MAAMC,QAAQN,SAAS;AAEvB;;;;CAIC,GACD,OAAO,eAAeO,sBAAsBC,OAG3C;IACC,OAAQA,QAAQC,OAAO;QACrB,KAAK;YAAiB;gBACpB,OAAOL,+BAA+BI,QAAQE,cAAc,EAAE;YAChE;QACA;YAAS;gBACP,MAAM,IAAIC,MAAM,CAAC,2CAA2C,EAAEH,QAAQC,OAAO,EAAE;YACjF;IACF;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASG,gBAAgBC,MAG/B;IACC,OAAQA,OAAOJ,OAAO;QACpB,KAAK;YAAiB;gBACpB,OAAOJ,eAAe,wBAAwBQ,OAAOC,MAAM;YAC7D;QACA;YAAS;gBACP,MAAM,IAAIH,MAAM,CAAC,2CAA2C,EAAEE,OAAOJ,OAAO,EAAE;YAChF;IACF;AACF;AAEA;;;;;CAKC,GACD,OAAO,eAAeM,aAAaP,OAOlC;IACC,MAAM,EAACC,OAAO,EAAEO,cAAc,EAAEN,cAAc,EAAEO,MAAM,EAAEC,SAAS,EAAEC,OAAO,EAAC,GAAGX;IAC9E,MAAMY,UAAUnB,KAAKJ,QAAQqB,YAAY;QAACG,SAAS;YAACzB,SAASsB;SAAW;IAAA,GAAGI,IAAI,CAACvB;IAChF,MAAMI,aAAaa,gBAAgB;QAACI;QAASD;IAAO;IAEpDb,MAAM,oCAAoCG;IAC1C,MAAMc,MAAMrB,gBAAgBQ;IAC5BO,OAAOO,GAAG,CAAC,CAAC,KAAK,EAAE1B,UAAU,QAAQ,YAAY,oBAAoB,EAAEA,UAAU,QAAQyB,MAAM;AACjG"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Gated once so a plain app can't pick up a stray key: without a workbench
3
+ * there is nothing to contribute. `views` and `services` travel together.
4
+ */ export function toWorkbenchPayload(workbench, { config, interfaces, title }) {
5
+ if (!workbench) return {};
6
+ const { services, views } = interfaces ?? {
7
+ services: [],
8
+ views: []
9
+ };
10
+ return {
11
+ ...config ? {
12
+ config
13
+ } : {},
14
+ ...workbench.isSingleton === undefined ? {} : {
15
+ isSingleton: workbench.isSingleton
16
+ },
17
+ ...services.length > 0 || views.length > 0 ? {
18
+ services,
19
+ views
20
+ } : {},
21
+ slug: workbench.slug,
22
+ title,
23
+ ...workbench.visibility ? {
24
+ visibility: workbench.visibility
25
+ } : {}
26
+ };
27
+ }
28
+
29
+ //# sourceMappingURL=deployPayload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/actions/deploy/deployPayload.ts"],"sourcesContent":["import {type DeployableWorkbenchApp} from './getWorkbench.js'\nimport {type DeployedInterface} from './summarizeInterfaces.js'\n\n/** What a workbench app contributes to a deploy payload. */\nexport interface WorkbenchDeployPayload {\n slug: string\n title: string\n\n /** Media-library config summary. */\n config?: string\n isSingleton?: boolean\n services?: DeployedInterface[]\n views?: DeployedInterface[]\n visibility?: string\n}\n\n/**\n * Gated once so a plain app can't pick up a stray key: without a workbench\n * there is nothing to contribute. `views` and `services` travel together.\n */\nexport function toWorkbenchPayload(\n workbench: DeployableWorkbenchApp | null,\n {\n config,\n interfaces,\n title,\n }: {\n config?: string\n interfaces: {services: DeployedInterface[]; views: DeployedInterface[]} | null\n title: string\n },\n): Partial<WorkbenchDeployPayload> {\n if (!workbench) return {}\n const {services, views} = interfaces ?? {services: [], views: []}\n return {\n ...(config ? {config} : {}),\n ...(workbench.isSingleton === undefined ? {} : {isSingleton: workbench.isSingleton}),\n ...(services.length > 0 || views.length > 0 ? {services, views} : {}),\n slug: workbench.slug,\n title,\n ...(workbench.visibility ? {visibility: workbench.visibility} : {}),\n }\n}\n"],"names":["toWorkbenchPayload","workbench","config","interfaces","title","services","views","isSingleton","undefined","length","slug","visibility"],"mappings":"AAgBA;;;CAGC,GACD,OAAO,SAASA,mBACdC,SAAwC,EACxC,EACEC,MAAM,EACNC,UAAU,EACVC,KAAK,EAKN;IAED,IAAI,CAACH,WAAW,OAAO,CAAC;IACxB,MAAM,EAACI,QAAQ,EAAEC,KAAK,EAAC,GAAGH,cAAc;QAACE,UAAU,EAAE;QAAEC,OAAO,EAAE;IAAA;IAChE,OAAO;QACL,GAAIJ,SAAS;YAACA;QAAM,IAAI,CAAC,CAAC;QAC1B,GAAID,UAAUM,WAAW,KAAKC,YAAY,CAAC,IAAI;YAACD,aAAaN,UAAUM,WAAW;QAAA,CAAC;QACnF,GAAIF,SAASI,MAAM,GAAG,KAAKH,MAAMG,MAAM,GAAG,IAAI;YAACJ;YAAUC;QAAK,IAAI,CAAC,CAAC;QACpEI,MAAMT,UAAUS,IAAI;QACpBN;QACA,GAAIH,UAAUU,UAAU,GAAG;YAACA,YAAYV,UAAUU,UAAU;QAAA,IAAI,CAAC,CAAC;IACpE;AACF"}