@webstudio-is/sdk 0.270.0 → 0.271.0
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/lib/index.js +2 -0
- package/lib/schema.js +902 -0
- package/lib/types/page-utils.d.ts +1 -1
- package/lib/types/schema/pages.d.ts +46 -47
- package/lib/types/schema.d.ts +11 -0
- package/package.json +13 -8
package/lib/index.js
CHANGED
|
@@ -3484,6 +3484,7 @@ export {
|
|
|
3484
3484
|
InstanceChild,
|
|
3485
3485
|
Instances,
|
|
3486
3486
|
MIME_CATEGORIES,
|
|
3487
|
+
Page,
|
|
3487
3488
|
PageAuth,
|
|
3488
3489
|
PageId,
|
|
3489
3490
|
PageName,
|
|
@@ -3493,6 +3494,7 @@ export {
|
|
|
3493
3494
|
PageTitle,
|
|
3494
3495
|
Pages,
|
|
3495
3496
|
PresetStyleDecl,
|
|
3497
|
+
ProjectMeta,
|
|
3496
3498
|
ProjectNewRedirectPath,
|
|
3497
3499
|
Prop,
|
|
3498
3500
|
PropMeta,
|
package/lib/schema.js
ADDED
|
@@ -0,0 +1,902 @@
|
|
|
1
|
+
// src/schema/assets.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { FontFormat, FontMeta } from "@webstudio-is/fonts";
|
|
4
|
+
var AssetId = z.string();
|
|
5
|
+
var baseAsset = {
|
|
6
|
+
id: AssetId,
|
|
7
|
+
projectId: z.string(),
|
|
8
|
+
size: z.number(),
|
|
9
|
+
name: z.string(),
|
|
10
|
+
filename: z.string().optional(),
|
|
11
|
+
description: z.union([z.string().optional(), z.null()]),
|
|
12
|
+
createdAt: z.string()
|
|
13
|
+
};
|
|
14
|
+
var FontAsset = z.object({
|
|
15
|
+
...baseAsset,
|
|
16
|
+
format: FontFormat,
|
|
17
|
+
meta: FontMeta,
|
|
18
|
+
type: z.literal("font")
|
|
19
|
+
});
|
|
20
|
+
var ImageMeta = z.object({
|
|
21
|
+
width: z.number(),
|
|
22
|
+
height: z.number()
|
|
23
|
+
});
|
|
24
|
+
var ImageAsset = z.object({
|
|
25
|
+
...baseAsset,
|
|
26
|
+
format: z.string(),
|
|
27
|
+
meta: ImageMeta,
|
|
28
|
+
type: z.literal("image")
|
|
29
|
+
});
|
|
30
|
+
var FileAsset = z.object({
|
|
31
|
+
...baseAsset,
|
|
32
|
+
format: z.string(),
|
|
33
|
+
meta: z.object({}),
|
|
34
|
+
type: z.literal("file")
|
|
35
|
+
});
|
|
36
|
+
var Asset = z.union([FontAsset, ImageAsset, FileAsset]);
|
|
37
|
+
var Assets = z.map(AssetId, Asset);
|
|
38
|
+
|
|
39
|
+
// src/schema/breakpoints.ts
|
|
40
|
+
import { z as z2 } from "zod";
|
|
41
|
+
var BreakpointId = z2.string();
|
|
42
|
+
var Breakpoint = z2.object({
|
|
43
|
+
id: BreakpointId,
|
|
44
|
+
label: z2.string(),
|
|
45
|
+
minWidth: z2.number().optional(),
|
|
46
|
+
maxWidth: z2.number().optional(),
|
|
47
|
+
condition: z2.string().optional()
|
|
48
|
+
}).transform((data) => {
|
|
49
|
+
if (data.condition !== void 0 && data.condition.trim() === "") {
|
|
50
|
+
return { ...data, condition: void 0 };
|
|
51
|
+
}
|
|
52
|
+
return data;
|
|
53
|
+
}).refine(({ minWidth, maxWidth, condition }) => {
|
|
54
|
+
if (condition !== void 0) {
|
|
55
|
+
return minWidth === void 0 && maxWidth === void 0;
|
|
56
|
+
}
|
|
57
|
+
if (minWidth !== void 0 && maxWidth !== void 0) {
|
|
58
|
+
return minWidth < maxWidth;
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}, "Width-based (minWidth/maxWidth) and condition are mutually exclusive, and minWidth must be less than maxWidth");
|
|
62
|
+
var Breakpoints = z2.map(BreakpointId, Breakpoint);
|
|
63
|
+
var initialBreakpoints = [
|
|
64
|
+
{ id: "placeholder", label: "Base" },
|
|
65
|
+
{ id: "placeholder", label: "Tablet", maxWidth: 991 },
|
|
66
|
+
{ id: "placeholder", label: "Mobile landscape", maxWidth: 767 },
|
|
67
|
+
{ id: "placeholder", label: "Mobile portrait", maxWidth: 479 }
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
// src/schema/data-sources.ts
|
|
71
|
+
import { z as z3 } from "zod";
|
|
72
|
+
var DataSourceId = z3.string();
|
|
73
|
+
var DataSourceVariableValue = z3.union([
|
|
74
|
+
z3.object({
|
|
75
|
+
type: z3.literal("number"),
|
|
76
|
+
// initial value of variable store
|
|
77
|
+
value: z3.number()
|
|
78
|
+
}),
|
|
79
|
+
z3.object({
|
|
80
|
+
type: z3.literal("string"),
|
|
81
|
+
value: z3.string()
|
|
82
|
+
}),
|
|
83
|
+
z3.object({
|
|
84
|
+
type: z3.literal("boolean"),
|
|
85
|
+
value: z3.boolean()
|
|
86
|
+
}),
|
|
87
|
+
z3.object({
|
|
88
|
+
type: z3.literal("string[]"),
|
|
89
|
+
value: z3.array(z3.string())
|
|
90
|
+
}),
|
|
91
|
+
z3.object({
|
|
92
|
+
type: z3.literal("json"),
|
|
93
|
+
value: z3.unknown()
|
|
94
|
+
})
|
|
95
|
+
]);
|
|
96
|
+
var DataSource = z3.union([
|
|
97
|
+
z3.object({
|
|
98
|
+
type: z3.literal("variable"),
|
|
99
|
+
id: DataSourceId,
|
|
100
|
+
// The instance should always be specified for variables,
|
|
101
|
+
// however, there was a bug in the embed template
|
|
102
|
+
// which produced variables without an instance
|
|
103
|
+
// and these variables will fail validation
|
|
104
|
+
// if we make it required
|
|
105
|
+
scopeInstanceId: z3.string().optional(),
|
|
106
|
+
name: z3.string(),
|
|
107
|
+
value: DataSourceVariableValue
|
|
108
|
+
}),
|
|
109
|
+
z3.object({
|
|
110
|
+
type: z3.literal("parameter"),
|
|
111
|
+
id: DataSourceId,
|
|
112
|
+
scopeInstanceId: z3.string().optional(),
|
|
113
|
+
name: z3.string()
|
|
114
|
+
}),
|
|
115
|
+
z3.object({
|
|
116
|
+
type: z3.literal("resource"),
|
|
117
|
+
id: DataSourceId,
|
|
118
|
+
scopeInstanceId: z3.string().optional(),
|
|
119
|
+
name: z3.string(),
|
|
120
|
+
resourceId: z3.string()
|
|
121
|
+
})
|
|
122
|
+
]);
|
|
123
|
+
var DataSources = z3.map(DataSourceId, DataSource);
|
|
124
|
+
|
|
125
|
+
// src/schema/deployment.ts
|
|
126
|
+
import { z as z4 } from "zod";
|
|
127
|
+
var Templates = z4.enum([
|
|
128
|
+
"docker",
|
|
129
|
+
"vercel",
|
|
130
|
+
"netlify",
|
|
131
|
+
"ssg",
|
|
132
|
+
"ssg-netlify",
|
|
133
|
+
"ssg-vercel"
|
|
134
|
+
]);
|
|
135
|
+
var Deployment = z4.union([
|
|
136
|
+
z4.object({
|
|
137
|
+
destination: z4.literal("static"),
|
|
138
|
+
name: z4.string(),
|
|
139
|
+
assetsDomain: z4.string(),
|
|
140
|
+
// Must be validated very strictly
|
|
141
|
+
templates: z4.array(Templates)
|
|
142
|
+
}),
|
|
143
|
+
z4.object({
|
|
144
|
+
destination: z4.literal("saas").optional(),
|
|
145
|
+
domains: z4.array(z4.string()),
|
|
146
|
+
assetsDomain: z4.string().optional(),
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated This field is deprecated, use `domains` instead.
|
|
149
|
+
*/
|
|
150
|
+
projectDomain: z4.string().optional(),
|
|
151
|
+
excludeWstdDomainFromSearch: z4.boolean().optional()
|
|
152
|
+
})
|
|
153
|
+
]);
|
|
154
|
+
|
|
155
|
+
// src/schema/instances.ts
|
|
156
|
+
import { z as z5 } from "zod";
|
|
157
|
+
var TextChild = z5.object({
|
|
158
|
+
type: z5.literal("text"),
|
|
159
|
+
value: z5.string(),
|
|
160
|
+
placeholder: z5.boolean().optional()
|
|
161
|
+
});
|
|
162
|
+
var InstanceId = z5.string();
|
|
163
|
+
var IdChild = z5.object({
|
|
164
|
+
type: z5.literal("id"),
|
|
165
|
+
value: InstanceId
|
|
166
|
+
});
|
|
167
|
+
var ExpressionChild = z5.object({
|
|
168
|
+
type: z5.literal("expression"),
|
|
169
|
+
value: z5.string()
|
|
170
|
+
});
|
|
171
|
+
var InstanceChild = z5.union([IdChild, TextChild, ExpressionChild]);
|
|
172
|
+
var Instance = z5.object({
|
|
173
|
+
type: z5.literal("instance"),
|
|
174
|
+
id: InstanceId,
|
|
175
|
+
component: z5.string(),
|
|
176
|
+
tag: z5.string().optional(),
|
|
177
|
+
label: z5.string().optional(),
|
|
178
|
+
children: z5.array(InstanceChild)
|
|
179
|
+
});
|
|
180
|
+
var Instances = z5.map(InstanceId, Instance);
|
|
181
|
+
|
|
182
|
+
// src/schema/pages.ts
|
|
183
|
+
import { z as z6 } from "zod";
|
|
184
|
+
import { validateBasicAuth } from "@webstudio-is/wsauth";
|
|
185
|
+
var MIN_TITLE_LENGTH = 2;
|
|
186
|
+
var PageId = z6.string();
|
|
187
|
+
var FolderId = z6.string();
|
|
188
|
+
var FolderName = z6.string().refine((value) => value.trim() !== "", "Can't be empty");
|
|
189
|
+
var Slug = z6.string().refine(
|
|
190
|
+
(path) => /^[-a-z0-9]*$/.test(path),
|
|
191
|
+
"Only a-z, 0-9 and - are allowed"
|
|
192
|
+
);
|
|
193
|
+
var Folder = z6.object({
|
|
194
|
+
id: FolderId,
|
|
195
|
+
name: FolderName,
|
|
196
|
+
slug: Slug,
|
|
197
|
+
children: z6.array(z6.union([FolderId, PageId]))
|
|
198
|
+
});
|
|
199
|
+
var PageName = z6.string().refine((value) => value.trim() !== "", "Can't be empty");
|
|
200
|
+
var PageTitle = z6.string().refine(
|
|
201
|
+
(val) => val.length >= MIN_TITLE_LENGTH,
|
|
202
|
+
`Minimum ${MIN_TITLE_LENGTH} characters required`
|
|
203
|
+
);
|
|
204
|
+
var documentTypes = ["html", "xml", "text"];
|
|
205
|
+
var BasicAuthFields = {
|
|
206
|
+
login: z6.string(),
|
|
207
|
+
password: z6.string()
|
|
208
|
+
};
|
|
209
|
+
var validateBasicAuthFields = ({
|
|
210
|
+
login,
|
|
211
|
+
password
|
|
212
|
+
}, context) => {
|
|
213
|
+
for (const issue of validateBasicAuth({ login, password }).issues ?? []) {
|
|
214
|
+
context.addIssue({
|
|
215
|
+
code: z6.ZodIssueCode.custom,
|
|
216
|
+
path: issue.path,
|
|
217
|
+
message: issue.message
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
var PageBasicAuth = z6.object({
|
|
222
|
+
method: z6.literal("basic"),
|
|
223
|
+
...BasicAuthFields
|
|
224
|
+
}).superRefine(validateBasicAuthFields);
|
|
225
|
+
var LegacyPageBasicAuth = z6.object({
|
|
226
|
+
type: z6.literal("basic"),
|
|
227
|
+
...BasicAuthFields
|
|
228
|
+
}).superRefine(validateBasicAuthFields).transform(({ login, password }) => ({
|
|
229
|
+
method: "basic",
|
|
230
|
+
login,
|
|
231
|
+
password
|
|
232
|
+
}));
|
|
233
|
+
var PageAuth = z6.union([PageBasicAuth, LegacyPageBasicAuth]);
|
|
234
|
+
var commonPageFields = {
|
|
235
|
+
id: PageId,
|
|
236
|
+
name: PageName,
|
|
237
|
+
title: PageTitle,
|
|
238
|
+
history: z6.optional(z6.array(z6.string())),
|
|
239
|
+
rootInstanceId: z6.string(),
|
|
240
|
+
systemDataSourceId: z6.string().optional(),
|
|
241
|
+
meta: z6.object({
|
|
242
|
+
description: z6.string().optional(),
|
|
243
|
+
title: z6.string().optional(),
|
|
244
|
+
excludePageFromSearch: z6.string().optional(),
|
|
245
|
+
language: z6.string().optional(),
|
|
246
|
+
socialImageAssetId: z6.string().optional(),
|
|
247
|
+
socialImageUrl: z6.string().optional(),
|
|
248
|
+
status: z6.string().optional(),
|
|
249
|
+
redirect: z6.string().optional(),
|
|
250
|
+
documentType: z6.optional(z6.enum(documentTypes)),
|
|
251
|
+
content: z6.string().optional(),
|
|
252
|
+
auth: PageAuth.optional(),
|
|
253
|
+
custom: z6.array(
|
|
254
|
+
z6.object({
|
|
255
|
+
property: z6.string(),
|
|
256
|
+
content: z6.string()
|
|
257
|
+
})
|
|
258
|
+
).optional()
|
|
259
|
+
}),
|
|
260
|
+
marketplace: z6.optional(
|
|
261
|
+
z6.object({
|
|
262
|
+
include: z6.optional(z6.boolean()),
|
|
263
|
+
category: z6.optional(z6.string()),
|
|
264
|
+
thumbnailAssetId: z6.optional(z6.string())
|
|
265
|
+
})
|
|
266
|
+
)
|
|
267
|
+
};
|
|
268
|
+
var HomePagePath = z6.string().refine((path) => path === "", "Home page path must be empty");
|
|
269
|
+
var DefaultPagePage = z6.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine((path) => path.endsWith("/") === false, "Can't end with a /").refine((path) => path.includes("//") === false, "Can't contain repeating /").refine(
|
|
270
|
+
(path) => /^[-_a-z0-9*:?\\/.]*$/.test(path),
|
|
271
|
+
"Only a-z, 0-9, -, _, /, :, ?, . and * are allowed"
|
|
272
|
+
).refine(
|
|
273
|
+
// We use /s for our system stuff like /s/css or /s/uploads
|
|
274
|
+
(path) => path !== "/s" && path.startsWith("/s/") === false,
|
|
275
|
+
"/s prefix is reserved for the system"
|
|
276
|
+
).refine(
|
|
277
|
+
// Remix serves build artefacts like JS bundles from /build
|
|
278
|
+
// And we cannot customize it due to bug in Remix: https://github.com/remix-run/remix/issues/2933
|
|
279
|
+
(path) => path !== "/build" && path.startsWith("/build/") === false,
|
|
280
|
+
"/build prefix is reserved for the system"
|
|
281
|
+
).refine((path) => path.length <= 255, "Path can't exceed 255 characters");
|
|
282
|
+
var RedirectSourcePath = z6.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine(
|
|
283
|
+
(path) => path.startsWith("/") && path.startsWith("//") === false,
|
|
284
|
+
"Must start with a /"
|
|
285
|
+
).refine((path) => {
|
|
286
|
+
if (/[\\\u0000-\u001f\u007f]/.test(path)) {
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
try {
|
|
290
|
+
new URL(path, "https://example.com");
|
|
291
|
+
return true;
|
|
292
|
+
} catch {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
}, "Must be a valid URL path").refine(
|
|
296
|
+
(path) => path !== "/s" && path.startsWith("/s/") === false,
|
|
297
|
+
"/s prefix is reserved for the system"
|
|
298
|
+
).refine(
|
|
299
|
+
(path) => path !== "/build" && path.startsWith("/build/") === false,
|
|
300
|
+
"/build prefix is reserved for the system"
|
|
301
|
+
);
|
|
302
|
+
var PagePath = DefaultPagePage.refine(
|
|
303
|
+
(path) => path === "" || path.startsWith("/"),
|
|
304
|
+
"Must start with a / or a full URL e.g. https://website.org"
|
|
305
|
+
);
|
|
306
|
+
var Page = z6.object({
|
|
307
|
+
...commonPageFields,
|
|
308
|
+
path: z6.union([HomePagePath, PagePath])
|
|
309
|
+
});
|
|
310
|
+
var PageTemplate = z6.object({
|
|
311
|
+
id: PageId,
|
|
312
|
+
name: PageName,
|
|
313
|
+
title: PageTitle,
|
|
314
|
+
rootInstanceId: z6.string(),
|
|
315
|
+
systemDataSourceId: z6.string().optional(),
|
|
316
|
+
meta: commonPageFields.meta
|
|
317
|
+
});
|
|
318
|
+
var ProjectMeta = z6.object({
|
|
319
|
+
// All fields are optional to ensure consistency and allow for the addition of new fields without requiring migration
|
|
320
|
+
siteName: z6.string().optional(),
|
|
321
|
+
contactEmail: z6.string().optional(),
|
|
322
|
+
faviconAssetId: z6.string().optional(),
|
|
323
|
+
code: z6.string().optional(),
|
|
324
|
+
auth: z6.string().optional()
|
|
325
|
+
});
|
|
326
|
+
var ProjectNewRedirectPath = z6.string().min(1, "Path is required").refine((data) => {
|
|
327
|
+
try {
|
|
328
|
+
new URL(data, "http://url.com");
|
|
329
|
+
return true;
|
|
330
|
+
} catch {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
}, "Must be a valid URL");
|
|
334
|
+
var PageRedirect = z6.object({
|
|
335
|
+
old: RedirectSourcePath,
|
|
336
|
+
new: ProjectNewRedirectPath,
|
|
337
|
+
status: z6.enum(["301", "302"]).optional()
|
|
338
|
+
});
|
|
339
|
+
var CompilerSettings = z6.object({
|
|
340
|
+
// All fields are optional to ensure consistency and allow for the addition of new fields without requiring migration
|
|
341
|
+
atomicStyles: z6.boolean().optional()
|
|
342
|
+
});
|
|
343
|
+
var Pages = z6.object({
|
|
344
|
+
meta: ProjectMeta.optional(),
|
|
345
|
+
compiler: CompilerSettings.optional(),
|
|
346
|
+
redirects: z6.array(PageRedirect).optional(),
|
|
347
|
+
homePageId: PageId,
|
|
348
|
+
rootFolderId: FolderId,
|
|
349
|
+
pages: z6.map(PageId, Page),
|
|
350
|
+
pageTemplates: z6.map(PageId, PageTemplate).optional(),
|
|
351
|
+
folders: z6.map(FolderId, Folder).refine((folders) => folders.size > 0, "Folders can't be empty")
|
|
352
|
+
}).superRefine((pages, context) => {
|
|
353
|
+
const homePage = pages.pages.get(pages.homePageId);
|
|
354
|
+
const rootFolder = pages.folders.get(pages.rootFolderId);
|
|
355
|
+
if (homePage === void 0) {
|
|
356
|
+
context.addIssue({
|
|
357
|
+
code: z6.ZodIssueCode.custom,
|
|
358
|
+
path: ["homePageId"],
|
|
359
|
+
message: "Home page must reference an existing page"
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
if (rootFolder === void 0) {
|
|
363
|
+
context.addIssue({
|
|
364
|
+
code: z6.ZodIssueCode.custom,
|
|
365
|
+
path: ["rootFolderId"],
|
|
366
|
+
message: "Root folder must reference an existing folder"
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
if (homePage !== void 0 && homePage.path !== "") {
|
|
370
|
+
context.addIssue({
|
|
371
|
+
code: z6.ZodIssueCode.custom,
|
|
372
|
+
path: ["pages", pages.homePageId, "path"],
|
|
373
|
+
message: "Home page path must be empty"
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
for (const [pageId, page] of pages.pages) {
|
|
377
|
+
if (page.id !== pageId) {
|
|
378
|
+
context.addIssue({
|
|
379
|
+
code: z6.ZodIssueCode.custom,
|
|
380
|
+
path: ["pages", pageId, "id"],
|
|
381
|
+
message: "Page id must match its record key"
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
if (pageId !== pages.homePageId && page.path === "") {
|
|
385
|
+
context.addIssue({
|
|
386
|
+
code: z6.ZodIssueCode.custom,
|
|
387
|
+
path: ["pages", pageId, "path"],
|
|
388
|
+
message: "Page path can't be empty"
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
for (const [templateId, template] of pages.pageTemplates ?? []) {
|
|
393
|
+
if (template.id !== templateId) {
|
|
394
|
+
context.addIssue({
|
|
395
|
+
code: z6.ZodIssueCode.custom,
|
|
396
|
+
path: ["pageTemplates", templateId, "id"],
|
|
397
|
+
message: "Page template id must match its record key"
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
if (pages.pages.has(templateId)) {
|
|
401
|
+
context.addIssue({
|
|
402
|
+
code: z6.ZodIssueCode.custom,
|
|
403
|
+
path: ["pageTemplates", templateId, "id"],
|
|
404
|
+
message: "Page template id must not match an existing page id"
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
for (const [folderId, folder] of pages.folders) {
|
|
409
|
+
if (folder.id !== folderId) {
|
|
410
|
+
context.addIssue({
|
|
411
|
+
code: z6.ZodIssueCode.custom,
|
|
412
|
+
path: ["folders", folderId, "id"],
|
|
413
|
+
message: "Folder id must match its record key"
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
for (const [index, childId] of folder.children.entries()) {
|
|
417
|
+
if (pages.pages.has(childId) === false && pages.folders.has(childId) === false) {
|
|
418
|
+
context.addIssue({
|
|
419
|
+
code: z6.ZodIssueCode.custom,
|
|
420
|
+
path: ["folders", folderId, "children", index],
|
|
421
|
+
message: "Folder child must reference an existing page or folder"
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
if (childId === pages.rootFolderId) {
|
|
425
|
+
context.addIssue({
|
|
426
|
+
code: z6.ZodIssueCode.custom,
|
|
427
|
+
path: ["folders", folderId, "children", index],
|
|
428
|
+
message: "Root folder can't be nested"
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if (rootFolder !== void 0 && rootFolder.children[0] !== pages.homePageId) {
|
|
434
|
+
context.addIssue({
|
|
435
|
+
code: z6.ZodIssueCode.custom,
|
|
436
|
+
path: ["folders", pages.rootFolderId, "children"],
|
|
437
|
+
message: "Root folder must start with the home page"
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
const childParents = /* @__PURE__ */ new Map();
|
|
441
|
+
for (const [folderId, folder] of pages.folders) {
|
|
442
|
+
for (const [index, childId] of folder.children.entries()) {
|
|
443
|
+
const parentId = childParents.get(childId);
|
|
444
|
+
if (parentId !== void 0) {
|
|
445
|
+
context.addIssue({
|
|
446
|
+
code: z6.ZodIssueCode.custom,
|
|
447
|
+
path: ["folders", folderId, "children", index],
|
|
448
|
+
message: `Child is already registered in folder "${parentId}"`
|
|
449
|
+
});
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
childParents.set(childId, folderId);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
const hasFolderCycle = (folderId, path = /* @__PURE__ */ new Set()) => {
|
|
456
|
+
if (path.has(folderId)) {
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
459
|
+
const folder = pages.folders.get(folderId);
|
|
460
|
+
if (folder === void 0) {
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
path.add(folderId);
|
|
464
|
+
for (const childId of folder.children) {
|
|
465
|
+
if (pages.folders.has(childId) && hasFolderCycle(childId, path)) {
|
|
466
|
+
return true;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
path.delete(folderId);
|
|
470
|
+
return false;
|
|
471
|
+
};
|
|
472
|
+
for (const folderId of pages.folders.keys()) {
|
|
473
|
+
if (hasFolderCycle(folderId)) {
|
|
474
|
+
context.addIssue({
|
|
475
|
+
code: z6.ZodIssueCode.custom,
|
|
476
|
+
path: ["folders", folderId, "children"],
|
|
477
|
+
message: "Folders can't contain cycles"
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
// src/schema/props.ts
|
|
484
|
+
import { z as z8 } from "zod";
|
|
485
|
+
|
|
486
|
+
// src/schema/animation-schema.ts
|
|
487
|
+
import { StyleValue } from "@webstudio-is/css-engine";
|
|
488
|
+
import { z as z7 } from "zod";
|
|
489
|
+
var literalUnion = (arr) => z7.union(
|
|
490
|
+
arr.map((val) => z7.literal(val))
|
|
491
|
+
);
|
|
492
|
+
var RANGE_UNITS = [
|
|
493
|
+
"%",
|
|
494
|
+
"px",
|
|
495
|
+
"cm",
|
|
496
|
+
"mm",
|
|
497
|
+
"q",
|
|
498
|
+
"in",
|
|
499
|
+
"pt",
|
|
500
|
+
"pc",
|
|
501
|
+
"em",
|
|
502
|
+
"rem",
|
|
503
|
+
"ex",
|
|
504
|
+
"rex",
|
|
505
|
+
"cap",
|
|
506
|
+
"rcap",
|
|
507
|
+
"ch",
|
|
508
|
+
"rch",
|
|
509
|
+
"lh",
|
|
510
|
+
"rlh",
|
|
511
|
+
"vw",
|
|
512
|
+
"svw",
|
|
513
|
+
"lvw",
|
|
514
|
+
"dvw",
|
|
515
|
+
"vh",
|
|
516
|
+
"svh",
|
|
517
|
+
"lvh",
|
|
518
|
+
"dvh",
|
|
519
|
+
"vi",
|
|
520
|
+
"svi",
|
|
521
|
+
"lvi",
|
|
522
|
+
"dvi",
|
|
523
|
+
"vb",
|
|
524
|
+
"svb",
|
|
525
|
+
"lvb",
|
|
526
|
+
"dvb",
|
|
527
|
+
"vmin",
|
|
528
|
+
"svmin",
|
|
529
|
+
"lvmin",
|
|
530
|
+
"dvmin",
|
|
531
|
+
"vmax",
|
|
532
|
+
"svmax",
|
|
533
|
+
"lvmax",
|
|
534
|
+
"dvmax"
|
|
535
|
+
];
|
|
536
|
+
var rangeUnitSchema = literalUnion(RANGE_UNITS);
|
|
537
|
+
var rangeUnitValueSchema = z7.union([
|
|
538
|
+
z7.object({
|
|
539
|
+
type: z7.literal("unit"),
|
|
540
|
+
value: z7.number(),
|
|
541
|
+
unit: rangeUnitSchema
|
|
542
|
+
}),
|
|
543
|
+
z7.object({
|
|
544
|
+
type: z7.literal("unparsed"),
|
|
545
|
+
value: z7.string()
|
|
546
|
+
}),
|
|
547
|
+
z7.object({
|
|
548
|
+
type: z7.literal("var"),
|
|
549
|
+
value: z7.string()
|
|
550
|
+
})
|
|
551
|
+
]);
|
|
552
|
+
var TIME_UNITS = ["ms", "s"];
|
|
553
|
+
var timeUnitSchema = literalUnion(TIME_UNITS);
|
|
554
|
+
var durationUnitValueSchema = z7.union([
|
|
555
|
+
z7.object({
|
|
556
|
+
type: z7.literal("unit"),
|
|
557
|
+
value: z7.number(),
|
|
558
|
+
unit: timeUnitSchema
|
|
559
|
+
}),
|
|
560
|
+
z7.object({
|
|
561
|
+
type: z7.literal("var"),
|
|
562
|
+
value: z7.string()
|
|
563
|
+
})
|
|
564
|
+
]);
|
|
565
|
+
var iterationsUnitValueSchema = z7.union([z7.number(), z7.literal("infinite")]);
|
|
566
|
+
var insetUnitValueSchema = z7.union([
|
|
567
|
+
rangeUnitValueSchema,
|
|
568
|
+
z7.object({
|
|
569
|
+
type: z7.literal("keyword"),
|
|
570
|
+
value: z7.literal("auto")
|
|
571
|
+
})
|
|
572
|
+
]);
|
|
573
|
+
var keyframeStylesSchema = z7.record(StyleValue);
|
|
574
|
+
var animationKeyframeSchema = z7.object({
|
|
575
|
+
offset: z7.number().optional(),
|
|
576
|
+
styles: keyframeStylesSchema
|
|
577
|
+
});
|
|
578
|
+
var keyframeEffectOptionsSchema = z7.object({
|
|
579
|
+
easing: z7.string().optional(),
|
|
580
|
+
fill: z7.union([
|
|
581
|
+
z7.literal("none"),
|
|
582
|
+
z7.literal("forwards"),
|
|
583
|
+
z7.literal("backwards"),
|
|
584
|
+
z7.literal("both")
|
|
585
|
+
]).optional(),
|
|
586
|
+
// FillMode
|
|
587
|
+
duration: durationUnitValueSchema.optional(),
|
|
588
|
+
delay: durationUnitValueSchema.optional(),
|
|
589
|
+
iterations: iterationsUnitValueSchema.optional()
|
|
590
|
+
});
|
|
591
|
+
var scrollNamedRangeSchema = z7.union([
|
|
592
|
+
z7.literal("start"),
|
|
593
|
+
z7.literal("end")
|
|
594
|
+
]);
|
|
595
|
+
var scrollRangeValueSchema = z7.tuple([
|
|
596
|
+
scrollNamedRangeSchema,
|
|
597
|
+
rangeUnitValueSchema
|
|
598
|
+
]);
|
|
599
|
+
var scrollRangeOptionsSchema = z7.object({
|
|
600
|
+
rangeStart: scrollRangeValueSchema.optional(),
|
|
601
|
+
rangeEnd: scrollRangeValueSchema.optional()
|
|
602
|
+
});
|
|
603
|
+
var animationAxisSchema = z7.union([
|
|
604
|
+
z7.literal("block"),
|
|
605
|
+
z7.literal("inline"),
|
|
606
|
+
z7.literal("x"),
|
|
607
|
+
z7.literal("y")
|
|
608
|
+
]);
|
|
609
|
+
var viewNamedRangeSchema = z7.union([
|
|
610
|
+
z7.literal("contain"),
|
|
611
|
+
z7.literal("cover"),
|
|
612
|
+
z7.literal("entry"),
|
|
613
|
+
z7.literal("exit"),
|
|
614
|
+
z7.literal("entry-crossing"),
|
|
615
|
+
z7.literal("exit-crossing")
|
|
616
|
+
]);
|
|
617
|
+
var viewRangeValueSchema = z7.tuple([
|
|
618
|
+
viewNamedRangeSchema,
|
|
619
|
+
rangeUnitValueSchema
|
|
620
|
+
]);
|
|
621
|
+
var viewRangeOptionsSchema = z7.object({
|
|
622
|
+
rangeStart: viewRangeValueSchema.optional(),
|
|
623
|
+
rangeEnd: viewRangeValueSchema.optional()
|
|
624
|
+
});
|
|
625
|
+
var baseAnimation = z7.object({
|
|
626
|
+
name: z7.string().optional(),
|
|
627
|
+
description: z7.string().optional(),
|
|
628
|
+
enabled: z7.array(z7.tuple([z7.string().describe("breakpointId"), z7.boolean()])).optional(),
|
|
629
|
+
keyframes: z7.array(animationKeyframeSchema)
|
|
630
|
+
});
|
|
631
|
+
var scrollAnimationSchema = baseAnimation.merge(
|
|
632
|
+
z7.object({
|
|
633
|
+
timing: keyframeEffectOptionsSchema.merge(scrollRangeOptionsSchema)
|
|
634
|
+
})
|
|
635
|
+
);
|
|
636
|
+
var scrollActionSchema = z7.object({
|
|
637
|
+
type: z7.literal("scroll"),
|
|
638
|
+
source: z7.union([z7.literal("closest"), z7.literal("nearest"), z7.literal("root")]).optional(),
|
|
639
|
+
axis: animationAxisSchema.optional(),
|
|
640
|
+
animations: z7.array(scrollAnimationSchema),
|
|
641
|
+
isPinned: z7.boolean().optional(),
|
|
642
|
+
debug: z7.boolean().optional()
|
|
643
|
+
});
|
|
644
|
+
var viewAnimationSchema = baseAnimation.merge(
|
|
645
|
+
z7.object({
|
|
646
|
+
timing: keyframeEffectOptionsSchema.merge(viewRangeOptionsSchema)
|
|
647
|
+
})
|
|
648
|
+
);
|
|
649
|
+
var viewActionSchema = z7.object({
|
|
650
|
+
type: z7.literal("view"),
|
|
651
|
+
subject: z7.string().optional(),
|
|
652
|
+
axis: animationAxisSchema.optional(),
|
|
653
|
+
animations: z7.array(viewAnimationSchema),
|
|
654
|
+
insetStart: insetUnitValueSchema.optional(),
|
|
655
|
+
insetEnd: insetUnitValueSchema.optional(),
|
|
656
|
+
isPinned: z7.boolean().optional(),
|
|
657
|
+
debug: z7.boolean().optional()
|
|
658
|
+
});
|
|
659
|
+
var animationActionSchema = z7.discriminatedUnion("type", [
|
|
660
|
+
scrollActionSchema,
|
|
661
|
+
viewActionSchema
|
|
662
|
+
]);
|
|
663
|
+
|
|
664
|
+
// src/schema/props.ts
|
|
665
|
+
var PropId = z8.string();
|
|
666
|
+
var baseProp = {
|
|
667
|
+
id: PropId,
|
|
668
|
+
instanceId: z8.string(),
|
|
669
|
+
name: z8.string(),
|
|
670
|
+
required: z8.optional(z8.boolean())
|
|
671
|
+
};
|
|
672
|
+
var Prop = z8.union([
|
|
673
|
+
z8.object({
|
|
674
|
+
...baseProp,
|
|
675
|
+
type: z8.literal("number"),
|
|
676
|
+
value: z8.number()
|
|
677
|
+
}),
|
|
678
|
+
z8.object({
|
|
679
|
+
...baseProp,
|
|
680
|
+
type: z8.literal("string"),
|
|
681
|
+
value: z8.string()
|
|
682
|
+
}),
|
|
683
|
+
z8.object({
|
|
684
|
+
...baseProp,
|
|
685
|
+
type: z8.literal("boolean"),
|
|
686
|
+
value: z8.boolean()
|
|
687
|
+
}),
|
|
688
|
+
z8.object({
|
|
689
|
+
...baseProp,
|
|
690
|
+
type: z8.literal("json"),
|
|
691
|
+
value: z8.unknown()
|
|
692
|
+
}),
|
|
693
|
+
z8.object({
|
|
694
|
+
...baseProp,
|
|
695
|
+
type: z8.literal("asset"),
|
|
696
|
+
value: z8.string()
|
|
697
|
+
// asset id
|
|
698
|
+
}),
|
|
699
|
+
z8.object({
|
|
700
|
+
...baseProp,
|
|
701
|
+
type: z8.literal("page"),
|
|
702
|
+
value: z8.union([
|
|
703
|
+
z8.string(),
|
|
704
|
+
// page id
|
|
705
|
+
z8.object({
|
|
706
|
+
pageId: z8.string(),
|
|
707
|
+
instanceId: z8.string()
|
|
708
|
+
})
|
|
709
|
+
])
|
|
710
|
+
}),
|
|
711
|
+
z8.object({
|
|
712
|
+
...baseProp,
|
|
713
|
+
type: z8.literal("string[]"),
|
|
714
|
+
value: z8.array(z8.string())
|
|
715
|
+
}),
|
|
716
|
+
z8.object({
|
|
717
|
+
...baseProp,
|
|
718
|
+
type: z8.literal("parameter"),
|
|
719
|
+
// data source id
|
|
720
|
+
value: z8.string()
|
|
721
|
+
}),
|
|
722
|
+
z8.object({
|
|
723
|
+
...baseProp,
|
|
724
|
+
type: z8.literal("resource"),
|
|
725
|
+
// resource id
|
|
726
|
+
value: z8.string()
|
|
727
|
+
}),
|
|
728
|
+
z8.object({
|
|
729
|
+
...baseProp,
|
|
730
|
+
type: z8.literal("expression"),
|
|
731
|
+
// expression code
|
|
732
|
+
value: z8.string()
|
|
733
|
+
}),
|
|
734
|
+
z8.object({
|
|
735
|
+
...baseProp,
|
|
736
|
+
type: z8.literal("action"),
|
|
737
|
+
value: z8.array(
|
|
738
|
+
z8.object({
|
|
739
|
+
type: z8.literal("execute"),
|
|
740
|
+
args: z8.array(z8.string()),
|
|
741
|
+
code: z8.string()
|
|
742
|
+
})
|
|
743
|
+
)
|
|
744
|
+
}),
|
|
745
|
+
z8.object({
|
|
746
|
+
...baseProp,
|
|
747
|
+
type: z8.literal("animationAction"),
|
|
748
|
+
value: animationActionSchema
|
|
749
|
+
})
|
|
750
|
+
]);
|
|
751
|
+
var Props = z8.map(PropId, Prop);
|
|
752
|
+
|
|
753
|
+
// src/schema/resources.ts
|
|
754
|
+
import { z as z9 } from "zod";
|
|
755
|
+
var ResourceId = z9.string();
|
|
756
|
+
var Method = z9.union([
|
|
757
|
+
z9.literal("get"),
|
|
758
|
+
z9.literal("post"),
|
|
759
|
+
z9.literal("put"),
|
|
760
|
+
z9.literal("delete")
|
|
761
|
+
]);
|
|
762
|
+
var Resource = z9.object({
|
|
763
|
+
id: ResourceId,
|
|
764
|
+
name: z9.string(),
|
|
765
|
+
control: z9.optional(z9.union([z9.literal("system"), z9.literal("graphql")])),
|
|
766
|
+
method: Method,
|
|
767
|
+
// expression
|
|
768
|
+
url: z9.string(),
|
|
769
|
+
searchParams: z9.array(
|
|
770
|
+
z9.object({
|
|
771
|
+
name: z9.string(),
|
|
772
|
+
// expression
|
|
773
|
+
value: z9.string()
|
|
774
|
+
})
|
|
775
|
+
).optional(),
|
|
776
|
+
headers: z9.array(
|
|
777
|
+
z9.object({
|
|
778
|
+
name: z9.string(),
|
|
779
|
+
// expression
|
|
780
|
+
value: z9.string()
|
|
781
|
+
})
|
|
782
|
+
),
|
|
783
|
+
// expression
|
|
784
|
+
body: z9.optional(z9.string())
|
|
785
|
+
});
|
|
786
|
+
var ResourceRequest = z9.object({
|
|
787
|
+
name: z9.string(),
|
|
788
|
+
method: Method,
|
|
789
|
+
url: z9.string(),
|
|
790
|
+
searchParams: z9.array(
|
|
791
|
+
z9.object({
|
|
792
|
+
name: z9.string(),
|
|
793
|
+
// can be string or object which should be serialized
|
|
794
|
+
value: z9.unknown()
|
|
795
|
+
})
|
|
796
|
+
),
|
|
797
|
+
headers: z9.array(
|
|
798
|
+
z9.object({
|
|
799
|
+
name: z9.string(),
|
|
800
|
+
// can be string or object which should be serialized
|
|
801
|
+
value: z9.unknown()
|
|
802
|
+
})
|
|
803
|
+
),
|
|
804
|
+
body: z9.optional(z9.unknown())
|
|
805
|
+
});
|
|
806
|
+
var Resources = z9.map(ResourceId, Resource);
|
|
807
|
+
|
|
808
|
+
// src/schema/style-source-selections.ts
|
|
809
|
+
import { z as z10 } from "zod";
|
|
810
|
+
var InstanceId2 = z10.string();
|
|
811
|
+
var StyleSourceId = z10.string();
|
|
812
|
+
var StyleSourceSelection = z10.object({
|
|
813
|
+
instanceId: InstanceId2,
|
|
814
|
+
values: z10.array(StyleSourceId)
|
|
815
|
+
});
|
|
816
|
+
var StyleSourceSelections = z10.map(InstanceId2, StyleSourceSelection);
|
|
817
|
+
|
|
818
|
+
// src/schema/style-sources.ts
|
|
819
|
+
import { z as z11 } from "zod";
|
|
820
|
+
var StyleSourceId2 = z11.string();
|
|
821
|
+
var StyleSourceToken = z11.object({
|
|
822
|
+
type: z11.literal("token"),
|
|
823
|
+
id: StyleSourceId2,
|
|
824
|
+
name: z11.string(),
|
|
825
|
+
locked: z11.boolean().optional()
|
|
826
|
+
});
|
|
827
|
+
var StyleSourceLocal = z11.object({
|
|
828
|
+
type: z11.literal("local"),
|
|
829
|
+
id: StyleSourceId2
|
|
830
|
+
});
|
|
831
|
+
var StyleSource = z11.union([StyleSourceToken, StyleSourceLocal]);
|
|
832
|
+
var StyleSources = z11.map(StyleSourceId2, StyleSource);
|
|
833
|
+
|
|
834
|
+
// src/schema/styles.ts
|
|
835
|
+
import { z as z12 } from "zod";
|
|
836
|
+
import { StyleValue as StyleValue2 } from "@webstudio-is/css-engine";
|
|
837
|
+
var StyleDeclRaw = z12.object({
|
|
838
|
+
styleSourceId: z12.string(),
|
|
839
|
+
breakpointId: z12.string(),
|
|
840
|
+
state: z12.optional(z12.string()),
|
|
841
|
+
// @todo can't figure out how to make property to be enum
|
|
842
|
+
property: z12.string(),
|
|
843
|
+
value: StyleValue2,
|
|
844
|
+
listed: z12.boolean().optional().describe("Whether the style is from the Advanced panel")
|
|
845
|
+
});
|
|
846
|
+
var StyleDecl = StyleDeclRaw;
|
|
847
|
+
var getStyleDeclKey = (styleDecl) => {
|
|
848
|
+
return `${styleDecl.styleSourceId}:${styleDecl.breakpointId}:${styleDecl.property}:${styleDecl.state ?? ""}`;
|
|
849
|
+
};
|
|
850
|
+
var Styles = z12.map(z12.string(), StyleDecl);
|
|
851
|
+
export {
|
|
852
|
+
Asset,
|
|
853
|
+
Assets,
|
|
854
|
+
Breakpoint,
|
|
855
|
+
Breakpoints,
|
|
856
|
+
CompilerSettings,
|
|
857
|
+
DataSource,
|
|
858
|
+
DataSourceVariableValue,
|
|
859
|
+
DataSources,
|
|
860
|
+
Deployment,
|
|
861
|
+
ExpressionChild,
|
|
862
|
+
FileAsset,
|
|
863
|
+
Folder,
|
|
864
|
+
FolderId,
|
|
865
|
+
FolderName,
|
|
866
|
+
FontAsset,
|
|
867
|
+
HomePagePath,
|
|
868
|
+
IdChild,
|
|
869
|
+
ImageAsset,
|
|
870
|
+
ImageMeta,
|
|
871
|
+
Instance,
|
|
872
|
+
InstanceChild,
|
|
873
|
+
Instances,
|
|
874
|
+
Page,
|
|
875
|
+
PageAuth,
|
|
876
|
+
PageId,
|
|
877
|
+
PageName,
|
|
878
|
+
PagePath,
|
|
879
|
+
PageRedirect,
|
|
880
|
+
PageTemplate,
|
|
881
|
+
PageTitle,
|
|
882
|
+
Pages,
|
|
883
|
+
ProjectMeta,
|
|
884
|
+
ProjectNewRedirectPath,
|
|
885
|
+
Prop,
|
|
886
|
+
Props,
|
|
887
|
+
RedirectSourcePath,
|
|
888
|
+
Resource,
|
|
889
|
+
ResourceRequest,
|
|
890
|
+
Resources,
|
|
891
|
+
StyleDecl,
|
|
892
|
+
StyleSource,
|
|
893
|
+
StyleSourceSelection,
|
|
894
|
+
StyleSourceSelections,
|
|
895
|
+
StyleSources,
|
|
896
|
+
Styles,
|
|
897
|
+
Templates,
|
|
898
|
+
TextChild,
|
|
899
|
+
documentTypes,
|
|
900
|
+
getStyleDeclKey,
|
|
901
|
+
initialBreakpoints
|
|
902
|
+
};
|
|
@@ -33,21 +33,21 @@ export declare const PageAuth: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
|
33
33
|
password: z.ZodString;
|
|
34
34
|
method: z.ZodLiteral<"basic">;
|
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
method: "basic";
|
|
36
37
|
login: string;
|
|
37
38
|
password: string;
|
|
38
|
-
method: "basic";
|
|
39
39
|
}, {
|
|
40
|
+
method: "basic";
|
|
40
41
|
login: string;
|
|
41
42
|
password: string;
|
|
42
|
-
method: "basic";
|
|
43
43
|
}>, {
|
|
44
|
+
method: "basic";
|
|
44
45
|
login: string;
|
|
45
46
|
password: string;
|
|
46
|
-
method: "basic";
|
|
47
47
|
}, {
|
|
48
|
+
method: "basic";
|
|
48
49
|
login: string;
|
|
49
50
|
password: string;
|
|
50
|
-
method: "basic";
|
|
51
51
|
}>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
52
52
|
login: z.ZodString;
|
|
53
53
|
password: z.ZodString;
|
|
@@ -81,7 +81,7 @@ export type PageAuth = z.infer<typeof PageAuth>;
|
|
|
81
81
|
export declare const HomePagePath: z.ZodEffects<z.ZodString, "", string>;
|
|
82
82
|
export declare const RedirectSourcePath: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>;
|
|
83
83
|
export declare const PagePath: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>;
|
|
84
|
-
declare const Page: z.ZodObject<{
|
|
84
|
+
export declare const Page: z.ZodObject<{
|
|
85
85
|
path: z.ZodUnion<[z.ZodEffects<z.ZodString, "", string>, z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>]>;
|
|
86
86
|
id: z.ZodString;
|
|
87
87
|
name: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -105,21 +105,21 @@ declare const Page: z.ZodObject<{
|
|
|
105
105
|
password: z.ZodString;
|
|
106
106
|
method: z.ZodLiteral<"basic">;
|
|
107
107
|
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
method: "basic";
|
|
108
109
|
login: string;
|
|
109
110
|
password: string;
|
|
110
|
-
method: "basic";
|
|
111
111
|
}, {
|
|
112
|
+
method: "basic";
|
|
112
113
|
login: string;
|
|
113
114
|
password: string;
|
|
114
|
-
method: "basic";
|
|
115
115
|
}>, {
|
|
116
|
+
method: "basic";
|
|
116
117
|
login: string;
|
|
117
118
|
password: string;
|
|
118
|
-
method: "basic";
|
|
119
119
|
}, {
|
|
120
|
+
method: "basic";
|
|
120
121
|
login: string;
|
|
121
122
|
password: string;
|
|
122
|
-
method: "basic";
|
|
123
123
|
}>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
124
124
|
login: z.ZodString;
|
|
125
125
|
password: z.ZodString;
|
|
@@ -167,9 +167,9 @@ declare const Page: z.ZodObject<{
|
|
|
167
167
|
}[] | undefined;
|
|
168
168
|
description?: string | undefined;
|
|
169
169
|
auth?: {
|
|
170
|
+
method: "basic";
|
|
170
171
|
login: string;
|
|
171
172
|
password: string;
|
|
172
|
-
method: "basic";
|
|
173
173
|
} | {
|
|
174
174
|
method: "basic";
|
|
175
175
|
login: string;
|
|
@@ -191,9 +191,9 @@ declare const Page: z.ZodObject<{
|
|
|
191
191
|
}[] | undefined;
|
|
192
192
|
description?: string | undefined;
|
|
193
193
|
auth?: {
|
|
194
|
+
method: "basic";
|
|
194
195
|
login: string;
|
|
195
196
|
password: string;
|
|
196
|
-
method: "basic";
|
|
197
197
|
} | {
|
|
198
198
|
type: "basic";
|
|
199
199
|
login: string;
|
|
@@ -232,9 +232,9 @@ declare const Page: z.ZodObject<{
|
|
|
232
232
|
}[] | undefined;
|
|
233
233
|
description?: string | undefined;
|
|
234
234
|
auth?: {
|
|
235
|
+
method: "basic";
|
|
235
236
|
login: string;
|
|
236
237
|
password: string;
|
|
237
|
-
method: "basic";
|
|
238
238
|
} | {
|
|
239
239
|
method: "basic";
|
|
240
240
|
login: string;
|
|
@@ -270,9 +270,9 @@ declare const Page: z.ZodObject<{
|
|
|
270
270
|
}[] | undefined;
|
|
271
271
|
description?: string | undefined;
|
|
272
272
|
auth?: {
|
|
273
|
+
method: "basic";
|
|
273
274
|
login: string;
|
|
274
275
|
password: string;
|
|
275
|
-
method: "basic";
|
|
276
276
|
} | {
|
|
277
277
|
type: "basic";
|
|
278
278
|
login: string;
|
|
@@ -320,21 +320,21 @@ export declare const PageTemplate: z.ZodObject<{
|
|
|
320
320
|
password: z.ZodString;
|
|
321
321
|
method: z.ZodLiteral<"basic">;
|
|
322
322
|
}, "strip", z.ZodTypeAny, {
|
|
323
|
+
method: "basic";
|
|
323
324
|
login: string;
|
|
324
325
|
password: string;
|
|
325
|
-
method: "basic";
|
|
326
326
|
}, {
|
|
327
|
+
method: "basic";
|
|
327
328
|
login: string;
|
|
328
329
|
password: string;
|
|
329
|
-
method: "basic";
|
|
330
330
|
}>, {
|
|
331
|
+
method: "basic";
|
|
331
332
|
login: string;
|
|
332
333
|
password: string;
|
|
333
|
-
method: "basic";
|
|
334
334
|
}, {
|
|
335
|
+
method: "basic";
|
|
335
336
|
login: string;
|
|
336
337
|
password: string;
|
|
337
|
-
method: "basic";
|
|
338
338
|
}>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
339
339
|
login: z.ZodString;
|
|
340
340
|
password: z.ZodString;
|
|
@@ -382,9 +382,9 @@ export declare const PageTemplate: z.ZodObject<{
|
|
|
382
382
|
}[] | undefined;
|
|
383
383
|
description?: string | undefined;
|
|
384
384
|
auth?: {
|
|
385
|
+
method: "basic";
|
|
385
386
|
login: string;
|
|
386
387
|
password: string;
|
|
387
|
-
method: "basic";
|
|
388
388
|
} | {
|
|
389
389
|
method: "basic";
|
|
390
390
|
login: string;
|
|
@@ -406,9 +406,9 @@ export declare const PageTemplate: z.ZodObject<{
|
|
|
406
406
|
}[] | undefined;
|
|
407
407
|
description?: string | undefined;
|
|
408
408
|
auth?: {
|
|
409
|
+
method: "basic";
|
|
409
410
|
login: string;
|
|
410
411
|
password: string;
|
|
411
|
-
method: "basic";
|
|
412
412
|
} | {
|
|
413
413
|
type: "basic";
|
|
414
414
|
login: string;
|
|
@@ -433,9 +433,9 @@ export declare const PageTemplate: z.ZodObject<{
|
|
|
433
433
|
}[] | undefined;
|
|
434
434
|
description?: string | undefined;
|
|
435
435
|
auth?: {
|
|
436
|
+
method: "basic";
|
|
436
437
|
login: string;
|
|
437
438
|
password: string;
|
|
438
|
-
method: "basic";
|
|
439
439
|
} | {
|
|
440
440
|
method: "basic";
|
|
441
441
|
login: string;
|
|
@@ -464,9 +464,9 @@ export declare const PageTemplate: z.ZodObject<{
|
|
|
464
464
|
}[] | undefined;
|
|
465
465
|
description?: string | undefined;
|
|
466
466
|
auth?: {
|
|
467
|
+
method: "basic";
|
|
467
468
|
login: string;
|
|
468
469
|
password: string;
|
|
469
|
-
method: "basic";
|
|
470
470
|
} | {
|
|
471
471
|
type: "basic";
|
|
472
472
|
login: string;
|
|
@@ -487,7 +487,7 @@ export declare const PageTemplate: z.ZodObject<{
|
|
|
487
487
|
systemDataSourceId?: string | undefined;
|
|
488
488
|
}>;
|
|
489
489
|
export type PageTemplate = z.infer<typeof PageTemplate>;
|
|
490
|
-
declare const ProjectMeta: z.ZodObject<{
|
|
490
|
+
export declare const ProjectMeta: z.ZodObject<{
|
|
491
491
|
siteName: z.ZodOptional<z.ZodString>;
|
|
492
492
|
contactEmail: z.ZodOptional<z.ZodString>;
|
|
493
493
|
faviconAssetId: z.ZodOptional<z.ZodString>;
|
|
@@ -597,21 +597,21 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
597
597
|
password: z.ZodString;
|
|
598
598
|
method: z.ZodLiteral<"basic">;
|
|
599
599
|
}, "strip", z.ZodTypeAny, {
|
|
600
|
+
method: "basic";
|
|
600
601
|
login: string;
|
|
601
602
|
password: string;
|
|
602
|
-
method: "basic";
|
|
603
603
|
}, {
|
|
604
|
+
method: "basic";
|
|
604
605
|
login: string;
|
|
605
606
|
password: string;
|
|
606
|
-
method: "basic";
|
|
607
607
|
}>, {
|
|
608
|
+
method: "basic";
|
|
608
609
|
login: string;
|
|
609
610
|
password: string;
|
|
610
|
-
method: "basic";
|
|
611
611
|
}, {
|
|
612
|
+
method: "basic";
|
|
612
613
|
login: string;
|
|
613
614
|
password: string;
|
|
614
|
-
method: "basic";
|
|
615
615
|
}>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
616
616
|
login: z.ZodString;
|
|
617
617
|
password: z.ZodString;
|
|
@@ -659,9 +659,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
659
659
|
}[] | undefined;
|
|
660
660
|
description?: string | undefined;
|
|
661
661
|
auth?: {
|
|
662
|
+
method: "basic";
|
|
662
663
|
login: string;
|
|
663
664
|
password: string;
|
|
664
|
-
method: "basic";
|
|
665
665
|
} | {
|
|
666
666
|
method: "basic";
|
|
667
667
|
login: string;
|
|
@@ -683,9 +683,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
683
683
|
}[] | undefined;
|
|
684
684
|
description?: string | undefined;
|
|
685
685
|
auth?: {
|
|
686
|
+
method: "basic";
|
|
686
687
|
login: string;
|
|
687
688
|
password: string;
|
|
688
|
-
method: "basic";
|
|
689
689
|
} | {
|
|
690
690
|
type: "basic";
|
|
691
691
|
login: string;
|
|
@@ -724,9 +724,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
724
724
|
}[] | undefined;
|
|
725
725
|
description?: string | undefined;
|
|
726
726
|
auth?: {
|
|
727
|
+
method: "basic";
|
|
727
728
|
login: string;
|
|
728
729
|
password: string;
|
|
729
|
-
method: "basic";
|
|
730
730
|
} | {
|
|
731
731
|
method: "basic";
|
|
732
732
|
login: string;
|
|
@@ -762,9 +762,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
762
762
|
}[] | undefined;
|
|
763
763
|
description?: string | undefined;
|
|
764
764
|
auth?: {
|
|
765
|
+
method: "basic";
|
|
765
766
|
login: string;
|
|
766
767
|
password: string;
|
|
767
|
-
method: "basic";
|
|
768
768
|
} | {
|
|
769
769
|
type: "basic";
|
|
770
770
|
login: string;
|
|
@@ -812,21 +812,21 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
812
812
|
password: z.ZodString;
|
|
813
813
|
method: z.ZodLiteral<"basic">;
|
|
814
814
|
}, "strip", z.ZodTypeAny, {
|
|
815
|
+
method: "basic";
|
|
815
816
|
login: string;
|
|
816
817
|
password: string;
|
|
817
|
-
method: "basic";
|
|
818
818
|
}, {
|
|
819
|
+
method: "basic";
|
|
819
820
|
login: string;
|
|
820
821
|
password: string;
|
|
821
|
-
method: "basic";
|
|
822
822
|
}>, {
|
|
823
|
+
method: "basic";
|
|
823
824
|
login: string;
|
|
824
825
|
password: string;
|
|
825
|
-
method: "basic";
|
|
826
826
|
}, {
|
|
827
|
+
method: "basic";
|
|
827
828
|
login: string;
|
|
828
829
|
password: string;
|
|
829
|
-
method: "basic";
|
|
830
830
|
}>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
831
831
|
login: z.ZodString;
|
|
832
832
|
password: z.ZodString;
|
|
@@ -874,9 +874,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
874
874
|
}[] | undefined;
|
|
875
875
|
description?: string | undefined;
|
|
876
876
|
auth?: {
|
|
877
|
+
method: "basic";
|
|
877
878
|
login: string;
|
|
878
879
|
password: string;
|
|
879
|
-
method: "basic";
|
|
880
880
|
} | {
|
|
881
881
|
method: "basic";
|
|
882
882
|
login: string;
|
|
@@ -898,9 +898,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
898
898
|
}[] | undefined;
|
|
899
899
|
description?: string | undefined;
|
|
900
900
|
auth?: {
|
|
901
|
+
method: "basic";
|
|
901
902
|
login: string;
|
|
902
903
|
password: string;
|
|
903
|
-
method: "basic";
|
|
904
904
|
} | {
|
|
905
905
|
type: "basic";
|
|
906
906
|
login: string;
|
|
@@ -925,9 +925,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
925
925
|
}[] | undefined;
|
|
926
926
|
description?: string | undefined;
|
|
927
927
|
auth?: {
|
|
928
|
+
method: "basic";
|
|
928
929
|
login: string;
|
|
929
930
|
password: string;
|
|
930
|
-
method: "basic";
|
|
931
931
|
} | {
|
|
932
932
|
method: "basic";
|
|
933
933
|
login: string;
|
|
@@ -956,9 +956,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
956
956
|
}[] | undefined;
|
|
957
957
|
description?: string | undefined;
|
|
958
958
|
auth?: {
|
|
959
|
+
method: "basic";
|
|
959
960
|
login: string;
|
|
960
961
|
password: string;
|
|
961
|
-
method: "basic";
|
|
962
962
|
} | {
|
|
963
963
|
type: "basic";
|
|
964
964
|
login: string;
|
|
@@ -1016,9 +1016,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
1016
1016
|
}[] | undefined;
|
|
1017
1017
|
description?: string | undefined;
|
|
1018
1018
|
auth?: {
|
|
1019
|
+
method: "basic";
|
|
1019
1020
|
login: string;
|
|
1020
1021
|
password: string;
|
|
1021
|
-
method: "basic";
|
|
1022
1022
|
} | {
|
|
1023
1023
|
method: "basic";
|
|
1024
1024
|
login: string;
|
|
@@ -1077,9 +1077,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
1077
1077
|
}[] | undefined;
|
|
1078
1078
|
description?: string | undefined;
|
|
1079
1079
|
auth?: {
|
|
1080
|
+
method: "basic";
|
|
1080
1081
|
login: string;
|
|
1081
1082
|
password: string;
|
|
1082
|
-
method: "basic";
|
|
1083
1083
|
} | {
|
|
1084
1084
|
method: "basic";
|
|
1085
1085
|
login: string;
|
|
@@ -1111,9 +1111,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
1111
1111
|
}[] | undefined;
|
|
1112
1112
|
description?: string | undefined;
|
|
1113
1113
|
auth?: {
|
|
1114
|
+
method: "basic";
|
|
1114
1115
|
login: string;
|
|
1115
1116
|
password: string;
|
|
1116
|
-
method: "basic";
|
|
1117
1117
|
} | {
|
|
1118
1118
|
type: "basic";
|
|
1119
1119
|
login: string;
|
|
@@ -1172,9 +1172,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
1172
1172
|
}[] | undefined;
|
|
1173
1173
|
description?: string | undefined;
|
|
1174
1174
|
auth?: {
|
|
1175
|
+
method: "basic";
|
|
1175
1176
|
login: string;
|
|
1176
1177
|
password: string;
|
|
1177
|
-
method: "basic";
|
|
1178
1178
|
} | {
|
|
1179
1179
|
type: "basic";
|
|
1180
1180
|
login: string;
|
|
@@ -1206,9 +1206,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
1206
1206
|
}[] | undefined;
|
|
1207
1207
|
description?: string | undefined;
|
|
1208
1208
|
auth?: {
|
|
1209
|
+
method: "basic";
|
|
1209
1210
|
login: string;
|
|
1210
1211
|
password: string;
|
|
1211
|
-
method: "basic";
|
|
1212
1212
|
} | {
|
|
1213
1213
|
method: "basic";
|
|
1214
1214
|
login: string;
|
|
@@ -1267,9 +1267,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
1267
1267
|
}[] | undefined;
|
|
1268
1268
|
description?: string | undefined;
|
|
1269
1269
|
auth?: {
|
|
1270
|
+
method: "basic";
|
|
1270
1271
|
login: string;
|
|
1271
1272
|
password: string;
|
|
1272
|
-
method: "basic";
|
|
1273
1273
|
} | {
|
|
1274
1274
|
method: "basic";
|
|
1275
1275
|
login: string;
|
|
@@ -1301,9 +1301,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
1301
1301
|
}[] | undefined;
|
|
1302
1302
|
description?: string | undefined;
|
|
1303
1303
|
auth?: {
|
|
1304
|
+
method: "basic";
|
|
1304
1305
|
login: string;
|
|
1305
1306
|
password: string;
|
|
1306
|
-
method: "basic";
|
|
1307
1307
|
} | {
|
|
1308
1308
|
type: "basic";
|
|
1309
1309
|
login: string;
|
|
@@ -1362,9 +1362,9 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
1362
1362
|
}[] | undefined;
|
|
1363
1363
|
description?: string | undefined;
|
|
1364
1364
|
auth?: {
|
|
1365
|
+
method: "basic";
|
|
1365
1366
|
login: string;
|
|
1366
1367
|
password: string;
|
|
1367
|
-
method: "basic";
|
|
1368
1368
|
} | {
|
|
1369
1369
|
type: "basic";
|
|
1370
1370
|
login: string;
|
|
@@ -1386,4 +1386,3 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
1386
1386
|
}> | undefined;
|
|
1387
1387
|
}>;
|
|
1388
1388
|
export type Pages = z.infer<typeof Pages>;
|
|
1389
|
-
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./schema/assets";
|
|
2
|
+
export * from "./schema/breakpoints";
|
|
3
|
+
export * from "./schema/data-sources";
|
|
4
|
+
export * from "./schema/deployment";
|
|
5
|
+
export * from "./schema/instances";
|
|
6
|
+
export * from "./schema/pages";
|
|
7
|
+
export * from "./schema/props";
|
|
8
|
+
export * from "./schema/resources";
|
|
9
|
+
export * from "./schema/style-source-selections";
|
|
10
|
+
export * from "./schema/style-sources";
|
|
11
|
+
export * from "./schema/styles";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.271.0",
|
|
4
4
|
"description": "Webstudio project data schema",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
"types": "./lib/types/link-utils.d.ts",
|
|
24
24
|
"import": "./lib/link-utils.js"
|
|
25
25
|
},
|
|
26
|
+
"./schema": {
|
|
27
|
+
"webstudio": "./src/schema.ts",
|
|
28
|
+
"types": "./lib/types/schema.d.ts",
|
|
29
|
+
"import": "./lib/schema.js"
|
|
30
|
+
},
|
|
26
31
|
"./normalize.css": {
|
|
27
32
|
"webstudio": "./src/__generated__/normalize.css.ts",
|
|
28
33
|
"types": "./lib/types/__generated__/normalize.css.d.ts",
|
|
@@ -51,23 +56,23 @@
|
|
|
51
56
|
"type-fest": "^4.37.0",
|
|
52
57
|
"warn-once": "^0.1.1",
|
|
53
58
|
"zod": "^3.24.2",
|
|
54
|
-
"@webstudio-is/css-engine": "0.
|
|
55
|
-
"@webstudio-is/
|
|
56
|
-
"@webstudio-is/
|
|
57
|
-
"@webstudio-is/
|
|
59
|
+
"@webstudio-is/css-engine": "0.271.0",
|
|
60
|
+
"@webstudio-is/icons": "0.271.0",
|
|
61
|
+
"@webstudio-is/fonts": "0.271.0",
|
|
62
|
+
"@webstudio-is/wsauth": "0.271.0"
|
|
58
63
|
},
|
|
59
64
|
"devDependencies": {
|
|
60
65
|
"html-tags": "^4.0.0",
|
|
61
66
|
"vitest": "^3.1.2",
|
|
62
|
-
"@webstudio-is/
|
|
63
|
-
"@webstudio-is/
|
|
67
|
+
"@webstudio-is/css-data": "0.271.0",
|
|
68
|
+
"@webstudio-is/template": "0.271.0",
|
|
64
69
|
"@webstudio-is/tsconfig": "1.0.7"
|
|
65
70
|
},
|
|
66
71
|
"scripts": {
|
|
67
72
|
"typecheck": "tsgo --noEmit -p tsconfig.typecheck.json",
|
|
68
73
|
"test": "vitest run",
|
|
69
74
|
"build:normalize.css": "tsx --conditions=webstudio ./scripts/normalize.css.ts && prettier --write src/__generated__/normalize.css.ts",
|
|
70
|
-
"build": "rm -rf lib && esbuild src/index.ts src/runtime.ts src/link-utils.ts src/__generated__/normalize.css.ts src/core-templates.tsx --outdir=lib --bundle --format=esm --packages=external",
|
|
75
|
+
"build": "rm -rf lib && esbuild src/index.ts src/runtime.ts src/link-utils.ts src/schema.ts src/__generated__/normalize.css.ts src/core-templates.tsx --outdir=lib --bundle --format=esm --packages=external",
|
|
71
76
|
"dts": "tsc --project tsconfig.dts.json"
|
|
72
77
|
}
|
|
73
78
|
}
|