@sanity/workbench 0.1.0-alpha.1 → 0.1.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.d.ts ADDED
@@ -0,0 +1,1646 @@
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.ZodNullable<
376
+ z.ZodObject<
377
+ {
378
+ id: z.ZodString;
379
+ version: z.ZodString;
380
+ isActiveDeployment: z.ZodBoolean;
381
+ userApplicationId: z.ZodString;
382
+ isAutoUpdating: z.ZodBoolean;
383
+ size: z.ZodNumber;
384
+ deployedAt: z.ZodString;
385
+ deployedBy: z.ZodString;
386
+ createdAt: z.ZodString;
387
+ updatedAt: z.ZodString;
388
+ manifest: z.ZodOptional<
389
+ z.ZodNullable<
390
+ z.ZodObject<
391
+ {
392
+ version: z.ZodString;
393
+ icon: z.ZodOptional<z.ZodString>;
394
+ title: z.ZodOptional<z.ZodString>;
395
+ },
396
+ z.core.$strip
397
+ >
398
+ >
399
+ >;
400
+ },
401
+ z.core.$strip
402
+ >
403
+ >;
404
+ },
405
+ z.core.$strip
406
+ >,
407
+ z.ZodObject<
408
+ {
409
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
410
+ appHost: z.ZodString;
411
+ createdAt: z.ZodString;
412
+ updatedAt: z.ZodString;
413
+ dashboardStatus: z.ZodEnum<{
414
+ default: "default";
415
+ disabled: "disabled";
416
+ }>;
417
+ title: z.ZodString;
418
+ organizationId: z.core.$ZodBranded<
419
+ z.ZodString,
420
+ "OrganizationId",
421
+ "out"
422
+ >;
423
+ type: z.ZodLiteral<"coreApp">;
424
+ manifest: z.ZodOptional<
425
+ z.ZodNullable<
426
+ z.ZodObject<
427
+ {
428
+ version: z.ZodString;
429
+ icon: z.ZodOptional<z.ZodString>;
430
+ title: z.ZodOptional<z.ZodString>;
431
+ },
432
+ z.core.$strip
433
+ >
434
+ >
435
+ >;
436
+ urlType: z.ZodLiteral<"external">;
437
+ activeDeployment: z.ZodNull;
438
+ },
439
+ z.core.$strip
440
+ >,
441
+ ],
442
+ "urlType"
443
+ >;
444
+
445
+ /**
446
+ * @public
447
+ */
448
+ declare type CoreAppUserApplication = z.output<typeof CoreAppUserApplication_2>;
449
+
450
+ /**
451
+ * @public
452
+ */
453
+ export declare const CoreAppUserApplicationManifest: z.ZodObject<
454
+ {
455
+ version: z.ZodString;
456
+ icon: z.ZodOptional<z.ZodString>;
457
+ title: z.ZodOptional<z.ZodString>;
458
+ },
459
+ z.core.$strip
460
+ >;
461
+
462
+ /**
463
+ * @public
464
+ */
465
+ export declare type CoreAppUserApplicationManifest = z.output<
466
+ typeof CoreAppUserApplicationManifest
467
+ >;
468
+
469
+ /**
470
+ * @public
471
+ */
472
+ export declare function createLogger({
473
+ namespace,
474
+ context: baseContext,
475
+ logLevel,
476
+ }?: LoggerOptions): Logger;
477
+
478
+ /**
479
+ * Returns the API host based on the `__SANITY_STAGING__` runtime-time flag.
480
+ * If the flag is set to `true`, the staging API host is returned.
481
+ * Otherwise, the production API host is returned.
482
+ *
483
+ * @public
484
+ */
485
+ export declare function getApiHost(): string | undefined;
486
+
487
+ /**
488
+ * Returns the Sanity domain based on the `__SANITY_STAGING__` runtime-time flag.
489
+ * If the flag is set to `true`, the staging domain is returned.
490
+ * Otherwise, the production domain is returned.
491
+ *
492
+ * @public
493
+ */
494
+ export declare function getSanityDomain(): string;
495
+
496
+ /**
497
+ * Returns the current Sanity environment based on the `__SANITY_STAGING__` runtime-time flag.
498
+ * If the flag is set to `true`, "staging" is returned.
499
+ * Otherwise, "production" is returned.
500
+ *
501
+ * @public
502
+ */
503
+ export declare function getSanityEnv(): "staging" | "production";
504
+
505
+ /**
506
+ * Joins multiple path segments into a single path string.
507
+ * Handles null, undefined, and URL objects gracefully.
508
+ *
509
+ * @public
510
+ * @param paths - An array of path segments to join.
511
+ * @returns A single joined path string.
512
+ */
513
+ export declare const joinUrlPaths: (
514
+ ...paths: Array<string | URL | null | undefined>
515
+ ) => string;
516
+
517
+ /**
518
+ * Raw data for a local application discovered by the CLI dev server.
519
+ *
520
+ * The CLI forwards the full studio or app manifest so the workbench can
521
+ * derive icons, titles, workspaces and schema references the same way it
522
+ * does for deployed applications. The manifest shape is discriminated on
523
+ * `type`: studios receive a `ClientManifest`, core apps a `CoreAppUserApplicationManifest`.
524
+ *
525
+ * When set on a `UserApplication`, `isLocal` is `true` and `url`/`isFederated`
526
+ * honour the local dev-server instead of the deployed application's host.
527
+ *
528
+ * @public
529
+ */
530
+ export declare const LocalUserApplication: z.ZodDiscriminatedUnion<
531
+ [
532
+ z.ZodObject<
533
+ {
534
+ host: z.ZodString;
535
+ port: z.ZodNumber;
536
+ id: z.ZodOptional<z.ZodString>;
537
+ type: z.ZodLiteral<"studio">;
538
+ manifest: z.ZodOptional<
539
+ z.ZodCustom<
540
+ {
541
+ version: number;
542
+ createdAt: string;
543
+ workspaces: {
544
+ name: string;
545
+ title: string;
546
+ basePath: string;
547
+ projectId: string & z.core.$brand<"ProjectId">;
548
+ schema: string;
549
+ subtitle?: string | undefined;
550
+ dataset?: string | undefined;
551
+ icon?: string | null | undefined;
552
+ tools?: string | undefined;
553
+ }[];
554
+ studioVersion?: string | undefined;
555
+ },
556
+ {
557
+ version: number;
558
+ createdAt: string;
559
+ workspaces: {
560
+ name: string;
561
+ title: string;
562
+ basePath: string;
563
+ projectId: string & z.core.$brand<"ProjectId">;
564
+ schema: string;
565
+ subtitle?: string | undefined;
566
+ dataset?: string | undefined;
567
+ icon?: string | null | undefined;
568
+ tools?: string | undefined;
569
+ }[];
570
+ studioVersion?: string | undefined;
571
+ }
572
+ >
573
+ >;
574
+ },
575
+ z.core.$strip
576
+ >,
577
+ z.ZodObject<
578
+ {
579
+ host: z.ZodString;
580
+ port: z.ZodNumber;
581
+ id: z.ZodOptional<z.ZodString>;
582
+ type: z.ZodLiteral<"coreApp">;
583
+ manifest: z.ZodOptional<
584
+ z.ZodCustom<
585
+ {
586
+ version: string;
587
+ icon?: string | undefined;
588
+ title?: string | undefined;
589
+ },
590
+ {
591
+ version: string;
592
+ icon?: string | undefined;
593
+ title?: string | undefined;
594
+ }
595
+ >
596
+ >;
597
+ },
598
+ z.core.$strip
599
+ >,
600
+ ],
601
+ "type"
602
+ >;
603
+
604
+ /**
605
+ * @public
606
+ */
607
+ export declare type LocalUserApplication = z.output<
608
+ typeof LocalUserApplication
609
+ >;
610
+
611
+ declare type LogContext = {
612
+ [key: string]: unknown;
613
+ };
614
+
615
+ /**
616
+ * @public
617
+ */
618
+ export declare interface Logger {
619
+ error: (message: string, context?: LogContext) => void;
620
+ warn: (message: string, context?: LogContext) => void;
621
+ info: (message: string, context?: LogContext) => void;
622
+ debug: (message: string, context?: LogContext) => void;
623
+ }
624
+
625
+ /**
626
+ * Shared workbench logger instance. Use this from both the workbench host
627
+ * and its remotes so lifecycle and diagnostic logs appear under a single
628
+ * namespace.
629
+ *
630
+ * @public
631
+ */
632
+ export declare const logger: Logger;
633
+
634
+ declare interface LoggerOptions {
635
+ namespace?: LogNamespace;
636
+ context?: LogContext;
637
+ logLevel?: LogLevel;
638
+ }
639
+
640
+ /**
641
+ * Log levels in order of verbosity (least to most)
642
+ * - none: Silent
643
+ * - error: Critical failures that prevent operation
644
+ * - warn: Issues that may cause problems but don't stop execution
645
+ * - info: High-level informational messages (default)
646
+ * - debug: Detailed debugging information (maintainer level)
647
+ * - trace: Very detailed tracing — sets `internal: true` on context
648
+ * @public
649
+ */
650
+ export declare type LogLevel = "none" | "error" | "warn" | "info" | "debug";
651
+
652
+ /**
653
+ * Namespaces organize logs by functional domain.
654
+ * @internal
655
+ */
656
+ export declare type LogNamespace = string;
657
+
658
+ /**
659
+ * Represents a MediaLibrary resource as returned from the API.
660
+ * @public
661
+ */
662
+ export declare type MediaLibrary = z.output<typeof MediaLibrary_2>;
663
+
664
+ declare const MediaLibrary_2: z.ZodObject<
665
+ {
666
+ id: z.core.$ZodBranded<z.ZodString, "MediaLibraryId", "out">;
667
+ organizationId: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
668
+ status: z.ZodEnum<{
669
+ active: "active";
670
+ provisioning: "provisioning";
671
+ }>;
672
+ aclMode: z.ZodEnum<{
673
+ private: "private";
674
+ public: "public";
675
+ }>;
676
+ },
677
+ z.core.$strip
678
+ >;
679
+
680
+ /**
681
+ * Represents a MediaLibrary resource as returned from the API.
682
+ * @public
683
+ */
684
+ declare type MediaLibrary = z.output<typeof MediaLibrary_2>;
685
+
686
+ /**
687
+ * Whilst the constructor takes an organization's media library resource the existance
688
+ * therefore implies the organization has access to the media library application which
689
+ * is what workbench most importantly wants to know.
690
+ * @public
691
+ */
692
+ export declare class MediaLibraryApplication extends AbstractApplication<"media-library"> {
693
+ readonly library: MediaLibrary;
694
+ constructor(library: MediaLibrary);
695
+ get id(): string;
696
+ get href(): string;
697
+ get title(): string;
698
+ get isFederated(): boolean;
699
+ get url(): URL;
700
+ toProtocolResource(): MediaResource;
701
+ }
702
+
703
+ /**
704
+ * MediaLibrary ID type, branded for type safety.
705
+ * @public
706
+ */
707
+ export declare type MediaLibraryId = z.output<typeof MediaLibraryId_2>;
708
+
709
+ /**
710
+ * Canvas ID schema, branded for type safety.
711
+ * @public
712
+ */
713
+ declare const MediaLibraryId_2: z.core.$ZodBranded<
714
+ z.ZodString,
715
+ "MediaLibraryId",
716
+ "out"
717
+ >;
718
+
719
+ /**
720
+ * MediaLibrary ID type, branded for type safety.
721
+ * @public
722
+ */
723
+ declare type MediaLibraryId = z.output<typeof MediaLibraryId_2>;
724
+
725
+ /**
726
+ * Organization schema — validates and brands API responses
727
+ * from the `/organizations/:id` endpoint.
728
+ * @public
729
+ */
730
+ export declare const Organization: z.ZodObject<
731
+ {
732
+ id: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
733
+ name: z.ZodString;
734
+ slug: z.ZodNullable<z.ZodString>;
735
+ createdAt: z.ZodString;
736
+ updatedAt: z.ZodString;
737
+ dashboardStatus: z.ZodEnum<{
738
+ enabled: "enabled";
739
+ disabled: "disabled";
740
+ }>;
741
+ aiFeaturesStatus: z.ZodEnum<{
742
+ enabled: "enabled";
743
+ disabled: "disabled";
744
+ }>;
745
+ defaultRoleName: z.ZodString;
746
+ },
747
+ z.core.$strip
748
+ >;
749
+
750
+ /**
751
+ * Represents an organization with optional members and
752
+ * features arrays depending on the generic parameters.
753
+ * - `Organization` — base fields only (default)
754
+ * - `Organization<true>` — includes `members`
755
+ * - `Organization<true, true>` — includes both
756
+ * @public
757
+ */
758
+ export declare type Organization<
759
+ IncludeMembers extends boolean = true,
760
+ IncludeFeatures extends boolean = true,
761
+ > = z.output<typeof Organization> &
762
+ (IncludeMembers extends true
763
+ ? {
764
+ members: OrganizationMember[];
765
+ }
766
+ : unknown) &
767
+ (IncludeFeatures extends true
768
+ ? {
769
+ features: string[];
770
+ }
771
+ : unknown);
772
+
773
+ /**
774
+ * Organization ID schema, branded for type safety.
775
+ * @public
776
+ */
777
+ export declare const OrganizationId: z.core.$ZodBranded<
778
+ z.ZodString,
779
+ "OrganizationId",
780
+ "out"
781
+ >;
782
+
783
+ /**
784
+ * Organization ID type, branded for type safety.
785
+ * @public
786
+ */
787
+ export declare type OrganizationId = z.output<typeof OrganizationId>;
788
+
789
+ /**
790
+ * @public
791
+ */
792
+ export declare type OrganizationMember = z.output<typeof OrganizationMember_2>;
793
+
794
+ declare const OrganizationMember_2: z.ZodObject<
795
+ {
796
+ sanityUserId: z.ZodString;
797
+ isCurrentUser: z.ZodBoolean;
798
+ user: z.ZodObject<
799
+ {
800
+ id: z.ZodString;
801
+ displayName: z.ZodString;
802
+ familyName: z.ZodString;
803
+ givenName: z.ZodString;
804
+ middleName: z.ZodNullable<z.ZodString>;
805
+ imageUrl: z.ZodNullable<z.ZodString>;
806
+ email: z.ZodString;
807
+ loginProvider: z.ZodString;
808
+ },
809
+ z.core.$strip
810
+ >;
811
+ roles: z.ZodArray<
812
+ z.ZodObject<
813
+ {
814
+ name: z.ZodString;
815
+ title: z.ZodString;
816
+ description: z.ZodOptional<z.ZodString>;
817
+ },
818
+ z.core.$strip
819
+ >
820
+ >;
821
+ },
822
+ z.core.$strip
823
+ >;
824
+
825
+ /**
826
+ * @public
827
+ */
828
+ declare type OrganizationMember = z.output<typeof OrganizationMember_2>;
829
+
830
+ /**
831
+ * Validates and parses a raw API response into a branded
832
+ * Canvas.
833
+ * @public
834
+ */
835
+ export declare function parseCanvas(data: unknown): Canvas;
836
+
837
+ /**
838
+ * Validates and parses a raw API response into a branded
839
+ * CoreAppUserApplicationData.
840
+ * @public
841
+ */
842
+ export declare function parseCoreApplication(
843
+ data: unknown,
844
+ ): CoreAppUserApplication;
845
+
846
+ /**
847
+ * Validates and parses a raw API response into a branded
848
+ * MediaLibrary.
849
+ * @public
850
+ */
851
+ export declare function parseMediaLibrary(data: unknown): MediaLibrary;
852
+
853
+ /**
854
+ * Validates and parses a raw API response into a branded
855
+ * Organization. The options control which schema is used —
856
+ * matching what the API returns based on query params.
857
+ * @public
858
+ */
859
+ export declare function parseOrganization<
860
+ IncludeMembers extends boolean = true,
861
+ IncludeFeatures extends boolean = true,
862
+ >(
863
+ data: unknown,
864
+ options?: {
865
+ includeMembers?: IncludeMembers;
866
+ includeFeatures?: IncludeFeatures;
867
+ },
868
+ ): Organization<IncludeMembers, IncludeFeatures>;
869
+
870
+ /**
871
+ * Validates and parses a raw API response into a branded
872
+ * Project. The options control which schema is used —
873
+ * matching what the API returns based on query params.
874
+ * @public
875
+ */
876
+ export declare function parseProject<
877
+ IncludeMembers extends boolean = true,
878
+ IncludeFeatures extends boolean = true,
879
+ >(
880
+ data: unknown,
881
+ options?: {
882
+ includeMembers?: IncludeMembers;
883
+ includeFeatures?: IncludeFeatures;
884
+ },
885
+ ): Project<IncludeMembers, IncludeFeatures>;
886
+
887
+ /**
888
+ * Validates and parses a raw API response into a branded
889
+ * StudioUserApplication.
890
+ * @public
891
+ */
892
+ export declare function parseStudioUserApplication(
893
+ data: unknown,
894
+ ): StudioUserApplication;
895
+
896
+ /**
897
+ * Project schema — validates and brands API responses
898
+ * from the `/projects/:id` endpoint.
899
+ * @public
900
+ */
901
+ export declare const Project: z.ZodObject<
902
+ {
903
+ id: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
904
+ displayName: z.ZodString;
905
+ studioHost: z.ZodNullable<z.ZodString>;
906
+ organizationId: z.core.$ZodBranded<z.ZodString, "OrganizationId", "out">;
907
+ metadata: z.ZodObject<
908
+ {
909
+ color: z.ZodOptional<z.ZodString>;
910
+ externalStudioHost: z.ZodOptional<z.ZodString>;
911
+ initialTemplate: z.ZodOptional<z.ZodString>;
912
+ cliInitializedAt: z.ZodOptional<z.ZodString>;
913
+ integration: z.ZodLiteral<"manage" | "cli">;
914
+ },
915
+ z.core.$strip
916
+ >;
917
+ isBlocked: z.ZodBoolean;
918
+ isDisabled: z.ZodBoolean;
919
+ isDisabledByUser: z.ZodBoolean;
920
+ activityFeedEnabled: z.ZodBoolean;
921
+ createdAt: z.ZodString;
922
+ updatedAt: z.ZodString;
923
+ },
924
+ z.core.$strip
925
+ >;
926
+
927
+ /**
928
+ * Represents a Sanity project with optional members and
929
+ * features arrays depending on the generic parameters.
930
+ * By default, neither members nor features are included.
931
+ * - `Project` — base fields only (default)
932
+ * - `Project<true>` — includes `members`
933
+ * - `Project<true, true>` — includes both
934
+ * @public
935
+ */
936
+ export declare type Project<
937
+ IncludeMembers extends boolean = true,
938
+ IncludeFeatures extends boolean = true,
939
+ > = z.output<typeof Project> &
940
+ (IncludeMembers extends true
941
+ ? {
942
+ members: ProjectMember[];
943
+ }
944
+ : unknown) &
945
+ (IncludeFeatures extends true
946
+ ? {
947
+ features: string[];
948
+ }
949
+ : unknown);
950
+
951
+ /**
952
+ * Project ID schema, branded for type safety.
953
+ * @public
954
+ */
955
+ export declare const ProjectId: z.core.$ZodBranded<
956
+ z.ZodString,
957
+ "ProjectId",
958
+ "out"
959
+ >;
960
+
961
+ /**
962
+ * Project ID type, branded for type safety.
963
+ * @public
964
+ */
965
+ export declare type ProjectId = z.output<typeof ProjectId>;
966
+
967
+ /**
968
+ * @public
969
+ */
970
+ export declare type ProjectMember = z.output<typeof ProjectMember_2>;
971
+
972
+ declare const ProjectMember_2: z.ZodObject<
973
+ {
974
+ id: z.ZodString;
975
+ createdAt: z.ZodString;
976
+ updatedAt: z.ZodString;
977
+ isCurrentUser: z.ZodBoolean;
978
+ isRobot: z.ZodBoolean;
979
+ roles: z.ZodArray<
980
+ z.ZodObject<
981
+ {
982
+ name: z.ZodString;
983
+ title: z.ZodString;
984
+ description: z.ZodString;
985
+ },
986
+ z.core.$strip
987
+ >
988
+ >;
989
+ },
990
+ z.core.$strip
991
+ >;
992
+
993
+ /**
994
+ * @public
995
+ */
996
+ declare type ProjectMember = z.output<typeof ProjectMember_2>;
997
+
998
+ /**
999
+ * Options for rendering a remote module, such as a user application.
1000
+ *
1001
+ * @public
1002
+ */
1003
+ export declare interface RemoteModuleRenderOptions {
1004
+ reactStrictMode?: boolean;
1005
+ }
1006
+
1007
+ /**
1008
+ * The resolved configuration after processing
1009
+ * and validating the provided config.
1010
+ *
1011
+ * @public
1012
+ */
1013
+ export declare type ResolvedConfig = Omit<Config, "organizationId"> & {
1014
+ organizationId: OrganizationId;
1015
+ };
1016
+
1017
+ /**
1018
+ * @public
1019
+ */
1020
+ export declare class StudioApplication extends UserApplication<
1021
+ StudioUserApplication,
1022
+ "studio",
1023
+ never
1024
+ > {
1025
+ /**
1026
+ * Returns a list of studio workspaces based on the application manifest.
1027
+ * If there is no manifest, or alternatively it is not valid, then we create a default workspace.
1028
+ */
1029
+ readonly workspaces: readonly StudioWorkspace[];
1030
+ readonly project: Project<false, false>;
1031
+ /**
1032
+ * The projects actually referenced by this studio — the application's own
1033
+ * project plus any project used by a workspace. Preserved so the instance
1034
+ * can be re-constructed (e.g. by dock wrappers) without having to thread
1035
+ * the full organization project list through again.
1036
+ */
1037
+ readonly projects: Project<false, false>[];
1038
+ /**
1039
+ * @param application - The studio application to create a list of workspaces for
1040
+ * @param projects - The projects available in the organization. It's not enough to just pass
1041
+ * the project that associates with the application because that is the project the app is deployed in relation to.
1042
+ * The workspaces may have different projects completely.
1043
+ */
1044
+ constructor(
1045
+ application: StudioUserApplication,
1046
+ projects: Project<false, false>[],
1047
+ options?: {
1048
+ isLocal?: boolean;
1049
+ remoteApplication?: StudioApplication | null;
1050
+ },
1051
+ );
1052
+ get href(): string;
1053
+ get title(): string;
1054
+ get subtitle(): string;
1055
+ get<TKey extends keyof StudioUserApplication>(
1056
+ attr: TKey,
1057
+ ): StudioUserApplication[TKey];
1058
+ get hasManifest(): boolean;
1059
+ get hasSchema(): boolean;
1060
+ private resolveVersion;
1061
+ get version(): string | null;
1062
+ get compatibilityStatus(): CompatibilityStatus;
1063
+ /**
1064
+ * Used to calculate the compatibility status of a given studio application.
1065
+ * Optionally if you've resolved the version elsewhere provide that value to
1066
+ * get the new compatibility status without mutating the application.
1067
+ */
1068
+ static resolveCompatibilityStatus(
1069
+ application: StudioApplication,
1070
+ version?: string | null,
1071
+ ): CompatibilityStatus;
1072
+ get isAutoRedirecting(): boolean;
1073
+ /**
1074
+ * Mirrors the `isRedirectable` function from Saison defined in
1075
+ * https://github.com/sanity-io/saison/blob/83556405d23e07f6d3a71c76249c67e33fe1101f/src/utils/applications.ts
1076
+ *
1077
+ * Returns whether a studio application is auto-redirecting, meaning it can only be accessed in the context of
1078
+ * Dashboard.
1079
+ */
1080
+ static resolveIsAutoRedirecting(
1081
+ application: StudioApplication,
1082
+ versionArg?: string | null,
1083
+ ): boolean;
1084
+ /**
1085
+ * Returns a list of issues that prevent the studio from functioning properly in the Dashboard.
1086
+ * This static value depends on the version of the studio that comes from the `activeDeployment` property.
1087
+ * As such, if the studio is auto-updating, this list will be incorrect & instead you should use
1088
+ * the static method `resolveIssues` to get the correct issues by passing the resolved version.
1089
+ */
1090
+ get issues(): StudioIssues;
1091
+ static resolveIssues(
1092
+ application: StudioApplication,
1093
+ version?: string | null,
1094
+ ): StudioIssues;
1095
+ protected isFeatureSupported(
1096
+ feature: StudioDashboardIssue,
1097
+ version?: string | null,
1098
+ ): boolean;
1099
+ toProtocolResource(): never;
1100
+ static CompatibilityStatuses: {
1101
+ readonly UNKNOWN: "unknown";
1102
+ readonly PARTIALLY_COMPATIBLE: "partially-compatible";
1103
+ readonly FULLY_COMPATIBLE: "fully-compatible";
1104
+ };
1105
+ static StudioIssues: {
1106
+ readonly ISSUE_ACTIVITY: "ACTIVITY";
1107
+ readonly ISSUE_AGENT: "AGENT";
1108
+ readonly ISSUE_FAVORITES: "FAVORITES";
1109
+ readonly ISSUE_URL_SYNCING: "URL_SYNCING";
1110
+ readonly ISSUE_UI_ADJUSTMENT: "UI_ADJUSTMENT";
1111
+ readonly ISSUE_CONTENT_MAPPING: "CONTENT_MAPPING";
1112
+ readonly ISSUE_LOGIN: "LOGIN";
1113
+ readonly ISSUE_MANIFEST: "MANIFEST";
1114
+ };
1115
+ static Features: (
1116
+ | {
1117
+ id: "AGENT";
1118
+ version: string;
1119
+ }
1120
+ | {
1121
+ id: "FAVORITES";
1122
+ version: string;
1123
+ }
1124
+ | {
1125
+ id: "ACTIVITY";
1126
+ version: string;
1127
+ }
1128
+ | {
1129
+ id: "URL_SYNCING";
1130
+ version: string;
1131
+ }
1132
+ | {
1133
+ id: "UI_ADJUSTMENT";
1134
+ version: string;
1135
+ }
1136
+ | {
1137
+ id: "CONTENT_MAPPING";
1138
+ version: string;
1139
+ }
1140
+ | {
1141
+ id: "LOGIN";
1142
+ version: string;
1143
+ }
1144
+ )[];
1145
+ static MinimumStudioVersion: "2.28.0";
1146
+ static MinimumStudioVersionWithNoIssues: string | undefined;
1147
+ }
1148
+
1149
+ declare type StudioDashboardIssue =
1150
+ (typeof StudioApplication.StudioIssues)[keyof typeof StudioApplication.StudioIssues];
1151
+
1152
+ declare type StudioIssues = Array<{
1153
+ id: StudioDashboardIssue;
1154
+ version?: string;
1155
+ }>;
1156
+
1157
+ /**
1158
+ * Studio user application schema — validates and brands API
1159
+ * responses from the `/user-applications?appType=studio`
1160
+ * endpoint. Uses a discriminated union on `urlType`.
1161
+ * @public
1162
+ */
1163
+ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1164
+ [
1165
+ z.ZodObject<
1166
+ {
1167
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
1168
+ appHost: z.ZodString;
1169
+ createdAt: z.ZodString;
1170
+ updatedAt: z.ZodString;
1171
+ dashboardStatus: z.ZodEnum<{
1172
+ default: "default";
1173
+ disabled: "disabled";
1174
+ }>;
1175
+ title: z.ZodNullable<z.ZodString>;
1176
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1177
+ type: z.ZodLiteral<"studio">;
1178
+ manifest: z.ZodNullable<
1179
+ z.ZodObject<
1180
+ {
1181
+ version: z.ZodNumber;
1182
+ createdAt: z.ZodString;
1183
+ studioVersion: z.ZodOptional<z.ZodString>;
1184
+ workspaces: z.ZodArray<
1185
+ z.ZodObject<
1186
+ {
1187
+ name: z.ZodString;
1188
+ title: z.ZodString;
1189
+ subtitle: z.ZodOptional<z.ZodString>;
1190
+ basePath: z.ZodString;
1191
+ projectId: z.core.$ZodBranded<
1192
+ z.ZodString,
1193
+ "ProjectId",
1194
+ "out"
1195
+ >;
1196
+ dataset: z.ZodOptional<z.ZodString>;
1197
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1198
+ schema: z.ZodString;
1199
+ tools: z.ZodOptional<z.ZodString>;
1200
+ },
1201
+ z.core.$strip
1202
+ >
1203
+ >;
1204
+ },
1205
+ z.core.$strip
1206
+ >
1207
+ >;
1208
+ manifestData: z.ZodNullable<
1209
+ z.ZodObject<
1210
+ {
1211
+ value: z.ZodObject<
1212
+ {
1213
+ version: z.ZodNumber;
1214
+ createdAt: z.ZodString;
1215
+ studioVersion: z.ZodOptional<z.ZodString>;
1216
+ workspaces: z.ZodArray<
1217
+ z.ZodObject<
1218
+ {
1219
+ name: z.ZodString;
1220
+ title: z.ZodString;
1221
+ subtitle: z.ZodOptional<z.ZodString>;
1222
+ basePath: z.ZodString;
1223
+ projectId: z.core.$ZodBranded<
1224
+ z.ZodString,
1225
+ "ProjectId",
1226
+ "out"
1227
+ >;
1228
+ dataset: z.ZodOptional<z.ZodString>;
1229
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1230
+ schema: z.ZodString;
1231
+ tools: z.ZodOptional<z.ZodString>;
1232
+ },
1233
+ z.core.$strip
1234
+ >
1235
+ >;
1236
+ },
1237
+ z.core.$strip
1238
+ >;
1239
+ },
1240
+ z.core.$strip
1241
+ >
1242
+ >;
1243
+ autoUpdatingVersion: z.ZodNullable<z.ZodString>;
1244
+ config: z.ZodObject<
1245
+ {
1246
+ "live-manifest": z.ZodOptional<
1247
+ z.ZodObject<
1248
+ {
1249
+ createdAt: z.ZodString;
1250
+ updatedAt: z.ZodString;
1251
+ updatedBy: z.ZodString;
1252
+ value: z.ZodObject<
1253
+ {
1254
+ buildId: z.ZodOptional<z.ZodString>;
1255
+ bundleVersion: z.ZodOptional<z.ZodString>;
1256
+ version: z.ZodOptional<z.ZodString>;
1257
+ workspaces: z.ZodOptional<
1258
+ z.ZodArray<
1259
+ z.ZodObject<
1260
+ {
1261
+ name: z.ZodString;
1262
+ title: z.ZodString;
1263
+ subtitle: z.ZodOptional<z.ZodString>;
1264
+ basePath: z.ZodString;
1265
+ projectId: z.core.$ZodBranded<
1266
+ z.ZodString,
1267
+ "ProjectId",
1268
+ "out"
1269
+ >;
1270
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1271
+ dataset: z.ZodString;
1272
+ schemaDescriptorId: z.ZodString;
1273
+ },
1274
+ z.core.$strip
1275
+ >
1276
+ >
1277
+ >;
1278
+ },
1279
+ z.core.$strip
1280
+ >;
1281
+ },
1282
+ z.core.$strip
1283
+ >
1284
+ >;
1285
+ },
1286
+ z.core.$strip
1287
+ >;
1288
+ urlType: z.ZodLiteral<"internal">;
1289
+ activeDeployment: z.ZodObject<
1290
+ {
1291
+ id: z.ZodString;
1292
+ version: z.ZodString;
1293
+ isActiveDeployment: z.ZodBoolean;
1294
+ userApplicationId: z.ZodString;
1295
+ isAutoUpdating: z.ZodBoolean;
1296
+ size: z.ZodNumber;
1297
+ deployedAt: z.ZodString;
1298
+ deployedBy: z.ZodString;
1299
+ createdAt: z.ZodString;
1300
+ updatedAt: z.ZodString;
1301
+ manifest: z.ZodNullable<
1302
+ z.ZodObject<
1303
+ {
1304
+ buildId: z.ZodOptional<z.ZodString>;
1305
+ bundleVersion: z.ZodOptional<z.ZodString>;
1306
+ version: z.ZodOptional<z.ZodString>;
1307
+ workspaces: z.ZodOptional<
1308
+ z.ZodArray<
1309
+ z.ZodObject<
1310
+ {
1311
+ name: z.ZodString;
1312
+ title: z.ZodString;
1313
+ subtitle: z.ZodOptional<z.ZodString>;
1314
+ basePath: z.ZodString;
1315
+ projectId: z.core.$ZodBranded<
1316
+ z.ZodString,
1317
+ "ProjectId",
1318
+ "out"
1319
+ >;
1320
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1321
+ dataset: z.ZodString;
1322
+ schemaDescriptorId: z.ZodString;
1323
+ },
1324
+ z.core.$strip
1325
+ >
1326
+ >
1327
+ >;
1328
+ },
1329
+ z.core.$strip
1330
+ >
1331
+ >;
1332
+ },
1333
+ z.core.$strip
1334
+ >;
1335
+ },
1336
+ z.core.$strip
1337
+ >,
1338
+ z.ZodObject<
1339
+ {
1340
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
1341
+ appHost: z.ZodString;
1342
+ createdAt: z.ZodString;
1343
+ updatedAt: z.ZodString;
1344
+ dashboardStatus: z.ZodEnum<{
1345
+ default: "default";
1346
+ disabled: "disabled";
1347
+ }>;
1348
+ title: z.ZodNullable<z.ZodString>;
1349
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1350
+ type: z.ZodLiteral<"studio">;
1351
+ manifest: z.ZodNullable<
1352
+ z.ZodObject<
1353
+ {
1354
+ version: z.ZodNumber;
1355
+ createdAt: z.ZodString;
1356
+ studioVersion: z.ZodOptional<z.ZodString>;
1357
+ workspaces: z.ZodArray<
1358
+ z.ZodObject<
1359
+ {
1360
+ name: z.ZodString;
1361
+ title: z.ZodString;
1362
+ subtitle: z.ZodOptional<z.ZodString>;
1363
+ basePath: z.ZodString;
1364
+ projectId: z.core.$ZodBranded<
1365
+ z.ZodString,
1366
+ "ProjectId",
1367
+ "out"
1368
+ >;
1369
+ dataset: z.ZodOptional<z.ZodString>;
1370
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1371
+ schema: z.ZodString;
1372
+ tools: z.ZodOptional<z.ZodString>;
1373
+ },
1374
+ z.core.$strip
1375
+ >
1376
+ >;
1377
+ },
1378
+ z.core.$strip
1379
+ >
1380
+ >;
1381
+ manifestData: z.ZodNullable<
1382
+ z.ZodObject<
1383
+ {
1384
+ value: z.ZodObject<
1385
+ {
1386
+ version: z.ZodNumber;
1387
+ createdAt: z.ZodString;
1388
+ studioVersion: z.ZodOptional<z.ZodString>;
1389
+ workspaces: z.ZodArray<
1390
+ z.ZodObject<
1391
+ {
1392
+ name: z.ZodString;
1393
+ title: z.ZodString;
1394
+ subtitle: z.ZodOptional<z.ZodString>;
1395
+ basePath: z.ZodString;
1396
+ projectId: z.core.$ZodBranded<
1397
+ z.ZodString,
1398
+ "ProjectId",
1399
+ "out"
1400
+ >;
1401
+ dataset: z.ZodOptional<z.ZodString>;
1402
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1403
+ schema: z.ZodString;
1404
+ tools: z.ZodOptional<z.ZodString>;
1405
+ },
1406
+ z.core.$strip
1407
+ >
1408
+ >;
1409
+ },
1410
+ z.core.$strip
1411
+ >;
1412
+ },
1413
+ z.core.$strip
1414
+ >
1415
+ >;
1416
+ autoUpdatingVersion: z.ZodNullable<z.ZodString>;
1417
+ config: z.ZodObject<
1418
+ {
1419
+ "live-manifest": z.ZodOptional<
1420
+ z.ZodObject<
1421
+ {
1422
+ createdAt: z.ZodString;
1423
+ updatedAt: z.ZodString;
1424
+ updatedBy: z.ZodString;
1425
+ value: z.ZodObject<
1426
+ {
1427
+ buildId: z.ZodOptional<z.ZodString>;
1428
+ bundleVersion: z.ZodOptional<z.ZodString>;
1429
+ version: z.ZodOptional<z.ZodString>;
1430
+ workspaces: z.ZodOptional<
1431
+ z.ZodArray<
1432
+ z.ZodObject<
1433
+ {
1434
+ name: z.ZodString;
1435
+ title: z.ZodString;
1436
+ subtitle: z.ZodOptional<z.ZodString>;
1437
+ basePath: z.ZodString;
1438
+ projectId: z.core.$ZodBranded<
1439
+ z.ZodString,
1440
+ "ProjectId",
1441
+ "out"
1442
+ >;
1443
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1444
+ dataset: z.ZodString;
1445
+ schemaDescriptorId: z.ZodString;
1446
+ },
1447
+ z.core.$strip
1448
+ >
1449
+ >
1450
+ >;
1451
+ },
1452
+ z.core.$strip
1453
+ >;
1454
+ },
1455
+ z.core.$strip
1456
+ >
1457
+ >;
1458
+ },
1459
+ z.core.$strip
1460
+ >;
1461
+ urlType: z.ZodLiteral<"external">;
1462
+ activeDeployment: z.ZodNull;
1463
+ },
1464
+ z.core.$strip
1465
+ >,
1466
+ ],
1467
+ "urlType"
1468
+ >;
1469
+
1470
+ /**
1471
+ * @public
1472
+ */
1473
+ export declare type StudioUserApplication = z.output<
1474
+ typeof StudioUserApplication
1475
+ >;
1476
+
1477
+ /**
1478
+ * @public
1479
+ */
1480
+ export declare class StudioWorkspace extends AbstractApplication<
1481
+ "workspace",
1482
+ StudioResource
1483
+ > {
1484
+ /**
1485
+ * Workspaces always belong to a studio application.
1486
+ * They do not exist on their own & therefore can access
1487
+ * information about the studio they're in via this property.
1488
+ */
1489
+ private readonly studioApplication;
1490
+ private readonly workspace;
1491
+ readonly project: Project<false, false>;
1492
+ private readonly isDefaultWorkspace;
1493
+ constructor(
1494
+ studioApplication: StudioApplication,
1495
+ workspace: Workspace,
1496
+ project: Project<false, false>,
1497
+ isDefaultWorkspace: boolean,
1498
+ );
1499
+ /**
1500
+ * The studio application that this workspace belongs to.
1501
+ */
1502
+ get studio(): StudioApplication;
1503
+ get id(): string;
1504
+ get href(): string;
1505
+ get title(): string;
1506
+ get subtitle(): string | undefined;
1507
+ get<TKey extends Exclude<keyof Workspace, "id" | "icon" | "title">>(
1508
+ attr: TKey,
1509
+ ): Workspace[TKey];
1510
+ get isFederated(): boolean;
1511
+ /**
1512
+ * With comlink, studio-applications were not considered applications at all, only workspaces. This is partially why
1513
+ * we create default workspaces when the application has no manifest or the manifest has no workspaces.
1514
+ *
1515
+ * Thereby, to create it we depend on a lot of information from the parent application even if it's duplicated across
1516
+ * different workspaces.
1517
+ */
1518
+ toProtocolResource(): StudioResource;
1519
+ /**
1520
+ * @returns the URL to the workspace of a studio application.
1521
+ */
1522
+ get url(): URL;
1523
+ static makeId(
1524
+ applicationId: UserApplicationId,
1525
+ workspaceName: string,
1526
+ ): string;
1527
+ static splitId(id: string): [string, string];
1528
+ }
1529
+
1530
+ /**
1531
+ * @public
1532
+ */
1533
+ export declare abstract class UserApplication<
1534
+ TUserApplication extends UserApplicationBase,
1535
+ TType extends Extract<AbstractApplicationType, "coreApp" | "studio">,
1536
+ TProtocolResource extends Resource = Extract<
1537
+ Resource,
1538
+ {
1539
+ type: TType;
1540
+ }
1541
+ >,
1542
+ > extends AbstractApplication<TType, TProtocolResource> {
1543
+ #private;
1544
+ readonly application: TUserApplication;
1545
+ readonly id: UserApplicationId;
1546
+ /**
1547
+ * For local applications (`isLocal === true`), the deployed application
1548
+ * that shares the same `id` — if one was passed at construction. `null`
1549
+ * for deployed applications or when no remote twin was provided.
1550
+ */
1551
+ readonly remoteApplication: this | null;
1552
+ constructor(
1553
+ application: TUserApplication,
1554
+ type: TType,
1555
+ options?: {
1556
+ isLocal?: boolean;
1557
+ remoteApplication?: UserApplication<
1558
+ TUserApplication,
1559
+ TType,
1560
+ TProtocolResource
1561
+ > | null;
1562
+ },
1563
+ );
1564
+ abstract get subtitle(): string | undefined;
1565
+ /**
1566
+ * Local dev servers are rendered as federated remotes; deployed applications
1567
+ * are rendered in an iframe.
1568
+ */
1569
+ get isFederated(): boolean;
1570
+ get isLocal(): boolean;
1571
+ /**
1572
+ * @returns A fully resolved URL instance for the application.
1573
+ * For internal applications, constructs a URL using the Sanity studio domain
1574
+ * pattern resolved from the environment at the consuming app's build time.
1575
+ * For external applications (including local dev servers), returns the
1576
+ * provided app host as a URL.
1577
+ */
1578
+ get url(): URL;
1579
+ }
1580
+
1581
+ /**
1582
+ * @public
1583
+ */
1584
+ export declare const UserApplicationBase: z.ZodObject<
1585
+ {
1586
+ id: z.core.$ZodBranded<z.ZodString, "UserApplicationId", "out">;
1587
+ appHost: z.ZodString;
1588
+ urlType: z.ZodEnum<{
1589
+ internal: "internal";
1590
+ external: "external";
1591
+ }>;
1592
+ createdAt: z.ZodString;
1593
+ updatedAt: z.ZodString;
1594
+ dashboardStatus: z.ZodEnum<{
1595
+ default: "default";
1596
+ disabled: "disabled";
1597
+ }>;
1598
+ },
1599
+ z.core.$strip
1600
+ >;
1601
+
1602
+ /**
1603
+ * @public
1604
+ */
1605
+ export declare type UserApplicationBase = z.output<typeof UserApplicationBase>;
1606
+
1607
+ /**
1608
+ * User application ID schema, branded for type safety.
1609
+ * @public
1610
+ */
1611
+ export declare const UserApplicationId: z.core.$ZodBranded<
1612
+ z.ZodString,
1613
+ "UserApplicationId",
1614
+ "out"
1615
+ >;
1616
+
1617
+ /**
1618
+ * User application ID type, branded for type safety.
1619
+ * @public
1620
+ */
1621
+ export declare type UserApplicationId = z.output<typeof UserApplicationId>;
1622
+
1623
+ /**
1624
+ * @public
1625
+ */
1626
+ export declare type Workspace = z.output<typeof Workspace_2>;
1627
+
1628
+ declare const Workspace_2: z.ZodObject<
1629
+ {
1630
+ name: z.ZodString;
1631
+ title: z.ZodString;
1632
+ subtitle: z.ZodOptional<z.ZodString>;
1633
+ basePath: z.ZodString;
1634
+ projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1635
+ dataset: z.ZodOptional<z.ZodString>;
1636
+ icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1637
+ },
1638
+ z.core.$strip
1639
+ >;
1640
+
1641
+ /**
1642
+ * @public
1643
+ */
1644
+ declare type Workspace = z.output<typeof Workspace_2>;
1645
+
1646
+ export {};