@sanity/workbench 0.1.0-alpha.19 → 0.1.0-alpha.20

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 CHANGED
@@ -1,7 +1,18 @@
1
+ import { App } from "@sanity/federation";
1
2
  import type { ApplicationResource } from "@sanity/message-protocol";
2
3
  import type { CanvasResource } from "@sanity/message-protocol";
4
+ import { Interface } from "@sanity/federation";
5
+ import { InterfaceSchema } from "@sanity/federation";
6
+ import { LocalApp } from "@sanity/federation";
7
+ import { LocalInterface } from "@sanity/federation";
8
+ import { LocalInterfaceSchema } from "@sanity/federation";
9
+ import { LocalPanel } from "@sanity/federation";
10
+ import { LocalService } from "@sanity/federation";
3
11
  import type { MediaResource } from "@sanity/message-protocol";
12
+ import { Panel } from "@sanity/federation";
13
+ import { PanelComponent } from "@sanity/federation";
4
14
  import type { Resource } from "@sanity/message-protocol";
15
+ import { Service } from "@sanity/federation";
5
16
  import type { StudioResource } from "@sanity/message-protocol";
6
17
  import { z } from "zod";
7
18
 
@@ -19,7 +30,13 @@ export declare abstract class AbstractApplication<
19
30
  > {
20
31
  readonly type: TType;
21
32
  constructor(type: TType);
22
- abstract get href(): string;
33
+ /**
34
+ * The in-app route this application navigates to, or `null` when it isn't
35
+ * navigable as a full-page app (US5 — e.g. an SDK app with no `app` view).
36
+ * The dock renders a navigable item only for a non-null `href`; the app
37
+ * routes 404 a `null`-href app on direct visit.
38
+ */
39
+ abstract get href(): string | null;
23
40
  abstract get title(): string;
24
41
  abstract get id(): string;
25
42
  /**
@@ -34,6 +51,33 @@ export declare abstract class AbstractApplication<
34
51
  */
35
52
  get isLocal(): boolean;
36
53
  abstract get url(): URL;
54
+ /**
55
+ * Interfaces the application exposes (e.g. dock panels). Defaults to none;
56
+ * user applications surface what they declared via `unstable_defineApp`.
57
+ */
58
+ get interfaces(): readonly LocalInterface[];
59
+ /**
60
+ * Whether the application has a navigable full-page `app` view (US5). Defaults
61
+ * to `true` — studios, Canvas, and Media Library are always navigable. An SDK
62
+ * app overrides this to derive it from whether it declares an `app` interface.
63
+ */
64
+ get hasAppView(): boolean;
65
+ /**
66
+ * Federation module id of the app's full-page view (`${id}/App`), or `null`
67
+ * when it can't be federation-loaded: the app isn't federated (Canvas, Media
68
+ * Library, deployed apps shown in an iframe) or has no app view. Only a
69
+ * non-null `moduleId` is fetched and rendered by the remotes machine.
70
+ */
71
+ get moduleId(): string | null;
72
+ /**
73
+ * Federation module id of one of this app's panel view components, or `null`
74
+ * when the app isn't federated (a non-federated app's panels can't be loaded
75
+ * as remotes).
76
+ */
77
+ resolveViewModuleId(
78
+ view: LocalPanel,
79
+ component: PanelComponent,
80
+ ): string | null;
37
81
  get initials(): string;
38
82
  /**
39
83
  * Converts the resource to a protocol resource that comlink expects
@@ -71,6 +115,8 @@ export declare const ActiveDeployment: z.ZodObject<
71
115
  z.core.$strip
72
116
  >;
73
117
 
118
+ export { App };
119
+
74
120
  /**
75
121
  * @public
76
122
  */
@@ -261,6 +307,8 @@ export declare const ClientManifest: z.ZodObject<
261
307
  version: z.ZodNumber;
262
308
  createdAt: z.ZodString;
263
309
  studioVersion: z.ZodOptional<z.ZodString>;
310
+ group: z.ZodOptional<z.ZodString>;
311
+ priority: z.ZodOptional<z.ZodNumber>;
264
312
  workspaces: z.ZodArray<
265
313
  z.ZodObject<
266
314
  {
@@ -317,7 +365,7 @@ export declare class CoreAppApplication extends UserApplication<
317
365
  remoteApplication?: CoreAppApplication | null;
318
366
  },
319
367
  );
320
- get href(): string;
368
+ get href(): string | null;
321
369
  get title(): string;
322
370
  /**
323
371
  * Resolves the core app's manifest from `activeDeployment.manifest`. This
@@ -359,6 +407,39 @@ declare const CoreAppUserApplication_2: z.ZodDiscriminatedUnion<
359
407
  default: "default";
360
408
  disabled: "disabled";
361
409
  }>;
410
+ interfaces: z.ZodOptional<
411
+ z.ZodArray<
412
+ z.ZodDiscriminatedUnion<
413
+ [
414
+ z.ZodObject<
415
+ {
416
+ interface_type: z.ZodLiteral<"panel">;
417
+ name: z.ZodString;
418
+ entry_point: z.ZodString;
419
+ },
420
+ z.core.$strip
421
+ >,
422
+ z.ZodObject<
423
+ {
424
+ interface_type: z.ZodLiteral<"worker">;
425
+ name: z.ZodString;
426
+ entry_point: z.ZodString;
427
+ },
428
+ z.core.$strip
429
+ >,
430
+ z.ZodObject<
431
+ {
432
+ interface_type: z.ZodLiteral<"app">;
433
+ name: z.ZodString;
434
+ entry_point: z.ZodString;
435
+ },
436
+ z.core.$strip
437
+ >,
438
+ ],
439
+ "interface_type"
440
+ >
441
+ >
442
+ >;
362
443
  title: z.ZodString;
363
444
  organizationId: z.core.$ZodBranded<
364
445
  z.ZodString,
@@ -386,6 +467,8 @@ declare const CoreAppUserApplication_2: z.ZodDiscriminatedUnion<
386
467
  version: z.ZodString;
387
468
  icon: z.ZodOptional<z.ZodString>;
388
469
  title: z.ZodOptional<z.ZodString>;
470
+ group: z.ZodOptional<z.ZodString>;
471
+ priority: z.ZodOptional<z.ZodNumber>;
389
472
  },
390
473
  z.core.$strip
391
474
  >
@@ -407,6 +490,39 @@ declare const CoreAppUserApplication_2: z.ZodDiscriminatedUnion<
407
490
  default: "default";
408
491
  disabled: "disabled";
409
492
  }>;
493
+ interfaces: z.ZodOptional<
494
+ z.ZodArray<
495
+ z.ZodDiscriminatedUnion<
496
+ [
497
+ z.ZodObject<
498
+ {
499
+ interface_type: z.ZodLiteral<"panel">;
500
+ name: z.ZodString;
501
+ entry_point: z.ZodString;
502
+ },
503
+ z.core.$strip
504
+ >,
505
+ z.ZodObject<
506
+ {
507
+ interface_type: z.ZodLiteral<"worker">;
508
+ name: z.ZodString;
509
+ entry_point: z.ZodString;
510
+ },
511
+ z.core.$strip
512
+ >,
513
+ z.ZodObject<
514
+ {
515
+ interface_type: z.ZodLiteral<"app">;
516
+ name: z.ZodString;
517
+ entry_point: z.ZodString;
518
+ },
519
+ z.core.$strip
520
+ >,
521
+ ],
522
+ "interface_type"
523
+ >
524
+ >
525
+ >;
410
526
  title: z.ZodString;
411
527
  organizationId: z.core.$ZodBranded<
412
528
  z.ZodString,
@@ -434,6 +550,8 @@ declare const CoreAppUserApplication_2: z.ZodDiscriminatedUnion<
434
550
  version: z.ZodString;
435
551
  icon: z.ZodOptional<z.ZodString>;
436
552
  title: z.ZodOptional<z.ZodString>;
553
+ group: z.ZodOptional<z.ZodString>;
554
+ priority: z.ZodOptional<z.ZodNumber>;
437
555
  },
438
556
  z.core.$strip
439
557
  >
@@ -462,6 +580,8 @@ export declare const CoreAppUserApplicationManifest: z.ZodObject<
462
580
  version: z.ZodString;
463
581
  icon: z.ZodOptional<z.ZodString>;
464
582
  title: z.ZodOptional<z.ZodString>;
583
+ group: z.ZodOptional<z.ZodString>;
584
+ priority: z.ZodOptional<z.ZodNumber>;
465
585
  },
466
586
  z.core.$strip
467
587
  >;
@@ -534,6 +654,10 @@ export declare function getSanityDomain(): string;
534
654
  */
535
655
  export declare function getSanityEnv(): "staging" | "production";
536
656
 
657
+ export { Interface };
658
+
659
+ export { InterfaceSchema };
660
+
537
661
  /**
538
662
  * Joins multiple path segments into a single path string.
539
663
  * Handles null, undefined, and URL objects gracefully.
@@ -546,6 +670,16 @@ export declare const joinUrlPaths: (
546
670
  ...paths: Array<string | URL | null | undefined>
547
671
  ) => string;
548
672
 
673
+ export { LocalApp };
674
+
675
+ export { LocalInterface };
676
+
677
+ export { LocalInterfaceSchema };
678
+
679
+ export { LocalPanel };
680
+
681
+ export { LocalService };
682
+
549
683
  /**
550
684
  * Raw data for a local application discovered by the CLI dev server.
551
685
  *
@@ -565,6 +699,39 @@ export declare const LocalUserApplication: z.ZodDiscriminatedUnion<
565
699
  {
566
700
  host: z.ZodString;
567
701
  port: z.ZodNumber;
702
+ interfaces: z.ZodOptional<
703
+ z.ZodArray<
704
+ z.ZodDiscriminatedUnion<
705
+ [
706
+ z.ZodObject<
707
+ {
708
+ interface_type: z.ZodLiteral<"panel">;
709
+ name: z.ZodString;
710
+ entry_point: z.ZodString;
711
+ },
712
+ z.core.$strip
713
+ >,
714
+ z.ZodObject<
715
+ {
716
+ interface_type: z.ZodLiteral<"worker">;
717
+ name: z.ZodString;
718
+ entry_point: z.ZodString;
719
+ },
720
+ z.core.$strip
721
+ >,
722
+ z.ZodObject<
723
+ {
724
+ interface_type: z.ZodLiteral<"app">;
725
+ name: z.ZodString;
726
+ entry_point: z.ZodString;
727
+ },
728
+ z.core.$strip
729
+ >,
730
+ ],
731
+ "interface_type"
732
+ >
733
+ >
734
+ >;
568
735
  id: z.ZodOptional<z.ZodString>;
569
736
  projectId: z.ZodOptional<z.ZodString>;
570
737
  type: z.ZodLiteral<"studio">;
@@ -585,6 +752,8 @@ export declare const LocalUserApplication: z.ZodDiscriminatedUnion<
585
752
  tools?: string | undefined;
586
753
  }[];
587
754
  studioVersion?: string | undefined;
755
+ group?: string | undefined;
756
+ priority?: number | undefined;
588
757
  },
589
758
  {
590
759
  version: number;
@@ -601,6 +770,8 @@ export declare const LocalUserApplication: z.ZodDiscriminatedUnion<
601
770
  tools?: string | undefined;
602
771
  }[];
603
772
  studioVersion?: string | undefined;
773
+ group?: string | undefined;
774
+ priority?: number | undefined;
604
775
  }
605
776
  >
606
777
  >;
@@ -611,6 +782,39 @@ export declare const LocalUserApplication: z.ZodDiscriminatedUnion<
611
782
  {
612
783
  host: z.ZodString;
613
784
  port: z.ZodNumber;
785
+ interfaces: z.ZodOptional<
786
+ z.ZodArray<
787
+ z.ZodDiscriminatedUnion<
788
+ [
789
+ z.ZodObject<
790
+ {
791
+ interface_type: z.ZodLiteral<"panel">;
792
+ name: z.ZodString;
793
+ entry_point: z.ZodString;
794
+ },
795
+ z.core.$strip
796
+ >,
797
+ z.ZodObject<
798
+ {
799
+ interface_type: z.ZodLiteral<"worker">;
800
+ name: z.ZodString;
801
+ entry_point: z.ZodString;
802
+ },
803
+ z.core.$strip
804
+ >,
805
+ z.ZodObject<
806
+ {
807
+ interface_type: z.ZodLiteral<"app">;
808
+ name: z.ZodString;
809
+ entry_point: z.ZodString;
810
+ },
811
+ z.core.$strip
812
+ >,
813
+ ],
814
+ "interface_type"
815
+ >
816
+ >
817
+ >;
614
818
  id: z.ZodOptional<z.ZodString>;
615
819
  projectId: z.ZodOptional<z.ZodString>;
616
820
  type: z.ZodLiteral<"coreApp">;
@@ -620,11 +824,15 @@ export declare const LocalUserApplication: z.ZodDiscriminatedUnion<
620
824
  version: string;
621
825
  icon?: string | undefined;
622
826
  title?: string | undefined;
827
+ group?: string | undefined;
828
+ priority?: number | undefined;
623
829
  },
624
830
  {
625
831
  version: string;
626
832
  icon?: string | undefined;
627
833
  title?: string | undefined;
834
+ group?: string | undefined;
835
+ priority?: number | undefined;
628
836
  }
629
837
  >
630
838
  >;
@@ -862,6 +1070,10 @@ declare const OrganizationMember_2: z.ZodObject<
862
1070
  */
863
1071
  declare type OrganizationMember = z.output<typeof OrganizationMember_2>;
864
1072
 
1073
+ export { Panel };
1074
+
1075
+ export { PanelComponent };
1076
+
865
1077
  /**
866
1078
  * Validates and parses a raw API response into a branded
867
1079
  * Canvas.
@@ -1057,6 +1269,8 @@ export declare const ServerManifest: z.ZodObject<
1057
1269
  buildId: z.ZodOptional<z.ZodString>;
1058
1270
  bundleVersion: z.ZodOptional<z.ZodString>;
1059
1271
  version: z.ZodOptional<z.ZodString>;
1272
+ group: z.ZodOptional<z.ZodString>;
1273
+ priority: z.ZodOptional<z.ZodNumber>;
1060
1274
  workspaces: z.ZodOptional<
1061
1275
  z.ZodArray<
1062
1276
  z.ZodObject<
@@ -1083,6 +1297,8 @@ export declare const ServerManifest: z.ZodObject<
1083
1297
  */
1084
1298
  export declare type ServerManifest = z.output<typeof ServerManifest>;
1085
1299
 
1300
+ export { Service };
1301
+
1086
1302
  /**
1087
1303
  * @public
1088
1304
  */
@@ -1268,6 +1484,39 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1268
1484
  default: "default";
1269
1485
  disabled: "disabled";
1270
1486
  }>;
1487
+ interfaces: z.ZodOptional<
1488
+ z.ZodArray<
1489
+ z.ZodDiscriminatedUnion<
1490
+ [
1491
+ z.ZodObject<
1492
+ {
1493
+ interface_type: z.ZodLiteral<"panel">;
1494
+ name: z.ZodString;
1495
+ entry_point: z.ZodString;
1496
+ },
1497
+ z.core.$strip
1498
+ >,
1499
+ z.ZodObject<
1500
+ {
1501
+ interface_type: z.ZodLiteral<"worker">;
1502
+ name: z.ZodString;
1503
+ entry_point: z.ZodString;
1504
+ },
1505
+ z.core.$strip
1506
+ >,
1507
+ z.ZodObject<
1508
+ {
1509
+ interface_type: z.ZodLiteral<"app">;
1510
+ name: z.ZodString;
1511
+ entry_point: z.ZodString;
1512
+ },
1513
+ z.core.$strip
1514
+ >,
1515
+ ],
1516
+ "interface_type"
1517
+ >
1518
+ >
1519
+ >;
1271
1520
  title: z.ZodNullable<z.ZodString>;
1272
1521
  projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1273
1522
  type: z.ZodLiteral<"studio">;
@@ -1277,6 +1526,8 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1277
1526
  version: z.ZodNumber;
1278
1527
  createdAt: z.ZodString;
1279
1528
  studioVersion: z.ZodOptional<z.ZodString>;
1529
+ group: z.ZodOptional<z.ZodString>;
1530
+ priority: z.ZodOptional<z.ZodNumber>;
1280
1531
  workspaces: z.ZodArray<
1281
1532
  z.ZodObject<
1282
1533
  {
@@ -1309,6 +1560,8 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1309
1560
  version: z.ZodNumber;
1310
1561
  createdAt: z.ZodString;
1311
1562
  studioVersion: z.ZodOptional<z.ZodString>;
1563
+ group: z.ZodOptional<z.ZodString>;
1564
+ priority: z.ZodOptional<z.ZodNumber>;
1312
1565
  workspaces: z.ZodArray<
1313
1566
  z.ZodObject<
1314
1567
  {
@@ -1350,6 +1603,8 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1350
1603
  buildId: z.ZodOptional<z.ZodString>;
1351
1604
  bundleVersion: z.ZodOptional<z.ZodString>;
1352
1605
  version: z.ZodOptional<z.ZodString>;
1606
+ group: z.ZodOptional<z.ZodString>;
1607
+ priority: z.ZodOptional<z.ZodNumber>;
1353
1608
  workspaces: z.ZodOptional<
1354
1609
  z.ZodArray<
1355
1610
  z.ZodObject<
@@ -1401,6 +1656,8 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1401
1656
  buildId: z.ZodOptional<z.ZodString>;
1402
1657
  bundleVersion: z.ZodOptional<z.ZodString>;
1403
1658
  version: z.ZodOptional<z.ZodString>;
1659
+ group: z.ZodOptional<z.ZodString>;
1660
+ priority: z.ZodOptional<z.ZodNumber>;
1404
1661
  workspaces: z.ZodOptional<
1405
1662
  z.ZodArray<
1406
1663
  z.ZodObject<
@@ -1443,6 +1700,39 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1443
1700
  default: "default";
1444
1701
  disabled: "disabled";
1445
1702
  }>;
1703
+ interfaces: z.ZodOptional<
1704
+ z.ZodArray<
1705
+ z.ZodDiscriminatedUnion<
1706
+ [
1707
+ z.ZodObject<
1708
+ {
1709
+ interface_type: z.ZodLiteral<"panel">;
1710
+ name: z.ZodString;
1711
+ entry_point: z.ZodString;
1712
+ },
1713
+ z.core.$strip
1714
+ >,
1715
+ z.ZodObject<
1716
+ {
1717
+ interface_type: z.ZodLiteral<"worker">;
1718
+ name: z.ZodString;
1719
+ entry_point: z.ZodString;
1720
+ },
1721
+ z.core.$strip
1722
+ >,
1723
+ z.ZodObject<
1724
+ {
1725
+ interface_type: z.ZodLiteral<"app">;
1726
+ name: z.ZodString;
1727
+ entry_point: z.ZodString;
1728
+ },
1729
+ z.core.$strip
1730
+ >,
1731
+ ],
1732
+ "interface_type"
1733
+ >
1734
+ >
1735
+ >;
1446
1736
  title: z.ZodNullable<z.ZodString>;
1447
1737
  projectId: z.core.$ZodBranded<z.ZodString, "ProjectId", "out">;
1448
1738
  type: z.ZodLiteral<"studio">;
@@ -1452,6 +1742,8 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1452
1742
  version: z.ZodNumber;
1453
1743
  createdAt: z.ZodString;
1454
1744
  studioVersion: z.ZodOptional<z.ZodString>;
1745
+ group: z.ZodOptional<z.ZodString>;
1746
+ priority: z.ZodOptional<z.ZodNumber>;
1455
1747
  workspaces: z.ZodArray<
1456
1748
  z.ZodObject<
1457
1749
  {
@@ -1484,6 +1776,8 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1484
1776
  version: z.ZodNumber;
1485
1777
  createdAt: z.ZodString;
1486
1778
  studioVersion: z.ZodOptional<z.ZodString>;
1779
+ group: z.ZodOptional<z.ZodString>;
1780
+ priority: z.ZodOptional<z.ZodNumber>;
1487
1781
  workspaces: z.ZodArray<
1488
1782
  z.ZodObject<
1489
1783
  {
@@ -1525,6 +1819,8 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1525
1819
  buildId: z.ZodOptional<z.ZodString>;
1526
1820
  bundleVersion: z.ZodOptional<z.ZodString>;
1527
1821
  version: z.ZodOptional<z.ZodString>;
1822
+ group: z.ZodOptional<z.ZodString>;
1823
+ priority: z.ZodOptional<z.ZodNumber>;
1528
1824
  workspaces: z.ZodOptional<
1529
1825
  z.ZodArray<
1530
1826
  z.ZodObject<
@@ -1576,6 +1872,8 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
1576
1872
  buildId: z.ZodOptional<z.ZodString>;
1577
1873
  bundleVersion: z.ZodOptional<z.ZodString>;
1578
1874
  version: z.ZodOptional<z.ZodString>;
1875
+ group: z.ZodOptional<z.ZodString>;
1876
+ priority: z.ZodOptional<z.ZodNumber>;
1579
1877
  workspaces: z.ZodOptional<
1580
1878
  z.ZodArray<
1581
1879
  z.ZodObject<
@@ -1713,6 +2011,7 @@ export declare abstract class UserApplication<
1713
2011
  */
1714
2012
  get isFederated(): boolean;
1715
2013
  get isLocal(): boolean;
2014
+ get interfaces(): readonly LocalInterface[];
1716
2015
  /**
1717
2016
  * @returns A fully resolved URL instance for the application.
1718
2017
  * For internal applications, constructs a URL using the Sanity studio domain
@@ -1755,6 +2054,39 @@ export declare const UserApplicationBase: z.ZodObject<
1755
2054
  default: "default";
1756
2055
  disabled: "disabled";
1757
2056
  }>;
2057
+ interfaces: z.ZodOptional<
2058
+ z.ZodArray<
2059
+ z.ZodDiscriminatedUnion<
2060
+ [
2061
+ z.ZodObject<
2062
+ {
2063
+ interface_type: z.ZodLiteral<"panel">;
2064
+ name: z.ZodString;
2065
+ entry_point: z.ZodString;
2066
+ },
2067
+ z.core.$strip
2068
+ >,
2069
+ z.ZodObject<
2070
+ {
2071
+ interface_type: z.ZodLiteral<"worker">;
2072
+ name: z.ZodString;
2073
+ entry_point: z.ZodString;
2074
+ },
2075
+ z.core.$strip
2076
+ >,
2077
+ z.ZodObject<
2078
+ {
2079
+ interface_type: z.ZodLiteral<"app">;
2080
+ name: z.ZodString;
2081
+ entry_point: z.ZodString;
2082
+ },
2083
+ z.core.$strip
2084
+ >,
2085
+ ],
2086
+ "interface_type"
2087
+ >
2088
+ >
2089
+ >;
1758
2090
  },
1759
2091
  z.core.$strip
1760
2092
  >;
package/dist/core.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AbstractApplication, ActiveDeployment, CanvasApplication, ClientManifest, CoreAppApplication, CoreAppUserApplicationManifest, LocalUserApplication, MediaLibraryApplication, Organization, OrganizationId, Project, ProjectId, ServerManifest, StudioApplication, StudioUserApplication, StudioWorkspace, UserApplication, UserApplicationBase, UserApplicationId, brandCanvasId, brandMediaLibraryId, brandOrganizationId, brandProjectId, brandUserApplicationId, getApiHost, getSanityDomain, getSanityEnv, joinUrlPaths, parseCanvas, parseCoreApplication, parseMediaLibrary, parseOrganization, parseProject, parseStudioUserApplication } from "./_chunks-es/studio.js";
2
2
  import { createLogger, logger } from "./_chunks-es/index.js";
3
+ import { InterfaceSchema, LocalInterfaceSchema } from "@sanity/federation";
3
4
  class ApplicationList {
4
5
  applications;
5
6
  /**
@@ -38,6 +39,8 @@ export {
38
39
  ClientManifest,
39
40
  CoreAppApplication,
40
41
  CoreAppUserApplicationManifest,
42
+ InterfaceSchema,
43
+ LocalInterfaceSchema,
41
44
  LocalUserApplication,
42
45
  MediaLibraryApplication,
43
46
  Organization,
package/dist/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sources":["../src/core/applications/application-list.ts"],"sourcesContent":["import type { Resource as ProtocolResource } from \"@sanity/message-protocol\";\n\nimport type { CanvasApplication } from \"../canvases\";\nimport type { MediaLibraryApplication } from \"../media-libraries\";\nimport type { CoreAppApplication } from \"../user-applications/core-app\";\nimport type {\n StudioApplication,\n StudioWorkspace,\n} from \"../user-applications/studios\";\nimport type { UserApplicationId } from \"../user-applications/user-application\";\n\n/**\n * @public\n */\nexport type Application =\n | CoreAppApplication\n | StudioApplication\n | StudioWorkspace\n | CanvasApplication\n | MediaLibraryApplication;\n\n/**\n * @public\n */\nexport class ApplicationList<TApplication extends Application = Application> {\n readonly applications: TApplication[];\n\n /**\n * @param applications - The applications to initialize the list with.\n */\n constructor(applications: TApplication[]) {\n this.applications = [...applications];\n }\n\n findApplicationsByType<T extends TApplication[\"type\"]>(\n type: T,\n ): Extract<TApplication, { type: T }>[];\n findApplicationsByType<T extends TApplication[\"type\"][]>(\n types: T,\n ): Extract<TApplication, { type: T[number] }>[];\n findApplicationsByType(\n _type: TApplication[\"type\"] | TApplication[\"type\"][],\n ): TApplication[] {\n const types = Array.isArray(_type) ? _type : [_type];\n\n return this.applications.filter((r) => types.includes(r.type));\n }\n\n findApplication(\n type: \"media-library\",\n ): Extract<TApplication, { type: \"media-library\" }> | undefined;\n findApplication(\n type: \"canvas\",\n ): Extract<TApplication, { type: \"canvas\" }> | undefined;\n findApplication(\n type: \"coreApp\",\n id: UserApplicationId,\n ): Extract<TApplication, { type: \"coreApp\" }> | undefined;\n findApplication(\n type: \"studio\",\n id: UserApplicationId,\n ): Extract<TApplication, { type: \"studio\" }> | undefined;\n findApplication(\n type: \"workspace\",\n id: string,\n ): Extract<TApplication, { type: \"workspace\" }> | undefined;\n findApplication(\n type: TApplication[\"type\"],\n id?: UserApplicationId | string,\n ): TApplication | undefined {\n switch (type) {\n case \"media-library\":\n case \"canvas\":\n return this.applications.find((r) => r.type === type);\n case \"coreApp\":\n case \"studio\":\n case \"workspace\": {\n return this.applications.find((r) => r.type === type && r.id === id);\n }\n }\n }\n\n toProtocolResources() {\n return this.applications.reduce<ProtocolResource[]>((acc, r) => {\n if (r.type === \"studio\" || r.isLocal) return acc;\n return [...acc, r.toProtocolResource()];\n }, []);\n }\n\n static areApplicationsEqual(\n application1?: Application,\n application2?: Application,\n ): boolean {\n if (\n !application1 ||\n !application2 ||\n application1.type !== application2.type\n ) {\n return false;\n }\n\n return application1.id === application2.id;\n }\n}\n"],"names":[],"mappings":";;AAwBO,MAAM,gBAAgE;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA,EAKT,YAAY,cAA8B;AACxC,SAAK,eAAe,CAAC,GAAG,YAAY;AAAA,EACtC;AAAA,EAQA,uBACE,OACgB;AAChB,UAAM,QAAQ,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AAEnD,WAAO,KAAK,aAAa,OAAO,CAAC,MAAM,MAAM,SAAS,EAAE,IAAI,CAAC;AAAA,EAC/D;AAAA,EAoBA,gBACE,MACA,IAC0B;AAC1B,YAAQ,MAAA;AAAA,MACN,KAAK;AAAA,MACL,KAAK;AACH,eAAO,KAAK,aAAa,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AAAA,MACtD,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,eAAO,KAAK,aAAa,KAAK,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,OAAO,EAAE;AAAA,IAAA;AAAA,EAGzE;AAAA,EAEA,sBAAsB;AACpB,WAAO,KAAK,aAAa,OAA2B,CAAC,KAAK,MACpD,EAAE,SAAS,YAAY,EAAE,UAAgB,MACtC,CAAC,GAAG,KAAK,EAAE,oBAAoB,GACrC,EAAE;AAAA,EACP;AAAA,EAEA,OAAO,qBACL,cACA,cACS;AACT,WACE,CAAC,gBACD,CAAC,gBACD,aAAa,SAAS,aAAa,OAE5B,KAGF,aAAa,OAAO,aAAa;AAAA,EAC1C;AACF;"}
1
+ {"version":3,"file":"core.js","sources":["../src/core/applications/application-list.ts"],"sourcesContent":["import type { Resource as ProtocolResource } from \"@sanity/message-protocol\";\n\nimport type { CanvasApplication } from \"../canvases\";\nimport type { MediaLibraryApplication } from \"../media-libraries\";\nimport type { CoreAppApplication } from \"../user-applications/core-app\";\nimport type {\n StudioApplication,\n StudioWorkspace,\n} from \"../user-applications/studios\";\nimport type { UserApplicationId } from \"../user-applications/user-application\";\n\n/**\n * @public\n */\nexport type Application =\n | CoreAppApplication\n | StudioApplication\n | StudioWorkspace\n | CanvasApplication\n | MediaLibraryApplication;\n\n/**\n * @public\n */\nexport class ApplicationList<TApplication extends Application = Application> {\n readonly applications: TApplication[];\n\n /**\n * @param applications - The applications to initialize the list with.\n */\n constructor(applications: TApplication[]) {\n this.applications = [...applications];\n }\n\n findApplicationsByType<T extends TApplication[\"type\"]>(\n type: T,\n ): Extract<TApplication, { type: T }>[];\n findApplicationsByType<T extends TApplication[\"type\"][]>(\n types: T,\n ): Extract<TApplication, { type: T[number] }>[];\n findApplicationsByType(\n _type: TApplication[\"type\"] | TApplication[\"type\"][],\n ): TApplication[] {\n const types = Array.isArray(_type) ? _type : [_type];\n\n return this.applications.filter((r) => types.includes(r.type));\n }\n\n findApplication(\n type: \"media-library\",\n ): Extract<TApplication, { type: \"media-library\" }> | undefined;\n findApplication(\n type: \"canvas\",\n ): Extract<TApplication, { type: \"canvas\" }> | undefined;\n findApplication(\n type: \"coreApp\",\n id: UserApplicationId,\n ): Extract<TApplication, { type: \"coreApp\" }> | undefined;\n findApplication(\n type: \"studio\",\n id: UserApplicationId,\n ): Extract<TApplication, { type: \"studio\" }> | undefined;\n findApplication(\n type: \"workspace\",\n id: string,\n ): Extract<TApplication, { type: \"workspace\" }> | undefined;\n findApplication(\n type: TApplication[\"type\"],\n id?: UserApplicationId | string,\n ): TApplication | undefined {\n switch (type) {\n case \"media-library\":\n case \"canvas\":\n return this.applications.find((r) => r.type === type);\n case \"coreApp\":\n case \"studio\":\n case \"workspace\": {\n return this.applications.find((r) => r.type === type && r.id === id);\n }\n }\n }\n\n toProtocolResources() {\n return this.applications.reduce<ProtocolResource[]>((acc, r) => {\n if (r.type === \"studio\" || r.isLocal) return acc;\n return [...acc, r.toProtocolResource()];\n }, []);\n }\n\n static areApplicationsEqual(\n application1?: Application,\n application2?: Application,\n ): boolean {\n if (\n !application1 ||\n !application2 ||\n application1.type !== application2.type\n ) {\n return false;\n }\n\n return application1.id === application2.id;\n }\n}\n"],"names":[],"mappings":";;;AAwBO,MAAM,gBAAgE;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA,EAKT,YAAY,cAA8B;AACxC,SAAK,eAAe,CAAC,GAAG,YAAY;AAAA,EACtC;AAAA,EAQA,uBACE,OACgB;AAChB,UAAM,QAAQ,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AAEnD,WAAO,KAAK,aAAa,OAAO,CAAC,MAAM,MAAM,SAAS,EAAE,IAAI,CAAC;AAAA,EAC/D;AAAA,EAoBA,gBACE,MACA,IAC0B;AAC1B,YAAQ,MAAA;AAAA,MACN,KAAK;AAAA,MACL,KAAK;AACH,eAAO,KAAK,aAAa,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AAAA,MACtD,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,eAAO,KAAK,aAAa,KAAK,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,OAAO,EAAE;AAAA,IAAA;AAAA,EAGzE;AAAA,EAEA,sBAAsB;AACpB,WAAO,KAAK,aAAa,OAA2B,CAAC,KAAK,MACpD,EAAE,SAAS,YAAY,EAAE,UAAgB,MACtC,CAAC,GAAG,KAAK,EAAE,oBAAoB,GACrC,EAAE;AAAA,EACP;AAAA,EAEA,OAAO,qBACL,cACA,cACS;AACT,WACE,CAAC,gBACD,CAAC,gBACD,aAAa,SAAS,aAAa,OAE5B,KAGF,aAAa,OAAO,aAAa;AAAA,EAC1C;AACF;"}