@sanity/workbench 0.1.0-alpha.8 → 0.1.0-alpha.9
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/package.json +7 -3
- package/src/_internal/render.test.ts +0 -105
- package/src/core/__tests__/__fixtures__.ts +0 -245
- package/src/core/applications/application-list.test.ts +0 -222
- package/src/core/applications/local-application.test.ts +0 -93
- package/src/core/canvases.test.ts +0 -38
- package/src/core/log/index.test.ts +0 -133
- package/src/core/media-libraries.test.ts +0 -38
- package/src/core/organizations.test.ts +0 -134
- package/src/core/projects.test.ts +0 -248
- package/src/core/shared/urls.test.ts +0 -182
- package/src/core/user-applications/core-app.test.ts +0 -236
- package/src/core/user-applications/studios/schemas.test.ts +0 -113
- package/src/core/user-applications/studios/studio.test.ts +0 -997
- package/src/core/user-applications/user-application.test.ts +0 -125
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/workbench",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.9",
|
|
4
4
|
"description": "Workbench component for the Sanity Content Operating System",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/sanity-io/workbench/packages/@sanity/workbench#readme",
|
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
-
"src"
|
|
18
|
+
"src",
|
|
19
|
+
"!src/**/*.test.ts",
|
|
20
|
+
"!src/**/*.test.tsx",
|
|
21
|
+
"!src/**/__tests__",
|
|
22
|
+
"!src/**/__fixtures__*"
|
|
19
23
|
],
|
|
20
24
|
"type": "module",
|
|
21
25
|
"sideEffects": false,
|
|
@@ -37,7 +41,7 @@
|
|
|
37
41
|
"rxjs": "^7.8.2",
|
|
38
42
|
"semver": "^7.7.4",
|
|
39
43
|
"zod": "^4.3.6",
|
|
40
|
-
"@sanity/federation": "0.1.0-alpha.
|
|
44
|
+
"@sanity/federation": "0.1.0-alpha.6"
|
|
41
45
|
},
|
|
42
46
|
"devDependencies": {
|
|
43
47
|
"@sanity/pkg-utils": "^9.2.3",
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { BehaviorSubject } from "rxjs";
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
-
|
|
4
|
-
import { renderWorkbench } from "./render";
|
|
5
|
-
|
|
6
|
-
const DEFAULT_WORKBENCH_REMOTE_URL =
|
|
7
|
-
"https://workbench-remote.sanity.dev/mf-manifest.json";
|
|
8
|
-
|
|
9
|
-
const { mockLoadRemote, mockCreateInstance } = vi.hoisted(() => ({
|
|
10
|
-
mockLoadRemote: vi.fn(),
|
|
11
|
-
mockCreateInstance: vi.fn(),
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
|
-
vi.mock("@sanity/federation/runtime", () => ({
|
|
15
|
-
createInstance: mockCreateInstance,
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
describe("renderWorkbench", () => {
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
mockCreateInstance.mockImplementation(() => ({
|
|
21
|
-
loadRemote: mockLoadRemote,
|
|
22
|
-
}));
|
|
23
|
-
mockLoadRemote.mockResolvedValue({
|
|
24
|
-
render: vi.fn().mockReturnValue(vi.fn()),
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
afterEach(() => {
|
|
29
|
-
vi.unstubAllEnvs();
|
|
30
|
-
vi.restoreAllMocks();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("throws when rootElement is missing", async () => {
|
|
34
|
-
await expect(
|
|
35
|
-
renderWorkbench(null as unknown as HTMLElement),
|
|
36
|
-
).rejects.toThrow("Missing root element to mount application into");
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("uses the default production URL when SANITY_INTERNAL_WORKBENCH_REMOTE_URL is not set", async () => {
|
|
40
|
-
await renderWorkbench(document.createElement("div"));
|
|
41
|
-
|
|
42
|
-
expect(mockCreateInstance).toHaveBeenCalledWith(
|
|
43
|
-
expect.objectContaining({
|
|
44
|
-
remotes: [
|
|
45
|
-
expect.objectContaining({ entry: DEFAULT_WORKBENCH_REMOTE_URL }),
|
|
46
|
-
],
|
|
47
|
-
}),
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("uses the configured URL when SANITY_INTERNAL_WORKBENCH_REMOTE_URL is set", async () => {
|
|
52
|
-
const customUrl = "http://localhost:3001";
|
|
53
|
-
vi.stubEnv("SANITY_INTERNAL_WORKBENCH_REMOTE_URL", customUrl);
|
|
54
|
-
|
|
55
|
-
await renderWorkbench(document.createElement("div"));
|
|
56
|
-
|
|
57
|
-
expect(mockCreateInstance).toHaveBeenCalledWith(
|
|
58
|
-
expect.objectContaining({
|
|
59
|
-
remotes: [expect.objectContaining({ entry: customUrl })],
|
|
60
|
-
}),
|
|
61
|
-
);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("throws when remote module is null", async () => {
|
|
65
|
-
mockLoadRemote.mockResolvedValue(null);
|
|
66
|
-
|
|
67
|
-
await expect(
|
|
68
|
-
renderWorkbench(document.createElement("div")),
|
|
69
|
-
).rejects.toThrow(
|
|
70
|
-
'Remote module "workbench-remote/App" did not expose a render function',
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it("throws when remote module does not expose a render function", async () => {
|
|
75
|
-
mockLoadRemote.mockResolvedValue({ notRender: true });
|
|
76
|
-
|
|
77
|
-
await expect(
|
|
78
|
-
renderWorkbench(document.createElement("div")),
|
|
79
|
-
).rejects.toThrow(
|
|
80
|
-
'Remote module "workbench-remote/App" did not expose a render function',
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("calls render on the remote module and returns the cleanup function", async () => {
|
|
85
|
-
const cleanup = vi.fn();
|
|
86
|
-
const render = vi.fn().mockReturnValue(cleanup);
|
|
87
|
-
mockLoadRemote.mockResolvedValue({ render });
|
|
88
|
-
|
|
89
|
-
const el = document.createElement("div");
|
|
90
|
-
const config = {};
|
|
91
|
-
const options = { reactStrictMode: true };
|
|
92
|
-
|
|
93
|
-
const result = await renderWorkbench(el, config, options);
|
|
94
|
-
|
|
95
|
-
expect(render).toHaveBeenCalledWith(
|
|
96
|
-
el,
|
|
97
|
-
{ config, localApplications: expect.any(BehaviorSubject) },
|
|
98
|
-
options,
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
expect(result).toBeTypeOf("function");
|
|
102
|
-
result();
|
|
103
|
-
expect(cleanup).toHaveBeenCalled();
|
|
104
|
-
});
|
|
105
|
-
});
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { parseCanvas } from "../canvases";
|
|
2
|
-
import { parseMediaLibrary } from "../media-libraries";
|
|
3
|
-
import { parseProject } from "../projects";
|
|
4
|
-
import { parseCoreApplication } from "../user-applications/core-app";
|
|
5
|
-
import { parseStudioUserApplication } from "../user-applications/studios";
|
|
6
|
-
|
|
7
|
-
export const CANVAS_DATA = parseCanvas({
|
|
8
|
-
organizationId: "oSyH1iET5",
|
|
9
|
-
id: "cac1Na6lwtEI",
|
|
10
|
-
status: "active",
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export const MEDIA_LIBRARY_DATA = parseMediaLibrary({
|
|
14
|
-
organizationId: "oSyH1iET5",
|
|
15
|
-
id: "al34RQcBfuD7",
|
|
16
|
-
status: "active",
|
|
17
|
-
aclMode: "private",
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const PROJECTS = [
|
|
21
|
-
parseProject(
|
|
22
|
-
{
|
|
23
|
-
id: "c16r74n4",
|
|
24
|
-
displayName: "Sanity Home",
|
|
25
|
-
studioHost: "sanity-home",
|
|
26
|
-
isBlocked: false,
|
|
27
|
-
isDisabled: false,
|
|
28
|
-
isDisabledByUser: false,
|
|
29
|
-
metadata: {
|
|
30
|
-
integration: "cli",
|
|
31
|
-
color: "a",
|
|
32
|
-
initialTemplate: "cli-clean",
|
|
33
|
-
externalStudioHost: "https://home.sanity.team/admin",
|
|
34
|
-
cliInitializedAt: "2024-03-13T10:16:07.297Z",
|
|
35
|
-
},
|
|
36
|
-
activityFeedEnabled: true,
|
|
37
|
-
createdAt: "2024-03-13T10:16:07.297Z",
|
|
38
|
-
updatedAt: "2025-07-08T20:13:22.574Z",
|
|
39
|
-
organizationId: "oSyH1iET5",
|
|
40
|
-
features: [],
|
|
41
|
-
},
|
|
42
|
-
{ includeMembers: false, includeFeatures: true },
|
|
43
|
-
),
|
|
44
|
-
parseProject(
|
|
45
|
-
{
|
|
46
|
-
id: "hzao7xsp",
|
|
47
|
-
displayName: "Customer 360",
|
|
48
|
-
studioHost: null,
|
|
49
|
-
isBlocked: false,
|
|
50
|
-
isDisabled: false,
|
|
51
|
-
isDisabledByUser: false,
|
|
52
|
-
metadata: {
|
|
53
|
-
integration: "cli",
|
|
54
|
-
color: "b",
|
|
55
|
-
initialTemplate: "cli-clean",
|
|
56
|
-
externalStudioHost: "https://360.sanity.build",
|
|
57
|
-
cliInitializedAt: "2024-01-06T21:09:20.688Z",
|
|
58
|
-
},
|
|
59
|
-
activityFeedEnabled: true,
|
|
60
|
-
createdAt: "2024-01-06T21:09:20.688Z",
|
|
61
|
-
updatedAt: "2025-07-04T17:47:55.830Z",
|
|
62
|
-
organizationId: "oSyH1iET5",
|
|
63
|
-
features: [],
|
|
64
|
-
},
|
|
65
|
-
{ includeMembers: false, includeFeatures: true },
|
|
66
|
-
),
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
export const APPLICATION_DATA = parseCoreApplication({
|
|
70
|
-
id: "v27rvqtlp3lmdvcln6ey3lro",
|
|
71
|
-
projectId: null,
|
|
72
|
-
organizationId: "oSyH1iET5",
|
|
73
|
-
title: "sdk-movie-list",
|
|
74
|
-
type: "coreApp",
|
|
75
|
-
urlType: "internal",
|
|
76
|
-
appHost: "x7apsmr6fxvc",
|
|
77
|
-
dashboardStatus: "default",
|
|
78
|
-
createdAt: "2025-03-27T19:00:32.792Z",
|
|
79
|
-
updatedAt: "2025-03-27T19:00:32.792Z",
|
|
80
|
-
activeDeployment: {
|
|
81
|
-
id: "dv3kz3fsl4aqha3parc8k391",
|
|
82
|
-
version: "3.81.0",
|
|
83
|
-
isActiveDeployment: true,
|
|
84
|
-
userApplicationId: "v27rvqtlp3lmdvcln6ey3lro",
|
|
85
|
-
isAutoUpdating: false,
|
|
86
|
-
size: 528292,
|
|
87
|
-
deployedAt: "2025-03-27T19:07:21.082Z",
|
|
88
|
-
deployedBy: "gwXueEBci",
|
|
89
|
-
createdAt: "2025-03-27T19:07:21.038Z",
|
|
90
|
-
updatedAt: "2025-03-27T19:07:21.082Z",
|
|
91
|
-
manifest: null,
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
export const MULTIPLE_WORKSPACE_STUDIO_DATA = parseStudioUserApplication({
|
|
96
|
-
id: "75affa24c862a372764ceb40",
|
|
97
|
-
projectId: "hzao7xsp",
|
|
98
|
-
organizationId: null,
|
|
99
|
-
title: null,
|
|
100
|
-
type: "studio",
|
|
101
|
-
urlType: "external",
|
|
102
|
-
appHost: "https://360.sanity.build",
|
|
103
|
-
dashboardStatus: "default",
|
|
104
|
-
createdAt: "2024-08-09T14:04:57.477Z",
|
|
105
|
-
updatedAt: "2025-05-06T20:12:05.955Z",
|
|
106
|
-
autoUpdatingVersion: null,
|
|
107
|
-
activeDeployment: null,
|
|
108
|
-
manifest: null,
|
|
109
|
-
manifestData: {
|
|
110
|
-
value: {
|
|
111
|
-
version: 2,
|
|
112
|
-
createdAt: "2025-11-19T07:59:25.943Z",
|
|
113
|
-
workspaces: [
|
|
114
|
-
{
|
|
115
|
-
name: "explorer",
|
|
116
|
-
title: "Customer 360",
|
|
117
|
-
basePath: "/360",
|
|
118
|
-
projectId: "hzao7xsp",
|
|
119
|
-
dataset: "production",
|
|
120
|
-
icon: '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="50" height="50" fill="#FF5500"></rect><path d="M8.5 25C8.5 27.1668 8.92678 29.3124 9.75599 31.3143C10.5852 33.3161 11.8006 35.1351 13.3327 36.6673C14.8649 38.1994 16.6839 39.4148 18.6857 40.244C20.6876 41.0732 22.8332 41.5 25 41.5C27.1668 41.5 29.3124 41.0732 31.3143 40.244C33.3161 39.4148 35.1351 38.1994 36.6673 36.6673C38.1994 35.1351 39.4148 33.3161 40.244 31.3143C41.0732 29.3124 41.5 27.1668 41.5 25C41.5 22.8332 41.0732 20.6876 40.244 18.6857C39.4148 16.6839 38.1994 14.8649 36.6673 13.3327C35.1351 11.8006 33.3161 10.5852 31.3143 9.75599C29.3124 8.92679 27.1668 8.5 25 8.5C22.8332 8.5 20.6876 8.92679 18.6857 9.75599C16.6839 10.5852 14.8649 11.8006 13.3327 13.3327C11.8006 14.8649 10.5852 16.6839 9.75599 18.6857C8.92678 20.6876 8.5 22.8332 8.5 25Z" fill="white" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M17.666 25C17.666 29.3761 18.4386 33.5729 19.8139 36.6673C21.1892 39.7616 23.0544 41.5 24.9993 41.5C26.9443 41.5 28.8095 39.7616 30.1848 36.6673C31.5601 33.5729 32.3327 29.3761 32.3327 25C32.3327 20.6239 31.5601 16.4271 30.1848 13.3327C28.8095 10.2384 26.9443 8.5 24.9993 8.5C23.0544 8.5 21.1892 10.2384 19.8139 13.3327C18.4386 16.4271 17.666 20.6239 17.666 25Z" fill="white" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.5 25.0003C8.5 29.052 15.8883 32.3337 25 32.3337C34.1117 32.3337 41.5 29.052 41.5 25.0003C41.5 20.9487 34.1117 17.667 25 17.667C15.8883 17.667 8.5 20.9487 8.5 25.0003Z" fill="white" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M17.666 25C17.666 29.3761 18.4386 33.5729 19.8139 36.6673C21.1892 39.7616 23.0544 41.5 24.9993 41.5C26.9443 41.5 28.8095 39.7616 30.1848 36.6673C31.5601 33.5729 32.3327 29.3761 32.3327 25C32.3327 20.6239 31.5601 16.4271 30.1848 13.3327C28.8095 10.2384 26.9443 8.5 24.9993 8.5C23.0544 8.5 21.1892 10.2384 19.8139 13.3327C18.4386 16.4271 17.666 20.6239 17.666 25Z" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path></svg>',
|
|
121
|
-
schema: "cd26d36b.create-schema.json",
|
|
122
|
-
tools: "d7989384.create-tools.json",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "operations-gateway",
|
|
126
|
-
title: "Operations Gateway",
|
|
127
|
-
basePath: "/operations-gateway",
|
|
128
|
-
projectId: "hzao7xsp",
|
|
129
|
-
dataset: "production",
|
|
130
|
-
icon: '<svg width="50" height="49" viewBox="0 0 50 49" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="50" height="49" fill="#FFCC32"></rect><path d="M30.5 36.6667V33C30.5 31.5413 29.9205 30.1424 28.8891 29.1109C27.8576 28.0795 26.4587 27.5 25 27.5C23.5413 27.5 22.1424 28.0795 21.1109 29.1109C20.0795 30.1424 19.5 31.5413 19.5 33V36.6667C19.5 37.1529 19.3068 37.6192 18.963 37.963C18.6192 38.3068 18.1529 38.5 17.6667 38.5H10.3333C9.8471 38.5 9.38079 38.3068 9.03697 37.963C8.69315 37.6192 8.5 37.1529 8.5 36.6667V11H15.8333V16.5H21.3333V11H28.6667V16.5H34.1667V11H41.5V36.6667C41.5 37.1529 41.3068 37.6192 40.963 37.963C40.6192 38.3068 40.1529 38.5 39.6667 38.5H32.3333C31.8471 38.5 31.3808 38.3068 31.037 37.963C30.6932 37.6192 30.5 37.1529 30.5 36.6667Z" fill="white" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.5 22H41.5Z" fill="white"></path><path d="M8.5 22H41.5" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path></svg>',
|
|
131
|
-
schema: "cd26d36b.create-schema.json",
|
|
132
|
-
tools: "f63673b7.create-tools.json",
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
name: "finder",
|
|
136
|
-
title: "Finder",
|
|
137
|
-
basePath: "/finder",
|
|
138
|
-
projectId: "hzao7xsp",
|
|
139
|
-
dataset: "production",
|
|
140
|
-
icon: '<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="50" height="50" fill="#D6EDFF"></rect><rect x="12.2959" y="11.7402" width="25.41" height="13.86" fill="white"></rect><path d="M23.0732 11.356H26.9232Z" fill="white"></path><path d="M23.0732 11.356H26.9232" stroke="black" stroke-width="3.85" stroke-linecap="round" stroke-linejoin="round"></path><path d="M38.4734 24.8306C37.1895 35.0966 33.9824 40.2306 28.8484 40.2306H21.1484C16.0145 40.2306 12.8074 35.0966 11.5234 24.8306" fill="white"></path><path d="M38.4734 24.8306C37.1895 35.0966 33.9824 40.2306 28.8484 40.2306H21.1484C16.0145 40.2306 12.8074 35.0966 11.5234 24.8306" stroke="black" stroke-width="3.85" stroke-linecap="round" stroke-linejoin="round"></path><path d="M23.0732 32.5303C23.0732 33.8142 23.7143 34.4553 24.9982 34.4553C26.2822 34.4553 26.9232 33.8142 26.9232 32.5303H23.0732Z" fill="white" stroke="black" stroke-width="3.85" stroke-linecap="round" stroke-linejoin="round"></path><path d="M24.999 36.3804V40.2304Z" fill="white"></path><path d="M24.999 36.3804V40.2304" stroke="black" stroke-width="3.85" stroke-linecap="round" stroke-linejoin="round"></path><path d="M21.1494 22.9058V22.9241Z" fill="white"></path><path d="M21.1494 22.9058V22.9241" stroke="black" stroke-width="3.85" stroke-linecap="round" stroke-linejoin="round"></path><path d="M28.8486 22.9058V22.9241Z" fill="white"></path><path d="M28.8486 22.9058V22.9241" stroke="black" stroke-width="3.85" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.5239 9.43018L23.0739 11.2974L11.0657 24.1718C10.7284 24.551 10.2575 24.7849 9.7516 24.8248C9.24568 24.8646 8.74398 24.7072 8.35148 24.3855C8.08529 24.1689 7.88519 23.882 7.77392 23.5574C7.66265 23.2327 7.64466 22.8834 7.72201 22.549L11.5239 9.43018Z" fill="white" stroke="black" stroke-width="3.85" stroke-linecap="round" stroke-linejoin="round"></path><path d="M38.4748 9.43018L26.9248 11.2974L38.933 24.1718C39.6221 24.9572 40.8368 25.0535 41.6472 24.3855C41.9134 24.1689 42.1135 23.882 42.2248 23.5574C42.336 23.2327 42.354 22.8834 42.2767 22.549L38.4748 9.43018Z" fill="white" stroke="black" stroke-width="3.85" stroke-linecap="round" stroke-linejoin="round"></path></svg>',
|
|
141
|
-
schema: "cd26d36b.create-schema.json",
|
|
142
|
-
tools: "790d30d6.create-tools.json",
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: "radar",
|
|
146
|
-
title: "Radar",
|
|
147
|
-
basePath: "/radar",
|
|
148
|
-
projectId: "hzao7xsp",
|
|
149
|
-
dataset: "production",
|
|
150
|
-
icon: '<svg viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="50" height="50" fill="#CDEA19"></rect><path d="M41.4925 24.9818H26.8258C26.8258 24.6192 26.7183 24.2647 26.5169 23.9632C26.3154 23.6617 26.0291 23.4268 25.6941 23.288C25.3591 23.1492 24.9905 23.1129 24.6348 23.1837C24.2792 23.2544 23.9525 23.429 23.6962 23.6854C23.4398 23.9418 23.2651 24.2685 23.1944 24.6241C23.1237 24.9797 23.16 25.3484 23.2987 25.6834C23.4375 26.0184 23.6725 26.3047 23.974 26.5061C24.2755 26.7076 24.6299 26.8151 24.9925 26.8151V41.4818C29.3686 41.4818 33.5654 39.7434 36.6598 36.649C39.7541 33.5547 41.4925 29.3578 41.4925 24.9818Z" fill="white" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M32.3252 19.4821C31.5372 18.4314 30.5326 17.5624 29.3795 16.9337C28.2264 16.3051 26.9517 15.9316 25.6417 15.8385C24.3317 15.7454 23.0169 15.9349 21.7865 16.3941C20.5561 16.8534 19.4387 17.5716 18.5101 18.5003C17.5814 19.4289 16.8631 20.5463 16.4039 21.7767C15.9446 23.0072 15.7552 24.3219 15.8483 25.6319C15.9414 26.9419 16.3149 28.2167 16.9435 29.3698C17.5721 30.5229 18.4412 31.5274 19.4919 32.3154" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M40.55 19.4821C39.6182 16.8561 38.0365 14.5088 35.9524 12.6592C33.8683 10.8096 31.3498 9.51795 28.6317 8.90464C25.9136 8.29133 23.0845 8.37637 20.4081 9.15184C17.7317 9.9273 15.2953 11.3679 13.3261 13.3393C11.3569 15.3108 9.91908 17.7488 9.14665 20.426C8.37422 23.1033 8.29238 25.9325 8.90876 28.6499C9.52514 31.3673 10.8197 33.8844 12.6716 35.9664C14.5236 38.0483 16.8726 39.6274 19.4997 40.5562" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path></svg>',
|
|
151
|
-
schema: "cd26d36b.create-schema.json",
|
|
152
|
-
tools: "6e3a5662.create-tools.json",
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
name: "atlas",
|
|
156
|
-
title: "Atlas",
|
|
157
|
-
basePath: "/atlas",
|
|
158
|
-
projectId: "hzao7xsp",
|
|
159
|
-
dataset: "production",
|
|
160
|
-
icon: '<svg width="50" height="49" viewBox="0 0 50 49" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="50" height="49" fill="#40E8AF"></rect><path d="M17.667 31.8332L21.3337 20.8332L32.3337 17.1665L28.667 28.1665L17.667 31.8332Z" fill="white" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.5 24.5C8.5 26.6668 8.92678 28.8124 9.75599 30.8143C10.5852 32.8161 11.8006 34.6351 13.3327 36.1673C14.8649 37.6994 16.6839 38.9148 18.6857 39.744C20.6876 40.5732 22.8332 41 25 41C27.1668 41 29.3124 40.5732 31.3143 39.744C33.3161 38.9148 35.1351 37.6994 36.6673 36.1673C38.1994 34.6351 39.4148 32.8161 40.244 30.8143C41.0732 28.8124 41.5 26.6668 41.5 24.5C41.5 22.3332 41.0732 20.1876 40.244 18.1857C39.4148 16.1839 38.1994 14.3649 36.6673 12.8327C35.1351 11.3006 33.3161 10.0852 31.3143 9.25599C29.3124 8.42679 27.1668 8 25 8C22.8332 8 20.6876 8.42679 18.6857 9.25599C16.6839 10.0852 14.8649 11.3006 13.3327 12.8327C11.8006 14.3649 10.5852 16.1839 9.75599 18.1857C8.92678 20.1876 8.5 22.3332 8.5 24.5Z" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M25 8V11.6667" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M25 37.3335V41.0002" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.5 24.5H12.1667" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path><path d="M37.833 24.5H41.4997" stroke="black" stroke-width="3.66667" stroke-linecap="round" stroke-linejoin="round"></path></svg>',
|
|
161
|
-
schema: "b0fefb08.create-schema.json",
|
|
162
|
-
tools: "9597875e.create-tools.json",
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
name: "resources",
|
|
166
|
-
title: "Resource Center",
|
|
167
|
-
basePath: "/resources",
|
|
168
|
-
projectId: "hzao7xsp",
|
|
169
|
-
dataset: "production",
|
|
170
|
-
icon: '<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"></path><path d="M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"></path><path d="M3 6l0 13"></path><path d="M12 6l0 13"></path><path d="M21 6l0 13"></path></svg>',
|
|
171
|
-
schema: "b0fefb08.create-schema.json",
|
|
172
|
-
tools: "c704250f.create-tools.json",
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
name: "data",
|
|
176
|
-
title: "Data Hub",
|
|
177
|
-
basePath: "/data",
|
|
178
|
-
projectId: "hzao7xsp",
|
|
179
|
-
dataset: "production",
|
|
180
|
-
icon: '<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"></path><path d="M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"></path><path d="M9 17v-4"></path><path d="M12 17v-1"></path><path d="M15 17v-2"></path><path d="M12 17v-1"></path></svg>',
|
|
181
|
-
schema: "b0fefb08.create-schema.json",
|
|
182
|
-
tools: "08382af6.create-tools.json",
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
name: "operations",
|
|
186
|
-
title: "SupportOS\u2122",
|
|
187
|
-
basePath: "/operations",
|
|
188
|
-
projectId: "hzao7xsp",
|
|
189
|
-
dataset: "production",
|
|
190
|
-
icon: '<svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2"></path><path d="M17 15c.345 .6 1.258 1 2 1a2 2 0 1 0 0 -4a2 2 0 1 1 0 -4c.746 0 1.656 .394 2 1"></path><path d="M3 15c.345 .6 1.258 1 2 1a2 2 0 1 0 0 -4a2 2 0 1 1 0 -4c.746 0 1.656 .394 2 1"></path></svg>',
|
|
191
|
-
schema: "cd26d36b.create-schema.json",
|
|
192
|
-
tools: "a6046e2d.create-tools.json",
|
|
193
|
-
},
|
|
194
|
-
],
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
config: {},
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
export const SINGLE_WORKSPACE_STUDIO_DATA = parseStudioUserApplication({
|
|
201
|
-
id: "0092b48439cd2aa19de05c2c",
|
|
202
|
-
projectId: "c16r74n4",
|
|
203
|
-
organizationId: null,
|
|
204
|
-
title: null,
|
|
205
|
-
type: "studio",
|
|
206
|
-
urlType: "internal",
|
|
207
|
-
appHost: "sanity-home",
|
|
208
|
-
dashboardStatus: "default",
|
|
209
|
-
createdAt: "2024-08-09T14:04:44.805Z",
|
|
210
|
-
updatedAt: "2025-09-19T08:33:10.922Z",
|
|
211
|
-
autoUpdatingVersion: "latest",
|
|
212
|
-
activeDeployment: {
|
|
213
|
-
id: "g8cp3s08izh6to03l0sycxfr",
|
|
214
|
-
version: "4.9.0",
|
|
215
|
-
isActiveDeployment: true,
|
|
216
|
-
userApplicationId: "0092b48439cd2aa19de05c2c",
|
|
217
|
-
isAutoUpdating: true,
|
|
218
|
-
size: 1433774,
|
|
219
|
-
deployedAt: "2025-09-19T08:16:13.060Z",
|
|
220
|
-
deployedBy: "go2WapeAw",
|
|
221
|
-
createdAt: "2025-09-19T08:16:12.930Z",
|
|
222
|
-
updatedAt: "2025-09-19T08:16:13.060Z",
|
|
223
|
-
manifest: null,
|
|
224
|
-
},
|
|
225
|
-
manifest: null,
|
|
226
|
-
manifestData: {
|
|
227
|
-
value: {
|
|
228
|
-
version: 2,
|
|
229
|
-
createdAt: "2025-09-19T08:16:12.185Z",
|
|
230
|
-
workspaces: [
|
|
231
|
-
{
|
|
232
|
-
name: "default",
|
|
233
|
-
title: "Sanity Home",
|
|
234
|
-
basePath: "/admin",
|
|
235
|
-
projectId: "c16r74n4",
|
|
236
|
-
dataset: "production",
|
|
237
|
-
icon: '<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1_1391)"><rect width="256" height="256" fill="white"></rect><rect width="256" height="256" fill="white"></rect><g clip-path="url(#clip1_1_1391)"><path d="M215.759 152.483L208.799 140.366L175.13 160.88L212.526 113.252L218.179 109.933L216.78 107.831L219.349 104.548L207.549 94.7227L202.147 101.608L93.1263 165.414L133.434 116.925L208.512 75.7566L201.379 61.963L160.486 84.3775L180.623 60.168L169.087 50L123.767 104.513L78.7575 129.206L113.217 83.6335L134.811 72.3909L127.953 58.4438L65.0424 91.2034L82.1978 68.4937L70.2143 58.8926L34 106.839L34.5619 107.288L41.3277 121.07L81.4753 100.155L44.8826 148.539L50.8801 153.345L54.4465 160.242L96.7156 137.06L50.1691 193.061L61.7054 203.229L64.0218 200.442L176.311 134.509L139.031 182.007L139.638 182.515L139.581 182.55L147.31 196.001L196.895 165.781L177.802 196.603L190.6 205L221 155.931L215.759 152.483Z" fill="#0B0B0B"></path></g></g><defs><clipPath id="clip0_1_1391"><rect width="256" height="256" fill="white"></rect></clipPath><clipPath id="clip1_1_1391"><rect width="187" height="155" fill="white" transform="translate(34 50)"></rect></clipPath></defs></svg>',
|
|
238
|
-
schema: "030a38ac.create-schema.json",
|
|
239
|
-
tools: "10657faf.create-tools.json",
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
config: {},
|
|
245
|
-
});
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line no-restricted-imports
|
|
2
|
-
import type { Resource as ProtocolResource } from "@sanity/message-protocol";
|
|
3
|
-
import { describe, expect, expectTypeOf, it } from "vitest";
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
APPLICATION_DATA,
|
|
7
|
-
CANVAS_DATA,
|
|
8
|
-
MEDIA_LIBRARY_DATA,
|
|
9
|
-
MULTIPLE_WORKSPACE_STUDIO_DATA,
|
|
10
|
-
PROJECTS,
|
|
11
|
-
SINGLE_WORKSPACE_STUDIO_DATA,
|
|
12
|
-
} from "../__tests__/__fixtures__";
|
|
13
|
-
import { CanvasApplication } from "../canvases";
|
|
14
|
-
import { MediaLibraryApplication } from "../media-libraries";
|
|
15
|
-
import { CoreAppApplication } from "../user-applications/core-app";
|
|
16
|
-
import {
|
|
17
|
-
StudioApplication,
|
|
18
|
-
StudioWorkspace,
|
|
19
|
-
} from "../user-applications/studios";
|
|
20
|
-
import { brandUserApplicationId } from "../user-applications/user-application";
|
|
21
|
-
import { ApplicationList } from "./application-list";
|
|
22
|
-
|
|
23
|
-
describe("ApplicationList", () => {
|
|
24
|
-
const create = () => {
|
|
25
|
-
const canvas = new CanvasApplication(CANVAS_DATA);
|
|
26
|
-
const mediaLibrary = new MediaLibraryApplication(MEDIA_LIBRARY_DATA);
|
|
27
|
-
const coreApp = new CoreAppApplication(APPLICATION_DATA);
|
|
28
|
-
const multiStudio = new StudioApplication(
|
|
29
|
-
MULTIPLE_WORKSPACE_STUDIO_DATA,
|
|
30
|
-
PROJECTS,
|
|
31
|
-
);
|
|
32
|
-
const singleStudio = new StudioApplication(
|
|
33
|
-
SINGLE_WORKSPACE_STUDIO_DATA,
|
|
34
|
-
PROJECTS,
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return new ApplicationList([
|
|
38
|
-
canvas,
|
|
39
|
-
mediaLibrary,
|
|
40
|
-
coreApp,
|
|
41
|
-
multiStudio,
|
|
42
|
-
singleStudio,
|
|
43
|
-
...multiStudio.workspaces,
|
|
44
|
-
...singleStudio.workspaces,
|
|
45
|
-
]);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
describe("findApplication", () => {
|
|
49
|
-
it("should find an application by type and correctly infer the type", () => {
|
|
50
|
-
const applicationList = create();
|
|
51
|
-
|
|
52
|
-
const canvasResource = applicationList.findApplication("canvas");
|
|
53
|
-
expect(canvasResource).toBeInstanceOf(CanvasApplication);
|
|
54
|
-
expectTypeOf(canvasResource).toEqualTypeOf<
|
|
55
|
-
CanvasApplication | undefined
|
|
56
|
-
>();
|
|
57
|
-
|
|
58
|
-
const mediaResource = applicationList.findApplication("media-library");
|
|
59
|
-
expect(mediaResource).toBeInstanceOf(MediaLibraryApplication);
|
|
60
|
-
expectTypeOf(mediaResource).toEqualTypeOf<
|
|
61
|
-
MediaLibraryApplication | undefined
|
|
62
|
-
>();
|
|
63
|
-
|
|
64
|
-
const applicationId = brandUserApplicationId(APPLICATION_DATA.id);
|
|
65
|
-
const foundCoreApplication = applicationList.findApplication(
|
|
66
|
-
"coreApp",
|
|
67
|
-
applicationId,
|
|
68
|
-
);
|
|
69
|
-
expect(foundCoreApplication).toBeInstanceOf(CoreAppApplication);
|
|
70
|
-
expectTypeOf(foundCoreApplication).toEqualTypeOf<
|
|
71
|
-
CoreAppApplication | undefined
|
|
72
|
-
>();
|
|
73
|
-
expect(foundCoreApplication?.id).toBe(applicationId);
|
|
74
|
-
|
|
75
|
-
const foundStudioApplication = applicationList.findApplication(
|
|
76
|
-
"studio",
|
|
77
|
-
brandUserApplicationId(MULTIPLE_WORKSPACE_STUDIO_DATA.id),
|
|
78
|
-
);
|
|
79
|
-
expect(foundStudioApplication).toBeInstanceOf(StudioApplication);
|
|
80
|
-
expectTypeOf(foundStudioApplication).toEqualTypeOf<
|
|
81
|
-
StudioApplication | undefined
|
|
82
|
-
>();
|
|
83
|
-
expect(foundStudioApplication?.id).toBe(
|
|
84
|
-
brandUserApplicationId(MULTIPLE_WORKSPACE_STUDIO_DATA.id),
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const workspaceId = StudioWorkspace.makeId(
|
|
88
|
-
brandUserApplicationId(SINGLE_WORKSPACE_STUDIO_DATA.id),
|
|
89
|
-
"default",
|
|
90
|
-
);
|
|
91
|
-
const foundWorkspace = applicationList.findApplication(
|
|
92
|
-
"workspace",
|
|
93
|
-
workspaceId,
|
|
94
|
-
);
|
|
95
|
-
expect(foundWorkspace).toBeInstanceOf(StudioWorkspace);
|
|
96
|
-
expectTypeOf(foundWorkspace).toEqualTypeOf<StudioWorkspace | undefined>();
|
|
97
|
-
expect(foundWorkspace?.id).toBe(workspaceId);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it("should find all applications of a given type", () => {
|
|
101
|
-
const applicationList = create();
|
|
102
|
-
|
|
103
|
-
const canvasResources = applicationList.findApplicationsByType("canvas");
|
|
104
|
-
expect(canvasResources).toHaveLength(1);
|
|
105
|
-
expectTypeOf(canvasResources).toEqualTypeOf<CanvasApplication[]>();
|
|
106
|
-
|
|
107
|
-
const mediaResources =
|
|
108
|
-
applicationList.findApplicationsByType("media-library");
|
|
109
|
-
expect(mediaResources).toHaveLength(1);
|
|
110
|
-
expectTypeOf(mediaResources).toEqualTypeOf<MediaLibraryApplication[]>();
|
|
111
|
-
|
|
112
|
-
const coreApplications =
|
|
113
|
-
applicationList.findApplicationsByType("coreApp");
|
|
114
|
-
expect(coreApplications).toHaveLength(1);
|
|
115
|
-
expectTypeOf(coreApplications).toEqualTypeOf<CoreAppApplication[]>();
|
|
116
|
-
|
|
117
|
-
const studioApplications =
|
|
118
|
-
applicationList.findApplicationsByType("studio");
|
|
119
|
-
expect(studioApplications).toHaveLength(2);
|
|
120
|
-
expectTypeOf(studioApplications).toEqualTypeOf<StudioApplication[]>();
|
|
121
|
-
|
|
122
|
-
const workspaceApplications =
|
|
123
|
-
applicationList.findApplicationsByType("workspace");
|
|
124
|
-
expect(workspaceApplications).toHaveLength(9);
|
|
125
|
-
expectTypeOf(workspaceApplications).toEqualTypeOf<StudioWorkspace[]>();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it("should allow passing multiple types to findApplicationsByType", () => {
|
|
129
|
-
const applicationList = create();
|
|
130
|
-
|
|
131
|
-
const applications = applicationList.findApplicationsByType([
|
|
132
|
-
"coreApp",
|
|
133
|
-
"studio",
|
|
134
|
-
]);
|
|
135
|
-
expect(applications).toHaveLength(3);
|
|
136
|
-
expect(applications[0]).toBeInstanceOf(CoreAppApplication);
|
|
137
|
-
expect(applications[1]).toBeInstanceOf(StudioApplication);
|
|
138
|
-
expect(applications[2]).toBeInstanceOf(StudioApplication);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it("should correctly merge workspaces with other application types when specified", () => {
|
|
142
|
-
const applicationList = create();
|
|
143
|
-
|
|
144
|
-
expect(
|
|
145
|
-
applicationList.findApplicationsByType(["coreApp", "workspace"]),
|
|
146
|
-
).toHaveLength(10);
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
describe("toProtocolResources", () => {
|
|
151
|
-
it("should return an array of protocol resources", () => {
|
|
152
|
-
const applicationList = create();
|
|
153
|
-
const protocolResources = applicationList.toProtocolResources();
|
|
154
|
-
expect(protocolResources).toHaveLength(12);
|
|
155
|
-
expectTypeOf(protocolResources).toEqualTypeOf<ProtocolResource[]>();
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
describe("static methods", () => {
|
|
160
|
-
describe("areApplicationsEqual", () => {
|
|
161
|
-
it("should return false if an application is undefined", () => {
|
|
162
|
-
const application = new CoreAppApplication(APPLICATION_DATA);
|
|
163
|
-
expect(
|
|
164
|
-
ApplicationList.areApplicationsEqual(undefined, application),
|
|
165
|
-
).toBe(false);
|
|
166
|
-
expect(
|
|
167
|
-
ApplicationList.areApplicationsEqual(application, undefined),
|
|
168
|
-
).toBe(false);
|
|
169
|
-
expect(ApplicationList.areApplicationsEqual(undefined, undefined)).toBe(
|
|
170
|
-
false,
|
|
171
|
-
);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it("should return true if the applications are the same", () => {
|
|
175
|
-
const application1 = new CoreAppApplication(APPLICATION_DATA);
|
|
176
|
-
const application2 = new CoreAppApplication(APPLICATION_DATA);
|
|
177
|
-
expect(
|
|
178
|
-
ApplicationList.areApplicationsEqual(application1, application2),
|
|
179
|
-
).toBe(true);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it("should return false if the applications are not the same", () => {
|
|
183
|
-
const application1 = new CoreAppApplication(APPLICATION_DATA);
|
|
184
|
-
const application2 = new StudioApplication(
|
|
185
|
-
MULTIPLE_WORKSPACE_STUDIO_DATA,
|
|
186
|
-
PROJECTS,
|
|
187
|
-
);
|
|
188
|
-
expect(
|
|
189
|
-
ApplicationList.areApplicationsEqual(application1, application2),
|
|
190
|
-
).toBe(false);
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it("should return true if the applications are the same studio", () => {
|
|
194
|
-
const application1 = new StudioApplication(
|
|
195
|
-
MULTIPLE_WORKSPACE_STUDIO_DATA,
|
|
196
|
-
PROJECTS,
|
|
197
|
-
);
|
|
198
|
-
const application2 = new StudioApplication(
|
|
199
|
-
MULTIPLE_WORKSPACE_STUDIO_DATA,
|
|
200
|
-
PROJECTS,
|
|
201
|
-
);
|
|
202
|
-
expect(
|
|
203
|
-
ApplicationList.areApplicationsEqual(application1, application2),
|
|
204
|
-
).toBe(true);
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it("should return false if the applications are not the same studio", () => {
|
|
208
|
-
const application1 = new StudioApplication(
|
|
209
|
-
MULTIPLE_WORKSPACE_STUDIO_DATA,
|
|
210
|
-
PROJECTS,
|
|
211
|
-
);
|
|
212
|
-
const application2 = new StudioApplication(
|
|
213
|
-
SINGLE_WORKSPACE_STUDIO_DATA,
|
|
214
|
-
PROJECTS,
|
|
215
|
-
);
|
|
216
|
-
expect(
|
|
217
|
-
ApplicationList.areApplicationsEqual(application1, application2),
|
|
218
|
-
).toBe(false);
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
});
|