@sanity/workbench 0.1.0-alpha.2 → 0.1.0-alpha.21

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 (52) hide show
  1. package/README.md +24 -0
  2. package/dist/_chunks-es/index.js +39 -0
  3. package/dist/_chunks-es/index.js.map +1 -0
  4. package/dist/_chunks-es/module-federation.js +59 -0
  5. package/dist/_chunks-es/module-federation.js.map +1 -0
  6. package/dist/_chunks-es/studio.js +892 -0
  7. package/dist/_chunks-es/studio.js.map +1 -0
  8. package/dist/_internal.d.ts +16 -4
  9. package/dist/_internal.js +34 -27
  10. package/dist/_internal.js.map +1 -1
  11. package/dist/core.d.ts +2250 -0
  12. package/dist/core.js +74 -0
  13. package/dist/core.js.map +1 -0
  14. package/dist/system.d.ts +2135 -0
  15. package/dist/system.js +887 -0
  16. package/dist/system.js.map +1 -0
  17. package/package.json +34 -6
  18. package/src/_exports/core.ts +1 -0
  19. package/src/_exports/system.ts +1 -0
  20. package/src/_internal/index.ts +2 -1
  21. package/src/_internal/render.ts +72 -43
  22. package/src/core/applications/application-list.ts +104 -0
  23. package/src/core/applications/application.ts +177 -0
  24. package/src/core/applications/interface.ts +126 -0
  25. package/src/core/canvases.ts +92 -0
  26. package/src/core/config.ts +34 -0
  27. package/src/core/env.ts +43 -0
  28. package/src/core/index.ts +13 -0
  29. package/src/core/log/index.ts +125 -0
  30. package/src/core/media-libraries.ts +93 -0
  31. package/src/core/organizations.ts +115 -0
  32. package/src/core/projects.ts +114 -0
  33. package/src/core/shared/urls.ts +129 -0
  34. package/src/core/user-applications/core-app.ts +148 -0
  35. package/src/core/user-applications/studios/index.ts +3 -0
  36. package/src/core/user-applications/studios/schemas.ts +128 -0
  37. package/src/core/user-applications/studios/studio.ts +533 -0
  38. package/src/core/user-applications/studios/workspace.ts +156 -0
  39. package/src/core/user-applications/user-application.ts +222 -0
  40. package/src/system/auth.machine.ts +223 -0
  41. package/src/system/index.ts +22 -0
  42. package/src/system/inspect.ts +40 -0
  43. package/src/system/load-federated-module.ts +53 -0
  44. package/src/system/module-federation.ts +116 -0
  45. package/src/system/remote.machine.ts +219 -0
  46. package/src/system/remotes.machine.ts +92 -0
  47. package/src/system/root.machine.ts +224 -0
  48. package/src/system/service.machine.ts +207 -0
  49. package/src/system/services.machine.ts +120 -0
  50. package/src/system/system-preferences.machine.ts +215 -0
  51. package/src/system/telemetry.machine.ts +179 -0
  52. package/src/_internal/render.test.ts +0 -18
package/dist/core.d.ts ADDED
@@ -0,0 +1,2250 @@
1
+ import type { ApplicationResource } from "@sanity/message-protocol";
2
+ import type { CanvasResource } from "@sanity/message-protocol";
3
+ import type { MediaResource } from "@sanity/message-protocol";
4
+ import type { Resource } from "@sanity/message-protocol";
5
+ import type { StudioResource } from "@sanity/message-protocol";
6
+ import { z } from "zod";
7
+
8
+ /**
9
+ * @public
10
+ */
11
+ export declare abstract class AbstractApplication<
12
+ TType extends AbstractApplicationType,
13
+ TProtocolResource extends Resource = Extract<
14
+ Resource,
15
+ {
16
+ type: TType;
17
+ }
18
+ >,
19
+ > {
20
+ readonly type: TType;
21
+ constructor(type: TType);
22
+ /**
23
+ * The in-app route this application navigates to, or `null` when it isn't
24
+ * navigable as a full-page app (US5, spec 002-workbench-extension-api — e.g. an SDK app with no `app` view).
25
+ * The dock renders a navigable item only for a non-null `href`; the app
26
+ * routes 404 a `null`-href app on direct visit.
27
+ */
28
+ abstract get href(): string | null;
29
+ abstract get title(): string;
30
+ abstract get id(): string;
31
+ /**
32
+ * Whether the application is federated or not. This is used to determine
33
+ * if the application should be rendered in an iframe or not.
34
+ */
35
+ abstract get isFederated(): boolean;
36
+ /**
37
+ * Whether the application is served by a local CLI dev server rather than a
38
+ * deployed remote. Defaults to `false`; user applications flip this when
39
+ * constructed from a `LocalUserApplication` payload.
40
+ */
41
+ get isLocal(): boolean;
42
+ abstract get url(): URL;
43
+ /**
44
+ * Interfaces the application exposes (e.g. dock panels). Defaults to none;
45
+ * user applications surface what they declared via `unstable_defineApp`.
46
+ */
47
+ get interfaces(): readonly LocalInterface[];
48
+ /**
49
+ * Whether the application has a navigable full-page `app` view (US5, spec 002-workbench-extension-api). Defaults
50
+ * to `true` — studios, Canvas, and Media Library are always navigable. An SDK
51
+ * app overrides this to derive it from whether it declares an `app` interface.
52
+ */
53
+ get hasAppView(): boolean;
54
+ /**
55
+ * Federation module id of the app's full-page view (`${id}/App`), or `null`
56
+ * when it can't be federation-loaded: the app isn't federated (Canvas, Media
57
+ * Library, deployed apps shown in an iframe) or has no app view. Only a
58
+ * non-null `moduleId` is fetched and rendered by the remotes machine.
59
+ */
60
+ get moduleId(): string | null;
61
+ /**
62
+ * Federation module id of one of this app's panel view components, or `null`
63
+ * when the app isn't federated (a non-federated app's panels can't be loaded
64
+ * as remotes).
65
+ */
66
+ resolveViewModuleId(
67
+ view: LocalPanel,
68
+ component: PanelComponent,
69
+ ): string | null;
70
+ get initials(): string;
71
+ /**
72
+ * Converts the resource to a protocol resource that comlink expects
73
+ * for backwards compatibility with the old API format.
74
+ */
75
+ abstract toProtocolResource(): TProtocolResource;
76
+ }
77
+
78
+ /**
79
+ * @public
80
+ */
81
+ export declare type AbstractApplicationType =
82
+ | "studio"
83
+ | "coreApp"
84
+ | "canvas"
85
+ | "media-library"
86
+ | "workspace";
87
+
88
+ /**
89
+ * @public
90
+ */
91
+ export declare const ActiveDeployment: z.ZodObject<
92
+ {
93
+ id: z.ZodString;
94
+ version: z.ZodString;
95
+ isActiveDeployment: z.ZodBoolean;
96
+ userApplicationId: z.ZodString;
97
+ isAutoUpdating: z.ZodNullable<z.ZodBoolean>;
98
+ size: z.ZodNullable<z.ZodNumber>;
99
+ deployedAt: z.ZodString;
100
+ deployedBy: z.ZodString;
101
+ createdAt: z.ZodString;
102
+ updatedAt: z.ZodString;
103
+ },
104
+ z.core.$strip
105
+ >;
106
+
107
+ /**
108
+ * The navigable full-page view — its presence is the sole signal a branded app
109
+ * is navigable (US5, spec 002-workbench-extension-api).
110
+ * @public
111
+ */
112
+ export declare type App = InterfaceOfType<"app">;
113
+
114
+ /**
115
+ * @public
116
+ */
117
+ export declare type Application =
118
+ | CoreAppApplication
119
+ | StudioApplication
120
+ | StudioWorkspace
121
+ | CanvasApplication
122
+ | MediaLibraryApplication;
123
+
124
+ /**
125
+ * @public
126
+ */
127
+ export declare class ApplicationList<
128
+ TApplication extends Application = Application,
129
+ > {
130
+ readonly applications: TApplication[];
131
+ /**
132
+ * @param applications - The applications to initialize the list with.
133
+ */
134
+ constructor(applications: TApplication[]);
135
+ findApplicationsByType<T extends TApplication["type"]>(
136
+ type: T,
137
+ ): Extract<
138
+ TApplication,
139
+ {
140
+ type: T;
141
+ }
142
+ >[];
143
+ findApplicationsByType<T extends TApplication["type"][]>(
144
+ types: T,
145
+ ): Extract<
146
+ TApplication,
147
+ {
148
+ type: T[number];
149
+ }
150
+ >[];
151
+ findApplication(type: "media-library"):
152
+ | Extract<
153
+ TApplication,
154
+ {
155
+ type: "media-library";
156
+ }
157
+ >
158
+ | undefined;
159
+ findApplication(type: "canvas"):
160
+ | Extract<
161
+ TApplication,
162
+ {
163
+ type: "canvas";
164
+ }
165
+ >
166
+ | undefined;
167
+ findApplication(
168
+ type: "coreApp",
169
+ id: UserApplicationId,
170
+ ):
171
+ | Extract<
172
+ TApplication,
173
+ {
174
+ type: "coreApp";
175
+ }
176
+ >
177
+ | undefined;
178
+ findApplication(
179
+ type: "studio",
180
+ id: UserApplicationId,
181
+ ):
182
+ | Extract<
183
+ TApplication,
184
+ {
185
+ type: "studio";
186
+ }
187
+ >
188
+ | undefined;
189
+ findApplication(
190
+ type: "workspace",
191
+ id: string,
192
+ ):
193
+ | Extract<
194
+ TApplication,
195
+ {
196
+ type: "workspace";
197
+ }
198
+ >
199
+ | undefined;
200
+ toProtocolResources(): Resource[];
201
+ static areApplicationsEqual(
202
+ application1?: Application,
203
+ application2?: Application,
204
+ ): boolean;
205
+ }
206
+
207
+ /**
208
+ * Validates and brands a string as a CanvasId.
209
+ * @public
210
+ */
211
+ export declare function brandCanvasId(id: string): CanvasId;
212
+
213
+ /**
214
+ * Validates and brands a string as a MediaLibraryId.
215
+ * @public
216
+ */
217
+ export declare function brandMediaLibraryId(id: string): MediaLibraryId;
218
+
219
+ /**
220
+ * Validates and brands a string as an OrganizationId.
221
+ * @public
222
+ */
223
+ export declare function brandOrganizationId(id: string): OrganizationId;
224
+
225
+ /**
226
+ * Validates and brands a string as a ProjectId.
227
+ * @public
228
+ */
229
+ export declare function brandProjectId(id: string): ProjectId;
230
+
231
+ /**
232
+ * Validates and brands a string as a UserApplicationId.
233
+ * @public
234
+ */
235
+ export declare function brandUserApplicationId(id: string): UserApplicationId;
236
+
237
+ /**
238
+ * Represents a Canvas resource as returned from the API.
239
+ * @public
240
+ */
241
+ export declare type Canvas = z.output<typeof Canvas_2>;
242
+
243
+ declare const Canvas_2: z.ZodObject<
244
+ {
245
+ id: z.core.$ZodBranded<z.ZodString, "CanvasId", "out">;
246
+ organizationId: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
247
+ status: z.ZodEnum<{
248
+ active: "active";
249
+ provisioning: "provisioning";
250
+ }>;
251
+ },
252
+ z.core.$strip
253
+ >;
254
+
255
+ /**
256
+ * Represents a Canvas resource as returned from the API.
257
+ * @public
258
+ */
259
+ declare type Canvas = z.output<typeof Canvas_2>;
260
+
261
+ /**
262
+ * Whilst the constructor takes an organization's canvas resource the existance
263
+ * therefore implies the organization has access to the canvas application which
264
+ * is what workbench most importantly wants to know.
265
+ * @public
266
+ */
267
+ export declare class CanvasApplication extends AbstractApplication<"canvas"> {
268
+ readonly canvas: Canvas;
269
+ constructor(canvas: Canvas);
270
+ get id(): CanvasId;
271
+ get href(): string;
272
+ get title(): string;
273
+ get url(): URL;
274
+ get isFederated(): boolean;
275
+ toProtocolResource(): CanvasResource;
276
+ }
277
+
278
+ /**
279
+ * Canvas ID type, branded for type safety.
280
+ * @public
281
+ */
282
+ export declare type CanvasId = z.output<typeof CanvasId_2>;
283
+
284
+ /**
285
+ * Canvas ID schema, branded for type safety.
286
+ * @public
287
+ */
288
+ declare const CanvasId_2: z.core.$ZodBranded<z.ZodString, "CanvasId", "out">;
289
+
290
+ /**
291
+ * Canvas ID type, branded for type safety.
292
+ * @public
293
+ */
294
+ declare type CanvasId = z.output<typeof CanvasId_2>;
295
+
296
+ /**
297
+ * @public
298
+ */
299
+ export declare const ClientManifest: z.ZodObject<
300
+ {
301
+ version: z.ZodNumber;
302
+ createdAt: z.ZodString;
303
+ studioVersion: z.ZodOptional<z.ZodString>;
304
+ group: z.ZodOptional<z.ZodString>;
305
+ priority: z.ZodOptional<z.ZodNumber>;
306
+ workspaces: z.ZodArray<
307
+ z.ZodObject<
308
+ {
309
+ name: z.ZodString;
310
+ title: z.ZodString;
311
+ subtitle: z.ZodOptional<z.ZodString>;
312
+ basePath: z.ZodString;
313
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
314
+ dataset: z.ZodOptional<z.ZodString>;
315
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
316
+ schema: z.ZodString;
317
+ tools: z.ZodOptional<z.ZodString>;
318
+ },
319
+ z.core.$strip
320
+ >
321
+ >;
322
+ },
323
+ z.core.$strip
324
+ >;
325
+
326
+ /**
327
+ * @public
328
+ */
329
+ export declare type ClientManifest = z.output<typeof ClientManifest>;
330
+
331
+ declare type CompatibilityStatus =
332
+ (typeof StudioApplication.CompatibilityStatuses)[keyof typeof StudioApplication.CompatibilityStatuses];
333
+
334
+ /**
335
+ * Workbench configuration.
336
+ *
337
+ * @public
338
+ */
339
+ export declare interface Config {
340
+ /**
341
+ * The organization ID to use when rendering the workbench.
342
+ */
343
+ organizationId?: string;
344
+ }
345
+
346
+ /**
347
+ * @public
348
+ */
349
+ export declare class CoreAppApplication extends UserApplication<
350
+ CoreAppUserApplication,
351
+ "coreApp",
352
+ ApplicationResource
353
+ > {
354
+ readonly activeDeployment: CoreAppUserApplication["activeDeployment"];
355
+ constructor(
356
+ application: CoreAppUserApplication,
357
+ options?: {
358
+ isLocal?: boolean;
359
+ remoteApplication?: CoreAppApplication | null;
360
+ },
361
+ );
362
+ get href(): string | null;
363
+ get title(): string;
364
+ /**
365
+ * Resolves the core app's manifest from `activeDeployment.manifest`. This
366
+ * is the canonical (and only) slot for core app manifests — both for
367
+ * Sanity-deployed apps and for local CLI dev-server apps, which synthesise
368
+ * a deployment to surface the live manifest.
369
+ */
370
+ get manifest(): CoreAppUserApplicationManifest | null;
371
+ get subtitle(): undefined;
372
+ get updatedAt(): string;
373
+ get<TKey extends keyof CoreAppUserApplication>(
374
+ attr: TKey,
375
+ ): CoreAppUserApplication[TKey];
376
+ toProtocolResource(): ApplicationResource;
377
+ }
378
+
379
+ /**
380
+ * @public
381
+ */
382
+ export declare type CoreAppUserApplication = z.output<
383
+ typeof CoreAppUserApplication_2
384
+ >;
385
+
386
+ /**
387
+ * Core application schema — validates and brands API
388
+ * responses from the `/user-applications?appType=coreApp`
389
+ * endpoint. Uses a discriminated union on `urlType`.
390
+ * @public
391
+ */
392
+ declare const CoreAppUserApplication_2: z.ZodDiscriminatedUnion<
393
+ [
394
+ z.ZodObject<
395
+ {
396
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
397
+ appHost: z.ZodString;
398
+ createdAt: z.ZodString;
399
+ updatedAt: z.ZodString;
400
+ dashboardStatus: z.ZodEnum<{
401
+ default: "default";
402
+ disabled: "disabled";
403
+ }>;
404
+ interfaces: z.ZodOptional<
405
+ z.ZodArray<
406
+ z.ZodDiscriminatedUnion<
407
+ [
408
+ z.ZodObject<
409
+ {
410
+ name: z.ZodString;
411
+ interface_type: z.ZodLiteral<"panel">;
412
+ entry_point: z.ZodString;
413
+ },
414
+ z.core.$strip
415
+ >,
416
+ z.ZodObject<
417
+ {
418
+ name: z.ZodString;
419
+ interface_type: z.ZodLiteral<"worker">;
420
+ entry_point: z.ZodString;
421
+ },
422
+ z.core.$strip
423
+ >,
424
+ z.ZodObject<
425
+ {
426
+ name: z.ZodString;
427
+ interface_type: z.ZodLiteral<"app">;
428
+ entry_point: z.ZodString;
429
+ },
430
+ z.core.$strip
431
+ >,
432
+ ],
433
+ "interface_type"
434
+ >
435
+ >
436
+ >;
437
+ title: z.ZodString;
438
+ organizationId: z.core.$ZodBranded<
439
+ z.ZodString,
440
+ "OrganizationId",
441
+ "out"
442
+ >;
443
+ type: z.ZodLiteral<"coreApp">;
444
+ urlType: z.ZodLiteral<"internal">;
445
+ activeDeployment: z.ZodNullable<
446
+ z.ZodObject<
447
+ {
448
+ id: z.ZodString;
449
+ version: z.ZodString;
450
+ isActiveDeployment: z.ZodBoolean;
451
+ userApplicationId: z.ZodString;
452
+ isAutoUpdating: z.ZodNullable<z.ZodBoolean>;
453
+ size: z.ZodNullable<z.ZodNumber>;
454
+ deployedAt: z.ZodString;
455
+ deployedBy: z.ZodString;
456
+ createdAt: z.ZodString;
457
+ updatedAt: z.ZodString;
458
+ manifest: z.ZodNullable<
459
+ z.ZodObject<
460
+ {
461
+ version: z.ZodString;
462
+ icon: z.ZodOptional<z.ZodString>;
463
+ title: z.ZodOptional<z.ZodString>;
464
+ group: z.ZodOptional<z.ZodString>;
465
+ priority: z.ZodOptional<z.ZodNumber>;
466
+ },
467
+ z.core.$strip
468
+ >
469
+ >;
470
+ },
471
+ z.core.$strip
472
+ >
473
+ >;
474
+ },
475
+ z.core.$strip
476
+ >,
477
+ z.ZodObject<
478
+ {
479
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
480
+ appHost: z.ZodString;
481
+ createdAt: z.ZodString;
482
+ updatedAt: z.ZodString;
483
+ dashboardStatus: z.ZodEnum<{
484
+ default: "default";
485
+ disabled: "disabled";
486
+ }>;
487
+ interfaces: z.ZodOptional<
488
+ z.ZodArray<
489
+ z.ZodDiscriminatedUnion<
490
+ [
491
+ z.ZodObject<
492
+ {
493
+ name: z.ZodString;
494
+ interface_type: z.ZodLiteral<"panel">;
495
+ entry_point: z.ZodString;
496
+ },
497
+ z.core.$strip
498
+ >,
499
+ z.ZodObject<
500
+ {
501
+ name: z.ZodString;
502
+ interface_type: z.ZodLiteral<"worker">;
503
+ entry_point: z.ZodString;
504
+ },
505
+ z.core.$strip
506
+ >,
507
+ z.ZodObject<
508
+ {
509
+ name: z.ZodString;
510
+ interface_type: z.ZodLiteral<"app">;
511
+ entry_point: z.ZodString;
512
+ },
513
+ z.core.$strip
514
+ >,
515
+ ],
516
+ "interface_type"
517
+ >
518
+ >
519
+ >;
520
+ title: z.ZodString;
521
+ organizationId: z.core.$ZodBranded<
522
+ z.ZodString,
523
+ "OrganizationId",
524
+ "out"
525
+ >;
526
+ type: z.ZodLiteral<"coreApp">;
527
+ urlType: z.ZodLiteral<"external">;
528
+ activeDeployment: z.ZodNullable<
529
+ z.ZodObject<
530
+ {
531
+ id: z.ZodString;
532
+ version: z.ZodString;
533
+ isActiveDeployment: z.ZodBoolean;
534
+ userApplicationId: z.ZodString;
535
+ isAutoUpdating: z.ZodNullable<z.ZodBoolean>;
536
+ size: z.ZodNullable<z.ZodNumber>;
537
+ deployedAt: z.ZodString;
538
+ deployedBy: z.ZodString;
539
+ createdAt: z.ZodString;
540
+ updatedAt: z.ZodString;
541
+ manifest: z.ZodNullable<
542
+ z.ZodObject<
543
+ {
544
+ version: z.ZodString;
545
+ icon: z.ZodOptional<z.ZodString>;
546
+ title: z.ZodOptional<z.ZodString>;
547
+ group: z.ZodOptional<z.ZodString>;
548
+ priority: z.ZodOptional<z.ZodNumber>;
549
+ },
550
+ z.core.$strip
551
+ >
552
+ >;
553
+ },
554
+ z.core.$strip
555
+ >
556
+ >;
557
+ },
558
+ z.core.$strip
559
+ >,
560
+ ],
561
+ "urlType"
562
+ >;
563
+
564
+ /**
565
+ * @public
566
+ */
567
+ declare type CoreAppUserApplication = z.output<typeof CoreAppUserApplication_2>;
568
+
569
+ /**
570
+ * @public
571
+ */
572
+ export declare const CoreAppUserApplicationManifest: z.ZodObject<
573
+ {
574
+ version: z.ZodString;
575
+ icon: z.ZodOptional<z.ZodString>;
576
+ title: z.ZodOptional<z.ZodString>;
577
+ group: z.ZodOptional<z.ZodString>;
578
+ priority: z.ZodOptional<z.ZodNumber>;
579
+ },
580
+ z.core.$strip
581
+ >;
582
+
583
+ /**
584
+ * @public
585
+ */
586
+ export declare type CoreAppUserApplicationManifest = z.output<
587
+ typeof CoreAppUserApplicationManifest
588
+ >;
589
+
590
+ /**
591
+ * Creates a leveled logger with an optional namespace prefix and bound
592
+ * context. Calls below the configured `logLevel` are suppressed; `"none"`
593
+ * silences the logger entirely.
594
+ *
595
+ * Use {@link Logger.child} to derive a sub-logger with an extended namespace
596
+ * (e.g. `parent:domain`) that inherits the parent's level and merges its
597
+ * bound context.
598
+ *
599
+ * @param options - Logger configuration.
600
+ * @param options.namespace - Prepended to every message in `[brackets]`.
601
+ * @param options.context - Bound context merged with per-call context.
602
+ * Per-call keys win on conflict.
603
+ * @param options.logLevel - Maximum verbosity to emit. Default `"info"`.
604
+ *
605
+ * @example
606
+ * ```ts
607
+ * const log = createLogger({ namespace: "checkout", logLevel: "debug" });
608
+ * log.info("placed", { orderId: "abc" });
609
+ * // → [checkout] placed { orderId: "abc" }
610
+ *
611
+ * const auth = log.child("auth", { tenant: "acme" });
612
+ * auth.warn("token expiring");
613
+ * // → [checkout:auth] token expiring { tenant: "acme" }
614
+ * ```
615
+ *
616
+ * @public
617
+ */
618
+ export declare function createLogger({
619
+ namespace,
620
+ context: baseContext,
621
+ logLevel,
622
+ }?: LoggerOptions): Logger;
623
+
624
+ /**
625
+ * Where an application docks. The manifest's `group` value the workbench reads
626
+ * to place an app in the dock; the authoring counterpart that validates it on
627
+ * `unstable_defineApp` lives with the CLI define helpers.
628
+ * @public
629
+ */
630
+ export declare type DockGroup =
631
+ | "dock.system"
632
+ | "dock.applications"
633
+ | "dock.user";
634
+
635
+ /**
636
+ * Returns the API host based on the `__SANITY_STAGING__` runtime-time flag.
637
+ * If the flag is set to `true`, the staging API host is returned.
638
+ * Otherwise, the production API host is returned.
639
+ *
640
+ * @public
641
+ */
642
+ export declare function getApiHost(): string | undefined;
643
+
644
+ /**
645
+ * Returns the Sanity domain based on the `__SANITY_STAGING__` runtime-time flag.
646
+ * If the flag is set to `true`, the staging domain is returned.
647
+ * Otherwise, the production domain is returned.
648
+ *
649
+ * @public
650
+ */
651
+ export declare function getSanityDomain(): string;
652
+
653
+ /**
654
+ * Returns the current Sanity environment based on the `__SANITY_STAGING__` runtime-time flag.
655
+ * If the flag is set to `true`, "staging" is returned.
656
+ * Otherwise, "production" is returned.
657
+ *
658
+ * @public
659
+ */
660
+ export declare function getSanityEnv(): "staging" | "production";
661
+
662
+ /** @public */
663
+ export declare type Interface = z.output<typeof InterfaceSchema>;
664
+
665
+ /** The interface record for a given `interface_type`. @public */
666
+ declare type InterfaceOfType<T extends Interface["interface_type"]> = Extract<
667
+ Interface,
668
+ {
669
+ interface_type: T;
670
+ }
671
+ >;
672
+
673
+ /**
674
+ * An interface record discriminated on `interface_type` — a `panel` renders in
675
+ * the dock, a `worker` runs a background service, an `app` is the navigable
676
+ * full-page view.
677
+ * @public
678
+ */
679
+ export declare const InterfaceSchema: z.ZodDiscriminatedUnion<
680
+ [
681
+ z.ZodObject<
682
+ {
683
+ interface_type: z.ZodLiteral<"panel">;
684
+ id: z.ZodString;
685
+ deployment_id: z.ZodString;
686
+ name: z.ZodString;
687
+ entry_point: z.ZodString;
688
+ },
689
+ z.core.$strip
690
+ >,
691
+ z.ZodObject<
692
+ {
693
+ interface_type: z.ZodLiteral<"worker">;
694
+ id: z.ZodString;
695
+ deployment_id: z.ZodString;
696
+ name: z.ZodString;
697
+ entry_point: z.ZodString;
698
+ },
699
+ z.core.$strip
700
+ >,
701
+ z.ZodObject<
702
+ {
703
+ interface_type: z.ZodLiteral<"app">;
704
+ id: z.ZodString;
705
+ deployment_id: z.ZodString;
706
+ name: z.ZodString;
707
+ entry_point: z.ZodString;
708
+ },
709
+ z.core.$strip
710
+ >,
711
+ ],
712
+ "interface_type"
713
+ >;
714
+
715
+ /**
716
+ * Joins multiple path segments into a single path string.
717
+ * Handles null, undefined, and URL objects gracefully.
718
+ *
719
+ * @public
720
+ * @param paths - An array of path segments to join.
721
+ * @returns A single joined path string.
722
+ */
723
+ export declare const joinUrlPaths: (
724
+ ...paths: Array<string | URL | null | undefined>
725
+ ) => string;
726
+
727
+ /** @public */
728
+ export declare type LocalApp = LocalInterfaceOfType<"app">;
729
+
730
+ /** @public */
731
+ export declare type LocalInterface = z.output<typeof LocalInterfaceSchema>;
732
+
733
+ /** The {@link InterfaceOfType} counterpart without `id`/`deployment_id`. @public */
734
+ declare type LocalInterfaceOfType<T extends LocalInterface["interface_type"]> =
735
+ Extract<
736
+ LocalInterface,
737
+ {
738
+ interface_type: T;
739
+ }
740
+ >;
741
+
742
+ /**
743
+ * An {@link Interface} without the service-assigned `id`/`deployment_id` a local
744
+ * dev server can't provide — the shape the workbench renders from.
745
+ * @public
746
+ */
747
+ export declare const LocalInterfaceSchema: z.ZodDiscriminatedUnion<
748
+ [
749
+ z.ZodObject<
750
+ {
751
+ name: z.ZodString;
752
+ interface_type: z.ZodLiteral<"panel">;
753
+ entry_point: z.ZodString;
754
+ },
755
+ z.core.$strip
756
+ >,
757
+ z.ZodObject<
758
+ {
759
+ name: z.ZodString;
760
+ interface_type: z.ZodLiteral<"worker">;
761
+ entry_point: z.ZodString;
762
+ },
763
+ z.core.$strip
764
+ >,
765
+ z.ZodObject<
766
+ {
767
+ name: z.ZodString;
768
+ interface_type: z.ZodLiteral<"app">;
769
+ entry_point: z.ZodString;
770
+ },
771
+ z.core.$strip
772
+ >,
773
+ ],
774
+ "interface_type"
775
+ >;
776
+
777
+ /** @public */
778
+ export declare type LocalPanel = LocalInterfaceOfType<"panel">;
779
+
780
+ /** @public */
781
+ export declare type LocalService = LocalInterfaceOfType<"worker">;
782
+
783
+ /**
784
+ * Raw data for a local application discovered by the CLI dev server.
785
+ *
786
+ * The CLI forwards the full studio or app manifest so the workbench can
787
+ * derive icons, titles, workspaces and schema references the same way it
788
+ * does for deployed applications. The manifest shape is discriminated on
789
+ * `type`: studios receive a `ClientManifest`, core apps a `CoreAppUserApplicationManifest`.
790
+ *
791
+ * When set on a `UserApplication`, `isLocal` is `true` and `url`/`isFederated`
792
+ * honour the local dev-server instead of the deployed application's host.
793
+ *
794
+ * @public
795
+ */
796
+ export declare const LocalUserApplication: z.ZodDiscriminatedUnion<
797
+ [
798
+ z.ZodObject<
799
+ {
800
+ host: z.ZodString;
801
+ port: z.ZodNumber;
802
+ interfaces: z.ZodOptional<
803
+ z.ZodArray<
804
+ z.ZodDiscriminatedUnion<
805
+ [
806
+ z.ZodObject<
807
+ {
808
+ name: z.ZodString;
809
+ interface_type: z.ZodLiteral<"panel">;
810
+ entry_point: z.ZodString;
811
+ },
812
+ z.core.$strip
813
+ >,
814
+ z.ZodObject<
815
+ {
816
+ name: z.ZodString;
817
+ interface_type: z.ZodLiteral<"worker">;
818
+ entry_point: z.ZodString;
819
+ },
820
+ z.core.$strip
821
+ >,
822
+ z.ZodObject<
823
+ {
824
+ name: z.ZodString;
825
+ interface_type: z.ZodLiteral<"app">;
826
+ entry_point: z.ZodString;
827
+ },
828
+ z.core.$strip
829
+ >,
830
+ ],
831
+ "interface_type"
832
+ >
833
+ >
834
+ >;
835
+ id: z.ZodOptional<z.ZodString>;
836
+ projectId: z.ZodOptional<z.ZodString>;
837
+ type: z.ZodLiteral<"studio">;
838
+ manifest: z.ZodOptional<
839
+ z.ZodCustom<
840
+ {
841
+ version: number;
842
+ createdAt: string;
843
+ workspaces: {
844
+ name: string;
845
+ title: string;
846
+ basePath: string;
847
+ projectId: string & z.core.$brand<"ProjectId">;
848
+ schema: string;
849
+ subtitle?: string | undefined;
850
+ dataset?: string | undefined;
851
+ icon?: string | null | undefined;
852
+ tools?: string | undefined;
853
+ }[];
854
+ studioVersion?: string | undefined;
855
+ group?: string | undefined;
856
+ priority?: number | undefined;
857
+ },
858
+ {
859
+ version: number;
860
+ createdAt: string;
861
+ workspaces: {
862
+ name: string;
863
+ title: string;
864
+ basePath: string;
865
+ projectId: string & z.core.$brand<"ProjectId">;
866
+ schema: string;
867
+ subtitle?: string | undefined;
868
+ dataset?: string | undefined;
869
+ icon?: string | null | undefined;
870
+ tools?: string | undefined;
871
+ }[];
872
+ studioVersion?: string | undefined;
873
+ group?: string | undefined;
874
+ priority?: number | undefined;
875
+ }
876
+ >
877
+ >;
878
+ },
879
+ z.core.$strip
880
+ >,
881
+ z.ZodObject<
882
+ {
883
+ host: z.ZodString;
884
+ port: z.ZodNumber;
885
+ interfaces: z.ZodOptional<
886
+ z.ZodArray<
887
+ z.ZodDiscriminatedUnion<
888
+ [
889
+ z.ZodObject<
890
+ {
891
+ name: z.ZodString;
892
+ interface_type: z.ZodLiteral<"panel">;
893
+ entry_point: z.ZodString;
894
+ },
895
+ z.core.$strip
896
+ >,
897
+ z.ZodObject<
898
+ {
899
+ name: z.ZodString;
900
+ interface_type: z.ZodLiteral<"worker">;
901
+ entry_point: z.ZodString;
902
+ },
903
+ z.core.$strip
904
+ >,
905
+ z.ZodObject<
906
+ {
907
+ name: z.ZodString;
908
+ interface_type: z.ZodLiteral<"app">;
909
+ entry_point: z.ZodString;
910
+ },
911
+ z.core.$strip
912
+ >,
913
+ ],
914
+ "interface_type"
915
+ >
916
+ >
917
+ >;
918
+ id: z.ZodOptional<z.ZodString>;
919
+ projectId: z.ZodOptional<z.ZodString>;
920
+ type: z.ZodLiteral<"coreApp">;
921
+ manifest: z.ZodOptional<
922
+ z.ZodCustom<
923
+ {
924
+ version: string;
925
+ icon?: string | undefined;
926
+ title?: string | undefined;
927
+ group?: string | undefined;
928
+ priority?: number | undefined;
929
+ },
930
+ {
931
+ version: string;
932
+ icon?: string | undefined;
933
+ title?: string | undefined;
934
+ group?: string | undefined;
935
+ priority?: number | undefined;
936
+ }
937
+ >
938
+ >;
939
+ },
940
+ z.core.$strip
941
+ >,
942
+ ],
943
+ "type"
944
+ >;
945
+
946
+ /**
947
+ * @public
948
+ */
949
+ export declare type LocalUserApplication = z.output<
950
+ typeof LocalUserApplication
951
+ >;
952
+
953
+ declare type LogContext = {
954
+ [key: string]: unknown;
955
+ };
956
+
957
+ /**
958
+ * @public
959
+ */
960
+ export declare interface Logger {
961
+ error: (message: string, context?: LogContext) => void;
962
+ warn: (message: string, context?: LogContext) => void;
963
+ info: (message: string, context?: LogContext) => void;
964
+ debug: (message: string, context?: LogContext) => void;
965
+ child: (domain: string, context?: LogContext) => Logger;
966
+ }
967
+
968
+ /**
969
+ * Shared workbench logger instance. Use this from both the workbench host
970
+ * and its remotes so lifecycle and diagnostic logs appear under a single
971
+ * namespace.
972
+ *
973
+ * @public
974
+ */
975
+ export declare const logger: Logger;
976
+
977
+ declare interface LoggerOptions {
978
+ namespace?: LogNamespace;
979
+ context?: LogContext;
980
+ logLevel?: LogLevel;
981
+ }
982
+
983
+ /**
984
+ * Log levels in order of verbosity (least to most)
985
+ * - none: Silent
986
+ * - error: Critical failures that prevent operation
987
+ * - warn: Issues that may cause problems but don't stop execution
988
+ * - info: High-level informational messages (default)
989
+ * - debug: Detailed debugging information (maintainer level)
990
+ * - trace: Very detailed tracing — sets `internal: true` on context
991
+ * @public
992
+ */
993
+ export declare type LogLevel = "none" | "error" | "warn" | "info" | "debug";
994
+
995
+ /**
996
+ * Namespaces organize logs by functional domain.
997
+ * @internal
998
+ */
999
+ export declare type LogNamespace = string;
1000
+
1001
+ /**
1002
+ * Represents a MediaLibrary resource as returned from the API.
1003
+ * @public
1004
+ */
1005
+ export declare type MediaLibrary = z.output<typeof MediaLibrary_2>;
1006
+
1007
+ declare const MediaLibrary_2: z.ZodObject<
1008
+ {
1009
+ id: z.core.$ZodBranded<z.ZodString, "MediaLibraryId", "out">;
1010
+ organizationId: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
1011
+ status: z.ZodEnum<{
1012
+ active: "active";
1013
+ provisioning: "provisioning";
1014
+ }>;
1015
+ aclMode: z.ZodEnum<{
1016
+ private: "private";
1017
+ public: "public";
1018
+ }>;
1019
+ },
1020
+ z.core.$strip
1021
+ >;
1022
+
1023
+ /**
1024
+ * Represents a MediaLibrary resource as returned from the API.
1025
+ * @public
1026
+ */
1027
+ declare type MediaLibrary = z.output<typeof MediaLibrary_2>;
1028
+
1029
+ /**
1030
+ * Whilst the constructor takes an organization's media library resource the existance
1031
+ * therefore implies the organization has access to the media library application which
1032
+ * is what workbench most importantly wants to know.
1033
+ * @public
1034
+ */
1035
+ export declare class MediaLibraryApplication extends AbstractApplication<"media-library"> {
1036
+ readonly library: MediaLibrary;
1037
+ constructor(library: MediaLibrary);
1038
+ get id(): string;
1039
+ get href(): string;
1040
+ get title(): string;
1041
+ get isFederated(): boolean;
1042
+ get url(): URL;
1043
+ toProtocolResource(): MediaResource;
1044
+ }
1045
+
1046
+ /**
1047
+ * MediaLibrary ID type, branded for type safety.
1048
+ * @public
1049
+ */
1050
+ export declare type MediaLibraryId = z.output<typeof MediaLibraryId_2>;
1051
+
1052
+ /**
1053
+ * Canvas ID schema, branded for type safety.
1054
+ * @public
1055
+ */
1056
+ declare const MediaLibraryId_2: z.core.$ZodBranded<
1057
+ z.ZodString,
1058
+ "MediaLibraryId",
1059
+ "out"
1060
+ >;
1061
+
1062
+ /**
1063
+ * MediaLibrary ID type, branded for type safety.
1064
+ * @public
1065
+ */
1066
+ declare type MediaLibraryId = z.output<typeof MediaLibraryId_2>;
1067
+
1068
+ /**
1069
+ * Organization schema — validates and brands API responses
1070
+ * from the `/organizations/:id` endpoint.
1071
+ * @public
1072
+ */
1073
+ export declare const Organization: z.ZodObject<
1074
+ {
1075
+ id: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
1076
+ name: z.ZodString;
1077
+ slug: z.ZodNullable<z.ZodString>;
1078
+ createdAt: z.ZodString;
1079
+ updatedAt: z.ZodString;
1080
+ dashboardStatus: z.ZodEnum<{
1081
+ enabled: "enabled";
1082
+ disabled: "disabled";
1083
+ }>;
1084
+ aiFeaturesStatus: z.ZodEnum<{
1085
+ enabled: "enabled";
1086
+ disabled: "disabled";
1087
+ }>;
1088
+ defaultRoleName: z.ZodNullable<z.ZodString>;
1089
+ },
1090
+ z.core.$strip
1091
+ >;
1092
+
1093
+ /**
1094
+ * Represents an organization with optional members and
1095
+ * features arrays depending on the generic parameters.
1096
+ * - `Organization` — base fields only (default)
1097
+ * - `Organization<true>` — includes `members`
1098
+ * - `Organization<true, true>` — includes both
1099
+ * @public
1100
+ */
1101
+ export declare type Organization<
1102
+ IncludeMembers extends boolean = true,
1103
+ IncludeFeatures extends boolean = true,
1104
+ > = z.output<typeof Organization> &
1105
+ (IncludeMembers extends true
1106
+ ? {
1107
+ members: OrganizationMember[];
1108
+ }
1109
+ : unknown) &
1110
+ (IncludeFeatures extends true
1111
+ ? {
1112
+ features: string[];
1113
+ }
1114
+ : unknown);
1115
+
1116
+ /**
1117
+ * Organization ID schema, branded for type safety.
1118
+ * @public
1119
+ */
1120
+ export declare const OrganizationId: z.core.$ZodBranded<
1121
+ z.ZodString,
1122
+ "OrganizationId",
1123
+ "out"
1124
+ >;
1125
+
1126
+ /**
1127
+ * Organization ID type, branded for type safety.
1128
+ * @public
1129
+ */
1130
+ export declare type OrganizationId = z.output<typeof OrganizationId>;
1131
+
1132
+ /**
1133
+ * @public
1134
+ */
1135
+ export declare type OrganizationMember = z.output<typeof OrganizationMember_2>;
1136
+
1137
+ declare const OrganizationMember_2: z.ZodObject<
1138
+ {
1139
+ sanityUserId: z.ZodString;
1140
+ isCurrentUser: z.ZodBoolean;
1141
+ user: z.ZodObject<
1142
+ {
1143
+ id: z.ZodString;
1144
+ displayName: z.ZodString;
1145
+ familyName: z.ZodString;
1146
+ givenName: z.ZodString;
1147
+ middleName: z.ZodNullable<z.ZodString>;
1148
+ imageUrl: z.ZodNullable<z.ZodString>;
1149
+ email: z.ZodString;
1150
+ loginProvider: z.ZodString;
1151
+ },
1152
+ z.core.$strip
1153
+ >;
1154
+ roles: z.ZodArray<
1155
+ z.ZodObject<
1156
+ {
1157
+ name: z.ZodString;
1158
+ title: z.ZodString;
1159
+ description: z.ZodOptional<z.ZodString>;
1160
+ },
1161
+ z.core.$strip
1162
+ >
1163
+ >;
1164
+ },
1165
+ z.core.$strip
1166
+ >;
1167
+
1168
+ /**
1169
+ * @public
1170
+ */
1171
+ declare type OrganizationMember = z.output<typeof OrganizationMember_2>;
1172
+
1173
+ /** @public */
1174
+ export declare type Panel = InterfaceOfType<"panel">;
1175
+
1176
+ /**
1177
+ * A panel's view-component slots, in render order — each its own federation
1178
+ * island (`${id}/views/${name}/${component}`). The authoring counterpart that
1179
+ * drives the build's per-slot codegen lives with the CLI define helpers.
1180
+ * @public
1181
+ */
1182
+ export declare type PanelComponent = "title" | "panel";
1183
+
1184
+ /**
1185
+ * Validates and parses a raw API response into a branded
1186
+ * Canvas.
1187
+ * @public
1188
+ */
1189
+ export declare function parseCanvas(data: unknown): Canvas;
1190
+
1191
+ /**
1192
+ * Validates and parses a raw API response into a branded
1193
+ * CoreAppUserApplicationData.
1194
+ * @public
1195
+ */
1196
+ export declare function parseCoreApplication(
1197
+ data: unknown,
1198
+ ): CoreAppUserApplication;
1199
+
1200
+ /**
1201
+ * Validates and parses a raw API response into a branded
1202
+ * MediaLibrary.
1203
+ * @public
1204
+ */
1205
+ export declare function parseMediaLibrary(data: unknown): MediaLibrary;
1206
+
1207
+ /**
1208
+ * Validates and parses a raw API response into a branded
1209
+ * Organization. The options control which schema is used —
1210
+ * matching what the API returns based on query params.
1211
+ * @public
1212
+ */
1213
+ export declare function parseOrganization<
1214
+ IncludeMembers extends boolean = true,
1215
+ IncludeFeatures extends boolean = true,
1216
+ >(
1217
+ data: unknown,
1218
+ options?: {
1219
+ includeMembers?: IncludeMembers;
1220
+ includeFeatures?: IncludeFeatures;
1221
+ },
1222
+ ): Organization<IncludeMembers, IncludeFeatures>;
1223
+
1224
+ /**
1225
+ * Validates and parses a raw API response into a branded
1226
+ * Project. The options control which schema is used —
1227
+ * matching what the API returns based on query params.
1228
+ * @public
1229
+ */
1230
+ export declare function parseProject<
1231
+ IncludeMembers extends boolean = true,
1232
+ IncludeFeatures extends boolean = true,
1233
+ >(
1234
+ data: unknown,
1235
+ options?: {
1236
+ includeMembers?: IncludeMembers;
1237
+ includeFeatures?: IncludeFeatures;
1238
+ },
1239
+ ): Project<IncludeMembers, IncludeFeatures>;
1240
+
1241
+ /**
1242
+ * Validates and parses a raw API response into a branded
1243
+ * StudioUserApplication.
1244
+ * @public
1245
+ */
1246
+ export declare function parseStudioUserApplication(
1247
+ data: unknown,
1248
+ ): StudioUserApplication;
1249
+
1250
+ /**
1251
+ * Project schema — validates and brands API responses
1252
+ * from the `/projects/:id` endpoint.
1253
+ * @public
1254
+ */
1255
+ export declare const Project: z.ZodObject<
1256
+ {
1257
+ id: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1258
+ displayName: z.ZodString;
1259
+ studioHost: z.ZodNullable<z.ZodString>;
1260
+ organizationId: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
1261
+ metadata: z.ZodObject<
1262
+ {
1263
+ color: z.ZodOptional<z.ZodString>;
1264
+ externalStudioHost: z.ZodOptional<z.ZodString>;
1265
+ initialTemplate: z.ZodOptional<z.ZodString>;
1266
+ cliInitializedAt: z.ZodOptional<z.ZodString>;
1267
+ integration: z.ZodOptional<z.ZodString>;
1268
+ },
1269
+ z.core.$strip
1270
+ >;
1271
+ isBlocked: z.ZodBoolean;
1272
+ isDisabled: z.ZodBoolean;
1273
+ isDisabledByUser: z.ZodBoolean;
1274
+ activityFeedEnabled: z.ZodBoolean;
1275
+ createdAt: z.ZodString;
1276
+ updatedAt: z.ZodString;
1277
+ },
1278
+ z.core.$strip
1279
+ >;
1280
+
1281
+ /**
1282
+ * Represents a Sanity project with optional members and
1283
+ * features arrays depending on the generic parameters.
1284
+ * By default, neither members nor features are included.
1285
+ * - `Project` — base fields only (default)
1286
+ * - `Project<true>` — includes `members`
1287
+ * - `Project<true, true>` — includes both
1288
+ * @public
1289
+ */
1290
+ export declare type Project<
1291
+ IncludeMembers extends boolean = true,
1292
+ IncludeFeatures extends boolean = true,
1293
+ > = z.output<typeof Project> &
1294
+ (IncludeMembers extends true
1295
+ ? {
1296
+ members: ProjectMember[];
1297
+ }
1298
+ : unknown) &
1299
+ (IncludeFeatures extends true
1300
+ ? {
1301
+ features: string[];
1302
+ }
1303
+ : unknown);
1304
+
1305
+ /**
1306
+ * Project ID schema, branded for type safety.
1307
+ * @public
1308
+ */
1309
+ export declare const ProjectId: z.core.$ZodBranded<
1310
+ z.ZodString,
1311
+ "ProjectId",
1312
+ "out"
1313
+ >;
1314
+
1315
+ /**
1316
+ * Project ID type, branded for type safety.
1317
+ * @public
1318
+ */
1319
+ export declare type ProjectId = z.output<typeof ProjectId>;
1320
+
1321
+ /**
1322
+ * @public
1323
+ */
1324
+ export declare type ProjectMember = z.output<typeof ProjectMember_2>;
1325
+
1326
+ declare const ProjectMember_2: z.ZodObject<
1327
+ {
1328
+ id: z.ZodString;
1329
+ createdAt: z.ZodString;
1330
+ updatedAt: z.ZodString;
1331
+ isCurrentUser: z.ZodBoolean;
1332
+ isRobot: z.ZodBoolean;
1333
+ roles: z.ZodArray<
1334
+ z.ZodObject<
1335
+ {
1336
+ name: z.ZodString;
1337
+ title: z.ZodString;
1338
+ description: z.ZodString;
1339
+ },
1340
+ z.core.$strip
1341
+ >
1342
+ >;
1343
+ },
1344
+ z.core.$strip
1345
+ >;
1346
+
1347
+ /**
1348
+ * @public
1349
+ */
1350
+ declare type ProjectMember = z.output<typeof ProjectMember_2>;
1351
+
1352
+ /**
1353
+ * Options for rendering a remote module, such as a user application.
1354
+ *
1355
+ * @public
1356
+ */
1357
+ export declare interface RemoteModuleRenderOptions {
1358
+ reactStrictMode?: boolean;
1359
+ }
1360
+
1361
+ /**
1362
+ * The resolved configuration after processing
1363
+ * and validating the provided config.
1364
+ *
1365
+ * @public
1366
+ */
1367
+ export declare type ResolvedConfig = Omit<Config, "organizationId"> & {
1368
+ organizationId: OrganizationId;
1369
+ };
1370
+
1371
+ /**
1372
+ * @public
1373
+ */
1374
+ export declare const ServerManifest: z.ZodObject<
1375
+ {
1376
+ buildId: z.ZodOptional<z.ZodString>;
1377
+ bundleVersion: z.ZodOptional<z.ZodString>;
1378
+ version: z.ZodOptional<z.ZodString>;
1379
+ group: z.ZodOptional<z.ZodString>;
1380
+ priority: z.ZodOptional<z.ZodNumber>;
1381
+ workspaces: z.ZodOptional<
1382
+ z.ZodArray<
1383
+ z.ZodObject<
1384
+ {
1385
+ name: z.ZodString;
1386
+ title: z.ZodString;
1387
+ subtitle: z.ZodOptional<z.ZodString>;
1388
+ basePath: z.ZodString;
1389
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1390
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1391
+ dataset: z.ZodString;
1392
+ schemaDescriptorId: z.ZodString;
1393
+ },
1394
+ z.core.$strip
1395
+ >
1396
+ >
1397
+ >;
1398
+ },
1399
+ z.core.$strip
1400
+ >;
1401
+
1402
+ /**
1403
+ * @public
1404
+ */
1405
+ export declare type ServerManifest = z.output<typeof ServerManifest>;
1406
+
1407
+ /**
1408
+ * A service an application runs — the worker-typed interface record. `Service`/
1409
+ * `LocalService` are the worker-typed subset of the interface model.
1410
+ * @public
1411
+ */
1412
+ export declare type Service = InterfaceOfType<"worker">;
1413
+
1414
+ /**
1415
+ * @public
1416
+ */
1417
+ export declare class StudioApplication extends UserApplication<
1418
+ StudioUserApplication,
1419
+ "studio",
1420
+ never
1421
+ > {
1422
+ /**
1423
+ * Returns a list of studio workspaces based on the application manifest.
1424
+ * If there is no manifest, or alternatively it is not valid, then we create a default workspace.
1425
+ */
1426
+ readonly workspaces: readonly StudioWorkspace[];
1427
+ readonly project: Project<false, false>;
1428
+ /**
1429
+ * The projects actually referenced by this studio — the application's own
1430
+ * project plus any project used by a workspace. Preserved so the instance
1431
+ * can be re-constructed (e.g. by dock wrappers) without having to thread
1432
+ * the full organization project list through again.
1433
+ */
1434
+ readonly projects: Project<false, false>[];
1435
+ /**
1436
+ * @param application - The studio application to create a list of workspaces for
1437
+ * @param projects - The projects available in the organization. It's not enough to just pass
1438
+ * the project that associates with the application because that is the project the app is deployed in relation to.
1439
+ * The workspaces may have different projects completely.
1440
+ */
1441
+ constructor(
1442
+ application: StudioUserApplication,
1443
+ projects: Project<false, false>[],
1444
+ options?: {
1445
+ isLocal?: boolean;
1446
+ remoteApplication?: StudioApplication | null;
1447
+ },
1448
+ );
1449
+ /**
1450
+ * Factory hook called for each workspace during construction. Subclasses
1451
+ * override this to substitute a `StudioWorkspace` subclass (e.g. a UI-aware
1452
+ * variant in a downstream package) without re-implementing the constructor's
1453
+ * workspace-derivation logic.
1454
+ */
1455
+ protected createWorkspace(
1456
+ workspace: Workspace,
1457
+ project: Project<false, false>,
1458
+ isDefaultWorkspace: boolean,
1459
+ ): StudioWorkspace;
1460
+ get href(): string;
1461
+ get title(): string;
1462
+ get subtitle(): string;
1463
+ get<TKey extends keyof StudioUserApplication>(
1464
+ attr: TKey,
1465
+ ): StudioUserApplication[TKey];
1466
+ /**
1467
+ * Resolves the studio's most authoritative manifest. The lookup order is:
1468
+ *
1469
+ * 1. `activeDeployment.manifest` — deployment manifests are the new
1470
+ * primitive within Sanity and are preferred whenever available.
1471
+ * 2. `manifestData.value` — fallback to support older studios that
1472
+ * haven't produced a deployment manifest yet.
1473
+ * 3. `application.manifest` — last-resort legacy field.
1474
+ *
1475
+ * Returns `null` when no manifest is available. The return shape is a
1476
+ * union because the deployment and client manifests are not
1477
+ * interchangeable — consumers that depend on client-only fields (e.g.
1478
+ * `studioVersion`, workspace `schema`) must narrow or read the raw
1479
+ * field they need.
1480
+ */
1481
+ get manifest(): ClientManifest | ServerManifest | null;
1482
+ get hasManifest(): boolean;
1483
+ get hasSchema(): boolean;
1484
+ private resolveVersion;
1485
+ get version(): string | null;
1486
+ get compatibilityStatus(): CompatibilityStatus;
1487
+ /**
1488
+ * Used to calculate the compatibility status of a given studio application.
1489
+ * Optionally if you've resolved the version elsewhere provide that value to
1490
+ * get the new compatibility status without mutating the application.
1491
+ */
1492
+ static resolveCompatibilityStatus(
1493
+ application: StudioApplication,
1494
+ version?: string | null,
1495
+ ): CompatibilityStatus;
1496
+ get isAutoRedirecting(): boolean;
1497
+ /**
1498
+ * Mirrors the `isRedirectable` function from Saison defined in
1499
+ * https://github.com/sanity-io/saison/blob/83556405d23e07f6d3a71c76249c67e33fe1101f/src/utils/applications.ts
1500
+ *
1501
+ * Returns whether a studio application is auto-redirecting, meaning it can only be accessed in the context of
1502
+ * Dashboard.
1503
+ */
1504
+ static resolveIsAutoRedirecting(
1505
+ application: StudioApplication,
1506
+ versionArg?: string | null,
1507
+ ): boolean;
1508
+ /**
1509
+ * Returns a list of issues that prevent the studio from functioning properly in the Dashboard.
1510
+ * This static value depends on the version of the studio that comes from the `activeDeployment` property.
1511
+ * As such, if the studio is auto-updating, this list will be incorrect & instead you should use
1512
+ * the static method `resolveIssues` to get the correct issues by passing the resolved version.
1513
+ */
1514
+ get issues(): StudioIssues;
1515
+ static resolveIssues(
1516
+ application: StudioApplication,
1517
+ version?: string | null,
1518
+ ): StudioIssues;
1519
+ protected isFeatureSupported(
1520
+ feature: StudioDashboardIssue,
1521
+ version?: string | null,
1522
+ ): boolean;
1523
+ toProtocolResource(): never;
1524
+ static CompatibilityStatuses: {
1525
+ readonly UNKNOWN: "unknown";
1526
+ readonly PARTIALLY_COMPATIBLE: "partially-compatible";
1527
+ readonly FULLY_COMPATIBLE: "fully-compatible";
1528
+ };
1529
+ static StudioIssues: {
1530
+ readonly ISSUE_ACTIVITY: "ACTIVITY";
1531
+ readonly ISSUE_AGENT: "AGENT";
1532
+ readonly ISSUE_FAVORITES: "FAVORITES";
1533
+ readonly ISSUE_URL_SYNCING: "URL_SYNCING";
1534
+ readonly ISSUE_UI_ADJUSTMENT: "UI_ADJUSTMENT";
1535
+ readonly ISSUE_CONTENT_MAPPING: "CONTENT_MAPPING";
1536
+ readonly ISSUE_LOGIN: "LOGIN";
1537
+ readonly ISSUE_MANIFEST: "MANIFEST";
1538
+ };
1539
+ static Features: (
1540
+ | {
1541
+ id: "AGENT";
1542
+ version: string;
1543
+ }
1544
+ | {
1545
+ id: "FAVORITES";
1546
+ version: string;
1547
+ }
1548
+ | {
1549
+ id: "ACTIVITY";
1550
+ version: string;
1551
+ }
1552
+ | {
1553
+ id: "URL_SYNCING";
1554
+ version: string;
1555
+ }
1556
+ | {
1557
+ id: "UI_ADJUSTMENT";
1558
+ version: string;
1559
+ }
1560
+ | {
1561
+ id: "CONTENT_MAPPING";
1562
+ version: string;
1563
+ }
1564
+ | {
1565
+ id: "LOGIN";
1566
+ version: string;
1567
+ }
1568
+ )[];
1569
+ static MinimumStudioVersion: "2.28.0";
1570
+ static MinimumStudioVersionWithNoIssues: string | undefined;
1571
+ }
1572
+
1573
+ declare type StudioDashboardIssue =
1574
+ (typeof StudioApplication.StudioIssues)[keyof typeof StudioApplication.StudioIssues];
1575
+
1576
+ declare type StudioIssues = Array<{
1577
+ id: StudioDashboardIssue;
1578
+ version?: string;
1579
+ }>;
1580
+
1581
+ /**
1582
+ * Studio user application schema — validates and brands API
1583
+ * responses from the `/user-applications?appType=studio`
1584
+ * endpoint. Uses a discriminated union on `urlType`.
1585
+ * @public
1586
+ */
1587
+ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1588
+ [
1589
+ z.ZodObject<
1590
+ {
1591
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
1592
+ appHost: z.ZodString;
1593
+ createdAt: z.ZodString;
1594
+ updatedAt: z.ZodString;
1595
+ dashboardStatus: z.ZodEnum<{
1596
+ default: "default";
1597
+ disabled: "disabled";
1598
+ }>;
1599
+ interfaces: z.ZodOptional<
1600
+ z.ZodArray<
1601
+ z.ZodDiscriminatedUnion<
1602
+ [
1603
+ z.ZodObject<
1604
+ {
1605
+ name: z.ZodString;
1606
+ interface_type: z.ZodLiteral<"panel">;
1607
+ entry_point: z.ZodString;
1608
+ },
1609
+ z.core.$strip
1610
+ >,
1611
+ z.ZodObject<
1612
+ {
1613
+ name: z.ZodString;
1614
+ interface_type: z.ZodLiteral<"worker">;
1615
+ entry_point: z.ZodString;
1616
+ },
1617
+ z.core.$strip
1618
+ >,
1619
+ z.ZodObject<
1620
+ {
1621
+ name: z.ZodString;
1622
+ interface_type: z.ZodLiteral<"app">;
1623
+ entry_point: z.ZodString;
1624
+ },
1625
+ z.core.$strip
1626
+ >,
1627
+ ],
1628
+ "interface_type"
1629
+ >
1630
+ >
1631
+ >;
1632
+ title: z.ZodNullable<z.ZodString>;
1633
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1634
+ type: z.ZodLiteral<"studio">;
1635
+ manifest: z.ZodNullable<
1636
+ z.ZodObject<
1637
+ {
1638
+ version: z.ZodNumber;
1639
+ createdAt: z.ZodString;
1640
+ studioVersion: z.ZodOptional<z.ZodString>;
1641
+ group: z.ZodOptional<z.ZodString>;
1642
+ priority: z.ZodOptional<z.ZodNumber>;
1643
+ workspaces: z.ZodArray<
1644
+ z.ZodObject<
1645
+ {
1646
+ name: z.ZodString;
1647
+ title: z.ZodString;
1648
+ subtitle: z.ZodOptional<z.ZodString>;
1649
+ basePath: z.ZodString;
1650
+ projectId: z.core.$ZodBranded<
1651
+ z.ZodString,
1652
+ "ProjectId",
1653
+ "out"
1654
+ >;
1655
+ dataset: z.ZodOptional<z.ZodString>;
1656
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1657
+ schema: z.ZodString;
1658
+ tools: z.ZodOptional<z.ZodString>;
1659
+ },
1660
+ z.core.$strip
1661
+ >
1662
+ >;
1663
+ },
1664
+ z.core.$strip
1665
+ >
1666
+ >;
1667
+ manifestData: z.ZodNullable<
1668
+ z.ZodObject<
1669
+ {
1670
+ value: z.ZodObject<
1671
+ {
1672
+ version: z.ZodNumber;
1673
+ createdAt: z.ZodString;
1674
+ studioVersion: z.ZodOptional<z.ZodString>;
1675
+ group: z.ZodOptional<z.ZodString>;
1676
+ priority: z.ZodOptional<z.ZodNumber>;
1677
+ workspaces: z.ZodArray<
1678
+ z.ZodObject<
1679
+ {
1680
+ name: z.ZodString;
1681
+ title: z.ZodString;
1682
+ subtitle: z.ZodOptional<z.ZodString>;
1683
+ basePath: z.ZodString;
1684
+ projectId: z.core.$ZodBranded<
1685
+ z.ZodString,
1686
+ "ProjectId",
1687
+ "out"
1688
+ >;
1689
+ dataset: z.ZodOptional<z.ZodString>;
1690
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1691
+ schema: z.ZodString;
1692
+ tools: z.ZodOptional<z.ZodString>;
1693
+ },
1694
+ z.core.$strip
1695
+ >
1696
+ >;
1697
+ },
1698
+ z.core.$strip
1699
+ >;
1700
+ },
1701
+ z.core.$strip
1702
+ >
1703
+ >;
1704
+ autoUpdatingVersion: z.ZodNullable<z.ZodString>;
1705
+ config: z.ZodObject<
1706
+ {
1707
+ "live-manifest": z.ZodOptional<
1708
+ z.ZodObject<
1709
+ {
1710
+ createdAt: z.ZodString;
1711
+ updatedAt: z.ZodString;
1712
+ updatedBy: z.ZodString;
1713
+ value: z.ZodObject<
1714
+ {
1715
+ buildId: z.ZodOptional<z.ZodString>;
1716
+ bundleVersion: z.ZodOptional<z.ZodString>;
1717
+ version: z.ZodOptional<z.ZodString>;
1718
+ group: z.ZodOptional<z.ZodString>;
1719
+ priority: z.ZodOptional<z.ZodNumber>;
1720
+ workspaces: z.ZodOptional<
1721
+ z.ZodArray<
1722
+ z.ZodObject<
1723
+ {
1724
+ name: z.ZodString;
1725
+ title: z.ZodString;
1726
+ subtitle: z.ZodOptional<z.ZodString>;
1727
+ basePath: z.ZodString;
1728
+ projectId: z.core.$ZodBranded<
1729
+ z.ZodString,
1730
+ "ProjectId",
1731
+ "out"
1732
+ >;
1733
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1734
+ dataset: z.ZodString;
1735
+ schemaDescriptorId: z.ZodString;
1736
+ },
1737
+ z.core.$strip
1738
+ >
1739
+ >
1740
+ >;
1741
+ },
1742
+ z.core.$strip
1743
+ >;
1744
+ },
1745
+ z.core.$strip
1746
+ >
1747
+ >;
1748
+ },
1749
+ z.core.$strip
1750
+ >;
1751
+ urlType: z.ZodLiteral<"internal">;
1752
+ activeDeployment: z.ZodNullable<
1753
+ z.ZodObject<
1754
+ {
1755
+ id: z.ZodString;
1756
+ version: z.ZodString;
1757
+ isActiveDeployment: z.ZodBoolean;
1758
+ userApplicationId: z.ZodString;
1759
+ isAutoUpdating: z.ZodNullable<z.ZodBoolean>;
1760
+ size: z.ZodNullable<z.ZodNumber>;
1761
+ deployedAt: z.ZodString;
1762
+ deployedBy: z.ZodString;
1763
+ createdAt: z.ZodString;
1764
+ updatedAt: z.ZodString;
1765
+ manifest: z.ZodNullable<
1766
+ z.ZodObject<
1767
+ {
1768
+ buildId: z.ZodOptional<z.ZodString>;
1769
+ bundleVersion: z.ZodOptional<z.ZodString>;
1770
+ version: z.ZodOptional<z.ZodString>;
1771
+ group: z.ZodOptional<z.ZodString>;
1772
+ priority: z.ZodOptional<z.ZodNumber>;
1773
+ workspaces: z.ZodOptional<
1774
+ z.ZodArray<
1775
+ z.ZodObject<
1776
+ {
1777
+ name: z.ZodString;
1778
+ title: z.ZodString;
1779
+ subtitle: z.ZodOptional<z.ZodString>;
1780
+ basePath: z.ZodString;
1781
+ projectId: z.core.$ZodBranded<
1782
+ z.ZodString,
1783
+ "ProjectId",
1784
+ "out"
1785
+ >;
1786
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1787
+ dataset: z.ZodString;
1788
+ schemaDescriptorId: z.ZodString;
1789
+ },
1790
+ z.core.$strip
1791
+ >
1792
+ >
1793
+ >;
1794
+ },
1795
+ z.core.$strip
1796
+ >
1797
+ >;
1798
+ },
1799
+ z.core.$strip
1800
+ >
1801
+ >;
1802
+ },
1803
+ z.core.$strip
1804
+ >,
1805
+ z.ZodObject<
1806
+ {
1807
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
1808
+ appHost: z.ZodString;
1809
+ createdAt: z.ZodString;
1810
+ updatedAt: z.ZodString;
1811
+ dashboardStatus: z.ZodEnum<{
1812
+ default: "default";
1813
+ disabled: "disabled";
1814
+ }>;
1815
+ interfaces: z.ZodOptional<
1816
+ z.ZodArray<
1817
+ z.ZodDiscriminatedUnion<
1818
+ [
1819
+ z.ZodObject<
1820
+ {
1821
+ name: z.ZodString;
1822
+ interface_type: z.ZodLiteral<"panel">;
1823
+ entry_point: z.ZodString;
1824
+ },
1825
+ z.core.$strip
1826
+ >,
1827
+ z.ZodObject<
1828
+ {
1829
+ name: z.ZodString;
1830
+ interface_type: z.ZodLiteral<"worker">;
1831
+ entry_point: z.ZodString;
1832
+ },
1833
+ z.core.$strip
1834
+ >,
1835
+ z.ZodObject<
1836
+ {
1837
+ name: z.ZodString;
1838
+ interface_type: z.ZodLiteral<"app">;
1839
+ entry_point: z.ZodString;
1840
+ },
1841
+ z.core.$strip
1842
+ >,
1843
+ ],
1844
+ "interface_type"
1845
+ >
1846
+ >
1847
+ >;
1848
+ title: z.ZodNullable<z.ZodString>;
1849
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1850
+ type: z.ZodLiteral<"studio">;
1851
+ manifest: z.ZodNullable<
1852
+ z.ZodObject<
1853
+ {
1854
+ version: z.ZodNumber;
1855
+ createdAt: z.ZodString;
1856
+ studioVersion: z.ZodOptional<z.ZodString>;
1857
+ group: z.ZodOptional<z.ZodString>;
1858
+ priority: z.ZodOptional<z.ZodNumber>;
1859
+ workspaces: z.ZodArray<
1860
+ z.ZodObject<
1861
+ {
1862
+ name: z.ZodString;
1863
+ title: z.ZodString;
1864
+ subtitle: z.ZodOptional<z.ZodString>;
1865
+ basePath: z.ZodString;
1866
+ projectId: z.core.$ZodBranded<
1867
+ z.ZodString,
1868
+ "ProjectId",
1869
+ "out"
1870
+ >;
1871
+ dataset: z.ZodOptional<z.ZodString>;
1872
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1873
+ schema: z.ZodString;
1874
+ tools: z.ZodOptional<z.ZodString>;
1875
+ },
1876
+ z.core.$strip
1877
+ >
1878
+ >;
1879
+ },
1880
+ z.core.$strip
1881
+ >
1882
+ >;
1883
+ manifestData: z.ZodNullable<
1884
+ z.ZodObject<
1885
+ {
1886
+ value: z.ZodObject<
1887
+ {
1888
+ version: z.ZodNumber;
1889
+ createdAt: z.ZodString;
1890
+ studioVersion: z.ZodOptional<z.ZodString>;
1891
+ group: z.ZodOptional<z.ZodString>;
1892
+ priority: z.ZodOptional<z.ZodNumber>;
1893
+ workspaces: z.ZodArray<
1894
+ z.ZodObject<
1895
+ {
1896
+ name: z.ZodString;
1897
+ title: z.ZodString;
1898
+ subtitle: z.ZodOptional<z.ZodString>;
1899
+ basePath: z.ZodString;
1900
+ projectId: z.core.$ZodBranded<
1901
+ z.ZodString,
1902
+ "ProjectId",
1903
+ "out"
1904
+ >;
1905
+ dataset: z.ZodOptional<z.ZodString>;
1906
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1907
+ schema: z.ZodString;
1908
+ tools: z.ZodOptional<z.ZodString>;
1909
+ },
1910
+ z.core.$strip
1911
+ >
1912
+ >;
1913
+ },
1914
+ z.core.$strip
1915
+ >;
1916
+ },
1917
+ z.core.$strip
1918
+ >
1919
+ >;
1920
+ autoUpdatingVersion: z.ZodNullable<z.ZodString>;
1921
+ config: z.ZodObject<
1922
+ {
1923
+ "live-manifest": z.ZodOptional<
1924
+ z.ZodObject<
1925
+ {
1926
+ createdAt: z.ZodString;
1927
+ updatedAt: z.ZodString;
1928
+ updatedBy: z.ZodString;
1929
+ value: z.ZodObject<
1930
+ {
1931
+ buildId: z.ZodOptional<z.ZodString>;
1932
+ bundleVersion: z.ZodOptional<z.ZodString>;
1933
+ version: z.ZodOptional<z.ZodString>;
1934
+ group: z.ZodOptional<z.ZodString>;
1935
+ priority: z.ZodOptional<z.ZodNumber>;
1936
+ workspaces: z.ZodOptional<
1937
+ z.ZodArray<
1938
+ z.ZodObject<
1939
+ {
1940
+ name: z.ZodString;
1941
+ title: z.ZodString;
1942
+ subtitle: z.ZodOptional<z.ZodString>;
1943
+ basePath: z.ZodString;
1944
+ projectId: z.core.$ZodBranded<
1945
+ z.ZodString,
1946
+ "ProjectId",
1947
+ "out"
1948
+ >;
1949
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1950
+ dataset: z.ZodString;
1951
+ schemaDescriptorId: z.ZodString;
1952
+ },
1953
+ z.core.$strip
1954
+ >
1955
+ >
1956
+ >;
1957
+ },
1958
+ z.core.$strip
1959
+ >;
1960
+ },
1961
+ z.core.$strip
1962
+ >
1963
+ >;
1964
+ },
1965
+ z.core.$strip
1966
+ >;
1967
+ urlType: z.ZodLiteral<"external">;
1968
+ activeDeployment: z.ZodNullable<
1969
+ z.ZodObject<
1970
+ {
1971
+ id: z.ZodString;
1972
+ version: z.ZodString;
1973
+ isActiveDeployment: z.ZodBoolean;
1974
+ userApplicationId: z.ZodString;
1975
+ isAutoUpdating: z.ZodNullable<z.ZodBoolean>;
1976
+ size: z.ZodNullable<z.ZodNumber>;
1977
+ deployedAt: z.ZodString;
1978
+ deployedBy: z.ZodString;
1979
+ createdAt: z.ZodString;
1980
+ updatedAt: z.ZodString;
1981
+ manifest: z.ZodNullable<
1982
+ z.ZodObject<
1983
+ {
1984
+ buildId: z.ZodOptional<z.ZodString>;
1985
+ bundleVersion: z.ZodOptional<z.ZodString>;
1986
+ version: z.ZodOptional<z.ZodString>;
1987
+ group: z.ZodOptional<z.ZodString>;
1988
+ priority: z.ZodOptional<z.ZodNumber>;
1989
+ workspaces: z.ZodOptional<
1990
+ z.ZodArray<
1991
+ z.ZodObject<
1992
+ {
1993
+ name: z.ZodString;
1994
+ title: z.ZodString;
1995
+ subtitle: z.ZodOptional<z.ZodString>;
1996
+ basePath: z.ZodString;
1997
+ projectId: z.core.$ZodBranded<
1998
+ z.ZodString,
1999
+ "ProjectId",
2000
+ "out"
2001
+ >;
2002
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2003
+ dataset: z.ZodString;
2004
+ schemaDescriptorId: z.ZodString;
2005
+ },
2006
+ z.core.$strip
2007
+ >
2008
+ >
2009
+ >;
2010
+ },
2011
+ z.core.$strip
2012
+ >
2013
+ >;
2014
+ },
2015
+ z.core.$strip
2016
+ >
2017
+ >;
2018
+ },
2019
+ z.core.$strip
2020
+ >,
2021
+ ],
2022
+ "urlType"
2023
+ >;
2024
+
2025
+ /**
2026
+ * @public
2027
+ */
2028
+ export declare type StudioUserApplication = z.output<
2029
+ typeof StudioUserApplication
2030
+ >;
2031
+
2032
+ /**
2033
+ * @public
2034
+ */
2035
+ export declare class StudioWorkspace extends AbstractApplication<
2036
+ "workspace",
2037
+ StudioResource
2038
+ > {
2039
+ /**
2040
+ * Workspaces always belong to a studio application.
2041
+ * They do not exist on their own & therefore can access
2042
+ * information about the studio they're in via this property.
2043
+ */
2044
+ private readonly studioApplication;
2045
+ private readonly workspace;
2046
+ readonly project: Project<false, false>;
2047
+ private readonly isDefaultWorkspace;
2048
+ constructor(
2049
+ studioApplication: StudioApplication,
2050
+ workspace: Workspace,
2051
+ project: Project<false, false>,
2052
+ isDefaultWorkspace: boolean,
2053
+ );
2054
+ /**
2055
+ * The studio application that this workspace belongs to.
2056
+ */
2057
+ get studio(): StudioApplication;
2058
+ get id(): string;
2059
+ get href(): string;
2060
+ get title(): string;
2061
+ get subtitle(): string | undefined;
2062
+ get<TKey extends Exclude<keyof Workspace, "id" | "icon" | "title">>(
2063
+ attr: TKey,
2064
+ ): Workspace[TKey];
2065
+ get isFederated(): boolean;
2066
+ /**
2067
+ * With comlink, studio-applications were not considered applications at all, only workspaces. This is partially why
2068
+ * we create default workspaces when the application has no manifest or the manifest has no workspaces.
2069
+ *
2070
+ * Thereby, to create it we depend on a lot of information from the parent application even if it's duplicated across
2071
+ * different workspaces.
2072
+ */
2073
+ toProtocolResource(): StudioResource;
2074
+ /**
2075
+ * @returns the URL to the workspace of a studio application.
2076
+ */
2077
+ get url(): URL;
2078
+ static makeId(
2079
+ applicationId: UserApplicationId,
2080
+ workspaceName: string,
2081
+ ): string;
2082
+ static splitId(id: string): [string, string];
2083
+ }
2084
+
2085
+ /**
2086
+ * @public
2087
+ */
2088
+ export declare abstract class UserApplication<
2089
+ TUserApplication extends UserApplicationBase,
2090
+ TType extends Extract<AbstractApplicationType, "coreApp" | "studio">,
2091
+ TProtocolResource extends Resource = Extract<
2092
+ Resource,
2093
+ {
2094
+ type: TType;
2095
+ }
2096
+ >,
2097
+ > extends AbstractApplication<TType, TProtocolResource> {
2098
+ #private;
2099
+ readonly application: TUserApplication;
2100
+ readonly id: UserApplicationId;
2101
+ /**
2102
+ * For local applications (`isLocal === true`), the deployed application
2103
+ * that shares the same `id` — if one was passed at construction. `null`
2104
+ * for deployed applications or when no remote twin was provided.
2105
+ */
2106
+ readonly remoteApplication: this | null;
2107
+ constructor(
2108
+ application: TUserApplication,
2109
+ type: TType,
2110
+ options?: {
2111
+ isLocal?: boolean;
2112
+ remoteApplication?: UserApplication<
2113
+ TUserApplication,
2114
+ TType,
2115
+ TProtocolResource
2116
+ > | null;
2117
+ },
2118
+ );
2119
+ abstract get subtitle(): string | undefined;
2120
+ /**
2121
+ * Local dev servers are rendered as federated remotes; deployed applications
2122
+ * are rendered in an iframe.
2123
+ */
2124
+ get isFederated(): boolean;
2125
+ get isLocal(): boolean;
2126
+ get interfaces(): readonly LocalInterface[];
2127
+ /**
2128
+ * @returns A fully resolved URL instance for the application.
2129
+ * For internal applications, constructs a URL using the Sanity studio domain
2130
+ * pattern resolved from the environment at the consuming app's build time.
2131
+ * For external applications (including local dev servers), returns the
2132
+ * provided app host as a URL.
2133
+ */
2134
+ get url(): URL;
2135
+ /**
2136
+ * Unified manifest accessor for user applications. Resolves the most
2137
+ * authoritative manifest available for the application, preferring the
2138
+ * deployment manifest (`activeDeployment.manifest`) before falling back to
2139
+ * any client-side manifest. The returned shape depends on the application
2140
+ * type and source: studios may yield either a `ServerManifest` (deployment)
2141
+ * or a `ClientManifest` (fallback); core apps yield a
2142
+ * `CoreAppUserApplicationManifest`. Returns `null` when no manifest is
2143
+ * available.
2144
+ */
2145
+ abstract get manifest():
2146
+ | ClientManifest
2147
+ | ServerManifest
2148
+ | CoreAppUserApplicationManifest
2149
+ | null;
2150
+ }
2151
+
2152
+ /**
2153
+ * @public
2154
+ */
2155
+ export declare const UserApplicationBase: z.ZodObject<
2156
+ {
2157
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
2158
+ appHost: z.ZodString;
2159
+ urlType: z.ZodEnum<{
2160
+ internal: "internal";
2161
+ external: "external";
2162
+ }>;
2163
+ createdAt: z.ZodString;
2164
+ updatedAt: z.ZodString;
2165
+ dashboardStatus: z.ZodEnum<{
2166
+ default: "default";
2167
+ disabled: "disabled";
2168
+ }>;
2169
+ interfaces: z.ZodOptional<
2170
+ z.ZodArray<
2171
+ z.ZodDiscriminatedUnion<
2172
+ [
2173
+ z.ZodObject<
2174
+ {
2175
+ name: z.ZodString;
2176
+ interface_type: z.ZodLiteral<"panel">;
2177
+ entry_point: z.ZodString;
2178
+ },
2179
+ z.core.$strip
2180
+ >,
2181
+ z.ZodObject<
2182
+ {
2183
+ name: z.ZodString;
2184
+ interface_type: z.ZodLiteral<"worker">;
2185
+ entry_point: z.ZodString;
2186
+ },
2187
+ z.core.$strip
2188
+ >,
2189
+ z.ZodObject<
2190
+ {
2191
+ name: z.ZodString;
2192
+ interface_type: z.ZodLiteral<"app">;
2193
+ entry_point: z.ZodString;
2194
+ },
2195
+ z.core.$strip
2196
+ >,
2197
+ ],
2198
+ "interface_type"
2199
+ >
2200
+ >
2201
+ >;
2202
+ },
2203
+ z.core.$strip
2204
+ >;
2205
+
2206
+ /**
2207
+ * @public
2208
+ */
2209
+ export declare type UserApplicationBase = z.output<typeof UserApplicationBase>;
2210
+
2211
+ /**
2212
+ * User application ID schema, branded for type safety.
2213
+ * @public
2214
+ */
2215
+ export declare const UserApplicationId: z.core.$ZodBranded<
2216
+ z.ZodString,
2217
+ "UserApplicationId",
2218
+ "out"
2219
+ >;
2220
+
2221
+ /**
2222
+ * User application ID type, branded for type safety.
2223
+ * @public
2224
+ */
2225
+ export declare type UserApplicationId = z.output<typeof UserApplicationId>;
2226
+
2227
+ /**
2228
+ * @public
2229
+ */
2230
+ export declare type Workspace = z.output<typeof Workspace_2>;
2231
+
2232
+ declare const Workspace_2: z.ZodObject<
2233
+ {
2234
+ name: z.ZodString;
2235
+ title: z.ZodString;
2236
+ subtitle: z.ZodOptional<z.ZodString>;
2237
+ basePath: z.ZodString;
2238
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
2239
+ dataset: z.ZodOptional<z.ZodString>;
2240
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2241
+ },
2242
+ z.core.$strip
2243
+ >;
2244
+
2245
+ /**
2246
+ * @public
2247
+ */
2248
+ declare type Workspace = z.output<typeof Workspace_2>;
2249
+
2250
+ export {};