@webstudio-is/sdk 0.267.0 → 0.268.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
@@ -44,6 +44,7 @@ var Assets = z.map(AssetId, Asset);
44
44
 
45
45
  // src/schema/pages.ts
46
46
  import { z as z2 } from "zod";
47
+ import { validateBasicAuth } from "@webstudio-is/wsauth";
47
48
  var MIN_TITLE_LENGTH = 2;
48
49
  var PageId = z2.string();
49
50
  var FolderId = z2.string();
@@ -63,7 +64,36 @@ var PageTitle = z2.string().refine(
63
64
  (val) => val.length >= MIN_TITLE_LENGTH,
64
65
  `Minimum ${MIN_TITLE_LENGTH} characters required`
65
66
  );
66
- var documentTypes = ["html", "xml"];
67
+ var documentTypes = ["html", "xml", "text"];
68
+ var BasicAuthFields = {
69
+ login: z2.string(),
70
+ password: z2.string()
71
+ };
72
+ var validateBasicAuthFields = ({
73
+ login,
74
+ password
75
+ }, context) => {
76
+ for (const issue of validateBasicAuth({ login, password }).issues ?? []) {
77
+ context.addIssue({
78
+ code: z2.ZodIssueCode.custom,
79
+ path: issue.path,
80
+ message: issue.message
81
+ });
82
+ }
83
+ };
84
+ var PageBasicAuth = z2.object({
85
+ method: z2.literal("basic"),
86
+ ...BasicAuthFields
87
+ }).superRefine(validateBasicAuthFields);
88
+ var LegacyPageBasicAuth = z2.object({
89
+ type: z2.literal("basic"),
90
+ ...BasicAuthFields
91
+ }).superRefine(validateBasicAuthFields).transform(({ login, password }) => ({
92
+ method: "basic",
93
+ login,
94
+ password
95
+ }));
96
+ var PageAuth = z2.union([PageBasicAuth, LegacyPageBasicAuth]);
67
97
  var commonPageFields = {
68
98
  id: PageId,
69
99
  name: PageName,
@@ -81,6 +111,8 @@ var commonPageFields = {
81
111
  status: z2.string().optional(),
82
112
  redirect: z2.string().optional(),
83
113
  documentType: z2.optional(z2.enum(documentTypes)),
114
+ content: z2.string().optional(),
115
+ auth: PageAuth.optional(),
84
116
  custom: z2.array(
85
117
  z2.object({
86
118
  property: z2.string(),
@@ -136,7 +168,8 @@ var ProjectMeta = z2.object({
136
168
  siteName: z2.string().optional(),
137
169
  contactEmail: z2.string().optional(),
138
170
  faviconAssetId: z2.string().optional(),
139
- code: z2.string().optional()
171
+ code: z2.string().optional(),
172
+ auth: z2.string().optional()
140
173
  });
141
174
  var ProjectNewRedirectPath = z2.string().min(1, "Path is required").refine((data) => {
142
175
  try {
@@ -1006,6 +1039,7 @@ var componentCategories = [
1006
1039
  "localization",
1007
1040
  "radix",
1008
1041
  "xml",
1042
+ "text",
1009
1043
  "other",
1010
1044
  "hidden",
1011
1045
  "internal"
@@ -2111,24 +2145,158 @@ var systemParameter = {
2111
2145
  type: "parameter",
2112
2146
  name: "system"
2113
2147
  };
2114
- var allowedStringMethods = /* @__PURE__ */ new Set([
2115
- "toLowerCase",
2116
- "replace",
2117
- "split",
2118
- "slice",
2119
- "at",
2120
- "endsWith",
2121
- "includes",
2122
- "startsWith",
2123
- "toUpperCase",
2124
- "toLocaleLowerCase",
2125
- "toLocaleUpperCase"
2148
+ var stringMethodReturnKindByName = /* @__PURE__ */ new Map([
2149
+ ["toLowerCase", "string"],
2150
+ ["replace", "string"],
2151
+ ["split", "array"],
2152
+ ["slice", "string"],
2153
+ ["at", "unknown"],
2154
+ ["endsWith", "boolean"],
2155
+ ["includes", "boolean"],
2156
+ ["startsWith", "boolean"],
2157
+ ["toString", "string"],
2158
+ ["toUpperCase", "string"],
2159
+ ["toLocaleLowerCase", "string"],
2160
+ ["toLocaleUpperCase", "string"]
2161
+ ]);
2162
+ var arrayMethodReturnKindByName = /* @__PURE__ */ new Map([
2163
+ ["at", "unknown"],
2164
+ ["includes", "boolean"],
2165
+ ["join", "string"],
2166
+ ["slice", "array"],
2167
+ ["toString", "string"]
2126
2168
  ]);
2127
- var allowedArrayMethods = /* @__PURE__ */ new Set(["at", "includes", "join", "slice"]);
2169
+ var allowedStringMethods = new Set(
2170
+ stringMethodReturnKindByName.keys()
2171
+ );
2172
+ var allowedArrayMethods = new Set(arrayMethodReturnKindByName.keys());
2173
+ var getVariableValue = (variableValues, name) => {
2174
+ if (variableValues === void 0) {
2175
+ return;
2176
+ }
2177
+ const maybeMap = variableValues;
2178
+ if (typeof maybeMap.has === "function" && typeof maybeMap.get === "function") {
2179
+ if (maybeMap.has(name)) {
2180
+ return { value: maybeMap.get(name) };
2181
+ }
2182
+ return;
2183
+ }
2184
+ const record = variableValues;
2185
+ if (Object.hasOwn(record, name)) {
2186
+ return { value: record[name] };
2187
+ }
2188
+ };
2189
+ var getValueKind = (value) => {
2190
+ if (Array.isArray(value)) {
2191
+ return "array";
2192
+ }
2193
+ if (value === void 0 || value === null) {
2194
+ return "nullish";
2195
+ }
2196
+ switch (typeof value) {
2197
+ case "bigint":
2198
+ return "bigint";
2199
+ case "boolean":
2200
+ return "boolean";
2201
+ case "number":
2202
+ return "number";
2203
+ case "string":
2204
+ return "string";
2205
+ case "object":
2206
+ return "object";
2207
+ default:
2208
+ return "unknown";
2209
+ }
2210
+ };
2211
+ var getMethodReturnKind = (receiverKind, methodName) => {
2212
+ if (receiverKind === "array") {
2213
+ return arrayMethodReturnKindByName.get(methodName) ?? "unknown";
2214
+ }
2215
+ if (receiverKind === "string") {
2216
+ return stringMethodReturnKindByName.get(methodName) ?? "unknown";
2217
+ }
2218
+ if (receiverKind === "unknown") {
2219
+ const stringReturnKind = stringMethodReturnKindByName.get(methodName);
2220
+ const arrayReturnKind = arrayMethodReturnKindByName.get(methodName);
2221
+ if (stringReturnKind && arrayReturnKind === void 0) {
2222
+ return stringReturnKind;
2223
+ }
2224
+ if (arrayReturnKind && stringReturnKind === void 0) {
2225
+ return arrayReturnKind;
2226
+ }
2227
+ if (stringReturnKind === arrayReturnKind) {
2228
+ return stringReturnKind ?? "unknown";
2229
+ }
2230
+ return "unknown";
2231
+ }
2232
+ return methodName === "toString" ? "string" : "unknown";
2233
+ };
2234
+ var isMethodSupported = (receiverKind, methodName) => {
2235
+ if (receiverKind === "unknown") {
2236
+ return allowedStringMethods.has(methodName) || allowedArrayMethods.has(methodName);
2237
+ }
2238
+ if (receiverKind === "string") {
2239
+ return stringMethodReturnKindByName.has(methodName);
2240
+ }
2241
+ if (receiverKind === "array") {
2242
+ return arrayMethodReturnKindByName.has(methodName);
2243
+ }
2244
+ if (receiverKind === "nullish") {
2245
+ return false;
2246
+ }
2247
+ return methodName === "toString";
2248
+ };
2249
+ var getExpressionNodeValueKind = (node, variableValues) => {
2250
+ if (node.type === "Identifier") {
2251
+ if (node.name === "undefined") {
2252
+ return "nullish";
2253
+ }
2254
+ const variable = getVariableValue(variableValues, node.name);
2255
+ return variable ? getValueKind(variable.value) : "unknown";
2256
+ }
2257
+ if (node.type === "Literal") {
2258
+ return getValueKind(node.value);
2259
+ }
2260
+ if (node.type === "ArrayExpression") {
2261
+ return "array";
2262
+ }
2263
+ if (node.type === "ObjectExpression") {
2264
+ return "object";
2265
+ }
2266
+ if (node.type === "TemplateLiteral") {
2267
+ return "string";
2268
+ }
2269
+ if (node.type === "ChainExpression" || node.type === "ParenthesizedExpression") {
2270
+ return getExpressionNodeValueKind(node.expression, variableValues);
2271
+ }
2272
+ if (node.type === "CallExpression" && node.callee.type === "MemberExpression" && node.callee.object.type !== "Super" && node.callee.property.type === "Identifier") {
2273
+ const receiverKind = getExpressionNodeValueKind(
2274
+ node.callee.object,
2275
+ variableValues
2276
+ );
2277
+ const methodName = node.callee.property.name;
2278
+ if (isMethodSupported(receiverKind, methodName)) {
2279
+ return getMethodReturnKind(receiverKind, methodName);
2280
+ }
2281
+ }
2282
+ return "unknown";
2283
+ };
2284
+ var getExpressionValueKind = ({
2285
+ expression,
2286
+ variableValues
2287
+ }) => {
2288
+ try {
2289
+ const node = parseExpressionAt(expression, 0, { ecmaVersion: "latest" });
2290
+ return getExpressionNodeValueKind(node, variableValues);
2291
+ } catch {
2292
+ return "unknown";
2293
+ }
2294
+ };
2128
2295
  var lintExpression = ({
2129
2296
  expression,
2130
2297
  availableVariables = /* @__PURE__ */ new Set(),
2131
- allowAssignment = false
2298
+ allowAssignment = false,
2299
+ variableValues
2132
2300
  }) => {
2133
2301
  const diagnostics = [];
2134
2302
  const addMessage = (message, severity = "error") => {
@@ -2215,7 +2383,11 @@ var lintExpression = ({
2215
2383
  if (node.callee.type === "MemberExpression") {
2216
2384
  if (node.callee.property.type === "Identifier") {
2217
2385
  const methodName = node.callee.property.name;
2218
- if (allowedStringMethods.has(methodName) || allowedArrayMethods.has(methodName)) {
2386
+ const receiverKind = node.callee.object.type === "Super" ? "unknown" : getExpressionNodeValueKind(
2387
+ node.callee.object,
2388
+ variableValues
2389
+ );
2390
+ if (isMethodSupported(receiverKind, methodName)) {
2219
2391
  return;
2220
2392
  }
2221
2393
  calleeName = methodName;
@@ -2826,6 +2998,12 @@ var generatePageMeta = ({
2826
2998
  usedDataSources,
2827
2999
  scope: localScope
2828
3000
  });
3001
+ const contentExpression = generateExpression({
3002
+ expression: page.meta.content ?? "undefined",
3003
+ dataSources,
3004
+ usedDataSources,
3005
+ scope: localScope
3006
+ });
2829
3007
  let customExpression = "";
2830
3008
  customExpression += `[
2831
3009
  `;
@@ -2834,7 +3012,7 @@ var generatePageMeta = ({
2834
3012
  continue;
2835
3013
  }
2836
3014
  const propertyExpression = JSON.stringify(customMeta.property);
2837
- const contentExpression = generateExpression({
3015
+ const contentExpression2 = generateExpression({
2838
3016
  expression: customMeta.content,
2839
3017
  dataSources,
2840
3018
  usedDataSources,
@@ -2844,7 +3022,7 @@ var generatePageMeta = ({
2844
3022
  `;
2845
3023
  customExpression += ` property: ${propertyExpression},
2846
3024
  `;
2847
- customExpression += ` content: ${contentExpression},
3025
+ customExpression += ` content: ${contentExpression2},
2848
3026
  `;
2849
3027
  customExpression += ` },
2850
3028
  `;
@@ -2909,6 +3087,8 @@ var generatePageMeta = ({
2909
3087
  generated += ` status: ${statusExpression},
2910
3088
  `;
2911
3089
  generated += ` redirect: ${redirectExpression},
3090
+ `;
3091
+ generated += ` content: ${contentExpression},
2912
3092
  `;
2913
3093
  generated += ` custom: ${customExpression},
2914
3094
  `;
@@ -3153,6 +3333,7 @@ export {
3153
3333
  Instances,
3154
3334
  MIME_CATEGORIES,
3155
3335
  OldPagePath,
3336
+ PageAuth,
3156
3337
  PageId,
3157
3338
  PageName,
3158
3339
  PagePath,
@@ -3225,6 +3406,7 @@ export {
3225
3406
  getAssetMime,
3226
3407
  getAssetUrl,
3227
3408
  getExpressionIdentifiers,
3409
+ getExpressionValueKind,
3228
3410
  getFolderById,
3229
3411
  getHomePage,
3230
3412
  getIndexesWithinAncestors,
@@ -9,12 +9,19 @@ export type Diagnostic = {
9
9
  severity: "error" | "hint" | "info" | "warning";
10
10
  message: string;
11
11
  };
12
+ export type VariableValues = ReadonlyMap<Identifier["name"], unknown> | Readonly<Record<Identifier["name"], unknown>>;
13
+ export type ExpressionValueKind = "array" | "bigint" | "boolean" | "nullish" | "number" | "object" | "string" | "unknown";
12
14
  export declare const allowedStringMethods: Set<string>;
13
15
  export declare const allowedArrayMethods: Set<string>;
14
- export declare const lintExpression: ({ expression, availableVariables, allowAssignment, }: {
16
+ export declare const getExpressionValueKind: ({ expression, variableValues, }: {
17
+ expression: string;
18
+ variableValues?: VariableValues;
19
+ }) => ExpressionValueKind;
20
+ export declare const lintExpression: ({ expression, availableVariables, allowAssignment, variableValues, }: {
15
21
  expression: string;
16
22
  availableVariables?: Set<Identifier["name"]>;
17
23
  allowAssignment?: boolean;
24
+ variableValues?: VariableValues;
18
25
  }) => Diagnostic[];
19
26
  /**
20
27
  * check whether provided expression is a literal value
@@ -11,6 +11,7 @@ export type PageMeta = {
11
11
  socialImageUrl?: string;
12
12
  status?: number;
13
13
  redirect?: string;
14
+ content?: string;
14
15
  custom: Array<{
15
16
  property: string;
16
17
  content: string;
@@ -5062,7 +5062,7 @@ export type PresetStyleDecl = Simplify<Omit<z.infer<typeof PresetStyleDecl>, "pr
5062
5062
  property: CssProperty;
5063
5063
  }>;
5064
5064
  export type PresetStyle<Tag extends HtmlTags = HtmlTags> = Partial<Record<Tag, PresetStyleDecl[]>>;
5065
- export declare const componentCategories: readonly ["general", "typography", "media", "animations", "data", "forms", "localization", "radix", "xml", "other", "hidden", "internal"];
5065
+ export declare const componentCategories: readonly ["general", "typography", "media", "animations", "data", "forms", "localization", "radix", "xml", "text", "other", "hidden", "internal"];
5066
5066
  export declare const ComponentState: z.ZodObject<{
5067
5067
  selector: z.ZodString;
5068
5068
  label: z.ZodString;
@@ -5095,7 +5095,7 @@ export declare const ContentModel: z.ZodObject<{
5095
5095
  }>;
5096
5096
  export type ContentModel = z.infer<typeof ContentModel>;
5097
5097
  export declare const WsComponentMeta: z.ZodObject<{
5098
- category: z.ZodOptional<z.ZodEnum<["general", "typography", "media", "animations", "data", "forms", "localization", "radix", "xml", "other", "hidden", "internal"]>>;
5098
+ category: z.ZodOptional<z.ZodEnum<["general", "typography", "media", "animations", "data", "forms", "localization", "radix", "xml", "text", "other", "hidden", "internal"]>>;
5099
5099
  contentModel: z.ZodOptional<z.ZodObject<{
5100
5100
  category: z.ZodUnion<[z.ZodLiteral<"instance">, z.ZodLiteral<"none">]>;
5101
5101
  /**
@@ -10748,7 +10748,7 @@ export declare const WsComponentMeta: z.ZodObject<{
10748
10748
  }>]>>>;
10749
10749
  }, "strip", z.ZodTypeAny, {
10750
10750
  description?: string | undefined;
10751
- category?: "xml" | "hidden" | "data" | "media" | "animations" | "general" | "typography" | "forms" | "localization" | "radix" | "other" | "internal" | undefined;
10751
+ category?: "xml" | "text" | "hidden" | "data" | "media" | "animations" | "general" | "typography" | "forms" | "localization" | "radix" | "other" | "internal" | undefined;
10752
10752
  label?: string | undefined;
10753
10753
  order?: number | undefined;
10754
10754
  props?: Record<string, {
@@ -11558,7 +11558,7 @@ export declare const WsComponentMeta: z.ZodObject<{
11558
11558
  initialProps?: string[] | undefined;
11559
11559
  }, {
11560
11560
  description?: string | undefined;
11561
- category?: "xml" | "hidden" | "data" | "media" | "animations" | "general" | "typography" | "forms" | "localization" | "radix" | "other" | "internal" | undefined;
11561
+ category?: "xml" | "text" | "hidden" | "data" | "media" | "animations" | "general" | "typography" | "forms" | "localization" | "radix" | "other" | "internal" | undefined;
11562
11562
  label?: string | undefined;
11563
11563
  order?: number | undefined;
11564
11564
  props?: Record<string, {
@@ -27,7 +27,57 @@ export declare const Folder: z.ZodObject<{
27
27
  export type Folder = z.infer<typeof Folder>;
28
28
  export declare const PageName: z.ZodEffects<z.ZodString, string, string>;
29
29
  export declare const PageTitle: z.ZodEffects<z.ZodString, string, string>;
30
- export declare const documentTypes: readonly ["html", "xml"];
30
+ export declare const documentTypes: readonly ["html", "xml", "text"];
31
+ export declare const PageAuth: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
32
+ login: z.ZodString;
33
+ password: z.ZodString;
34
+ method: z.ZodLiteral<"basic">;
35
+ }, "strip", z.ZodTypeAny, {
36
+ login: string;
37
+ password: string;
38
+ method: "basic";
39
+ }, {
40
+ login: string;
41
+ password: string;
42
+ method: "basic";
43
+ }>, {
44
+ login: string;
45
+ password: string;
46
+ method: "basic";
47
+ }, {
48
+ login: string;
49
+ password: string;
50
+ method: "basic";
51
+ }>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
52
+ login: z.ZodString;
53
+ password: z.ZodString;
54
+ type: z.ZodLiteral<"basic">;
55
+ }, "strip", z.ZodTypeAny, {
56
+ type: "basic";
57
+ login: string;
58
+ password: string;
59
+ }, {
60
+ type: "basic";
61
+ login: string;
62
+ password: string;
63
+ }>, {
64
+ type: "basic";
65
+ login: string;
66
+ password: string;
67
+ }, {
68
+ type: "basic";
69
+ login: string;
70
+ password: string;
71
+ }>, {
72
+ method: "basic";
73
+ login: string;
74
+ password: string;
75
+ }, {
76
+ type: "basic";
77
+ login: string;
78
+ password: string;
79
+ }>]>;
80
+ export type PageAuth = z.infer<typeof PageAuth>;
31
81
  export declare const HomePagePath: z.ZodEffects<z.ZodString, "", string>;
32
82
  export declare const OldPagePath: 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>;
33
83
  export declare const PagePath: z.ZodEffects<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>, string, string>;
@@ -48,45 +98,115 @@ declare const Page: z.ZodObject<{
48
98
  socialImageUrl: z.ZodOptional<z.ZodString>;
49
99
  status: z.ZodOptional<z.ZodString>;
50
100
  redirect: z.ZodOptional<z.ZodString>;
51
- documentType: z.ZodOptional<z.ZodEnum<["html", "xml"]>>;
101
+ documentType: z.ZodOptional<z.ZodEnum<["html", "xml", "text"]>>;
102
+ content: z.ZodOptional<z.ZodString>;
103
+ auth: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
104
+ login: z.ZodString;
105
+ password: z.ZodString;
106
+ method: z.ZodLiteral<"basic">;
107
+ }, "strip", z.ZodTypeAny, {
108
+ login: string;
109
+ password: string;
110
+ method: "basic";
111
+ }, {
112
+ login: string;
113
+ password: string;
114
+ method: "basic";
115
+ }>, {
116
+ login: string;
117
+ password: string;
118
+ method: "basic";
119
+ }, {
120
+ login: string;
121
+ password: string;
122
+ method: "basic";
123
+ }>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
124
+ login: z.ZodString;
125
+ password: z.ZodString;
126
+ type: z.ZodLiteral<"basic">;
127
+ }, "strip", z.ZodTypeAny, {
128
+ type: "basic";
129
+ login: string;
130
+ password: string;
131
+ }, {
132
+ type: "basic";
133
+ login: string;
134
+ password: string;
135
+ }>, {
136
+ type: "basic";
137
+ login: string;
138
+ password: string;
139
+ }, {
140
+ type: "basic";
141
+ login: string;
142
+ password: string;
143
+ }>, {
144
+ method: "basic";
145
+ login: string;
146
+ password: string;
147
+ }, {
148
+ type: "basic";
149
+ login: string;
150
+ password: string;
151
+ }>]>>;
52
152
  custom: z.ZodOptional<z.ZodArray<z.ZodObject<{
53
153
  property: z.ZodString;
54
154
  content: z.ZodString;
55
155
  }, "strip", z.ZodTypeAny, {
56
- property: string;
57
156
  content: string;
58
- }, {
59
157
  property: string;
158
+ }, {
60
159
  content: string;
160
+ property: string;
61
161
  }>, "many">>;
62
162
  }, "strip", z.ZodTypeAny, {
63
163
  status?: string | undefined;
64
164
  custom?: {
65
- property: string;
66
165
  content: string;
166
+ property: string;
67
167
  }[] | undefined;
68
168
  description?: string | undefined;
169
+ auth?: {
170
+ login: string;
171
+ password: string;
172
+ method: "basic";
173
+ } | {
174
+ method: "basic";
175
+ login: string;
176
+ password: string;
177
+ } | undefined;
178
+ content?: string | undefined;
69
179
  title?: string | undefined;
70
180
  excludePageFromSearch?: string | undefined;
71
181
  language?: string | undefined;
72
182
  socialImageAssetId?: string | undefined;
73
183
  socialImageUrl?: string | undefined;
74
184
  redirect?: string | undefined;
75
- documentType?: "html" | "xml" | undefined;
185
+ documentType?: "html" | "xml" | "text" | undefined;
76
186
  }, {
77
187
  status?: string | undefined;
78
188
  custom?: {
79
- property: string;
80
189
  content: string;
190
+ property: string;
81
191
  }[] | undefined;
82
192
  description?: string | undefined;
193
+ auth?: {
194
+ login: string;
195
+ password: string;
196
+ method: "basic";
197
+ } | {
198
+ type: "basic";
199
+ login: string;
200
+ password: string;
201
+ } | undefined;
202
+ content?: string | undefined;
83
203
  title?: string | undefined;
84
204
  excludePageFromSearch?: string | undefined;
85
205
  language?: string | undefined;
86
206
  socialImageAssetId?: string | undefined;
87
207
  socialImageUrl?: string | undefined;
88
208
  redirect?: string | undefined;
89
- documentType?: "html" | "xml" | undefined;
209
+ documentType?: "html" | "xml" | "text" | undefined;
90
210
  }>;
91
211
  marketplace: z.ZodOptional<z.ZodObject<{
92
212
  include: z.ZodOptional<z.ZodBoolean>;
@@ -107,17 +227,27 @@ declare const Page: z.ZodObject<{
107
227
  meta: {
108
228
  status?: string | undefined;
109
229
  custom?: {
110
- property: string;
111
230
  content: string;
231
+ property: string;
112
232
  }[] | undefined;
113
233
  description?: string | undefined;
234
+ auth?: {
235
+ login: string;
236
+ password: string;
237
+ method: "basic";
238
+ } | {
239
+ method: "basic";
240
+ login: string;
241
+ password: string;
242
+ } | undefined;
243
+ content?: string | undefined;
114
244
  title?: string | undefined;
115
245
  excludePageFromSearch?: string | undefined;
116
246
  language?: string | undefined;
117
247
  socialImageAssetId?: string | undefined;
118
248
  socialImageUrl?: string | undefined;
119
249
  redirect?: string | undefined;
120
- documentType?: "html" | "xml" | undefined;
250
+ documentType?: "html" | "xml" | "text" | undefined;
121
251
  };
122
252
  id: string;
123
253
  title: string;
@@ -135,17 +265,27 @@ declare const Page: z.ZodObject<{
135
265
  meta: {
136
266
  status?: string | undefined;
137
267
  custom?: {
138
- property: string;
139
268
  content: string;
269
+ property: string;
140
270
  }[] | undefined;
141
271
  description?: string | undefined;
272
+ auth?: {
273
+ login: string;
274
+ password: string;
275
+ method: "basic";
276
+ } | {
277
+ type: "basic";
278
+ login: string;
279
+ password: string;
280
+ } | undefined;
281
+ content?: string | undefined;
142
282
  title?: string | undefined;
143
283
  excludePageFromSearch?: string | undefined;
144
284
  language?: string | undefined;
145
285
  socialImageAssetId?: string | undefined;
146
286
  socialImageUrl?: string | undefined;
147
287
  redirect?: string | undefined;
148
- documentType?: "html" | "xml" | undefined;
288
+ documentType?: "html" | "xml" | "text" | undefined;
149
289
  };
150
290
  id: string;
151
291
  title: string;
@@ -163,13 +303,16 @@ declare const ProjectMeta: z.ZodObject<{
163
303
  contactEmail: z.ZodOptional<z.ZodString>;
164
304
  faviconAssetId: z.ZodOptional<z.ZodString>;
165
305
  code: z.ZodOptional<z.ZodString>;
306
+ auth: z.ZodOptional<z.ZodString>;
166
307
  }, "strip", z.ZodTypeAny, {
167
308
  code?: string | undefined;
309
+ auth?: string | undefined;
168
310
  siteName?: string | undefined;
169
311
  contactEmail?: string | undefined;
170
312
  faviconAssetId?: string | undefined;
171
313
  }, {
172
314
  code?: string | undefined;
315
+ auth?: string | undefined;
173
316
  siteName?: string | undefined;
174
317
  contactEmail?: string | undefined;
175
318
  faviconAssetId?: string | undefined;
@@ -205,13 +348,16 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
205
348
  contactEmail: z.ZodOptional<z.ZodString>;
206
349
  faviconAssetId: z.ZodOptional<z.ZodString>;
207
350
  code: z.ZodOptional<z.ZodString>;
351
+ auth: z.ZodOptional<z.ZodString>;
208
352
  }, "strip", z.ZodTypeAny, {
209
353
  code?: string | undefined;
354
+ auth?: string | undefined;
210
355
  siteName?: string | undefined;
211
356
  contactEmail?: string | undefined;
212
357
  faviconAssetId?: string | undefined;
213
358
  }, {
214
359
  code?: string | undefined;
360
+ auth?: string | undefined;
215
361
  siteName?: string | undefined;
216
362
  contactEmail?: string | undefined;
217
363
  faviconAssetId?: string | undefined;
@@ -255,45 +401,115 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
255
401
  socialImageUrl: z.ZodOptional<z.ZodString>;
256
402
  status: z.ZodOptional<z.ZodString>;
257
403
  redirect: z.ZodOptional<z.ZodString>;
258
- documentType: z.ZodOptional<z.ZodEnum<["html", "xml"]>>;
404
+ documentType: z.ZodOptional<z.ZodEnum<["html", "xml", "text"]>>;
405
+ content: z.ZodOptional<z.ZodString>;
406
+ auth: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
407
+ login: z.ZodString;
408
+ password: z.ZodString;
409
+ method: z.ZodLiteral<"basic">;
410
+ }, "strip", z.ZodTypeAny, {
411
+ login: string;
412
+ password: string;
413
+ method: "basic";
414
+ }, {
415
+ login: string;
416
+ password: string;
417
+ method: "basic";
418
+ }>, {
419
+ login: string;
420
+ password: string;
421
+ method: "basic";
422
+ }, {
423
+ login: string;
424
+ password: string;
425
+ method: "basic";
426
+ }>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
427
+ login: z.ZodString;
428
+ password: z.ZodString;
429
+ type: z.ZodLiteral<"basic">;
430
+ }, "strip", z.ZodTypeAny, {
431
+ type: "basic";
432
+ login: string;
433
+ password: string;
434
+ }, {
435
+ type: "basic";
436
+ login: string;
437
+ password: string;
438
+ }>, {
439
+ type: "basic";
440
+ login: string;
441
+ password: string;
442
+ }, {
443
+ type: "basic";
444
+ login: string;
445
+ password: string;
446
+ }>, {
447
+ method: "basic";
448
+ login: string;
449
+ password: string;
450
+ }, {
451
+ type: "basic";
452
+ login: string;
453
+ password: string;
454
+ }>]>>;
259
455
  custom: z.ZodOptional<z.ZodArray<z.ZodObject<{
260
456
  property: z.ZodString;
261
457
  content: z.ZodString;
262
458
  }, "strip", z.ZodTypeAny, {
263
- property: string;
264
459
  content: string;
265
- }, {
266
460
  property: string;
461
+ }, {
267
462
  content: string;
463
+ property: string;
268
464
  }>, "many">>;
269
465
  }, "strip", z.ZodTypeAny, {
270
466
  status?: string | undefined;
271
467
  custom?: {
272
- property: string;
273
468
  content: string;
469
+ property: string;
274
470
  }[] | undefined;
275
471
  description?: string | undefined;
472
+ auth?: {
473
+ login: string;
474
+ password: string;
475
+ method: "basic";
476
+ } | {
477
+ method: "basic";
478
+ login: string;
479
+ password: string;
480
+ } | undefined;
481
+ content?: string | undefined;
276
482
  title?: string | undefined;
277
483
  excludePageFromSearch?: string | undefined;
278
484
  language?: string | undefined;
279
485
  socialImageAssetId?: string | undefined;
280
486
  socialImageUrl?: string | undefined;
281
487
  redirect?: string | undefined;
282
- documentType?: "html" | "xml" | undefined;
488
+ documentType?: "html" | "xml" | "text" | undefined;
283
489
  }, {
284
490
  status?: string | undefined;
285
491
  custom?: {
286
- property: string;
287
492
  content: string;
493
+ property: string;
288
494
  }[] | undefined;
289
495
  description?: string | undefined;
496
+ auth?: {
497
+ login: string;
498
+ password: string;
499
+ method: "basic";
500
+ } | {
501
+ type: "basic";
502
+ login: string;
503
+ password: string;
504
+ } | undefined;
505
+ content?: string | undefined;
290
506
  title?: string | undefined;
291
507
  excludePageFromSearch?: string | undefined;
292
508
  language?: string | undefined;
293
509
  socialImageAssetId?: string | undefined;
294
510
  socialImageUrl?: string | undefined;
295
511
  redirect?: string | undefined;
296
- documentType?: "html" | "xml" | undefined;
512
+ documentType?: "html" | "xml" | "text" | undefined;
297
513
  }>;
298
514
  marketplace: z.ZodOptional<z.ZodObject<{
299
515
  include: z.ZodOptional<z.ZodBoolean>;
@@ -314,17 +530,27 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
314
530
  meta: {
315
531
  status?: string | undefined;
316
532
  custom?: {
317
- property: string;
318
533
  content: string;
534
+ property: string;
319
535
  }[] | undefined;
320
536
  description?: string | undefined;
537
+ auth?: {
538
+ login: string;
539
+ password: string;
540
+ method: "basic";
541
+ } | {
542
+ method: "basic";
543
+ login: string;
544
+ password: string;
545
+ } | undefined;
546
+ content?: string | undefined;
321
547
  title?: string | undefined;
322
548
  excludePageFromSearch?: string | undefined;
323
549
  language?: string | undefined;
324
550
  socialImageAssetId?: string | undefined;
325
551
  socialImageUrl?: string | undefined;
326
552
  redirect?: string | undefined;
327
- documentType?: "html" | "xml" | undefined;
553
+ documentType?: "html" | "xml" | "text" | undefined;
328
554
  };
329
555
  id: string;
330
556
  title: string;
@@ -342,17 +568,27 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
342
568
  meta: {
343
569
  status?: string | undefined;
344
570
  custom?: {
345
- property: string;
346
571
  content: string;
572
+ property: string;
347
573
  }[] | undefined;
348
574
  description?: string | undefined;
575
+ auth?: {
576
+ login: string;
577
+ password: string;
578
+ method: "basic";
579
+ } | {
580
+ type: "basic";
581
+ login: string;
582
+ password: string;
583
+ } | undefined;
584
+ content?: string | undefined;
349
585
  title?: string | undefined;
350
586
  excludePageFromSearch?: string | undefined;
351
587
  language?: string | undefined;
352
588
  socialImageAssetId?: string | undefined;
353
589
  socialImageUrl?: string | undefined;
354
590
  redirect?: string | undefined;
355
- documentType?: "html" | "xml" | undefined;
591
+ documentType?: "html" | "xml" | "text" | undefined;
356
592
  };
357
593
  id: string;
358
594
  title: string;
@@ -392,25 +628,33 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
392
628
  children: string[];
393
629
  }>>;
394
630
  }, "strip", z.ZodTypeAny, {
395
- homePageId: string;
396
- rootFolderId: string;
397
631
  pages: Map<string, {
398
632
  path: string;
399
633
  name: string;
400
634
  meta: {
401
635
  status?: string | undefined;
402
636
  custom?: {
403
- property: string;
404
637
  content: string;
638
+ property: string;
405
639
  }[] | undefined;
406
640
  description?: string | undefined;
641
+ auth?: {
642
+ login: string;
643
+ password: string;
644
+ method: "basic";
645
+ } | {
646
+ method: "basic";
647
+ login: string;
648
+ password: string;
649
+ } | undefined;
650
+ content?: string | undefined;
407
651
  title?: string | undefined;
408
652
  excludePageFromSearch?: string | undefined;
409
653
  language?: string | undefined;
410
654
  socialImageAssetId?: string | undefined;
411
655
  socialImageUrl?: string | undefined;
412
656
  redirect?: string | undefined;
413
- documentType?: "html" | "xml" | undefined;
657
+ documentType?: "html" | "xml" | "text" | undefined;
414
658
  };
415
659
  id: string;
416
660
  title: string;
@@ -423,6 +667,8 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
423
667
  thumbnailAssetId?: string | undefined;
424
668
  } | undefined;
425
669
  }>;
670
+ homePageId: string;
671
+ rootFolderId: string;
426
672
  folders: Map<string, {
427
673
  name: string;
428
674
  id: string;
@@ -431,6 +677,7 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
431
677
  }>;
432
678
  meta?: {
433
679
  code?: string | undefined;
680
+ auth?: string | undefined;
434
681
  siteName?: string | undefined;
435
682
  contactEmail?: string | undefined;
436
683
  faviconAssetId?: string | undefined;
@@ -444,25 +691,33 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
444
691
  status?: "301" | "302" | undefined;
445
692
  }[] | undefined;
446
693
  }, {
447
- homePageId: string;
448
- rootFolderId: string;
449
694
  pages: Map<string, {
450
695
  path: string;
451
696
  name: string;
452
697
  meta: {
453
698
  status?: string | undefined;
454
699
  custom?: {
455
- property: string;
456
700
  content: string;
701
+ property: string;
457
702
  }[] | undefined;
458
703
  description?: string | undefined;
704
+ auth?: {
705
+ login: string;
706
+ password: string;
707
+ method: "basic";
708
+ } | {
709
+ type: "basic";
710
+ login: string;
711
+ password: string;
712
+ } | undefined;
713
+ content?: string | undefined;
459
714
  title?: string | undefined;
460
715
  excludePageFromSearch?: string | undefined;
461
716
  language?: string | undefined;
462
717
  socialImageAssetId?: string | undefined;
463
718
  socialImageUrl?: string | undefined;
464
719
  redirect?: string | undefined;
465
- documentType?: "html" | "xml" | undefined;
720
+ documentType?: "html" | "xml" | "text" | undefined;
466
721
  };
467
722
  id: string;
468
723
  title: string;
@@ -475,6 +730,8 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
475
730
  thumbnailAssetId?: string | undefined;
476
731
  } | undefined;
477
732
  }>;
733
+ homePageId: string;
734
+ rootFolderId: string;
478
735
  folders: Map<string, {
479
736
  name: string;
480
737
  id: string;
@@ -483,6 +740,7 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
483
740
  }>;
484
741
  meta?: {
485
742
  code?: string | undefined;
743
+ auth?: string | undefined;
486
744
  siteName?: string | undefined;
487
745
  contactEmail?: string | undefined;
488
746
  faviconAssetId?: string | undefined;
@@ -496,25 +754,33 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
496
754
  status?: "301" | "302" | undefined;
497
755
  }[] | undefined;
498
756
  }>, {
499
- homePageId: string;
500
- rootFolderId: string;
501
757
  pages: Map<string, {
502
758
  path: string;
503
759
  name: string;
504
760
  meta: {
505
761
  status?: string | undefined;
506
762
  custom?: {
507
- property: string;
508
763
  content: string;
764
+ property: string;
509
765
  }[] | undefined;
510
766
  description?: string | undefined;
767
+ auth?: {
768
+ login: string;
769
+ password: string;
770
+ method: "basic";
771
+ } | {
772
+ method: "basic";
773
+ login: string;
774
+ password: string;
775
+ } | undefined;
776
+ content?: string | undefined;
511
777
  title?: string | undefined;
512
778
  excludePageFromSearch?: string | undefined;
513
779
  language?: string | undefined;
514
780
  socialImageAssetId?: string | undefined;
515
781
  socialImageUrl?: string | undefined;
516
782
  redirect?: string | undefined;
517
- documentType?: "html" | "xml" | undefined;
783
+ documentType?: "html" | "xml" | "text" | undefined;
518
784
  };
519
785
  id: string;
520
786
  title: string;
@@ -527,6 +793,8 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
527
793
  thumbnailAssetId?: string | undefined;
528
794
  } | undefined;
529
795
  }>;
796
+ homePageId: string;
797
+ rootFolderId: string;
530
798
  folders: Map<string, {
531
799
  name: string;
532
800
  id: string;
@@ -535,6 +803,7 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
535
803
  }>;
536
804
  meta?: {
537
805
  code?: string | undefined;
806
+ auth?: string | undefined;
538
807
  siteName?: string | undefined;
539
808
  contactEmail?: string | undefined;
540
809
  faviconAssetId?: string | undefined;
@@ -548,25 +817,33 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
548
817
  status?: "301" | "302" | undefined;
549
818
  }[] | undefined;
550
819
  }, {
551
- homePageId: string;
552
- rootFolderId: string;
553
820
  pages: Map<string, {
554
821
  path: string;
555
822
  name: string;
556
823
  meta: {
557
824
  status?: string | undefined;
558
825
  custom?: {
559
- property: string;
560
826
  content: string;
827
+ property: string;
561
828
  }[] | undefined;
562
829
  description?: string | undefined;
830
+ auth?: {
831
+ login: string;
832
+ password: string;
833
+ method: "basic";
834
+ } | {
835
+ type: "basic";
836
+ login: string;
837
+ password: string;
838
+ } | undefined;
839
+ content?: string | undefined;
563
840
  title?: string | undefined;
564
841
  excludePageFromSearch?: string | undefined;
565
842
  language?: string | undefined;
566
843
  socialImageAssetId?: string | undefined;
567
844
  socialImageUrl?: string | undefined;
568
845
  redirect?: string | undefined;
569
- documentType?: "html" | "xml" | undefined;
846
+ documentType?: "html" | "xml" | "text" | undefined;
570
847
  };
571
848
  id: string;
572
849
  title: string;
@@ -579,6 +856,8 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
579
856
  thumbnailAssetId?: string | undefined;
580
857
  } | undefined;
581
858
  }>;
859
+ homePageId: string;
860
+ rootFolderId: string;
582
861
  folders: Map<string, {
583
862
  name: string;
584
863
  id: string;
@@ -587,6 +866,7 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
587
866
  }>;
588
867
  meta?: {
589
868
  code?: string | undefined;
869
+ auth?: string | undefined;
590
870
  siteName?: string | undefined;
591
871
  contactEmail?: string | undefined;
592
872
  faviconAssetId?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk",
3
- "version": "0.267.0",
3
+ "version": "0.268.0",
4
4
  "description": "Webstudio project data schema",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -46,15 +46,16 @@
46
46
  "type-fest": "^4.37.0",
47
47
  "warn-once": "^0.1.1",
48
48
  "zod": "^3.24.2",
49
- "@webstudio-is/fonts": "0.267.0",
50
- "@webstudio-is/icons": "0.267.0",
51
- "@webstudio-is/css-engine": "0.267.0"
49
+ "@webstudio-is/css-engine": "0.268.0",
50
+ "@webstudio-is/icons": "0.268.0",
51
+ "@webstudio-is/wsauth": "0.268.0",
52
+ "@webstudio-is/fonts": "0.268.0"
52
53
  },
53
54
  "devDependencies": {
54
55
  "html-tags": "^4.0.0",
55
56
  "vitest": "^3.1.2",
56
- "@webstudio-is/template": "0.267.0",
57
- "@webstudio-is/css-data": "0.267.0",
57
+ "@webstudio-is/css-data": "0.268.0",
58
+ "@webstudio-is/template": "0.268.0",
58
59
  "@webstudio-is/tsconfig": "1.0.7"
59
60
  },
60
61
  "scripts": {