@sanity/workbench 0.0.1-alpha.0 → 0.1.0-alpha.10

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 (37) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_chunks-es/index.js +34 -0
  3. package/dist/_chunks-es/index.js.map +1 -0
  4. package/dist/_internal.d.ts +64 -0
  5. package/dist/_internal.js +54 -0
  6. package/dist/_internal.js.map +1 -0
  7. package/dist/core.d.ts +1617 -0
  8. package/dist/core.js +779 -0
  9. package/dist/core.js.map +1 -0
  10. package/package.json +34 -24
  11. package/src/_exports/_internal.ts +1 -0
  12. package/src/_exports/core.ts +1 -0
  13. package/src/_internal/env.ts +32 -0
  14. package/src/_internal/index.ts +4 -0
  15. package/src/_internal/render.ts +125 -0
  16. package/src/core/applications/application-list.ts +104 -0
  17. package/src/core/applications/application.ts +95 -0
  18. package/src/core/canvases.ts +91 -0
  19. package/src/core/config.ts +34 -0
  20. package/src/core/index.ts +12 -0
  21. package/src/core/log/index.ts +92 -0
  22. package/src/core/media-libraries.ts +92 -0
  23. package/src/core/organizations.ts +115 -0
  24. package/src/core/projects.ts +114 -0
  25. package/src/core/shared/urls.ts +129 -0
  26. package/src/core/user-applications/core-app.ts +131 -0
  27. package/src/core/user-applications/studios/index.ts +3 -0
  28. package/src/core/user-applications/studios/schemas.ts +111 -0
  29. package/src/core/user-applications/studios/studio.ts +504 -0
  30. package/src/core/user-applications/studios/workspace.ts +147 -0
  31. package/src/core/user-applications/user-application.ts +181 -0
  32. package/src/vite-env.d.ts +8 -0
  33. package/dist/index.cjs +0 -16
  34. package/dist/index.cjs.map +0 -1
  35. package/dist/index.js +0 -18
  36. package/dist/index.js.map +0 -1
  37. package/src/index.tsx +0 -35
package/dist/core.d.ts ADDED
@@ -0,0 +1,1617 @@
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
+ abstract get href(): string;
23
+ abstract get title(): string;
24
+ abstract get id(): string;
25
+ /**
26
+ * Whether the application is federated or not. This is used to determine
27
+ * if the application should be rendered in an iframe or not.
28
+ */
29
+ abstract get isFederated(): boolean;
30
+ /**
31
+ * Whether the application is served by a local CLI dev server rather than a
32
+ * deployed remote. Defaults to `false`; user applications flip this when
33
+ * constructed from a `LocalUserApplication` payload.
34
+ */
35
+ get isLocal(): boolean;
36
+ abstract get url(): URL;
37
+ get initials(): string;
38
+ /**
39
+ * Converts the resource to a protocol resource that comlink expects
40
+ * for backwards compatibility with the old API format.
41
+ */
42
+ abstract toProtocolResource(): TProtocolResource;
43
+ }
44
+
45
+ /**
46
+ * @public
47
+ */
48
+ export declare type AbstractApplicationType =
49
+ | "studio"
50
+ | "coreApp"
51
+ | "canvas"
52
+ | "media-library"
53
+ | "workspace";
54
+
55
+ /**
56
+ * @public
57
+ */
58
+ export declare const ActiveDeployment: z.ZodObject<
59
+ {
60
+ id: z.ZodString;
61
+ version: z.ZodString;
62
+ isActiveDeployment: z.ZodBoolean;
63
+ userApplicationId: z.ZodString;
64
+ isAutoUpdating: z.ZodBoolean;
65
+ size: z.ZodNumber;
66
+ deployedAt: z.ZodString;
67
+ deployedBy: z.ZodString;
68
+ createdAt: z.ZodString;
69
+ updatedAt: z.ZodString;
70
+ },
71
+ z.core.$strip
72
+ >;
73
+
74
+ /**
75
+ * @public
76
+ */
77
+ export declare type Application =
78
+ | CoreAppApplication
79
+ | StudioApplication
80
+ | StudioWorkspace
81
+ | CanvasApplication
82
+ | MediaLibraryApplication;
83
+
84
+ /**
85
+ * @public
86
+ */
87
+ export declare class ApplicationList<
88
+ TApplication extends Application = Application,
89
+ > {
90
+ readonly applications: TApplication[];
91
+ /**
92
+ * @param applications - The applications to initialize the list with.
93
+ */
94
+ constructor(applications: TApplication[]);
95
+ findApplicationsByType<T extends TApplication["type"]>(
96
+ type: T,
97
+ ): Extract<
98
+ TApplication,
99
+ {
100
+ type: T;
101
+ }
102
+ >[];
103
+ findApplicationsByType<T extends TApplication["type"][]>(
104
+ types: T,
105
+ ): Extract<
106
+ TApplication,
107
+ {
108
+ type: T[number];
109
+ }
110
+ >[];
111
+ findApplication(type: "media-library"):
112
+ | Extract<
113
+ TApplication,
114
+ {
115
+ type: "media-library";
116
+ }
117
+ >
118
+ | undefined;
119
+ findApplication(type: "canvas"):
120
+ | Extract<
121
+ TApplication,
122
+ {
123
+ type: "canvas";
124
+ }
125
+ >
126
+ | undefined;
127
+ findApplication(
128
+ type: "coreApp",
129
+ id: UserApplicationId,
130
+ ):
131
+ | Extract<
132
+ TApplication,
133
+ {
134
+ type: "coreApp";
135
+ }
136
+ >
137
+ | undefined;
138
+ findApplication(
139
+ type: "studio",
140
+ id: UserApplicationId,
141
+ ):
142
+ | Extract<
143
+ TApplication,
144
+ {
145
+ type: "studio";
146
+ }
147
+ >
148
+ | undefined;
149
+ findApplication(
150
+ type: "workspace",
151
+ id: string,
152
+ ):
153
+ | Extract<
154
+ TApplication,
155
+ {
156
+ type: "workspace";
157
+ }
158
+ >
159
+ | undefined;
160
+ toProtocolResources(): Resource[];
161
+ static areApplicationsEqual(
162
+ application1?: Application,
163
+ application2?: Application,
164
+ ): boolean;
165
+ }
166
+
167
+ /**
168
+ * Validates and brands a string as a CanvasId.
169
+ * @public
170
+ */
171
+ export declare function brandCanvasId(id: string): CanvasId;
172
+
173
+ /**
174
+ * Validates and brands a string as a MediaLibraryId.
175
+ * @public
176
+ */
177
+ export declare function brandMediaLibraryId(id: string): MediaLibraryId;
178
+
179
+ /**
180
+ * Validates and brands a string as an OrganizationId.
181
+ * @public
182
+ */
183
+ export declare function brandOrganizationId(id: string): OrganizationId;
184
+
185
+ /**
186
+ * Validates and brands a string as a ProjectId.
187
+ * @public
188
+ */
189
+ export declare function brandProjectId(id: string): ProjectId;
190
+
191
+ /**
192
+ * Validates and brands a string as a UserApplicationId.
193
+ * @public
194
+ */
195
+ export declare function brandUserApplicationId(id: string): UserApplicationId;
196
+
197
+ /**
198
+ * Represents a Canvas resource as returned from the API.
199
+ * @public
200
+ */
201
+ export declare type Canvas = z.output<typeof Canvas_2>;
202
+
203
+ declare const Canvas_2: z.ZodObject<
204
+ {
205
+ id: z.core.$ZodBranded<z.ZodString, "CanvasId", "out">;
206
+ organizationId: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
207
+ status: z.ZodEnum<{
208
+ active: "active";
209
+ provisioning: "provisioning";
210
+ }>;
211
+ },
212
+ z.core.$strip
213
+ >;
214
+
215
+ /**
216
+ * Represents a Canvas resource as returned from the API.
217
+ * @public
218
+ */
219
+ declare type Canvas = z.output<typeof Canvas_2>;
220
+
221
+ /**
222
+ * Whilst the constructor takes an organization's canvas resource the existance
223
+ * therefore implies the organization has access to the canvas application which
224
+ * is what workbench most importantly wants to know.
225
+ * @public
226
+ */
227
+ export declare class CanvasApplication extends AbstractApplication<"canvas"> {
228
+ readonly canvas: Canvas;
229
+ constructor(canvas: Canvas);
230
+ get id(): CanvasId;
231
+ get href(): string;
232
+ get title(): string;
233
+ get url(): URL;
234
+ get isFederated(): boolean;
235
+ toProtocolResource(): CanvasResource;
236
+ }
237
+
238
+ /**
239
+ * Canvas ID type, branded for type safety.
240
+ * @public
241
+ */
242
+ export declare type CanvasId = z.output<typeof CanvasId_2>;
243
+
244
+ /**
245
+ * Canvas ID schema, branded for type safety.
246
+ * @public
247
+ */
248
+ declare const CanvasId_2: z.core.$ZodBranded<z.ZodString, "CanvasId", "out">;
249
+
250
+ /**
251
+ * Canvas ID type, branded for type safety.
252
+ * @public
253
+ */
254
+ declare type CanvasId = z.output<typeof CanvasId_2>;
255
+
256
+ /**
257
+ * @public
258
+ */
259
+ export declare const ClientManifest: z.ZodObject<
260
+ {
261
+ version: z.ZodNumber;
262
+ createdAt: z.ZodString;
263
+ studioVersion: z.ZodOptional<z.ZodString>;
264
+ workspaces: z.ZodArray<
265
+ z.ZodObject<
266
+ {
267
+ name: z.ZodString;
268
+ title: z.ZodString;
269
+ subtitle: z.ZodOptional<z.ZodString>;
270
+ basePath: z.ZodString;
271
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
272
+ dataset: z.ZodOptional<z.ZodString>;
273
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
274
+ schema: z.ZodString;
275
+ tools: z.ZodOptional<z.ZodString>;
276
+ },
277
+ z.core.$strip
278
+ >
279
+ >;
280
+ },
281
+ z.core.$strip
282
+ >;
283
+
284
+ /**
285
+ * @public
286
+ */
287
+ export declare type ClientManifest = z.output<typeof ClientManifest>;
288
+
289
+ declare type CompatibilityStatus =
290
+ (typeof StudioApplication.CompatibilityStatuses)[keyof typeof StudioApplication.CompatibilityStatuses];
291
+
292
+ /**
293
+ * Workbench configuration.
294
+ *
295
+ * @public
296
+ */
297
+ export declare interface Config {
298
+ /**
299
+ * The organization ID to use when rendering the workbench.
300
+ */
301
+ organizationId?: string;
302
+ }
303
+
304
+ /**
305
+ * @public
306
+ */
307
+ export declare class CoreAppApplication extends UserApplication<
308
+ CoreAppUserApplication,
309
+ "coreApp",
310
+ ApplicationResource
311
+ > {
312
+ readonly activeDeployment: CoreAppUserApplication["activeDeployment"];
313
+ constructor(
314
+ application: CoreAppUserApplication,
315
+ options?: {
316
+ isLocal?: boolean;
317
+ remoteApplication?: CoreAppApplication | null;
318
+ },
319
+ );
320
+ get href(): string;
321
+ get title(): string;
322
+ get subtitle(): undefined;
323
+ get updatedAt(): string;
324
+ get<TKey extends keyof CoreAppUserApplication>(
325
+ attr: TKey,
326
+ ): CoreAppUserApplication[TKey];
327
+ toProtocolResource(): ApplicationResource;
328
+ }
329
+
330
+ /**
331
+ * @public
332
+ */
333
+ export declare type CoreAppUserApplication = z.output<
334
+ typeof CoreAppUserApplication_2
335
+ >;
336
+
337
+ /**
338
+ * Core application schema — validates and brands API
339
+ * responses from the `/user-applications?appType=coreApp`
340
+ * endpoint. Uses a discriminated union on `urlType`.
341
+ * @public
342
+ */
343
+ declare const CoreAppUserApplication_2: z.ZodDiscriminatedUnion<
344
+ [
345
+ z.ZodObject<
346
+ {
347
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
348
+ appHost: z.ZodString;
349
+ createdAt: z.ZodString;
350
+ updatedAt: z.ZodString;
351
+ dashboardStatus: z.ZodEnum<{
352
+ default: "default";
353
+ disabled: "disabled";
354
+ }>;
355
+ title: z.ZodString;
356
+ organizationId: z.core.$ZodBranded<
357
+ z.ZodString,
358
+ "OrganizationId",
359
+ "out"
360
+ >;
361
+ type: z.ZodLiteral<"coreApp">;
362
+ manifest: z.ZodOptional<
363
+ z.ZodNullable<
364
+ z.ZodObject<
365
+ {
366
+ version: z.ZodString;
367
+ icon: z.ZodOptional<z.ZodString>;
368
+ title: z.ZodOptional<z.ZodString>;
369
+ },
370
+ z.core.$strip
371
+ >
372
+ >
373
+ >;
374
+ urlType: z.ZodLiteral<"internal">;
375
+ activeDeployment: z.ZodObject<
376
+ {
377
+ id: z.ZodString;
378
+ version: z.ZodString;
379
+ isActiveDeployment: z.ZodBoolean;
380
+ userApplicationId: z.ZodString;
381
+ isAutoUpdating: z.ZodBoolean;
382
+ size: z.ZodNumber;
383
+ deployedAt: z.ZodString;
384
+ deployedBy: z.ZodString;
385
+ createdAt: z.ZodString;
386
+ updatedAt: z.ZodString;
387
+ manifest: z.ZodOptional<
388
+ z.ZodNullable<
389
+ z.ZodObject<
390
+ {
391
+ version: z.ZodString;
392
+ icon: z.ZodOptional<z.ZodString>;
393
+ title: z.ZodOptional<z.ZodString>;
394
+ },
395
+ z.core.$strip
396
+ >
397
+ >
398
+ >;
399
+ },
400
+ z.core.$strip
401
+ >;
402
+ },
403
+ z.core.$strip
404
+ >,
405
+ z.ZodObject<
406
+ {
407
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
408
+ appHost: z.ZodString;
409
+ createdAt: z.ZodString;
410
+ updatedAt: z.ZodString;
411
+ dashboardStatus: z.ZodEnum<{
412
+ default: "default";
413
+ disabled: "disabled";
414
+ }>;
415
+ title: z.ZodString;
416
+ organizationId: z.core.$ZodBranded<
417
+ z.ZodString,
418
+ "OrganizationId",
419
+ "out"
420
+ >;
421
+ type: z.ZodLiteral<"coreApp">;
422
+ manifest: z.ZodOptional<
423
+ z.ZodNullable<
424
+ z.ZodObject<
425
+ {
426
+ version: z.ZodString;
427
+ icon: z.ZodOptional<z.ZodString>;
428
+ title: z.ZodOptional<z.ZodString>;
429
+ },
430
+ z.core.$strip
431
+ >
432
+ >
433
+ >;
434
+ urlType: z.ZodLiteral<"external">;
435
+ activeDeployment: z.ZodNull;
436
+ },
437
+ z.core.$strip
438
+ >,
439
+ ],
440
+ "urlType"
441
+ >;
442
+
443
+ /**
444
+ * @public
445
+ */
446
+ declare type CoreAppUserApplication = z.output<typeof CoreAppUserApplication_2>;
447
+
448
+ /**
449
+ * @public
450
+ */
451
+ export declare const CoreAppUserApplicationManifest: z.ZodObject<
452
+ {
453
+ version: z.ZodString;
454
+ icon: z.ZodOptional<z.ZodString>;
455
+ title: z.ZodOptional<z.ZodString>;
456
+ },
457
+ z.core.$strip
458
+ >;
459
+
460
+ /**
461
+ * @public
462
+ */
463
+ export declare type CoreAppUserApplicationManifest = z.output<
464
+ typeof CoreAppUserApplicationManifest
465
+ >;
466
+
467
+ /**
468
+ * @public
469
+ */
470
+ export declare function createLogger({
471
+ namespace,
472
+ context: baseContext,
473
+ logLevel,
474
+ }?: LoggerOptions): Logger;
475
+
476
+ /**
477
+ * Joins multiple path segments into a single path string.
478
+ * Handles null, undefined, and URL objects gracefully.
479
+ *
480
+ * @public
481
+ * @param paths - An array of path segments to join.
482
+ * @returns A single joined path string.
483
+ */
484
+ export declare const joinUrlPaths: (
485
+ ...paths: Array<string | URL | null | undefined>
486
+ ) => string;
487
+
488
+ /**
489
+ * Raw data for a local application discovered by the CLI dev server.
490
+ *
491
+ * The CLI forwards the full studio or app manifest so the workbench can
492
+ * derive icons, titles, workspaces and schema references the same way it
493
+ * does for deployed applications. The manifest shape is discriminated on
494
+ * `type`: studios receive a `ClientManifest`, core apps a `CoreAppUserApplicationManifest`.
495
+ *
496
+ * When set on a `UserApplication`, `isLocal` is `true` and `url`/`isFederated`
497
+ * honour the local dev-server instead of the deployed application's host.
498
+ *
499
+ * @public
500
+ */
501
+ export declare const LocalUserApplication: z.ZodDiscriminatedUnion<
502
+ [
503
+ z.ZodObject<
504
+ {
505
+ host: z.ZodString;
506
+ port: z.ZodNumber;
507
+ id: z.ZodOptional<z.ZodString>;
508
+ type: z.ZodLiteral<"studio">;
509
+ manifest: z.ZodOptional<
510
+ z.ZodCustom<
511
+ {
512
+ version: number;
513
+ createdAt: string;
514
+ workspaces: {
515
+ name: string;
516
+ title: string;
517
+ basePath: string;
518
+ projectId: string & z.core.$brand<"ProjectId">;
519
+ schema: string;
520
+ subtitle?: string | undefined;
521
+ dataset?: string | undefined;
522
+ icon?: string | null | undefined;
523
+ tools?: string | undefined;
524
+ }[];
525
+ studioVersion?: string | undefined;
526
+ },
527
+ {
528
+ version: number;
529
+ createdAt: string;
530
+ workspaces: {
531
+ name: string;
532
+ title: string;
533
+ basePath: string;
534
+ projectId: string & z.core.$brand<"ProjectId">;
535
+ schema: string;
536
+ subtitle?: string | undefined;
537
+ dataset?: string | undefined;
538
+ icon?: string | null | undefined;
539
+ tools?: string | undefined;
540
+ }[];
541
+ studioVersion?: string | undefined;
542
+ }
543
+ >
544
+ >;
545
+ },
546
+ z.core.$strip
547
+ >,
548
+ z.ZodObject<
549
+ {
550
+ host: z.ZodString;
551
+ port: z.ZodNumber;
552
+ id: z.ZodOptional<z.ZodString>;
553
+ type: z.ZodLiteral<"coreApp">;
554
+ manifest: z.ZodOptional<
555
+ z.ZodCustom<
556
+ {
557
+ version: string;
558
+ icon?: string | undefined;
559
+ title?: string | undefined;
560
+ },
561
+ {
562
+ version: string;
563
+ icon?: string | undefined;
564
+ title?: string | undefined;
565
+ }
566
+ >
567
+ >;
568
+ },
569
+ z.core.$strip
570
+ >,
571
+ ],
572
+ "type"
573
+ >;
574
+
575
+ /**
576
+ * @public
577
+ */
578
+ export declare type LocalUserApplication = z.output<
579
+ typeof LocalUserApplication
580
+ >;
581
+
582
+ declare type LogContext = {
583
+ [key: string]: unknown;
584
+ };
585
+
586
+ /**
587
+ * @public
588
+ */
589
+ export declare interface Logger {
590
+ error: (message: string, context?: LogContext) => void;
591
+ warn: (message: string, context?: LogContext) => void;
592
+ info: (message: string, context?: LogContext) => void;
593
+ debug: (message: string, context?: LogContext) => void;
594
+ }
595
+
596
+ /**
597
+ * Shared workbench logger instance. Use this from both the workbench host
598
+ * and its remotes so lifecycle and diagnostic logs appear under a single
599
+ * namespace.
600
+ *
601
+ * @public
602
+ */
603
+ export declare const logger: Logger;
604
+
605
+ declare interface LoggerOptions {
606
+ namespace?: LogNamespace;
607
+ context?: LogContext;
608
+ logLevel?: LogLevel;
609
+ }
610
+
611
+ /**
612
+ * Log levels in order of verbosity (least to most)
613
+ * - none: Silent
614
+ * - error: Critical failures that prevent operation
615
+ * - warn: Issues that may cause problems but don't stop execution
616
+ * - info: High-level informational messages (default)
617
+ * - debug: Detailed debugging information (maintainer level)
618
+ * - trace: Very detailed tracing — sets `internal: true` on context
619
+ * @public
620
+ */
621
+ export declare type LogLevel = "none" | "error" | "warn" | "info" | "debug";
622
+
623
+ /**
624
+ * Namespaces organize logs by functional domain.
625
+ * @internal
626
+ */
627
+ export declare type LogNamespace = string;
628
+
629
+ /**
630
+ * Represents a MediaLibrary resource as returned from the API.
631
+ * @public
632
+ */
633
+ export declare type MediaLibrary = z.output<typeof MediaLibrary_2>;
634
+
635
+ declare const MediaLibrary_2: z.ZodObject<
636
+ {
637
+ id: z.core.$ZodBranded<z.ZodString, "MediaLibraryId", "out">;
638
+ organizationId: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
639
+ status: z.ZodEnum<{
640
+ active: "active";
641
+ provisioning: "provisioning";
642
+ }>;
643
+ aclMode: z.ZodEnum<{
644
+ private: "private";
645
+ public: "public";
646
+ }>;
647
+ },
648
+ z.core.$strip
649
+ >;
650
+
651
+ /**
652
+ * Represents a MediaLibrary resource as returned from the API.
653
+ * @public
654
+ */
655
+ declare type MediaLibrary = z.output<typeof MediaLibrary_2>;
656
+
657
+ /**
658
+ * Whilst the constructor takes an organization's media library resource the existance
659
+ * therefore implies the organization has access to the media library application which
660
+ * is what workbench most importantly wants to know.
661
+ * @public
662
+ */
663
+ export declare class MediaLibraryApplication extends AbstractApplication<"media-library"> {
664
+ readonly library: MediaLibrary;
665
+ constructor(library: MediaLibrary);
666
+ get id(): string;
667
+ get href(): string;
668
+ get title(): string;
669
+ get isFederated(): boolean;
670
+ get url(): URL;
671
+ toProtocolResource(): MediaResource;
672
+ }
673
+
674
+ /**
675
+ * MediaLibrary ID type, branded for type safety.
676
+ * @public
677
+ */
678
+ export declare type MediaLibraryId = z.output<typeof MediaLibraryId_2>;
679
+
680
+ /**
681
+ * Canvas ID schema, branded for type safety.
682
+ * @public
683
+ */
684
+ declare const MediaLibraryId_2: z.core.$ZodBranded<
685
+ z.ZodString,
686
+ "MediaLibraryId",
687
+ "out"
688
+ >;
689
+
690
+ /**
691
+ * MediaLibrary ID type, branded for type safety.
692
+ * @public
693
+ */
694
+ declare type MediaLibraryId = z.output<typeof MediaLibraryId_2>;
695
+
696
+ /**
697
+ * Organization schema — validates and brands API responses
698
+ * from the `/organizations/:id` endpoint.
699
+ * @public
700
+ */
701
+ export declare const Organization: z.ZodObject<
702
+ {
703
+ id: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
704
+ name: z.ZodString;
705
+ slug: z.ZodNullable<z.ZodString>;
706
+ createdAt: z.ZodString;
707
+ updatedAt: z.ZodString;
708
+ dashboardStatus: z.ZodEnum<{
709
+ enabled: "enabled";
710
+ disabled: "disabled";
711
+ }>;
712
+ aiFeaturesStatus: z.ZodEnum<{
713
+ enabled: "enabled";
714
+ disabled: "disabled";
715
+ }>;
716
+ defaultRoleName: z.ZodString;
717
+ },
718
+ z.core.$strip
719
+ >;
720
+
721
+ /**
722
+ * Represents an organization with optional members and
723
+ * features arrays depending on the generic parameters.
724
+ * - `Organization` — base fields only (default)
725
+ * - `Organization<true>` — includes `members`
726
+ * - `Organization<true, true>` — includes both
727
+ * @public
728
+ */
729
+ export declare type Organization<
730
+ IncludeMembers extends boolean = true,
731
+ IncludeFeatures extends boolean = true,
732
+ > = z.output<typeof Organization> &
733
+ (IncludeMembers extends true
734
+ ? {
735
+ members: OrganizationMember[];
736
+ }
737
+ : unknown) &
738
+ (IncludeFeatures extends true
739
+ ? {
740
+ features: string[];
741
+ }
742
+ : unknown);
743
+
744
+ /**
745
+ * Organization ID schema, branded for type safety.
746
+ * @public
747
+ */
748
+ export declare const OrganizationId: z.core.$ZodBranded<
749
+ z.ZodString,
750
+ "OrganizationId",
751
+ "out"
752
+ >;
753
+
754
+ /**
755
+ * Organization ID type, branded for type safety.
756
+ * @public
757
+ */
758
+ export declare type OrganizationId = z.output<typeof OrganizationId>;
759
+
760
+ /**
761
+ * @public
762
+ */
763
+ export declare type OrganizationMember = z.output<typeof OrganizationMember_2>;
764
+
765
+ declare const OrganizationMember_2: z.ZodObject<
766
+ {
767
+ sanityUserId: z.ZodString;
768
+ isCurrentUser: z.ZodBoolean;
769
+ user: z.ZodObject<
770
+ {
771
+ id: z.ZodString;
772
+ displayName: z.ZodString;
773
+ familyName: z.ZodString;
774
+ givenName: z.ZodString;
775
+ middleName: z.ZodNullable<z.ZodString>;
776
+ imageUrl: z.ZodNullable<z.ZodString>;
777
+ email: z.ZodString;
778
+ loginProvider: z.ZodString;
779
+ },
780
+ z.core.$strip
781
+ >;
782
+ roles: z.ZodArray<
783
+ z.ZodObject<
784
+ {
785
+ name: z.ZodString;
786
+ title: z.ZodString;
787
+ description: z.ZodOptional<z.ZodString>;
788
+ },
789
+ z.core.$strip
790
+ >
791
+ >;
792
+ },
793
+ z.core.$strip
794
+ >;
795
+
796
+ /**
797
+ * @public
798
+ */
799
+ declare type OrganizationMember = z.output<typeof OrganizationMember_2>;
800
+
801
+ /**
802
+ * Validates and parses a raw API response into a branded
803
+ * Canvas.
804
+ * @public
805
+ */
806
+ export declare function parseCanvas(data: unknown): Canvas;
807
+
808
+ /**
809
+ * Validates and parses a raw API response into a branded
810
+ * CoreAppUserApplicationData.
811
+ * @public
812
+ */
813
+ export declare function parseCoreApplication(
814
+ data: unknown,
815
+ ): CoreAppUserApplication;
816
+
817
+ /**
818
+ * Validates and parses a raw API response into a branded
819
+ * MediaLibrary.
820
+ * @public
821
+ */
822
+ export declare function parseMediaLibrary(data: unknown): MediaLibrary;
823
+
824
+ /**
825
+ * Validates and parses a raw API response into a branded
826
+ * Organization. The options control which schema is used —
827
+ * matching what the API returns based on query params.
828
+ * @public
829
+ */
830
+ export declare function parseOrganization<
831
+ IncludeMembers extends boolean = true,
832
+ IncludeFeatures extends boolean = true,
833
+ >(
834
+ data: unknown,
835
+ options?: {
836
+ includeMembers?: IncludeMembers;
837
+ includeFeatures?: IncludeFeatures;
838
+ },
839
+ ): Organization<IncludeMembers, IncludeFeatures>;
840
+
841
+ /**
842
+ * Validates and parses a raw API response into a branded
843
+ * Project. The options control which schema is used —
844
+ * matching what the API returns based on query params.
845
+ * @public
846
+ */
847
+ export declare function parseProject<
848
+ IncludeMembers extends boolean = true,
849
+ IncludeFeatures extends boolean = true,
850
+ >(
851
+ data: unknown,
852
+ options?: {
853
+ includeMembers?: IncludeMembers;
854
+ includeFeatures?: IncludeFeatures;
855
+ },
856
+ ): Project<IncludeMembers, IncludeFeatures>;
857
+
858
+ /**
859
+ * Validates and parses a raw API response into a branded
860
+ * StudioUserApplication.
861
+ * @public
862
+ */
863
+ export declare function parseStudioUserApplication(
864
+ data: unknown,
865
+ ): StudioUserApplication;
866
+
867
+ /**
868
+ * Project schema — validates and brands API responses
869
+ * from the `/projects/:id` endpoint.
870
+ * @public
871
+ */
872
+ export declare const Project: z.ZodObject<
873
+ {
874
+ id: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
875
+ displayName: z.ZodString;
876
+ studioHost: z.ZodNullable<z.ZodString>;
877
+ organizationId: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
878
+ metadata: z.ZodObject<
879
+ {
880
+ color: z.ZodOptional<z.ZodString>;
881
+ externalStudioHost: z.ZodOptional<z.ZodString>;
882
+ initialTemplate: z.ZodOptional<z.ZodString>;
883
+ cliInitializedAt: z.ZodOptional<z.ZodString>;
884
+ integration: z.ZodLiteral<"manage" | "cli">;
885
+ },
886
+ z.core.$strip
887
+ >;
888
+ isBlocked: z.ZodBoolean;
889
+ isDisabled: z.ZodBoolean;
890
+ isDisabledByUser: z.ZodBoolean;
891
+ activityFeedEnabled: z.ZodBoolean;
892
+ createdAt: z.ZodString;
893
+ updatedAt: z.ZodString;
894
+ },
895
+ z.core.$strip
896
+ >;
897
+
898
+ /**
899
+ * Represents a Sanity project with optional members and
900
+ * features arrays depending on the generic parameters.
901
+ * By default, neither members nor features are included.
902
+ * - `Project` — base fields only (default)
903
+ * - `Project<true>` — includes `members`
904
+ * - `Project<true, true>` — includes both
905
+ * @public
906
+ */
907
+ export declare type Project<
908
+ IncludeMembers extends boolean = true,
909
+ IncludeFeatures extends boolean = true,
910
+ > = z.output<typeof Project> &
911
+ (IncludeMembers extends true
912
+ ? {
913
+ members: ProjectMember[];
914
+ }
915
+ : unknown) &
916
+ (IncludeFeatures extends true
917
+ ? {
918
+ features: string[];
919
+ }
920
+ : unknown);
921
+
922
+ /**
923
+ * Project ID schema, branded for type safety.
924
+ * @public
925
+ */
926
+ export declare const ProjectId: z.core.$ZodBranded<
927
+ z.ZodString,
928
+ "ProjectId",
929
+ "out"
930
+ >;
931
+
932
+ /**
933
+ * Project ID type, branded for type safety.
934
+ * @public
935
+ */
936
+ export declare type ProjectId = z.output<typeof ProjectId>;
937
+
938
+ /**
939
+ * @public
940
+ */
941
+ export declare type ProjectMember = z.output<typeof ProjectMember_2>;
942
+
943
+ declare const ProjectMember_2: z.ZodObject<
944
+ {
945
+ id: z.ZodString;
946
+ createdAt: z.ZodString;
947
+ updatedAt: z.ZodString;
948
+ isCurrentUser: z.ZodBoolean;
949
+ isRobot: z.ZodBoolean;
950
+ roles: z.ZodArray<
951
+ z.ZodObject<
952
+ {
953
+ name: z.ZodString;
954
+ title: z.ZodString;
955
+ description: z.ZodString;
956
+ },
957
+ z.core.$strip
958
+ >
959
+ >;
960
+ },
961
+ z.core.$strip
962
+ >;
963
+
964
+ /**
965
+ * @public
966
+ */
967
+ declare type ProjectMember = z.output<typeof ProjectMember_2>;
968
+
969
+ /**
970
+ * Options for rendering a remote module, such as a user application.
971
+ *
972
+ * @public
973
+ */
974
+ export declare interface RemoteModuleRenderOptions {
975
+ reactStrictMode?: boolean;
976
+ }
977
+
978
+ /**
979
+ * The resolved configuration after processing
980
+ * and validating the provided config.
981
+ *
982
+ * @public
983
+ */
984
+ export declare type ResolvedConfig = Omit<Config, "organizationId"> & {
985
+ organizationId: OrganizationId;
986
+ };
987
+
988
+ /**
989
+ * @public
990
+ */
991
+ export declare class StudioApplication extends UserApplication<
992
+ StudioUserApplication,
993
+ "studio",
994
+ never
995
+ > {
996
+ /**
997
+ * Returns a list of studio workspaces based on the application manifest.
998
+ * If there is no manifest, or alternatively it is not valid, then we create a default workspace.
999
+ */
1000
+ readonly workspaces: readonly StudioWorkspace[];
1001
+ readonly project: Project<false, false>;
1002
+ /**
1003
+ * The projects actually referenced by this studio — the application's own
1004
+ * project plus any project used by a workspace. Preserved so the instance
1005
+ * can be re-constructed (e.g. by dock wrappers) without having to thread
1006
+ * the full organization project list through again.
1007
+ */
1008
+ readonly projects: Project<false, false>[];
1009
+ /**
1010
+ * @param application - The studio application to create a list of workspaces for
1011
+ * @param projects - The projects available in the organization. It's not enough to just pass
1012
+ * the project that associates with the application because that is the project the app is deployed in relation to.
1013
+ * The workspaces may have different projects completely.
1014
+ */
1015
+ constructor(
1016
+ application: StudioUserApplication,
1017
+ projects: Project<false, false>[],
1018
+ options?: {
1019
+ isLocal?: boolean;
1020
+ remoteApplication?: StudioApplication | null;
1021
+ },
1022
+ );
1023
+ get href(): string;
1024
+ get title(): string;
1025
+ get subtitle(): string;
1026
+ get<TKey extends keyof StudioUserApplication>(
1027
+ attr: TKey,
1028
+ ): StudioUserApplication[TKey];
1029
+ get hasManifest(): boolean;
1030
+ get hasSchema(): boolean;
1031
+ private resolveVersion;
1032
+ get version(): string | null;
1033
+ get compatibilityStatus(): CompatibilityStatus;
1034
+ /**
1035
+ * Used to calculate the compatibility status of a given studio application.
1036
+ * Optionally if you've resolved the version elsewhere provide that value to
1037
+ * get the new compatibility status without mutating the application.
1038
+ */
1039
+ static resolveCompatibilityStatus(
1040
+ application: StudioApplication,
1041
+ version?: string | null,
1042
+ ): CompatibilityStatus;
1043
+ get isAutoRedirecting(): boolean;
1044
+ /**
1045
+ * Mirrors the `isRedirectable` function from Saison defined in
1046
+ * https://github.com/sanity-io/saison/blob/83556405d23e07f6d3a71c76249c67e33fe1101f/src/utils/applications.ts
1047
+ *
1048
+ * Returns whether a studio application is auto-redirecting, meaning it can only be accessed in the context of
1049
+ * Dashboard.
1050
+ */
1051
+ static resolveIsAutoRedirecting(
1052
+ application: StudioApplication,
1053
+ versionArg?: string | null,
1054
+ ): boolean;
1055
+ /**
1056
+ * Returns a list of issues that prevent the studio from functioning properly in the Dashboard.
1057
+ * This static value depends on the version of the studio that comes from the `activeDeployment` property.
1058
+ * As such, if the studio is auto-updating, this list will be incorrect & instead you should use
1059
+ * the static method `resolveIssues` to get the correct issues by passing the resolved version.
1060
+ */
1061
+ get issues(): StudioIssues;
1062
+ static resolveIssues(
1063
+ application: StudioApplication,
1064
+ version?: string | null,
1065
+ ): StudioIssues;
1066
+ protected isFeatureSupported(
1067
+ feature: StudioDashboardIssue,
1068
+ version?: string | null,
1069
+ ): boolean;
1070
+ toProtocolResource(): never;
1071
+ static CompatibilityStatuses: {
1072
+ readonly UNKNOWN: "unknown";
1073
+ readonly PARTIALLY_COMPATIBLE: "partially-compatible";
1074
+ readonly FULLY_COMPATIBLE: "fully-compatible";
1075
+ };
1076
+ static StudioIssues: {
1077
+ readonly ISSUE_ACTIVITY: "ACTIVITY";
1078
+ readonly ISSUE_AGENT: "AGENT";
1079
+ readonly ISSUE_FAVORITES: "FAVORITES";
1080
+ readonly ISSUE_URL_SYNCING: "URL_SYNCING";
1081
+ readonly ISSUE_UI_ADJUSTMENT: "UI_ADJUSTMENT";
1082
+ readonly ISSUE_CONTENT_MAPPING: "CONTENT_MAPPING";
1083
+ readonly ISSUE_LOGIN: "LOGIN";
1084
+ readonly ISSUE_MANIFEST: "MANIFEST";
1085
+ };
1086
+ static Features: (
1087
+ | {
1088
+ id: "AGENT";
1089
+ version: string;
1090
+ }
1091
+ | {
1092
+ id: "FAVORITES";
1093
+ version: string;
1094
+ }
1095
+ | {
1096
+ id: "ACTIVITY";
1097
+ version: string;
1098
+ }
1099
+ | {
1100
+ id: "URL_SYNCING";
1101
+ version: string;
1102
+ }
1103
+ | {
1104
+ id: "UI_ADJUSTMENT";
1105
+ version: string;
1106
+ }
1107
+ | {
1108
+ id: "CONTENT_MAPPING";
1109
+ version: string;
1110
+ }
1111
+ | {
1112
+ id: "LOGIN";
1113
+ version: string;
1114
+ }
1115
+ )[];
1116
+ static MinimumStudioVersion: "2.28.0";
1117
+ static MinimumStudioVersionWithNoIssues: string | undefined;
1118
+ }
1119
+
1120
+ declare type StudioDashboardIssue =
1121
+ (typeof StudioApplication.StudioIssues)[keyof typeof StudioApplication.StudioIssues];
1122
+
1123
+ declare type StudioIssues = Array<{
1124
+ id: StudioDashboardIssue;
1125
+ version?: string;
1126
+ }>;
1127
+
1128
+ /**
1129
+ * Studio user application schema — validates and brands API
1130
+ * responses from the `/user-applications?appType=studio`
1131
+ * endpoint. Uses a discriminated union on `urlType`.
1132
+ * @public
1133
+ */
1134
+ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1135
+ [
1136
+ z.ZodObject<
1137
+ {
1138
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
1139
+ appHost: z.ZodString;
1140
+ createdAt: z.ZodString;
1141
+ updatedAt: z.ZodString;
1142
+ dashboardStatus: z.ZodEnum<{
1143
+ default: "default";
1144
+ disabled: "disabled";
1145
+ }>;
1146
+ title: z.ZodNullable<z.ZodString>;
1147
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1148
+ type: z.ZodLiteral<"studio">;
1149
+ manifest: z.ZodNullable<
1150
+ z.ZodObject<
1151
+ {
1152
+ version: z.ZodNumber;
1153
+ createdAt: z.ZodString;
1154
+ studioVersion: z.ZodOptional<z.ZodString>;
1155
+ workspaces: z.ZodArray<
1156
+ z.ZodObject<
1157
+ {
1158
+ name: z.ZodString;
1159
+ title: z.ZodString;
1160
+ subtitle: z.ZodOptional<z.ZodString>;
1161
+ basePath: z.ZodString;
1162
+ projectId: z.core.$ZodBranded<
1163
+ z.ZodString,
1164
+ "ProjectId",
1165
+ "out"
1166
+ >;
1167
+ dataset: z.ZodOptional<z.ZodString>;
1168
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1169
+ schema: z.ZodString;
1170
+ tools: z.ZodOptional<z.ZodString>;
1171
+ },
1172
+ z.core.$strip
1173
+ >
1174
+ >;
1175
+ },
1176
+ z.core.$strip
1177
+ >
1178
+ >;
1179
+ manifestData: z.ZodNullable<
1180
+ z.ZodObject<
1181
+ {
1182
+ value: z.ZodObject<
1183
+ {
1184
+ version: z.ZodNumber;
1185
+ createdAt: z.ZodString;
1186
+ studioVersion: z.ZodOptional<z.ZodString>;
1187
+ workspaces: z.ZodArray<
1188
+ z.ZodObject<
1189
+ {
1190
+ name: z.ZodString;
1191
+ title: z.ZodString;
1192
+ subtitle: z.ZodOptional<z.ZodString>;
1193
+ basePath: z.ZodString;
1194
+ projectId: z.core.$ZodBranded<
1195
+ z.ZodString,
1196
+ "ProjectId",
1197
+ "out"
1198
+ >;
1199
+ dataset: z.ZodOptional<z.ZodString>;
1200
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1201
+ schema: z.ZodString;
1202
+ tools: z.ZodOptional<z.ZodString>;
1203
+ },
1204
+ z.core.$strip
1205
+ >
1206
+ >;
1207
+ },
1208
+ z.core.$strip
1209
+ >;
1210
+ },
1211
+ z.core.$strip
1212
+ >
1213
+ >;
1214
+ autoUpdatingVersion: z.ZodNullable<z.ZodString>;
1215
+ config: z.ZodObject<
1216
+ {
1217
+ "live-manifest": z.ZodOptional<
1218
+ z.ZodObject<
1219
+ {
1220
+ createdAt: z.ZodString;
1221
+ updatedAt: z.ZodString;
1222
+ updatedBy: z.ZodString;
1223
+ value: z.ZodObject<
1224
+ {
1225
+ buildId: z.ZodOptional<z.ZodString>;
1226
+ bundleVersion: z.ZodOptional<z.ZodString>;
1227
+ version: z.ZodOptional<z.ZodString>;
1228
+ workspaces: z.ZodOptional<
1229
+ z.ZodArray<
1230
+ z.ZodObject<
1231
+ {
1232
+ name: z.ZodString;
1233
+ title: z.ZodString;
1234
+ subtitle: z.ZodOptional<z.ZodString>;
1235
+ basePath: z.ZodString;
1236
+ projectId: z.core.$ZodBranded<
1237
+ z.ZodString,
1238
+ "ProjectId",
1239
+ "out"
1240
+ >;
1241
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1242
+ dataset: z.ZodString;
1243
+ schemaDescriptorId: z.ZodString;
1244
+ },
1245
+ z.core.$strip
1246
+ >
1247
+ >
1248
+ >;
1249
+ },
1250
+ z.core.$strip
1251
+ >;
1252
+ },
1253
+ z.core.$strip
1254
+ >
1255
+ >;
1256
+ },
1257
+ z.core.$strip
1258
+ >;
1259
+ urlType: z.ZodLiteral<"internal">;
1260
+ activeDeployment: z.ZodObject<
1261
+ {
1262
+ id: z.ZodString;
1263
+ version: z.ZodString;
1264
+ isActiveDeployment: z.ZodBoolean;
1265
+ userApplicationId: z.ZodString;
1266
+ isAutoUpdating: z.ZodBoolean;
1267
+ size: z.ZodNumber;
1268
+ deployedAt: z.ZodString;
1269
+ deployedBy: z.ZodString;
1270
+ createdAt: z.ZodString;
1271
+ updatedAt: z.ZodString;
1272
+ manifest: z.ZodNullable<
1273
+ z.ZodObject<
1274
+ {
1275
+ buildId: z.ZodOptional<z.ZodString>;
1276
+ bundleVersion: z.ZodOptional<z.ZodString>;
1277
+ version: z.ZodOptional<z.ZodString>;
1278
+ workspaces: z.ZodOptional<
1279
+ z.ZodArray<
1280
+ z.ZodObject<
1281
+ {
1282
+ name: z.ZodString;
1283
+ title: z.ZodString;
1284
+ subtitle: z.ZodOptional<z.ZodString>;
1285
+ basePath: z.ZodString;
1286
+ projectId: z.core.$ZodBranded<
1287
+ z.ZodString,
1288
+ "ProjectId",
1289
+ "out"
1290
+ >;
1291
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1292
+ dataset: z.ZodString;
1293
+ schemaDescriptorId: z.ZodString;
1294
+ },
1295
+ z.core.$strip
1296
+ >
1297
+ >
1298
+ >;
1299
+ },
1300
+ z.core.$strip
1301
+ >
1302
+ >;
1303
+ },
1304
+ z.core.$strip
1305
+ >;
1306
+ },
1307
+ z.core.$strip
1308
+ >,
1309
+ z.ZodObject<
1310
+ {
1311
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
1312
+ appHost: z.ZodString;
1313
+ createdAt: z.ZodString;
1314
+ updatedAt: z.ZodString;
1315
+ dashboardStatus: z.ZodEnum<{
1316
+ default: "default";
1317
+ disabled: "disabled";
1318
+ }>;
1319
+ title: z.ZodNullable<z.ZodString>;
1320
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1321
+ type: z.ZodLiteral<"studio">;
1322
+ manifest: z.ZodNullable<
1323
+ z.ZodObject<
1324
+ {
1325
+ version: z.ZodNumber;
1326
+ createdAt: z.ZodString;
1327
+ studioVersion: z.ZodOptional<z.ZodString>;
1328
+ workspaces: z.ZodArray<
1329
+ z.ZodObject<
1330
+ {
1331
+ name: z.ZodString;
1332
+ title: z.ZodString;
1333
+ subtitle: z.ZodOptional<z.ZodString>;
1334
+ basePath: z.ZodString;
1335
+ projectId: z.core.$ZodBranded<
1336
+ z.ZodString,
1337
+ "ProjectId",
1338
+ "out"
1339
+ >;
1340
+ dataset: z.ZodOptional<z.ZodString>;
1341
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1342
+ schema: z.ZodString;
1343
+ tools: z.ZodOptional<z.ZodString>;
1344
+ },
1345
+ z.core.$strip
1346
+ >
1347
+ >;
1348
+ },
1349
+ z.core.$strip
1350
+ >
1351
+ >;
1352
+ manifestData: z.ZodNullable<
1353
+ z.ZodObject<
1354
+ {
1355
+ value: z.ZodObject<
1356
+ {
1357
+ version: z.ZodNumber;
1358
+ createdAt: z.ZodString;
1359
+ studioVersion: z.ZodOptional<z.ZodString>;
1360
+ workspaces: z.ZodArray<
1361
+ z.ZodObject<
1362
+ {
1363
+ name: z.ZodString;
1364
+ title: z.ZodString;
1365
+ subtitle: z.ZodOptional<z.ZodString>;
1366
+ basePath: z.ZodString;
1367
+ projectId: z.core.$ZodBranded<
1368
+ z.ZodString,
1369
+ "ProjectId",
1370
+ "out"
1371
+ >;
1372
+ dataset: z.ZodOptional<z.ZodString>;
1373
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1374
+ schema: z.ZodString;
1375
+ tools: z.ZodOptional<z.ZodString>;
1376
+ },
1377
+ z.core.$strip
1378
+ >
1379
+ >;
1380
+ },
1381
+ z.core.$strip
1382
+ >;
1383
+ },
1384
+ z.core.$strip
1385
+ >
1386
+ >;
1387
+ autoUpdatingVersion: z.ZodNullable<z.ZodString>;
1388
+ config: z.ZodObject<
1389
+ {
1390
+ "live-manifest": z.ZodOptional<
1391
+ z.ZodObject<
1392
+ {
1393
+ createdAt: z.ZodString;
1394
+ updatedAt: z.ZodString;
1395
+ updatedBy: z.ZodString;
1396
+ value: z.ZodObject<
1397
+ {
1398
+ buildId: z.ZodOptional<z.ZodString>;
1399
+ bundleVersion: z.ZodOptional<z.ZodString>;
1400
+ version: z.ZodOptional<z.ZodString>;
1401
+ workspaces: z.ZodOptional<
1402
+ z.ZodArray<
1403
+ z.ZodObject<
1404
+ {
1405
+ name: z.ZodString;
1406
+ title: z.ZodString;
1407
+ subtitle: z.ZodOptional<z.ZodString>;
1408
+ basePath: z.ZodString;
1409
+ projectId: z.core.$ZodBranded<
1410
+ z.ZodString,
1411
+ "ProjectId",
1412
+ "out"
1413
+ >;
1414
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1415
+ dataset: z.ZodString;
1416
+ schemaDescriptorId: z.ZodString;
1417
+ },
1418
+ z.core.$strip
1419
+ >
1420
+ >
1421
+ >;
1422
+ },
1423
+ z.core.$strip
1424
+ >;
1425
+ },
1426
+ z.core.$strip
1427
+ >
1428
+ >;
1429
+ },
1430
+ z.core.$strip
1431
+ >;
1432
+ urlType: z.ZodLiteral<"external">;
1433
+ activeDeployment: z.ZodNull;
1434
+ },
1435
+ z.core.$strip
1436
+ >,
1437
+ ],
1438
+ "urlType"
1439
+ >;
1440
+
1441
+ /**
1442
+ * @public
1443
+ */
1444
+ export declare type StudioUserApplication = z.output<
1445
+ typeof StudioUserApplication
1446
+ >;
1447
+
1448
+ /**
1449
+ * @public
1450
+ */
1451
+ export declare class StudioWorkspace extends AbstractApplication<
1452
+ "workspace",
1453
+ StudioResource
1454
+ > {
1455
+ /**
1456
+ * Workspaces always belong to a studio application.
1457
+ * They do not exist on their own & therefore can access
1458
+ * information about the studio they're in via this property.
1459
+ */
1460
+ private readonly studioApplication;
1461
+ private readonly workspace;
1462
+ readonly project: Project<false, false>;
1463
+ private readonly isDefaultWorkspace;
1464
+ constructor(
1465
+ studioApplication: StudioApplication,
1466
+ workspace: Workspace,
1467
+ project: Project<false, false>,
1468
+ isDefaultWorkspace: boolean,
1469
+ );
1470
+ /**
1471
+ * The studio application that this workspace belongs to.
1472
+ */
1473
+ get studio(): StudioApplication;
1474
+ get id(): string;
1475
+ get href(): string;
1476
+ get title(): string;
1477
+ get subtitle(): string | undefined;
1478
+ get<TKey extends Exclude<keyof Workspace, "id" | "icon" | "title">>(
1479
+ attr: TKey,
1480
+ ): Workspace[TKey];
1481
+ get isFederated(): boolean;
1482
+ /**
1483
+ * With comlink, studio-applications were not considered applications at all, only workspaces. This is partially why
1484
+ * we create default workspaces when the application has no manifest or the manifest has no workspaces.
1485
+ *
1486
+ * Thereby, to create it we depend on a lot of information from the parent application even if it's duplicated across
1487
+ * different workspaces.
1488
+ */
1489
+ toProtocolResource(): StudioResource;
1490
+ /**
1491
+ * @returns the URL to the workspace of a studio application.
1492
+ */
1493
+ get url(): URL;
1494
+ static makeId(
1495
+ applicationId: UserApplicationId,
1496
+ workspaceName: string,
1497
+ ): string;
1498
+ static splitId(id: string): [string, string];
1499
+ }
1500
+
1501
+ /**
1502
+ * @public
1503
+ */
1504
+ export declare abstract class UserApplication<
1505
+ TUserApplication extends UserApplicationBase,
1506
+ TType extends Extract<AbstractApplicationType, "coreApp" | "studio">,
1507
+ TProtocolResource extends Resource = Extract<
1508
+ Resource,
1509
+ {
1510
+ type: TType;
1511
+ }
1512
+ >,
1513
+ > extends AbstractApplication<TType, TProtocolResource> {
1514
+ #private;
1515
+ readonly application: TUserApplication;
1516
+ readonly id: UserApplicationId;
1517
+ /**
1518
+ * For local applications (`isLocal === true`), the deployed application
1519
+ * that shares the same `id` — if one was passed at construction. `null`
1520
+ * for deployed applications or when no remote twin was provided.
1521
+ */
1522
+ readonly remoteApplication: this | null;
1523
+ constructor(
1524
+ application: TUserApplication,
1525
+ type: TType,
1526
+ options?: {
1527
+ isLocal?: boolean;
1528
+ remoteApplication?: UserApplication<
1529
+ TUserApplication,
1530
+ TType,
1531
+ TProtocolResource
1532
+ > | null;
1533
+ },
1534
+ );
1535
+ abstract get subtitle(): string | undefined;
1536
+ /**
1537
+ * Local dev servers are rendered as federated remotes; deployed applications
1538
+ * are rendered in an iframe.
1539
+ */
1540
+ get isFederated(): boolean;
1541
+ get isLocal(): boolean;
1542
+ /**
1543
+ * @returns A fully resolved URL instance for the application.
1544
+ * For internal applications, constructs a URL using the Sanity studio domain
1545
+ * pattern resolved from the environment at the consuming app's build time.
1546
+ * For external applications (including local dev servers), returns the
1547
+ * provided app host as a URL.
1548
+ */
1549
+ get url(): URL;
1550
+ }
1551
+
1552
+ /**
1553
+ * @public
1554
+ */
1555
+ export declare const UserApplicationBase: z.ZodObject<
1556
+ {
1557
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
1558
+ appHost: z.ZodString;
1559
+ urlType: z.ZodEnum<{
1560
+ internal: "internal";
1561
+ external: "external";
1562
+ }>;
1563
+ createdAt: z.ZodString;
1564
+ updatedAt: z.ZodString;
1565
+ dashboardStatus: z.ZodEnum<{
1566
+ default: "default";
1567
+ disabled: "disabled";
1568
+ }>;
1569
+ },
1570
+ z.core.$strip
1571
+ >;
1572
+
1573
+ /**
1574
+ * @public
1575
+ */
1576
+ export declare type UserApplicationBase = z.output<typeof UserApplicationBase>;
1577
+
1578
+ /**
1579
+ * User application ID schema, branded for type safety.
1580
+ * @public
1581
+ */
1582
+ export declare const UserApplicationId: z.core.$ZodBranded<
1583
+ z.ZodString,
1584
+ "UserApplicationId",
1585
+ "out"
1586
+ >;
1587
+
1588
+ /**
1589
+ * User application ID type, branded for type safety.
1590
+ * @public
1591
+ */
1592
+ export declare type UserApplicationId = z.output<typeof UserApplicationId>;
1593
+
1594
+ /**
1595
+ * @public
1596
+ */
1597
+ export declare type Workspace = z.output<typeof Workspace_2>;
1598
+
1599
+ declare const Workspace_2: z.ZodObject<
1600
+ {
1601
+ name: z.ZodString;
1602
+ title: z.ZodString;
1603
+ subtitle: z.ZodOptional<z.ZodString>;
1604
+ basePath: z.ZodString;
1605
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1606
+ dataset: z.ZodOptional<z.ZodString>;
1607
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1608
+ },
1609
+ z.core.$strip
1610
+ >;
1611
+
1612
+ /**
1613
+ * @public
1614
+ */
1615
+ declare type Workspace = z.output<typeof Workspace_2>;
1616
+
1617
+ export {};