@webstudio-is/sdk 0.141.0 → 0.143.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.
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Generates data based utilities at build time
3
+ */
4
+ export declare const generateFormsProperties: (props: Map<string, {
5
+ value: number;
6
+ type: "number";
7
+ id: string;
8
+ name: string;
9
+ instanceId: string;
10
+ required?: boolean | undefined;
11
+ } | {
12
+ value: string;
13
+ type: "string";
14
+ id: string;
15
+ name: string;
16
+ instanceId: string;
17
+ required?: boolean | undefined;
18
+ } | {
19
+ value: boolean;
20
+ type: "boolean";
21
+ id: string;
22
+ name: string;
23
+ instanceId: string;
24
+ required?: boolean | undefined;
25
+ } | {
26
+ type: "json";
27
+ id: string;
28
+ name: string;
29
+ instanceId: string;
30
+ value?: unknown;
31
+ required?: boolean | undefined;
32
+ } | {
33
+ value: string;
34
+ type: "asset";
35
+ id: string;
36
+ name: string;
37
+ instanceId: string;
38
+ required?: boolean | undefined;
39
+ } | {
40
+ value: (string | {
41
+ instanceId: string;
42
+ pageId: string;
43
+ }) & (string | {
44
+ instanceId: string;
45
+ pageId: string;
46
+ } | undefined);
47
+ type: "page";
48
+ id: string;
49
+ name: string;
50
+ instanceId: string;
51
+ required?: boolean | undefined;
52
+ } | {
53
+ value: string[];
54
+ type: "string[]";
55
+ id: string;
56
+ name: string;
57
+ instanceId: string;
58
+ required?: boolean | undefined;
59
+ } | {
60
+ value: string;
61
+ type: "parameter";
62
+ id: string;
63
+ name: string;
64
+ instanceId: string;
65
+ required?: boolean | undefined;
66
+ } | {
67
+ value: string;
68
+ type: "expression";
69
+ id: string;
70
+ name: string;
71
+ instanceId: string;
72
+ required?: boolean | undefined;
73
+ } | {
74
+ value: {
75
+ code: string;
76
+ type: "execute";
77
+ args: string[];
78
+ }[];
79
+ type: "action";
80
+ id: string;
81
+ name: string;
82
+ instanceId: string;
83
+ required?: boolean | undefined;
84
+ }>) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -14,3 +14,7 @@ export * from "./instances-utils";
14
14
  export * from "./page-utils";
15
15
  export * from "./scope";
16
16
  export * from "./resource-loader";
17
+ export * from "./expression";
18
+ export * from "./forms-generator";
19
+ export * from "./resources-generator";
20
+ export * from "./page-meta-generator";
@@ -0,0 +1,55 @@
1
+ import type { Asset } from "./schema/assets";
2
+ import type { DataSources } from "./schema/data-sources";
3
+ import type { Page } from "./schema/pages";
4
+ import { type Scope } from "./scope";
5
+ export type PageMeta = {
6
+ title: string;
7
+ description?: string;
8
+ excludePageFromSearch?: boolean;
9
+ language?: string;
10
+ socialImageAssetId?: Asset["id"];
11
+ socialImageUrl?: string;
12
+ status?: number;
13
+ redirect?: string;
14
+ custom: Array<{
15
+ property: string;
16
+ content: string;
17
+ }>;
18
+ };
19
+ export declare const generatePageMeta: ({ globalScope, page, dataSources, }: {
20
+ globalScope: Scope;
21
+ page: Page;
22
+ dataSources: Map<string, {
23
+ value: {
24
+ value: number;
25
+ type: "number";
26
+ } | {
27
+ value: string;
28
+ type: "string";
29
+ } | {
30
+ value: boolean;
31
+ type: "boolean";
32
+ } | {
33
+ value: string[];
34
+ type: "string[]";
35
+ } | {
36
+ type: "json";
37
+ value?: unknown;
38
+ };
39
+ type: "variable";
40
+ id: string;
41
+ name: string;
42
+ scopeInstanceId?: string | undefined;
43
+ } | {
44
+ type: "parameter";
45
+ id: string;
46
+ name: string;
47
+ scopeInstanceId?: string | undefined;
48
+ } | {
49
+ type: "resource";
50
+ id: string;
51
+ name: string;
52
+ resourceId: string;
53
+ scopeInstanceId?: string | undefined;
54
+ }>;
55
+ }) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ import type { DataSources } from "./schema/data-sources";
2
+ import type { Page } from "./schema/pages";
3
+ import type { Resources } from "./schema/resources";
4
+ import type { Scope } from "./scope";
5
+ export declare const generateResourcesLoader: ({ scope, page, dataSources, resources, }: {
6
+ scope: Scope;
7
+ page: Page;
8
+ dataSources: Map<string, {
9
+ value: {
10
+ value: number;
11
+ type: "number";
12
+ } | {
13
+ value: string;
14
+ type: "string";
15
+ } | {
16
+ value: boolean;
17
+ type: "boolean";
18
+ } | {
19
+ value: string[];
20
+ type: "string[]";
21
+ } | {
22
+ type: "json";
23
+ value?: unknown;
24
+ };
25
+ type: "variable";
26
+ id: string;
27
+ name: string;
28
+ scopeInstanceId?: string | undefined;
29
+ } | {
30
+ type: "parameter";
31
+ id: string;
32
+ name: string;
33
+ scopeInstanceId?: string | undefined;
34
+ } | {
35
+ type: "resource";
36
+ id: string;
37
+ name: string;
38
+ resourceId: string;
39
+ scopeInstanceId?: string | undefined;
40
+ }>;
41
+ resources: Map<string, {
42
+ id: string;
43
+ name: string;
44
+ method: "post" | "get" | "put" | "delete";
45
+ url: string;
46
+ headers: {
47
+ value: string;
48
+ name: string;
49
+ }[];
50
+ body?: string | undefined;
51
+ }>;
52
+ }) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -57,6 +57,7 @@ export declare const FontAsset: z.ZodObject<{
57
57
  createdAt: z.ZodString;
58
58
  }, "strip", z.ZodTypeAny, {
59
59
  type: "font";
60
+ id: string;
60
61
  name: string;
61
62
  format: "ttf" | "woff" | "woff2" | "otf";
62
63
  meta: ({
@@ -84,13 +85,13 @@ export declare const FontAsset: z.ZodObject<{
84
85
  max: number;
85
86
  }>>;
86
87
  } | undefined);
87
- id: string;
88
88
  projectId: string;
89
89
  size: number;
90
90
  description: string | null;
91
91
  createdAt: string;
92
92
  }, {
93
93
  type: "font";
94
+ id: string;
94
95
  name: string;
95
96
  format: "ttf" | "woff" | "woff2" | "otf";
96
97
  meta: ({
@@ -118,7 +119,6 @@ export declare const FontAsset: z.ZodObject<{
118
119
  max: number;
119
120
  }>>;
120
121
  } | undefined);
121
- id: string;
122
122
  projectId: string;
123
123
  size: number;
124
124
  description: string | null;
@@ -157,26 +157,26 @@ export declare const ImageAsset: z.ZodObject<{
157
157
  createdAt: z.ZodString;
158
158
  }, "strip", z.ZodTypeAny, {
159
159
  type: "image";
160
+ id: string;
160
161
  name: string;
161
162
  format: string;
162
163
  meta: {
163
164
  width: number;
164
165
  height: number;
165
166
  };
166
- id: string;
167
167
  projectId: string;
168
168
  size: number;
169
169
  description: string | null;
170
170
  createdAt: string;
171
171
  }, {
172
172
  type: "image";
173
+ id: string;
173
174
  name: string;
174
175
  format: string;
175
176
  meta: {
176
177
  width: number;
177
178
  height: number;
178
179
  };
179
- id: string;
180
180
  projectId: string;
181
181
  size: number;
182
182
  description: string | null;
@@ -241,6 +241,7 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
241
241
  createdAt: z.ZodString;
242
242
  }, "strip", z.ZodTypeAny, {
243
243
  type: "font";
244
+ id: string;
244
245
  name: string;
245
246
  format: "ttf" | "woff" | "woff2" | "otf";
246
247
  meta: ({
@@ -268,13 +269,13 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
268
269
  max: number;
269
270
  }>>;
270
271
  } | undefined);
271
- id: string;
272
272
  projectId: string;
273
273
  size: number;
274
274
  description: string | null;
275
275
  createdAt: string;
276
276
  }, {
277
277
  type: "font";
278
+ id: string;
278
279
  name: string;
279
280
  format: "ttf" | "woff" | "woff2" | "otf";
280
281
  meta: ({
@@ -302,7 +303,6 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
302
303
  max: number;
303
304
  }>>;
304
305
  } | undefined);
305
- id: string;
306
306
  projectId: string;
307
307
  size: number;
308
308
  description: string | null;
@@ -328,26 +328,26 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
328
328
  createdAt: z.ZodString;
329
329
  }, "strip", z.ZodTypeAny, {
330
330
  type: "image";
331
+ id: string;
331
332
  name: string;
332
333
  format: string;
333
334
  meta: {
334
335
  width: number;
335
336
  height: number;
336
337
  };
337
- id: string;
338
338
  projectId: string;
339
339
  size: number;
340
340
  description: string | null;
341
341
  createdAt: string;
342
342
  }, {
343
343
  type: "image";
344
+ id: string;
344
345
  name: string;
345
346
  format: string;
346
347
  meta: {
347
348
  width: number;
348
349
  height: number;
349
350
  };
350
- id: string;
351
351
  projectId: string;
352
352
  size: number;
353
353
  description: string | null;
@@ -412,6 +412,7 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
412
412
  createdAt: z.ZodString;
413
413
  }, "strip", z.ZodTypeAny, {
414
414
  type: "font";
415
+ id: string;
415
416
  name: string;
416
417
  format: "ttf" | "woff" | "woff2" | "otf";
417
418
  meta: ({
@@ -439,13 +440,13 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
439
440
  max: number;
440
441
  }>>;
441
442
  } | undefined);
442
- id: string;
443
443
  projectId: string;
444
444
  size: number;
445
445
  description: string | null;
446
446
  createdAt: string;
447
447
  }, {
448
448
  type: "font";
449
+ id: string;
449
450
  name: string;
450
451
  format: "ttf" | "woff" | "woff2" | "otf";
451
452
  meta: ({
@@ -473,7 +474,6 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
473
474
  max: number;
474
475
  }>>;
475
476
  } | undefined);
476
- id: string;
477
477
  projectId: string;
478
478
  size: number;
479
479
  description: string | null;
@@ -499,26 +499,26 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
499
499
  createdAt: z.ZodString;
500
500
  }, "strip", z.ZodTypeAny, {
501
501
  type: "image";
502
+ id: string;
502
503
  name: string;
503
504
  format: string;
504
505
  meta: {
505
506
  width: number;
506
507
  height: number;
507
508
  };
508
- id: string;
509
509
  projectId: string;
510
510
  size: number;
511
511
  description: string | null;
512
512
  createdAt: string;
513
513
  }, {
514
514
  type: "image";
515
+ id: string;
515
516
  name: string;
516
517
  format: string;
517
518
  meta: {
518
519
  width: number;
519
520
  height: number;
520
521
  };
521
- id: string;
522
522
  projectId: string;
523
523
  size: number;
524
524
  description: string | null;
@@ -114,8 +114,8 @@ export declare const DataSource: z.ZodUnion<[z.ZodObject<{
114
114
  value?: unknown;
115
115
  };
116
116
  type: "variable";
117
- name: string;
118
117
  id: string;
118
+ name: string;
119
119
  scopeInstanceId?: string | undefined;
120
120
  }, {
121
121
  value: {
@@ -135,8 +135,8 @@ export declare const DataSource: z.ZodUnion<[z.ZodObject<{
135
135
  value?: unknown;
136
136
  };
137
137
  type: "variable";
138
- name: string;
139
138
  id: string;
139
+ name: string;
140
140
  scopeInstanceId?: string | undefined;
141
141
  }>, z.ZodObject<{
142
142
  type: z.ZodLiteral<"parameter">;
@@ -145,13 +145,13 @@ export declare const DataSource: z.ZodUnion<[z.ZodObject<{
145
145
  name: z.ZodString;
146
146
  }, "strip", z.ZodTypeAny, {
147
147
  type: "parameter";
148
- name: string;
149
148
  id: string;
149
+ name: string;
150
150
  scopeInstanceId?: string | undefined;
151
151
  }, {
152
152
  type: "parameter";
153
- name: string;
154
153
  id: string;
154
+ name: string;
155
155
  scopeInstanceId?: string | undefined;
156
156
  }>, z.ZodObject<{
157
157
  type: z.ZodLiteral<"resource">;
@@ -161,14 +161,14 @@ export declare const DataSource: z.ZodUnion<[z.ZodObject<{
161
161
  resourceId: z.ZodString;
162
162
  }, "strip", z.ZodTypeAny, {
163
163
  type: "resource";
164
- name: string;
165
164
  id: string;
165
+ name: string;
166
166
  resourceId: string;
167
167
  scopeInstanceId?: string | undefined;
168
168
  }, {
169
169
  type: "resource";
170
- name: string;
171
170
  id: string;
171
+ name: string;
172
172
  resourceId: string;
173
173
  scopeInstanceId?: string | undefined;
174
174
  }>]>;
@@ -242,8 +242,8 @@ export declare const DataSources: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<
242
242
  value?: unknown;
243
243
  };
244
244
  type: "variable";
245
- name: string;
246
245
  id: string;
246
+ name: string;
247
247
  scopeInstanceId?: string | undefined;
248
248
  }, {
249
249
  value: {
@@ -263,8 +263,8 @@ export declare const DataSources: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<
263
263
  value?: unknown;
264
264
  };
265
265
  type: "variable";
266
- name: string;
267
266
  id: string;
267
+ name: string;
268
268
  scopeInstanceId?: string | undefined;
269
269
  }>, z.ZodObject<{
270
270
  type: z.ZodLiteral<"parameter">;
@@ -273,13 +273,13 @@ export declare const DataSources: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<
273
273
  name: z.ZodString;
274
274
  }, "strip", z.ZodTypeAny, {
275
275
  type: "parameter";
276
- name: string;
277
276
  id: string;
277
+ name: string;
278
278
  scopeInstanceId?: string | undefined;
279
279
  }, {
280
280
  type: "parameter";
281
- name: string;
282
281
  id: string;
282
+ name: string;
283
283
  scopeInstanceId?: string | undefined;
284
284
  }>, z.ZodObject<{
285
285
  type: z.ZodLiteral<"resource">;
@@ -289,14 +289,14 @@ export declare const DataSources: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<
289
289
  resourceId: z.ZodString;
290
290
  }, "strip", z.ZodTypeAny, {
291
291
  type: "resource";
292
- name: string;
293
292
  id: string;
293
+ name: string;
294
294
  resourceId: string;
295
295
  scopeInstanceId?: string | undefined;
296
296
  }, {
297
297
  type: "resource";
298
- name: string;
299
298
  id: string;
299
+ name: string;
300
300
  resourceId: string;
301
301
  scopeInstanceId?: string | undefined;
302
302
  }>]>>;