@webstudio-is/sdk 0.121.0 → 0.123.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 +12 -14
- package/lib/types/schema/data-sources.d.ts +32 -2
- package/lib/types/schema/pages.d.ts +19 -5
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -53,22 +53,17 @@ var commonPageFields = {
|
|
|
53
53
|
})
|
|
54
54
|
).optional()
|
|
55
55
|
}),
|
|
56
|
-
rootInstanceId: z2.string()
|
|
56
|
+
rootInstanceId: z2.string(),
|
|
57
|
+
pathVariableId: z2.optional(z2.string())
|
|
57
58
|
};
|
|
58
59
|
var HomePagePath = z2.string().refine((path) => path === "", "Home page path must be empty");
|
|
59
60
|
var HomePage = z2.object({
|
|
60
61
|
...commonPageFields,
|
|
61
62
|
path: HomePagePath
|
|
62
63
|
});
|
|
63
|
-
var
|
|
64
|
-
(path) => path
|
|
65
|
-
"
|
|
66
|
-
).refine((path) => path.endsWith("/") === false, "Can't end with a /").refine(
|
|
67
|
-
(path) => path.includes("//") === false,
|
|
68
|
-
"Can't contain repeating /"
|
|
69
|
-
).refine(
|
|
70
|
-
(path) => /^[-_a-z0-9\\/]*$/.test(path),
|
|
71
|
-
"Only a-z, 0-9, -, _ and / are allowed"
|
|
64
|
+
var PagePath = z2.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine((path) => path === "" || path.startsWith("/"), "Must start with a /").refine((path) => path.endsWith("/") === false, "Can't end with a /").refine((path) => path.includes("//") === false, "Can't contain repeating /").refine(
|
|
65
|
+
(path) => /^[-_a-z0-9*:\\/]*$/.test(path),
|
|
66
|
+
"Only a-z, 0-9, -, _, /, : and * are allowed"
|
|
72
67
|
).refine(
|
|
73
68
|
// We use /s for our system stuff like /s/css or /s/uploads
|
|
74
69
|
(path) => path !== "/s" && path.startsWith("/s/") === false,
|
|
@@ -79,7 +74,6 @@ var pathValidators = (baseValidator) => baseValidator.refine((path) => path !==
|
|
|
79
74
|
(path) => path !== "/build" && path.startsWith("/build/") === false,
|
|
80
75
|
"/build prefix is reserved for the system"
|
|
81
76
|
);
|
|
82
|
-
var PagePath = pathValidators(z2.string());
|
|
83
77
|
var Page = z2.object({
|
|
84
78
|
...commonPageFields,
|
|
85
79
|
path: PagePath
|
|
@@ -152,7 +146,12 @@ var DataSource = z4.union([
|
|
|
152
146
|
name: z4.string(),
|
|
153
147
|
value: DataSourceVariableValue
|
|
154
148
|
}),
|
|
155
|
-
z4.
|
|
149
|
+
z4.object({
|
|
150
|
+
type: z4.literal("parameter"),
|
|
151
|
+
id: DataSourceId,
|
|
152
|
+
scopeInstanceId: z4.optional(z4.string()),
|
|
153
|
+
name: z4.string()
|
|
154
|
+
})
|
|
156
155
|
]);
|
|
157
156
|
var DataSources = z4.map(DataSourceId, DataSource);
|
|
158
157
|
|
|
@@ -422,6 +421,5 @@ export {
|
|
|
422
421
|
findTreeInstanceIdsExcludingSlotDescendants,
|
|
423
422
|
getStyleDeclKey,
|
|
424
423
|
initialBreakpoints,
|
|
425
|
-
parseComponentName
|
|
426
|
-
pathValidators
|
|
424
|
+
parseComponentName
|
|
427
425
|
};
|
|
@@ -138,7 +138,22 @@ export declare const DataSource: z.ZodUnion<[z.ZodObject<{
|
|
|
138
138
|
name: string;
|
|
139
139
|
id: string;
|
|
140
140
|
scopeInstanceId?: string | undefined;
|
|
141
|
-
}>, z.
|
|
141
|
+
}>, z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<"parameter">;
|
|
143
|
+
id: z.ZodString;
|
|
144
|
+
scopeInstanceId: z.ZodOptional<z.ZodString>;
|
|
145
|
+
name: z.ZodString;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
type: "parameter";
|
|
148
|
+
name: string;
|
|
149
|
+
id: string;
|
|
150
|
+
scopeInstanceId?: string | undefined;
|
|
151
|
+
}, {
|
|
152
|
+
type: "parameter";
|
|
153
|
+
name: string;
|
|
154
|
+
id: string;
|
|
155
|
+
scopeInstanceId?: string | undefined;
|
|
156
|
+
}>]>;
|
|
142
157
|
export type DataSource = z.infer<typeof DataSource>;
|
|
143
158
|
export declare const DataSources: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
144
159
|
type: z.ZodLiteral<"variable">;
|
|
@@ -233,5 +248,20 @@ export declare const DataSources: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<
|
|
|
233
248
|
name: string;
|
|
234
249
|
id: string;
|
|
235
250
|
scopeInstanceId?: string | undefined;
|
|
236
|
-
}>, z.
|
|
251
|
+
}>, z.ZodObject<{
|
|
252
|
+
type: z.ZodLiteral<"parameter">;
|
|
253
|
+
id: z.ZodString;
|
|
254
|
+
scopeInstanceId: z.ZodOptional<z.ZodString>;
|
|
255
|
+
name: z.ZodString;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
type: "parameter";
|
|
258
|
+
name: string;
|
|
259
|
+
id: string;
|
|
260
|
+
scopeInstanceId?: string | undefined;
|
|
261
|
+
}, {
|
|
262
|
+
type: "parameter";
|
|
263
|
+
name: string;
|
|
264
|
+
id: string;
|
|
265
|
+
scopeInstanceId?: string | undefined;
|
|
266
|
+
}>]>>;
|
|
237
267
|
export type DataSources = z.infer<typeof DataSources>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { z
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const PageName: z.ZodEffects<z.ZodString, string, string>;
|
|
3
3
|
export declare const PageTitle: z.ZodEffects<z.ZodString, string, string>;
|
|
4
4
|
export declare const HomePagePath: z.ZodEffects<z.ZodString, string, string>;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const PagePath: z.ZodType<string, z.ZodTypeDef, string>;
|
|
5
|
+
export declare const PagePath: 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>;
|
|
7
6
|
declare const Page: z.ZodObject<{
|
|
8
|
-
path: z.
|
|
7
|
+
path: 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>;
|
|
9
8
|
id: z.ZodString;
|
|
10
9
|
name: z.ZodEffects<z.ZodString, string, string>;
|
|
11
10
|
title: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -44,6 +43,7 @@ declare const Page: z.ZodObject<{
|
|
|
44
43
|
}[] | undefined;
|
|
45
44
|
}>;
|
|
46
45
|
rootInstanceId: z.ZodString;
|
|
46
|
+
pathVariableId: z.ZodOptional<z.ZodString>;
|
|
47
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
48
|
path: string;
|
|
49
49
|
name: string;
|
|
@@ -60,6 +60,7 @@ declare const Page: z.ZodObject<{
|
|
|
60
60
|
id: string;
|
|
61
61
|
title: string;
|
|
62
62
|
rootInstanceId: string;
|
|
63
|
+
pathVariableId?: string | undefined;
|
|
63
64
|
}, {
|
|
64
65
|
path: string;
|
|
65
66
|
name: string;
|
|
@@ -76,6 +77,7 @@ declare const Page: z.ZodObject<{
|
|
|
76
77
|
id: string;
|
|
77
78
|
title: string;
|
|
78
79
|
rootInstanceId: string;
|
|
80
|
+
pathVariableId?: string | undefined;
|
|
79
81
|
}>;
|
|
80
82
|
declare const SiteMeta: z.ZodObject<{
|
|
81
83
|
siteName: z.ZodOptional<z.ZodString>;
|
|
@@ -146,6 +148,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
146
148
|
}[] | undefined;
|
|
147
149
|
}>;
|
|
148
150
|
rootInstanceId: z.ZodString;
|
|
151
|
+
pathVariableId: z.ZodOptional<z.ZodString>;
|
|
149
152
|
}, "strip", z.ZodTypeAny, {
|
|
150
153
|
path: string;
|
|
151
154
|
name: string;
|
|
@@ -162,6 +165,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
162
165
|
id: string;
|
|
163
166
|
title: string;
|
|
164
167
|
rootInstanceId: string;
|
|
168
|
+
pathVariableId?: string | undefined;
|
|
165
169
|
}, {
|
|
166
170
|
path: string;
|
|
167
171
|
name: string;
|
|
@@ -178,9 +182,10 @@ export declare const Pages: z.ZodObject<{
|
|
|
178
182
|
id: string;
|
|
179
183
|
title: string;
|
|
180
184
|
rootInstanceId: string;
|
|
185
|
+
pathVariableId?: string | undefined;
|
|
181
186
|
}>;
|
|
182
187
|
pages: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
183
|
-
path: z.
|
|
188
|
+
path: 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>;
|
|
184
189
|
id: z.ZodString;
|
|
185
190
|
name: z.ZodEffects<z.ZodString, string, string>;
|
|
186
191
|
title: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -219,6 +224,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
219
224
|
}[] | undefined;
|
|
220
225
|
}>;
|
|
221
226
|
rootInstanceId: z.ZodString;
|
|
227
|
+
pathVariableId: z.ZodOptional<z.ZodString>;
|
|
222
228
|
}, "strip", z.ZodTypeAny, {
|
|
223
229
|
path: string;
|
|
224
230
|
name: string;
|
|
@@ -235,6 +241,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
235
241
|
id: string;
|
|
236
242
|
title: string;
|
|
237
243
|
rootInstanceId: string;
|
|
244
|
+
pathVariableId?: string | undefined;
|
|
238
245
|
}, {
|
|
239
246
|
path: string;
|
|
240
247
|
name: string;
|
|
@@ -251,6 +258,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
251
258
|
id: string;
|
|
252
259
|
title: string;
|
|
253
260
|
rootInstanceId: string;
|
|
261
|
+
pathVariableId?: string | undefined;
|
|
254
262
|
}>, "many">, {
|
|
255
263
|
path: string;
|
|
256
264
|
name: string;
|
|
@@ -267,6 +275,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
267
275
|
id: string;
|
|
268
276
|
title: string;
|
|
269
277
|
rootInstanceId: string;
|
|
278
|
+
pathVariableId?: string | undefined;
|
|
270
279
|
}[], {
|
|
271
280
|
path: string;
|
|
272
281
|
name: string;
|
|
@@ -283,6 +292,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
283
292
|
id: string;
|
|
284
293
|
title: string;
|
|
285
294
|
rootInstanceId: string;
|
|
295
|
+
pathVariableId?: string | undefined;
|
|
286
296
|
}[]>;
|
|
287
297
|
}, "strip", z.ZodTypeAny, {
|
|
288
298
|
homePage: {
|
|
@@ -301,6 +311,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
301
311
|
id: string;
|
|
302
312
|
title: string;
|
|
303
313
|
rootInstanceId: string;
|
|
314
|
+
pathVariableId?: string | undefined;
|
|
304
315
|
};
|
|
305
316
|
pages: {
|
|
306
317
|
path: string;
|
|
@@ -318,6 +329,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
318
329
|
id: string;
|
|
319
330
|
title: string;
|
|
320
331
|
rootInstanceId: string;
|
|
332
|
+
pathVariableId?: string | undefined;
|
|
321
333
|
}[];
|
|
322
334
|
meta?: {
|
|
323
335
|
siteName?: string | undefined;
|
|
@@ -341,6 +353,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
341
353
|
id: string;
|
|
342
354
|
title: string;
|
|
343
355
|
rootInstanceId: string;
|
|
356
|
+
pathVariableId?: string | undefined;
|
|
344
357
|
};
|
|
345
358
|
pages: {
|
|
346
359
|
path: string;
|
|
@@ -358,6 +371,7 @@ export declare const Pages: z.ZodObject<{
|
|
|
358
371
|
id: string;
|
|
359
372
|
title: string;
|
|
360
373
|
rootInstanceId: string;
|
|
374
|
+
pathVariableId?: string | undefined;
|
|
361
375
|
}[];
|
|
362
376
|
meta?: {
|
|
363
377
|
siteName?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.123.0",
|
|
4
4
|
"description": "Webstudio site data schema",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"zod": "^3.21.4",
|
|
22
|
-
"@webstudio-is/
|
|
23
|
-
"@webstudio-is/
|
|
22
|
+
"@webstudio-is/css-engine": "0.123.0",
|
|
23
|
+
"@webstudio-is/fonts": "0.123.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@jest/globals": "^29.7.0",
|