@webstudio-is/sdk 0.227.0 → 0.229.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.
@@ -940,16 +940,16 @@ var blockMeta2 = {
940
940
  category: "general",
941
941
  template: /* @__PURE__ */ jsxs(ws.block, { children: [
942
942
  /* @__PURE__ */ jsxs(BlockTemplate, { "ws:label": "Templates", children: [
943
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "p" }),
943
+ /* @__PURE__ */ jsx(ws.element, { "ws:label": "Paragraph", "ws:tag": "p" }),
944
944
  /* @__PURE__ */ jsx(ws.element, { "ws:label": "Heading 1", "ws:tag": "h1" }),
945
945
  /* @__PURE__ */ jsx(ws.element, { "ws:label": "Heading 2", "ws:tag": "h2" }),
946
946
  /* @__PURE__ */ jsx(ws.element, { "ws:label": "Heading 3", "ws:tag": "h3" }),
947
947
  /* @__PURE__ */ jsx(ws.element, { "ws:label": "Heading 4", "ws:tag": "h4" }),
948
948
  /* @__PURE__ */ jsx(ws.element, { "ws:label": "Heading 5", "ws:tag": "h5" }),
949
949
  /* @__PURE__ */ jsx(ws.element, { "ws:label": "Heading 6", "ws:tag": "h6" }),
950
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "ul", children: /* @__PURE__ */ jsx(ws.element, { "ws:tag": "li" }) }),
951
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "ol", children: /* @__PURE__ */ jsx(ws.element, { "ws:tag": "li" }) }),
952
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "a" }),
950
+ /* @__PURE__ */ jsx(ws.element, { "ws:label": "Unordered List", "ws:tag": "ul", children: /* @__PURE__ */ jsx(ws.element, { "ws:label": "List Item", "ws:tag": "li" }) }),
951
+ /* @__PURE__ */ jsx(ws.element, { "ws:label": "Ordered List", "ws:tag": "ol", children: /* @__PURE__ */ jsx(ws.element, { "ws:label": "List Item", "ws:tag": "li" }) }),
952
+ /* @__PURE__ */ jsx(ws.element, { "ws:label": "Link", "ws:tag": "a" }),
953
953
  /* @__PURE__ */ jsx(
954
954
  $.Image,
955
955
  {
@@ -961,21 +961,29 @@ var blockMeta2 = {
961
961
  `
962
962
  }
963
963
  ),
964
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "hr" }),
965
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "blockquote" }),
964
+ /* @__PURE__ */ jsx(ws.element, { "ws:label": "Separator", "ws:tag": "hr" }),
965
+ /* @__PURE__ */ jsx(ws.element, { "ws:label": "Blockquote", "ws:tag": "blockquote" }),
966
966
  /* @__PURE__ */ jsx($.HtmlEmbed, {}),
967
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "code" })
967
+ /* @__PURE__ */ jsx(ws.element, { "ws:label": "Code Text", "ws:tag": "code" })
968
968
  ] }),
969
- /* @__PURE__ */ jsxs(ws.element, { "ws:tag": "p", children: [
969
+ /* @__PURE__ */ jsxs(ws.element, { "ws:label": "Paragraph", "ws:tag": "p", children: [
970
970
  "The Content Block component designates regions on the page where pre-styled instances can be inserted in",
971
971
  " ",
972
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "a", href: "https://wstd.us/content-block", children: "Content mode" }),
972
+ /* @__PURE__ */ jsx(
973
+ ws.element,
974
+ {
975
+ "ws:label": "Link",
976
+ "ws:tag": "a",
977
+ href: "https://wstd.us/content-block",
978
+ children: "Content mode"
979
+ }
980
+ ),
973
981
  "."
974
982
  ] }),
975
- /* @__PURE__ */ jsxs(ws.element, { "ws:tag": "ul", children: [
976
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "li", children: "In Content mode, you can edit any direct child instances that were pre-added to the Content Block, as well as add new instances predefined in Templates." }),
977
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "li", children: "To predefine instances for insertion in Content mode, switch to Design mode and add them to the Templates container." }),
978
- /* @__PURE__ */ jsx(ws.element, { "ws:tag": "li", children: "To insert predefined instances in Content mode, click the + button while hovering over the Content Block on the canvas and choose an instance from the list." })
983
+ /* @__PURE__ */ jsxs(ws.element, { "ws:label": "Unordered List", "ws:tag": "ul", children: [
984
+ /* @__PURE__ */ jsx(ws.element, { "ws:label": "List Item", "ws:tag": "li", children: "In Content mode, you can edit any direct child instances that were pre-added to the Content Block, as well as add new instances predefined in Templates." }),
985
+ /* @__PURE__ */ jsx(ws.element, { "ws:label": "List Item", "ws:tag": "li", children: "To predefine instances for insertion in Content mode, switch to Design mode and add them to the Templates container." }),
986
+ /* @__PURE__ */ jsx(ws.element, { "ws:label": "List Item", "ws:tag": "li", children: "To insert predefined instances in Content mode, click the + button while hovering over the Content Block on the canvas and choose an instance from the list." })
979
987
  ] })
980
988
  ] })
981
989
  };
package/lib/index.js CHANGED
@@ -13,7 +13,8 @@ var baseAsset = {
13
13
  projectId: z.string(),
14
14
  size: z.number(),
15
15
  name: z.string(),
16
- description: z.union([z.string(), z.null()]),
16
+ filename: z.string().optional(),
17
+ description: z.union([z.string().optional(), z.null()]),
17
18
  createdAt: z.string()
18
19
  };
19
20
  var FontAsset = z.object({
@@ -253,11 +254,6 @@ var Method = z5.union([
253
254
  z5.literal("put"),
254
255
  z5.literal("delete")
255
256
  ]);
256
- var Header = z5.object({
257
- name: z5.string(),
258
- // expression
259
- value: z5.string()
260
- });
261
257
  var Resource = z5.object({
262
258
  id: ResourceId,
263
259
  name: z5.string(),
@@ -265,16 +261,41 @@ var Resource = z5.object({
265
261
  method: Method,
266
262
  // expression
267
263
  url: z5.string(),
268
- headers: z5.array(Header),
264
+ searchParams: z5.array(
265
+ z5.object({
266
+ name: z5.string(),
267
+ // expression
268
+ value: z5.string()
269
+ })
270
+ ).optional(),
271
+ headers: z5.array(
272
+ z5.object({
273
+ name: z5.string(),
274
+ // expression
275
+ value: z5.string()
276
+ })
277
+ ),
269
278
  // expression
270
279
  body: z5.optional(z5.string())
271
280
  });
272
281
  var ResourceRequest = z5.object({
273
- id: ResourceId,
274
282
  name: z5.string(),
275
283
  method: Method,
276
284
  url: z5.string(),
277
- headers: z5.array(Header),
285
+ searchParams: z5.array(
286
+ z5.object({
287
+ name: z5.string(),
288
+ // can be string or object which should be serialized
289
+ value: z5.unknown()
290
+ })
291
+ ),
292
+ headers: z5.array(
293
+ z5.object({
294
+ name: z5.string(),
295
+ // can be string or object which should be serialized
296
+ value: z5.unknown()
297
+ })
298
+ ),
278
299
  body: z5.optional(z5.unknown())
279
300
  });
280
301
  var Resources = z5.map(ResourceId, Resource);
@@ -2309,8 +2330,6 @@ var generateResources = ({
2309
2330
  let generatedRequest = "";
2310
2331
  const resourceName = scope.getName(resource.id, resource.name);
2311
2332
  generatedRequest += ` const ${resourceName}: ResourceRequest = {
2312
- `;
2313
- generatedRequest += ` id: "${resource.id}",
2314
2333
  `;
2315
2334
  generatedRequest += ` name: ${JSON.stringify(resource.name)},
2316
2335
  `;
@@ -2321,6 +2340,20 @@ var generateResources = ({
2321
2340
  scope
2322
2341
  });
2323
2342
  generatedRequest += ` url: ${url},
2343
+ `;
2344
+ generatedRequest += ` searchParams: [
2345
+ `;
2346
+ for (const searchParam of resource.searchParams ?? []) {
2347
+ const value = generateExpression({
2348
+ expression: searchParam.value,
2349
+ dataSources,
2350
+ usedDataSources,
2351
+ scope
2352
+ });
2353
+ generatedRequest += ` { name: "${searchParam.name}", value: ${value} },
2354
+ `;
2355
+ }
2356
+ generatedRequest += ` ],
2324
2357
  `;
2325
2358
  generatedRequest += ` method: "${resource.method}",
2326
2359
  `;
package/lib/runtime.js CHANGED
@@ -1,3 +1,33 @@
1
+ // src/resource-loader.ts
2
+ import hash from "@emotion/hash";
3
+
4
+ // src/to-string.ts
5
+ var createJsonStringifyProxy = (target) => {
6
+ return new Proxy(target, {
7
+ get(target2, prop, receiver) {
8
+ if (prop === "toString") {
9
+ return function() {
10
+ return JSON.stringify(target2);
11
+ };
12
+ }
13
+ const value = Reflect.get(target2, prop, receiver);
14
+ if (typeof value === "object" && value !== null) {
15
+ return createJsonStringifyProxy(value);
16
+ }
17
+ return value;
18
+ }
19
+ });
20
+ };
21
+ var isPlainObject = (value) => {
22
+ return Object.prototype.toString.call(value) === "[object Object]" && (Object.getPrototypeOf(value) === null || Object.getPrototypeOf(value) === Object.prototype);
23
+ };
24
+ var serializeValue = (value) => {
25
+ if (typeof value === "string") {
26
+ return value;
27
+ }
28
+ return JSON.stringify(value);
29
+ };
30
+
1
31
  // src/resource-loader.ts
2
32
  var LOCAL_RESOURCE_PREFIX = "$resources";
3
33
  var isLocalResource = (pathname, resourceName) => {
@@ -9,24 +39,28 @@ var isLocalResource = (pathname, resourceName) => {
9
39
  };
10
40
  var sitemapResourceUrl = `/${LOCAL_RESOURCE_PREFIX}/sitemap.xml`;
11
41
  var loadResource = async (customFetch, resourceRequest) => {
12
- const { url, method, headers, body } = resourceRequest;
13
- const requestHeaders = new Headers(
14
- headers.map(({ name, value }) => [name, value])
15
- );
16
- const requestInit = {
17
- method,
18
- headers: requestHeaders
19
- };
20
- if (method !== "get" && body !== void 0) {
21
- if (typeof body === "string") {
22
- requestInit.body = body;
42
+ try {
43
+ const { method, searchParams, headers, body } = resourceRequest;
44
+ const url = new URL(resourceRequest.url.trim());
45
+ if (searchParams) {
46
+ for (const { name, value } of searchParams) {
47
+ url.searchParams.append(name, serializeValue(value));
48
+ }
23
49
  }
24
- if (typeof body === "object") {
25
- requestInit.body = JSON.stringify(body);
50
+ const requestHeaders = new Headers(
51
+ headers.map(({ name, value }) => [
52
+ name,
53
+ serializeValue(value)
54
+ ])
55
+ );
56
+ const requestInit = {
57
+ method,
58
+ headers: requestHeaders
59
+ };
60
+ if (method !== "get" && body !== void 0) {
61
+ requestInit.body = serializeValue(body);
26
62
  }
27
- }
28
- try {
29
- const response = await customFetch(url.trim(), requestInit);
63
+ const response = await customFetch(url.href, requestInit);
30
64
  let data = await response.text();
31
65
  try {
32
66
  data = JSON.parse(data);
@@ -39,9 +73,9 @@ var loadResource = async (customFetch, resourceRequest) => {
39
73
  }
40
74
  return {
41
75
  ok: response.ok,
42
- data,
43
76
  status: response.status,
44
- statusText: response.statusText
77
+ statusText: response.statusText,
78
+ data
45
79
  };
46
80
  } catch (error) {
47
81
  console.error(error);
@@ -64,26 +98,38 @@ var loadResources = async (customFetch, requests) => {
64
98
  )
65
99
  );
66
100
  };
67
-
68
- // src/to-string.ts
69
- var createJsonStringifyProxy = (target) => {
70
- return new Proxy(target, {
71
- get(target2, prop, receiver) {
72
- if (prop === "toString") {
73
- return function() {
74
- return JSON.stringify(target2);
75
- };
76
- }
77
- const value = Reflect.get(target2, prop, receiver);
78
- if (typeof value === "object" && value !== null) {
79
- return createJsonStringifyProxy(value);
80
- }
81
- return value;
82
- }
83
- });
101
+ var getCacheKey = async (request) => {
102
+ const url = new URL(request.url);
103
+ const method = request.method;
104
+ const body = await request.clone().text();
105
+ const cacheControl = request.headers.get("Cache-Control");
106
+ const resourceHash = hash(`${method}:${body}:${cacheControl}`);
107
+ url.searchParams.set("ws-resource-hash", resourceHash);
108
+ return url;
84
109
  };
85
- var isPlainObject = (value) => {
86
- return Object.prototype.toString.call(value) === "[object Object]" && (Object.getPrototypeOf(value) === null || Object.getPrototypeOf(value) === Object.prototype);
110
+ var cachedFetch = async (namespace, input, init) => {
111
+ if (globalThis.caches) {
112
+ const request = new Request(input, init);
113
+ const requestCacheControl = request.headers.get("Cache-Control");
114
+ if (!requestCacheControl) {
115
+ return fetch(input, init);
116
+ }
117
+ const cache = await caches.open(namespace);
118
+ const cacheKey = await getCacheKey(request);
119
+ let response = await cache.match(cacheKey);
120
+ if (response) {
121
+ return new Response(response.body, response);
122
+ }
123
+ response = await fetch(request);
124
+ if (!response.ok) {
125
+ return response;
126
+ }
127
+ response = new Response(response.body, response);
128
+ response.headers.set("Cache-Control", requestCacheControl);
129
+ await cache.put(cacheKey, response.clone());
130
+ return response;
131
+ }
132
+ return fetch(input, init);
87
133
  };
88
134
 
89
135
  // src/form-fields.ts
@@ -102,6 +148,7 @@ var getIndexWithinAncestorFromProps = (props) => {
102
148
  var animationCanPlayOnCanvasProperty = "data-ws-animation-can-play-on-canvas";
103
149
  export {
104
150
  animationCanPlayOnCanvasProperty,
151
+ cachedFetch,
105
152
  createJsonStringifyProxy,
106
153
  formBotFieldName,
107
154
  formIdFieldName,
@@ -112,6 +159,7 @@ export {
112
159
  isPlainObject,
113
160
  loadResource,
114
161
  loadResources,
162
+ serializeValue,
115
163
  sitemapResourceUrl,
116
164
  tagProperty
117
165
  };
@@ -6,9 +6,9 @@ export declare const isLocalResource: (pathname: string, resourceName?: string)
6
6
  export declare const sitemapResourceUrl = "/$resources/sitemap.xml";
7
7
  export declare const loadResource: (customFetch: typeof fetch, resourceRequest: ResourceRequest) => Promise<{
8
8
  ok: boolean;
9
- data: string;
10
9
  status: number;
11
10
  statusText: string;
11
+ data: string;
12
12
  } | {
13
13
  ok: boolean;
14
14
  data: undefined;
@@ -18,9 +18,9 @@ export declare const loadResource: (customFetch: typeof fetch, resourceRequest:
18
18
  export declare const loadResources: (customFetch: typeof fetch, requests: Map<string, ResourceRequest>) => Promise<{
19
19
  [k: string]: {
20
20
  ok: boolean;
21
- data: string;
22
21
  status: number;
23
22
  statusText: string;
23
+ data: string;
24
24
  } | {
25
25
  ok: boolean;
26
26
  data: undefined;
@@ -28,3 +28,4 @@ export declare const loadResources: (customFetch: typeof fetch, requests: Map<st
28
28
  statusText: string;
29
29
  };
30
30
  }>;
31
+ export declare const cachedFetch: (namespace: string, input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
@@ -53,7 +53,8 @@ export declare const FontAsset: z.ZodObject<{
53
53
  projectId: z.ZodString;
54
54
  size: z.ZodNumber;
55
55
  name: z.ZodString;
56
- description: z.ZodUnion<[z.ZodString, z.ZodNull]>;
56
+ filename: z.ZodOptional<z.ZodString>;
57
+ description: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodNull]>;
57
58
  createdAt: z.ZodString;
58
59
  }, "strip", z.ZodTypeAny, {
59
60
  type: "font";
@@ -71,12 +72,13 @@ export declare const FontAsset: z.ZodObject<{
71
72
  max: number;
72
73
  }>>;
73
74
  };
74
- description: string | null;
75
75
  id: string;
76
76
  format: "ttf" | "woff" | "woff2";
77
77
  projectId: string;
78
78
  size: number;
79
79
  createdAt: string;
80
+ description?: string | null | undefined;
81
+ filename?: string | undefined;
80
82
  }, {
81
83
  type: "font";
82
84
  name: string;
@@ -93,12 +95,13 @@ export declare const FontAsset: z.ZodObject<{
93
95
  max: number;
94
96
  }>>;
95
97
  };
96
- description: string | null;
97
98
  id: string;
98
99
  format: "ttf" | "woff" | "woff2";
99
100
  projectId: string;
100
101
  size: number;
101
102
  createdAt: string;
103
+ description?: string | null | undefined;
104
+ filename?: string | undefined;
102
105
  }>;
103
106
  export type FontAsset = z.infer<typeof FontAsset>;
104
107
  export declare const ImageMeta: z.ZodObject<{
@@ -129,7 +132,8 @@ export declare const ImageAsset: z.ZodObject<{
129
132
  projectId: z.ZodString;
130
133
  size: z.ZodNumber;
131
134
  name: z.ZodString;
132
- description: z.ZodUnion<[z.ZodString, z.ZodNull]>;
135
+ filename: z.ZodOptional<z.ZodString>;
136
+ description: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodNull]>;
133
137
  createdAt: z.ZodString;
134
138
  }, "strip", z.ZodTypeAny, {
135
139
  type: "image";
@@ -138,12 +142,13 @@ export declare const ImageAsset: z.ZodObject<{
138
142
  height: number;
139
143
  width: number;
140
144
  };
141
- description: string | null;
142
145
  id: string;
143
146
  format: string;
144
147
  projectId: string;
145
148
  size: number;
146
149
  createdAt: string;
150
+ description?: string | null | undefined;
151
+ filename?: string | undefined;
147
152
  }, {
148
153
  type: "image";
149
154
  name: string;
@@ -151,12 +156,13 @@ export declare const ImageAsset: z.ZodObject<{
151
156
  height: number;
152
157
  width: number;
153
158
  };
154
- description: string | null;
155
159
  id: string;
156
160
  format: string;
157
161
  projectId: string;
158
162
  size: number;
159
163
  createdAt: string;
164
+ description?: string | null | undefined;
165
+ filename?: string | undefined;
160
166
  }>;
161
167
  export type ImageAsset = z.infer<typeof ImageAsset>;
162
168
  export declare const Asset: z.ZodUnion<[z.ZodObject<{
@@ -213,7 +219,8 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
213
219
  projectId: z.ZodString;
214
220
  size: z.ZodNumber;
215
221
  name: z.ZodString;
216
- description: z.ZodUnion<[z.ZodString, z.ZodNull]>;
222
+ filename: z.ZodOptional<z.ZodString>;
223
+ description: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodNull]>;
217
224
  createdAt: z.ZodString;
218
225
  }, "strip", z.ZodTypeAny, {
219
226
  type: "font";
@@ -231,12 +238,13 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
231
238
  max: number;
232
239
  }>>;
233
240
  };
234
- description: string | null;
235
241
  id: string;
236
242
  format: "ttf" | "woff" | "woff2";
237
243
  projectId: string;
238
244
  size: number;
239
245
  createdAt: string;
246
+ description?: string | null | undefined;
247
+ filename?: string | undefined;
240
248
  }, {
241
249
  type: "font";
242
250
  name: string;
@@ -253,12 +261,13 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
253
261
  max: number;
254
262
  }>>;
255
263
  };
256
- description: string | null;
257
264
  id: string;
258
265
  format: "ttf" | "woff" | "woff2";
259
266
  projectId: string;
260
267
  size: number;
261
268
  createdAt: string;
269
+ description?: string | null | undefined;
270
+ filename?: string | undefined;
262
271
  }>, z.ZodObject<{
263
272
  format: z.ZodString;
264
273
  meta: z.ZodObject<{
@@ -276,7 +285,8 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
276
285
  projectId: z.ZodString;
277
286
  size: z.ZodNumber;
278
287
  name: z.ZodString;
279
- description: z.ZodUnion<[z.ZodString, z.ZodNull]>;
288
+ filename: z.ZodOptional<z.ZodString>;
289
+ description: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodNull]>;
280
290
  createdAt: z.ZodString;
281
291
  }, "strip", z.ZodTypeAny, {
282
292
  type: "image";
@@ -285,12 +295,13 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
285
295
  height: number;
286
296
  width: number;
287
297
  };
288
- description: string | null;
289
298
  id: string;
290
299
  format: string;
291
300
  projectId: string;
292
301
  size: number;
293
302
  createdAt: string;
303
+ description?: string | null | undefined;
304
+ filename?: string | undefined;
294
305
  }, {
295
306
  type: "image";
296
307
  name: string;
@@ -298,12 +309,13 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
298
309
  height: number;
299
310
  width: number;
300
311
  };
301
- description: string | null;
302
312
  id: string;
303
313
  format: string;
304
314
  projectId: string;
305
315
  size: number;
306
316
  createdAt: string;
317
+ description?: string | null | undefined;
318
+ filename?: string | undefined;
307
319
  }>]>;
308
320
  export type Asset = z.infer<typeof Asset>;
309
321
  export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
@@ -360,7 +372,8 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
360
372
  projectId: z.ZodString;
361
373
  size: z.ZodNumber;
362
374
  name: z.ZodString;
363
- description: z.ZodUnion<[z.ZodString, z.ZodNull]>;
375
+ filename: z.ZodOptional<z.ZodString>;
376
+ description: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodNull]>;
364
377
  createdAt: z.ZodString;
365
378
  }, "strip", z.ZodTypeAny, {
366
379
  type: "font";
@@ -378,12 +391,13 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
378
391
  max: number;
379
392
  }>>;
380
393
  };
381
- description: string | null;
382
394
  id: string;
383
395
  format: "ttf" | "woff" | "woff2";
384
396
  projectId: string;
385
397
  size: number;
386
398
  createdAt: string;
399
+ description?: string | null | undefined;
400
+ filename?: string | undefined;
387
401
  }, {
388
402
  type: "font";
389
403
  name: string;
@@ -400,12 +414,13 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
400
414
  max: number;
401
415
  }>>;
402
416
  };
403
- description: string | null;
404
417
  id: string;
405
418
  format: "ttf" | "woff" | "woff2";
406
419
  projectId: string;
407
420
  size: number;
408
421
  createdAt: string;
422
+ description?: string | null | undefined;
423
+ filename?: string | undefined;
409
424
  }>, z.ZodObject<{
410
425
  format: z.ZodString;
411
426
  meta: z.ZodObject<{
@@ -423,7 +438,8 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
423
438
  projectId: z.ZodString;
424
439
  size: z.ZodNumber;
425
440
  name: z.ZodString;
426
- description: z.ZodUnion<[z.ZodString, z.ZodNull]>;
441
+ filename: z.ZodOptional<z.ZodString>;
442
+ description: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodNull]>;
427
443
  createdAt: z.ZodString;
428
444
  }, "strip", z.ZodTypeAny, {
429
445
  type: "image";
@@ -432,12 +448,13 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
432
448
  height: number;
433
449
  width: number;
434
450
  };
435
- description: string | null;
436
451
  id: string;
437
452
  format: string;
438
453
  projectId: string;
439
454
  size: number;
440
455
  createdAt: string;
456
+ description?: string | null | undefined;
457
+ filename?: string | undefined;
441
458
  }, {
442
459
  type: "image";
443
460
  name: string;
@@ -445,11 +462,12 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
445
462
  height: number;
446
463
  width: number;
447
464
  };
448
- description: string | null;
449
465
  id: string;
450
466
  format: string;
451
467
  projectId: string;
452
468
  size: number;
453
469
  createdAt: string;
470
+ description?: string | null | undefined;
471
+ filename?: string | undefined;
454
472
  }>]>>;
455
473
  export type Assets = z.infer<typeof Assets>;
@@ -5,6 +5,16 @@ export declare const Resource: z.ZodObject<{
5
5
  control: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"system">, z.ZodLiteral<"graphql">]>>;
6
6
  method: z.ZodUnion<[z.ZodLiteral<"get">, z.ZodLiteral<"post">, z.ZodLiteral<"put">, z.ZodLiteral<"delete">]>;
7
7
  url: z.ZodString;
8
+ searchParams: z.ZodOptional<z.ZodArray<z.ZodObject<{
9
+ name: z.ZodString;
10
+ value: z.ZodString;
11
+ }, "strip", z.ZodTypeAny, {
12
+ value: string;
13
+ name: string;
14
+ }, {
15
+ value: string;
16
+ name: string;
17
+ }>, "many">>;
8
18
  headers: z.ZodArray<z.ZodObject<{
9
19
  name: z.ZodString;
10
20
  value: z.ZodString;
@@ -27,6 +37,10 @@ export declare const Resource: z.ZodObject<{
27
37
  }[];
28
38
  body?: string | undefined;
29
39
  control?: "system" | "graphql" | undefined;
40
+ searchParams?: {
41
+ value: string;
42
+ name: string;
43
+ }[] | undefined;
30
44
  }, {
31
45
  name: string;
32
46
  url: string;
@@ -38,42 +52,61 @@ export declare const Resource: z.ZodObject<{
38
52
  }[];
39
53
  body?: string | undefined;
40
54
  control?: "system" | "graphql" | undefined;
55
+ searchParams?: {
56
+ value: string;
57
+ name: string;
58
+ }[] | undefined;
41
59
  }>;
42
60
  export type Resource = z.infer<typeof Resource>;
43
61
  export declare const ResourceRequest: z.ZodObject<{
44
- id: z.ZodString;
45
62
  name: z.ZodString;
46
63
  method: z.ZodUnion<[z.ZodLiteral<"get">, z.ZodLiteral<"post">, z.ZodLiteral<"put">, z.ZodLiteral<"delete">]>;
47
64
  url: z.ZodString;
65
+ searchParams: z.ZodArray<z.ZodObject<{
66
+ name: z.ZodString;
67
+ value: z.ZodUnknown;
68
+ }, "strip", z.ZodTypeAny, {
69
+ name: string;
70
+ value?: unknown;
71
+ }, {
72
+ name: string;
73
+ value?: unknown;
74
+ }>, "many">;
48
75
  headers: z.ZodArray<z.ZodObject<{
49
76
  name: z.ZodString;
50
- value: z.ZodString;
77
+ value: z.ZodUnknown;
51
78
  }, "strip", z.ZodTypeAny, {
52
- value: string;
53
79
  name: string;
80
+ value?: unknown;
54
81
  }, {
55
- value: string;
56
82
  name: string;
83
+ value?: unknown;
57
84
  }>, "many">;
58
85
  body: z.ZodOptional<z.ZodUnknown>;
59
86
  }, "strip", z.ZodTypeAny, {
60
87
  name: string;
61
88
  url: string;
62
- id: string;
63
89
  method: "get" | "post" | "put" | "delete";
90
+ searchParams: {
91
+ name: string;
92
+ value?: unknown;
93
+ }[];
64
94
  headers: {
65
- value: string;
66
95
  name: string;
96
+ value?: unknown;
67
97
  }[];
68
98
  body?: unknown;
69
99
  }, {
70
100
  name: string;
71
101
  url: string;
72
- id: string;
73
102
  method: "get" | "post" | "put" | "delete";
103
+ searchParams: {
104
+ name: string;
105
+ value?: unknown;
106
+ }[];
74
107
  headers: {
75
- value: string;
76
108
  name: string;
109
+ value?: unknown;
77
110
  }[];
78
111
  body?: unknown;
79
112
  }>;
@@ -84,6 +117,16 @@ export declare const Resources: z.ZodMap<z.ZodString, z.ZodObject<{
84
117
  control: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"system">, z.ZodLiteral<"graphql">]>>;
85
118
  method: z.ZodUnion<[z.ZodLiteral<"get">, z.ZodLiteral<"post">, z.ZodLiteral<"put">, z.ZodLiteral<"delete">]>;
86
119
  url: z.ZodString;
120
+ searchParams: z.ZodOptional<z.ZodArray<z.ZodObject<{
121
+ name: z.ZodString;
122
+ value: z.ZodString;
123
+ }, "strip", z.ZodTypeAny, {
124
+ value: string;
125
+ name: string;
126
+ }, {
127
+ value: string;
128
+ name: string;
129
+ }>, "many">>;
87
130
  headers: z.ZodArray<z.ZodObject<{
88
131
  name: z.ZodString;
89
132
  value: z.ZodString;
@@ -106,6 +149,10 @@ export declare const Resources: z.ZodMap<z.ZodString, z.ZodObject<{
106
149
  }[];
107
150
  body?: string | undefined;
108
151
  control?: "system" | "graphql" | undefined;
152
+ searchParams?: {
153
+ value: string;
154
+ name: string;
155
+ }[] | undefined;
109
156
  }, {
110
157
  name: string;
111
158
  url: string;
@@ -117,5 +164,9 @@ export declare const Resources: z.ZodMap<z.ZodString, z.ZodObject<{
117
164
  }[];
118
165
  body?: string | undefined;
119
166
  control?: "system" | "graphql" | undefined;
167
+ searchParams?: {
168
+ value: string;
169
+ name: string;
170
+ }[] | undefined;
120
171
  }>>;
121
172
  export type Resources = z.infer<typeof Resources>;
@@ -171,7 +171,8 @@ export declare const WebstudioFragment: z.ZodObject<{
171
171
  projectId: z.ZodString;
172
172
  size: z.ZodNumber;
173
173
  name: z.ZodString;
174
- description: z.ZodUnion<[z.ZodString, z.ZodNull]>;
174
+ filename: z.ZodOptional<z.ZodString>;
175
+ description: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodNull]>;
175
176
  createdAt: z.ZodString;
176
177
  }, "strip", z.ZodTypeAny, {
177
178
  type: "font";
@@ -189,12 +190,13 @@ export declare const WebstudioFragment: z.ZodObject<{
189
190
  max: number;
190
191
  }>>;
191
192
  };
192
- description: string | null;
193
193
  id: string;
194
194
  format: "ttf" | "woff" | "woff2";
195
195
  projectId: string;
196
196
  size: number;
197
197
  createdAt: string;
198
+ description?: string | null | undefined;
199
+ filename?: string | undefined;
198
200
  }, {
199
201
  type: "font";
200
202
  name: string;
@@ -211,12 +213,13 @@ export declare const WebstudioFragment: z.ZodObject<{
211
213
  max: number;
212
214
  }>>;
213
215
  };
214
- description: string | null;
215
216
  id: string;
216
217
  format: "ttf" | "woff" | "woff2";
217
218
  projectId: string;
218
219
  size: number;
219
220
  createdAt: string;
221
+ description?: string | null | undefined;
222
+ filename?: string | undefined;
220
223
  }>, z.ZodObject<{
221
224
  format: z.ZodString;
222
225
  meta: z.ZodObject<{
@@ -234,7 +237,8 @@ export declare const WebstudioFragment: z.ZodObject<{
234
237
  projectId: z.ZodString;
235
238
  size: z.ZodNumber;
236
239
  name: z.ZodString;
237
- description: z.ZodUnion<[z.ZodString, z.ZodNull]>;
240
+ filename: z.ZodOptional<z.ZodString>;
241
+ description: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodNull]>;
238
242
  createdAt: z.ZodString;
239
243
  }, "strip", z.ZodTypeAny, {
240
244
  type: "image";
@@ -243,12 +247,13 @@ export declare const WebstudioFragment: z.ZodObject<{
243
247
  height: number;
244
248
  width: number;
245
249
  };
246
- description: string | null;
247
250
  id: string;
248
251
  format: string;
249
252
  projectId: string;
250
253
  size: number;
251
254
  createdAt: string;
255
+ description?: string | null | undefined;
256
+ filename?: string | undefined;
252
257
  }, {
253
258
  type: "image";
254
259
  name: string;
@@ -256,12 +261,13 @@ export declare const WebstudioFragment: z.ZodObject<{
256
261
  height: number;
257
262
  width: number;
258
263
  };
259
- description: string | null;
260
264
  id: string;
261
265
  format: string;
262
266
  projectId: string;
263
267
  size: number;
264
268
  createdAt: string;
269
+ description?: string | null | undefined;
270
+ filename?: string | undefined;
265
271
  }>]>, "many">;
266
272
  dataSources: z.ZodArray<z.ZodUnion<[z.ZodObject<{
267
273
  type: z.ZodLiteral<"variable">;
@@ -396,6 +402,16 @@ export declare const WebstudioFragment: z.ZodObject<{
396
402
  control: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"system">, z.ZodLiteral<"graphql">]>>;
397
403
  method: z.ZodUnion<[z.ZodLiteral<"get">, z.ZodLiteral<"post">, z.ZodLiteral<"put">, z.ZodLiteral<"delete">]>;
398
404
  url: z.ZodString;
405
+ searchParams: z.ZodOptional<z.ZodArray<z.ZodObject<{
406
+ name: z.ZodString;
407
+ value: z.ZodString;
408
+ }, "strip", z.ZodTypeAny, {
409
+ value: string;
410
+ name: string;
411
+ }, {
412
+ value: string;
413
+ name: string;
414
+ }>, "many">>;
399
415
  headers: z.ZodArray<z.ZodObject<{
400
416
  name: z.ZodString;
401
417
  value: z.ZodString;
@@ -418,6 +434,10 @@ export declare const WebstudioFragment: z.ZodObject<{
418
434
  }[];
419
435
  body?: string | undefined;
420
436
  control?: "system" | "graphql" | undefined;
437
+ searchParams?: {
438
+ value: string;
439
+ name: string;
440
+ }[] | undefined;
421
441
  }, {
422
442
  name: string;
423
443
  url: string;
@@ -429,6 +449,10 @@ export declare const WebstudioFragment: z.ZodObject<{
429
449
  }[];
430
450
  body?: string | undefined;
431
451
  control?: "system" | "graphql" | undefined;
452
+ searchParams?: {
453
+ value: string;
454
+ name: string;
455
+ }[] | undefined;
432
456
  }>, "many">;
433
457
  props: z.ZodArray<z.ZodUnion<[z.ZodObject<{
434
458
  type: z.ZodLiteral<"number">;
@@ -22472,12 +22496,13 @@ export declare const WebstudioFragment: z.ZodObject<{
22472
22496
  max: number;
22473
22497
  }>>;
22474
22498
  };
22475
- description: string | null;
22476
22499
  id: string;
22477
22500
  format: "ttf" | "woff" | "woff2";
22478
22501
  projectId: string;
22479
22502
  size: number;
22480
22503
  createdAt: string;
22504
+ description?: string | null | undefined;
22505
+ filename?: string | undefined;
22481
22506
  } | {
22482
22507
  type: "image";
22483
22508
  name: string;
@@ -22485,12 +22510,13 @@ export declare const WebstudioFragment: z.ZodObject<{
22485
22510
  height: number;
22486
22511
  width: number;
22487
22512
  };
22488
- description: string | null;
22489
22513
  id: string;
22490
22514
  format: string;
22491
22515
  projectId: string;
22492
22516
  size: number;
22493
22517
  createdAt: string;
22518
+ description?: string | null | undefined;
22519
+ filename?: string | undefined;
22494
22520
  })[];
22495
22521
  dataSources: ({
22496
22522
  value: {
@@ -22536,6 +22562,10 @@ export declare const WebstudioFragment: z.ZodObject<{
22536
22562
  }[];
22537
22563
  body?: string | undefined;
22538
22564
  control?: "system" | "graphql" | undefined;
22565
+ searchParams?: {
22566
+ value: string;
22567
+ name: string;
22568
+ }[] | undefined;
22539
22569
  }[];
22540
22570
  breakpoints: {
22541
22571
  label: string;
@@ -24630,12 +24660,13 @@ export declare const WebstudioFragment: z.ZodObject<{
24630
24660
  max: number;
24631
24661
  }>>;
24632
24662
  };
24633
- description: string | null;
24634
24663
  id: string;
24635
24664
  format: "ttf" | "woff" | "woff2";
24636
24665
  projectId: string;
24637
24666
  size: number;
24638
24667
  createdAt: string;
24668
+ description?: string | null | undefined;
24669
+ filename?: string | undefined;
24639
24670
  } | {
24640
24671
  type: "image";
24641
24672
  name: string;
@@ -24643,12 +24674,13 @@ export declare const WebstudioFragment: z.ZodObject<{
24643
24674
  height: number;
24644
24675
  width: number;
24645
24676
  };
24646
- description: string | null;
24647
24677
  id: string;
24648
24678
  format: string;
24649
24679
  projectId: string;
24650
24680
  size: number;
24651
24681
  createdAt: string;
24682
+ description?: string | null | undefined;
24683
+ filename?: string | undefined;
24652
24684
  })[];
24653
24685
  dataSources: ({
24654
24686
  value: {
@@ -24694,6 +24726,10 @@ export declare const WebstudioFragment: z.ZodObject<{
24694
24726
  }[];
24695
24727
  body?: string | undefined;
24696
24728
  control?: "system" | "graphql" | undefined;
24729
+ searchParams?: {
24730
+ value: string;
24731
+ name: string;
24732
+ }[] | undefined;
24697
24733
  }[];
24698
24734
  breakpoints: {
24699
24735
  label: string;
@@ -1,2 +1,3 @@
1
1
  export declare const createJsonStringifyProxy: <T extends object>(target: T) => T;
2
2
  export declare const isPlainObject: (value: unknown) => value is object;
3
+ export declare const serializeValue: (value: unknown) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk",
3
- "version": "0.227.0",
3
+ "version": "0.229.0",
4
4
  "description": "Webstudio project data schema",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -34,21 +34,22 @@
34
34
  ],
35
35
  "sideEffects": false,
36
36
  "dependencies": {
37
+ "@emotion/hash": "^0.9.2",
37
38
  "acorn": "^8.14.1",
38
39
  "acorn-walk": "^8.3.4",
39
40
  "change-case": "^5.4.4",
40
41
  "reserved-identifiers": "^1.0.0",
41
42
  "type-fest": "^4.37.0",
42
43
  "zod": "^3.24.2",
43
- "@webstudio-is/css-engine": "0.227.0",
44
- "@webstudio-is/fonts": "0.227.0",
45
- "@webstudio-is/icons": "0.227.0"
44
+ "@webstudio-is/css-engine": "0.229.0",
45
+ "@webstudio-is/fonts": "0.229.0",
46
+ "@webstudio-is/icons": "0.229.0"
46
47
  },
47
48
  "devDependencies": {
48
49
  "html-tags": "^4.0.0",
49
50
  "vitest": "^3.1.2",
51
+ "@webstudio-is/template": "0.229.0",
50
52
  "@webstudio-is/css-data": "0.0.0",
51
- "@webstudio-is/template": "0.227.0",
52
53
  "@webstudio-is/tsconfig": "1.0.7"
53
54
  },
54
55
  "scripts": {