@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
|
@@ -0,0 +1,892 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { valid, coerce, gt, lt, gte, rsort } from "semver";
|
|
3
|
+
const interfaceBaseFields = {
|
|
4
|
+
id: z.string(),
|
|
5
|
+
deployment_id: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
entry_point: z.string()
|
|
8
|
+
}, PanelInterfaceSchema = z.object({
|
|
9
|
+
...interfaceBaseFields,
|
|
10
|
+
interface_type: z.literal("panel")
|
|
11
|
+
}), WorkerInterfaceSchema = z.object({
|
|
12
|
+
...interfaceBaseFields,
|
|
13
|
+
interface_type: z.literal("worker")
|
|
14
|
+
}), AppInterfaceSchema = z.object({
|
|
15
|
+
...interfaceBaseFields,
|
|
16
|
+
interface_type: z.literal("app")
|
|
17
|
+
}), InterfaceSchema = z.discriminatedUnion("interface_type", [
|
|
18
|
+
PanelInterfaceSchema,
|
|
19
|
+
WorkerInterfaceSchema,
|
|
20
|
+
AppInterfaceSchema
|
|
21
|
+
]), LocalInterfaceSchema = z.discriminatedUnion("interface_type", [
|
|
22
|
+
PanelInterfaceSchema.omit({ id: !0, deployment_id: !0 }),
|
|
23
|
+
WorkerInterfaceSchema.omit({ id: !0, deployment_id: !0 }),
|
|
24
|
+
AppInterfaceSchema.omit({ id: !0, deployment_id: !0 })
|
|
25
|
+
]);
|
|
26
|
+
class AbstractApplication {
|
|
27
|
+
type;
|
|
28
|
+
constructor(type) {
|
|
29
|
+
this.type = type;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether the application is served by a local CLI dev server rather than a
|
|
33
|
+
* deployed remote. Defaults to `false`; user applications flip this when
|
|
34
|
+
* constructed from a `LocalUserApplication` payload.
|
|
35
|
+
*/
|
|
36
|
+
get isLocal() {
|
|
37
|
+
return !1;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Interfaces the application exposes (e.g. dock panels). Defaults to none;
|
|
41
|
+
* user applications surface what they declared via `unstable_defineApp`.
|
|
42
|
+
*/
|
|
43
|
+
get interfaces() {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Whether the application has a navigable full-page `app` view (US5, spec 002-workbench-extension-api). Defaults
|
|
48
|
+
* to `true` — studios, Canvas, and Media Library are always navigable. An SDK
|
|
49
|
+
* app overrides this to derive it from whether it declares an `app` interface.
|
|
50
|
+
*/
|
|
51
|
+
get hasAppView() {
|
|
52
|
+
return !0;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Federation module id of the app's full-page view (`${id}/App`), or `null`
|
|
56
|
+
* when it can't be federation-loaded: the app isn't federated (Canvas, Media
|
|
57
|
+
* Library, deployed apps shown in an iframe) or has no app view. Only a
|
|
58
|
+
* non-null `moduleId` is fetched and rendered by the remotes machine.
|
|
59
|
+
*/
|
|
60
|
+
get moduleId() {
|
|
61
|
+
return this.isFederated && this.hasAppView ? `${this.id}/App` : null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Federation module id of one of this app's panel view components, or `null`
|
|
65
|
+
* when the app isn't federated (a non-federated app's panels can't be loaded
|
|
66
|
+
* as remotes).
|
|
67
|
+
*/
|
|
68
|
+
resolveViewModuleId(view, component) {
|
|
69
|
+
return this.isFederated ? `${this.id}/views/${view.name}/${component}` : null;
|
|
70
|
+
}
|
|
71
|
+
get initials() {
|
|
72
|
+
const SYMBOLS = /[^\p{Alpha}\p{N}\p{White_Space}]/gu, WHITESPACE = new RegExp("\\p{White_Space}+", "u"), ALPHANUMERIC_SEGMENTS = new RegExp("(\\p{N}+|\\p{Alpha}+)", "gu"), IS_NUMERIC = new RegExp("^\\p{N}+$", "u");
|
|
73
|
+
if (!this.title) return "";
|
|
74
|
+
const namesArray = this.title.replace(SYMBOLS, "").split(WHITESPACE).filter(Boolean);
|
|
75
|
+
if (namesArray.length === 0) return "";
|
|
76
|
+
if (namesArray.length === 1) {
|
|
77
|
+
const word = namesArray[0], segments = word.match(ALPHANUMERIC_SEGMENTS) || [];
|
|
78
|
+
return segments.length === 0 ? "" : segments.length === 1 ? word.length === 1 ? word.toUpperCase() : IS_NUMERIC.test(word) ? `${word.charAt(0)}${word.charAt(1)}`.toUpperCase() : word.charAt(0).toUpperCase() : `${segments[0].charAt(0)}${segments[1].charAt(0)}`.toUpperCase();
|
|
79
|
+
}
|
|
80
|
+
return `${namesArray[0].charAt(0)}${namesArray[namesArray.length - 1].charAt(0)}`.toUpperCase();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function getSanityDomain() {
|
|
84
|
+
return getSanityEnv() === "staging" ? "sanity.work" : "sanity.io";
|
|
85
|
+
}
|
|
86
|
+
function getApiHost() {
|
|
87
|
+
return `https://api.${getSanityDomain()}`;
|
|
88
|
+
}
|
|
89
|
+
function getSanityEnv() {
|
|
90
|
+
return typeof __SANITY_STAGING__ < "u" && __SANITY_STAGING__ === !0 ? "staging" : "production";
|
|
91
|
+
}
|
|
92
|
+
const OrganizationId = z.string().nonempty().brand("OrganizationId");
|
|
93
|
+
function brandOrganizationId(id) {
|
|
94
|
+
return OrganizationId.parse(id);
|
|
95
|
+
}
|
|
96
|
+
const OrganizationMember = z.object({
|
|
97
|
+
sanityUserId: z.string(),
|
|
98
|
+
isCurrentUser: z.boolean(),
|
|
99
|
+
user: z.object({
|
|
100
|
+
id: z.string(),
|
|
101
|
+
displayName: z.string(),
|
|
102
|
+
familyName: z.string(),
|
|
103
|
+
givenName: z.string(),
|
|
104
|
+
middleName: z.string().nullable(),
|
|
105
|
+
imageUrl: z.string().nullable(),
|
|
106
|
+
email: z.string(),
|
|
107
|
+
loginProvider: z.string()
|
|
108
|
+
}),
|
|
109
|
+
roles: z.array(
|
|
110
|
+
z.object({
|
|
111
|
+
name: z.string(),
|
|
112
|
+
title: z.string(),
|
|
113
|
+
description: z.string().optional()
|
|
114
|
+
})
|
|
115
|
+
)
|
|
116
|
+
}), Organization = z.object({
|
|
117
|
+
id: OrganizationId,
|
|
118
|
+
name: z.string(),
|
|
119
|
+
slug: z.string().nullable(),
|
|
120
|
+
createdAt: z.string(),
|
|
121
|
+
updatedAt: z.string(),
|
|
122
|
+
dashboardStatus: z.enum(["enabled", "disabled"]),
|
|
123
|
+
aiFeaturesStatus: z.enum(["enabled", "disabled"]),
|
|
124
|
+
defaultRoleName: z.string().nullable()
|
|
125
|
+
});
|
|
126
|
+
function parseOrganization(data, options) {
|
|
127
|
+
const includeMembers = options?.includeMembers ?? !0, includeFeatures = options?.includeFeatures ?? !0, extensions = {
|
|
128
|
+
...includeMembers && {
|
|
129
|
+
members: z.array(OrganizationMember)
|
|
130
|
+
},
|
|
131
|
+
...includeFeatures && {
|
|
132
|
+
features: z.array(z.string())
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
return (Object.keys(extensions).length > 0 ? Organization.extend(extensions) : Organization).parse(data);
|
|
136
|
+
}
|
|
137
|
+
const CanvasId = z.string().nonempty().brand("CanvasId");
|
|
138
|
+
function brandCanvasId(id) {
|
|
139
|
+
return CanvasId.parse(id);
|
|
140
|
+
}
|
|
141
|
+
const Canvas = z.object({
|
|
142
|
+
id: CanvasId,
|
|
143
|
+
organizationId: OrganizationId,
|
|
144
|
+
status: z.enum(["active", "provisioning"])
|
|
145
|
+
});
|
|
146
|
+
function parseCanvas(data) {
|
|
147
|
+
return Canvas.parse(data);
|
|
148
|
+
}
|
|
149
|
+
class CanvasApplication extends AbstractApplication {
|
|
150
|
+
canvas;
|
|
151
|
+
constructor(canvas) {
|
|
152
|
+
super("canvas"), this.canvas = canvas;
|
|
153
|
+
}
|
|
154
|
+
get id() {
|
|
155
|
+
return this.canvas.id;
|
|
156
|
+
}
|
|
157
|
+
get href() {
|
|
158
|
+
return "canvas";
|
|
159
|
+
}
|
|
160
|
+
get title() {
|
|
161
|
+
return "Canvas";
|
|
162
|
+
}
|
|
163
|
+
get url() {
|
|
164
|
+
return new URL(
|
|
165
|
+
`https://canvas.${getSanityDomain()}/o/${this.canvas.organizationId}`
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
get isFederated() {
|
|
169
|
+
return !1;
|
|
170
|
+
}
|
|
171
|
+
toProtocolResource() {
|
|
172
|
+
return {
|
|
173
|
+
type: "canvas",
|
|
174
|
+
id: this.id
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const MediaLibraryId = z.string().nonempty().brand("MediaLibraryId");
|
|
179
|
+
function brandMediaLibraryId(id) {
|
|
180
|
+
return MediaLibraryId.parse(id);
|
|
181
|
+
}
|
|
182
|
+
const MediaLibrary = z.object({
|
|
183
|
+
id: MediaLibraryId,
|
|
184
|
+
organizationId: OrganizationId,
|
|
185
|
+
status: z.enum(["active", "provisioning"]),
|
|
186
|
+
aclMode: z.enum(["private", "public"])
|
|
187
|
+
});
|
|
188
|
+
function parseMediaLibrary(data) {
|
|
189
|
+
return MediaLibrary.parse(data);
|
|
190
|
+
}
|
|
191
|
+
class MediaLibraryApplication extends AbstractApplication {
|
|
192
|
+
library;
|
|
193
|
+
constructor(library) {
|
|
194
|
+
super("media-library"), this.library = library;
|
|
195
|
+
}
|
|
196
|
+
get id() {
|
|
197
|
+
return this.library.id;
|
|
198
|
+
}
|
|
199
|
+
get href() {
|
|
200
|
+
return "media";
|
|
201
|
+
}
|
|
202
|
+
get title() {
|
|
203
|
+
return "Media Library";
|
|
204
|
+
}
|
|
205
|
+
get isFederated() {
|
|
206
|
+
return !1;
|
|
207
|
+
}
|
|
208
|
+
get url() {
|
|
209
|
+
return new URL(
|
|
210
|
+
`https://media.${getSanityDomain()}/${this.library.organizationId}`
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
toProtocolResource() {
|
|
214
|
+
return {
|
|
215
|
+
type: "media-library",
|
|
216
|
+
id: this.id
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const ProjectId = z.string().nonempty().brand("ProjectId");
|
|
221
|
+
function brandProjectId(id) {
|
|
222
|
+
return ProjectId.parse(id);
|
|
223
|
+
}
|
|
224
|
+
const ProjectMember = z.object({
|
|
225
|
+
id: z.string(),
|
|
226
|
+
createdAt: z.string(),
|
|
227
|
+
updatedAt: z.string(),
|
|
228
|
+
isCurrentUser: z.boolean(),
|
|
229
|
+
isRobot: z.boolean(),
|
|
230
|
+
roles: z.array(
|
|
231
|
+
z.object({
|
|
232
|
+
name: z.string(),
|
|
233
|
+
title: z.string(),
|
|
234
|
+
description: z.string()
|
|
235
|
+
})
|
|
236
|
+
)
|
|
237
|
+
}), Project = z.object({
|
|
238
|
+
id: ProjectId,
|
|
239
|
+
displayName: z.string(),
|
|
240
|
+
studioHost: z.string().nullable(),
|
|
241
|
+
organizationId: OrganizationId,
|
|
242
|
+
metadata: z.object({
|
|
243
|
+
color: z.string().optional(),
|
|
244
|
+
externalStudioHost: z.string().optional(),
|
|
245
|
+
initialTemplate: z.string().optional(),
|
|
246
|
+
cliInitializedAt: z.string().optional(),
|
|
247
|
+
integration: z.string().optional()
|
|
248
|
+
}),
|
|
249
|
+
isBlocked: z.boolean(),
|
|
250
|
+
isDisabled: z.boolean(),
|
|
251
|
+
isDisabledByUser: z.boolean(),
|
|
252
|
+
activityFeedEnabled: z.boolean(),
|
|
253
|
+
createdAt: z.string(),
|
|
254
|
+
updatedAt: z.string()
|
|
255
|
+
});
|
|
256
|
+
function parseProject(data, options) {
|
|
257
|
+
const includeMembers = options?.includeMembers ?? !0, includeFeatures = options?.includeFeatures ?? !0, extensions = {
|
|
258
|
+
...includeMembers && { members: z.array(ProjectMember) },
|
|
259
|
+
...includeFeatures && { features: z.array(z.string()) }
|
|
260
|
+
};
|
|
261
|
+
return (Object.keys(extensions).length > 0 ? Project.extend(extensions) : Project).parse(data);
|
|
262
|
+
}
|
|
263
|
+
const joinUrlPaths = (...paths) => {
|
|
264
|
+
let nextPath = null;
|
|
265
|
+
const safeJoinSegments = (segment1, segment2) => segment1 ? segment2 ? segment1.endsWith("/") && segment2.startsWith("/") ? segment1 + segment2.slice(1) : segment1.endsWith("/") || segment2.startsWith("/") ? segment1 + segment2 : `${segment1}/${segment2}` : segment1 : segment2 || "", validPaths = paths.filter(
|
|
266
|
+
(path) => path != null
|
|
267
|
+
);
|
|
268
|
+
for (const path of validPaths)
|
|
269
|
+
nextPath = safeJoinSegments(
|
|
270
|
+
nextPath,
|
|
271
|
+
path instanceof URL ? path.pathname : path
|
|
272
|
+
);
|
|
273
|
+
return nextPath ?? "";
|
|
274
|
+
};
|
|
275
|
+
function normalizePath(pathname) {
|
|
276
|
+
return pathname.startsWith("/") || (pathname = `/${pathname}`), pathname !== "/" && pathname.endsWith("/") && (pathname = pathname.slice(0, -1)), pathname;
|
|
277
|
+
}
|
|
278
|
+
const UserApplicationId = z.string().nonempty().brand("UserApplicationId");
|
|
279
|
+
function brandUserApplicationId(id) {
|
|
280
|
+
return UserApplicationId.parse(id);
|
|
281
|
+
}
|
|
282
|
+
const LocalUserApplicationBase = z.object({
|
|
283
|
+
host: z.string(),
|
|
284
|
+
port: z.number(),
|
|
285
|
+
/**
|
|
286
|
+
* Interfaces the app exposes — dock panels (`interface_type: "panel"`) and
|
|
287
|
+
* background workers (`interface_type: "worker"`), forwarded from the dev
|
|
288
|
+
* server in one list.
|
|
289
|
+
*/
|
|
290
|
+
interfaces: z.array(LocalInterfaceSchema).optional(),
|
|
291
|
+
/** The `deployment.appId` from the application's `sanity.cli.ts`, when set. */
|
|
292
|
+
id: z.string().optional(),
|
|
293
|
+
/**
|
|
294
|
+
* The `api.projectId` from the application's `sanity.cli.ts`. Available
|
|
295
|
+
* synchronously at dev-server startup (no manifest extraction required), so
|
|
296
|
+
* the studio's primary project is resolvable from the very first local
|
|
297
|
+
* application event.
|
|
298
|
+
*/
|
|
299
|
+
projectId: z.string().optional()
|
|
300
|
+
}), LocalUserApplication = z.discriminatedUnion("type", [
|
|
301
|
+
LocalUserApplicationBase.extend({
|
|
302
|
+
type: z.literal("studio"),
|
|
303
|
+
manifest: z.custom().optional()
|
|
304
|
+
}),
|
|
305
|
+
LocalUserApplicationBase.extend({
|
|
306
|
+
type: z.literal("coreApp"),
|
|
307
|
+
manifest: z.custom().optional()
|
|
308
|
+
})
|
|
309
|
+
]), UserApplicationBase = z.object({
|
|
310
|
+
id: UserApplicationId,
|
|
311
|
+
appHost: z.string(),
|
|
312
|
+
urlType: z.enum(["internal", "external"]),
|
|
313
|
+
createdAt: z.string(),
|
|
314
|
+
updatedAt: z.string(),
|
|
315
|
+
dashboardStatus: z.enum(["default", "disabled"]),
|
|
316
|
+
/**
|
|
317
|
+
* Interfaces the app exposes (dock panels and background workers). Not part
|
|
318
|
+
* of the manifest.
|
|
319
|
+
*/
|
|
320
|
+
interfaces: z.array(LocalInterfaceSchema).optional()
|
|
321
|
+
}), ActiveDeployment = z.object({
|
|
322
|
+
id: z.string(),
|
|
323
|
+
version: z.string(),
|
|
324
|
+
isActiveDeployment: z.boolean(),
|
|
325
|
+
userApplicationId: z.string(),
|
|
326
|
+
isAutoUpdating: z.boolean().nullable(),
|
|
327
|
+
size: z.number().nullable(),
|
|
328
|
+
deployedAt: z.string(),
|
|
329
|
+
deployedBy: z.string(),
|
|
330
|
+
createdAt: z.string(),
|
|
331
|
+
updatedAt: z.string()
|
|
332
|
+
});
|
|
333
|
+
class UserApplication extends AbstractApplication {
|
|
334
|
+
application;
|
|
335
|
+
id;
|
|
336
|
+
/**
|
|
337
|
+
* For local applications (`isLocal === true`), the deployed application
|
|
338
|
+
* that shares the same `id` — if one was passed at construction. `null`
|
|
339
|
+
* for deployed applications or when no remote twin was provided.
|
|
340
|
+
*/
|
|
341
|
+
remoteApplication;
|
|
342
|
+
#isLocal;
|
|
343
|
+
constructor(application, type, options = {}) {
|
|
344
|
+
super(type), this.application = application, this.id = brandUserApplicationId(application.id), this.#isLocal = options.isLocal ?? !1, this.remoteApplication = options.remoteApplication ?? null;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Local dev servers are rendered as federated remotes; deployed applications
|
|
348
|
+
* are rendered in an iframe.
|
|
349
|
+
*/
|
|
350
|
+
get isFederated() {
|
|
351
|
+
return this.isLocal;
|
|
352
|
+
}
|
|
353
|
+
get isLocal() {
|
|
354
|
+
return this.#isLocal;
|
|
355
|
+
}
|
|
356
|
+
get interfaces() {
|
|
357
|
+
return this.application.interfaces ?? [];
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* @returns A fully resolved URL instance for the application.
|
|
361
|
+
* For internal applications, constructs a URL using the Sanity studio domain
|
|
362
|
+
* pattern resolved from the environment at the consuming app's build time.
|
|
363
|
+
* For external applications (including local dev servers), returns the
|
|
364
|
+
* provided app host as a URL.
|
|
365
|
+
*/
|
|
366
|
+
get url() {
|
|
367
|
+
return this.application.urlType === "internal" ? getSanityEnv() === "production" ? new URL(`https://${this.application.appHost}.sanity.studio`) : new URL(
|
|
368
|
+
`https://${this.application.appHost}.studio.${getSanityDomain()}`
|
|
369
|
+
) : new URL(this.application.appHost);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const CoreAppUserApplicationManifest = z.object({
|
|
373
|
+
version: z.string(),
|
|
374
|
+
icon: z.string().optional(),
|
|
375
|
+
title: z.string().optional(),
|
|
376
|
+
group: z.string().optional(),
|
|
377
|
+
priority: z.number().optional()
|
|
378
|
+
}), CoreAppUserApplicationBase = UserApplicationBase.extend({
|
|
379
|
+
title: z.string(),
|
|
380
|
+
organizationId: OrganizationId,
|
|
381
|
+
type: z.literal("coreApp")
|
|
382
|
+
}), CoreAppActiveDeployment = ActiveDeployment.extend({
|
|
383
|
+
manifest: CoreAppUserApplicationManifest.nullable()
|
|
384
|
+
}).nullable(), InternalCoreAppUserApplication = CoreAppUserApplicationBase.extend({
|
|
385
|
+
urlType: z.literal("internal"),
|
|
386
|
+
activeDeployment: CoreAppActiveDeployment
|
|
387
|
+
}), ExternalCoreAppUserApplication = CoreAppUserApplicationBase.extend({
|
|
388
|
+
urlType: z.literal("external"),
|
|
389
|
+
activeDeployment: CoreAppActiveDeployment
|
|
390
|
+
}), CoreAppUserApplication = z.discriminatedUnion("urlType", [
|
|
391
|
+
InternalCoreAppUserApplication,
|
|
392
|
+
ExternalCoreAppUserApplication
|
|
393
|
+
]);
|
|
394
|
+
function parseCoreApplication(data) {
|
|
395
|
+
return CoreAppUserApplication.parse(data);
|
|
396
|
+
}
|
|
397
|
+
class CoreAppApplication extends UserApplication {
|
|
398
|
+
activeDeployment;
|
|
399
|
+
constructor(application, options = {}) {
|
|
400
|
+
super(application, "coreApp", options), this.activeDeployment = application.activeDeployment;
|
|
401
|
+
}
|
|
402
|
+
// Typed `string | null` so the UI-aware remote subclass can override it to
|
|
403
|
+
// `null` for a non-navigable app (US5, spec 002-workbench-extension-api); the core route itself is always set.
|
|
404
|
+
get href() {
|
|
405
|
+
return this.isLocal ? `/local/${this.id}` : `/application/${this.application.id}`;
|
|
406
|
+
}
|
|
407
|
+
get title() {
|
|
408
|
+
return this.manifest?.title ?? this.application.title;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Resolves the core app's manifest from `activeDeployment.manifest`. This
|
|
412
|
+
* is the canonical (and only) slot for core app manifests — both for
|
|
413
|
+
* Sanity-deployed apps and for local CLI dev-server apps, which synthesise
|
|
414
|
+
* a deployment to surface the live manifest.
|
|
415
|
+
*/
|
|
416
|
+
get manifest() {
|
|
417
|
+
return this.activeDeployment?.manifest ?? null;
|
|
418
|
+
}
|
|
419
|
+
get subtitle() {
|
|
420
|
+
}
|
|
421
|
+
get updatedAt() {
|
|
422
|
+
return this.application.updatedAt;
|
|
423
|
+
}
|
|
424
|
+
get(attr) {
|
|
425
|
+
if (!(attr in this.application))
|
|
426
|
+
throw new Error(
|
|
427
|
+
`Attribute ${attr.toString()} does not exist on application ${this.application.id}`
|
|
428
|
+
);
|
|
429
|
+
return this.application[attr];
|
|
430
|
+
}
|
|
431
|
+
toProtocolResource() {
|
|
432
|
+
return {
|
|
433
|
+
...this.application,
|
|
434
|
+
type: "application",
|
|
435
|
+
url: this.url.toString()
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
const Workspace = z.object({
|
|
440
|
+
name: z.string(),
|
|
441
|
+
title: z.string(),
|
|
442
|
+
subtitle: z.string().optional(),
|
|
443
|
+
basePath: z.string(),
|
|
444
|
+
projectId: ProjectId,
|
|
445
|
+
dataset: z.string().optional(),
|
|
446
|
+
icon: z.string().nullable().optional()
|
|
447
|
+
}), ServerManifest = z.object({
|
|
448
|
+
buildId: z.string().optional(),
|
|
449
|
+
bundleVersion: z.string().optional(),
|
|
450
|
+
version: z.string().optional(),
|
|
451
|
+
group: z.string().optional(),
|
|
452
|
+
priority: z.number().optional(),
|
|
453
|
+
workspaces: z.array(
|
|
454
|
+
Workspace.extend({
|
|
455
|
+
dataset: z.string(),
|
|
456
|
+
schemaDescriptorId: z.string()
|
|
457
|
+
})
|
|
458
|
+
).optional()
|
|
459
|
+
}), ClientManifest = z.object({
|
|
460
|
+
version: z.number(),
|
|
461
|
+
createdAt: z.string(),
|
|
462
|
+
studioVersion: z.string().optional(),
|
|
463
|
+
group: z.string().optional(),
|
|
464
|
+
priority: z.number().optional(),
|
|
465
|
+
workspaces: z.array(
|
|
466
|
+
Workspace.extend({
|
|
467
|
+
schema: z.string(),
|
|
468
|
+
tools: z.string().optional()
|
|
469
|
+
})
|
|
470
|
+
)
|
|
471
|
+
}), StudioUserApplicationBase = UserApplicationBase.extend({
|
|
472
|
+
title: z.string().nullable(),
|
|
473
|
+
projectId: ProjectId,
|
|
474
|
+
type: z.literal("studio"),
|
|
475
|
+
/**
|
|
476
|
+
* @deprecated Use `manifestData` instead.
|
|
477
|
+
*/
|
|
478
|
+
manifest: ClientManifest.nullable(),
|
|
479
|
+
manifestData: z.object({ value: ClientManifest }).nullable(),
|
|
480
|
+
autoUpdatingVersion: z.string().nullable(),
|
|
481
|
+
config: z.object({
|
|
482
|
+
"live-manifest": z.object({
|
|
483
|
+
createdAt: z.string(),
|
|
484
|
+
updatedAt: z.string(),
|
|
485
|
+
updatedBy: z.string(),
|
|
486
|
+
value: ServerManifest
|
|
487
|
+
}).optional()
|
|
488
|
+
})
|
|
489
|
+
}), InternalStudioUserApplication = StudioUserApplicationBase.extend({
|
|
490
|
+
urlType: z.literal("internal"),
|
|
491
|
+
activeDeployment: ActiveDeployment.extend({
|
|
492
|
+
manifest: ServerManifest.nullable()
|
|
493
|
+
}).nullable()
|
|
494
|
+
}), ExternalStudioUserApplication = StudioUserApplicationBase.extend({
|
|
495
|
+
urlType: z.literal("external"),
|
|
496
|
+
activeDeployment: ActiveDeployment.extend({
|
|
497
|
+
manifest: ServerManifest.nullable()
|
|
498
|
+
}).nullable()
|
|
499
|
+
}), StudioUserApplication = z.discriminatedUnion("urlType", [
|
|
500
|
+
InternalStudioUserApplication,
|
|
501
|
+
ExternalStudioUserApplication
|
|
502
|
+
]);
|
|
503
|
+
function parseStudioUserApplication(data) {
|
|
504
|
+
return StudioUserApplication.parse(data);
|
|
505
|
+
}
|
|
506
|
+
class StudioWorkspace extends AbstractApplication {
|
|
507
|
+
/**
|
|
508
|
+
* Workspaces always belong to a studio application.
|
|
509
|
+
* They do not exist on their own & therefore can access
|
|
510
|
+
* information about the studio they're in via this property.
|
|
511
|
+
*/
|
|
512
|
+
studioApplication;
|
|
513
|
+
workspace;
|
|
514
|
+
project;
|
|
515
|
+
isDefaultWorkspace;
|
|
516
|
+
constructor(studioApplication, workspace, project, isDefaultWorkspace) {
|
|
517
|
+
super("workspace"), this.studioApplication = studioApplication, this.workspace = workspace, this.project = project, this.isDefaultWorkspace = isDefaultWorkspace;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* The studio application that this workspace belongs to.
|
|
521
|
+
*/
|
|
522
|
+
get studio() {
|
|
523
|
+
return this.studioApplication;
|
|
524
|
+
}
|
|
525
|
+
get id() {
|
|
526
|
+
return StudioWorkspace.makeId(this.studio.id, this.workspace.name);
|
|
527
|
+
}
|
|
528
|
+
get href() {
|
|
529
|
+
return joinUrlPaths(this.studio.href, this.workspace.name);
|
|
530
|
+
}
|
|
531
|
+
get title() {
|
|
532
|
+
return this.isDefaultWorkspace ? this.project.displayName : this.workspace.title;
|
|
533
|
+
}
|
|
534
|
+
get subtitle() {
|
|
535
|
+
return this.isDefaultWorkspace ? (URL.canParse(this.studio.get("appHost")) ? new URL(this.studio.get("appHost")) : this.studio.url).hostname : this.get("subtitle");
|
|
536
|
+
}
|
|
537
|
+
get(attr) {
|
|
538
|
+
return this.workspace[attr];
|
|
539
|
+
}
|
|
540
|
+
get isFederated() {
|
|
541
|
+
return this.studio.isFederated;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* With comlink, studio-applications were not considered applications at all, only workspaces. This is partially why
|
|
545
|
+
* we create default workspaces when the application has no manifest or the manifest has no workspaces.
|
|
546
|
+
*
|
|
547
|
+
* Thereby, to create it we depend on a lot of information from the parent application even if it's duplicated across
|
|
548
|
+
* different workspaces.
|
|
549
|
+
*/
|
|
550
|
+
toProtocolResource() {
|
|
551
|
+
return {
|
|
552
|
+
...this.workspace,
|
|
553
|
+
type: "studio",
|
|
554
|
+
userApplicationId: this.studio.id,
|
|
555
|
+
// The protocol still types `size`/`isAutoUpdating` as non-nullable,
|
|
556
|
+
// but the user-applications API reports both as nullable.
|
|
557
|
+
activeDeployment: this.studio.get(
|
|
558
|
+
"activeDeployment"
|
|
559
|
+
),
|
|
560
|
+
autoUpdatingVersion: this.studio.get("autoUpdatingVersion"),
|
|
561
|
+
dashboardStatus: this.studio.get("dashboardStatus"),
|
|
562
|
+
url: this.studio.url.toString(),
|
|
563
|
+
href: this.href,
|
|
564
|
+
id: this.id,
|
|
565
|
+
hasManifest: !0,
|
|
566
|
+
hasSchema: !!("schema" in this.workspace && this.workspace.schema),
|
|
567
|
+
// The protocol resource requires the client-shaped manifest (workspaces
|
|
568
|
+
// with `schema`). Read those sources directly rather than the unified
|
|
569
|
+
// `manifest` getter, which may return a `ServerManifest` for studios
|
|
570
|
+
// with a deployment manifest.
|
|
571
|
+
manifest: this.studio.get("manifestData")?.value ?? this.studio.get("manifest") ?? null,
|
|
572
|
+
updatedAt: this.studio.get("updatedAt"),
|
|
573
|
+
version: this.studio.get("activeDeployment")?.version,
|
|
574
|
+
urlType: this.studio.get("urlType"),
|
|
575
|
+
config: this.studio.get("config")
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* @returns the URL to the workspace of a studio application.
|
|
580
|
+
*/
|
|
581
|
+
get url() {
|
|
582
|
+
const studioUrl = new URL(this.studio.url), normalizedUrlPath = normalizePath(studioUrl.pathname);
|
|
583
|
+
let finalBasePath = normalizePath(this.get("basePath"));
|
|
584
|
+
return finalBasePath.startsWith(normalizedUrlPath) && (finalBasePath = finalBasePath.slice(normalizedUrlPath.length)), studioUrl.pathname = joinUrlPaths(normalizedUrlPath, finalBasePath), studioUrl;
|
|
585
|
+
}
|
|
586
|
+
static makeId(applicationId, workspaceName) {
|
|
587
|
+
return `${applicationId}-${workspaceName}`;
|
|
588
|
+
}
|
|
589
|
+
static splitId(id) {
|
|
590
|
+
return id.split(new RegExp(/-(.*)/)).slice(0, 2);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
const Manifest = z.union([
|
|
594
|
+
ClientManifest.superRefine((data, ctx) => {
|
|
595
|
+
data.version || ctx.addIssue({
|
|
596
|
+
code: "invalid_type",
|
|
597
|
+
message: "Manifest version is too old",
|
|
598
|
+
expected: "number"
|
|
599
|
+
}), data.version < 2 && ctx.addIssue({
|
|
600
|
+
code: "invalid_value",
|
|
601
|
+
message: "Manifest version is too old",
|
|
602
|
+
values: [2, 3]
|
|
603
|
+
}), data.version >= 3 && !data.studioVersion && ctx.addIssue({
|
|
604
|
+
code: "invalid_type",
|
|
605
|
+
message: "Manifest version 3 or higher requires a `studioVersion`",
|
|
606
|
+
expected: "string"
|
|
607
|
+
});
|
|
608
|
+
}),
|
|
609
|
+
ServerManifest
|
|
610
|
+
]), DEFAULT_WORKSPACE_DATA = {
|
|
611
|
+
name: "default",
|
|
612
|
+
title: "Default",
|
|
613
|
+
basePath: "/"
|
|
614
|
+
};
|
|
615
|
+
class StudioApplication extends UserApplication {
|
|
616
|
+
/**
|
|
617
|
+
* Returns a list of studio workspaces based on the application manifest.
|
|
618
|
+
* If there is no manifest, or alternatively it is not valid, then we create a default workspace.
|
|
619
|
+
*/
|
|
620
|
+
workspaces = [];
|
|
621
|
+
project;
|
|
622
|
+
/**
|
|
623
|
+
* The projects actually referenced by this studio — the application's own
|
|
624
|
+
* project plus any project used by a workspace. Preserved so the instance
|
|
625
|
+
* can be re-constructed (e.g. by dock wrappers) without having to thread
|
|
626
|
+
* the full organization project list through again.
|
|
627
|
+
*/
|
|
628
|
+
projects;
|
|
629
|
+
/**
|
|
630
|
+
* @param application - The studio application to create a list of workspaces for
|
|
631
|
+
* @param projects - The projects available in the organization. It's not enough to just pass
|
|
632
|
+
* the project that associates with the application because that is the project the app is deployed in relation to.
|
|
633
|
+
* The workspaces may have different projects completely.
|
|
634
|
+
*/
|
|
635
|
+
constructor(application, projects, options = {}) {
|
|
636
|
+
super(application, "studio", options);
|
|
637
|
+
let workspaces = [];
|
|
638
|
+
const manifest = this.manifest;
|
|
639
|
+
if (manifest)
|
|
640
|
+
try {
|
|
641
|
+
workspaces = Manifest.parse(manifest).workspaces ?? [];
|
|
642
|
+
} catch (error) {
|
|
643
|
+
console.warn(
|
|
644
|
+
`Failed to parse manifest for application ${application.id}`,
|
|
645
|
+
error
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
const workspacesWithProjectsMap = workspaces.reduce((acc, workspace) => {
|
|
649
|
+
const project2 = projects.find((p) => p.id === workspace.projectId);
|
|
650
|
+
return project2 ? acc.set(workspace, project2) : console.warn(
|
|
651
|
+
`Project not found for application ${application.id} and workspace ${workspace.name}. This workspace has been omitted.`
|
|
652
|
+
), acc;
|
|
653
|
+
}, /* @__PURE__ */ new Map()), project = projects.find((p) => p.id === application.projectId);
|
|
654
|
+
if (!project)
|
|
655
|
+
throw new Error(`Project not found for application ${application.id}`);
|
|
656
|
+
workspacesWithProjectsMap.size === 0 && workspacesWithProjectsMap.set(
|
|
657
|
+
{
|
|
658
|
+
...DEFAULT_WORKSPACE_DATA,
|
|
659
|
+
projectId: application.projectId
|
|
660
|
+
},
|
|
661
|
+
project
|
|
662
|
+
), this.workspaces = Object.freeze(
|
|
663
|
+
Array.from(workspacesWithProjectsMap.entries()).map(([workspace, p]) => {
|
|
664
|
+
const isDefaultWorkspace = workspace.name === DEFAULT_WORKSPACE_DATA.name && workspace.basePath === DEFAULT_WORKSPACE_DATA.basePath && workspace.title === DEFAULT_WORKSPACE_DATA.title;
|
|
665
|
+
return this.createWorkspace(workspace, p, isDefaultWorkspace);
|
|
666
|
+
})
|
|
667
|
+
), this.project = project;
|
|
668
|
+
const usedProjects = /* @__PURE__ */ new Set([project]);
|
|
669
|
+
for (const workspace of this.workspaces)
|
|
670
|
+
usedProjects.add(workspace.project);
|
|
671
|
+
this.projects = Array.from(usedProjects);
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Factory hook called for each workspace during construction. Subclasses
|
|
675
|
+
* override this to substitute a `StudioWorkspace` subclass (e.g. a UI-aware
|
|
676
|
+
* variant in a downstream package) without re-implementing the constructor's
|
|
677
|
+
* workspace-derivation logic.
|
|
678
|
+
*/
|
|
679
|
+
createWorkspace(workspace, project, isDefaultWorkspace) {
|
|
680
|
+
return new StudioWorkspace(this, workspace, project, isDefaultWorkspace);
|
|
681
|
+
}
|
|
682
|
+
get href() {
|
|
683
|
+
return this.isLocal ? `/local/${this.id}` : `/studio/${this.application.id}`;
|
|
684
|
+
}
|
|
685
|
+
get title() {
|
|
686
|
+
return this.get("title") || (this.workspaces.length > 1 && this.get("urlType") === "internal" ? this.project.displayName : this.workspaces[0].title);
|
|
687
|
+
}
|
|
688
|
+
get subtitle() {
|
|
689
|
+
return new URL(this.url).hostname;
|
|
690
|
+
}
|
|
691
|
+
get(attr) {
|
|
692
|
+
if (!(attr in this.application))
|
|
693
|
+
throw new Error(
|
|
694
|
+
`Attribute ${attr.toString()} does not exist on studio ${this.application.id}`
|
|
695
|
+
);
|
|
696
|
+
return this.application[attr];
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Resolves the studio's most authoritative manifest. The lookup order is:
|
|
700
|
+
*
|
|
701
|
+
* 1. `activeDeployment.manifest` — deployment manifests are the new
|
|
702
|
+
* primitive within Sanity and are preferred whenever available.
|
|
703
|
+
* 2. `manifestData.value` — fallback to support older studios that
|
|
704
|
+
* haven't produced a deployment manifest yet.
|
|
705
|
+
* 3. `application.manifest` — last-resort legacy field.
|
|
706
|
+
*
|
|
707
|
+
* Returns `null` when no manifest is available. The return shape is a
|
|
708
|
+
* union because the deployment and client manifests are not
|
|
709
|
+
* interchangeable — consumers that depend on client-only fields (e.g.
|
|
710
|
+
* `studioVersion`, workspace `schema`) must narrow or read the raw
|
|
711
|
+
* field they need.
|
|
712
|
+
*/
|
|
713
|
+
get manifest() {
|
|
714
|
+
return this.application.activeDeployment?.manifest ?? this.application.manifestData?.value ?? this.application.manifest ?? null;
|
|
715
|
+
}
|
|
716
|
+
get hasManifest() {
|
|
717
|
+
const manifest = this.manifest;
|
|
718
|
+
return manifest ? typeof manifest.version != "number" || manifest.version >= 2 : !1;
|
|
719
|
+
}
|
|
720
|
+
get hasSchema() {
|
|
721
|
+
if (this.application.activeDeployment?.manifest) return !0;
|
|
722
|
+
const workspaces = (this.application.manifestData?.value ?? this.application.manifest)?.workspaces ?? [];
|
|
723
|
+
return workspaces.length === 0 ? !1 : workspaces.every((w) => !!w.schema);
|
|
724
|
+
}
|
|
725
|
+
resolveVersion() {
|
|
726
|
+
let version;
|
|
727
|
+
if (this.get("urlType") === "internal")
|
|
728
|
+
version = this.get("activeDeployment")?.version;
|
|
729
|
+
else {
|
|
730
|
+
const clientManifest = this.get("manifestData")?.value ?? this.get("manifest");
|
|
731
|
+
version = clientManifest && "studioVersion" in clientManifest ? clientManifest.studioVersion : void 0;
|
|
732
|
+
}
|
|
733
|
+
const bundleVersion = this.get("activeDeployment")?.manifest?.bundleVersion;
|
|
734
|
+
return bundleVersion && valid(coerce(bundleVersion)) && (!version || version && gt(bundleVersion, version)) && (version = bundleVersion), !version || !valid(coerce(version)) ? null : coerce(version);
|
|
735
|
+
}
|
|
736
|
+
get version() {
|
|
737
|
+
const version = this.resolveVersion();
|
|
738
|
+
return version ? version.toString() : null;
|
|
739
|
+
}
|
|
740
|
+
get compatibilityStatus() {
|
|
741
|
+
return StudioApplication.resolveCompatibilityStatus(this);
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Used to calculate the compatibility status of a given studio application.
|
|
745
|
+
* Optionally if you've resolved the version elsewhere provide that value to
|
|
746
|
+
* get the new compatibility status without mutating the application.
|
|
747
|
+
*/
|
|
748
|
+
static resolveCompatibilityStatus(application, version = application.version) {
|
|
749
|
+
return version === null || lt(version, StudioApplication.MinimumStudioVersion) ? StudioApplication.CompatibilityStatuses.UNKNOWN : !application.hasSchema || !application.hasManifest || StudioApplication.resolveIssues(application, version).length > 0 ? StudioApplication.CompatibilityStatuses.PARTIALLY_COMPATIBLE : StudioApplication.CompatibilityStatuses.FULLY_COMPATIBLE;
|
|
750
|
+
}
|
|
751
|
+
get isAutoRedirecting() {
|
|
752
|
+
return StudioApplication.resolveIsAutoRedirecting(this);
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Mirrors the `isRedirectable` function from Saison defined in
|
|
756
|
+
* https://github.com/sanity-io/saison/blob/83556405d23e07f6d3a71c76249c67e33fe1101f/src/utils/applications.ts
|
|
757
|
+
*
|
|
758
|
+
* Returns whether a studio application is auto-redirecting, meaning it can only be accessed in the context of
|
|
759
|
+
* Dashboard.
|
|
760
|
+
*/
|
|
761
|
+
static resolveIsAutoRedirecting(application, versionArg = application.version) {
|
|
762
|
+
let version = versionArg;
|
|
763
|
+
if (application.get("urlType") === "external" || !version)
|
|
764
|
+
return !1;
|
|
765
|
+
if (!application.get("activeDeployment")?.isAutoUpdating)
|
|
766
|
+
return gt(version, "3.92.0");
|
|
767
|
+
const autoUpdatingVersion = application.get("autoUpdatingVersion");
|
|
768
|
+
if (autoUpdatingVersion) {
|
|
769
|
+
if (["next", "stable", "latest"].includes(autoUpdatingVersion))
|
|
770
|
+
return !0;
|
|
771
|
+
const autoUpdatingVersionPinnedVersion = coerce(autoUpdatingVersion);
|
|
772
|
+
autoUpdatingVersionPinnedVersion && (version = autoUpdatingVersionPinnedVersion);
|
|
773
|
+
}
|
|
774
|
+
return gt(version, StudioApplication.MinimumStudioVersion);
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Returns a list of issues that prevent the studio from functioning properly in the Dashboard.
|
|
778
|
+
* This static value depends on the version of the studio that comes from the `activeDeployment` property.
|
|
779
|
+
* As such, if the studio is auto-updating, this list will be incorrect & instead you should use
|
|
780
|
+
* the static method `resolveIssues` to get the correct issues by passing the resolved version.
|
|
781
|
+
*/
|
|
782
|
+
get issues() {
|
|
783
|
+
return StudioApplication.resolveIssues(this);
|
|
784
|
+
}
|
|
785
|
+
static resolveIssues(application, version = application.version) {
|
|
786
|
+
const issues = StudioApplication.Features.filter(
|
|
787
|
+
(feature) => !application.isFeatureSupported(feature.id, version)
|
|
788
|
+
);
|
|
789
|
+
return application.hasManifest || issues.push({
|
|
790
|
+
id: StudioApplication.StudioIssues.ISSUE_MANIFEST
|
|
791
|
+
}), issues;
|
|
792
|
+
}
|
|
793
|
+
isFeatureSupported(feature, version = this.version) {
|
|
794
|
+
const featureVersion = StudioApplication.Features.find(
|
|
795
|
+
(_) => _.id === feature
|
|
796
|
+
)?.version;
|
|
797
|
+
return !featureVersion || !version ? !1 : gte(version, featureVersion);
|
|
798
|
+
}
|
|
799
|
+
toProtocolResource() {
|
|
800
|
+
throw new Error(
|
|
801
|
+
"Studio application resources cannot be converted to protocol resources"
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
static CompatibilityStatuses = {
|
|
805
|
+
UNKNOWN: "unknown",
|
|
806
|
+
PARTIALLY_COMPATIBLE: "partially-compatible",
|
|
807
|
+
FULLY_COMPATIBLE: "fully-compatible"
|
|
808
|
+
};
|
|
809
|
+
static StudioIssues = {
|
|
810
|
+
ISSUE_ACTIVITY: "ACTIVITY",
|
|
811
|
+
ISSUE_AGENT: "AGENT",
|
|
812
|
+
ISSUE_FAVORITES: "FAVORITES",
|
|
813
|
+
ISSUE_URL_SYNCING: "URL_SYNCING",
|
|
814
|
+
ISSUE_UI_ADJUSTMENT: "UI_ADJUSTMENT",
|
|
815
|
+
ISSUE_CONTENT_MAPPING: "CONTENT_MAPPING",
|
|
816
|
+
ISSUE_LOGIN: "LOGIN",
|
|
817
|
+
ISSUE_MANIFEST: "MANIFEST"
|
|
818
|
+
};
|
|
819
|
+
static Features = [
|
|
820
|
+
{
|
|
821
|
+
id: StudioApplication.StudioIssues.ISSUE_AGENT,
|
|
822
|
+
version: "5.1.0"
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
id: StudioApplication.StudioIssues.ISSUE_FAVORITES,
|
|
826
|
+
version: "3.88.1"
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
id: StudioApplication.StudioIssues.ISSUE_ACTIVITY,
|
|
830
|
+
version: "3.88.1"
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
id: StudioApplication.StudioIssues.ISSUE_URL_SYNCING,
|
|
834
|
+
version: "3.75.0"
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
id: StudioApplication.StudioIssues.ISSUE_UI_ADJUSTMENT,
|
|
838
|
+
version: "3.78.1"
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
id: StudioApplication.StudioIssues.ISSUE_CONTENT_MAPPING,
|
|
842
|
+
version: "3.68.0"
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
id: StudioApplication.StudioIssues.ISSUE_LOGIN,
|
|
846
|
+
version: "2.28.0"
|
|
847
|
+
}
|
|
848
|
+
];
|
|
849
|
+
static MinimumStudioVersion = "2.28.0";
|
|
850
|
+
static MinimumStudioVersionWithNoIssues = rsort(
|
|
851
|
+
StudioApplication.Features.map((feature) => feature.version)
|
|
852
|
+
).at(0);
|
|
853
|
+
}
|
|
854
|
+
export {
|
|
855
|
+
AbstractApplication,
|
|
856
|
+
ActiveDeployment,
|
|
857
|
+
CanvasApplication,
|
|
858
|
+
ClientManifest,
|
|
859
|
+
CoreAppApplication,
|
|
860
|
+
CoreAppUserApplicationManifest,
|
|
861
|
+
InterfaceSchema,
|
|
862
|
+
LocalInterfaceSchema,
|
|
863
|
+
LocalUserApplication,
|
|
864
|
+
MediaLibraryApplication,
|
|
865
|
+
Organization,
|
|
866
|
+
OrganizationId,
|
|
867
|
+
Project,
|
|
868
|
+
ProjectId,
|
|
869
|
+
ServerManifest,
|
|
870
|
+
StudioApplication,
|
|
871
|
+
StudioUserApplication,
|
|
872
|
+
StudioWorkspace,
|
|
873
|
+
UserApplication,
|
|
874
|
+
UserApplicationBase,
|
|
875
|
+
UserApplicationId,
|
|
876
|
+
brandCanvasId,
|
|
877
|
+
brandMediaLibraryId,
|
|
878
|
+
brandOrganizationId,
|
|
879
|
+
brandProjectId,
|
|
880
|
+
brandUserApplicationId,
|
|
881
|
+
getApiHost,
|
|
882
|
+
getSanityDomain,
|
|
883
|
+
getSanityEnv,
|
|
884
|
+
joinUrlPaths,
|
|
885
|
+
parseCanvas,
|
|
886
|
+
parseCoreApplication,
|
|
887
|
+
parseMediaLibrary,
|
|
888
|
+
parseOrganization,
|
|
889
|
+
parseProject,
|
|
890
|
+
parseStudioUserApplication
|
|
891
|
+
};
|
|
892
|
+
//# sourceMappingURL=studio.js.map
|