@sanity/workbench 0.1.0-alpha.2 → 0.1.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/_chunks-es/index.js +39 -0
- package/dist/_chunks-es/index.js.map +1 -0
- 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 +892 -0
- package/dist/_chunks-es/studio.js.map +1 -0
- package/dist/_internal.d.ts +16 -4
- package/dist/_internal.js +34 -27
- package/dist/_internal.js.map +1 -1
- package/dist/core.d.ts +2250 -0
- package/dist/core.js +74 -0
- package/dist/core.js.map +1 -0
- package/dist/system.d.ts +2135 -0
- package/dist/system.js +887 -0
- package/dist/system.js.map +1 -0
- package/package.json +34 -6
- package/src/_exports/core.ts +1 -0
- package/src/_exports/system.ts +1 -0
- package/src/_internal/index.ts +2 -1
- package/src/_internal/render.ts +72 -43
- package/src/core/applications/application-list.ts +104 -0
- package/src/core/applications/application.ts +177 -0
- package/src/core/applications/interface.ts +126 -0
- package/src/core/canvases.ts +92 -0
- package/src/core/config.ts +34 -0
- package/src/core/env.ts +43 -0
- package/src/core/index.ts +13 -0
- package/src/core/log/index.ts +125 -0
- package/src/core/media-libraries.ts +93 -0
- package/src/core/organizations.ts +115 -0
- package/src/core/projects.ts +114 -0
- package/src/core/shared/urls.ts +129 -0
- package/src/core/user-applications/core-app.ts +148 -0
- package/src/core/user-applications/studios/index.ts +3 -0
- package/src/core/user-applications/studios/schemas.ts +128 -0
- package/src/core/user-applications/studios/studio.ts +533 -0
- package/src/core/user-applications/studios/workspace.ts +156 -0
- package/src/core/user-applications/user-application.ts +222 -0
- package/src/system/auth.machine.ts +223 -0
- package/src/system/index.ts +22 -0
- package/src/system/inspect.ts +40 -0
- package/src/system/load-federated-module.ts +53 -0
- package/src/system/module-federation.ts +116 -0
- package/src/system/remote.machine.ts +219 -0
- package/src/system/remotes.machine.ts +92 -0
- package/src/system/root.machine.ts +224 -0
- package/src/system/service.machine.ts +207 -0
- package/src/system/services.machine.ts +120 -0
- package/src/system/system-preferences.machine.ts +215 -0
- package/src/system/telemetry.machine.ts +179 -0
- package/src/_internal/render.test.ts +0 -18
package/dist/core.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
import { createLogger, logger } from "./_chunks-es/index.js";
|
|
3
|
+
class ApplicationList {
|
|
4
|
+
applications;
|
|
5
|
+
/**
|
|
6
|
+
* @param applications - The applications to initialize the list with.
|
|
7
|
+
*/
|
|
8
|
+
constructor(applications) {
|
|
9
|
+
this.applications = [...applications];
|
|
10
|
+
}
|
|
11
|
+
findApplicationsByType(_type) {
|
|
12
|
+
const types = Array.isArray(_type) ? _type : [_type];
|
|
13
|
+
return this.applications.filter((r) => types.includes(r.type));
|
|
14
|
+
}
|
|
15
|
+
findApplication(type, id) {
|
|
16
|
+
switch (type) {
|
|
17
|
+
case "media-library":
|
|
18
|
+
case "canvas":
|
|
19
|
+
return this.applications.find((r) => r.type === type);
|
|
20
|
+
case "coreApp":
|
|
21
|
+
case "studio":
|
|
22
|
+
case "workspace":
|
|
23
|
+
return this.applications.find((r) => r.type === type && r.id === id);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
toProtocolResources() {
|
|
27
|
+
return this.applications.reduce((acc, r) => r.type === "studio" || r.isLocal ? acc : [...acc, r.toProtocolResource()], []);
|
|
28
|
+
}
|
|
29
|
+
static areApplicationsEqual(application1, application2) {
|
|
30
|
+
return !application1 || !application2 || application1.type !== application2.type ? !1 : application1.id === application2.id;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
AbstractApplication,
|
|
35
|
+
ActiveDeployment,
|
|
36
|
+
ApplicationList,
|
|
37
|
+
CanvasApplication,
|
|
38
|
+
ClientManifest,
|
|
39
|
+
CoreAppApplication,
|
|
40
|
+
CoreAppUserApplicationManifest,
|
|
41
|
+
InterfaceSchema,
|
|
42
|
+
LocalInterfaceSchema,
|
|
43
|
+
LocalUserApplication,
|
|
44
|
+
MediaLibraryApplication,
|
|
45
|
+
Organization,
|
|
46
|
+
OrganizationId,
|
|
47
|
+
Project,
|
|
48
|
+
ProjectId,
|
|
49
|
+
ServerManifest,
|
|
50
|
+
StudioApplication,
|
|
51
|
+
StudioUserApplication,
|
|
52
|
+
StudioWorkspace,
|
|
53
|
+
UserApplication,
|
|
54
|
+
UserApplicationBase,
|
|
55
|
+
UserApplicationId,
|
|
56
|
+
brandCanvasId,
|
|
57
|
+
brandMediaLibraryId,
|
|
58
|
+
brandOrganizationId,
|
|
59
|
+
brandProjectId,
|
|
60
|
+
brandUserApplicationId,
|
|
61
|
+
createLogger,
|
|
62
|
+
getApiHost,
|
|
63
|
+
getSanityDomain,
|
|
64
|
+
getSanityEnv,
|
|
65
|
+
joinUrlPaths,
|
|
66
|
+
logger,
|
|
67
|
+
parseCanvas,
|
|
68
|
+
parseCoreApplication,
|
|
69
|
+
parseMediaLibrary,
|
|
70
|
+
parseOrganization,
|
|
71
|
+
parseProject,
|
|
72
|
+
parseStudioUserApplication
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
ADDED
|
@@ -0,0 +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;"}
|