@sanity/workbench 0.1.0-alpha.20 → 0.1.0-alpha.22
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/_chunks-es/module-federation.js +59 -0
- package/dist/_chunks-es/module-federation.js.map +1 -0
- package/dist/_chunks-es/studio.js +35 -7
- package/dist/_chunks-es/studio.js.map +1 -1
- package/dist/_internal.js +1 -2
- package/dist/_internal.js.map +1 -1
- package/dist/core.d.ts +168 -56
- package/dist/core.js +1 -2
- package/dist/core.js.map +1 -1
- package/dist/system.d.ts +16 -1
- package/dist/system.js +1 -2
- package/dist/system.js.map +1 -1
- package/package.json +6 -5
- package/src/_internal/render.ts +1 -2
- package/src/core/applications/application.ts +12 -9
- package/src/core/applications/interface.ts +126 -0
- package/src/core/projects.ts +1 -1
- package/src/core/user-applications/core-app.ts +1 -1
- package/src/core/user-applications/studios/workspace.ts +5 -1
- package/src/core/user-applications/user-application.ts +2 -2
- package/src/system/load-federated-module.ts +1 -2
- package/src/system/module-federation.ts +116 -0
- package/src/system/remote.machine.ts +1 -1
- package/src/system/remotes.machine.ts +1 -1
- package/src/system/root.machine.ts +5 -5
- package/src/system/service.machine.ts +1 -1
- package/src/system/services.machine.ts +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import { App } from "@sanity/federation";
|
|
2
1
|
import type { ApplicationResource } from "@sanity/message-protocol";
|
|
3
2
|
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";
|
|
11
3
|
import type { MediaResource } from "@sanity/message-protocol";
|
|
12
|
-
import { Panel } from "@sanity/federation";
|
|
13
|
-
import { PanelComponent } from "@sanity/federation";
|
|
14
4
|
import type { Resource } from "@sanity/message-protocol";
|
|
15
|
-
import { Service } from "@sanity/federation";
|
|
16
5
|
import type { StudioResource } from "@sanity/message-protocol";
|
|
17
6
|
import { z } from "zod";
|
|
18
7
|
|
|
@@ -32,7 +21,7 @@ export declare abstract class AbstractApplication<
|
|
|
32
21
|
constructor(type: TType);
|
|
33
22
|
/**
|
|
34
23
|
* 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).
|
|
24
|
+
* navigable as a full-page app (US5, spec 002-workbench-extension-api — e.g. an SDK app with no `app` view).
|
|
36
25
|
* The dock renders a navigable item only for a non-null `href`; the app
|
|
37
26
|
* routes 404 a `null`-href app on direct visit.
|
|
38
27
|
*/
|
|
@@ -57,7 +46,7 @@ export declare abstract class AbstractApplication<
|
|
|
57
46
|
*/
|
|
58
47
|
get interfaces(): readonly LocalInterface[];
|
|
59
48
|
/**
|
|
60
|
-
* Whether the application has a navigable full-page `app` view (US5). Defaults
|
|
49
|
+
* Whether the application has a navigable full-page `app` view (US5, spec 002-workbench-extension-api). Defaults
|
|
61
50
|
* to `true` — studios, Canvas, and Media Library are always navigable. An SDK
|
|
62
51
|
* app overrides this to derive it from whether it declares an `app` interface.
|
|
63
52
|
*/
|
|
@@ -105,8 +94,8 @@ export declare const ActiveDeployment: z.ZodObject<
|
|
|
105
94
|
version: z.ZodString;
|
|
106
95
|
isActiveDeployment: z.ZodBoolean;
|
|
107
96
|
userApplicationId: z.ZodString;
|
|
108
|
-
isAutoUpdating: z.ZodBoolean
|
|
109
|
-
size: z.ZodNumber
|
|
97
|
+
isAutoUpdating: z.ZodNullable<z.ZodBoolean>;
|
|
98
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
110
99
|
deployedAt: z.ZodString;
|
|
111
100
|
deployedBy: z.ZodString;
|
|
112
101
|
createdAt: z.ZodString;
|
|
@@ -115,7 +104,12 @@ export declare const ActiveDeployment: z.ZodObject<
|
|
|
115
104
|
z.core.$strip
|
|
116
105
|
>;
|
|
117
106
|
|
|
118
|
-
|
|
107
|
+
/**
|
|
108
|
+
* The navigable full-page view — its presence is the sole signal a branded app
|
|
109
|
+
* is navigable (US5, spec 002-workbench-extension-api).
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
export declare type App = InterfaceOfType<"app">;
|
|
119
113
|
|
|
120
114
|
/**
|
|
121
115
|
* @public
|
|
@@ -413,24 +407,24 @@ declare const CoreAppUserApplication_2: z.ZodDiscriminatedUnion<
|
|
|
413
407
|
[
|
|
414
408
|
z.ZodObject<
|
|
415
409
|
{
|
|
416
|
-
interface_type: z.ZodLiteral<"panel">;
|
|
417
410
|
name: z.ZodString;
|
|
411
|
+
interface_type: z.ZodLiteral<"panel">;
|
|
418
412
|
entry_point: z.ZodString;
|
|
419
413
|
},
|
|
420
414
|
z.core.$strip
|
|
421
415
|
>,
|
|
422
416
|
z.ZodObject<
|
|
423
417
|
{
|
|
424
|
-
interface_type: z.ZodLiteral<"worker">;
|
|
425
418
|
name: z.ZodString;
|
|
419
|
+
interface_type: z.ZodLiteral<"worker">;
|
|
426
420
|
entry_point: z.ZodString;
|
|
427
421
|
},
|
|
428
422
|
z.core.$strip
|
|
429
423
|
>,
|
|
430
424
|
z.ZodObject<
|
|
431
425
|
{
|
|
432
|
-
interface_type: z.ZodLiteral<"app">;
|
|
433
426
|
name: z.ZodString;
|
|
427
|
+
interface_type: z.ZodLiteral<"app">;
|
|
434
428
|
entry_point: z.ZodString;
|
|
435
429
|
},
|
|
436
430
|
z.core.$strip
|
|
@@ -455,8 +449,8 @@ declare const CoreAppUserApplication_2: z.ZodDiscriminatedUnion<
|
|
|
455
449
|
version: z.ZodString;
|
|
456
450
|
isActiveDeployment: z.ZodBoolean;
|
|
457
451
|
userApplicationId: z.ZodString;
|
|
458
|
-
isAutoUpdating: z.ZodBoolean
|
|
459
|
-
size: z.ZodNumber
|
|
452
|
+
isAutoUpdating: z.ZodNullable<z.ZodBoolean>;
|
|
453
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
460
454
|
deployedAt: z.ZodString;
|
|
461
455
|
deployedBy: z.ZodString;
|
|
462
456
|
createdAt: z.ZodString;
|
|
@@ -496,24 +490,24 @@ declare const CoreAppUserApplication_2: z.ZodDiscriminatedUnion<
|
|
|
496
490
|
[
|
|
497
491
|
z.ZodObject<
|
|
498
492
|
{
|
|
499
|
-
interface_type: z.ZodLiteral<"panel">;
|
|
500
493
|
name: z.ZodString;
|
|
494
|
+
interface_type: z.ZodLiteral<"panel">;
|
|
501
495
|
entry_point: z.ZodString;
|
|
502
496
|
},
|
|
503
497
|
z.core.$strip
|
|
504
498
|
>,
|
|
505
499
|
z.ZodObject<
|
|
506
500
|
{
|
|
507
|
-
interface_type: z.ZodLiteral<"worker">;
|
|
508
501
|
name: z.ZodString;
|
|
502
|
+
interface_type: z.ZodLiteral<"worker">;
|
|
509
503
|
entry_point: z.ZodString;
|
|
510
504
|
},
|
|
511
505
|
z.core.$strip
|
|
512
506
|
>,
|
|
513
507
|
z.ZodObject<
|
|
514
508
|
{
|
|
515
|
-
interface_type: z.ZodLiteral<"app">;
|
|
516
509
|
name: z.ZodString;
|
|
510
|
+
interface_type: z.ZodLiteral<"app">;
|
|
517
511
|
entry_point: z.ZodString;
|
|
518
512
|
},
|
|
519
513
|
z.core.$strip
|
|
@@ -538,8 +532,8 @@ declare const CoreAppUserApplication_2: z.ZodDiscriminatedUnion<
|
|
|
538
532
|
version: z.ZodString;
|
|
539
533
|
isActiveDeployment: z.ZodBoolean;
|
|
540
534
|
userApplicationId: z.ZodString;
|
|
541
|
-
isAutoUpdating: z.ZodBoolean
|
|
542
|
-
size: z.ZodNumber
|
|
535
|
+
isAutoUpdating: z.ZodNullable<z.ZodBoolean>;
|
|
536
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
543
537
|
deployedAt: z.ZodString;
|
|
544
538
|
deployedBy: z.ZodString;
|
|
545
539
|
createdAt: z.ZodString;
|
|
@@ -627,6 +621,17 @@ export declare function createLogger({
|
|
|
627
621
|
logLevel,
|
|
628
622
|
}?: LoggerOptions): Logger;
|
|
629
623
|
|
|
624
|
+
/**
|
|
625
|
+
* Where an application docks. The manifest's `group` value the workbench reads
|
|
626
|
+
* to place an app in the dock; the authoring counterpart that validates it on
|
|
627
|
+
* `unstable_defineApp` lives with the CLI define helpers.
|
|
628
|
+
* @public
|
|
629
|
+
*/
|
|
630
|
+
export declare type DockGroup =
|
|
631
|
+
| "dock.system"
|
|
632
|
+
| "dock.applications"
|
|
633
|
+
| "dock.user";
|
|
634
|
+
|
|
630
635
|
/**
|
|
631
636
|
* Returns the API host based on the `__SANITY_STAGING__` runtime-time flag.
|
|
632
637
|
* If the flag is set to `true`, the staging API host is returned.
|
|
@@ -654,9 +659,58 @@ export declare function getSanityDomain(): string;
|
|
|
654
659
|
*/
|
|
655
660
|
export declare function getSanityEnv(): "staging" | "production";
|
|
656
661
|
|
|
657
|
-
|
|
662
|
+
/** @public */
|
|
663
|
+
export declare type Interface = z.output<typeof InterfaceSchema>;
|
|
658
664
|
|
|
659
|
-
|
|
665
|
+
/** The interface record for a given `interface_type`. @public */
|
|
666
|
+
declare type InterfaceOfType<T extends Interface["interface_type"]> = Extract<
|
|
667
|
+
Interface,
|
|
668
|
+
{
|
|
669
|
+
interface_type: T;
|
|
670
|
+
}
|
|
671
|
+
>;
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* An interface record discriminated on `interface_type` — a `panel` renders in
|
|
675
|
+
* the dock, a `worker` runs a background service, an `app` is the navigable
|
|
676
|
+
* full-page view.
|
|
677
|
+
* @public
|
|
678
|
+
*/
|
|
679
|
+
export declare const InterfaceSchema: z.ZodDiscriminatedUnion<
|
|
680
|
+
[
|
|
681
|
+
z.ZodObject<
|
|
682
|
+
{
|
|
683
|
+
interface_type: z.ZodLiteral<"panel">;
|
|
684
|
+
id: z.ZodString;
|
|
685
|
+
deployment_id: z.ZodString;
|
|
686
|
+
name: z.ZodString;
|
|
687
|
+
entry_point: z.ZodString;
|
|
688
|
+
},
|
|
689
|
+
z.core.$strip
|
|
690
|
+
>,
|
|
691
|
+
z.ZodObject<
|
|
692
|
+
{
|
|
693
|
+
interface_type: z.ZodLiteral<"worker">;
|
|
694
|
+
id: z.ZodString;
|
|
695
|
+
deployment_id: z.ZodString;
|
|
696
|
+
name: z.ZodString;
|
|
697
|
+
entry_point: z.ZodString;
|
|
698
|
+
},
|
|
699
|
+
z.core.$strip
|
|
700
|
+
>,
|
|
701
|
+
z.ZodObject<
|
|
702
|
+
{
|
|
703
|
+
interface_type: z.ZodLiteral<"app">;
|
|
704
|
+
id: z.ZodString;
|
|
705
|
+
deployment_id: z.ZodString;
|
|
706
|
+
name: z.ZodString;
|
|
707
|
+
entry_point: z.ZodString;
|
|
708
|
+
},
|
|
709
|
+
z.core.$strip
|
|
710
|
+
>,
|
|
711
|
+
],
|
|
712
|
+
"interface_type"
|
|
713
|
+
>;
|
|
660
714
|
|
|
661
715
|
/**
|
|
662
716
|
* Joins multiple path segments into a single path string.
|
|
@@ -670,15 +724,61 @@ export declare const joinUrlPaths: (
|
|
|
670
724
|
...paths: Array<string | URL | null | undefined>
|
|
671
725
|
) => string;
|
|
672
726
|
|
|
673
|
-
|
|
727
|
+
/** @public */
|
|
728
|
+
export declare type LocalApp = LocalInterfaceOfType<"app">;
|
|
674
729
|
|
|
675
|
-
|
|
730
|
+
/** @public */
|
|
731
|
+
export declare type LocalInterface = z.output<typeof LocalInterfaceSchema>;
|
|
676
732
|
|
|
677
|
-
|
|
733
|
+
/** The {@link InterfaceOfType} counterpart without `id`/`deployment_id`. @public */
|
|
734
|
+
declare type LocalInterfaceOfType<T extends LocalInterface["interface_type"]> =
|
|
735
|
+
Extract<
|
|
736
|
+
LocalInterface,
|
|
737
|
+
{
|
|
738
|
+
interface_type: T;
|
|
739
|
+
}
|
|
740
|
+
>;
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* An {@link Interface} without the service-assigned `id`/`deployment_id` a local
|
|
744
|
+
* dev server can't provide — the shape the workbench renders from.
|
|
745
|
+
* @public
|
|
746
|
+
*/
|
|
747
|
+
export declare const LocalInterfaceSchema: z.ZodDiscriminatedUnion<
|
|
748
|
+
[
|
|
749
|
+
z.ZodObject<
|
|
750
|
+
{
|
|
751
|
+
name: z.ZodString;
|
|
752
|
+
interface_type: z.ZodLiteral<"panel">;
|
|
753
|
+
entry_point: z.ZodString;
|
|
754
|
+
},
|
|
755
|
+
z.core.$strip
|
|
756
|
+
>,
|
|
757
|
+
z.ZodObject<
|
|
758
|
+
{
|
|
759
|
+
name: z.ZodString;
|
|
760
|
+
interface_type: z.ZodLiteral<"worker">;
|
|
761
|
+
entry_point: z.ZodString;
|
|
762
|
+
},
|
|
763
|
+
z.core.$strip
|
|
764
|
+
>,
|
|
765
|
+
z.ZodObject<
|
|
766
|
+
{
|
|
767
|
+
name: z.ZodString;
|
|
768
|
+
interface_type: z.ZodLiteral<"app">;
|
|
769
|
+
entry_point: z.ZodString;
|
|
770
|
+
},
|
|
771
|
+
z.core.$strip
|
|
772
|
+
>,
|
|
773
|
+
],
|
|
774
|
+
"interface_type"
|
|
775
|
+
>;
|
|
678
776
|
|
|
679
|
-
|
|
777
|
+
/** @public */
|
|
778
|
+
export declare type LocalPanel = LocalInterfaceOfType<"panel">;
|
|
680
779
|
|
|
681
|
-
|
|
780
|
+
/** @public */
|
|
781
|
+
export declare type LocalService = LocalInterfaceOfType<"worker">;
|
|
682
782
|
|
|
683
783
|
/**
|
|
684
784
|
* Raw data for a local application discovered by the CLI dev server.
|
|
@@ -705,24 +805,24 @@ export declare const LocalUserApplication: z.ZodDiscriminatedUnion<
|
|
|
705
805
|
[
|
|
706
806
|
z.ZodObject<
|
|
707
807
|
{
|
|
708
|
-
interface_type: z.ZodLiteral<"panel">;
|
|
709
808
|
name: z.ZodString;
|
|
809
|
+
interface_type: z.ZodLiteral<"panel">;
|
|
710
810
|
entry_point: z.ZodString;
|
|
711
811
|
},
|
|
712
812
|
z.core.$strip
|
|
713
813
|
>,
|
|
714
814
|
z.ZodObject<
|
|
715
815
|
{
|
|
716
|
-
interface_type: z.ZodLiteral<"worker">;
|
|
717
816
|
name: z.ZodString;
|
|
817
|
+
interface_type: z.ZodLiteral<"worker">;
|
|
718
818
|
entry_point: z.ZodString;
|
|
719
819
|
},
|
|
720
820
|
z.core.$strip
|
|
721
821
|
>,
|
|
722
822
|
z.ZodObject<
|
|
723
823
|
{
|
|
724
|
-
interface_type: z.ZodLiteral<"app">;
|
|
725
824
|
name: z.ZodString;
|
|
825
|
+
interface_type: z.ZodLiteral<"app">;
|
|
726
826
|
entry_point: z.ZodString;
|
|
727
827
|
},
|
|
728
828
|
z.core.$strip
|
|
@@ -788,24 +888,24 @@ export declare const LocalUserApplication: z.ZodDiscriminatedUnion<
|
|
|
788
888
|
[
|
|
789
889
|
z.ZodObject<
|
|
790
890
|
{
|
|
791
|
-
interface_type: z.ZodLiteral<"panel">;
|
|
792
891
|
name: z.ZodString;
|
|
892
|
+
interface_type: z.ZodLiteral<"panel">;
|
|
793
893
|
entry_point: z.ZodString;
|
|
794
894
|
},
|
|
795
895
|
z.core.$strip
|
|
796
896
|
>,
|
|
797
897
|
z.ZodObject<
|
|
798
898
|
{
|
|
799
|
-
interface_type: z.ZodLiteral<"worker">;
|
|
800
899
|
name: z.ZodString;
|
|
900
|
+
interface_type: z.ZodLiteral<"worker">;
|
|
801
901
|
entry_point: z.ZodString;
|
|
802
902
|
},
|
|
803
903
|
z.core.$strip
|
|
804
904
|
>,
|
|
805
905
|
z.ZodObject<
|
|
806
906
|
{
|
|
807
|
-
interface_type: z.ZodLiteral<"app">;
|
|
808
907
|
name: z.ZodString;
|
|
908
|
+
interface_type: z.ZodLiteral<"app">;
|
|
809
909
|
entry_point: z.ZodString;
|
|
810
910
|
},
|
|
811
911
|
z.core.$strip
|
|
@@ -1070,9 +1170,16 @@ declare const OrganizationMember_2: z.ZodObject<
|
|
|
1070
1170
|
*/
|
|
1071
1171
|
declare type OrganizationMember = z.output<typeof OrganizationMember_2>;
|
|
1072
1172
|
|
|
1073
|
-
|
|
1173
|
+
/** @public */
|
|
1174
|
+
export declare type Panel = InterfaceOfType<"panel">;
|
|
1074
1175
|
|
|
1075
|
-
|
|
1176
|
+
/**
|
|
1177
|
+
* A panel's view-component slots, in render order — each its own federation
|
|
1178
|
+
* island (`${id}/views/${name}/${component}`). The authoring counterpart that
|
|
1179
|
+
* drives the build's per-slot codegen lives with the CLI define helpers.
|
|
1180
|
+
* @public
|
|
1181
|
+
*/
|
|
1182
|
+
export declare type PanelComponent = "title" | "panel";
|
|
1076
1183
|
|
|
1077
1184
|
/**
|
|
1078
1185
|
* Validates and parses a raw API response into a branded
|
|
@@ -1154,7 +1261,7 @@ export declare const Project: z.ZodObject<
|
|
|
1154
1261
|
metadata: z.ZodObject<
|
|
1155
1262
|
{
|
|
1156
1263
|
color: z.ZodOptional<z.ZodString>;
|
|
1157
|
-
externalStudioHost: z.ZodOptional<z.ZodString
|
|
1264
|
+
externalStudioHost: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1158
1265
|
initialTemplate: z.ZodOptional<z.ZodString>;
|
|
1159
1266
|
cliInitializedAt: z.ZodOptional<z.ZodString>;
|
|
1160
1267
|
integration: z.ZodOptional<z.ZodString>;
|
|
@@ -1297,7 +1404,12 @@ export declare const ServerManifest: z.ZodObject<
|
|
|
1297
1404
|
*/
|
|
1298
1405
|
export declare type ServerManifest = z.output<typeof ServerManifest>;
|
|
1299
1406
|
|
|
1300
|
-
|
|
1407
|
+
/**
|
|
1408
|
+
* A service an application runs — the worker-typed interface record. `Service`/
|
|
1409
|
+
* `LocalService` are the worker-typed subset of the interface model.
|
|
1410
|
+
* @public
|
|
1411
|
+
*/
|
|
1412
|
+
export declare type Service = InterfaceOfType<"worker">;
|
|
1301
1413
|
|
|
1302
1414
|
/**
|
|
1303
1415
|
* @public
|
|
@@ -1490,24 +1602,24 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
|
|
|
1490
1602
|
[
|
|
1491
1603
|
z.ZodObject<
|
|
1492
1604
|
{
|
|
1493
|
-
interface_type: z.ZodLiteral<"panel">;
|
|
1494
1605
|
name: z.ZodString;
|
|
1606
|
+
interface_type: z.ZodLiteral<"panel">;
|
|
1495
1607
|
entry_point: z.ZodString;
|
|
1496
1608
|
},
|
|
1497
1609
|
z.core.$strip
|
|
1498
1610
|
>,
|
|
1499
1611
|
z.ZodObject<
|
|
1500
1612
|
{
|
|
1501
|
-
interface_type: z.ZodLiteral<"worker">;
|
|
1502
1613
|
name: z.ZodString;
|
|
1614
|
+
interface_type: z.ZodLiteral<"worker">;
|
|
1503
1615
|
entry_point: z.ZodString;
|
|
1504
1616
|
},
|
|
1505
1617
|
z.core.$strip
|
|
1506
1618
|
>,
|
|
1507
1619
|
z.ZodObject<
|
|
1508
1620
|
{
|
|
1509
|
-
interface_type: z.ZodLiteral<"app">;
|
|
1510
1621
|
name: z.ZodString;
|
|
1622
|
+
interface_type: z.ZodLiteral<"app">;
|
|
1511
1623
|
entry_point: z.ZodString;
|
|
1512
1624
|
},
|
|
1513
1625
|
z.core.$strip
|
|
@@ -1644,8 +1756,8 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
|
|
|
1644
1756
|
version: z.ZodString;
|
|
1645
1757
|
isActiveDeployment: z.ZodBoolean;
|
|
1646
1758
|
userApplicationId: z.ZodString;
|
|
1647
|
-
isAutoUpdating: z.ZodBoolean
|
|
1648
|
-
size: z.ZodNumber
|
|
1759
|
+
isAutoUpdating: z.ZodNullable<z.ZodBoolean>;
|
|
1760
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
1649
1761
|
deployedAt: z.ZodString;
|
|
1650
1762
|
deployedBy: z.ZodString;
|
|
1651
1763
|
createdAt: z.ZodString;
|
|
@@ -1706,24 +1818,24 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
|
|
|
1706
1818
|
[
|
|
1707
1819
|
z.ZodObject<
|
|
1708
1820
|
{
|
|
1709
|
-
interface_type: z.ZodLiteral<"panel">;
|
|
1710
1821
|
name: z.ZodString;
|
|
1822
|
+
interface_type: z.ZodLiteral<"panel">;
|
|
1711
1823
|
entry_point: z.ZodString;
|
|
1712
1824
|
},
|
|
1713
1825
|
z.core.$strip
|
|
1714
1826
|
>,
|
|
1715
1827
|
z.ZodObject<
|
|
1716
1828
|
{
|
|
1717
|
-
interface_type: z.ZodLiteral<"worker">;
|
|
1718
1829
|
name: z.ZodString;
|
|
1830
|
+
interface_type: z.ZodLiteral<"worker">;
|
|
1719
1831
|
entry_point: z.ZodString;
|
|
1720
1832
|
},
|
|
1721
1833
|
z.core.$strip
|
|
1722
1834
|
>,
|
|
1723
1835
|
z.ZodObject<
|
|
1724
1836
|
{
|
|
1725
|
-
interface_type: z.ZodLiteral<"app">;
|
|
1726
1837
|
name: z.ZodString;
|
|
1838
|
+
interface_type: z.ZodLiteral<"app">;
|
|
1727
1839
|
entry_point: z.ZodString;
|
|
1728
1840
|
},
|
|
1729
1841
|
z.core.$strip
|
|
@@ -1860,8 +1972,8 @@ export declare const StudioUserApplication: z.ZodDiscriminatedUnion<
|
|
|
1860
1972
|
version: z.ZodString;
|
|
1861
1973
|
isActiveDeployment: z.ZodBoolean;
|
|
1862
1974
|
userApplicationId: z.ZodString;
|
|
1863
|
-
isAutoUpdating: z.ZodBoolean
|
|
1864
|
-
size: z.ZodNumber
|
|
1975
|
+
isAutoUpdating: z.ZodNullable<z.ZodBoolean>;
|
|
1976
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
1865
1977
|
deployedAt: z.ZodString;
|
|
1866
1978
|
deployedBy: z.ZodString;
|
|
1867
1979
|
createdAt: z.ZodString;
|
|
@@ -2060,24 +2172,24 @@ export declare const UserApplicationBase: z.ZodObject<
|
|
|
2060
2172
|
[
|
|
2061
2173
|
z.ZodObject<
|
|
2062
2174
|
{
|
|
2063
|
-
interface_type: z.ZodLiteral<"panel">;
|
|
2064
2175
|
name: z.ZodString;
|
|
2176
|
+
interface_type: z.ZodLiteral<"panel">;
|
|
2065
2177
|
entry_point: z.ZodString;
|
|
2066
2178
|
},
|
|
2067
2179
|
z.core.$strip
|
|
2068
2180
|
>,
|
|
2069
2181
|
z.ZodObject<
|
|
2070
2182
|
{
|
|
2071
|
-
interface_type: z.ZodLiteral<"worker">;
|
|
2072
2183
|
name: z.ZodString;
|
|
2184
|
+
interface_type: z.ZodLiteral<"worker">;
|
|
2073
2185
|
entry_point: z.ZodString;
|
|
2074
2186
|
},
|
|
2075
2187
|
z.core.$strip
|
|
2076
2188
|
>,
|
|
2077
2189
|
z.ZodObject<
|
|
2078
2190
|
{
|
|
2079
|
-
interface_type: z.ZodLiteral<"app">;
|
|
2080
2191
|
name: z.ZodString;
|
|
2192
|
+
interface_type: z.ZodLiteral<"app">;
|
|
2081
2193
|
entry_point: z.ZodString;
|
|
2082
2194
|
},
|
|
2083
2195
|
z.core.$strip
|
package/dist/core.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
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";
|
|
1
|
+
import { AbstractApplication, ActiveDeployment, CanvasApplication, ClientManifest, CoreAppApplication, CoreAppUserApplicationManifest, InterfaceSchema, LocalInterfaceSchema, 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";
|
|
4
3
|
class ApplicationList {
|
|
5
4
|
applications;
|
|
6
5
|
/**
|
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":"
|
|
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;"}
|
package/dist/system.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { CallbackActorLogic } from "xstate";
|
|
|
7
7
|
import { ConsentStatus } from "@sanity/telemetry";
|
|
8
8
|
import { CurrentUser } from "@sanity/sdk";
|
|
9
9
|
import { EventObject } from "xstate";
|
|
10
|
-
import { FederationInstance } from "@sanity/federation/runtime";
|
|
11
10
|
import { InspectionEvent } from "xstate";
|
|
12
11
|
import { MetaObject } from "xstate";
|
|
13
12
|
import { NonReducibleUnknown } from "xstate";
|
|
@@ -56,6 +55,22 @@ export declare interface FederatedModuleRef {
|
|
|
56
55
|
entry: string;
|
|
57
56
|
}
|
|
58
57
|
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
declare interface FederationInstance {
|
|
62
|
+
registerRemotes(remotes: FederationRemote[]): void;
|
|
63
|
+
loadRemote<T>(id: string): Promise<T | null>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
declare type FederationRemote = {
|
|
70
|
+
name: string;
|
|
71
|
+
entry: string;
|
|
72
|
+
};
|
|
73
|
+
|
|
59
74
|
/**
|
|
60
75
|
* A loaded render-contract module. `TProps` is what its `render` accepts —
|
|
61
76
|
* `RemoteRenderOptions` for an application's full-page view, the view's props
|
package/dist/system.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { fromPromise, setup, assign, sendParent, fromObservable, fromCallback, enqueueActions, sendTo, raise } from "xstate";
|
|
2
2
|
import { logger } from "./_chunks-es/index.js";
|
|
3
|
-
import { createInstance } from "@sanity/federation/runtime";
|
|
4
|
-
import { log } from "@sanity/federation/runtime/plugins/log";
|
|
5
3
|
import { getAuthState, logout, AuthStateType, getClient, createSanityInstance } from "@sanity/sdk";
|
|
6
4
|
import "./_chunks-es/studio.js";
|
|
5
|
+
import { createInstance, log } from "./_chunks-es/module-federation.js";
|
|
7
6
|
import { createSessionId, createBatchedStore } from "@sanity/telemetry";
|
|
8
7
|
async function loadRemoteModule(instance, { moduleId, entry }) {
|
|
9
8
|
const name = moduleId.slice(0, moduleId.indexOf("/"));
|