@webstudio-is/sdk 0.128.0 → 0.130.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 CHANGED
@@ -57,8 +57,9 @@ var commonPageFields = {
57
57
  meta: z2.object({
58
58
  description: z2.string().optional(),
59
59
  title: z2.string().optional(),
60
- excludePageFromSearch: z2.boolean().optional(),
60
+ excludePageFromSearch: z2.string().optional(),
61
61
  socialImageAssetId: z2.string().optional(),
62
+ socialImageUrl: z2.string().optional(),
62
63
  custom: z2.array(
63
64
  z2.object({
64
65
  property: z2.string(),
@@ -97,7 +98,7 @@ var ProjectMeta = z2.object({
97
98
  faviconAssetId: z2.string().optional(),
98
99
  code: z2.string().optional()
99
100
  });
100
- var ProjectNewRedirectPathSchema = PagePath.or(
101
+ var ProjectNewRedirectPath = PagePath.or(
101
102
  z2.string().refine((data) => {
102
103
  try {
103
104
  new URL(data);
@@ -107,18 +108,18 @@ var ProjectNewRedirectPathSchema = PagePath.or(
107
108
  }
108
109
  }, "Must be a valid URL")
109
110
  );
110
- var PageRedirectSchema = z2.object({
111
+ var PageRedirect = z2.object({
111
112
  old: PagePath,
112
- new: ProjectNewRedirectPathSchema
113
+ new: ProjectNewRedirectPath
113
114
  });
114
- var ProjectSettings = z2.object({
115
+ var CompilerSettings = z2.object({
115
116
  // All fields are optional to ensure consistency and allow for the addition of new fields without requiring migration
116
- atomicStyles: z2.boolean().optional(),
117
- redirects: z2.array(PageRedirectSchema).optional()
117
+ atomicStyles: z2.boolean().optional()
118
118
  });
119
119
  var Pages = z2.object({
120
120
  meta: ProjectMeta.optional(),
121
- settings: ProjectSettings.optional(),
121
+ compiler: CompilerSettings.optional(),
122
+ redirects: z2.array(PageRedirect).optional(),
122
123
  homePage: HomePage,
123
124
  pages: z2.array(Page).refine(
124
125
  (array) => new Set(array.map((page) => page.path)).size === array.length,
@@ -538,7 +539,7 @@ var loadResource = async (resourceData) => {
538
539
  requestInit.body = body;
539
540
  }
540
541
  try {
541
- const response = await fetch(url, requestInit);
542
+ const response = await fetch(url.trim(), requestInit);
542
543
  let data;
543
544
  if (response.ok && // accept json by default and when specified explicitly
544
545
  (requestHeaders.has("accept") === false || requestHeaders.get("accept") === "application/json")) {
@@ -565,6 +566,7 @@ export {
565
566
  Assets,
566
567
  Breakpoint,
567
568
  Breakpoints,
569
+ CompilerSettings,
568
570
  DataSource,
569
571
  DataSourceVariableValue,
570
572
  DataSources,
@@ -582,10 +584,10 @@ export {
582
584
  Instances,
583
585
  PageName,
584
586
  PagePath,
585
- PageRedirectSchema,
587
+ PageRedirect,
586
588
  PageTitle,
587
589
  Pages,
588
- ProjectNewRedirectPathSchema,
590
+ ProjectNewRedirectPath,
589
591
  Prop,
590
592
  Props,
591
593
  ROOT_FOLDER_ID,
@@ -29,8 +29,9 @@ declare const Page: z.ZodObject<{
29
29
  meta: z.ZodObject<{
30
30
  description: z.ZodOptional<z.ZodString>;
31
31
  title: z.ZodOptional<z.ZodString>;
32
- excludePageFromSearch: z.ZodOptional<z.ZodBoolean>;
32
+ excludePageFromSearch: z.ZodOptional<z.ZodString>;
33
33
  socialImageAssetId: z.ZodOptional<z.ZodString>;
34
+ socialImageUrl: z.ZodOptional<z.ZodString>;
34
35
  custom: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
36
  property: z.ZodString;
36
37
  content: z.ZodString;
@@ -44,8 +45,9 @@ declare const Page: z.ZodObject<{
44
45
  }, "strip", z.ZodTypeAny, {
45
46
  description?: string | undefined;
46
47
  title?: string | undefined;
47
- excludePageFromSearch?: boolean | undefined;
48
+ excludePageFromSearch?: string | undefined;
48
49
  socialImageAssetId?: string | undefined;
50
+ socialImageUrl?: string | undefined;
49
51
  custom?: {
50
52
  property: string;
51
53
  content: string;
@@ -53,8 +55,9 @@ declare const Page: z.ZodObject<{
53
55
  }, {
54
56
  description?: string | undefined;
55
57
  title?: string | undefined;
56
- excludePageFromSearch?: boolean | undefined;
58
+ excludePageFromSearch?: string | undefined;
57
59
  socialImageAssetId?: string | undefined;
60
+ socialImageUrl?: string | undefined;
58
61
  custom?: {
59
62
  property: string;
60
63
  content: string;
@@ -68,8 +71,9 @@ declare const Page: z.ZodObject<{
68
71
  meta: {
69
72
  description?: string | undefined;
70
73
  title?: string | undefined;
71
- excludePageFromSearch?: boolean | undefined;
74
+ excludePageFromSearch?: string | undefined;
72
75
  socialImageAssetId?: string | undefined;
76
+ socialImageUrl?: string | undefined;
73
77
  custom?: {
74
78
  property: string;
75
79
  content: string;
@@ -85,8 +89,9 @@ declare const Page: z.ZodObject<{
85
89
  meta: {
86
90
  description?: string | undefined;
87
91
  title?: string | undefined;
88
- excludePageFromSearch?: boolean | undefined;
92
+ excludePageFromSearch?: string | undefined;
89
93
  socialImageAssetId?: string | undefined;
94
+ socialImageUrl?: string | undefined;
90
95
  custom?: {
91
96
  property: string;
92
97
  content: string;
@@ -110,8 +115,9 @@ declare const ProjectMeta: z.ZodObject<{
110
115
  faviconAssetId?: string | undefined;
111
116
  code?: string | undefined;
112
117
  }>;
113
- export declare const ProjectNewRedirectPathSchema: z.ZodUnion<[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>, z.ZodEffects<z.ZodString, string, string>]>;
114
- export declare const PageRedirectSchema: z.ZodObject<{
118
+ export type ProjectMeta = z.infer<typeof ProjectMeta>;
119
+ export declare const ProjectNewRedirectPath: z.ZodUnion<[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>, z.ZodEffects<z.ZodString, string, string>]>;
120
+ export declare const PageRedirect: z.ZodObject<{
115
121
  old: 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>;
116
122
  new: z.ZodUnion<[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>, z.ZodEffects<z.ZodString, string, string>]>;
117
123
  }, "strip", z.ZodTypeAny, {
@@ -121,8 +127,15 @@ export declare const PageRedirectSchema: z.ZodObject<{
121
127
  old: string;
122
128
  new: string;
123
129
  }>;
124
- export type PageRedirect = z.infer<typeof PageRedirectSchema>;
125
- export type ProjectMeta = z.infer<typeof ProjectMeta>;
130
+ export type PageRedirect = z.infer<typeof PageRedirect>;
131
+ export declare const CompilerSettings: z.ZodObject<{
132
+ atomicStyles: z.ZodOptional<z.ZodBoolean>;
133
+ }, "strip", z.ZodTypeAny, {
134
+ atomicStyles?: boolean | undefined;
135
+ }, {
136
+ atomicStyles?: boolean | undefined;
137
+ }>;
138
+ export type CompilerSettings = z.infer<typeof CompilerSettings>;
126
139
  export type Page = z.infer<typeof Page>;
127
140
  export declare const Pages: z.ZodObject<{
128
141
  meta: z.ZodOptional<z.ZodObject<{
@@ -138,31 +151,23 @@ export declare const Pages: z.ZodObject<{
138
151
  faviconAssetId?: string | undefined;
139
152
  code?: string | undefined;
140
153
  }>>;
141
- settings: z.ZodOptional<z.ZodObject<{
154
+ compiler: z.ZodOptional<z.ZodObject<{
142
155
  atomicStyles: z.ZodOptional<z.ZodBoolean>;
143
- redirects: z.ZodOptional<z.ZodArray<z.ZodObject<{
144
- old: 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>;
145
- new: z.ZodUnion<[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>, z.ZodEffects<z.ZodString, string, string>]>;
146
- }, "strip", z.ZodTypeAny, {
147
- old: string;
148
- new: string;
149
- }, {
150
- old: string;
151
- new: string;
152
- }>, "many">>;
153
156
  }, "strip", z.ZodTypeAny, {
154
157
  atomicStyles?: boolean | undefined;
155
- redirects?: {
156
- old: string;
157
- new: string;
158
- }[] | undefined;
159
158
  }, {
160
159
  atomicStyles?: boolean | undefined;
161
- redirects?: {
162
- old: string;
163
- new: string;
164
- }[] | undefined;
165
160
  }>>;
161
+ redirects: z.ZodOptional<z.ZodArray<z.ZodObject<{
162
+ old: 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>;
163
+ new: z.ZodUnion<[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>, z.ZodEffects<z.ZodString, string, string>]>;
164
+ }, "strip", z.ZodTypeAny, {
165
+ old: string;
166
+ new: string;
167
+ }, {
168
+ old: string;
169
+ new: string;
170
+ }>, "many">>;
166
171
  homePage: z.ZodObject<{
167
172
  path: z.ZodEffects<z.ZodString, string, string>;
168
173
  id: z.ZodString;
@@ -171,8 +176,9 @@ export declare const Pages: z.ZodObject<{
171
176
  meta: z.ZodObject<{
172
177
  description: z.ZodOptional<z.ZodString>;
173
178
  title: z.ZodOptional<z.ZodString>;
174
- excludePageFromSearch: z.ZodOptional<z.ZodBoolean>;
179
+ excludePageFromSearch: z.ZodOptional<z.ZodString>;
175
180
  socialImageAssetId: z.ZodOptional<z.ZodString>;
181
+ socialImageUrl: z.ZodOptional<z.ZodString>;
176
182
  custom: z.ZodOptional<z.ZodArray<z.ZodObject<{
177
183
  property: z.ZodString;
178
184
  content: z.ZodString;
@@ -186,8 +192,9 @@ export declare const Pages: z.ZodObject<{
186
192
  }, "strip", z.ZodTypeAny, {
187
193
  description?: string | undefined;
188
194
  title?: string | undefined;
189
- excludePageFromSearch?: boolean | undefined;
195
+ excludePageFromSearch?: string | undefined;
190
196
  socialImageAssetId?: string | undefined;
197
+ socialImageUrl?: string | undefined;
191
198
  custom?: {
192
199
  property: string;
193
200
  content: string;
@@ -195,8 +202,9 @@ export declare const Pages: z.ZodObject<{
195
202
  }, {
196
203
  description?: string | undefined;
197
204
  title?: string | undefined;
198
- excludePageFromSearch?: boolean | undefined;
205
+ excludePageFromSearch?: string | undefined;
199
206
  socialImageAssetId?: string | undefined;
207
+ socialImageUrl?: string | undefined;
200
208
  custom?: {
201
209
  property: string;
202
210
  content: string;
@@ -210,8 +218,9 @@ export declare const Pages: z.ZodObject<{
210
218
  meta: {
211
219
  description?: string | undefined;
212
220
  title?: string | undefined;
213
- excludePageFromSearch?: boolean | undefined;
221
+ excludePageFromSearch?: string | undefined;
214
222
  socialImageAssetId?: string | undefined;
223
+ socialImageUrl?: string | undefined;
215
224
  custom?: {
216
225
  property: string;
217
226
  content: string;
@@ -227,8 +236,9 @@ export declare const Pages: z.ZodObject<{
227
236
  meta: {
228
237
  description?: string | undefined;
229
238
  title?: string | undefined;
230
- excludePageFromSearch?: boolean | undefined;
239
+ excludePageFromSearch?: string | undefined;
231
240
  socialImageAssetId?: string | undefined;
241
+ socialImageUrl?: string | undefined;
232
242
  custom?: {
233
243
  property: string;
234
244
  content: string;
@@ -247,8 +257,9 @@ export declare const Pages: z.ZodObject<{
247
257
  meta: z.ZodObject<{
248
258
  description: z.ZodOptional<z.ZodString>;
249
259
  title: z.ZodOptional<z.ZodString>;
250
- excludePageFromSearch: z.ZodOptional<z.ZodBoolean>;
260
+ excludePageFromSearch: z.ZodOptional<z.ZodString>;
251
261
  socialImageAssetId: z.ZodOptional<z.ZodString>;
262
+ socialImageUrl: z.ZodOptional<z.ZodString>;
252
263
  custom: z.ZodOptional<z.ZodArray<z.ZodObject<{
253
264
  property: z.ZodString;
254
265
  content: z.ZodString;
@@ -262,8 +273,9 @@ export declare const Pages: z.ZodObject<{
262
273
  }, "strip", z.ZodTypeAny, {
263
274
  description?: string | undefined;
264
275
  title?: string | undefined;
265
- excludePageFromSearch?: boolean | undefined;
276
+ excludePageFromSearch?: string | undefined;
266
277
  socialImageAssetId?: string | undefined;
278
+ socialImageUrl?: string | undefined;
267
279
  custom?: {
268
280
  property: string;
269
281
  content: string;
@@ -271,8 +283,9 @@ export declare const Pages: z.ZodObject<{
271
283
  }, {
272
284
  description?: string | undefined;
273
285
  title?: string | undefined;
274
- excludePageFromSearch?: boolean | undefined;
286
+ excludePageFromSearch?: string | undefined;
275
287
  socialImageAssetId?: string | undefined;
288
+ socialImageUrl?: string | undefined;
276
289
  custom?: {
277
290
  property: string;
278
291
  content: string;
@@ -286,8 +299,9 @@ export declare const Pages: z.ZodObject<{
286
299
  meta: {
287
300
  description?: string | undefined;
288
301
  title?: string | undefined;
289
- excludePageFromSearch?: boolean | undefined;
302
+ excludePageFromSearch?: string | undefined;
290
303
  socialImageAssetId?: string | undefined;
304
+ socialImageUrl?: string | undefined;
291
305
  custom?: {
292
306
  property: string;
293
307
  content: string;
@@ -303,8 +317,9 @@ export declare const Pages: z.ZodObject<{
303
317
  meta: {
304
318
  description?: string | undefined;
305
319
  title?: string | undefined;
306
- excludePageFromSearch?: boolean | undefined;
320
+ excludePageFromSearch?: string | undefined;
307
321
  socialImageAssetId?: string | undefined;
322
+ socialImageUrl?: string | undefined;
308
323
  custom?: {
309
324
  property: string;
310
325
  content: string;
@@ -320,8 +335,9 @@ export declare const Pages: z.ZodObject<{
320
335
  meta: {
321
336
  description?: string | undefined;
322
337
  title?: string | undefined;
323
- excludePageFromSearch?: boolean | undefined;
338
+ excludePageFromSearch?: string | undefined;
324
339
  socialImageAssetId?: string | undefined;
340
+ socialImageUrl?: string | undefined;
325
341
  custom?: {
326
342
  property: string;
327
343
  content: string;
@@ -337,8 +353,9 @@ export declare const Pages: z.ZodObject<{
337
353
  meta: {
338
354
  description?: string | undefined;
339
355
  title?: string | undefined;
340
- excludePageFromSearch?: boolean | undefined;
356
+ excludePageFromSearch?: string | undefined;
341
357
  socialImageAssetId?: string | undefined;
358
+ socialImageUrl?: string | undefined;
342
359
  custom?: {
343
360
  property: string;
344
361
  content: string;
@@ -382,8 +399,9 @@ export declare const Pages: z.ZodObject<{
382
399
  meta: {
383
400
  description?: string | undefined;
384
401
  title?: string | undefined;
385
- excludePageFromSearch?: boolean | undefined;
402
+ excludePageFromSearch?: string | undefined;
386
403
  socialImageAssetId?: string | undefined;
404
+ socialImageUrl?: string | undefined;
387
405
  custom?: {
388
406
  property: string;
389
407
  content: string;
@@ -400,8 +418,9 @@ export declare const Pages: z.ZodObject<{
400
418
  meta: {
401
419
  description?: string | undefined;
402
420
  title?: string | undefined;
403
- excludePageFromSearch?: boolean | undefined;
421
+ excludePageFromSearch?: string | undefined;
404
422
  socialImageAssetId?: string | undefined;
423
+ socialImageUrl?: string | undefined;
405
424
  custom?: {
406
425
  property: string;
407
426
  content: string;
@@ -423,13 +442,13 @@ export declare const Pages: z.ZodObject<{
423
442
  faviconAssetId?: string | undefined;
424
443
  code?: string | undefined;
425
444
  } | undefined;
426
- settings?: {
445
+ compiler?: {
427
446
  atomicStyles?: boolean | undefined;
428
- redirects?: {
429
- old: string;
430
- new: string;
431
- }[] | undefined;
432
447
  } | undefined;
448
+ redirects?: {
449
+ old: string;
450
+ new: string;
451
+ }[] | undefined;
433
452
  }, {
434
453
  homePage: {
435
454
  path: string;
@@ -437,8 +456,9 @@ export declare const Pages: z.ZodObject<{
437
456
  meta: {
438
457
  description?: string | undefined;
439
458
  title?: string | undefined;
440
- excludePageFromSearch?: boolean | undefined;
459
+ excludePageFromSearch?: string | undefined;
441
460
  socialImageAssetId?: string | undefined;
461
+ socialImageUrl?: string | undefined;
442
462
  custom?: {
443
463
  property: string;
444
464
  content: string;
@@ -455,8 +475,9 @@ export declare const Pages: z.ZodObject<{
455
475
  meta: {
456
476
  description?: string | undefined;
457
477
  title?: string | undefined;
458
- excludePageFromSearch?: boolean | undefined;
478
+ excludePageFromSearch?: string | undefined;
459
479
  socialImageAssetId?: string | undefined;
480
+ socialImageUrl?: string | undefined;
460
481
  custom?: {
461
482
  property: string;
462
483
  content: string;
@@ -478,13 +499,13 @@ export declare const Pages: z.ZodObject<{
478
499
  faviconAssetId?: string | undefined;
479
500
  code?: string | undefined;
480
501
  } | undefined;
481
- settings?: {
502
+ compiler?: {
482
503
  atomicStyles?: boolean | undefined;
483
- redirects?: {
484
- old: string;
485
- new: string;
486
- }[] | undefined;
487
504
  } | undefined;
505
+ redirects?: {
506
+ old: string;
507
+ new: string;
508
+ }[] | undefined;
488
509
  }>;
489
510
  export type Pages = z.infer<typeof Pages>;
490
511
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk",
3
- "version": "0.128.0",
3
+ "version": "0.130.0",
4
4
  "description": "Webstudio project 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/css-engine": "0.128.0",
23
- "@webstudio-is/fonts": "0.128.0"
22
+ "@webstudio-is/fonts": "0.130.0",
23
+ "@webstudio-is/css-engine": "0.130.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@jest/globals": "^29.7.0",