@webstudio-is/sdk 0.151.0 → 0.163.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
@@ -50,10 +50,12 @@ var PageTitle = z2.string().refine(
50
50
  (val) => val.length >= MIN_TITLE_LENGTH,
51
51
  `Minimum ${MIN_TITLE_LENGTH} characters required`
52
52
  );
53
+ var documentTypes = ["html", "xml"];
53
54
  var commonPageFields = {
54
55
  id: PageId,
55
56
  name: PageName,
56
57
  title: PageTitle,
58
+ history: z2.optional(z2.array(z2.string())),
57
59
  meta: z2.object({
58
60
  description: z2.string().optional(),
59
61
  title: z2.string().optional(),
@@ -63,6 +65,7 @@ var commonPageFields = {
63
65
  socialImageUrl: z2.string().optional(),
64
66
  status: z2.string().optional(),
65
67
  redirect: z2.string().optional(),
68
+ documentType: z2.optional(z2.enum(documentTypes)),
66
69
  custom: z2.array(
67
70
  z2.object({
68
71
  property: z2.string(),
@@ -79,8 +82,8 @@ var HomePage = z2.object({
79
82
  path: HomePagePath
80
83
  });
81
84
  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(
82
- (path) => /^[-_a-z0-9*:?\\/]*$/.test(path),
83
- "Only a-z, 0-9, -, _, /, :, ? and * are allowed"
85
+ (path) => /^[-_a-z0-9*:?\\/.]*$/.test(path),
86
+ "Only a-z, 0-9, -, _, /, :, ?, . and * are allowed"
84
87
  ).refine(
85
88
  // We use /s for our system stuff like /s/css or /s/uploads
86
89
  (path) => path !== "/s" && path.startsWith("/s/") === false,
@@ -225,6 +228,7 @@ var Header = z5.object({
225
228
  var Resource = z5.object({
226
229
  id: ResourceId,
227
230
  name: z5.string(),
231
+ control: z5.optional(z5.union([z5.literal("system"), z5.literal("graphql")])),
228
232
  method: Method,
229
233
  // expression
230
234
  url: z5.string(),
@@ -242,7 +246,14 @@ var ResourceRequest = z5.object({
242
246
  });
243
247
  var Resources = z5.map(ResourceId, Resource);
244
248
  var LOCAL_RESOURCE_PREFIX = "$resources";
245
- var isLocalResource = (pathname, resourceName) => pathname.split("/").filter(Boolean).join("/") === `${LOCAL_RESOURCE_PREFIX}/${resourceName}`;
249
+ var isLocalResource = (pathname, resourceName) => {
250
+ const segments = pathname.split("/").filter(Boolean);
251
+ if (resourceName === void 0) {
252
+ return segments[0] === LOCAL_RESOURCE_PREFIX;
253
+ }
254
+ return segments.join("/") === `${LOCAL_RESOURCE_PREFIX}/${resourceName}`;
255
+ };
256
+ var sitemapResourceUrl = `/${LOCAL_RESOURCE_PREFIX}/sitemap.xml`;
246
257
 
247
258
  // src/schema/props.ts
248
259
  import { z as z6 } from "zod";
@@ -655,6 +666,50 @@ var transpileExpression = ({
655
666
  }
656
667
  return expression;
657
668
  };
669
+ var parseObjectExpression = (expression) => {
670
+ const map = /* @__PURE__ */ new Map();
671
+ let root;
672
+ try {
673
+ root = parseExpressionAt(expression, 0, { ecmaVersion: "latest" });
674
+ } catch (error) {
675
+ return map;
676
+ }
677
+ if (root.type !== "ObjectExpression") {
678
+ return map;
679
+ }
680
+ for (const property of root.properties) {
681
+ if (property.type === "SpreadElement") {
682
+ continue;
683
+ }
684
+ if (property.computed) {
685
+ continue;
686
+ }
687
+ let key;
688
+ if (property.key.type === "Identifier") {
689
+ key = property.key.name;
690
+ } else if (property.key.type === "Literal" && typeof property.key.value === "string") {
691
+ key = property.key.value;
692
+ } else {
693
+ continue;
694
+ }
695
+ const valueExpression = expression.slice(
696
+ property.value.start,
697
+ property.value.end
698
+ );
699
+ map.set(key, valueExpression);
700
+ }
701
+ return map;
702
+ };
703
+ var generateObjectExpression = (map) => {
704
+ let generated = "{\n";
705
+ for (const [key, valueExpression] of map) {
706
+ const keyExpression = JSON.stringify(key);
707
+ generated += ` ${keyExpression}: ${valueExpression},
708
+ `;
709
+ }
710
+ generated += `}`;
711
+ return generated;
712
+ };
658
713
  var dataSourceVariablePrefix = "$ws$dataSource$";
659
714
  var encodeDataSourceVariable = (id) => {
660
715
  const encoded = id.replaceAll("-", "__DASH__");
@@ -694,6 +749,14 @@ var executeExpression = (expression) => {
694
749
  }
695
750
  };
696
751
 
752
+ // src/url-pattern.ts
753
+ var tokenRegex = /:(?<name>\w+)(?<modifier>[?*]?)|(?<wildcard>(?<!:\w+)\*)/;
754
+ var isPathnamePattern = (pathname) => tokenRegex.test(pathname);
755
+ var tokenRegexGlobal = new RegExp(tokenRegex.source, "g");
756
+ var matchPathnameParams = (pathname) => {
757
+ return pathname.matchAll(tokenRegexGlobal);
758
+ };
759
+
697
760
  // src/page-utils.ts
698
761
  var ROOT_FOLDER_ID = "root";
699
762
  var isRoot = (folder) => folder.id === ROOT_FOLDER_ID;
@@ -743,9 +806,9 @@ var getPagePath = (id, pages) => {
743
806
  };
744
807
  var getStaticSiteMapXml = (pages, updatedAt) => {
745
808
  const allPages = [pages.homePage, ...pages.pages];
746
- return allPages.filter(
809
+ return allPages.filter((page) => (page.meta.documentType ?? "html") === "html").filter(
747
810
  (page) => executeExpression(page.meta.excludePageFromSearch) !== true
748
- ).map((page) => ({
811
+ ).filter((page) => false === isPathnamePattern(page.path)).map((page) => ({
749
812
  path: getPagePath(page.id, pages),
750
813
  lastModified: updatedAt.split("T")[0]
751
814
  }));
@@ -940,7 +1003,7 @@ var generateResourcesLoader = ({
940
1003
  generated += `import { loadResource, isLocalResource, type System } from "@webstudio-is/sdk";
941
1004
  `;
942
1005
  if (hasResources) {
943
- generated += `import { sitemap } from "./[sitemap.xml]";
1006
+ generated += `import { sitemap } from "./$resources.sitemap.xml";
944
1007
  `;
945
1008
  }
946
1009
  generated += `export const loadResources = async (_props: { system: System }) => {
@@ -1170,6 +1233,7 @@ export {
1170
1233
  WebstudioFragment,
1171
1234
  createScope,
1172
1235
  decodeDataSourceVariable,
1236
+ documentTypes,
1173
1237
  encodeDataSourceVariable,
1174
1238
  executeExpression,
1175
1239
  findPageByIdOrPath,
@@ -1178,6 +1242,7 @@ export {
1178
1242
  findTreeInstanceIdsExcludingSlotDescendants,
1179
1243
  generateExpression,
1180
1244
  generateFormsProperties,
1245
+ generateObjectExpression,
1181
1246
  generatePageMeta,
1182
1247
  generateResourcesLoader,
1183
1248
  getExpressionIdentifiers,
@@ -1187,9 +1252,13 @@ export {
1187
1252
  initialBreakpoints,
1188
1253
  isLiteralExpression,
1189
1254
  isLocalResource,
1255
+ isPathnamePattern,
1190
1256
  isRoot,
1191
1257
  lintExpression,
1192
1258
  loadResource,
1259
+ matchPathnameParams,
1193
1260
  parseComponentName,
1261
+ parseObjectExpression,
1262
+ sitemapResourceUrl,
1194
1263
  transpileExpression
1195
1264
  };
@@ -32,6 +32,16 @@ export declare const transpileExpression: ({ expression, executable, replaceVari
32
32
  executable?: boolean;
33
33
  replaceVariable?: (identifier: string, assignee: boolean) => string | undefined | void;
34
34
  }) => string;
35
+ /**
36
+ * parse object expression into key value map
37
+ * where each value is expression
38
+ */
39
+ export declare const parseObjectExpression: (expression: string) => Map<string, string>;
40
+ /**
41
+ * generate key value map into object expression
42
+ * after updating individual value expressions
43
+ */
44
+ export declare const generateObjectExpression: (map: Map<string, string>) => string;
35
45
  export declare const encodeDataSourceVariable: (id: string) => string;
36
46
  export declare const decodeDataSourceVariable: (name: string) => string | undefined;
37
47
  export declare const generateExpression: ({ expression, dataSources, usedDataSources, scope, }: {
@@ -18,3 +18,4 @@ export * from "./expression";
18
18
  export * from "./forms-generator";
19
19
  export * from "./resources-generator";
20
20
  export * from "./page-meta-generator";
21
+ export * from "./url-pattern";
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  export declare const FontAsset: z.ZodObject<{
3
- format: z.ZodUnion<[z.ZodLiteral<"ttf">, z.ZodLiteral<"woff">, z.ZodLiteral<"woff2">, z.ZodLiteral<"otf">]>;
3
+ format: z.ZodUnion<[z.ZodLiteral<"ttf">, z.ZodLiteral<"woff">, z.ZodLiteral<"woff2">]>;
4
4
  meta: z.ZodUnion<[z.ZodObject<{
5
5
  family: z.ZodString;
6
6
  style: z.ZodEnum<["normal", "italic", "oblique"]>;
@@ -59,7 +59,7 @@ export declare const FontAsset: z.ZodObject<{
59
59
  type: "font";
60
60
  id: string;
61
61
  name: string;
62
- format: "ttf" | "woff" | "woff2" | "otf";
62
+ format: "ttf" | "woff" | "woff2";
63
63
  meta: ({
64
64
  family: string;
65
65
  style: "normal" | "italic" | "oblique";
@@ -93,7 +93,7 @@ export declare const FontAsset: z.ZodObject<{
93
93
  type: "font";
94
94
  id: string;
95
95
  name: string;
96
- format: "ttf" | "woff" | "woff2" | "otf";
96
+ format: "ttf" | "woff" | "woff2";
97
97
  meta: ({
98
98
  family: string;
99
99
  style: "normal" | "italic" | "oblique";
@@ -184,7 +184,7 @@ export declare const ImageAsset: z.ZodObject<{
184
184
  }>;
185
185
  export type ImageAsset = z.infer<typeof ImageAsset>;
186
186
  export declare const Asset: z.ZodUnion<[z.ZodObject<{
187
- format: z.ZodUnion<[z.ZodLiteral<"ttf">, z.ZodLiteral<"woff">, z.ZodLiteral<"woff2">, z.ZodLiteral<"otf">]>;
187
+ format: z.ZodUnion<[z.ZodLiteral<"ttf">, z.ZodLiteral<"woff">, z.ZodLiteral<"woff2">]>;
188
188
  meta: z.ZodUnion<[z.ZodObject<{
189
189
  family: z.ZodString;
190
190
  style: z.ZodEnum<["normal", "italic", "oblique"]>;
@@ -243,7 +243,7 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
243
243
  type: "font";
244
244
  id: string;
245
245
  name: string;
246
- format: "ttf" | "woff" | "woff2" | "otf";
246
+ format: "ttf" | "woff" | "woff2";
247
247
  meta: ({
248
248
  family: string;
249
249
  style: "normal" | "italic" | "oblique";
@@ -277,7 +277,7 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
277
277
  type: "font";
278
278
  id: string;
279
279
  name: string;
280
- format: "ttf" | "woff" | "woff2" | "otf";
280
+ format: "ttf" | "woff" | "woff2";
281
281
  meta: ({
282
282
  family: string;
283
283
  style: "normal" | "italic" | "oblique";
@@ -355,7 +355,7 @@ export declare const Asset: z.ZodUnion<[z.ZodObject<{
355
355
  }>]>;
356
356
  export type Asset = z.infer<typeof Asset>;
357
357
  export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
358
- format: z.ZodUnion<[z.ZodLiteral<"ttf">, z.ZodLiteral<"woff">, z.ZodLiteral<"woff2">, z.ZodLiteral<"otf">]>;
358
+ format: z.ZodUnion<[z.ZodLiteral<"ttf">, z.ZodLiteral<"woff">, z.ZodLiteral<"woff2">]>;
359
359
  meta: z.ZodUnion<[z.ZodObject<{
360
360
  family: z.ZodString;
361
361
  style: z.ZodEnum<["normal", "italic", "oblique"]>;
@@ -414,7 +414,7 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
414
414
  type: "font";
415
415
  id: string;
416
416
  name: string;
417
- format: "ttf" | "woff" | "woff2" | "otf";
417
+ format: "ttf" | "woff" | "woff2";
418
418
  meta: ({
419
419
  family: string;
420
420
  style: "normal" | "italic" | "oblique";
@@ -448,7 +448,7 @@ export declare const Assets: z.ZodMap<z.ZodString, z.ZodUnion<[z.ZodObject<{
448
448
  type: "font";
449
449
  id: string;
450
450
  name: string;
451
- format: "ttf" | "woff" | "woff2" | "otf";
451
+ format: "ttf" | "woff" | "woff2";
452
452
  meta: ({
453
453
  family: string;
454
454
  style: "normal" | "italic" | "oblique";
@@ -24,6 +24,7 @@ export declare const Folder: z.ZodObject<{
24
24
  export type Folder = z.infer<typeof Folder>;
25
25
  export declare const PageName: z.ZodEffects<z.ZodString, string, string>;
26
26
  export declare const PageTitle: z.ZodEffects<z.ZodString, string, string>;
27
+ export declare const documentTypes: readonly ["html", "xml"];
27
28
  export declare const HomePagePath: z.ZodEffects<z.ZodString, string, string>;
28
29
  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>;
29
30
  declare const Page: z.ZodObject<{
@@ -31,6 +32,7 @@ declare const Page: z.ZodObject<{
31
32
  id: z.ZodString;
32
33
  name: z.ZodEffects<z.ZodString, string, string>;
33
34
  title: z.ZodEffects<z.ZodString, string, string>;
35
+ history: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
34
36
  meta: z.ZodObject<{
35
37
  description: z.ZodOptional<z.ZodString>;
36
38
  title: z.ZodOptional<z.ZodString>;
@@ -40,6 +42,7 @@ declare const Page: z.ZodObject<{
40
42
  socialImageUrl: z.ZodOptional<z.ZodString>;
41
43
  status: z.ZodOptional<z.ZodString>;
42
44
  redirect: z.ZodOptional<z.ZodString>;
45
+ documentType: z.ZodOptional<z.ZodEnum<["html", "xml"]>>;
43
46
  custom: z.ZodOptional<z.ZodArray<z.ZodObject<{
44
47
  property: z.ZodString;
45
48
  content: z.ZodString;
@@ -59,6 +62,7 @@ declare const Page: z.ZodObject<{
59
62
  socialImageUrl?: string | undefined;
60
63
  status?: string | undefined;
61
64
  redirect?: string | undefined;
65
+ documentType?: "html" | "xml" | undefined;
62
66
  custom?: {
63
67
  property: string;
64
68
  content: string;
@@ -72,6 +76,7 @@ declare const Page: z.ZodObject<{
72
76
  socialImageUrl?: string | undefined;
73
77
  status?: string | undefined;
74
78
  redirect?: string | undefined;
79
+ documentType?: "html" | "xml" | undefined;
75
80
  custom?: {
76
81
  property: string;
77
82
  content: string;
@@ -92,6 +97,7 @@ declare const Page: z.ZodObject<{
92
97
  socialImageUrl?: string | undefined;
93
98
  status?: string | undefined;
94
99
  redirect?: string | undefined;
100
+ documentType?: "html" | "xml" | undefined;
95
101
  custom?: {
96
102
  property: string;
97
103
  content: string;
@@ -100,6 +106,7 @@ declare const Page: z.ZodObject<{
100
106
  title: string;
101
107
  rootInstanceId: string;
102
108
  systemDataSourceId: string;
109
+ history?: string[] | undefined;
103
110
  }, {
104
111
  path: string;
105
112
  id: string;
@@ -113,6 +120,7 @@ declare const Page: z.ZodObject<{
113
120
  socialImageUrl?: string | undefined;
114
121
  status?: string | undefined;
115
122
  redirect?: string | undefined;
123
+ documentType?: "html" | "xml" | undefined;
116
124
  custom?: {
117
125
  property: string;
118
126
  content: string;
@@ -121,6 +129,7 @@ declare const Page: z.ZodObject<{
121
129
  title: string;
122
130
  rootInstanceId: string;
123
131
  systemDataSourceId: string;
132
+ history?: string[] | undefined;
124
133
  }>;
125
134
  declare const ProjectMeta: z.ZodObject<{
126
135
  siteName: z.ZodOptional<z.ZodString>;
@@ -205,6 +214,7 @@ export declare const Pages: z.ZodObject<{
205
214
  id: z.ZodString;
206
215
  name: z.ZodEffects<z.ZodString, string, string>;
207
216
  title: z.ZodEffects<z.ZodString, string, string>;
217
+ history: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
208
218
  meta: z.ZodObject<{
209
219
  description: z.ZodOptional<z.ZodString>;
210
220
  title: z.ZodOptional<z.ZodString>;
@@ -214,6 +224,7 @@ export declare const Pages: z.ZodObject<{
214
224
  socialImageUrl: z.ZodOptional<z.ZodString>;
215
225
  status: z.ZodOptional<z.ZodString>;
216
226
  redirect: z.ZodOptional<z.ZodString>;
227
+ documentType: z.ZodOptional<z.ZodEnum<["html", "xml"]>>;
217
228
  custom: z.ZodOptional<z.ZodArray<z.ZodObject<{
218
229
  property: z.ZodString;
219
230
  content: z.ZodString;
@@ -233,6 +244,7 @@ export declare const Pages: z.ZodObject<{
233
244
  socialImageUrl?: string | undefined;
234
245
  status?: string | undefined;
235
246
  redirect?: string | undefined;
247
+ documentType?: "html" | "xml" | undefined;
236
248
  custom?: {
237
249
  property: string;
238
250
  content: string;
@@ -246,6 +258,7 @@ export declare const Pages: z.ZodObject<{
246
258
  socialImageUrl?: string | undefined;
247
259
  status?: string | undefined;
248
260
  redirect?: string | undefined;
261
+ documentType?: "html" | "xml" | undefined;
249
262
  custom?: {
250
263
  property: string;
251
264
  content: string;
@@ -266,6 +279,7 @@ export declare const Pages: z.ZodObject<{
266
279
  socialImageUrl?: string | undefined;
267
280
  status?: string | undefined;
268
281
  redirect?: string | undefined;
282
+ documentType?: "html" | "xml" | undefined;
269
283
  custom?: {
270
284
  property: string;
271
285
  content: string;
@@ -274,6 +288,7 @@ export declare const Pages: z.ZodObject<{
274
288
  title: string;
275
289
  rootInstanceId: string;
276
290
  systemDataSourceId: string;
291
+ history?: string[] | undefined;
277
292
  }, {
278
293
  path: string;
279
294
  id: string;
@@ -287,6 +302,7 @@ export declare const Pages: z.ZodObject<{
287
302
  socialImageUrl?: string | undefined;
288
303
  status?: string | undefined;
289
304
  redirect?: string | undefined;
305
+ documentType?: "html" | "xml" | undefined;
290
306
  custom?: {
291
307
  property: string;
292
308
  content: string;
@@ -295,12 +311,14 @@ export declare const Pages: z.ZodObject<{
295
311
  title: string;
296
312
  rootInstanceId: string;
297
313
  systemDataSourceId: string;
314
+ history?: string[] | undefined;
298
315
  }>;
299
316
  pages: z.ZodArray<z.ZodObject<{
300
317
  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>;
301
318
  id: z.ZodString;
302
319
  name: z.ZodEffects<z.ZodString, string, string>;
303
320
  title: z.ZodEffects<z.ZodString, string, string>;
321
+ history: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
304
322
  meta: z.ZodObject<{
305
323
  description: z.ZodOptional<z.ZodString>;
306
324
  title: z.ZodOptional<z.ZodString>;
@@ -310,6 +328,7 @@ export declare const Pages: z.ZodObject<{
310
328
  socialImageUrl: z.ZodOptional<z.ZodString>;
311
329
  status: z.ZodOptional<z.ZodString>;
312
330
  redirect: z.ZodOptional<z.ZodString>;
331
+ documentType: z.ZodOptional<z.ZodEnum<["html", "xml"]>>;
313
332
  custom: z.ZodOptional<z.ZodArray<z.ZodObject<{
314
333
  property: z.ZodString;
315
334
  content: z.ZodString;
@@ -329,6 +348,7 @@ export declare const Pages: z.ZodObject<{
329
348
  socialImageUrl?: string | undefined;
330
349
  status?: string | undefined;
331
350
  redirect?: string | undefined;
351
+ documentType?: "html" | "xml" | undefined;
332
352
  custom?: {
333
353
  property: string;
334
354
  content: string;
@@ -342,6 +362,7 @@ export declare const Pages: z.ZodObject<{
342
362
  socialImageUrl?: string | undefined;
343
363
  status?: string | undefined;
344
364
  redirect?: string | undefined;
365
+ documentType?: "html" | "xml" | undefined;
345
366
  custom?: {
346
367
  property: string;
347
368
  content: string;
@@ -362,6 +383,7 @@ export declare const Pages: z.ZodObject<{
362
383
  socialImageUrl?: string | undefined;
363
384
  status?: string | undefined;
364
385
  redirect?: string | undefined;
386
+ documentType?: "html" | "xml" | undefined;
365
387
  custom?: {
366
388
  property: string;
367
389
  content: string;
@@ -370,6 +392,7 @@ export declare const Pages: z.ZodObject<{
370
392
  title: string;
371
393
  rootInstanceId: string;
372
394
  systemDataSourceId: string;
395
+ history?: string[] | undefined;
373
396
  }, {
374
397
  path: string;
375
398
  id: string;
@@ -383,6 +406,7 @@ export declare const Pages: z.ZodObject<{
383
406
  socialImageUrl?: string | undefined;
384
407
  status?: string | undefined;
385
408
  redirect?: string | undefined;
409
+ documentType?: "html" | "xml" | undefined;
386
410
  custom?: {
387
411
  property: string;
388
412
  content: string;
@@ -391,6 +415,7 @@ export declare const Pages: z.ZodObject<{
391
415
  title: string;
392
416
  rootInstanceId: string;
393
417
  systemDataSourceId: string;
418
+ history?: string[] | undefined;
394
419
  }>, "many">;
395
420
  folders: z.ZodEffects<z.ZodArray<z.ZodObject<{
396
421
  id: z.ZodString;
@@ -432,6 +457,7 @@ export declare const Pages: z.ZodObject<{
432
457
  socialImageUrl?: string | undefined;
433
458
  status?: string | undefined;
434
459
  redirect?: string | undefined;
460
+ documentType?: "html" | "xml" | undefined;
435
461
  custom?: {
436
462
  property: string;
437
463
  content: string;
@@ -440,6 +466,7 @@ export declare const Pages: z.ZodObject<{
440
466
  title: string;
441
467
  rootInstanceId: string;
442
468
  systemDataSourceId: string;
469
+ history?: string[] | undefined;
443
470
  };
444
471
  pages: {
445
472
  path: string;
@@ -454,6 +481,7 @@ export declare const Pages: z.ZodObject<{
454
481
  socialImageUrl?: string | undefined;
455
482
  status?: string | undefined;
456
483
  redirect?: string | undefined;
484
+ documentType?: "html" | "xml" | undefined;
457
485
  custom?: {
458
486
  property: string;
459
487
  content: string;
@@ -462,6 +490,7 @@ export declare const Pages: z.ZodObject<{
462
490
  title: string;
463
491
  rootInstanceId: string;
464
492
  systemDataSourceId: string;
493
+ history?: string[] | undefined;
465
494
  }[];
466
495
  folders: {
467
496
  id: string;
@@ -497,6 +526,7 @@ export declare const Pages: z.ZodObject<{
497
526
  socialImageUrl?: string | undefined;
498
527
  status?: string | undefined;
499
528
  redirect?: string | undefined;
529
+ documentType?: "html" | "xml" | undefined;
500
530
  custom?: {
501
531
  property: string;
502
532
  content: string;
@@ -505,6 +535,7 @@ export declare const Pages: z.ZodObject<{
505
535
  title: string;
506
536
  rootInstanceId: string;
507
537
  systemDataSourceId: string;
538
+ history?: string[] | undefined;
508
539
  };
509
540
  pages: {
510
541
  path: string;
@@ -519,6 +550,7 @@ export declare const Pages: z.ZodObject<{
519
550
  socialImageUrl?: string | undefined;
520
551
  status?: string | undefined;
521
552
  redirect?: string | undefined;
553
+ documentType?: "html" | "xml" | undefined;
522
554
  custom?: {
523
555
  property: string;
524
556
  content: string;
@@ -527,6 +559,7 @@ export declare const Pages: z.ZodObject<{
527
559
  title: string;
528
560
  rootInstanceId: string;
529
561
  systemDataSourceId: string;
562
+ history?: string[] | undefined;
530
563
  }[];
531
564
  folders: {
532
565
  id: string;
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  export declare const Resource: z.ZodObject<{
3
3
  id: z.ZodString;
4
4
  name: z.ZodString;
5
+ control: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"system">, z.ZodLiteral<"graphql">]>>;
5
6
  method: z.ZodUnion<[z.ZodLiteral<"get">, z.ZodLiteral<"post">, z.ZodLiteral<"put">, z.ZodLiteral<"delete">]>;
6
7
  url: z.ZodString;
7
8
  headers: z.ZodArray<z.ZodObject<{
@@ -24,6 +25,7 @@ export declare const Resource: z.ZodObject<{
24
25
  value: string;
25
26
  name: string;
26
27
  }[];
28
+ control?: "system" | "graphql" | undefined;
27
29
  body?: string | undefined;
28
30
  }, {
29
31
  id: string;
@@ -34,6 +36,7 @@ export declare const Resource: z.ZodObject<{
34
36
  value: string;
35
37
  name: string;
36
38
  }[];
39
+ control?: "system" | "graphql" | undefined;
37
40
  body?: string | undefined;
38
41
  }>;
39
42
  export type Resource = z.infer<typeof Resource>;
@@ -78,6 +81,7 @@ export type ResourceRequest = z.infer<typeof ResourceRequest>;
78
81
  export declare const Resources: z.ZodMap<z.ZodString, z.ZodObject<{
79
82
  id: z.ZodString;
80
83
  name: z.ZodString;
84
+ control: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"system">, z.ZodLiteral<"graphql">]>>;
81
85
  method: z.ZodUnion<[z.ZodLiteral<"get">, z.ZodLiteral<"post">, z.ZodLiteral<"put">, z.ZodLiteral<"delete">]>;
82
86
  url: z.ZodString;
83
87
  headers: z.ZodArray<z.ZodObject<{
@@ -100,6 +104,7 @@ export declare const Resources: z.ZodMap<z.ZodString, z.ZodObject<{
100
104
  value: string;
101
105
  name: string;
102
106
  }[];
107
+ control?: "system" | "graphql" | undefined;
103
108
  body?: string | undefined;
104
109
  }, {
105
110
  id: string;
@@ -110,10 +115,12 @@ export declare const Resources: z.ZodMap<z.ZodString, z.ZodObject<{
110
115
  value: string;
111
116
  name: string;
112
117
  }[];
118
+ control?: "system" | "graphql" | undefined;
113
119
  body?: string | undefined;
114
120
  }>>;
115
121
  export type Resources = z.infer<typeof Resources>;
116
122
  /**
117
123
  * Prevents fetch cycles by prefixing local resources.
118
124
  */
119
- export declare const isLocalResource: (pathname: string, resourceName: string) => boolean;
125
+ export declare const isLocalResource: (pathname: string, resourceName?: string) => boolean;
126
+ export declare const sitemapResourceUrl = "/$resources/sitemap.xml";
@@ -107,7 +107,7 @@ export declare const WebstudioFragment: z.ZodObject<{
107
107
  label?: string | undefined;
108
108
  }>, "many">;
109
109
  assets: z.ZodArray<z.ZodUnion<[z.ZodObject<{
110
- format: z.ZodUnion<[z.ZodLiteral<"ttf">, z.ZodLiteral<"woff">, z.ZodLiteral<"woff2">, z.ZodLiteral<"otf">]>;
110
+ format: z.ZodUnion<[z.ZodLiteral<"ttf">, z.ZodLiteral<"woff">, z.ZodLiteral<"woff2">]>;
111
111
  meta: z.ZodUnion<[z.ZodObject<{
112
112
  family: z.ZodString;
113
113
  style: z.ZodEnum<["normal", "italic", "oblique"]>;
@@ -166,7 +166,7 @@ export declare const WebstudioFragment: z.ZodObject<{
166
166
  type: "font";
167
167
  id: string;
168
168
  name: string;
169
- format: "ttf" | "woff" | "woff2" | "otf";
169
+ format: "ttf" | "woff" | "woff2";
170
170
  meta: ({
171
171
  family: string;
172
172
  style: "normal" | "italic" | "oblique";
@@ -200,7 +200,7 @@ export declare const WebstudioFragment: z.ZodObject<{
200
200
  type: "font";
201
201
  id: string;
202
202
  name: string;
203
- format: "ttf" | "woff" | "woff2" | "otf";
203
+ format: "ttf" | "woff" | "woff2";
204
204
  meta: ({
205
205
  family: string;
206
206
  style: "normal" | "italic" | "oblique";
@@ -406,6 +406,7 @@ export declare const WebstudioFragment: z.ZodObject<{
406
406
  resources: z.ZodArray<z.ZodObject<{
407
407
  id: z.ZodString;
408
408
  name: z.ZodString;
409
+ control: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"system">, z.ZodLiteral<"graphql">]>>;
409
410
  method: z.ZodUnion<[z.ZodLiteral<"get">, z.ZodLiteral<"post">, z.ZodLiteral<"put">, z.ZodLiteral<"delete">]>;
410
411
  url: z.ZodString;
411
412
  headers: z.ZodArray<z.ZodObject<{
@@ -428,6 +429,7 @@ export declare const WebstudioFragment: z.ZodObject<{
428
429
  value: string;
429
430
  name: string;
430
431
  }[];
432
+ control?: "system" | "graphql" | undefined;
431
433
  body?: string | undefined;
432
434
  }, {
433
435
  id: string;
@@ -438,6 +440,7 @@ export declare const WebstudioFragment: z.ZodObject<{
438
440
  value: string;
439
441
  name: string;
440
442
  }[];
443
+ control?: "system" | "graphql" | undefined;
441
444
  body?: string | undefined;
442
445
  }>, "many">;
443
446
  props: z.ZodArray<z.ZodUnion<[z.ZodObject<{
@@ -1685,7 +1688,7 @@ export declare const WebstudioFragment: z.ZodObject<{
1685
1688
  type: "font";
1686
1689
  id: string;
1687
1690
  name: string;
1688
- format: "ttf" | "woff" | "woff2" | "otf";
1691
+ format: "ttf" | "woff" | "woff2";
1689
1692
  meta: ({
1690
1693
  family: string;
1691
1694
  style: "normal" | "italic" | "oblique";
@@ -1738,6 +1741,7 @@ export declare const WebstudioFragment: z.ZodObject<{
1738
1741
  value: string;
1739
1742
  name: string;
1740
1743
  }[];
1744
+ control?: "system" | "graphql" | undefined;
1741
1745
  body?: string | undefined;
1742
1746
  }[];
1743
1747
  props: ({
@@ -2339,7 +2343,7 @@ export declare const WebstudioFragment: z.ZodObject<{
2339
2343
  type: "font";
2340
2344
  id: string;
2341
2345
  name: string;
2342
- format: "ttf" | "woff" | "woff2" | "otf";
2346
+ format: "ttf" | "woff" | "woff2";
2343
2347
  meta: ({
2344
2348
  family: string;
2345
2349
  style: "normal" | "italic" | "oblique";
@@ -2392,6 +2396,7 @@ export declare const WebstudioFragment: z.ZodObject<{
2392
2396
  value: string;
2393
2397
  name: string;
2394
2398
  }[];
2399
+ control?: "system" | "graphql" | undefined;
2395
2400
  body?: string | undefined;
2396
2401
  }[];
2397
2402
  props: ({
@@ -0,0 +1,2 @@
1
+ export declare const isPathnamePattern: (pathname: string) => boolean;
2
+ export declare const matchPathnameParams: (pathname: string) => IterableIterator<RegExpExecArray>;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk",
3
- "version": "0.151.0",
3
+ "version": "0.163.0",
4
4
  "description": "Webstudio project data schema",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -9,8 +9,7 @@
9
9
  "exports": {
10
10
  "webstudio": "./src/index.ts",
11
11
  "types": "./lib/types/index.d.ts",
12
- "import": "./lib/index.js",
13
- "require": "./lib/index.js"
12
+ "import": "./lib/index.js"
14
13
  },
15
14
  "files": [
16
15
  "lib/*",
@@ -22,8 +21,8 @@
22
21
  "acorn-walk": "^8.3.2",
23
22
  "type-fest": "^4.3.1",
24
23
  "zod": "^3.22.4",
25
- "@webstudio-is/css-engine": "0.151.0",
26
- "@webstudio-is/fonts": "0.151.0"
24
+ "@webstudio-is/css-engine": "0.163.0",
25
+ "@webstudio-is/fonts": "0.163.0"
27
26
  },
28
27
  "devDependencies": {
29
28
  "@jest/globals": "^29.7.0",