@webstudio-is/sdk 0.135.0 → 0.137.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
@@ -58,6 +58,7 @@ var commonPageFields = {
58
58
  description: z2.string().optional(),
59
59
  title: z2.string().optional(),
60
60
  excludePageFromSearch: z2.string().optional(),
61
+ language: z2.string().optional(),
61
62
  socialImageAssetId: z2.string().optional(),
62
63
  socialImageUrl: z2.string().optional(),
63
64
  status: z2.string().optional(),
@@ -230,6 +231,14 @@ var Resource = z5.object({
230
231
  // expression
231
232
  body: z5.optional(z5.string())
232
233
  });
234
+ var ResourceRequest = z5.object({
235
+ id: ResourceId,
236
+ name: z5.string(),
237
+ method: Method,
238
+ url: z5.string(),
239
+ headers: z5.array(Header),
240
+ body: z5.optional(z5.unknown())
241
+ });
233
242
  var Resources = z5.map(ResourceId, Resource);
234
243
 
235
244
  // src/schema/props.ts
@@ -539,7 +548,12 @@ var loadResource = async (resourceData) => {
539
548
  headers: requestHeaders
540
549
  };
541
550
  if (method !== "get" && body !== void 0) {
542
- requestInit.body = body;
551
+ if (typeof body === "string") {
552
+ requestInit.body = body;
553
+ }
554
+ if (typeof body === "object") {
555
+ requestInit.body = JSON.stringify(body);
556
+ }
543
557
  }
544
558
  try {
545
559
  const response = await fetch(url.trim(), requestInit);
@@ -595,6 +609,7 @@ export {
595
609
  Props,
596
610
  ROOT_FOLDER_ID,
597
611
  Resource,
612
+ ResourceRequest,
598
613
  Resources,
599
614
  StyleDecl,
600
615
  StyleSource,
@@ -1,5 +1,5 @@
1
- import type { Resource } from "./schema/resources";
2
- export declare const loadResource: (resourceData: Resource) => Promise<{
1
+ import type { ResourceRequest } from "./schema/resources";
2
+ export declare const loadResource: (resourceData: ResourceRequest) => Promise<{
3
3
  data: any;
4
4
  status: number;
5
5
  statusText: string;
@@ -30,6 +30,7 @@ declare const Page: z.ZodObject<{
30
30
  description: z.ZodOptional<z.ZodString>;
31
31
  title: z.ZodOptional<z.ZodString>;
32
32
  excludePageFromSearch: z.ZodOptional<z.ZodString>;
33
+ language: z.ZodOptional<z.ZodString>;
33
34
  socialImageAssetId: z.ZodOptional<z.ZodString>;
34
35
  socialImageUrl: z.ZodOptional<z.ZodString>;
35
36
  status: z.ZodOptional<z.ZodString>;
@@ -48,6 +49,7 @@ declare const Page: z.ZodObject<{
48
49
  description?: string | undefined;
49
50
  title?: string | undefined;
50
51
  excludePageFromSearch?: string | undefined;
52
+ language?: string | undefined;
51
53
  socialImageAssetId?: string | undefined;
52
54
  socialImageUrl?: string | undefined;
53
55
  status?: string | undefined;
@@ -60,6 +62,7 @@ declare const Page: z.ZodObject<{
60
62
  description?: string | undefined;
61
63
  title?: string | undefined;
62
64
  excludePageFromSearch?: string | undefined;
65
+ language?: string | undefined;
63
66
  socialImageAssetId?: string | undefined;
64
67
  socialImageUrl?: string | undefined;
65
68
  status?: string | undefined;
@@ -78,6 +81,7 @@ declare const Page: z.ZodObject<{
78
81
  description?: string | undefined;
79
82
  title?: string | undefined;
80
83
  excludePageFromSearch?: string | undefined;
84
+ language?: string | undefined;
81
85
  socialImageAssetId?: string | undefined;
82
86
  socialImageUrl?: string | undefined;
83
87
  status?: string | undefined;
@@ -98,6 +102,7 @@ declare const Page: z.ZodObject<{
98
102
  description?: string | undefined;
99
103
  title?: string | undefined;
100
104
  excludePageFromSearch?: string | undefined;
105
+ language?: string | undefined;
101
106
  socialImageAssetId?: string | undefined;
102
107
  socialImageUrl?: string | undefined;
103
108
  status?: string | undefined;
@@ -193,6 +198,7 @@ export declare const Pages: z.ZodObject<{
193
198
  description: z.ZodOptional<z.ZodString>;
194
199
  title: z.ZodOptional<z.ZodString>;
195
200
  excludePageFromSearch: z.ZodOptional<z.ZodString>;
201
+ language: z.ZodOptional<z.ZodString>;
196
202
  socialImageAssetId: z.ZodOptional<z.ZodString>;
197
203
  socialImageUrl: z.ZodOptional<z.ZodString>;
198
204
  status: z.ZodOptional<z.ZodString>;
@@ -211,6 +217,7 @@ export declare const Pages: z.ZodObject<{
211
217
  description?: string | undefined;
212
218
  title?: string | undefined;
213
219
  excludePageFromSearch?: string | undefined;
220
+ language?: string | undefined;
214
221
  socialImageAssetId?: string | undefined;
215
222
  socialImageUrl?: string | undefined;
216
223
  status?: string | undefined;
@@ -223,6 +230,7 @@ export declare const Pages: z.ZodObject<{
223
230
  description?: string | undefined;
224
231
  title?: string | undefined;
225
232
  excludePageFromSearch?: string | undefined;
233
+ language?: string | undefined;
226
234
  socialImageAssetId?: string | undefined;
227
235
  socialImageUrl?: string | undefined;
228
236
  status?: string | undefined;
@@ -241,6 +249,7 @@ export declare const Pages: z.ZodObject<{
241
249
  description?: string | undefined;
242
250
  title?: string | undefined;
243
251
  excludePageFromSearch?: string | undefined;
252
+ language?: string | undefined;
244
253
  socialImageAssetId?: string | undefined;
245
254
  socialImageUrl?: string | undefined;
246
255
  status?: string | undefined;
@@ -261,6 +270,7 @@ export declare const Pages: z.ZodObject<{
261
270
  description?: string | undefined;
262
271
  title?: string | undefined;
263
272
  excludePageFromSearch?: string | undefined;
273
+ language?: string | undefined;
264
274
  socialImageAssetId?: string | undefined;
265
275
  socialImageUrl?: string | undefined;
266
276
  status?: string | undefined;
@@ -284,6 +294,7 @@ export declare const Pages: z.ZodObject<{
284
294
  description: z.ZodOptional<z.ZodString>;
285
295
  title: z.ZodOptional<z.ZodString>;
286
296
  excludePageFromSearch: z.ZodOptional<z.ZodString>;
297
+ language: z.ZodOptional<z.ZodString>;
287
298
  socialImageAssetId: z.ZodOptional<z.ZodString>;
288
299
  socialImageUrl: z.ZodOptional<z.ZodString>;
289
300
  status: z.ZodOptional<z.ZodString>;
@@ -302,6 +313,7 @@ export declare const Pages: z.ZodObject<{
302
313
  description?: string | undefined;
303
314
  title?: string | undefined;
304
315
  excludePageFromSearch?: string | undefined;
316
+ language?: string | undefined;
305
317
  socialImageAssetId?: string | undefined;
306
318
  socialImageUrl?: string | undefined;
307
319
  status?: string | undefined;
@@ -314,6 +326,7 @@ export declare const Pages: z.ZodObject<{
314
326
  description?: string | undefined;
315
327
  title?: string | undefined;
316
328
  excludePageFromSearch?: string | undefined;
329
+ language?: string | undefined;
317
330
  socialImageAssetId?: string | undefined;
318
331
  socialImageUrl?: string | undefined;
319
332
  status?: string | undefined;
@@ -332,6 +345,7 @@ export declare const Pages: z.ZodObject<{
332
345
  description?: string | undefined;
333
346
  title?: string | undefined;
334
347
  excludePageFromSearch?: string | undefined;
348
+ language?: string | undefined;
335
349
  socialImageAssetId?: string | undefined;
336
350
  socialImageUrl?: string | undefined;
337
351
  status?: string | undefined;
@@ -352,6 +366,7 @@ export declare const Pages: z.ZodObject<{
352
366
  description?: string | undefined;
353
367
  title?: string | undefined;
354
368
  excludePageFromSearch?: string | undefined;
369
+ language?: string | undefined;
355
370
  socialImageAssetId?: string | undefined;
356
371
  socialImageUrl?: string | undefined;
357
372
  status?: string | undefined;
@@ -372,6 +387,7 @@ export declare const Pages: z.ZodObject<{
372
387
  description?: string | undefined;
373
388
  title?: string | undefined;
374
389
  excludePageFromSearch?: string | undefined;
390
+ language?: string | undefined;
375
391
  socialImageAssetId?: string | undefined;
376
392
  socialImageUrl?: string | undefined;
377
393
  status?: string | undefined;
@@ -392,6 +408,7 @@ export declare const Pages: z.ZodObject<{
392
408
  description?: string | undefined;
393
409
  title?: string | undefined;
394
410
  excludePageFromSearch?: string | undefined;
411
+ language?: string | undefined;
395
412
  socialImageAssetId?: string | undefined;
396
413
  socialImageUrl?: string | undefined;
397
414
  status?: string | undefined;
@@ -440,6 +457,7 @@ export declare const Pages: z.ZodObject<{
440
457
  description?: string | undefined;
441
458
  title?: string | undefined;
442
459
  excludePageFromSearch?: string | undefined;
460
+ language?: string | undefined;
443
461
  socialImageAssetId?: string | undefined;
444
462
  socialImageUrl?: string | undefined;
445
463
  status?: string | undefined;
@@ -461,6 +479,7 @@ export declare const Pages: z.ZodObject<{
461
479
  description?: string | undefined;
462
480
  title?: string | undefined;
463
481
  excludePageFromSearch?: string | undefined;
482
+ language?: string | undefined;
464
483
  socialImageAssetId?: string | undefined;
465
484
  socialImageUrl?: string | undefined;
466
485
  status?: string | undefined;
@@ -502,6 +521,7 @@ export declare const Pages: z.ZodObject<{
502
521
  description?: string | undefined;
503
522
  title?: string | undefined;
504
523
  excludePageFromSearch?: string | undefined;
524
+ language?: string | undefined;
505
525
  socialImageAssetId?: string | undefined;
506
526
  socialImageUrl?: string | undefined;
507
527
  status?: string | undefined;
@@ -523,6 +543,7 @@ export declare const Pages: z.ZodObject<{
523
543
  description?: string | undefined;
524
544
  title?: string | undefined;
525
545
  excludePageFromSearch?: string | undefined;
546
+ language?: string | undefined;
526
547
  socialImageAssetId?: string | undefined;
527
548
  socialImageUrl?: string | undefined;
528
549
  status?: string | undefined;
@@ -37,6 +37,44 @@ export declare const Resource: z.ZodObject<{
37
37
  body?: string | undefined;
38
38
  }>;
39
39
  export type Resource = z.infer<typeof Resource>;
40
+ export declare const ResourceRequest: z.ZodObject<{
41
+ id: z.ZodString;
42
+ name: z.ZodString;
43
+ method: z.ZodUnion<[z.ZodLiteral<"get">, z.ZodLiteral<"post">, z.ZodLiteral<"put">, z.ZodLiteral<"delete">]>;
44
+ url: z.ZodString;
45
+ headers: z.ZodArray<z.ZodObject<{
46
+ name: z.ZodString;
47
+ value: z.ZodString;
48
+ }, "strip", z.ZodTypeAny, {
49
+ value: string;
50
+ name: string;
51
+ }, {
52
+ value: string;
53
+ name: string;
54
+ }>, "many">;
55
+ body: z.ZodOptional<z.ZodUnknown>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ name: string;
58
+ id: string;
59
+ method: "get" | "post" | "put" | "delete";
60
+ url: string;
61
+ headers: {
62
+ value: string;
63
+ name: string;
64
+ }[];
65
+ body?: unknown;
66
+ }, {
67
+ name: string;
68
+ id: string;
69
+ method: "get" | "post" | "put" | "delete";
70
+ url: string;
71
+ headers: {
72
+ value: string;
73
+ name: string;
74
+ }[];
75
+ body?: unknown;
76
+ }>;
77
+ export type ResourceRequest = z.infer<typeof ResourceRequest>;
40
78
  export declare const Resources: z.ZodMap<z.ZodString, z.ZodObject<{
41
79
  id: z.ZodString;
42
80
  name: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk",
3
- "version": "0.135.0",
3
+ "version": "0.137.0",
4
4
  "description": "Webstudio project data schema",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -19,13 +19,13 @@
19
19
  "sideEffects": false,
20
20
  "dependencies": {
21
21
  "zod": "^3.21.4",
22
- "@webstudio-is/css-engine": "0.135.0",
23
- "@webstudio-is/fonts": "0.135.0"
22
+ "@webstudio-is/css-engine": "0.137.0",
23
+ "@webstudio-is/fonts": "0.137.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@jest/globals": "^29.7.0",
27
- "@webstudio-is/tsconfig": "1.0.7",
28
- "@webstudio-is/jest-config": "1.0.7"
27
+ "@webstudio-is/jest-config": "1.0.7",
28
+ "@webstudio-is/tsconfig": "1.0.7"
29
29
  },
30
30
  "scripts": {
31
31
  "typecheck": "tsc",