@panneau/protocol 5.0.0-alpha.18 → 5.0.0-alpha.19
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/compound.d.ts +20 -0
- package/dist/compound.d.ts.map +1 -0
- package/dist/compound.js +27 -0
- package/dist/compound.js.map +1 -0
- package/dist/index.js +2 -1
- package/dist/mock/index.d.ts +8 -0
- package/dist/mock/index.d.ts.map +1 -1
- package/dist/mock/index.js +14 -5
- package/dist/mock/index.js.map +1 -1
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +4 -2
- package/dist/rules.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +2 -1
- package/dist/schemas/api.js +1 -1
- package/dist/schemas/api.js.map +1 -1
- package/dist/schemas/field.js +2 -2
- package/dist/schemas/field.js.map +1 -1
- package/package.json +1 -1
- package/schema/openapi.json +3 -3
package/dist/rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 = { ...options, root, failures: {} };\n checkFields(fields, values, '', context);\n return context.failures;\n}\n"],"mappings":";;;;;;;;AA6CA,IAAM,QAAQ;;AAEd,IAAM,MAAM;;AAEZ,IAAM,gBAAgB;AAEtB,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;CAGX,IAAI,SAAS,KAAK,KAAK,cAAc,SAAS,OAAO,MAAM,WAAW,UAClE,OAAO,MAAM;CAEjB,IAAI,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAChD,OAAO,MAAM;CAEjB,OAAO;AACX;AAEA,SAAS,YAAY,MAAc,UAA6B;CAC5D,OAAO,SAAS,MAAM,YAAY;EAC9B,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,MAAM,QAAQ,OAAO;CAChF,CAAC;AACL;;;;;;AAOA,SAAgB,YACZ,QACA,QACA,UAAwB,CAAC,GACI;CAC7B,MAAM,OACF,QAAQ,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 { getNestedShape } from './compound';\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 // Compound fields of plugins check their `fields` as groups and repeaters do (decision 0065).\n const shape = getNestedShape(field);\n if (shape === 'group' && field.fields !== undefined && isRecord(value)) {\n checkFields(field.fields, value, `${path}.`, context);\n }\n if (shape === '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":";;;;;;;;;AA8CA,IAAM,QAAQ;;AAEd,IAAM,MAAM;;AAEZ,IAAM,gBAAgB;AAEtB,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;CAGX,IAAI,SAAS,KAAK,KAAK,cAAc,SAAS,OAAO,MAAM,WAAW,UAClE,OAAO,MAAM;CAEjB,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,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAA,CAE7C,OAAO,QAAQ,CAAC,CAChB,KAAK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GAAG;EAAS;EAAM,UAAU,CAAC;CAAE;CAC1D,YAAY,QAAQ,QAAQ,IAAI,OAAO;CACvC,OAAO,QAAQ;AACnB"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from '../constants.js';
|
|
|
3
3
|
export { type CurrencyCode, CURRENCY_CODES, fromMinorUnits, getCurrencyDigits, isCurrencyCode, toMinorUnits, } from '../currencies.js';
|
|
4
4
|
export { type CheckOptions, type RuleFailure, checkRules, checkValues } from '../rules.js';
|
|
5
5
|
export { evaluateCondition } from '../conditions.js';
|
|
6
|
+
export { type NestedShape, getNestedShape, isBuiltInFieldType, isCompoundField } from '../compound.js';
|
|
6
7
|
export { POSTAL_CODE_COUNTRIES, getAddressRequiredParts, isAddressPart, isPostalCode, normalizePostalCode, } from '../addresses.js';
|
|
7
8
|
export { type LinkNewTab, type LinkType, getLinkNewTab, getLinkTypes, isBuiltInLinkType, isExternalUrl, resolveLinkNewTab, } from '../links.js';
|
|
8
9
|
export { type ItemImageResource, type MediaLibrariesDefinition, getItemImageField, getMediaLibraries, } from '../libraries.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,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,CAA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AO,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;AAC3D,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,EAC5B,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,GACtB,MAAM,YAAY,CAAC"}
|
package/dist/runtime/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION } from "../version.js";
|
|
|
2
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, UNDO_LIMIT, isBuiltInItemAction, isBuiltInLink } from "../constants.js";
|
|
3
3
|
import { CURRENCY_CODES, fromMinorUnits, getCurrencyDigits, isCurrencyCode, toMinorUnits } from "../currencies.js";
|
|
4
4
|
import { POSTAL_CODE_COUNTRIES, getAddressRequiredParts, isAddressPart, isPostalCode, normalizePostalCode } from "../addresses.js";
|
|
5
|
+
import { getNestedShape, isBuiltInFieldType, isCompoundField } from "../compound.js";
|
|
5
6
|
import { getValue, isFilled } from "../values.js";
|
|
6
7
|
import { evaluateCondition } from "../conditions.js";
|
|
7
8
|
import { getLinkNewTab, getLinkTypes, isBuiltInLinkType, isExternalUrl, resolveLinkNewTab } from "../links.js";
|
|
@@ -15,4 +16,4 @@ import { SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_L
|
|
|
15
16
|
import { contextBefore, formatContextHeader, parseContextHeader } from "../context.js";
|
|
16
17
|
import { isProblem } from "../problem.js";
|
|
17
18
|
import { mergeThemes } from "../themes.js";
|
|
18
|
-
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, BUILT_IN_WIDGET_TYPES, 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, RESOURCE_WIDGET_TYPES, RICH_TEXT_STYLE_ELEMENTS, SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_LENGTH, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, UNDO_LIMIT, WIDGET_LIST_MAX_ITEMS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_PERIODS, checkRules, checkValues, checkWidgetData, contextBefore, evaluateCondition, formatContextHeader, fromMinorUnits, fromSearchParams, getAddressRequiredParts, getCurrencyDigits, getItemImageField, getLinkNewTab, getLinkTypes, getMediaLibraries, getValue, getWidgetResource, isAddressPart, isBuiltInItemAction, isBuiltInLink, isBuiltInLinkType, isBuiltInWidgetType, isCurrencyCode, isCursorPage, isExternalUrl, isFilled, isFilterRange, isPostalCode, isProblem, isSearchableResource, lintDefinition, matchesFilterRange, matchesRatio, mergeThemes, normalizePostalCode, parseContextHeader, parseRatio, readSearchQuery, renderedCropSize, resolveLinkNewTab, toMinorUnits, toSearchParams, toSearchQueryParams };
|
|
19
|
+
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, BUILT_IN_WIDGET_TYPES, 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, RESOURCE_WIDGET_TYPES, RICH_TEXT_STYLE_ELEMENTS, SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_LENGTH, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, UNDO_LIMIT, WIDGET_LIST_MAX_ITEMS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_PERIODS, checkRules, checkValues, checkWidgetData, contextBefore, evaluateCondition, formatContextHeader, fromMinorUnits, fromSearchParams, getAddressRequiredParts, getCurrencyDigits, getItemImageField, getLinkNewTab, getLinkTypes, getMediaLibraries, getNestedShape, getValue, getWidgetResource, isAddressPart, isBuiltInFieldType, isBuiltInItemAction, isBuiltInLink, isBuiltInLinkType, isBuiltInWidgetType, isCompoundField, isCurrencyCode, isCursorPage, isExternalUrl, isFilled, isFilterRange, isPostalCode, isProblem, isSearchableResource, lintDefinition, matchesFilterRange, matchesRatio, mergeThemes, normalizePostalCode, parseContextHeader, parseRatio, readSearchQuery, renderedCropSize, resolveLinkNewTab, toMinorUnits, toSearchParams, toSearchQueryParams };
|
package/dist/schemas/api.js
CHANGED
|
@@ -50,7 +50,7 @@ var ActionItemResult = z.looseObject({
|
|
|
50
50
|
id: Id,
|
|
51
51
|
status: z.enum(["failed", "skipped"]),
|
|
52
52
|
message: z.string().optional(),
|
|
53
|
-
reason: z.string().optional().meta({ description: "`skipped`: `forbidden`, `not_found` or `
|
|
53
|
+
reason: z.string().optional().meta({ description: "`skipped`: `forbidden`, `not_found`, `unchanged`, or `in_use` (something else uses the item, so it can’t be deleted)." })
|
|
54
54
|
});
|
|
55
55
|
var ActionResult = z.looseObject({
|
|
56
56
|
message: z.string().optional(),
|
package/dist/schemas/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","names":[],"sources":["../../src/schemas/api.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Abilities, Id, RouteReference } from './common';\nimport { ContextOption, User } from './definition';\n\nexport const Item = z\n .looseObject({\n id: Id,\n version: z.string().nullable().meta({\n description: 'Changes on every update. `null` when the backend has no versions.',\n }),\n abilities: Abilities,\n })\n .meta({\n description: 'An item of a resource. Its other properties are the values of its fields.',\n });\n\nexport const Pagination = z.looseObject({\n page: z.number().int().positive(),\n perPage: z.number().int().positive(),\n total: z.number().int().nonnegative(),\n lastPage: z.number().int().positive(),\n});\n\nexport const CursorPagination = z\n .looseObject({\n perPage: z.number().int().positive(),\n nextCursor: z.string().min(1).nullable().meta({\n description: 'The `cursor` of the next page, or `null` on the last page.',\n }),\n previousCursor: z.string().min(1).nullable().optional().meta({\n description:\n 'The `cursor` of the previous page, or `null` when it is the first page, which has none (and on the first page). Without it, clients go back through the cursors they followed.',\n }),\n total: z.number().int().nonnegative().nullable().optional().meta({\n description: 'How many items match, when the backend counts them.',\n }),\n })\n .meta({\n description:\n 'The meta of a page of a list whose `pagination` is `cursor`: no page numbers, and no total unless the backend has one.',\n });\n\nexport const ItemResponse = z.looseObject({ data: Item });\n\nexport const ListResponse = z.looseObject({\n data: z.array(Item),\n meta: z.union([Pagination, CursorPagination]),\n});\n\nexport const Problem = z\n .looseObject({\n type: z.string().meta({ description: 'A URI reference that identifies the problem type.' }),\n title: z.string(),\n status: z.number().int().min(400).max(599),\n detail: z.string().optional(),\n instance: z.string().optional(),\n errors: z\n .record(z.string(), z.array(z.string()))\n .optional()\n .meta({ description: '`422`: messages keyed by the dot path of the invalid value.' }),\n current: Item.optional().meta({ description: '`412`: the current version of the item.' }),\n param: z.string().optional().meta({\n description:\n \"`403` of type `urn:panneau:problem:context`: the param of the context whose value the user can't use.\",\n }),\n })\n .meta({ description: 'An error, as RFC 9457 problem details (`application/problem+json`).' });\n\nexport const Selection = z.union([\n z.looseObject({ ids: z.array(Id).min(1) }),\n z.looseObject({\n query: z.looseObject({\n filter: z.record(z.string(), z.unknown()).optional().meta({\n description:\n 'The `filter` of the list query, by filter id: a value, a list of values, or the bounds of a range (`{ \"from\": \"2026-01-01\", \"to\": \"2026-01-31\" }`).',\n }),\n q: z.string().optional(),\n }),\n except: z.array(Id).optional(),\n }),\n]);\n\nexport const ActionRequest = z.looseObject({\n selection: Selection.optional().meta({\n description: 'Omitted for actions on the whole resource.',\n }),\n values: z.record(z.string(), z.unknown()).optional(),\n dryRun: z.boolean().optional().meta({\n description:\n 'Answer what the action would do without running it: a `200` action result whose `summary` counts the items that would succeed and those that would be skipped. Only for actions with `dryRun: true`.',\n }),\n});\n\nexport const ActionItemResult = z.looseObject({\n id: Id,\n status: z.enum(['failed', 'skipped']),\n message: z.string().optional(),\n reason: z\n .string()\n .optional()\n .meta({ description: '`skipped`: `forbidden`, `not_found` or `unchanged`.' }),\n});\n\nexport const ActionResult = z.looseObject({\n message: z.string().optional(),\n summary: z\n .looseObject({\n succeeded: z.number().int().nonnegative(),\n failed: z.number().int().nonnegative(),\n skipped: z.number().int().nonnegative(),\n })\n .optional(),\n results: z\n .array(ActionItemResult)\n .optional()\n .meta({ description: 'The items that did not succeed.' }),\n refresh: z.enum(['none', 'items', 'list']).optional(),\n redirect: z.union([z.string(), RouteReference]).nullable().optional(),\n download: z\n .looseObject({\n url: z.string(),\n filename: z.string().optional(),\n expiresAt: z.string().optional(),\n })\n .nullable()\n .optional(),\n undo: z\n .looseObject({\n action: z.string().min(1).meta({\n description:\n 'An action of the same resource that undoes this run: `restore` after a `delete` with a trash, or the inverse a project declares (`unarchive`).',\n }),\n items: z.array(Id).min(1).max(100).meta({\n description:\n 'The items the run changed, to run the undo on: not those it skipped or failed. At most `UNDO_LIMIT` (100): a larger run has no `undo`.',\n }),\n params: z\n .record(z.string(), z.unknown())\n .optional()\n .meta({ description: 'The `values` of the request that runs the undo.' }),\n })\n .optional()\n .meta({\n description:\n 'How to undo the run, for an `undoable` action (decision 0063): the client runs it as any action, through the action endpoint, when the user presses \"Undo\" in the toast of the result. Without it, the run can not be undone.',\n }),\n});\n\nexport const ActionRun = z.looseObject({\n id: Id,\n action: z.string(),\n resource: z.string(),\n status: z.enum(['queued', 'running', 'succeeded', 'partial', 'failed', 'cancelled']),\n progress: z.number().int().nonnegative(),\n total: z.number().int().nonnegative().nullable(),\n result: ActionResult.optional().meta({ description: 'Set once the run has finished.' }),\n createdAt: z.string().optional(),\n finishedAt: z.string().nullable().optional(),\n});\n\nexport const ActionRunResponse = z.looseObject({ run: ActionRun });\n\nexport const MediaTransform = z\n .looseObject({\n crop: z\n .looseObject({\n x: z.number().int().nonnegative(),\n y: z.number().int().nonnegative(),\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n })\n .optional()\n .meta({\n description:\n 'In whole pixels of the upright original image (after its EXIF orientation), from its top left corner.',\n }),\n rotate: z\n .union([z.literal(0), z.literal(90), z.literal(180), z.literal(270)])\n .optional()\n .meta({ description: 'Clockwise, in degrees.' }),\n flipX: z.boolean().optional().meta({ description: 'Mirrors left to right (horizontal).' }),\n flipY: z.boolean().optional().meta({ description: 'Mirrors top to bottom (vertical).' }),\n focalPoint: z\n .looseObject({ x: z.number().min(0).max(1), y: z.number().min(0).max(1) })\n .optional()\n .meta({\n description:\n 'From 0 to 1, relative to the width and height of the upright original image, not of the crop: changing the crop does not move it. Renderers map it into the transformed image and clamp it to the crop.',\n }),\n base: z.enum(['media', 'original']).optional().meta({\n description:\n \"What a transform for one use starts from: the original file by default, or the media's own transform (`media`). With `media`, the crop and the focal point are relative to the media's version instead of the original (decision 0031).\",\n }),\n // Return types are written out so that declaration files keep the recursion.\n get baseTransform(): z.ZodOptional<typeof MediaTransform> {\n return MediaTransform.optional().meta({\n description:\n 'With `base: \"media\"`: the media\\'s own transform this one was made on. When the media\\'s transform is no longer the same, clients ask to check the crop, and renderers clamp it.',\n });\n },\n })\n .meta({\n description:\n \"Non-destructive edits of an image, applied in this order: crop, then rotate, then flip. Renderers ignore the keys they don't know, which editor tools can add.\",\n });\n\nexport const UploadReference = z.looseObject({ upload: z.string().min(1) }).meta({\n description:\n 'A file uploaded directly to storage, by the id of its upload: in a file value, such as the `file` of a media, or an action parameter.',\n});\n\nexport const StoredFile = z\n .looseObject({\n name: z.string().meta({ description: 'The name of the file, as the user knows it.' }),\n url: z.string().nullable().optional().meta({\n description: 'Where to download it. A private file gets a temporary URL.',\n }),\n mime: z.string().nullable().optional(),\n size: z.number().int().nonnegative().nullable().optional(),\n })\n .meta({\n description:\n 'A file stored by the backend: the value of a `file` field in items. Requests send it back to keep the file, `{ \"upload\" }` to replace it, or `null` to remove it.',\n });\n\nexport const Upload = z\n .looseObject({\n id: z.string().min(1).meta({ description: 'The id of the upload: `upl_…`.' }),\n key: z.string().optional().meta({ description: 'The key of the object in storage.' }),\n name: z.string().optional(),\n mime: z.string().optional(),\n size: z.number().int().nonnegative().optional(),\n })\n .meta({\n description:\n 'A file the browser uploaded to storage, before it becomes a media, an import or another value.',\n });\n\nexport const UploadResponse = z.looseObject({ data: Upload });\n\nexport const UploadSignRequest = z\n .looseObject({\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE']),\n key: z.string().min(1),\n uploadId: z.string().optional().meta({ description: 'The S3 multipart upload.' }),\n partNumber: z.number().int().positive().optional(),\n contentType: z.string().optional(),\n expiresIn: z.number().int().positive().optional(),\n })\n .meta({\n description: \"A request of the browser's S3 client to sign (Uppy 6's `signRequest`).\",\n });\n\nexport const UploadSignResponse = z\n .looseObject({\n url: z.string(),\n key: z\n .string()\n .optional()\n .meta({ description: 'The key the backend chose, for the first request of a file.' }),\n headers: z.record(z.string(), z.string()).optional().meta({\n description: 'Headers the URL was signed with, which the browser sends.',\n }),\n upload: z\n .string()\n .optional()\n .meta({ description: 'The upload the first request of a file created: `upl_…`.' }),\n })\n .meta({ description: 'A presigned request.' });\n\nexport const MediaInfo = z\n .looseObject({\n type: z.string().meta({\n description:\n '`image`, `video`, `audio`, `document`, `font`, or another type the backend knows.',\n }),\n mime: z.string().nullable().optional(),\n size: z.number().int().nonnegative().nullable().optional(),\n url: z.string().nullable().optional().meta({\n description:\n 'The main file to show or play: a rendition, or the original until it exists.',\n }),\n thumbnailUrl: z.string().nullable().optional(),\n variants: z\n .record(\n z.string(),\n z.looseObject({\n url: z.string(),\n width: z.number().optional(),\n height: z.number().optional(),\n }),\n )\n .optional()\n .meta({ description: 'Named renditions: sizes of an image, qualities of a video.' }),\n width: z.number().nullable().optional(),\n height: z.number().nullable().optional(),\n duration: z.number().nullable().optional().meta({ description: 'In seconds.' }),\n status: z.enum(['pending', 'processing', 'ready', 'failed']).optional().meta({\n description:\n 'Where the processing of the file is: `pending` and `processing` until its renditions are made, then `ready` or `failed`. Without it, the media is ready.',\n }),\n error: z\n .looseObject({\n code: z.string().meta({\n description:\n 'The code of the step that failed, such as a transcoder task code (`timeout`, `input_unreadable`).',\n }),\n message: z.string().optional().meta({ description: 'Why it failed, for people.' }),\n })\n .nullable()\n .optional()\n .meta({\n description:\n \"Why the processing failed, when `status` is `failed`, so that editors see it without the backend's monitoring.\",\n }),\n metadata: z.record(z.string(), z.unknown()).optional(),\n transform: MediaTransform.nullable().optional().meta({\n description:\n \"The media's own transform, from its library, which clients need to draw a transform for one use made over it (decision 0031).\",\n }),\n })\n .meta({\n description:\n 'What the backend computed about the file of a media item: the `media` of the items of a `media` resource, and of the values of `media` fields. Read-only: the editable properties of a media are the fields of its resource.',\n });\n\nexport const MediaItem = Item.extend({\n media: MediaInfo,\n}).meta({\n description:\n 'An item of a resource of kind `media`: the values of its fields (`file`, the original, and those of the project), and the `media` the backend computed.',\n});\n\nexport const MediaReference = z\n .looseObject({\n id: Id,\n resource: z.string().optional().meta({\n description:\n 'The library of the media. Required for a field that allows several libraries, since ids are unique only within their resource (decision 0027).',\n }),\n label: z.string().optional().meta({ description: 'The `itemTitle` of the media.' }),\n media: MediaInfo.optional(),\n transform: MediaTransform.nullable().optional().meta({\n description:\n 'The edits of the image for this use only: from the original file, or over the media\\'s own transform with `base: \"media\"`.',\n }),\n })\n .meta({\n description:\n 'The value of a `media` or `image` field in items: the media, with what lists and fields show, and its edits for this use. Requests send the id, or `{ id, resource, transform }`: `resource` is required when the field allows several libraries.',\n });\n\nexport const FieldCheckRequest = z\n .looseObject({\n value: z.string().meta({ description: 'The value to check, as it is typed.' }),\n locale: z\n .string()\n .optional()\n .meta({ description: 'The locale of the value, for a localized field.' }),\n id: Id.nullable()\n .optional()\n .meta({ description: 'The item being edited, or null when creating one.' }),\n values: z.record(z.string(), z.unknown()).optional().meta({\n description:\n \"The form's current values, as they would be sent to save, for what the check depends on (a page's parent).\",\n }),\n })\n .meta({ description: 'A value of a field with `check`, to check with the backend.' });\n\nexport const FieldCheckResponse = z\n .looseObject({\n available: z.boolean().meta({\n description:\n 'Whether no other item of the resource, in its scope and the same locale, has the value.',\n }),\n suggestion: z.string().nullable().optional().meta({\n description: 'An available value close to the one checked, when it is taken.',\n }),\n prefix: z.string().nullable().optional().meta({\n description: 'What the field shows in front of the value: the start of its URL.',\n }),\n url: z\n .string()\n .nullable()\n .optional()\n .meta({ description: 'The URL the value gives the item, which the field links to.' }),\n disabled: z.boolean().optional().meta({\n description:\n \"The field doesn't apply to this item (the home page has no slug): the field is read-only.\",\n }),\n })\n .meta({\n description:\n 'What the backend says about a value: not authoritative, since saving still validates it.',\n });\n\nexport const Session = z.looseObject({ user: User });\n\nexport const TwoFactorChallenge = z.looseObject({ twoFactor: z.literal(true) }).meta({\n description:\n 'The answer of `POST /auth/login` when a second factor is needed: the login waits for `POST /auth/two-factor/challenge`.',\n});\n\nexport const TwoFactorStatus = z\n .looseObject({\n status: z.enum(['disabled', 'pending', 'enabled']).meta({\n description: '`pending`: set up, not confirmed with a code yet.',\n }),\n required: z.boolean().meta({\n description: \"The backend requires it for this user: it can't be turned off.\",\n }),\n })\n .meta({ description: 'The two-factor authentication of the current user.' });\n\nexport const TwoFactorSetup = z\n .looseObject({\n secret: z.string().meta({ description: 'The secret, to type in an authenticator app.' }),\n otpauthUrl: z.string().meta({ description: 'The `otpauth://totp/…` URL of the secret.' }),\n qrCode: z.string().optional().meta({\n description:\n 'An SVG document of the QR code of `otpauthUrl`. Clients show it as an image, never as markup.',\n }),\n })\n .meta({ description: 'A two-factor authentication to confirm with a code.' });\n\nexport const WebAuthnOptions = z\n .looseObject({\n options: z.record(z.string(), z.unknown()).meta({\n description:\n 'The options of `navigator.credentials.get()` or `create()`, in the JSON form of the WebAuthn spec.',\n }),\n })\n .meta({ description: 'The options of a WebAuthn ceremony.' });\n\nexport const Passkey = z\n .looseObject({\n id: Id,\n name: z.string(),\n authenticator: z.string().nullable().optional().meta({\n description: 'What keeps it, when the backend knows: \"iCloud Keychain\", \"1Password\"…',\n }),\n createdAt: z.string().meta({ description: 'ISO 8601.' }),\n lastUsedAt: z\n .string()\n .nullable()\n .meta({ description: 'ISO 8601, or null before its first login.' }),\n })\n .meta({ description: 'A passkey of the current user.' });\n\nexport const RecoveryCodes = z.looseObject({ recoveryCodes: z.array(z.string()) }).meta({\n description: 'Codes that each log in once in place of a code of the authenticator app.',\n});\n\nexport const ContextOptionsResponse = z\n .looseObject({ data: z.array(ContextOption) })\n .meta({ description: 'The first choices of a param of the context that match `q`.' });\n\nexport const SearchResponse = z\n .looseObject({\n data: z.array(\n z.looseObject({\n resource: z.string().meta({ description: 'The id of the resource.' }),\n items: z.array(Item),\n total: z.number().int().nonnegative().optional().meta({\n description:\n 'How many items of the resource match, when the backend counts them: the list of the resource, searched, shows them all.',\n }),\n }),\n ),\n })\n .meta({\n description:\n 'The results of the global search: the resources with results, in the order of the definition.',\n });\n\nexport const PreviewResponse = z.looseObject({ url: z.string(), expiresAt: z.string().optional() });\n\nexport const EmbedValue = z\n .looseObject({\n url: z.string().meta({ description: 'The URL of the video, sound or post.' }),\n type: z.enum(['video', 'audio', 'photo', 'rich', 'link']).optional(),\n title: z.string().optional(),\n provider: z.string().optional().meta({ description: 'The name of the provider.' }),\n thumbnailUrl: z.string().optional(),\n html: z\n .string()\n .optional()\n .meta({ description: 'The HTML that embeds it, from the oEmbed of its provider.' }),\n width: z.number().optional(),\n height: z.number().optional(),\n })\n .meta({\n description:\n 'The value of an `embed` field: its URL, and what the backend got from its oEmbed.',\n });\n\nexport const EmbedResponse = z.looseObject({ data: EmbedValue });\n\nexport const LocationValue = z\n .looseObject({\n lat: z.number().min(-90).max(90),\n lng: z.number().min(-180).max(180),\n address: z.string().optional(),\n })\n .meta({ description: 'The value of a `location` field: a point, and its address.' });\n\nexport const AddressValue = z\n .looseObject({\n street: z.string().optional().meta({ description: 'The number and the street.' }),\n unit: z.string().optional().meta({ description: 'An apartment, a suite or a floor.' }),\n city: z.string().optional(),\n region: z.string().optional().meta({\n description:\n 'A value of the `region` type for the country: the code of the region without its country (`QC`) for the countries Panneau knows the regions of, the text as typed for the others.',\n }),\n postalCode: z.string().optional().meta({\n description: 'Normalized for its country: `H2X 1Y4`, `12345-6789`.',\n }),\n country: z\n .string()\n .regex(/^[A-Z]{2}$/)\n .optional()\n .meta({ description: 'An ISO 3166-1 alpha-2 code: `CA`.' }),\n point: z\n .looseObject({ lat: z.number().min(-90).max(90), lng: z.number().min(-180).max(180) })\n .optional()\n .meta({ description: 'The place of the address on a map, with `settings.point`.' }),\n })\n .meta({\n description:\n 'The value of an `address` field (decision 0054): the parts of a postal address, the empty ones left out.',\n });\n\nexport const LinkValue = z\n .looseObject({\n type: z.string().min(1).meta({\n description:\n 'The type of the link: `url`, `page`, `email`, `tel`, `file`, or a type of the site.',\n }),\n url: z.string().optional().meta({\n description:\n 'The `href` of the link: `https://…`, `mailto:…`, `tel:+…`, or the text of a type of the site. For `page` and `file` links, the URL the backend resolved, in items only.',\n }),\n page: z\n .union([\n z.string(),\n z.looseObject({\n id: z.string(),\n resource: z.string().optional(),\n label: z.string().optional(),\n }),\n ])\n .optional()\n .meta({\n description:\n '`page` links: the item, `{ \"id\", \"resource\", \"label\" }` in items, its id or `{ \"id\", \"resource\" }` in requests.',\n }),\n file: z\n .union([z.string(), z.looseObject({ id: z.string() })])\n .optional()\n .meta({ description: '`file` links: the media, as a `media` value.' }),\n label: z\n .union([z.string(), z.record(z.string(), z.string().nullable())])\n .nullable()\n .optional()\n .meta({\n description:\n 'The words of the link, per locale; a string in a `localized` link field.',\n }),\n newTab: z.boolean().optional().meta({ description: 'The link opens in a new tab.' }),\n })\n .meta({ description: 'The value of a `link` field (decision 0055).' });\n\nexport const DateRangeValue = z\n .looseObject({\n start: z.string().nullable().meta({\n description:\n 'The first day (`2026-11-04`) or the start (`2026-11-04T23:30:00Z`), or `null` when the range is open at its start.',\n }),\n end: z.string().nullable().meta({\n description:\n 'The last day, included, or the end, or `null` when the range is open at its end. On or after the start.',\n }),\n allDay: z\n .boolean()\n .optional()\n .meta({ description: 'The range takes whole days: its bounds are days.' }),\n timeZone: z.string().optional().meta({\n description:\n 'The IANA time zone the date-times are shown and typed in (`America/Toronto`), when the field lets the user choose it.',\n }),\n })\n .meta({\n description:\n 'The value of a `daterange` field: a start and an end, days or date-times (decision 0053).',\n });\n\nexport const MoneyValue = z\n .looseObject({\n amount: z.number().int().meta({\n description:\n 'The amount in the minor unit of the currency, its ISO 4217 exponent: `1250` is 12.50 CAD, `1250` is 1,250 JPY.',\n }),\n currency: z\n .string()\n .regex(/^[A-Z]{3}$/)\n .meta({ description: 'An ISO 4217 currency code, in capitals: `CAD`.' }),\n })\n .meta({\n description: 'The value of a `money` field: an amount and its currency (decision 0053).',\n });\n\nexport type Item = z.infer<typeof Item>;\nexport type Pagination = z.infer<typeof Pagination>;\nexport type ItemResponse = z.infer<typeof ItemResponse>;\nexport type CursorPagination = z.infer<typeof CursorPagination>;\nexport type ListResponse = z.infer<typeof ListResponse>;\nexport type ContextOptionsResponse = z.infer<typeof ContextOptionsResponse>;\nexport type Problem = z.infer<typeof Problem>;\nexport type Selection = z.infer<typeof Selection>;\nexport type ActionRequest = z.infer<typeof ActionRequest>;\nexport type ActionItemResult = z.infer<typeof ActionItemResult>;\nexport type ActionResult = z.infer<typeof ActionResult>;\nexport type ActionRun = z.infer<typeof ActionRun>;\nexport type ActionRunResponse = z.infer<typeof ActionRunResponse>;\nexport type MediaTransform = z.infer<typeof MediaTransform>;\nexport type UploadReference = z.infer<typeof UploadReference>;\nexport type StoredFile = z.infer<typeof StoredFile>;\nexport type Upload = z.infer<typeof Upload>;\nexport type UploadResponse = z.infer<typeof UploadResponse>;\nexport type UploadSignRequest = z.infer<typeof UploadSignRequest>;\nexport type UploadSignResponse = z.infer<typeof UploadSignResponse>;\nexport type FieldCheckRequest = z.infer<typeof FieldCheckRequest>;\nexport type FieldCheckResponse = z.infer<typeof FieldCheckResponse>;\nexport type MediaInfo = z.infer<typeof MediaInfo>;\nexport type MediaItem = z.infer<typeof MediaItem>;\nexport type MediaReference = z.infer<typeof MediaReference>;\nexport type Session = z.infer<typeof Session>;\nexport type TwoFactorChallenge = z.infer<typeof TwoFactorChallenge>;\nexport type TwoFactorStatus = z.infer<typeof TwoFactorStatus>;\nexport type TwoFactorSetup = z.infer<typeof TwoFactorSetup>;\nexport type RecoveryCodes = z.infer<typeof RecoveryCodes>;\nexport type WebAuthnOptions = z.infer<typeof WebAuthnOptions>;\nexport type Passkey = z.infer<typeof Passkey>;\nexport type SearchResponse = z.infer<typeof SearchResponse>;\nexport type PreviewResponse = z.infer<typeof PreviewResponse>;\nexport type EmbedValue = z.infer<typeof EmbedValue>;\nexport type EmbedResponse = z.infer<typeof EmbedResponse>;\nexport type LocationValue = z.infer<typeof LocationValue>;\nexport type AddressValue = z.infer<typeof AddressValue>;\nexport type LinkValue = z.infer<typeof LinkValue>;\nexport type DateRangeValue = z.infer<typeof DateRangeValue>;\nexport type MoneyValue = z.infer<typeof MoneyValue>;\n"],"mappings":";;;;AAKA,IAAa,OAAO,EACf,YAAY;CACT,IAAI;CACJ,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAChC,aAAa,oEACjB,CAAC;CACD,WAAW;AACf,CAAC,CAAC,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C,CAAC,CAAC,CAAC,CAChE,SAAS,CAAC,CACV,SAAS,CAAC,CACV,KAAK,EACF,aACI,2EACR,CAAC;CACL,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,+BAA+B,CAAC;AACvF,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,+CAA+C,CAAC;AAEzE,IAAa,iBAAiB,EACzB,YAAY;CACT,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC9B,aACI,qHACR,CAAC;CACD,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC5B,aACI,0GACR,CAAC;CACD,QAAQ,EACH,QAAQ,CAAC,CACT,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,mDAAmD,CAAC;CAC7E,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACjC,aACI,wHACR,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EACF,aACI,4FACR,CAAC;AAEL,IAAa,aAAa,EACrB,YAAY;CACT,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAC1B,aACI,iHACR,CAAC;CACD,UAAU,EACL,OAAO,CAAC,CACR,MAAM,YAAY,CAAC,CACnB,KAAK,EAAE,aAAa,iDAAiD,CAAC;AAC/E,CAAC,CAAC,CACD,KAAK,EACF,aAAa,4EACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"api.js","names":[],"sources":["../../src/schemas/api.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Abilities, Id, RouteReference } from './common';\nimport { ContextOption, User } from './definition';\n\nexport const Item = z\n .looseObject({\n id: Id,\n version: z.string().nullable().meta({\n description: 'Changes on every update. `null` when the backend has no versions.',\n }),\n abilities: Abilities,\n })\n .meta({\n description: 'An item of a resource. Its other properties are the values of its fields.',\n });\n\nexport const Pagination = z.looseObject({\n page: z.number().int().positive(),\n perPage: z.number().int().positive(),\n total: z.number().int().nonnegative(),\n lastPage: z.number().int().positive(),\n});\n\nexport const CursorPagination = z\n .looseObject({\n perPage: z.number().int().positive(),\n nextCursor: z.string().min(1).nullable().meta({\n description: 'The `cursor` of the next page, or `null` on the last page.',\n }),\n previousCursor: z.string().min(1).nullable().optional().meta({\n description:\n 'The `cursor` of the previous page, or `null` when it is the first page, which has none (and on the first page). Without it, clients go back through the cursors they followed.',\n }),\n total: z.number().int().nonnegative().nullable().optional().meta({\n description: 'How many items match, when the backend counts them.',\n }),\n })\n .meta({\n description:\n 'The meta of a page of a list whose `pagination` is `cursor`: no page numbers, and no total unless the backend has one.',\n });\n\nexport const ItemResponse = z.looseObject({ data: Item });\n\nexport const ListResponse = z.looseObject({\n data: z.array(Item),\n meta: z.union([Pagination, CursorPagination]),\n});\n\nexport const Problem = z\n .looseObject({\n type: z.string().meta({ description: 'A URI reference that identifies the problem type.' }),\n title: z.string(),\n status: z.number().int().min(400).max(599),\n detail: z.string().optional(),\n instance: z.string().optional(),\n errors: z\n .record(z.string(), z.array(z.string()))\n .optional()\n .meta({ description: '`422`: messages keyed by the dot path of the invalid value.' }),\n current: Item.optional().meta({ description: '`412`: the current version of the item.' }),\n param: z.string().optional().meta({\n description:\n \"`403` of type `urn:panneau:problem:context`: the param of the context whose value the user can't use.\",\n }),\n })\n .meta({ description: 'An error, as RFC 9457 problem details (`application/problem+json`).' });\n\nexport const Selection = z.union([\n z.looseObject({ ids: z.array(Id).min(1) }),\n z.looseObject({\n query: z.looseObject({\n filter: z.record(z.string(), z.unknown()).optional().meta({\n description:\n 'The `filter` of the list query, by filter id: a value, a list of values, or the bounds of a range (`{ \"from\": \"2026-01-01\", \"to\": \"2026-01-31\" }`).',\n }),\n q: z.string().optional(),\n }),\n except: z.array(Id).optional(),\n }),\n]);\n\nexport const ActionRequest = z.looseObject({\n selection: Selection.optional().meta({\n description: 'Omitted for actions on the whole resource.',\n }),\n values: z.record(z.string(), z.unknown()).optional(),\n dryRun: z.boolean().optional().meta({\n description:\n 'Answer what the action would do without running it: a `200` action result whose `summary` counts the items that would succeed and those that would be skipped. Only for actions with `dryRun: true`.',\n }),\n});\n\nexport const ActionItemResult = z.looseObject({\n id: Id,\n status: z.enum(['failed', 'skipped']),\n message: z.string().optional(),\n reason: z.string().optional().meta({\n description:\n '`skipped`: `forbidden`, `not_found`, `unchanged`, or `in_use` (something else uses the item, so it can’t be deleted).',\n }),\n});\n\nexport const ActionResult = z.looseObject({\n message: z.string().optional(),\n summary: z\n .looseObject({\n succeeded: z.number().int().nonnegative(),\n failed: z.number().int().nonnegative(),\n skipped: z.number().int().nonnegative(),\n })\n .optional(),\n results: z\n .array(ActionItemResult)\n .optional()\n .meta({ description: 'The items that did not succeed.' }),\n refresh: z.enum(['none', 'items', 'list']).optional(),\n redirect: z.union([z.string(), RouteReference]).nullable().optional(),\n download: z\n .looseObject({\n url: z.string(),\n filename: z.string().optional(),\n expiresAt: z.string().optional(),\n })\n .nullable()\n .optional(),\n undo: z\n .looseObject({\n action: z.string().min(1).meta({\n description:\n 'An action of the same resource that undoes this run: `restore` after a `delete` with a trash, or the inverse a project declares (`unarchive`).',\n }),\n items: z.array(Id).min(1).max(100).meta({\n description:\n 'The items the run changed, to run the undo on: not those it skipped or failed. At most `UNDO_LIMIT` (100): a larger run has no `undo`.',\n }),\n params: z\n .record(z.string(), z.unknown())\n .optional()\n .meta({ description: 'The `values` of the request that runs the undo.' }),\n })\n .optional()\n .meta({\n description:\n 'How to undo the run, for an `undoable` action (decision 0063): the client runs it as any action, through the action endpoint, when the user presses \"Undo\" in the toast of the result. Without it, the run can not be undone.',\n }),\n});\n\nexport const ActionRun = z.looseObject({\n id: Id,\n action: z.string(),\n resource: z.string(),\n status: z.enum(['queued', 'running', 'succeeded', 'partial', 'failed', 'cancelled']),\n progress: z.number().int().nonnegative(),\n total: z.number().int().nonnegative().nullable(),\n result: ActionResult.optional().meta({ description: 'Set once the run has finished.' }),\n createdAt: z.string().optional(),\n finishedAt: z.string().nullable().optional(),\n});\n\nexport const ActionRunResponse = z.looseObject({ run: ActionRun });\n\nexport const MediaTransform = z\n .looseObject({\n crop: z\n .looseObject({\n x: z.number().int().nonnegative(),\n y: z.number().int().nonnegative(),\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n })\n .optional()\n .meta({\n description:\n 'In whole pixels of the upright original image (after its EXIF orientation), from its top left corner.',\n }),\n rotate: z\n .union([z.literal(0), z.literal(90), z.literal(180), z.literal(270)])\n .optional()\n .meta({ description: 'Clockwise, in degrees.' }),\n flipX: z.boolean().optional().meta({ description: 'Mirrors left to right (horizontal).' }),\n flipY: z.boolean().optional().meta({ description: 'Mirrors top to bottom (vertical).' }),\n focalPoint: z\n .looseObject({ x: z.number().min(0).max(1), y: z.number().min(0).max(1) })\n .optional()\n .meta({\n description:\n 'From 0 to 1, relative to the width and height of the upright original image, not of the crop: changing the crop does not move it. Renderers map it into the transformed image and clamp it to the crop.',\n }),\n base: z.enum(['media', 'original']).optional().meta({\n description:\n \"What a transform for one use starts from: the original file by default, or the media's own transform (`media`). With `media`, the crop and the focal point are relative to the media's version instead of the original (decision 0031).\",\n }),\n // Return types are written out so that declaration files keep the recursion.\n get baseTransform(): z.ZodOptional<typeof MediaTransform> {\n return MediaTransform.optional().meta({\n description:\n 'With `base: \"media\"`: the media\\'s own transform this one was made on. When the media\\'s transform is no longer the same, clients ask to check the crop, and renderers clamp it.',\n });\n },\n })\n .meta({\n description:\n \"Non-destructive edits of an image, applied in this order: crop, then rotate, then flip. Renderers ignore the keys they don't know, which editor tools can add.\",\n });\n\nexport const UploadReference = z.looseObject({ upload: z.string().min(1) }).meta({\n description:\n 'A file uploaded directly to storage, by the id of its upload: in a file value, such as the `file` of a media, or an action parameter.',\n});\n\nexport const StoredFile = z\n .looseObject({\n name: z.string().meta({ description: 'The name of the file, as the user knows it.' }),\n url: z.string().nullable().optional().meta({\n description: 'Where to download it. A private file gets a temporary URL.',\n }),\n mime: z.string().nullable().optional(),\n size: z.number().int().nonnegative().nullable().optional(),\n })\n .meta({\n description:\n 'A file stored by the backend: the value of a `file` field in items. Requests send it back to keep the file, `{ \"upload\" }` to replace it, or `null` to remove it.',\n });\n\nexport const Upload = z\n .looseObject({\n id: z.string().min(1).meta({ description: 'The id of the upload: `upl_…`.' }),\n key: z.string().optional().meta({ description: 'The key of the object in storage.' }),\n name: z.string().optional(),\n mime: z.string().optional(),\n size: z.number().int().nonnegative().optional(),\n })\n .meta({\n description:\n 'A file the browser uploaded to storage, before it becomes a media, an import or another value.',\n });\n\nexport const UploadResponse = z.looseObject({ data: Upload });\n\nexport const UploadSignRequest = z\n .looseObject({\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE']),\n key: z.string().min(1),\n uploadId: z.string().optional().meta({ description: 'The S3 multipart upload.' }),\n partNumber: z.number().int().positive().optional(),\n contentType: z.string().optional(),\n expiresIn: z.number().int().positive().optional(),\n })\n .meta({\n description: \"A request of the browser's S3 client to sign (Uppy 6's `signRequest`).\",\n });\n\nexport const UploadSignResponse = z\n .looseObject({\n url: z.string(),\n key: z\n .string()\n .optional()\n .meta({ description: 'The key the backend chose, for the first request of a file.' }),\n headers: z.record(z.string(), z.string()).optional().meta({\n description: 'Headers the URL was signed with, which the browser sends.',\n }),\n upload: z\n .string()\n .optional()\n .meta({ description: 'The upload the first request of a file created: `upl_…`.' }),\n })\n .meta({ description: 'A presigned request.' });\n\nexport const MediaInfo = z\n .looseObject({\n type: z.string().meta({\n description:\n '`image`, `video`, `audio`, `document`, `font`, or another type the backend knows.',\n }),\n mime: z.string().nullable().optional(),\n size: z.number().int().nonnegative().nullable().optional(),\n url: z.string().nullable().optional().meta({\n description:\n 'The main file to show or play: a rendition, or the original until it exists.',\n }),\n thumbnailUrl: z.string().nullable().optional(),\n variants: z\n .record(\n z.string(),\n z.looseObject({\n url: z.string(),\n width: z.number().optional(),\n height: z.number().optional(),\n }),\n )\n .optional()\n .meta({ description: 'Named renditions: sizes of an image, qualities of a video.' }),\n width: z.number().nullable().optional(),\n height: z.number().nullable().optional(),\n duration: z.number().nullable().optional().meta({ description: 'In seconds.' }),\n status: z.enum(['pending', 'processing', 'ready', 'failed']).optional().meta({\n description:\n 'Where the processing of the file is: `pending` and `processing` until its renditions are made, then `ready` or `failed`. Without it, the media is ready.',\n }),\n error: z\n .looseObject({\n code: z.string().meta({\n description:\n 'The code of the step that failed, such as a transcoder task code (`timeout`, `input_unreadable`).',\n }),\n message: z.string().optional().meta({ description: 'Why it failed, for people.' }),\n })\n .nullable()\n .optional()\n .meta({\n description:\n \"Why the processing failed, when `status` is `failed`, so that editors see it without the backend's monitoring.\",\n }),\n metadata: z.record(z.string(), z.unknown()).optional(),\n transform: MediaTransform.nullable().optional().meta({\n description:\n \"The media's own transform, from its library, which clients need to draw a transform for one use made over it (decision 0031).\",\n }),\n })\n .meta({\n description:\n 'What the backend computed about the file of a media item: the `media` of the items of a `media` resource, and of the values of `media` fields. Read-only: the editable properties of a media are the fields of its resource.',\n });\n\nexport const MediaItem = Item.extend({\n media: MediaInfo,\n}).meta({\n description:\n 'An item of a resource of kind `media`: the values of its fields (`file`, the original, and those of the project), and the `media` the backend computed.',\n});\n\nexport const MediaReference = z\n .looseObject({\n id: Id,\n resource: z.string().optional().meta({\n description:\n 'The library of the media. Required for a field that allows several libraries, since ids are unique only within their resource (decision 0027).',\n }),\n label: z.string().optional().meta({ description: 'The `itemTitle` of the media.' }),\n media: MediaInfo.optional(),\n transform: MediaTransform.nullable().optional().meta({\n description:\n 'The edits of the image for this use only: from the original file, or over the media\\'s own transform with `base: \"media\"`.',\n }),\n })\n .meta({\n description:\n 'The value of a `media` or `image` field in items: the media, with what lists and fields show, and its edits for this use. Requests send the id, or `{ id, resource, transform }`: `resource` is required when the field allows several libraries.',\n });\n\nexport const FieldCheckRequest = z\n .looseObject({\n value: z.string().meta({ description: 'The value to check, as it is typed.' }),\n locale: z\n .string()\n .optional()\n .meta({ description: 'The locale of the value, for a localized field.' }),\n id: Id.nullable()\n .optional()\n .meta({ description: 'The item being edited, or null when creating one.' }),\n values: z.record(z.string(), z.unknown()).optional().meta({\n description:\n \"The form's current values, as they would be sent to save, for what the check depends on (a page's parent).\",\n }),\n })\n .meta({ description: 'A value of a field with `check`, to check with the backend.' });\n\nexport const FieldCheckResponse = z\n .looseObject({\n available: z.boolean().meta({\n description:\n 'Whether no other item of the resource, in its scope and the same locale, has the value.',\n }),\n suggestion: z.string().nullable().optional().meta({\n description: 'An available value close to the one checked, when it is taken.',\n }),\n prefix: z.string().nullable().optional().meta({\n description: 'What the field shows in front of the value: the start of its URL.',\n }),\n url: z\n .string()\n .nullable()\n .optional()\n .meta({ description: 'The URL the value gives the item, which the field links to.' }),\n disabled: z.boolean().optional().meta({\n description:\n \"The field doesn't apply to this item (the home page has no slug): the field is read-only.\",\n }),\n })\n .meta({\n description:\n 'What the backend says about a value: not authoritative, since saving still validates it.',\n });\n\nexport const Session = z.looseObject({ user: User });\n\nexport const TwoFactorChallenge = z.looseObject({ twoFactor: z.literal(true) }).meta({\n description:\n 'The answer of `POST /auth/login` when a second factor is needed: the login waits for `POST /auth/two-factor/challenge`.',\n});\n\nexport const TwoFactorStatus = z\n .looseObject({\n status: z.enum(['disabled', 'pending', 'enabled']).meta({\n description: '`pending`: set up, not confirmed with a code yet.',\n }),\n required: z.boolean().meta({\n description: \"The backend requires it for this user: it can't be turned off.\",\n }),\n })\n .meta({ description: 'The two-factor authentication of the current user.' });\n\nexport const TwoFactorSetup = z\n .looseObject({\n secret: z.string().meta({ description: 'The secret, to type in an authenticator app.' }),\n otpauthUrl: z.string().meta({ description: 'The `otpauth://totp/…` URL of the secret.' }),\n qrCode: z.string().optional().meta({\n description:\n 'An SVG document of the QR code of `otpauthUrl`. Clients show it as an image, never as markup.',\n }),\n })\n .meta({ description: 'A two-factor authentication to confirm with a code.' });\n\nexport const WebAuthnOptions = z\n .looseObject({\n options: z.record(z.string(), z.unknown()).meta({\n description:\n 'The options of `navigator.credentials.get()` or `create()`, in the JSON form of the WebAuthn spec.',\n }),\n })\n .meta({ description: 'The options of a WebAuthn ceremony.' });\n\nexport const Passkey = z\n .looseObject({\n id: Id,\n name: z.string(),\n authenticator: z.string().nullable().optional().meta({\n description: 'What keeps it, when the backend knows: \"iCloud Keychain\", \"1Password\"…',\n }),\n createdAt: z.string().meta({ description: 'ISO 8601.' }),\n lastUsedAt: z\n .string()\n .nullable()\n .meta({ description: 'ISO 8601, or null before its first login.' }),\n })\n .meta({ description: 'A passkey of the current user.' });\n\nexport const RecoveryCodes = z.looseObject({ recoveryCodes: z.array(z.string()) }).meta({\n description: 'Codes that each log in once in place of a code of the authenticator app.',\n});\n\nexport const ContextOptionsResponse = z\n .looseObject({ data: z.array(ContextOption) })\n .meta({ description: 'The first choices of a param of the context that match `q`.' });\n\nexport const SearchResponse = z\n .looseObject({\n data: z.array(\n z.looseObject({\n resource: z.string().meta({ description: 'The id of the resource.' }),\n items: z.array(Item),\n total: z.number().int().nonnegative().optional().meta({\n description:\n 'How many items of the resource match, when the backend counts them: the list of the resource, searched, shows them all.',\n }),\n }),\n ),\n })\n .meta({\n description:\n 'The results of the global search: the resources with results, in the order of the definition.',\n });\n\nexport const PreviewResponse = z.looseObject({ url: z.string(), expiresAt: z.string().optional() });\n\nexport const EmbedValue = z\n .looseObject({\n url: z.string().meta({ description: 'The URL of the video, sound or post.' }),\n type: z.enum(['video', 'audio', 'photo', 'rich', 'link']).optional(),\n title: z.string().optional(),\n provider: z.string().optional().meta({ description: 'The name of the provider.' }),\n thumbnailUrl: z.string().optional(),\n html: z\n .string()\n .optional()\n .meta({ description: 'The HTML that embeds it, from the oEmbed of its provider.' }),\n width: z.number().optional(),\n height: z.number().optional(),\n })\n .meta({\n description:\n 'The value of an `embed` field: its URL, and what the backend got from its oEmbed.',\n });\n\nexport const EmbedResponse = z.looseObject({ data: EmbedValue });\n\nexport const LocationValue = z\n .looseObject({\n lat: z.number().min(-90).max(90),\n lng: z.number().min(-180).max(180),\n address: z.string().optional(),\n })\n .meta({ description: 'The value of a `location` field: a point, and its address.' });\n\nexport const AddressValue = z\n .looseObject({\n street: z.string().optional().meta({ description: 'The number and the street.' }),\n unit: z.string().optional().meta({ description: 'An apartment, a suite or a floor.' }),\n city: z.string().optional(),\n region: z.string().optional().meta({\n description:\n 'A value of the `region` type for the country: the code of the region without its country (`QC`) for the countries Panneau knows the regions of, the text as typed for the others.',\n }),\n postalCode: z.string().optional().meta({\n description: 'Normalized for its country: `H2X 1Y4`, `12345-6789`.',\n }),\n country: z\n .string()\n .regex(/^[A-Z]{2}$/)\n .optional()\n .meta({ description: 'An ISO 3166-1 alpha-2 code: `CA`.' }),\n point: z\n .looseObject({ lat: z.number().min(-90).max(90), lng: z.number().min(-180).max(180) })\n .optional()\n .meta({ description: 'The place of the address on a map, with `settings.point`.' }),\n })\n .meta({\n description:\n 'The value of an `address` field (decision 0054): the parts of a postal address, the empty ones left out.',\n });\n\nexport const LinkValue = z\n .looseObject({\n type: z.string().min(1).meta({\n description:\n 'The type of the link: `url`, `page`, `email`, `tel`, `file`, or a type of the site.',\n }),\n url: z.string().optional().meta({\n description:\n 'The `href` of the link: `https://…`, `mailto:…`, `tel:+…`, or the text of a type of the site. For `page` and `file` links, the URL the backend resolved, in items only.',\n }),\n page: z\n .union([\n z.string(),\n z.looseObject({\n id: z.string(),\n resource: z.string().optional(),\n label: z.string().optional(),\n }),\n ])\n .optional()\n .meta({\n description:\n '`page` links: the item, `{ \"id\", \"resource\", \"label\" }` in items, its id or `{ \"id\", \"resource\" }` in requests.',\n }),\n file: z\n .union([z.string(), z.looseObject({ id: z.string() })])\n .optional()\n .meta({ description: '`file` links: the media, as a `media` value.' }),\n label: z\n .union([z.string(), z.record(z.string(), z.string().nullable())])\n .nullable()\n .optional()\n .meta({\n description:\n 'The words of the link, per locale; a string in a `localized` link field.',\n }),\n newTab: z.boolean().optional().meta({ description: 'The link opens in a new tab.' }),\n })\n .meta({ description: 'The value of a `link` field (decision 0055).' });\n\nexport const DateRangeValue = z\n .looseObject({\n start: z.string().nullable().meta({\n description:\n 'The first day (`2026-11-04`) or the start (`2026-11-04T23:30:00Z`), or `null` when the range is open at its start.',\n }),\n end: z.string().nullable().meta({\n description:\n 'The last day, included, or the end, or `null` when the range is open at its end. On or after the start.',\n }),\n allDay: z\n .boolean()\n .optional()\n .meta({ description: 'The range takes whole days: its bounds are days.' }),\n timeZone: z.string().optional().meta({\n description:\n 'The IANA time zone the date-times are shown and typed in (`America/Toronto`), when the field lets the user choose it.',\n }),\n })\n .meta({\n description:\n 'The value of a `daterange` field: a start and an end, days or date-times (decision 0053).',\n });\n\nexport const MoneyValue = z\n .looseObject({\n amount: z.number().int().meta({\n description:\n 'The amount in the minor unit of the currency, its ISO 4217 exponent: `1250` is 12.50 CAD, `1250` is 1,250 JPY.',\n }),\n currency: z\n .string()\n .regex(/^[A-Z]{3}$/)\n .meta({ description: 'An ISO 4217 currency code, in capitals: `CAD`.' }),\n })\n .meta({\n description: 'The value of a `money` field: an amount and its currency (decision 0053).',\n });\n\nexport type Item = z.infer<typeof Item>;\nexport type Pagination = z.infer<typeof Pagination>;\nexport type ItemResponse = z.infer<typeof ItemResponse>;\nexport type CursorPagination = z.infer<typeof CursorPagination>;\nexport type ListResponse = z.infer<typeof ListResponse>;\nexport type ContextOptionsResponse = z.infer<typeof ContextOptionsResponse>;\nexport type Problem = z.infer<typeof Problem>;\nexport type Selection = z.infer<typeof Selection>;\nexport type ActionRequest = z.infer<typeof ActionRequest>;\nexport type ActionItemResult = z.infer<typeof ActionItemResult>;\nexport type ActionResult = z.infer<typeof ActionResult>;\nexport type ActionRun = z.infer<typeof ActionRun>;\nexport type ActionRunResponse = z.infer<typeof ActionRunResponse>;\nexport type MediaTransform = z.infer<typeof MediaTransform>;\nexport type UploadReference = z.infer<typeof UploadReference>;\nexport type StoredFile = z.infer<typeof StoredFile>;\nexport type Upload = z.infer<typeof Upload>;\nexport type UploadResponse = z.infer<typeof UploadResponse>;\nexport type UploadSignRequest = z.infer<typeof UploadSignRequest>;\nexport type UploadSignResponse = z.infer<typeof UploadSignResponse>;\nexport type FieldCheckRequest = z.infer<typeof FieldCheckRequest>;\nexport type FieldCheckResponse = z.infer<typeof FieldCheckResponse>;\nexport type MediaInfo = z.infer<typeof MediaInfo>;\nexport type MediaItem = z.infer<typeof MediaItem>;\nexport type MediaReference = z.infer<typeof MediaReference>;\nexport type Session = z.infer<typeof Session>;\nexport type TwoFactorChallenge = z.infer<typeof TwoFactorChallenge>;\nexport type TwoFactorStatus = z.infer<typeof TwoFactorStatus>;\nexport type TwoFactorSetup = z.infer<typeof TwoFactorSetup>;\nexport type RecoveryCodes = z.infer<typeof RecoveryCodes>;\nexport type WebAuthnOptions = z.infer<typeof WebAuthnOptions>;\nexport type Passkey = z.infer<typeof Passkey>;\nexport type SearchResponse = z.infer<typeof SearchResponse>;\nexport type PreviewResponse = z.infer<typeof PreviewResponse>;\nexport type EmbedValue = z.infer<typeof EmbedValue>;\nexport type EmbedResponse = z.infer<typeof EmbedResponse>;\nexport type LocationValue = z.infer<typeof LocationValue>;\nexport type AddressValue = z.infer<typeof AddressValue>;\nexport type LinkValue = z.infer<typeof LinkValue>;\nexport type DateRangeValue = z.infer<typeof DateRangeValue>;\nexport type MoneyValue = z.infer<typeof MoneyValue>;\n"],"mappings":";;;;AAKA,IAAa,OAAO,EACf,YAAY;CACT,IAAI;CACJ,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAChC,aAAa,oEACjB,CAAC;CACD,WAAW;AACf,CAAC,CAAC,CACD,KAAK,EACF,aAAa,4EACjB,CAAC;AAEL,IAAa,aAAa,EAAE,YAAY;CACpC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CAChC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CACnC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY;CACpC,UAAU,EAAE,OAAO,CAAC,CA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AE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC9B,aACI,qHACR,CAAC;CACD,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC5B,aACI,0GACR,CAAC;CACD,QAAQ,EACH,QAAQ,CAAC,CACT,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,mDAAmD,CAAC;CAC7E,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACjC,aACI,wHACR,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EACF,aACI,4FACR,CAAC;AAEL,IAAa,aAAa,EACrB,YAAY;CACT,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAC1B,aACI,iHACR,CAAC;CACD,UAAU,EACL,OAAO,CAAC,CACR,MAAM,YAAY,CAAC,CACnB,KAAK,EAAE,aAAa,iDAAiD,CAAC;AAC/E,CAAC,CAAC,CACD,KAAK,EACF,aAAa,4EACjB,CAAC"}
|
package/dist/schemas/field.js
CHANGED
|
@@ -133,7 +133,7 @@ var Field = z.looseObject({
|
|
|
133
133
|
rules: z.array(Rule).optional(),
|
|
134
134
|
visibleWhen: Condition.optional(),
|
|
135
135
|
options: z.array(Option).optional().meta({ description: "`select`: the choices." }),
|
|
136
|
-
multiple: z.boolean().optional().meta({ description: "`select`, `relation`, `media`, `image`, `file`, `country
|
|
136
|
+
multiple: z.boolean().optional().meta({ description: "`select`, `relation`, `media`, `image`, `file`, `country`, and compound fields: the value is an array." }),
|
|
137
137
|
resource: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).optional().meta({ description: "`relation`: id of the related resource. `media`, `image`: id of a resource of kind `media`, or a list of them; without it, every library of the definition (decision 0027). `link`: the resources of its `page` links (decision 0055)." }),
|
|
138
138
|
accept: z.array(z.string()).optional().meta({ description: "`media`, `image`, `file`: accepted MIME types. `image` defaults to `image/*`." }),
|
|
139
139
|
ratios: z.array(Ratio).optional().meta({ description: "`image`: ratios the editor suggests. The `crop` rule enforces ratios (decision 0031)." }),
|
|
@@ -148,7 +148,7 @@ var Field = z.looseObject({
|
|
|
148
148
|
check: z.boolean().optional().meta({ description: "The client checks the value with the backend as it is typed, with `POST /resources/{resource}/fields/{field}/check`: whether a `slug` is available, and its URL. A field at the top of the resource only." }),
|
|
149
149
|
display: z.string().optional().meta({ description: "Display used in lists, when it differs from the default one of the type." }),
|
|
150
150
|
get fields() {
|
|
151
|
-
return z.array(Field).optional().meta({ description: "`group` and `repeater`: the nested fields." });
|
|
151
|
+
return z.array(Field).optional().meta({ description: "`group` and `repeater`: the nested fields. On a type that isn't built in, they make it a compound field (decision 0065): its value is an object of them, or a list of objects with `multiple`, and a client without the type's plugin renders it as a `group` or a `repeater`." });
|
|
152
152
|
},
|
|
153
153
|
get types() {
|
|
154
154
|
return z.array(BlockType).optional().meta({ description: "`repeater`: typed blocks, each with its own fields." });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":[],"sources":["../../src/schemas/field.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport {\n ADDRESS_PARTS,\n BUILT_IN_LINK_TYPES,\n DATE_RANGE_OPEN_BOUNDS,\n DURATION_UNITS,\n PORTABLE_RULES,\n RICH_TEXT_STYLE_ELEMENTS,\n} from '../constants';\nimport { Abilities, Condition, Option } from './common';\n\nconst message = z\n .string()\n .optional()\n .meta({ description: 'Message shown when the rule fails, instead of the default one.' });\n\nconst mode = z.enum(['create', 'update']).optional().meta({\n description:\n 'The rule only applies when the item is created (`create`) or updated (`update`): a password required to create a user, optional to edit one. Without it, the rule applies in both modes.',\n});\n\nconst Ratio = z\n .string()\n .regex(/^[1-9][0-9]*:[1-9][0-9]*$/)\n .meta({ description: 'An aspect ratio, as `width:height`: `16:9`.' });\n\nconst CountryCode = z\n .string()\n .regex(/^[A-Z]{2}$/)\n .meta({ description: 'An ISO 3166-1 alpha-2 code, in capitals: `CA`.' });\nconst CurrencyCode = z\n .string()\n .regex(/^[A-Z]{3}$/)\n .meta({ description: 'An ISO 4217 currency code, in capitals: `CAD`.' });\n\nconst DateRangeOpen = z.enum(DATE_RANGE_OPEN_BOUNDS).meta({\n description: 'Which bounds of the range can be `null`: `start`, `end` or `both`.',\n});\n\nconst DateBound = z.union([\n z.string().meta({ description: 'An ISO 8601 date or date-time.' }),\n z.looseObject({ field: z.string().min(1) }).meta({ description: 'Another field of the form.' }),\n]);\n\nexport const Rule = z\n .union([\n z.looseObject({ rule: z.literal('required'), message, mode }),\n z.looseObject({ rule: z.enum(['min', 'max']), value: z.number(), message, mode }),\n z.looseObject({\n rule: z.literal('pattern'),\n value: z.string(),\n flags: z.string().optional(),\n message,\n mode,\n }),\n z.looseObject({ rule: z.enum(['email', 'url', 'json']), message, mode }),\n z.looseObject({\n rule: z.literal('tel'),\n extension: z.boolean().optional().meta({\n description:\n 'The number can have an extension, after `;ext=` as in a `tel:` URI (RFC 3966): `+15145550199;ext=123`, 1 to 10 digits. Without it, a value with an extension fails.',\n }),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('daterange'),\n open: DateRangeOpen.optional(),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('money'),\n currencies: z.array(CurrencyCode).optional().meta({\n description: 'The currencies allowed. Without them, any ISO 4217 currency.',\n }),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('in'),\n value: z.array(z.union([z.string(), z.number(), z.boolean()])),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('accept'),\n value: z.array(z.string().min(1)),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('maxSize'),\n value: z.number().int().positive(),\n message,\n mode,\n }),\n z.looseObject({ rule: z.enum(['before', 'after']), value: DateBound, message, mode }),\n z.looseObject({\n rule: z.literal('postalCode'),\n value: z\n .union([\n CountryCode,\n z.looseObject({ field: z.string().min(1) }).meta({\n description: 'Another field of the form, which holds the country.',\n }),\n ])\n .optional()\n .meta({\n description:\n 'The country of the postal code. Without it, or without a country, any postal code passes. An `address` value has its own country.',\n }),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('crop'),\n value: z.looseObject({\n ratios: z.array(Ratio).optional().meta({\n description:\n 'A crop must have one of them: its height is within one pixel of its width divided by the ratio, after its rotation.',\n }),\n required: z\n .boolean()\n .optional()\n .meta({ description: 'Each image needs a crop for this use.' }),\n }),\n message,\n mode,\n }),\n z\n .looseObject({\n rule: z.literal('providers'),\n value: z.array(z.string().min(1)).min(1),\n message,\n mode,\n })\n .meta({\n description:\n 'The providers an `embed` value may come from: the `provider_name` of their oEmbed (`YouTube`), compared without case (decision 0058).',\n }),\n z\n .looseObject({\n rule: z\n .string()\n .refine((rule) => !(PORTABLE_RULES as readonly string[]).includes(rule)),\n message,\n mode,\n })\n .meta({\n description:\n \"A rule added in a later version of the protocol. Clients that don't know it ignore it; the server still enforces it.\",\n }),\n ])\n .meta({\n description:\n 'A portable validation rule. `min` and `max` apply to numbers, to the amount of `money` values (in minor units), and to the length of text and arrays. `daterange` and `money` are implied by their types, with the `open` bounds and the `currencies` of the field (decision 0053). `accept` lists MIME types (`image/*`). `maxSize` is in bytes. `tel` checks an E.164 number, with an extension when `extension` is `true`. `crop` checks the transform of each image of an `image` or `media` value (decision 0031). `postalCode` checks a postal code against the format of its country, for the countries whose format Panneau knows: Canada and the United States (decision 0054). `providers` lists the providers of an `embed` value (decision 0058).',\n });\n\nexport const BlockType = z.looseObject({\n id: z.string().min(1),\n label: z.string(),\n icon: z.string().optional(),\n // Return types are written out so that declaration files keep the recursion.\n get fields(): z.ZodArray<typeof Field> {\n return z.array(Field);\n },\n});\n\nexport const Field = z\n .looseObject({\n name: z.string().min(1),\n type: z\n .string()\n .min(1)\n .meta({ description: 'A built-in field type, or a type provided by a plugin.' }),\n label: z.string().optional(),\n help: z.string().optional(),\n placeholder: z.string().optional(),\n default: z.unknown().optional(),\n localized: z\n .boolean()\n .optional()\n .meta({ description: 'The value is an object keyed by locale.' }),\n readOnly: z.boolean().optional().meta({\n description:\n \"Nobody edits the field (a computed value). For a field the current user can't edit, use `abilities.update: false`.\",\n }),\n abilities: Abilities.optional().meta({\n description:\n \"What the current user can do with the field (decision 0046). Only `false` restricts: `view: false` leaves the field out of forms, details and lists, and items don't carry its value; `update: false` makes it read-only, and the backend ignores its value. For the fields at the top of a resource and of its types.\",\n }),\n createOnly: z.boolean().optional(),\n updateOnly: z.boolean().optional(),\n rules: z.array(Rule).optional(),\n visibleWhen: Condition.optional(),\n options: z.array(Option).optional().meta({ description: '`select`: the choices.' }),\n multiple: z.boolean().optional().meta({\n description:\n '`select`, `relation`, `media`, `image`, `file`, `country`: the value is an array.',\n }),\n resource: z\n .union([z.string().min(1), z.array(z.string().min(1)).min(1)])\n .optional()\n .meta({\n description:\n '`relation`: id of the related resource. `media`, `image`: id of a resource of kind `media`, or a list of them; without it, every library of the definition (decision 0027). `link`: the resources of its `page` links (decision 0055).',\n }),\n accept: z.array(z.string()).optional().meta({\n description:\n '`media`, `image`, `file`: accepted MIME types. `image` defaults to `image/*`.',\n }),\n ratios: z.array(Ratio).optional().meta({\n description:\n '`image`: ratios the editor suggests. The `crop` rule enforces ratios (decision 0031).',\n }),\n rotate: z.boolean().optional().meta({\n description: '`image`: whether the editor offers rotation and flips. Defaults to true.',\n }),\n focalPoint: z.boolean().optional().meta({\n description: '`image`: whether the editor offers the focal point. Defaults to true.',\n }),\n transformBase: z.enum(['media', 'original', 'choose']).optional().meta({\n description:\n \"`image`: what a transform for one use starts from: the media's own transform (`media`, the default), the original file, or the user's choice in the editor (decision 0031).\",\n }),\n from: z.string().optional().meta({\n description:\n '`slug`: the field the slug is generated from. `region`: the field of the same object that holds its country.',\n }),\n check: z.boolean().optional().meta({\n description:\n 'The client checks the value with the backend as it is typed, with `POST /resources/{resource}/fields/{field}/check`: whether a `slug` is available, and its URL. A field at the top of the resource only.',\n }),\n display: z.string().optional().meta({\n description: 'Display used in lists, when it differs from the default one of the type.',\n }),\n get fields(): z.ZodOptional<z.ZodArray<typeof Field>> {\n return z\n .array(Field)\n .optional()\n .meta({ description: '`group` and `repeater`: the nested fields.' });\n },\n get types(): z.ZodOptional<z.ZodArray<typeof BlockType>> {\n return z\n .array(BlockType)\n .optional()\n .meta({ description: '`repeater`: typed blocks, each with its own fields.' });\n },\n settings: z.record(z.string(), z.unknown()).optional(),\n })\n .meta({ description: 'A field of a form.' });\n\n/** A block style of a `richtext` field: a named class on an element (`<p class=\"big\">`). */\nexport const RichTextStyle = z\n .looseObject({\n label: z.string().meta({ description: 'The name of the style in the toolbar.' }),\n class: z.string().min(1).meta({\n description:\n 'The class the style puts on the element: `big`. Several classes are separated by spaces.',\n }),\n element: z.enum(RICH_TEXT_STYLE_ELEMENTS).optional().meta({\n description:\n 'The element the style applies to: `p` (the default), `h1` to `h6`, `blockquote`, `ul`, `ol` or `li`.',\n }),\n })\n .meta({\n description:\n 'A block style of a `richtext` field: a named class on a paragraph, a heading, a quote or a list (`<p class=\"big\">`).',\n });\n\n/**\n * The `settings` of a `richtext` field: its toolbar, heading levels, block styles and which links\n * open in a new tab. `validateDefinition()` checks them.\n */\nexport const RichTextSettings = z\n .looseObject({\n toolbar: z.array(z.string().min(1)).optional().meta({\n description:\n \"The toolbar, in order: `heading`, `style`, `bold`, `italic`, `underline`, `strike`, `superscript`, `subscript`, `code`, `link`, `bulletList`, `orderedList`, `blockquote`, `horizontalRule`, `clear`, `undo`, `redo`, `|` between groups, and the buttons of plugins. Clients skip the names they don't know.\",\n }),\n headings: z.array(z.number().int().min(1).max(6)).optional().meta({\n description: 'The heading levels the toolbar offers. Defaults to 2, 3 and 4.',\n }),\n styles: z.array(RichTextStyle).optional().meta({ description: 'The block styles.' }),\n links: z\n .looseObject({\n newTab: z.enum(['choose', 'external', 'never']).optional().meta({\n description:\n 'Which links open in a new tab (`target=\"_blank\" rel=\"noopener noreferrer\"`): as the user chooses (the default), every link to another site, or none.',\n }),\n })\n .optional(),\n })\n .meta({\n description:\n 'The `settings` of a `richtext` field. Its value is HTML. The toolbar only limits what users add: content that the field stores keeps its elements and attributes.',\n });\n\n/**\n * The `settings` of a `duration` field: the unit of its value, and the parts its input shows.\n * `validateDefinition()` checks them.\n */\nexport const DurationSettings = z\n .looseObject({\n unit: z.enum(DURATION_UNITS).optional().meta({\n description:\n 'The unit of the value, a whole number: `seconds` (the default), `minutes`, `hours` or `days`. The `min` and `max` rules are in it too.',\n }),\n precision: z.enum(DURATION_UNITS).optional().meta({\n description:\n 'The smallest part the input shows. Defaults to `unit`; a precision finer than `unit` is raised to it.',\n }),\n largestUnit: z.enum(DURATION_UNITS).optional().meta({\n description:\n 'The largest part the input shows, which has no upper bound: `days` shows days, and hours from 0 to 23. Defaults to the larger of `hours` and `precision`; a largest unit smaller than `precision` is raised to it.',\n }),\n })\n .meta({\n description:\n 'The `settings` of a `duration` field. Its value is a whole number of `unit`, zero or more. A day is 24 hours.',\n });\n\n/** A type of link that a site adds to a `link` field, in its `settings.types`. */\nexport const LinkTypeSetting = z\n .looseObject({\n id: z\n .string()\n .min(1)\n .refine((id) => !(BUILT_IN_LINK_TYPES as readonly string[]).includes(id), {\n message: \"A type of a site can't have the id of a built-in type.\",\n })\n .meta({ description: 'The id of the type, in the `type` of values: `anchor`.' }),\n label: z.string().meta({ description: 'The name of the type, in the field.' }),\n pattern: z.string().optional().meta({\n description: 'The pattern that the `url` of its links matches: `^#[\\\\w-]+$`.',\n }),\n placeholder: z.string().optional(),\n })\n .meta({\n description:\n 'A type of link that a site adds: its `url` is the text typed, checked against its `pattern`.',\n });\n\n/** The `settings` of a `link` field (decision 0055). `validateDefinition()` checks them. */\nexport const LinkSettings = z\n .looseObject({\n types: z\n .array(z.union([z.enum(BUILT_IN_LINK_TYPES), LinkTypeSetting]))\n .min(1)\n .optional()\n .meta({\n description:\n 'The types the field offers, in order: `url`, `page`, `email`, `tel`, `file`, and the types of the site. Defaults to `url`, `email` and `tel`, after `page` when the field has a `resource`.',\n }),\n newTab: z.enum(['choose', 'external', 'never']).optional().meta({\n description:\n 'Which links open in a new tab: as the user chooses (the default), by their type (`url` and `file` links), or none.',\n }),\n label: z.enum(['optional', 'required', 'none']).optional().meta({\n description: 'Whether links have a label: optional (the default), required, or none.',\n }),\n libraries: z.array(z.string().min(1)).optional().meta({\n description:\n 'The media libraries of `file` links. Defaults to every library of the definition.',\n }),\n })\n .meta({\n description:\n 'The `settings` of a `link` field. Its value is `{ \"type\", \"url\", \"page\", \"file\", \"label\", \"newTab\" }` (`LinkValue`).',\n });\n\n/** The `settings` of an `address` field (decision 0054). `validateDefinition()` checks them. */\nexport const AddressSettings = z\n .looseObject({\n country: CountryCode.optional().meta({\n description: 'The country of a new address. The field sets it once a part is typed.',\n }),\n countries: z.array(CountryCode).optional().meta({\n description:\n \"The countries the field allows. With one, the field doesn't show the country, and sets it.\",\n }),\n preferred: z\n .array(CountryCode)\n .optional()\n .meta({ description: 'The countries shown first.' }),\n required: z.array(z.enum(ADDRESS_PARTS)).optional().meta({\n description:\n 'The parts a filled address must have. Defaults to `street`, `city` and `country`.',\n }),\n point: z.boolean().optional().meta({\n description: 'Adds a map, and the point of the address to the value.',\n }),\n })\n .meta({\n description:\n 'The `settings` of an `address` field. Its value is `{ \"street\", \"unit\", \"city\", \"region\", \"postalCode\", \"country\", \"point\" }` (`AddressValue`).',\n });\n\n/** The `settings` of a `daterange` field (decision 0053). `validateDefinition()` checks them. */\nexport const DateRangeSettings = z\n .looseObject({\n time: z.boolean().optional().meta({\n description:\n 'The bounds are date-times, with an offset (`2026-11-04T23:30:00Z`). Without it, they are days (`2026-11-04`), both inclusive.',\n }),\n allDay: z.boolean().optional().meta({\n description:\n 'With `time`: an \"All day\" switch. An all-day value has days as bounds, and `\"allDay\": true`.',\n }),\n open: DateRangeOpen.optional(),\n timeZone: z.string().min(1).optional().meta({\n description:\n \"The IANA time zone the date-times are shown and typed in (`America/Toronto`), when the value has none. Without it, the browser's.\",\n }),\n chooseTimeZone: z.boolean().optional().meta({\n description:\n 'With `time`: the field has a menu of time zones, and keeps the choice in the value (`timeZone`).',\n }),\n })\n .meta({\n description:\n 'The `settings` of a `daterange` field: days or date-times, an \"All day\" switch, open bounds and the time zone of its date-times.',\n });\n\n/** The `settings` of a `money` field (decision 0053). `validateDefinition()` checks them. */\nexport const MoneySettings = z\n .looseObject({\n currency: CurrencyCode.optional().meta({\n description: 'The currency of every amount: the field shows it and cannot change it.',\n }),\n currencies: z.array(CurrencyCode).min(1).optional().meta({\n description:\n 'The currencies the user picks from, the first one for a new amount. Without `currency` or `currencies`, every currency.',\n }),\n })\n .meta({\n description:\n 'The `settings` of a `money` field: its currency, or the currencies to pick from. `min` and `max` rules apply to the amount, in minor units.',\n });\n\nexport type Rule = z.infer<typeof Rule>;\nexport type BlockType = z.infer<typeof BlockType>;\nexport type Field = z.infer<typeof Field>;\n/** A block style of a `richtext` field. */\nexport type RichTextStyle = z.infer<typeof RichTextStyle>;\n/** The `settings` of a `richtext` field. */\nexport type RichTextSettings = z.infer<typeof RichTextSettings>;\n/** A type of link that a site adds to a `link` field. */\nexport type LinkTypeSetting = z.infer<typeof LinkTypeSetting>;\n/** The `settings` of a `link` field. */\nexport type LinkSettings = z.infer<typeof LinkSettings>;\n/** The `settings` of an `address` field. */\nexport type AddressSettings = z.infer<typeof AddressSettings>;\n/** The `settings` of a `daterange` field. */\nexport type DateRangeSettings = z.infer<typeof DateRangeSettings>;\n/** The `settings` of a `money` field. */\nexport type MoneySettings = z.infer<typeof MoneySettings>;\n/** The `settings` of a `duration` field. */\nexport type DurationSettings = z.infer<typeof DurationSettings>;\n"],"mappings":";;;;AAYA,IAAM,UAAU,EACX,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,iEAAiE,CAAC;AAE3F,IAAM,OAAO,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACtD,aACI,2LACR,CAAC;AAED,IAAM,QAAQ,EACT,OAAO,CAAC,CACR,MAAM,2BAA2B,CAAC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CAAC,CAAC,KAAK,EACxC,aACI,mGACR,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EACF,aACI,qIACR,CAAC;;AAGL,IAAa,gBAAgB,EACxB,YAAY;CACT,UAAU,aAAa,SAAS,CAAC,CAAC,KAAK,EACnC,aAAa,yEACjB,CAAC;CACD,YAAY,EAAE,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACrD,aACI,0HACR,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EACF,aACI,8IACR,CAAC"}
|
|
1
|
+
{"version":3,"file":"field.js","names":[],"sources":["../../src/schemas/field.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport {\n ADDRESS_PARTS,\n BUILT_IN_LINK_TYPES,\n DATE_RANGE_OPEN_BOUNDS,\n DURATION_UNITS,\n PORTABLE_RULES,\n RICH_TEXT_STYLE_ELEMENTS,\n} from '../constants';\nimport { Abilities, Condition, Option } from './common';\n\nconst message = z\n .string()\n .optional()\n .meta({ description: 'Message shown when the rule fails, instead of the default one.' });\n\nconst mode = z.enum(['create', 'update']).optional().meta({\n description:\n 'The rule only applies when the item is created (`create`) or updated (`update`): a password required to create a user, optional to edit one. Without it, the rule applies in both modes.',\n});\n\nconst Ratio = z\n .string()\n .regex(/^[1-9][0-9]*:[1-9][0-9]*$/)\n .meta({ description: 'An aspect ratio, as `width:height`: `16:9`.' });\n\nconst CountryCode = z\n .string()\n .regex(/^[A-Z]{2}$/)\n .meta({ description: 'An ISO 3166-1 alpha-2 code, in capitals: `CA`.' });\nconst CurrencyCode = z\n .string()\n .regex(/^[A-Z]{3}$/)\n .meta({ description: 'An ISO 4217 currency code, in capitals: `CAD`.' });\n\nconst DateRangeOpen = z.enum(DATE_RANGE_OPEN_BOUNDS).meta({\n description: 'Which bounds of the range can be `null`: `start`, `end` or `both`.',\n});\n\nconst DateBound = z.union([\n z.string().meta({ description: 'An ISO 8601 date or date-time.' }),\n z.looseObject({ field: z.string().min(1) }).meta({ description: 'Another field of the form.' }),\n]);\n\nexport const Rule = z\n .union([\n z.looseObject({ rule: z.literal('required'), message, mode }),\n z.looseObject({ rule: z.enum(['min', 'max']), value: z.number(), message, mode }),\n z.looseObject({\n rule: z.literal('pattern'),\n value: z.string(),\n flags: z.string().optional(),\n message,\n mode,\n }),\n z.looseObject({ rule: z.enum(['email', 'url', 'json']), message, mode }),\n z.looseObject({\n rule: z.literal('tel'),\n extension: z.boolean().optional().meta({\n description:\n 'The number can have an extension, after `;ext=` as in a `tel:` URI (RFC 3966): `+15145550199;ext=123`, 1 to 10 digits. Without it, a value with an extension fails.',\n }),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('daterange'),\n open: DateRangeOpen.optional(),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('money'),\n currencies: z.array(CurrencyCode).optional().meta({\n description: 'The currencies allowed. Without them, any ISO 4217 currency.',\n }),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('in'),\n value: z.array(z.union([z.string(), z.number(), z.boolean()])),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('accept'),\n value: z.array(z.string().min(1)),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('maxSize'),\n value: z.number().int().positive(),\n message,\n mode,\n }),\n z.looseObject({ rule: z.enum(['before', 'after']), value: DateBound, message, mode }),\n z.looseObject({\n rule: z.literal('postalCode'),\n value: z\n .union([\n CountryCode,\n z.looseObject({ field: z.string().min(1) }).meta({\n description: 'Another field of the form, which holds the country.',\n }),\n ])\n .optional()\n .meta({\n description:\n 'The country of the postal code. Without it, or without a country, any postal code passes. An `address` value has its own country.',\n }),\n message,\n mode,\n }),\n z.looseObject({\n rule: z.literal('crop'),\n value: z.looseObject({\n ratios: z.array(Ratio).optional().meta({\n description:\n 'A crop must have one of them: its height is within one pixel of its width divided by the ratio, after its rotation.',\n }),\n required: z\n .boolean()\n .optional()\n .meta({ description: 'Each image needs a crop for this use.' }),\n }),\n message,\n mode,\n }),\n z\n .looseObject({\n rule: z.literal('providers'),\n value: z.array(z.string().min(1)).min(1),\n message,\n mode,\n })\n .meta({\n description:\n 'The providers an `embed` value may come from: the `provider_name` of their oEmbed (`YouTube`), compared without case (decision 0058).',\n }),\n z\n .looseObject({\n rule: z\n .string()\n .refine((rule) => !(PORTABLE_RULES as readonly string[]).includes(rule)),\n message,\n mode,\n })\n .meta({\n description:\n \"A rule added in a later version of the protocol. Clients that don't know it ignore it; the server still enforces it.\",\n }),\n ])\n .meta({\n description:\n 'A portable validation rule. `min` and `max` apply to numbers, to the amount of `money` values (in minor units), and to the length of text and arrays. `daterange` and `money` are implied by their types, with the `open` bounds and the `currencies` of the field (decision 0053). `accept` lists MIME types (`image/*`). `maxSize` is in bytes. `tel` checks an E.164 number, with an extension when `extension` is `true`. `crop` checks the transform of each image of an `image` or `media` value (decision 0031). `postalCode` checks a postal code against the format of its country, for the countries whose format Panneau knows: Canada and the United States (decision 0054). `providers` lists the providers of an `embed` value (decision 0058).',\n });\n\nexport const BlockType = z.looseObject({\n id: z.string().min(1),\n label: z.string(),\n icon: z.string().optional(),\n // Return types are written out so that declaration files keep the recursion.\n get fields(): z.ZodArray<typeof Field> {\n return z.array(Field);\n },\n});\n\nexport const Field = z\n .looseObject({\n name: z.string().min(1),\n type: z\n .string()\n .min(1)\n .meta({ description: 'A built-in field type, or a type provided by a plugin.' }),\n label: z.string().optional(),\n help: z.string().optional(),\n placeholder: z.string().optional(),\n default: z.unknown().optional(),\n localized: z\n .boolean()\n .optional()\n .meta({ description: 'The value is an object keyed by locale.' }),\n readOnly: z.boolean().optional().meta({\n description:\n \"Nobody edits the field (a computed value). For a field the current user can't edit, use `abilities.update: false`.\",\n }),\n abilities: Abilities.optional().meta({\n description:\n \"What the current user can do with the field (decision 0046). Only `false` restricts: `view: false` leaves the field out of forms, details and lists, and items don't carry its value; `update: false` makes it read-only, and the backend ignores its value. For the fields at the top of a resource and of its types.\",\n }),\n createOnly: z.boolean().optional(),\n updateOnly: z.boolean().optional(),\n rules: z.array(Rule).optional(),\n visibleWhen: Condition.optional(),\n options: z.array(Option).optional().meta({ description: '`select`: the choices.' }),\n multiple: z.boolean().optional().meta({\n description:\n '`select`, `relation`, `media`, `image`, `file`, `country`, and compound fields: the value is an array.',\n }),\n resource: z\n .union([z.string().min(1), z.array(z.string().min(1)).min(1)])\n .optional()\n .meta({\n description:\n '`relation`: id of the related resource. `media`, `image`: id of a resource of kind `media`, or a list of them; without it, every library of the definition (decision 0027). `link`: the resources of its `page` links (decision 0055).',\n }),\n accept: z.array(z.string()).optional().meta({\n description:\n '`media`, `image`, `file`: accepted MIME types. `image` defaults to `image/*`.',\n }),\n ratios: z.array(Ratio).optional().meta({\n description:\n '`image`: ratios the editor suggests. The `crop` rule enforces ratios (decision 0031).',\n }),\n rotate: z.boolean().optional().meta({\n description: '`image`: whether the editor offers rotation and flips. Defaults to true.',\n }),\n focalPoint: z.boolean().optional().meta({\n description: '`image`: whether the editor offers the focal point. Defaults to true.',\n }),\n transformBase: z.enum(['media', 'original', 'choose']).optional().meta({\n description:\n \"`image`: what a transform for one use starts from: the media's own transform (`media`, the default), the original file, or the user's choice in the editor (decision 0031).\",\n }),\n from: z.string().optional().meta({\n description:\n '`slug`: the field the slug is generated from. `region`: the field of the same object that holds its country.',\n }),\n check: z.boolean().optional().meta({\n description:\n 'The client checks the value with the backend as it is typed, with `POST /resources/{resource}/fields/{field}/check`: whether a `slug` is available, and its URL. A field at the top of the resource only.',\n }),\n display: z.string().optional().meta({\n description: 'Display used in lists, when it differs from the default one of the type.',\n }),\n get fields(): z.ZodOptional<z.ZodArray<typeof Field>> {\n return z.array(Field).optional().meta({\n description:\n \"`group` and `repeater`: the nested fields. On a type that isn't built in, they make it a compound field (decision 0065): its value is an object of them, or a list of objects with `multiple`, and a client without the type's plugin renders it as a `group` or a `repeater`.\",\n });\n },\n get types(): z.ZodOptional<z.ZodArray<typeof BlockType>> {\n return z\n .array(BlockType)\n .optional()\n .meta({ description: '`repeater`: typed blocks, each with its own fields.' });\n },\n settings: z.record(z.string(), z.unknown()).optional(),\n })\n .meta({ description: 'A field of a form.' });\n\n/** A block style of a `richtext` field: a named class on an element (`<p class=\"big\">`). */\nexport const RichTextStyle = z\n .looseObject({\n label: z.string().meta({ description: 'The name of the style in the toolbar.' }),\n class: z.string().min(1).meta({\n description:\n 'The class the style puts on the element: `big`. Several classes are separated by spaces.',\n }),\n element: z.enum(RICH_TEXT_STYLE_ELEMENTS).optional().meta({\n description:\n 'The element the style applies to: `p` (the default), `h1` to `h6`, `blockquote`, `ul`, `ol` or `li`.',\n }),\n })\n .meta({\n description:\n 'A block style of a `richtext` field: a named class on a paragraph, a heading, a quote or a list (`<p class=\"big\">`).',\n });\n\n/**\n * The `settings` of a `richtext` field: its toolbar, heading levels, block styles and which links\n * open in a new tab. `validateDefinition()` checks them.\n */\nexport const RichTextSettings = z\n .looseObject({\n toolbar: z.array(z.string().min(1)).optional().meta({\n description:\n \"The toolbar, in order: `heading`, `style`, `bold`, `italic`, `underline`, `strike`, `superscript`, `subscript`, `code`, `link`, `bulletList`, `orderedList`, `blockquote`, `horizontalRule`, `clear`, `undo`, `redo`, `|` between groups, and the buttons of plugins. Clients skip the names they don't know.\",\n }),\n headings: z.array(z.number().int().min(1).max(6)).optional().meta({\n description: 'The heading levels the toolbar offers. Defaults to 2, 3 and 4.',\n }),\n styles: z.array(RichTextStyle).optional().meta({ description: 'The block styles.' }),\n links: z\n .looseObject({\n newTab: z.enum(['choose', 'external', 'never']).optional().meta({\n description:\n 'Which links open in a new tab (`target=\"_blank\" rel=\"noopener noreferrer\"`): as the user chooses (the default), every link to another site, or none.',\n }),\n })\n .optional(),\n })\n .meta({\n description:\n 'The `settings` of a `richtext` field. Its value is HTML. The toolbar only limits what users add: content that the field stores keeps its elements and attributes.',\n });\n\n/**\n * The `settings` of a `duration` field: the unit of its value, and the parts its input shows.\n * `validateDefinition()` checks them.\n */\nexport const DurationSettings = z\n .looseObject({\n unit: z.enum(DURATION_UNITS).optional().meta({\n description:\n 'The unit of the value, a whole number: `seconds` (the default), `minutes`, `hours` or `days`. The `min` and `max` rules are in it too.',\n }),\n precision: z.enum(DURATION_UNITS).optional().meta({\n description:\n 'The smallest part the input shows. Defaults to `unit`; a precision finer than `unit` is raised to it.',\n }),\n largestUnit: z.enum(DURATION_UNITS).optional().meta({\n description:\n 'The largest part the input shows, which has no upper bound: `days` shows days, and hours from 0 to 23. Defaults to the larger of `hours` and `precision`; a largest unit smaller than `precision` is raised to it.',\n }),\n })\n .meta({\n description:\n 'The `settings` of a `duration` field. Its value is a whole number of `unit`, zero or more. A day is 24 hours.',\n });\n\n/** A type of link that a site adds to a `link` field, in its `settings.types`. */\nexport const LinkTypeSetting = z\n .looseObject({\n id: z\n .string()\n .min(1)\n .refine((id) => !(BUILT_IN_LINK_TYPES as readonly string[]).includes(id), {\n message: \"A type of a site can't have the id of a built-in type.\",\n })\n .meta({ description: 'The id of the type, in the `type` of values: `anchor`.' }),\n label: z.string().meta({ description: 'The name of the type, in the field.' }),\n pattern: z.string().optional().meta({\n description: 'The pattern that the `url` of its links matches: `^#[\\\\w-]+$`.',\n }),\n placeholder: z.string().optional(),\n })\n .meta({\n description:\n 'A type of link that a site adds: its `url` is the text typed, checked against its `pattern`.',\n });\n\n/** The `settings` of a `link` field (decision 0055). `validateDefinition()` checks them. */\nexport const LinkSettings = z\n .looseObject({\n types: z\n .array(z.union([z.enum(BUILT_IN_LINK_TYPES), LinkTypeSetting]))\n .min(1)\n .optional()\n .meta({\n description:\n 'The types the field offers, in order: `url`, `page`, `email`, `tel`, `file`, and the types of the site. Defaults to `url`, `email` and `tel`, after `page` when the field has a `resource`.',\n }),\n newTab: z.enum(['choose', 'external', 'never']).optional().meta({\n description:\n 'Which links open in a new tab: as the user chooses (the default), by their type (`url` and `file` links), or none.',\n }),\n label: z.enum(['optional', 'required', 'none']).optional().meta({\n description: 'Whether links have a label: optional (the default), required, or none.',\n }),\n libraries: z.array(z.string().min(1)).optional().meta({\n description:\n 'The media libraries of `file` links. Defaults to every library of the definition.',\n }),\n })\n .meta({\n description:\n 'The `settings` of a `link` field. Its value is `{ \"type\", \"url\", \"page\", \"file\", \"label\", \"newTab\" }` (`LinkValue`).',\n });\n\n/** The `settings` of an `address` field (decision 0054). `validateDefinition()` checks them. */\nexport const AddressSettings = z\n .looseObject({\n country: CountryCode.optional().meta({\n description: 'The country of a new address. The field sets it once a part is typed.',\n }),\n countries: z.array(CountryCode).optional().meta({\n description:\n \"The countries the field allows. With one, the field doesn't show the country, and sets it.\",\n }),\n preferred: z\n .array(CountryCode)\n .optional()\n .meta({ description: 'The countries shown first.' }),\n required: z.array(z.enum(ADDRESS_PARTS)).optional().meta({\n description:\n 'The parts a filled address must have. Defaults to `street`, `city` and `country`.',\n }),\n point: z.boolean().optional().meta({\n description: 'Adds a map, and the point of the address to the value.',\n }),\n })\n .meta({\n description:\n 'The `settings` of an `address` field. Its value is `{ \"street\", \"unit\", \"city\", \"region\", \"postalCode\", \"country\", \"point\" }` (`AddressValue`).',\n });\n\n/** The `settings` of a `daterange` field (decision 0053). `validateDefinition()` checks them. */\nexport const DateRangeSettings = z\n .looseObject({\n time: z.boolean().optional().meta({\n description:\n 'The bounds are date-times, with an offset (`2026-11-04T23:30:00Z`). Without it, they are days (`2026-11-04`), both inclusive.',\n }),\n allDay: z.boolean().optional().meta({\n description:\n 'With `time`: an \"All day\" switch. An all-day value has days as bounds, and `\"allDay\": true`.',\n }),\n open: DateRangeOpen.optional(),\n timeZone: z.string().min(1).optional().meta({\n description:\n \"The IANA time zone the date-times are shown and typed in (`America/Toronto`), when the value has none. Without it, the browser's.\",\n }),\n chooseTimeZone: z.boolean().optional().meta({\n description:\n 'With `time`: the field has a menu of time zones, and keeps the choice in the value (`timeZone`).',\n }),\n })\n .meta({\n description:\n 'The `settings` of a `daterange` field: days or date-times, an \"All day\" switch, open bounds and the time zone of its date-times.',\n });\n\n/** The `settings` of a `money` field (decision 0053). `validateDefinition()` checks them. */\nexport const MoneySettings = z\n .looseObject({\n currency: CurrencyCode.optional().meta({\n description: 'The currency of every amount: the field shows it and cannot change it.',\n }),\n currencies: z.array(CurrencyCode).min(1).optional().meta({\n description:\n 'The currencies the user picks from, the first one for a new amount. Without `currency` or `currencies`, every currency.',\n }),\n })\n .meta({\n description:\n 'The `settings` of a `money` field: its currency, or the currencies to pick from. `min` and `max` rules apply to the amount, in minor units.',\n });\n\nexport type Rule = z.infer<typeof Rule>;\nexport type BlockType = z.infer<typeof BlockType>;\nexport type Field = z.infer<typeof Field>;\n/** A block style of a `richtext` field. */\nexport type RichTextStyle = z.infer<typeof RichTextStyle>;\n/** The `settings` of a `richtext` field. */\nexport type RichTextSettings = z.infer<typeof RichTextSettings>;\n/** A type of link that a site adds to a `link` field. */\nexport type LinkTypeSetting = z.infer<typeof LinkTypeSetting>;\n/** The `settings` of a `link` field. */\nexport type LinkSettings = z.infer<typeof LinkSettings>;\n/** The `settings` of an `address` field. */\nexport type AddressSettings = z.infer<typeof AddressSettings>;\n/** The `settings` of a `daterange` field. */\nexport type DateRangeSettings = z.infer<typeof DateRangeSettings>;\n/** The `settings` of a `money` field. */\nexport type MoneySettings = z.infer<typeof MoneySettings>;\n/** The `settings` of a `duration` field. */\nexport type DurationSettings = z.infer<typeof DurationSettings>;\n"],"mappings":";;;;AAYA,IAAM,UAAU,EACX,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,iEAAiE,CAAC;AAE3F,IAAM,OAAO,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACtD,aACI,2LACR,CAAC;AAED,IAAM,QAAQ,EACT,OAAO,CAAC,CACR,MAAM,2BAA2B,CAAC,CAClC,KAAK,EAAE,aAAa,8CAA8C,CAAC;AAExE,IAAM,cAAc,EACf,OAAO,CAAC,CACR,MAAM,YAAY,CAAC,CACnB,KAAK,EAAE,aAAa,iDAAiD,CAAC;AAC3E,IAAM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