@panneau/protocol 5.0.0-alpha.15 → 5.0.0-alpha.17
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/dist/addresses.d.ts +23 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +52 -0
- package/dist/addresses.js.map +1 -0
- package/dist/conformance/index.d.ts.map +1 -1
- package/dist/conformance/index.js +109 -0
- package/dist/conformance/index.js.map +1 -1
- package/dist/constants.d.ts +23 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +51 -3
- package/dist/constants.js.map +1 -1
- package/dist/currencies.d.ts +22 -0
- package/dist/currencies.d.ts.map +1 -0
- package/dist/currencies.js +231 -0
- package/dist/currencies.js.map +1 -0
- package/dist/index.js +7 -4
- package/dist/links.d.ts +38 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +65 -0
- package/dist/links.js.map +1 -0
- package/dist/lint.js +6 -2
- package/dist/lint.js.map +1 -1
- package/dist/mock/index.d.ts.map +1 -1
- package/dist/mock/index.js +11 -2
- package/dist/mock/index.js.map +1 -1
- package/dist/query.d.ts +4 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +23 -7
- package/dist/query.js.map +1 -1
- package/dist/rules.d.ts +4 -1
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +165 -7
- package/dist/rules.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -2
- package/dist/schemas/action.d.ts +46 -1
- package/dist/schemas/action.d.ts.map +1 -1
- package/dist/schemas/api.d.ts +43 -3
- package/dist/schemas/api.d.ts.map +1 -1
- package/dist/schemas/api.js +35 -1
- package/dist/schemas/api.js.map +1 -1
- package/dist/schemas/definition.d.ts +93 -3
- package/dist/schemas/definition.d.ts.map +1 -1
- package/dist/schemas/field.d.ts +193 -2
- package/dist/schemas/field.d.ts.map +1 -1
- package/dist/schemas/field.js +91 -7
- package/dist/schemas/field.js.map +1 -1
- package/dist/schemas/index.d.ts +445 -14
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +14 -4
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/list.d.ts +2 -2
- package/dist/schemas/resource.d.ts +93 -3
- package/dist/schemas/resource.d.ts.map +1 -1
- package/dist/validate.d.ts +2 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +18 -4
- package/dist/validate.js.map +1 -1
- package/package.json +1 -1
- package/schema/boot.schema.json +164 -2
- package/schema/definition.schema.json +164 -2
- package/schema/openapi.json +611 -5
package/dist/rules.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { PORTABLE_RULES } from "./constants.js";
|
|
2
|
+
import { isCurrencyCode } from "./currencies.js";
|
|
3
|
+
import { getAddressRequiredParts, isPostalCode } from "./addresses.js";
|
|
2
4
|
import { getValue, isFilled, isRecord } from "./values.js";
|
|
3
5
|
import { evaluateCondition } from "./conditions.js";
|
|
6
|
+
import { getLinkTypes } from "./links.js";
|
|
4
7
|
import { matchesRatio, renderedCropSize } from "./transforms.js";
|
|
5
8
|
//#region src/rules.ts
|
|
6
9
|
var EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
7
10
|
/** An international phone number in E.164: `+`, then 7 to 15 digits, without a leading zero. */
|
|
8
11
|
var TEL = /^\+[1-9]\d{6,14}$/;
|
|
12
|
+
/** The same number, with an optional extension after `;ext=` (RFC 3966): `+15145550199;ext=123`. */
|
|
13
|
+
var TEL_EXTENSION = /^\+[1-9]\d{6,14}(?:;ext=\d{1,10})?$/;
|
|
9
14
|
function isKnownRule(rule) {
|
|
10
15
|
return PORTABLE_RULES.includes(rule.rule);
|
|
11
16
|
}
|
|
@@ -24,6 +29,7 @@ function failure(rule) {
|
|
|
24
29
|
}
|
|
25
30
|
function sizeOf(value) {
|
|
26
31
|
if (typeof value === "number") return value;
|
|
32
|
+
if (isRecord(value) && "currency" in value && typeof value.amount === "number") return value.amount;
|
|
27
33
|
if (typeof value === "string" || Array.isArray(value)) return value.length;
|
|
28
34
|
return null;
|
|
29
35
|
}
|
|
@@ -53,6 +59,43 @@ function hasCrop(value, rule) {
|
|
|
53
59
|
return ratios.length === 0 || ratios.some((ratio) => matchesRatio(size.width, size.height, ratio));
|
|
54
60
|
});
|
|
55
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Whether an `embed` value comes from one of the providers, compared without case (decision 0058).
|
|
64
|
+
* A value without a `provider` (an app without `GET /embeds`) is left to the backend.
|
|
65
|
+
*/
|
|
66
|
+
function hasProvider(value, providers) {
|
|
67
|
+
if (!isRecord(value) || typeof value.provider !== "string") return true;
|
|
68
|
+
const provider = value.provider.toLowerCase();
|
|
69
|
+
return providers.some((allowed) => typeof allowed === "string" && allowed.toLowerCase() === provider);
|
|
70
|
+
}
|
|
71
|
+
var DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
72
|
+
var DATE_TIME = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/;
|
|
73
|
+
/** A bound of a `daterange`: a day or a date-time, `null` when empty, `undefined` when invalid. */
|
|
74
|
+
function rangeBound(value) {
|
|
75
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
76
|
+
if (typeof value !== "string" || !(DAY.test(value) || DATE_TIME.test(value))) return;
|
|
77
|
+
return toTime(value) !== null ? value : void 0;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* What a `daterange` value fails (decision 0053): a bound that is missing or invalid where the range
|
|
81
|
+
* isn't open (`start`, `end`), or an end before the start (`order`). `null` when it is valid.
|
|
82
|
+
*/
|
|
83
|
+
function checkDateRange(value, open) {
|
|
84
|
+
if (!isRecord(value)) return "start";
|
|
85
|
+
const start = rangeBound(value.start);
|
|
86
|
+
const end = rangeBound(value.end);
|
|
87
|
+
const openStart = open === "start" || open === "both";
|
|
88
|
+
const openEnd = open === "end" || open === "both";
|
|
89
|
+
if (start === void 0 || start === null && !openStart) return "start";
|
|
90
|
+
if (end === void 0 || end === null && !openEnd) return "end";
|
|
91
|
+
if (start === null || end === null) return null;
|
|
92
|
+
return (DAY.test(start) && DAY.test(end) ? end < start : toTime(end) < toTime(start)) ? "order" : null;
|
|
93
|
+
}
|
|
94
|
+
/** Whether a `money` value has an integer amount, and a currency that the rule allows. */
|
|
95
|
+
function isMoney(value, currencies) {
|
|
96
|
+
if (!isRecord(value) || !Number.isSafeInteger(value.amount)) return false;
|
|
97
|
+
return Array.isArray(currencies) && currencies.length > 0 ? currencies.includes(value.currency) : isCurrencyCode(value.currency);
|
|
98
|
+
}
|
|
56
99
|
function toTime(value) {
|
|
57
100
|
if (typeof value !== "string" && typeof value !== "number") return null;
|
|
58
101
|
const time = new Date(value).getTime();
|
|
@@ -72,6 +115,7 @@ function checkRules(rules, value, root = {}, mode) {
|
|
|
72
115
|
}
|
|
73
116
|
if (!filled) return;
|
|
74
117
|
let valid = true;
|
|
118
|
+
let detail = null;
|
|
75
119
|
switch (rule.rule) {
|
|
76
120
|
case "min":
|
|
77
121
|
case "max": {
|
|
@@ -93,7 +137,19 @@ function checkRules(rules, value, root = {}, mode) {
|
|
|
93
137
|
valid = isRecord(value) || Array.isArray(value);
|
|
94
138
|
break;
|
|
95
139
|
case "tel":
|
|
96
|
-
valid = typeof value !== "string" || TEL.test(value);
|
|
140
|
+
valid = typeof value !== "string" || (rule.extension === true ? TEL_EXTENSION : TEL).test(value);
|
|
141
|
+
break;
|
|
142
|
+
case "postalCode": {
|
|
143
|
+
const country = isRecord(rule.value) ? getValue(root, String(rule.value.field)) : rule.value;
|
|
144
|
+
valid = typeof value !== "string" || isPostalCode(value, typeof country === "string" ? country : null);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
case "daterange":
|
|
148
|
+
detail = checkDateRange(value, rule.open);
|
|
149
|
+
valid = detail === null;
|
|
150
|
+
break;
|
|
151
|
+
case "money":
|
|
152
|
+
valid = isMoney(value, rule.currencies);
|
|
97
153
|
break;
|
|
98
154
|
case "in": {
|
|
99
155
|
const allowed = rule.value;
|
|
@@ -109,6 +165,9 @@ function checkRules(rules, value, root = {}, mode) {
|
|
|
109
165
|
case "crop":
|
|
110
166
|
valid = !isRecord(rule.value) || hasCrop(value, rule.value);
|
|
111
167
|
break;
|
|
168
|
+
case "providers":
|
|
169
|
+
valid = hasProvider(value, rule.value);
|
|
170
|
+
break;
|
|
112
171
|
case "before":
|
|
113
172
|
case "after": {
|
|
114
173
|
const bound = rule.value;
|
|
@@ -118,27 +177,124 @@ function checkRules(rules, value, root = {}, mode) {
|
|
|
118
177
|
break;
|
|
119
178
|
}
|
|
120
179
|
}
|
|
121
|
-
if (!valid) failures.push(
|
|
180
|
+
if (!valid) failures.push(detail !== null ? {
|
|
181
|
+
...failure(rule),
|
|
182
|
+
value: detail
|
|
183
|
+
} : failure(rule));
|
|
122
184
|
});
|
|
123
185
|
return failures;
|
|
124
186
|
}
|
|
125
187
|
function addFailures(context, path, failures) {
|
|
126
188
|
if (failures.length > 0) context.failures[path] = [...context.failures[path] ?? [], ...failures];
|
|
127
189
|
}
|
|
128
|
-
/**
|
|
190
|
+
/** A string setting of a field. */
|
|
191
|
+
function stringSetting(field, key) {
|
|
192
|
+
const value = field.settings?.[key];
|
|
193
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* The rule each type implies: its values are checked whatever rules the field lists. `tel`,
|
|
197
|
+
* `daterange` and `money` carry settings of their field: the extension, the open bounds, the
|
|
198
|
+
* allowed currencies.
|
|
199
|
+
*/
|
|
129
200
|
var IMPLIED_RULES = {
|
|
130
|
-
json: { rule: "json" },
|
|
131
|
-
tel:
|
|
201
|
+
json: () => ({ rule: "json" }),
|
|
202
|
+
tel: (field) => field.settings?.extension === true ? {
|
|
203
|
+
rule: "tel",
|
|
204
|
+
extension: true
|
|
205
|
+
} : { rule: "tel" },
|
|
206
|
+
daterange: (field) => {
|
|
207
|
+
const open = stringSetting(field, "open");
|
|
208
|
+
return {
|
|
209
|
+
rule: "daterange",
|
|
210
|
+
...open !== void 0 ? { open } : {}
|
|
211
|
+
};
|
|
212
|
+
},
|
|
213
|
+
money: (field) => {
|
|
214
|
+
const currency = stringSetting(field, "currency");
|
|
215
|
+
const listed = field.settings?.currencies;
|
|
216
|
+
const currencies = currency !== void 0 ? [currency] : Array.isArray(listed) ? listed.filter((code) => typeof code === "string") : [];
|
|
217
|
+
return {
|
|
218
|
+
rule: "money",
|
|
219
|
+
...currencies.length > 0 ? { currencies } : {}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
132
222
|
};
|
|
133
223
|
/**
|
|
134
224
|
* The rules of a field that apply in the mode, with the one its type implies: `json` for the
|
|
135
|
-
* `json` type, `tel` for
|
|
225
|
+
* `json` type, `tel` for `tel`, `daterange` for `daterange` and `money` for `money`. A rule of
|
|
226
|
+
* the same name on the field wins.
|
|
136
227
|
*/
|
|
137
228
|
function rulesOf(field, mode) {
|
|
138
229
|
const rules = (field.rules ?? []).filter((rule) => appliesIn(rule, mode));
|
|
139
|
-
const implied = IMPLIED_RULES[field.type];
|
|
230
|
+
const implied = IMPLIED_RULES[field.type]?.(field);
|
|
140
231
|
return implied !== void 0 && !rules.some((rule) => rule.rule === implied.rule) ? [...rules, implied] : rules;
|
|
141
232
|
}
|
|
233
|
+
/** The parts that make an address filled: a country or a point alone don't. */
|
|
234
|
+
var ADDRESS_TEXT_PARTS = [
|
|
235
|
+
"street",
|
|
236
|
+
"unit",
|
|
237
|
+
"city",
|
|
238
|
+
"region",
|
|
239
|
+
"postalCode"
|
|
240
|
+
];
|
|
241
|
+
/**
|
|
242
|
+
* The checks of the parts of an `address` (decision 0054): a filled address, with a part other
|
|
243
|
+
* than its country, has its required parts, and a postal code of its country.
|
|
244
|
+
*/
|
|
245
|
+
function checkAddress(field, value, path, context) {
|
|
246
|
+
if (!isRecord(value) || !ADDRESS_TEXT_PARTS.some((part) => isFilled(value[part]))) return;
|
|
247
|
+
getAddressRequiredParts(field).forEach((part) => {
|
|
248
|
+
if (!isFilled(value[part])) addFailures(context, `${path}.${part}`, [{ rule: "required" }]);
|
|
249
|
+
});
|
|
250
|
+
const { postalCode, country } = value;
|
|
251
|
+
if (typeof postalCode === "string" && isFilled(postalCode) && !isPostalCode(postalCode, typeof country === "string" ? country : null)) addFailures(context, `${path}.postalCode`, [{ rule: "postalCode" }]);
|
|
252
|
+
}
|
|
253
|
+
/** Whether a string is an email address. */
|
|
254
|
+
var isEmail = (text) => EMAIL.test(text);
|
|
255
|
+
/** Whether the `url` of a link of a type is valid: the `rule` it fails, or `null`. */
|
|
256
|
+
function checkLinkUrl(type, url, pattern) {
|
|
257
|
+
switch (type) {
|
|
258
|
+
case "url": return /^https?:\/\//i.test(url) && URL.canParse(url) ? null : "url";
|
|
259
|
+
case "email": return /^mailto:/i.test(url) && isEmail(url.slice(7).split("?")[0] ?? "") ? null : "email";
|
|
260
|
+
case "tel": return /^tel:/i.test(url) && TEL.test(url.slice(4)) ? null : "tel";
|
|
261
|
+
default: return pattern === void 0 || new RegExp(pattern).test(url) ? null : "pattern";
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The checks of the parts of a `link` (decision 0055): a type of the field, the URL of its type,
|
|
266
|
+
* its page or its file, and its label when the field requires one.
|
|
267
|
+
*/
|
|
268
|
+
function checkLink(field, value, path, context) {
|
|
269
|
+
if (!isRecord(value)) return;
|
|
270
|
+
const types = getLinkTypes(field);
|
|
271
|
+
const type = types.find((candidate) => candidate.id === value.type);
|
|
272
|
+
if (type === void 0) {
|
|
273
|
+
addFailures(context, `${path}.type`, [{
|
|
274
|
+
rule: "in",
|
|
275
|
+
value: types.map((candidate) => candidate.id)
|
|
276
|
+
}]);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (type.id === "page" || type.id === "file") {
|
|
280
|
+
if (!isFilled(value[type.id])) addFailures(context, `${path}.${type.id}`, [{ rule: "required" }]);
|
|
281
|
+
} else if (typeof value.url !== "string" || !isFilled(value.url)) addFailures(context, `${path}.url`, [{ rule: "required" }]);
|
|
282
|
+
else {
|
|
283
|
+
const failed = checkLinkUrl(type.id, value.url.trim(), type.pattern);
|
|
284
|
+
if (failed !== null) addFailures(context, `${path}.url`, [failed === "pattern" ? {
|
|
285
|
+
rule: "pattern",
|
|
286
|
+
value: type.pattern
|
|
287
|
+
} : { rule: failed }]);
|
|
288
|
+
}
|
|
289
|
+
const label = value.label;
|
|
290
|
+
const hasLabel = isRecord(label) ? Object.values(label).some(isFilled) : isFilled(label);
|
|
291
|
+
if (field.settings?.label === "required" && !hasLabel) addFailures(context, `${path}.label`, [{ rule: "required" }]);
|
|
292
|
+
}
|
|
293
|
+
/** The checks of the parts of a value that the field's type implies. */
|
|
294
|
+
function checkParts(field, value, path, context) {
|
|
295
|
+
if (field.type === "address") checkAddress(field, value, path, context);
|
|
296
|
+
else if (field.type === "link") checkLink(field, value, path, context);
|
|
297
|
+
}
|
|
142
298
|
function checkFieldValue(field, value, path, context) {
|
|
143
299
|
const rules = rulesOf(field, context.mode);
|
|
144
300
|
if (field.localized === true) {
|
|
@@ -155,10 +311,12 @@ function checkFieldValue(field, value, path, context) {
|
|
|
155
311
|
}
|
|
156
312
|
Object.entries(localized).forEach(([locale, localeValue]) => {
|
|
157
313
|
addFailures(context, `${path}.${locale}`, checkRules(others, localeValue, context.root, context.mode));
|
|
314
|
+
checkParts(field, localeValue, `${path}.${locale}`, context);
|
|
158
315
|
});
|
|
159
316
|
return;
|
|
160
317
|
}
|
|
161
318
|
addFailures(context, path, checkRules(rules, value, context.root, context.mode));
|
|
319
|
+
checkParts(field, value, path, context);
|
|
162
320
|
if (field.type === "group" && field.fields !== void 0 && isRecord(value)) checkFields(field.fields, value, `${path}.`, context);
|
|
163
321
|
if (field.type === "repeater" && Array.isArray(value)) value.forEach((item, index) => {
|
|
164
322
|
if (!isRecord(item)) return;
|
package/dist/rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","names":[],"sources":["../src/rules.ts"],"sourcesContent":["import { evaluateCondition } from './conditions';\nimport { PORTABLE_RULES } from './constants';\nimport type { Field, Rule } from './schemas/field';\nimport { matchesRatio, renderedCropSize } from './transforms';\nimport { getValue, isFilled, isRecord } from './values';\n\n/** A rule that a value doesn't satisfy. */\nexport interface RuleFailure {\n rule: string;\n /** The rule's parameter (`max: 120` gives `120`). */\n value?: unknown;\n /** The message set on the rule, if any. */\n message?: string;\n}\n\nexport interface CheckOptions {\n /**\n * Locales a `required` localized field must be filled in. Without it, one filled locale is\n * enough.\n */\n locales?: string[];\n /** `create` skips `updateOnly` fields; `update` skips `createOnly` fields. */\n mode?: 'create' | 'update';\n /** Only check the fields present in the values (partial updates). */\n partial?: boolean;\n /**\n * The values of the item being updated. With `partial`, conditions (`visibleWhen`) and rules\n * that read other fields read them for the fields that aren't in the values: a field shown\n * when `status` is `published`, sent alone, is checked on a published item (decision 0043).\n */\n item?: Record<string, unknown>;\n}\n\ninterface Context extends CheckOptions {\n /** The whole form, for `visibleWhen` and date rules that reference other fields. */\n root: Record<string, unknown>;\n failures: Record<string, RuleFailure[]>;\n}\n\nconst EMAIL = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n/** An international phone number in E.164: `+`, then 7 to 15 digits, without a leading zero. */\nconst TEL = /^\\+[1-9]\\d{6,14}$/;\n\nfunction isKnownRule(rule: Rule): boolean {\n return (PORTABLE_RULES as readonly string[]).includes(rule.rule);\n}\n\n/**\n * Whether a rule applies in a mode: a rule with a `mode` applies only in that mode, and not when the\n * mode isn't known.\n */\nfunction appliesIn(rule: Rule, mode: CheckOptions['mode']): boolean {\n return rule.mode === undefined || rule.mode === mode;\n}\n\nfunction failure(rule: Rule): RuleFailure {\n const result: RuleFailure = { rule: rule.rule };\n if ('value' in rule && rule.value !== undefined) {\n result.value = rule.value;\n }\n if (rule.message !== undefined) {\n result.message = rule.message;\n }\n return result;\n}\n\nfunction sizeOf(value: unknown): number | null {\n if (typeof value === 'number') {\n return value;\n }\n if (typeof value === 'string' || Array.isArray(value)) {\n return value.length;\n }\n return null;\n}\n\nfunction matchesMime(mime: string, patterns: string[]): boolean {\n return patterns.some((pattern) => {\n if (pattern.endsWith('/*')) {\n return mime.startsWith(pattern.slice(0, -1));\n }\n return mime === pattern;\n });\n}\n\n/** The files of a value, with their MIME type and size: stored files, or chosen ones (`File`). */\nfunction mediaList(value: unknown): Record<string, unknown>[] {\n const list = Array.isArray(value) ? value : [value];\n return list\n .filter(isRecord)\n .map((media) =>\n typeof Blob !== 'undefined' && media instanceof Blob\n ? { mime: media.type === '' ? undefined : media.type, size: media.size }\n : media,\n );\n}\n\n/**\n * Whether each image of a value has the crop the `crop` rule asks for (decision 0031): a crop when\n * it is required, and one of the ratios once rendered. An id alone has no crop.\n */\nfunction hasCrop(value: unknown, rule: { ratios?: string[]; required?: boolean }): boolean {\n const entries = Array.isArray(value) ? value : [value];\n return entries.every((entry) => {\n const transform = isRecord(entry) && isRecord(entry.transform) ? entry.transform : {};\n const size = renderedCropSize(transform);\n if (size === null) {\n return rule.required !== true;\n }\n const ratios = rule.ratios ?? [];\n return (\n ratios.length === 0 ||\n ratios.some((ratio) => matchesRatio(size.width, size.height, ratio))\n );\n });\n}\n\nfunction toTime(value: unknown): number | null {\n if (typeof value !== 'string' && typeof value !== 'number') {\n return null;\n }\n const time = new Date(value).getTime();\n return Number.isNaN(time) ? null : time;\n}\n\n/**\n * Checks one value against a field's rules. Returns the rules that fail. Rules limited to a `mode`\n * only apply when it is given.\n */\nexport function checkRules(\n rules: Rule[],\n value: unknown,\n root: Record<string, unknown> = {},\n mode?: CheckOptions['mode'],\n): RuleFailure[] {\n const failures: RuleFailure[] = [];\n const filled = isFilled(value);\n const applying = rules.filter((rule) => isKnownRule(rule) && appliesIn(rule, mode));\n applying.forEach((rule) => {\n if (rule.rule === 'required') {\n if (!filled) {\n failures.push(failure(rule));\n }\n return;\n }\n if (!filled) {\n return;\n }\n let valid = true;\n switch (rule.rule) {\n case 'min':\n case 'max': {\n const size = sizeOf(value);\n const limit = rule.value as number;\n valid = size === null || (rule.rule === 'min' ? size >= limit : size <= limit);\n break;\n }\n case 'pattern':\n valid =\n typeof value !== 'string' ||\n new RegExp(rule.value as string, (rule as { flags?: string }).flags).test(\n value,\n );\n break;\n case 'email':\n valid = typeof value !== 'string' || EMAIL.test(value);\n break;\n case 'url':\n valid = typeof value !== 'string' || URL.canParse(value);\n break;\n case 'json':\n // Text that doesn't parse stays a string in the form: only objects and arrays pass\n valid = isRecord(value) || Array.isArray(value);\n break;\n case 'tel':\n valid = typeof value !== 'string' || TEL.test(value);\n break;\n case 'in': {\n const allowed = rule.value as unknown[];\n const values = Array.isArray(value) ? value : [value];\n valid = values.every((item) => allowed.includes(item));\n break;\n }\n case 'accept':\n valid = mediaList(value).every(\n (media) =>\n typeof media.mime !== 'string' ||\n matchesMime(media.mime, rule.value as string[]),\n );\n break;\n case 'maxSize':\n valid = mediaList(value).every(\n (media) =>\n typeof media.size !== 'number' || media.size <= (rule.value as number),\n );\n break;\n case 'crop':\n valid = !isRecord(rule.value) || hasCrop(value, rule.value);\n break;\n case 'before':\n case 'after': {\n const bound = rule.value as string | { field: string };\n const boundTime = toTime(\n typeof bound === 'string' ? bound : getValue(root, bound.field),\n );\n const time = toTime(value);\n if (boundTime !== null && time !== null) {\n valid = rule.rule === 'before' ? time < boundTime : time > boundTime;\n }\n break;\n }\n }\n if (!valid) {\n failures.push(failure(rule));\n }\n });\n return failures;\n}\n\nfunction addFailures(context: Context, path: string, failures: RuleFailure[]) {\n if (failures.length > 0) {\n context.failures[path] = [...(context.failures[path] ?? []), ...failures];\n }\n}\n\n/** The rule each type implies: its values are checked whatever rules the field lists. */\nconst IMPLIED_RULES: Readonly<Record<string, Rule>> = {\n json: { rule: 'json' },\n tel: { rule: 'tel' },\n};\n\n/**\n * The rules of a field that apply in the mode, with the one its type implies: `json` for the\n * `json` type, `tel` for the `tel` type.\n */\nfunction rulesOf(field: Field, mode: CheckOptions['mode']): Rule[] {\n const rules = (field.rules ?? []).filter((rule) => appliesIn(rule, mode));\n const implied = IMPLIED_RULES[field.type];\n return implied !== undefined && !rules.some((rule) => rule.rule === implied.rule)\n ? [...rules, implied]\n : rules;\n}\n\nfunction checkFieldValue(field: Field, value: unknown, path: string, context: Context) {\n const rules = rulesOf(field, context.mode);\n if (field.localized === true) {\n const localized = isRecord(value) ? value : {};\n const required = rules.filter((rule) => rule.rule === 'required');\n const others = rules.filter((rule) => rule.rule !== 'required');\n if (required.length > 0) {\n const locales = context.locales;\n if (locales === undefined || locales.length === 0) {\n if (!Object.values(localized).some(isFilled)) {\n addFailures(context, path, required.map(failure));\n }\n } else {\n locales.forEach((locale) => {\n addFailures(\n context,\n `${path}.${locale}`,\n checkRules(required, localized[locale], context.root, context.mode),\n );\n });\n }\n }\n Object.entries(localized).forEach(([locale, localeValue]) => {\n addFailures(\n context,\n `${path}.${locale}`,\n checkRules(others, localeValue, context.root, context.mode),\n );\n });\n return;\n }\n\n addFailures(context, path, checkRules(rules, value, context.root, context.mode));\n\n if (field.type === 'group' && field.fields !== undefined && isRecord(value)) {\n checkFields(field.fields, value, `${path}.`, context);\n }\n if (field.type === 'repeater' && Array.isArray(value)) {\n value.forEach((item, index) => {\n if (!isRecord(item)) {\n return;\n }\n const blockFields =\n field.types !== undefined\n ? field.types.find((type) => type.id === item.type)?.fields\n : field.fields;\n if (blockFields !== undefined) {\n checkFields(blockFields, item, `${path}.${index}.`, context);\n }\n });\n }\n}\n\nfunction checkFields(\n fields: Field[],\n values: Record<string, unknown>,\n prefix: string,\n context: Context,\n) {\n fields.forEach((field) => {\n if (field.readOnly === true) {\n return;\n }\n if (context.mode === 'create' && field.updateOnly === true) {\n return;\n }\n if (context.mode === 'update' && field.createOnly === true) {\n return;\n }\n if (\n field.visibleWhen !== undefined &&\n !evaluateCondition(field.visibleWhen, prefix === '' ? context.root : values)\n ) {\n return;\n }\n if (context.partial === true && prefix === '' && !(field.name in values)) {\n return;\n }\n checkFieldValue(field, values[field.name], `${prefix}${field.name}`, context);\n });\n}\n\n/**\n * Checks form values against the portable rules of their fields. Returns the failures keyed by\n * the dot path of the value (`title.fr`, `blocks.2.image`), the same keys as validation errors.\n * Hidden and read-only fields are skipped. Rules this version doesn't know are ignored.\n */\nexport function checkValues(\n fields: Field[],\n values: Record<string, unknown>,\n options: CheckOptions = {},\n): Record<string, RuleFailure[]> {\n const root =\n options.partial === true && options.item !== undefined\n ? { ...options.item, ...values }\n : values;\n const context: Context = { ...options, root, failures: {} };\n checkFields(fields, values, '', context);\n return context.failures;\n}\n"],"mappings":";;;;;AAuCA,IAAM,QAAQ;;AAEd,IAAM,MAAM;AAEZ,SAAS,YAAY,MAAqB;CACtC,OAAQ,eAAqC,SAAS,KAAK,IAAI;AACnE;;;;;AAMA,SAAS,UAAU,MAAY,MAAqC;CAChE,OAAO,KAAK,SAAS,KAAA,KAAa,KAAK,SAAS;AACpD;AAEA,SAAS,QAAQ,MAAyB;CACtC,MAAM,SAAsB,EAAE,MAAM,KAAK,KAAK;CAC9C,IAAI,WAAW,QAAQ,KAAK,UAAU,KAAA,GAClC,OAAO,QAAQ,KAAK;CAExB,IAAI,KAAK,YAAY,KAAA,GACjB,OAAO,UAAU,KAAK;CAE1B,OAAO;AACX;AAEA,SAAS,OAAO,OAA+B;CAC3C,IAAI,OAAO,UAAU,UACjB,OAAO;CAEX,IAAI,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAChD,OAAO,MAAM;CAEjB,OAAO;AACX;AAEA,SAAS,YAAY,MAAc,UAA6B;CAC5D,OAAO,SAAS,MAAM,YAAY;EAC9B,IAAI,QAAQ,SAAS,IAAI,GACrB,OAAO,KAAK,WAAW,QAAQ,MAAM,GAAG,EAAE,CAAC;EAE/C,OAAO,SAAS;CACpB,CAAC;AACL;;AAGA,SAAS,UAAU,OAA2C;CAE1D,QADa,MAAM,QAAQ,K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Q,YAAY,QAAQ,QAAQ,SAAS,KAAA,IACvC;EAAE,GAAG,QAAQ;EAAM,GAAG;CAAO,IAC7B;CACV,MAAM,UAAmB;EAAE,GAAG;EAAS;EAAM,UAAU,CAAC;CAAE;CAC1D,YAAY,QAAQ,QAAQ,IAAI,OAAO;CACvC,OAAO,QAAQ;AACnB"}
|
|
1
|
+
{"version":3,"file":"rules.js","names":[],"sources":["../src/rules.ts"],"sourcesContent":["import { getAddressRequiredParts, isPostalCode } from './addresses';\nimport { evaluateCondition } from './conditions';\nimport { PORTABLE_RULES } from './constants';\nimport { isCurrencyCode } from './currencies';\nimport { getLinkTypes } from './links';\nimport type { Field, Rule } from './schemas/field';\nimport { matchesRatio, renderedCropSize } from './transforms';\nimport { getValue, isFilled, isRecord } from './values';\n\n/** A rule that a value doesn't satisfy. */\nexport interface RuleFailure {\n rule: string;\n /**\n * The rule's parameter (`max: 120` gives `120`). For `daterange`, what fails: `start` or `end`\n * (a bound missing where the range isn't open), or `order` (the end is before the start).\n */\n value?: unknown;\n /** The message set on the rule, if any. */\n message?: string;\n}\n\nexport interface CheckOptions {\n /**\n * Locales a `required` localized field must be filled in. Without it, one filled locale is\n * enough.\n */\n locales?: string[];\n /** `create` skips `updateOnly` fields; `update` skips `createOnly` fields. */\n mode?: 'create' | 'update';\n /** Only check the fields present in the values (partial updates). */\n partial?: boolean;\n /**\n * The values of the item being updated. With `partial`, conditions (`visibleWhen`) and rules\n * that read other fields read them for the fields that aren't in the values: a field shown\n * when `status` is `published`, sent alone, is checked on a published item (decision 0043).\n */\n item?: Record<string, unknown>;\n}\n\ninterface Context extends CheckOptions {\n /** The whole form, for `visibleWhen` and date rules that reference other fields. */\n root: Record<string, unknown>;\n failures: Record<string, RuleFailure[]>;\n}\n\nconst EMAIL = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n/** An international phone number in E.164: `+`, then 7 to 15 digits, without a leading zero. */\nconst TEL = /^\\+[1-9]\\d{6,14}$/;\n/** The same number, with an optional extension after `;ext=` (RFC 3966): `+15145550199;ext=123`. */\nconst TEL_EXTENSION = /^\\+[1-9]\\d{6,14}(?:;ext=\\d{1,10})?$/;\n\nfunction isKnownRule(rule: Rule): boolean {\n return (PORTABLE_RULES as readonly string[]).includes(rule.rule);\n}\n\n/**\n * Whether a rule applies in a mode: a rule with a `mode` applies only in that mode, and not when the\n * mode isn't known.\n */\nfunction appliesIn(rule: Rule, mode: CheckOptions['mode']): boolean {\n return rule.mode === undefined || rule.mode === mode;\n}\n\nfunction failure(rule: Rule): RuleFailure {\n const result: RuleFailure = { rule: rule.rule };\n if ('value' in rule && rule.value !== undefined) {\n result.value = rule.value;\n }\n if (rule.message !== undefined) {\n result.message = rule.message;\n }\n return result;\n}\n\nfunction sizeOf(value: unknown): number | null {\n if (typeof value === 'number') {\n return value;\n }\n // A `money` value: `min` and `max` apply to its amount, in minor units (decision 0053).\n if (isRecord(value) && 'currency' in value && typeof value.amount === 'number') {\n return value.amount;\n }\n if (typeof value === 'string' || Array.isArray(value)) {\n return value.length;\n }\n return null;\n}\n\nfunction matchesMime(mime: string, patterns: string[]): boolean {\n return patterns.some((pattern) => {\n if (pattern.endsWith('/*')) {\n return mime.startsWith(pattern.slice(0, -1));\n }\n return mime === pattern;\n });\n}\n\n/** The files of a value, with their MIME type and size: stored files, or chosen ones (`File`). */\nfunction mediaList(value: unknown): Record<string, unknown>[] {\n const list = Array.isArray(value) ? value : [value];\n return list\n .filter(isRecord)\n .map((media) =>\n typeof Blob !== 'undefined' && media instanceof Blob\n ? { mime: media.type === '' ? undefined : media.type, size: media.size }\n : media,\n );\n}\n\n/**\n * Whether each image of a value has the crop the `crop` rule asks for (decision 0031): a crop when\n * it is required, and one of the ratios once rendered. An id alone has no crop.\n */\nfunction hasCrop(value: unknown, rule: { ratios?: string[]; required?: boolean }): boolean {\n const entries = Array.isArray(value) ? value : [value];\n return entries.every((entry) => {\n const transform = isRecord(entry) && isRecord(entry.transform) ? entry.transform : {};\n const size = renderedCropSize(transform);\n if (size === null) {\n return rule.required !== true;\n }\n const ratios = rule.ratios ?? [];\n return (\n ratios.length === 0 ||\n ratios.some((ratio) => matchesRatio(size.width, size.height, ratio))\n );\n });\n}\n\n/**\n * Whether an `embed` value comes from one of the providers, compared without case (decision 0058).\n * A value without a `provider` (an app without `GET /embeds`) is left to the backend.\n */\nfunction hasProvider(value: unknown, providers: readonly string[]): boolean {\n if (!isRecord(value) || typeof value.provider !== 'string') {\n return true;\n }\n const provider = value.provider.toLowerCase();\n return providers.some(\n (allowed) => typeof allowed === 'string' && allowed.toLowerCase() === provider,\n );\n}\n\nconst DAY = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst DATE_TIME = /^\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}/;\n\n/** A bound of a `daterange`: a day or a date-time, `null` when empty, `undefined` when invalid. */\nfunction rangeBound(value: unknown): string | null | undefined {\n if (value === null || value === undefined || value === '') {\n return null;\n }\n if (typeof value !== 'string' || !(DAY.test(value) || DATE_TIME.test(value))) {\n return undefined;\n }\n return toTime(value) !== null ? value : undefined;\n}\n\n/**\n * What a `daterange` value fails (decision 0053): a bound that is missing or invalid where the range\n * isn't open (`start`, `end`), or an end before the start (`order`). `null` when it is valid.\n */\nfunction checkDateRange(value: unknown, open: unknown): 'start' | 'end' | 'order' | null {\n if (!isRecord(value)) {\n return 'start';\n }\n const start = rangeBound(value.start);\n const end = rangeBound(value.end);\n const openStart = open === 'start' || open === 'both';\n const openEnd = open === 'end' || open === 'both';\n if (start === undefined || (start === null && !openStart)) {\n return 'start';\n }\n if (end === undefined || (end === null && !openEnd)) {\n return 'end';\n }\n if (start === null || end === null) {\n return null;\n }\n // Days compare as days; a date-time compares as its instant.\n const before =\n DAY.test(start) && DAY.test(end)\n ? end < start\n : (toTime(end) as number) < (toTime(start) as number);\n return before ? 'order' : null;\n}\n\n/** Whether a `money` value has an integer amount, and a currency that the rule allows. */\nfunction isMoney(value: unknown, currencies: unknown): boolean {\n if (!isRecord(value) || !Number.isSafeInteger(value.amount)) {\n return false;\n }\n return Array.isArray(currencies) && currencies.length > 0\n ? currencies.includes(value.currency)\n : isCurrencyCode(value.currency);\n}\n\nfunction toTime(value: unknown): number | null {\n if (typeof value !== 'string' && typeof value !== 'number') {\n return null;\n }\n const time = new Date(value).getTime();\n return Number.isNaN(time) ? null : time;\n}\n\n/**\n * Checks one value against a field's rules. Returns the rules that fail. Rules limited to a `mode`\n * only apply when it is given.\n */\nexport function checkRules(\n rules: Rule[],\n value: unknown,\n root: Record<string, unknown> = {},\n mode?: CheckOptions['mode'],\n): RuleFailure[] {\n const failures: RuleFailure[] = [];\n const filled = isFilled(value);\n const applying = rules.filter((rule) => isKnownRule(rule) && appliesIn(rule, mode));\n applying.forEach((rule) => {\n if (rule.rule === 'required') {\n if (!filled) {\n failures.push(failure(rule));\n }\n return;\n }\n if (!filled) {\n return;\n }\n let valid = true;\n // What fails, when the rule says more than its parameter (`daterange`).\n let detail: string | null = null;\n switch (rule.rule) {\n case 'min':\n case 'max': {\n const size = sizeOf(value);\n const limit = rule.value as number;\n valid = size === null || (rule.rule === 'min' ? size >= limit : size <= limit);\n break;\n }\n case 'pattern':\n valid =\n typeof value !== 'string' ||\n new RegExp(rule.value as string, (rule as { flags?: string }).flags).test(\n value,\n );\n break;\n case 'email':\n valid = typeof value !== 'string' || EMAIL.test(value);\n break;\n case 'url':\n valid = typeof value !== 'string' || URL.canParse(value);\n break;\n case 'json':\n // Text that doesn't parse stays a string in the form: only objects and arrays pass\n valid = isRecord(value) || Array.isArray(value);\n break;\n case 'tel':\n valid =\n typeof value !== 'string' ||\n ((rule as { extension?: boolean }).extension === true\n ? TEL_EXTENSION\n : TEL\n ).test(value);\n break;\n case 'postalCode': {\n // The country is a code, or another field of the form (decision 0054)\n const country = isRecord(rule.value)\n ? getValue(root, String(rule.value.field))\n : rule.value;\n valid =\n typeof value !== 'string' ||\n isPostalCode(value, typeof country === 'string' ? country : null);\n break;\n }\n case 'daterange':\n detail = checkDateRange(value, (rule as { open?: unknown }).open);\n valid = detail === null;\n break;\n case 'money':\n valid = isMoney(value, (rule as { currencies?: unknown }).currencies);\n break;\n case 'in': {\n const allowed = rule.value as unknown[];\n const values = Array.isArray(value) ? value : [value];\n valid = values.every((item) => allowed.includes(item));\n break;\n }\n case 'accept':\n valid = mediaList(value).every(\n (media) =>\n typeof media.mime !== 'string' ||\n matchesMime(media.mime, rule.value as string[]),\n );\n break;\n case 'maxSize':\n valid = mediaList(value).every(\n (media) =>\n typeof media.size !== 'number' || media.size <= (rule.value as number),\n );\n break;\n case 'crop':\n valid = !isRecord(rule.value) || hasCrop(value, rule.value);\n break;\n case 'providers':\n valid = hasProvider(value, rule.value as string[]);\n break;\n case 'before':\n case 'after': {\n const bound = rule.value as string | { field: string };\n const boundTime = toTime(\n typeof bound === 'string' ? bound : getValue(root, bound.field),\n );\n const time = toTime(value);\n if (boundTime !== null && time !== null) {\n valid = rule.rule === 'before' ? time < boundTime : time > boundTime;\n }\n break;\n }\n }\n if (!valid) {\n failures.push(detail !== null ? { ...failure(rule), value: detail } : failure(rule));\n }\n });\n return failures;\n}\n\nfunction addFailures(context: Context, path: string, failures: RuleFailure[]) {\n if (failures.length > 0) {\n context.failures[path] = [...(context.failures[path] ?? []), ...failures];\n }\n}\n\n/** A string setting of a field. */\nfunction stringSetting(field: Field, key: string): string | undefined {\n const value = field.settings?.[key];\n return typeof value === 'string' && value !== '' ? value : undefined;\n}\n\n/**\n * The rule each type implies: its values are checked whatever rules the field lists. `tel`,\n * `daterange` and `money` carry settings of their field: the extension, the open bounds, the\n * allowed currencies.\n */\nconst IMPLIED_RULES: Readonly<Record<string, (field: Field) => Rule>> = {\n json: () => ({ rule: 'json' }),\n tel: (field) =>\n field.settings?.extension === true ? { rule: 'tel', extension: true } : { rule: 'tel' },\n daterange: (field) => {\n const open = stringSetting(field, 'open');\n return { rule: 'daterange', ...(open !== undefined ? { open } : {}) } as Rule;\n },\n money: (field) => {\n const currency = stringSetting(field, 'currency');\n const listed = field.settings?.currencies;\n const currencies =\n currency !== undefined\n ? [currency]\n : Array.isArray(listed)\n ? listed.filter((code): code is string => typeof code === 'string')\n : [];\n return { rule: 'money', ...(currencies.length > 0 ? { currencies } : {}) } as Rule;\n },\n};\n\n/**\n * The rules of a field that apply in the mode, with the one its type implies: `json` for the\n * `json` type, `tel` for `tel`, `daterange` for `daterange` and `money` for `money`. A rule of\n * the same name on the field wins.\n */\nfunction rulesOf(field: Field, mode: CheckOptions['mode']): Rule[] {\n const rules = (field.rules ?? []).filter((rule) => appliesIn(rule, mode));\n const implied = IMPLIED_RULES[field.type]?.(field);\n return implied !== undefined && !rules.some((rule) => rule.rule === implied.rule)\n ? [...rules, implied]\n : rules;\n}\n\n/** The parts that make an address filled: a country or a point alone don't. */\nconst ADDRESS_TEXT_PARTS = ['street', 'unit', 'city', 'region', 'postalCode'] as const;\n\n/**\n * The checks of the parts of an `address` (decision 0054): a filled address, with a part other\n * than its country, has its required parts, and a postal code of its country.\n */\nfunction checkAddress(field: Field, value: unknown, path: string, context: Context) {\n if (!isRecord(value) || !ADDRESS_TEXT_PARTS.some((part) => isFilled(value[part]))) {\n return;\n }\n getAddressRequiredParts(field).forEach((part) => {\n if (!isFilled(value[part])) {\n addFailures(context, `${path}.${part}`, [{ rule: 'required' }]);\n }\n });\n const { postalCode, country } = value;\n if (\n typeof postalCode === 'string' &&\n isFilled(postalCode) &&\n !isPostalCode(postalCode, typeof country === 'string' ? country : null)\n ) {\n addFailures(context, `${path}.postalCode`, [{ rule: 'postalCode' }]);\n }\n}\n\n/** Whether a string is an email address. */\nconst isEmail = (text: string) => EMAIL.test(text);\n\n/** Whether the `url` of a link of a type is valid: the `rule` it fails, or `null`. */\nfunction checkLinkUrl(type: string, url: string, pattern: string | undefined): string | null {\n switch (type) {\n case 'url':\n return /^https?:\\/\\//i.test(url) && URL.canParse(url) ? null : 'url';\n case 'email':\n // `mailto:` and an address, with a query (`?subject=`) if any\n return /^mailto:/i.test(url) && isEmail(url.slice(7).split('?')[0] ?? '')\n ? null\n : 'email';\n case 'tel':\n return /^tel:/i.test(url) && TEL.test(url.slice(4)) ? null : 'tel';\n default:\n return pattern === undefined || new RegExp(pattern).test(url) ? null : 'pattern';\n }\n}\n\n/**\n * The checks of the parts of a `link` (decision 0055): a type of the field, the URL of its type,\n * its page or its file, and its label when the field requires one.\n */\nfunction checkLink(field: Field, value: unknown, path: string, context: Context) {\n if (!isRecord(value)) {\n return;\n }\n const types = getLinkTypes(field);\n const type = types.find((candidate) => candidate.id === value.type);\n if (type === undefined) {\n addFailures(context, `${path}.type`, [\n { rule: 'in', value: types.map((candidate) => candidate.id) },\n ]);\n return;\n }\n if (type.id === 'page' || type.id === 'file') {\n if (!isFilled(value[type.id])) {\n addFailures(context, `${path}.${type.id}`, [{ rule: 'required' }]);\n }\n } else if (typeof value.url !== 'string' || !isFilled(value.url)) {\n addFailures(context, `${path}.url`, [{ rule: 'required' }]);\n } else {\n const failed = checkLinkUrl(type.id, value.url.trim(), type.pattern);\n if (failed !== null) {\n addFailures(context, `${path}.url`, [\n failed === 'pattern' ? { rule: 'pattern', value: type.pattern } : { rule: failed },\n ]);\n }\n }\n const label = value.label;\n const hasLabel = isRecord(label) ? Object.values(label).some(isFilled) : isFilled(label);\n if (field.settings?.label === 'required' && !hasLabel) {\n addFailures(context, `${path}.label`, [{ rule: 'required' }]);\n }\n}\n\n/** The checks of the parts of a value that the field's type implies. */\nfunction checkParts(field: Field, value: unknown, path: string, context: Context) {\n if (field.type === 'address') {\n checkAddress(field, value, path, context);\n } else if (field.type === 'link') {\n checkLink(field, value, path, context);\n }\n}\n\nfunction checkFieldValue(field: Field, value: unknown, path: string, context: Context) {\n const rules = rulesOf(field, context.mode);\n if (field.localized === true) {\n const localized = isRecord(value) ? value : {};\n const required = rules.filter((rule) => rule.rule === 'required');\n const others = rules.filter((rule) => rule.rule !== 'required');\n if (required.length > 0) {\n const locales = context.locales;\n if (locales === undefined || locales.length === 0) {\n if (!Object.values(localized).some(isFilled)) {\n addFailures(context, path, required.map(failure));\n }\n } else {\n locales.forEach((locale) => {\n addFailures(\n context,\n `${path}.${locale}`,\n checkRules(required, localized[locale], context.root, context.mode),\n );\n });\n }\n }\n Object.entries(localized).forEach(([locale, localeValue]) => {\n addFailures(\n context,\n `${path}.${locale}`,\n checkRules(others, localeValue, context.root, context.mode),\n );\n checkParts(field, localeValue, `${path}.${locale}`, context);\n });\n return;\n }\n\n addFailures(context, path, checkRules(rules, value, context.root, context.mode));\n checkParts(field, value, path, context);\n\n if (field.type === 'group' && field.fields !== undefined && isRecord(value)) {\n checkFields(field.fields, value, `${path}.`, context);\n }\n if (field.type === 'repeater' && Array.isArray(value)) {\n value.forEach((item, index) => {\n if (!isRecord(item)) {\n return;\n }\n const blockFields =\n field.types !== undefined\n ? field.types.find((type) => type.id === item.type)?.fields\n : field.fields;\n if (blockFields !== undefined) {\n checkFields(blockFields, item, `${path}.${index}.`, context);\n }\n });\n }\n}\n\nfunction checkFields(\n fields: Field[],\n values: Record<string, unknown>,\n prefix: string,\n context: Context,\n) {\n fields.forEach((field) => {\n if (field.readOnly === true) {\n return;\n }\n if (context.mode === 'create' && field.updateOnly === true) {\n return;\n }\n if (context.mode === 'update' && field.createOnly === true) {\n return;\n }\n if (\n field.visibleWhen !== undefined &&\n !evaluateCondition(field.visibleWhen, prefix === '' ? context.root : values)\n ) {\n return;\n }\n if (context.partial === true && prefix === '' && !(field.name in values)) {\n return;\n }\n checkFieldValue(field, values[field.name], `${prefix}${field.name}`, context);\n });\n}\n\n/**\n * Checks form values against the portable rules of their fields. Returns the failures keyed by\n * the dot path of the value (`title.fr`, `blocks.2.image`), the same keys as validation errors.\n * Hidden and read-only fields are skipped. Rules this version doesn't know are ignored.\n */\nexport function checkValues(\n fields: Field[],\n values: Record<string, unknown>,\n options: CheckOptions = {},\n): Record<string, RuleFailure[]> {\n const root =\n options.partial === true && options.item !== undefined\n ? { ...options.item, ...values }\n : values;\n const context: Context = { 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../version.js';
|
|
2
2
|
export * from '../constants.js';
|
|
3
|
+
export { type CurrencyCode, CURRENCY_CODES, fromMinorUnits, getCurrencyDigits, isCurrencyCode, toMinorUnits, } from '../currencies.js';
|
|
3
4
|
export { type CheckOptions, type RuleFailure, checkRules, checkValues } from '../rules.js';
|
|
4
5
|
export { evaluateCondition } from '../conditions.js';
|
|
6
|
+
export { POSTAL_CODE_COUNTRIES, getAddressRequiredParts, isAddressPart, isPostalCode, normalizePostalCode, } from '../addresses.js';
|
|
7
|
+
export { type LinkNewTab, type LinkType, getLinkNewTab, getLinkTypes, isBuiltInLinkType, isExternalUrl, resolveLinkNewTab, } from '../links.js';
|
|
5
8
|
export { getMediaLibraries, type MediaLibrariesDefinition } from '../libraries.js';
|
|
6
9
|
export { matchesRatio, parseRatio, renderedCropSize } from '../transforms.js';
|
|
7
10
|
export { lintDefinition } from '../lint.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACpE,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,cAAc,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACH,KAAK,aAAa,EAClB,aAAa,EACb,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACpE,cAAc,cAAc,CAAC;AAC7B,OAAO,EACH,KAAK,YAAY,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,YAAY,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACH,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,mBAAmB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,iBAAiB,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,cAAc,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACH,KAAK,aAAa,EAClB,aAAa,EACb,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION } from "../version.js";
|
|
2
|
-
import { AUTH_ERROR_CODES, AUTH_ERROR_PARAM, AUTH_PAGE_PATHS, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_ITEM_ACTIONS, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LINK_ACTIONS, BUILT_IN_LIST_LAYOUTS, CONTEXT_HEADER, CONTEXT_PROBLEM_TYPE, EMAIL_UNVERIFIED_PROBLEM_TYPE, ITEM_ACTION_ABILITIES, PASSWORD_CONFIRMATION_PROBLEM_TYPE, PORTABLE_RULES, RESERVED_ROUTE_SEGMENTS, RICH_TEXT_STYLE_ELEMENTS, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, isBuiltInItemAction, isBuiltInLink } from "../constants.js";
|
|
2
|
+
import { ADDRESS_PARTS, AUTH_ERROR_CODES, AUTH_ERROR_PARAM, AUTH_PAGE_PATHS, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_ITEM_ACTIONS, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LINK_ACTIONS, BUILT_IN_LINK_TYPES, BUILT_IN_LIST_LAYOUTS, CONTEXT_HEADER, CONTEXT_PROBLEM_TYPE, DATE_RANGE_OPEN_BOUNDS, DEFAULT_ADDRESS_REQUIRED_PARTS, DURATION_UNITS, EMAIL_UNVERIFIED_PROBLEM_TYPE, ITEM_ACTION_ABILITIES, PASSWORD_CONFIRMATION_PROBLEM_TYPE, PORTABLE_RULES, RESERVED_ROUTE_SEGMENTS, RICH_TEXT_STYLE_ELEMENTS, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, isBuiltInItemAction, isBuiltInLink } from "../constants.js";
|
|
3
|
+
import { CURRENCY_CODES, fromMinorUnits, getCurrencyDigits, isCurrencyCode, toMinorUnits } from "../currencies.js";
|
|
4
|
+
import { POSTAL_CODE_COUNTRIES, getAddressRequiredParts, isAddressPart, isPostalCode, normalizePostalCode } from "../addresses.js";
|
|
3
5
|
import { getValue, isFilled } from "../values.js";
|
|
4
6
|
import { evaluateCondition } from "../conditions.js";
|
|
7
|
+
import { getLinkNewTab, getLinkTypes, isBuiltInLinkType, isExternalUrl, resolveLinkNewTab } from "../links.js";
|
|
5
8
|
import { matchesRatio, parseRatio, renderedCropSize } from "../transforms.js";
|
|
6
9
|
import { checkRules, checkValues } from "../rules.js";
|
|
7
10
|
import { getMediaLibraries } from "../libraries.js";
|
|
@@ -11,4 +14,4 @@ import { SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_L
|
|
|
11
14
|
import { contextBefore, formatContextHeader, parseContextHeader } from "../context.js";
|
|
12
15
|
import { isProblem } from "../problem.js";
|
|
13
16
|
import { mergeThemes } from "../themes.js";
|
|
14
|
-
export { AUTH_ERROR_CODES, AUTH_ERROR_PARAM, AUTH_PAGE_PATHS, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_ITEM_ACTIONS, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LINK_ACTIONS, BUILT_IN_LIST_LAYOUTS, CONTEXT_HEADER, CONTEXT_PROBLEM_TYPE, EMAIL_UNVERIFIED_PROBLEM_TYPE, ITEM_ACTION_ABILITIES, PASSWORD_CONFIRMATION_PROBLEM_TYPE, PORTABLE_RULES, PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION, RESERVED_ROUTE_SEGMENTS, RICH_TEXT_STYLE_ELEMENTS, SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_LENGTH, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, checkRules, checkValues, contextBefore, evaluateCondition, formatContextHeader, fromSearchParams, getMediaLibraries, getValue, isBuiltInItemAction, isBuiltInLink, isCursorPage, isFilled, isFilterRange, isProblem, isSearchableResource, lintDefinition, matchesFilterRange, matchesRatio, mergeThemes, parseContextHeader, parseRatio, readSearchQuery, renderedCropSize, toSearchParams, toSearchQueryParams };
|
|
17
|
+
export { ADDRESS_PARTS, AUTH_ERROR_CODES, AUTH_ERROR_PARAM, AUTH_PAGE_PATHS, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_ITEM_ACTIONS, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LINK_ACTIONS, BUILT_IN_LINK_TYPES, BUILT_IN_LIST_LAYOUTS, CONTEXT_HEADER, CONTEXT_PROBLEM_TYPE, CURRENCY_CODES, DATE_RANGE_OPEN_BOUNDS, DEFAULT_ADDRESS_REQUIRED_PARTS, DURATION_UNITS, EMAIL_UNVERIFIED_PROBLEM_TYPE, ITEM_ACTION_ABILITIES, PASSWORD_CONFIRMATION_PROBLEM_TYPE, PORTABLE_RULES, POSTAL_CODE_COUNTRIES, PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION, RESERVED_ROUTE_SEGMENTS, RICH_TEXT_STYLE_ELEMENTS, SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_LENGTH, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, checkRules, checkValues, contextBefore, evaluateCondition, formatContextHeader, fromMinorUnits, fromSearchParams, getAddressRequiredParts, getCurrencyDigits, getLinkNewTab, getLinkTypes, getMediaLibraries, getValue, isAddressPart, isBuiltInItemAction, isBuiltInLink, isBuiltInLinkType, isCurrencyCode, isCursorPage, isExternalUrl, isFilled, isFilterRange, isPostalCode, isProblem, isSearchableResource, lintDefinition, matchesFilterRange, matchesRatio, mergeThemes, normalizePostalCode, parseContextHeader, parseRatio, readSearchQuery, renderedCropSize, resolveLinkNewTab, toMinorUnits, toSearchParams, toSearchQueryParams };
|
package/dist/schemas/action.d.ts
CHANGED
|
@@ -88,7 +88,6 @@ export declare const Action: z.ZodObject<{
|
|
|
88
88
|
rule: z.ZodEnum<{
|
|
89
89
|
email: "email";
|
|
90
90
|
url: "url";
|
|
91
|
-
tel: "tel";
|
|
92
91
|
json: "json";
|
|
93
92
|
}>;
|
|
94
93
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -96,6 +95,34 @@ export declare const Action: z.ZodObject<{
|
|
|
96
95
|
update: "update";
|
|
97
96
|
create: "create";
|
|
98
97
|
}>>;
|
|
98
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
99
|
+
rule: z.ZodLiteral<"tel">;
|
|
100
|
+
extension: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
message: z.ZodOptional<z.ZodString>;
|
|
102
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
103
|
+
update: "update";
|
|
104
|
+
create: "create";
|
|
105
|
+
}>>;
|
|
106
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
107
|
+
rule: z.ZodLiteral<"daterange">;
|
|
108
|
+
open: z.ZodOptional<z.ZodEnum<{
|
|
109
|
+
start: "start";
|
|
110
|
+
end: "end";
|
|
111
|
+
both: "both";
|
|
112
|
+
}>>;
|
|
113
|
+
message: z.ZodOptional<z.ZodString>;
|
|
114
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
115
|
+
update: "update";
|
|
116
|
+
create: "create";
|
|
117
|
+
}>>;
|
|
118
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
119
|
+
rule: z.ZodLiteral<"money">;
|
|
120
|
+
currencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
121
|
+
message: z.ZodOptional<z.ZodString>;
|
|
122
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
123
|
+
update: "update";
|
|
124
|
+
create: "create";
|
|
125
|
+
}>>;
|
|
99
126
|
}, z.core.$loose>, z.ZodObject<{
|
|
100
127
|
rule: z.ZodLiteral<"in">;
|
|
101
128
|
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
@@ -133,6 +160,16 @@ export declare const Action: z.ZodObject<{
|
|
|
133
160
|
update: "update";
|
|
134
161
|
create: "create";
|
|
135
162
|
}>>;
|
|
163
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
164
|
+
rule: z.ZodLiteral<"postalCode">;
|
|
165
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
166
|
+
field: z.ZodString;
|
|
167
|
+
}, z.core.$loose>]>>;
|
|
168
|
+
message: z.ZodOptional<z.ZodString>;
|
|
169
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
170
|
+
update: "update";
|
|
171
|
+
create: "create";
|
|
172
|
+
}>>;
|
|
136
173
|
}, z.core.$loose>, z.ZodObject<{
|
|
137
174
|
rule: z.ZodLiteral<"crop">;
|
|
138
175
|
value: z.ZodObject<{
|
|
@@ -144,6 +181,14 @@ export declare const Action: z.ZodObject<{
|
|
|
144
181
|
update: "update";
|
|
145
182
|
create: "create";
|
|
146
183
|
}>>;
|
|
184
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
185
|
+
rule: z.ZodLiteral<"providers">;
|
|
186
|
+
value: z.ZodArray<z.ZodString>;
|
|
187
|
+
message: z.ZodOptional<z.ZodString>;
|
|
188
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
189
|
+
update: "update";
|
|
190
|
+
create: "create";
|
|
191
|
+
}>>;
|
|
147
192
|
}, z.core.$loose>, z.ZodObject<{
|
|
148
193
|
rule: z.ZodString;
|
|
149
194
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/schemas/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,WAAW;;;;EAA4C,CAAC;AAErE,eAAO,MAAM,eAAe;;;;;EAA6C,CAAC;AAE1E,eAAO,MAAM,aAAa;;;;;mBAWxB,CAAC;AAEH,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/schemas/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,WAAW;;;;EAA4C,CAAC;AAErE,eAAO,MAAM,eAAe;;;;;EAA6C,CAAC;AAE1E,eAAO,MAAM,aAAa;;;;;mBAWxB,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyEb,CAAC;AAEP,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,qEAAqE;AACrE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
package/dist/schemas/api.d.ts
CHANGED
|
@@ -103,8 +103,8 @@ export declare const ActionResult: z.ZodObject<{
|
|
|
103
103
|
reason: z.ZodOptional<z.ZodString>;
|
|
104
104
|
}, z.core.$loose>>>;
|
|
105
105
|
refresh: z.ZodOptional<z.ZodEnum<{
|
|
106
|
-
list: "list";
|
|
107
106
|
none: "none";
|
|
107
|
+
list: "list";
|
|
108
108
|
items: "items";
|
|
109
109
|
}>>;
|
|
110
110
|
redirect: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
@@ -148,8 +148,8 @@ export declare const ActionRun: z.ZodObject<{
|
|
|
148
148
|
reason: z.ZodOptional<z.ZodString>;
|
|
149
149
|
}, z.core.$loose>>>;
|
|
150
150
|
refresh: z.ZodOptional<z.ZodEnum<{
|
|
151
|
-
list: "list";
|
|
152
151
|
none: "none";
|
|
152
|
+
list: "list";
|
|
153
153
|
items: "items";
|
|
154
154
|
}>>;
|
|
155
155
|
redirect: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
@@ -197,8 +197,8 @@ export declare const ActionRunResponse: z.ZodObject<{
|
|
|
197
197
|
reason: z.ZodOptional<z.ZodString>;
|
|
198
198
|
}, z.core.$loose>>>;
|
|
199
199
|
refresh: z.ZodOptional<z.ZodEnum<{
|
|
200
|
-
list: "list";
|
|
201
200
|
none: "none";
|
|
201
|
+
list: "list";
|
|
202
202
|
items: "items";
|
|
203
203
|
}>>;
|
|
204
204
|
redirect: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
@@ -560,6 +560,42 @@ export declare const LocationValue: z.ZodObject<{
|
|
|
560
560
|
lng: z.ZodNumber;
|
|
561
561
|
address: z.ZodOptional<z.ZodString>;
|
|
562
562
|
}, z.core.$loose>;
|
|
563
|
+
export declare const AddressValue: z.ZodObject<{
|
|
564
|
+
street: z.ZodOptional<z.ZodString>;
|
|
565
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
566
|
+
city: z.ZodOptional<z.ZodString>;
|
|
567
|
+
region: z.ZodOptional<z.ZodString>;
|
|
568
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
569
|
+
country: z.ZodOptional<z.ZodString>;
|
|
570
|
+
point: z.ZodOptional<z.ZodObject<{
|
|
571
|
+
lat: z.ZodNumber;
|
|
572
|
+
lng: z.ZodNumber;
|
|
573
|
+
}, z.core.$loose>>;
|
|
574
|
+
}, z.core.$loose>;
|
|
575
|
+
export declare const LinkValue: z.ZodObject<{
|
|
576
|
+
type: z.ZodString;
|
|
577
|
+
url: z.ZodOptional<z.ZodString>;
|
|
578
|
+
page: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
579
|
+
id: z.ZodString;
|
|
580
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
581
|
+
label: z.ZodOptional<z.ZodString>;
|
|
582
|
+
}, z.core.$loose>]>>;
|
|
583
|
+
file: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
584
|
+
id: z.ZodString;
|
|
585
|
+
}, z.core.$loose>]>>;
|
|
586
|
+
label: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>]>>>;
|
|
587
|
+
newTab: z.ZodOptional<z.ZodBoolean>;
|
|
588
|
+
}, z.core.$loose>;
|
|
589
|
+
export declare const DateRangeValue: z.ZodObject<{
|
|
590
|
+
start: z.ZodNullable<z.ZodString>;
|
|
591
|
+
end: z.ZodNullable<z.ZodString>;
|
|
592
|
+
allDay: z.ZodOptional<z.ZodBoolean>;
|
|
593
|
+
timeZone: z.ZodOptional<z.ZodString>;
|
|
594
|
+
}, z.core.$loose>;
|
|
595
|
+
export declare const MoneyValue: z.ZodObject<{
|
|
596
|
+
amount: z.ZodNumber;
|
|
597
|
+
currency: z.ZodString;
|
|
598
|
+
}, z.core.$loose>;
|
|
563
599
|
export type Item = z.infer<typeof Item>;
|
|
564
600
|
export type Pagination = z.infer<typeof Pagination>;
|
|
565
601
|
export type ItemResponse = z.infer<typeof ItemResponse>;
|
|
@@ -597,4 +633,8 @@ export type PreviewResponse = z.infer<typeof PreviewResponse>;
|
|
|
597
633
|
export type EmbedValue = z.infer<typeof EmbedValue>;
|
|
598
634
|
export type EmbedResponse = z.infer<typeof EmbedResponse>;
|
|
599
635
|
export type LocationValue = z.infer<typeof LocationValue>;
|
|
636
|
+
export type AddressValue = z.infer<typeof AddressValue>;
|
|
637
|
+
export type LinkValue = z.infer<typeof LinkValue>;
|
|
638
|
+
export type DateRangeValue = z.infer<typeof DateRangeValue>;
|
|
639
|
+
export type MoneyValue = z.infer<typeof MoneyValue>;
|
|
600
640
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/schemas/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,IAAI;;;;iBAUX,CAAC;AAEP,eAAO,MAAM,UAAU;;;;;iBAKrB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;iBAiBvB,CAAC;AAEP,eAAO,MAAM,YAAY;;;;;;iBAAgC,CAAC;AAE1D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;iBAGvB,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;;iBAiB6E,CAAC;AAElG,eAAO,MAAM,SAAS;;;;;;;;mBAYpB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;iBASxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;iBAQ3B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBvB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUpB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAoC,CAAC;AAEnE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;mBAgCE,CAAC,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC;iBAU3D,CAAC;AAEP,eAAO,MAAM,eAAe;;iBAG1B,CAAC;AAEH,e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