@panneau/protocol 5.0.0-alpha.5 → 5.0.0-alpha.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAInD,2CAA2C;AAC3C,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AA6ED,6EAA6E;AAC7E,wBAAgB,UAAU,CACtB,KAAK,EAAE,IAAI,EAAE,EACb,KAAK,EAAE,OAAO,EACd,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,WAAW,EAAE,CA2Ef;AAuFD;;;;GAIG;AACH,wBAAgB,WAAW,CACvB,MAAM,EAAE,KAAK,EAAE,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,GAAE,YAAiB,GAC3B,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAI/B"}
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAInD,2CAA2C;AAC3C,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AA6ED,6EAA6E;AAC7E,wBAAgB,UAAU,CACtB,KAAK,EAAE,IAAI,EAAE,EACb,KAAK,EAAE,OAAO,EACd,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,WAAW,EAAE,CA+Ef;AA+FD;;;;GAIG;AACH,wBAAgB,WAAW,CACvB,MAAM,EAAE,KAAK,EAAE,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,GAAE,YAAiB,GAC3B,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAI/B"}
package/dist/rules.js CHANGED
@@ -73,6 +73,9 @@ function checkRules(rules, value, root = {}) {
73
73
  case "url":
74
74
  valid = typeof value !== "string" || URL.canParse(value);
75
75
  break;
76
+ case "json":
77
+ valid = isRecord(value) || Array.isArray(value);
78
+ break;
76
79
  case "in": {
77
80
  const allowed = rule.value;
78
81
  valid = (Array.isArray(value) ? value : [value]).every((item) => allowed.includes(item));
@@ -103,8 +106,13 @@ function checkRules(rules, value, root = {}) {
103
106
  function addFailures(context, path, failures) {
104
107
  if (failures.length > 0) context.failures[path] = [...context.failures[path] ?? [], ...failures];
105
108
  }
106
- function checkFieldValue(field, value, path, context) {
109
+ /** The rules of a field, with those its type implies: `json` for the `json` type. */
110
+ function rulesOf(field) {
107
111
  const rules = field.rules ?? [];
112
+ return field.type === "json" && !rules.some((rule) => rule.rule === "json") ? [...rules, { rule: "json" }] : rules;
113
+ }
114
+ function checkFieldValue(field, value, path, context) {
115
+ const rules = rulesOf(field);
108
116
  if (field.localized === true) {
109
117
  const localized = isRecord(value) ? value : {};
110
118
  const required = rules.filter((rule) => rule.rule === "required");
package/dist/rules.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","names":[],"sources":["../src/rules.ts"],"sourcesContent":["import { evaluateCondition } from './conditions';\nimport { PORTABLE_RULES } from './constants';\nimport type { Field, Rule } from './schemas/field';\nimport { matchesRatio, renderedCropSize } from './transforms';\nimport { getValue, isFilled, isRecord } from './values';\n\n/** A rule that a value doesn't satisfy. */\nexport interface RuleFailure {\n rule: string;\n /** The rule's parameter (`max: 120` gives `120`). */\n value?: unknown;\n /** The message set on the rule, if any. */\n message?: string;\n}\n\nexport interface CheckOptions {\n /**\n * Locales a `required` localized field must be filled in. Without it, one filled locale is\n * enough.\n */\n locales?: string[];\n /** `create` skips `updateOnly` fields; `update` skips `createOnly` fields. */\n mode?: 'create' | 'update';\n /** Only check the fields present in the values (partial updates). */\n partial?: boolean;\n}\n\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\nfunction isKnownRule(rule: Rule): boolean {\n return (PORTABLE_RULES as readonly string[]).includes(rule.rule);\n}\n\nfunction failure(rule: Rule): RuleFailure {\n const result: RuleFailure = { rule: rule.rule };\n if ('value' in rule && rule.value !== undefined) {\n result.value = rule.value;\n }\n if (rule.message !== undefined) {\n result.message = rule.message;\n }\n return result;\n}\n\nfunction sizeOf(value: unknown): number | null {\n if (typeof value === 'number') {\n return value;\n }\n if (typeof value === 'string' || Array.isArray(value)) {\n return value.length;\n }\n return null;\n}\n\nfunction matchesMime(mime: string, patterns: string[]): boolean {\n return patterns.some((pattern) => {\n if (pattern.endsWith('/*')) {\n return mime.startsWith(pattern.slice(0, -1));\n }\n return mime === pattern;\n });\n}\n\nfunction mediaList(value: unknown): Record<string, unknown>[] {\n const list = Array.isArray(value) ? value : [value];\n return list.filter(isRecord);\n}\n\n/**\n * Whether each image of a value has the crop the `crop` rule asks for (decision 0031): a crop when\n * it is required, and one of the ratios once rendered. An id alone has no crop.\n */\nfunction hasCrop(value: unknown, rule: { ratios?: string[]; required?: boolean }): boolean {\n const entries = Array.isArray(value) ? value : [value];\n return entries.every((entry) => {\n const transform = isRecord(entry) && isRecord(entry.transform) ? entry.transform : {};\n const size = renderedCropSize(transform);\n if (size === null) {\n return rule.required !== true;\n }\n const ratios = rule.ratios ?? [];\n return (\n ratios.length === 0 ||\n ratios.some((ratio) => matchesRatio(size.width, size.height, ratio))\n );\n });\n}\n\nfunction toTime(value: unknown): number | null {\n if (typeof value !== 'string' && typeof value !== 'number') {\n return null;\n }\n const time = new Date(value).getTime();\n return Number.isNaN(time) ? null : time;\n}\n\n/** Checks one value against a field's rules. Returns the rules that fail. */\nexport function checkRules(\n rules: Rule[],\n value: unknown,\n root: Record<string, unknown> = {},\n): RuleFailure[] {\n const failures: RuleFailure[] = [];\n const filled = isFilled(value);\n rules.filter(isKnownRule).forEach((rule) => {\n if (rule.rule === 'required') {\n if (!filled) {\n failures.push(failure(rule));\n }\n return;\n }\n if (!filled) {\n return;\n }\n let valid = true;\n switch (rule.rule) {\n case 'min':\n case 'max': {\n const size = sizeOf(value);\n const limit = rule.value as number;\n valid = size === null || (rule.rule === 'min' ? size >= limit : size <= limit);\n break;\n }\n case 'pattern':\n valid =\n typeof value !== 'string' ||\n new RegExp(rule.value as string, (rule as { flags?: string }).flags).test(\n value,\n );\n break;\n case 'email':\n valid = typeof value !== 'string' || EMAIL.test(value);\n break;\n case 'url':\n valid = typeof value !== 'string' || URL.canParse(value);\n break;\n case 'in': {\n const allowed = rule.value as unknown[];\n const values = Array.isArray(value) ? value : [value];\n valid = values.every((item) => allowed.includes(item));\n break;\n }\n case 'accept':\n valid = mediaList(value).every(\n (media) =>\n typeof media.mime !== 'string' ||\n matchesMime(media.mime, rule.value as string[]),\n );\n break;\n case 'maxSize':\n valid = mediaList(value).every(\n (media) =>\n typeof media.size !== 'number' || media.size <= (rule.value as number),\n );\n break;\n case 'crop':\n valid = !isRecord(rule.value) || hasCrop(value, rule.value);\n break;\n case 'before':\n case 'after': {\n const bound = rule.value as string | { field: string };\n const boundTime = toTime(\n typeof bound === 'string' ? bound : getValue(root, bound.field),\n );\n const time = toTime(value);\n if (boundTime !== null && time !== null) {\n valid = rule.rule === 'before' ? time < boundTime : time > boundTime;\n }\n break;\n }\n }\n if (!valid) {\n failures.push(failure(rule));\n }\n });\n return failures;\n}\n\nfunction addFailures(context: Context, path: string, failures: RuleFailure[]) {\n if (failures.length > 0) {\n context.failures[path] = [...(context.failures[path] ?? []), ...failures];\n }\n}\n\nfunction checkFieldValue(field: Field, value: unknown, path: string, context: Context) {\n const rules = field.rules ?? [];\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),\n );\n });\n }\n }\n Object.entries(localized).forEach(([locale, localeValue]) => {\n addFailures(\n context,\n `${path}.${locale}`,\n checkRules(others, localeValue, context.root),\n );\n });\n return;\n }\n\n addFailures(context, path, checkRules(rules, value, context.root));\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 (field.visibleWhen !== undefined && !evaluateCondition(field.visibleWhen, values)) {\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 context: Context = { ...options, root: values, failures: {} };\n checkFields(fields, values, '', context);\n return context.failures;\n}\n"],"mappings":";;;;;AAiCA,IAAM,QAAQ;AAEd,SAAS,YAAY,MAAqB;CACtC,OAAQ,eAAqC,SAAS,KAAK,IAAI;AACnE;AAEA,SAAS,QAAQ,MAAyB;CACtC,MAAM,SAAsB,EAAE,MAAM,KAAK,KAAK;CAC9C,IAAI,WAAW,QAAQ,KAAK,UAAU,KAAA,GAClC,OAAO,QAAQ,KAAK;CAExB,IAAI,KAAK,YAAY,KAAA,GACjB,OAAO,UAAU,KAAK;CAE1B,OAAO;AACX;AAEA,SAAS,OAAO,OAA+B;CAC3C,IAAI,OAAO,UAAU,UACjB,OAAO;CAEX,IAAI,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAChD,OAAO,MAAM;CAEjB,OAAO;AACX;AAEA,SAAS,YAAY,MAAc,UAA6B;CAC5D,OAAO,SAAS,MAAM,YAAY;EAC9B,IAAI,QAAQ,SAAS,IAAI,GACrB,OAAO,KAAK,WAAW,QAAQ,MAAM,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,YAAY,aAAa,MAAM,GAAG,KAAK,GAAG,MAAM,IAAI,OAAO;CAEnE,CAAC;AAET;AAEA,SAAS,YACL,QACA,QACA,QACA,SACF;CACE,OAAO,SAAS,UAAU;EACtB,IAAI,MAAM,aAAa,MACnB;EAEJ,IAAI,QAAQ,SAAS,YAAY,MAAM,eAAe,MAClD;EAEJ,IAAI,QAAQ,SAAS,YAAY,MAAM,eAAe,MAClD;EAEJ,IAAI,MAAM,gBAAgB,KAAA,KAAa,CAAC,kBAAkB,MAAM,aAAa,MAAM,GAC/E;EAEJ,IAAI,QAAQ,YAAY,QAAQ,WAAW,MAAM,EAAE,MAAM,QAAQ,SAC7D;EAEJ,gBAAgB,OAAO,OAAO,MAAM,OAAO,GAAG,SAAS,MAAM,QAAQ,OAAO;CAChF,CAAC;AACL;;;;;;AAOA,SAAgB,YACZ,QACA,QACA,UAAwB,CAAC,GACI;CAC7B,MAAM,UAAmB;EAAE,GAAG;EAAS,MAAM;EAAQ,UAAU,CAAC;CAAE;CAClE,YAAY,QAAQ,QAAQ,IAAI,OAAO;CACvC,OAAO,QAAQ;AACnB"}
1
+ {"version":3,"file":"rules.js","names":[],"sources":["../src/rules.ts"],"sourcesContent":["import { evaluateCondition } from './conditions';\nimport { PORTABLE_RULES } from './constants';\nimport type { Field, Rule } from './schemas/field';\nimport { matchesRatio, renderedCropSize } from './transforms';\nimport { getValue, isFilled, isRecord } from './values';\n\n/** A rule that a value doesn't satisfy. */\nexport interface RuleFailure {\n rule: string;\n /** The rule's parameter (`max: 120` gives `120`). */\n value?: unknown;\n /** The message set on the rule, if any. */\n message?: string;\n}\n\nexport interface CheckOptions {\n /**\n * Locales a `required` localized field must be filled in. Without it, one filled locale is\n * enough.\n */\n locales?: string[];\n /** `create` skips `updateOnly` fields; `update` skips `createOnly` fields. */\n mode?: 'create' | 'update';\n /** Only check the fields present in the values (partial updates). */\n partial?: boolean;\n}\n\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\nfunction isKnownRule(rule: Rule): boolean {\n return (PORTABLE_RULES as readonly string[]).includes(rule.rule);\n}\n\nfunction failure(rule: Rule): RuleFailure {\n const result: RuleFailure = { rule: rule.rule };\n if ('value' in rule && rule.value !== undefined) {\n result.value = rule.value;\n }\n if (rule.message !== undefined) {\n result.message = rule.message;\n }\n return result;\n}\n\nfunction sizeOf(value: unknown): number | null {\n if (typeof value === 'number') {\n return value;\n }\n if (typeof value === 'string' || Array.isArray(value)) {\n return value.length;\n }\n return null;\n}\n\nfunction matchesMime(mime: string, patterns: string[]): boolean {\n return patterns.some((pattern) => {\n if (pattern.endsWith('/*')) {\n return mime.startsWith(pattern.slice(0, -1));\n }\n return mime === pattern;\n });\n}\n\nfunction mediaList(value: unknown): Record<string, unknown>[] {\n const list = Array.isArray(value) ? value : [value];\n return list.filter(isRecord);\n}\n\n/**\n * Whether each image of a value has the crop the `crop` rule asks for (decision 0031): a crop when\n * it is required, and one of the ratios once rendered. An id alone has no crop.\n */\nfunction hasCrop(value: unknown, rule: { ratios?: string[]; required?: boolean }): boolean {\n const entries = Array.isArray(value) ? value : [value];\n return entries.every((entry) => {\n const transform = isRecord(entry) && isRecord(entry.transform) ? entry.transform : {};\n const size = renderedCropSize(transform);\n if (size === null) {\n return rule.required !== true;\n }\n const ratios = rule.ratios ?? [];\n return (\n ratios.length === 0 ||\n ratios.some((ratio) => matchesRatio(size.width, size.height, ratio))\n );\n });\n}\n\nfunction toTime(value: unknown): number | null {\n if (typeof value !== 'string' && typeof value !== 'number') {\n return null;\n }\n const time = new Date(value).getTime();\n return Number.isNaN(time) ? null : time;\n}\n\n/** Checks one value against a field's rules. Returns the rules that fail. */\nexport function checkRules(\n rules: Rule[],\n value: unknown,\n root: Record<string, unknown> = {},\n): RuleFailure[] {\n const failures: RuleFailure[] = [];\n const filled = isFilled(value);\n rules.filter(isKnownRule).forEach((rule) => {\n if (rule.rule === 'required') {\n if (!filled) {\n failures.push(failure(rule));\n }\n return;\n }\n if (!filled) {\n return;\n }\n let valid = true;\n switch (rule.rule) {\n case 'min':\n case 'max': {\n const size = sizeOf(value);\n const limit = rule.value as number;\n valid = size === null || (rule.rule === 'min' ? size >= limit : size <= limit);\n break;\n }\n case 'pattern':\n valid =\n typeof value !== 'string' ||\n new RegExp(rule.value as string, (rule as { flags?: string }).flags).test(\n value,\n );\n break;\n case 'email':\n valid = typeof value !== 'string' || EMAIL.test(value);\n break;\n case 'url':\n valid = typeof value !== 'string' || URL.canParse(value);\n break;\n case 'json':\n // Text that doesn't parse stays a string in the form: only objects and arrays pass\n valid = isRecord(value) || Array.isArray(value);\n break;\n case 'in': {\n const allowed = rule.value as unknown[];\n const values = Array.isArray(value) ? value : [value];\n valid = values.every((item) => allowed.includes(item));\n break;\n }\n case 'accept':\n valid = mediaList(value).every(\n (media) =>\n typeof media.mime !== 'string' ||\n matchesMime(media.mime, rule.value as string[]),\n );\n break;\n case 'maxSize':\n valid = mediaList(value).every(\n (media) =>\n typeof media.size !== 'number' || media.size <= (rule.value as number),\n );\n break;\n case 'crop':\n valid = !isRecord(rule.value) || hasCrop(value, rule.value);\n break;\n case 'before':\n case 'after': {\n const bound = rule.value as string | { field: string };\n const boundTime = toTime(\n typeof bound === 'string' ? bound : getValue(root, bound.field),\n );\n const time = toTime(value);\n if (boundTime !== null && time !== null) {\n valid = rule.rule === 'before' ? time < boundTime : time > boundTime;\n }\n break;\n }\n }\n if (!valid) {\n failures.push(failure(rule));\n }\n });\n return failures;\n}\n\nfunction addFailures(context: Context, path: string, failures: RuleFailure[]) {\n if (failures.length > 0) {\n context.failures[path] = [...(context.failures[path] ?? []), ...failures];\n }\n}\n\n/** The rules of a field, with those its type implies: `json` for the `json` type. */\nfunction rulesOf(field: Field): Rule[] {\n const rules = field.rules ?? [];\n return field.type === 'json' && !rules.some((rule) => rule.rule === 'json')\n ? [...rules, { rule: 'json' }]\n : rules;\n}\n\nfunction checkFieldValue(field: Field, value: unknown, path: string, context: Context) {\n const rules = rulesOf(field);\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),\n );\n });\n }\n }\n Object.entries(localized).forEach(([locale, localeValue]) => {\n addFailures(\n context,\n `${path}.${locale}`,\n checkRules(others, localeValue, context.root),\n );\n });\n return;\n }\n\n addFailures(context, path, checkRules(rules, value, context.root));\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 (field.visibleWhen !== undefined && !evaluateCondition(field.visibleWhen, values)) {\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 context: Context = { ...options, root: values, failures: {} };\n checkFields(fields, values, '', context);\n return context.failures;\n}\n"],"mappings":";;;;;AAiCA,IAAM,QAAQ;AAEd,SAAS,YAAY,MAAqB;CACtC,OAAQ,eAAqC,SAAS,KAAK,IAAI;AACnE;AAEA,SAAS,QAAQ,MAAyB;CACtC,MAAM,SAAsB,EAAE,MAAM,KAAK,KAAK;CAC9C,IAAI,WAAW,QAAQ,KAAK,UAAU,KAAA,GAClC,OAAO,QAAQ,KAAK;CAExB,IAAI,KAAK,YAAY,KAAA,GACjB,OAAO,UAAU,KAAK;CAE1B,OAAO;AACX;AAEA,SAAS,OAAO,OAA+B;CAC3C,IAAI,OAAO,UAAU,UACjB,OAAO;CAEX,IAAI,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAChD,OAAO,MAAM;CAEjB,OAAO;AACX;AAEA,SAAS,YAAY,MAAc,UAA6B;CAC5D,OAAO,SAAS,MAAM,YAAY;EAC9B,IAAI,QAAQ,SAAS,IAAI,GACrB,OAAO,KAAK,WAAW,QAAQ,MAAM,GAAG,EAAE,CAAC;EAE/C,OAAO,SAAS;CACpB,CAAC;AACL;AAEA,SAAS,UAAU,OAA2C;CAE1D,QADa,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAA,CACtC,OAAO,QAAQ;AAC/B;;;;;AAMA,SAAS,QAAQ,OAAgB,MAA0D;CAEvF,QADgB,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAA,CACtC,OAAO,UAAU;EAC5B,MAAM,YAAY,SAAS,KAAK,KAAK,SAAS,MAAM,SAAS,IAAI,MAAM,YAAY,CAAC;EACpF,MAAM,OAAO,iBAAiB,SAAS;EACvC,IAAI,SAAS,MACT,OAAO,KAAK,aAAa;EAE7B,MAAM,SAAS,KAAK,UAAU,CA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EAEJ,IAAI,QAAQ,SAAS,YAAY,MAAM,eAAe,MAClD;EAEJ,IAAI,MAAM,gBAAgB,KAAA,KAAa,CAAC,kBAAkB,MAAM,aAAa,MAAM,GAC/E;EAEJ,IAAI,QAAQ,YAAY,QAAQ,WAAW,MAAM,EAAE,MAAM,QAAQ,SAC7D;EAEJ,gBAAgB,OAAO,OAAO,MAAM,OAAO,GAAG,SAAS,MAAM,QAAQ,OAAO;CAChF,CAAC;AACL;;;;;;AAOA,SAAgB,YACZ,QACA,QACA,UAAwB,CAAC,GACI;CAC7B,MAAM,UAAmB;EAAE,GAAG;EAAS,MAAM;EAAQ,UAAU,CAAC;CAAE;CAClE,YAAY,QAAQ,QAAQ,IAAI,OAAO;CACvC,OAAO,QAAQ;AACnB"}
@@ -75,6 +75,7 @@ export declare const Action: z.ZodObject<{
75
75
  rule: z.ZodEnum<{
76
76
  email: "email";
77
77
  url: "url";
78
+ json: "json";
78
79
  }>;
79
80
  message: z.ZodOptional<z.ZodString>;
80
81
  }, z.core.$loose>, z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/schemas/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,WAAW;;;;EAA4C,CAAC;AAErE,eAAO,MAAM,eAAe;;;;;EAA6C,CAAC;AAE1E,eAAO,MAAM,aAAa;;;;;mBAWxB,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+CwE,CAAC;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AAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,qEAAqE;AACrE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC"}
@@ -287,6 +287,10 @@ export declare const MediaInfo: z.ZodObject<{
287
287
  processing: "processing";
288
288
  ready: "ready";
289
289
  }>>;
290
+ error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
291
+ code: z.ZodString;
292
+ message: z.ZodOptional<z.ZodString>;
293
+ }, z.core.$loose>>>;
290
294
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
291
295
  transform: z.ZodOptional<z.ZodNullable<z.ZodObject<{
292
296
  crop: z.ZodOptional<z.ZodObject<{
@@ -333,6 +337,10 @@ export declare const MediaItem: z.ZodObject<{
333
337
  processing: "processing";
334
338
  ready: "ready";
335
339
  }>>;
340
+ error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
341
+ code: z.ZodString;
342
+ message: z.ZodOptional<z.ZodString>;
343
+ }, z.core.$loose>>>;
336
344
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
337
345
  transform: z.ZodOptional<z.ZodNullable<z.ZodObject<{
338
346
  crop: z.ZodOptional<z.ZodObject<{
@@ -380,6 +388,10 @@ export declare const MediaReference: z.ZodObject<{
380
388
  processing: "processing";
381
389
  ready: "ready";
382
390
  }>>;
391
+ error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
392
+ code: z.ZodString;
393
+ message: z.ZodOptional<z.ZodString>;
394
+ }, z.core.$loose>>>;
383
395
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
384
396
  transform: z.ZodOptional<z.ZodNullable<z.ZodObject<{
385
397
  crop: z.ZodOptional<z.ZodObject<{
@@ -461,6 +473,45 @@ export declare const PreviewResponse: z.ZodObject<{
461
473
  url: z.ZodString;
462
474
  expiresAt: z.ZodOptional<z.ZodString>;
463
475
  }, z.core.$loose>;
476
+ export declare const EmbedValue: z.ZodObject<{
477
+ url: z.ZodString;
478
+ type: z.ZodOptional<z.ZodEnum<{
479
+ link: "link";
480
+ video: "video";
481
+ audio: "audio";
482
+ photo: "photo";
483
+ rich: "rich";
484
+ }>>;
485
+ title: z.ZodOptional<z.ZodString>;
486
+ provider: z.ZodOptional<z.ZodString>;
487
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
488
+ html: z.ZodOptional<z.ZodString>;
489
+ width: z.ZodOptional<z.ZodNumber>;
490
+ height: z.ZodOptional<z.ZodNumber>;
491
+ }, z.core.$loose>;
492
+ export declare const EmbedResponse: z.ZodObject<{
493
+ data: z.ZodObject<{
494
+ url: z.ZodString;
495
+ type: z.ZodOptional<z.ZodEnum<{
496
+ link: "link";
497
+ video: "video";
498
+ audio: "audio";
499
+ photo: "photo";
500
+ rich: "rich";
501
+ }>>;
502
+ title: z.ZodOptional<z.ZodString>;
503
+ provider: z.ZodOptional<z.ZodString>;
504
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
505
+ html: z.ZodOptional<z.ZodString>;
506
+ width: z.ZodOptional<z.ZodNumber>;
507
+ height: z.ZodOptional<z.ZodNumber>;
508
+ }, z.core.$loose>;
509
+ }, z.core.$loose>;
510
+ export declare const LocationValue: z.ZodObject<{
511
+ lat: z.ZodNumber;
512
+ lng: z.ZodNumber;
513
+ address: z.ZodOptional<z.ZodString>;
514
+ }, z.core.$loose>;
464
515
  export type Item = z.infer<typeof Item>;
465
516
  export type Pagination = z.infer<typeof Pagination>;
466
517
  export type ItemResponse = z.infer<typeof ItemResponse>;
@@ -487,4 +538,7 @@ export type MediaReference = z.infer<typeof MediaReference>;
487
538
  export type Session = z.infer<typeof Session>;
488
539
  export type SearchResponse = z.infer<typeof SearchResponse>;
489
540
  export type PreviewResponse = z.infer<typeof PreviewResponse>;
541
+ export type EmbedValue = z.infer<typeof EmbedValue>;
542
+ export type EmbedResponse = z.infer<typeof EmbedResponse>;
543
+ export type LocationValue = z.infer<typeof LocationValue>;
490
544
  //# sourceMappingURL=api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/schemas/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,IAAI;;;;iBAUX,CAAC;AAEP,eAAO,MAAM,UAAU;;;;;iBAKrB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;iBAAgC,CAAC;AAE1D,eAAO,MAAM,YAAY;;;;;;;;;;;;iBAA2D,CAAC;AAErF,eAAO,MAAM,OAAO;;;;;;;;;;;;iBAa6E,CAAC;AAElG,eAAO,MAAM,SAAS;;;;;;;;mBAYpB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;iBASxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;iBAQ3B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBvB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUpB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAoC,CAAC;AAEnE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;mBAgCE,CAAC,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC;iBAU3D,CAAC;AAEP,eAAO,MAAM,eAAe;;iBAG1B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;iBAYjB,CAAC;AAEP,eAAO,MAAM,MAAM;;;;;;iBAWb,CAAC;AAEP,eAAO,MAAM,cAAc;;;;;;;;iBAAkC,CAAC;AAE9D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;iBAWxB,CAAC;AAEP,eAAO,MAAM,kBAAkB;;;;;iBAemB,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AAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACpE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACpE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACpD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -162,6 +162,10 @@ var MediaInfo = z.looseObject({
162
162
  "ready",
163
163
  "failed"
164
164
  ]).optional().meta({ description: "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." }),
165
+ error: z.looseObject({
166
+ code: z.string().meta({ description: "The code of the step that failed, such as a transcoder task code (`timeout`, `input_unreadable`)." }),
167
+ message: z.string().optional().meta({ description: "Why it failed, for people." })
168
+ }).nullable().optional().meta({ description: "Why the processing failed, when `status` is `failed`, so that editors see it without the backend's monitoring." }),
165
169
  metadata: z.record(z.string(), z.unknown()).optional(),
166
170
  transform: MediaTransform.nullable().optional().meta({ description: "The media's own transform, from its library, which clients need to draw a transform for one use made over it (decision 0031)." })
167
171
  }).meta({ description: "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." });
@@ -196,7 +200,29 @@ var PreviewResponse = z.looseObject({
196
200
  url: z.string(),
197
201
  expiresAt: z.string().optional()
198
202
  });
203
+ var EmbedValue = z.looseObject({
204
+ url: z.string().meta({ description: "The URL of the video, sound or post." }),
205
+ type: z.enum([
206
+ "video",
207
+ "audio",
208
+ "photo",
209
+ "rich",
210
+ "link"
211
+ ]).optional(),
212
+ title: z.string().optional(),
213
+ provider: z.string().optional().meta({ description: "The name of the provider." }),
214
+ thumbnailUrl: z.string().optional(),
215
+ html: z.string().optional().meta({ description: "The HTML that embeds it, from the oEmbed of its provider." }),
216
+ width: z.number().optional(),
217
+ height: z.number().optional()
218
+ }).meta({ description: "The value of an `embed` field: its URL, and what the backend got from its oEmbed." });
219
+ var EmbedResponse = z.looseObject({ data: EmbedValue });
220
+ var LocationValue = z.looseObject({
221
+ lat: z.number().min(-90).max(90),
222
+ lng: z.number().min(-180).max(180),
223
+ address: z.string().optional()
224
+ }).meta({ description: "The value of a `location` field: a point, and its address." });
199
225
  //#endregion
200
- export { ActionItemResult, ActionRequest, ActionResult, ActionRun, ActionRunResponse, FieldCheckRequest, FieldCheckResponse, Item, ItemResponse, ListResponse, MediaInfo, MediaItem, MediaReference, MediaTransform, Pagination, PreviewResponse, Problem, SearchResponse, Selection, Session, StoredFile, Upload, UploadReference, UploadResponse, UploadSignRequest, UploadSignResponse };
226
+ export { ActionItemResult, ActionRequest, ActionResult, ActionRun, ActionRunResponse, EmbedResponse, EmbedValue, FieldCheckRequest, FieldCheckResponse, Item, ItemResponse, ListResponse, LocationValue, MediaInfo, MediaItem, MediaReference, MediaTransform, Pagination, PreviewResponse, Problem, SearchResponse, Selection, Session, StoredFile, Upload, UploadReference, UploadResponse, UploadSignRequest, UploadSignResponse };
201
227
 
202
228
  //# sourceMappingURL=api.js.map
@@ -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 { 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 ItemResponse = z.looseObject({ data: Item });\n\nexport const ListResponse = z.looseObject({ data: z.array(Item), meta: Pagination });\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 })\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});\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 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 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 type Item = z.infer<typeof Item>;\nexport type Pagination = z.infer<typeof Pagination>;\nexport type ItemResponse = z.infer<typeof ItemResponse>;\nexport type ListResponse = z.infer<typeof ListResponse>;\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 SearchResponse = z.infer<typeof SearchResponse>;\nexport type PreviewResponse = z.infer<typeof PreviewResponse>;\n"],"mappings":";;;;AAKA,IAAa,OAAO,EACf,YAAY;CACT,I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YAAY;CACT,WAAW,EAAE,QAAQ,CAAC,CAAC,KAAK,EACxB,aACI,0FACR,CAAC;CACD,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC9C,aAAa,iEACjB,CAAC;CACD,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC1C,aAAa,oEACjB,CAAC;CACD,KAAK,EACA,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,8DAA8D,CAAC;CACxF,UAAU,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAClC,aACI,4FACR,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EACF,aACI,2FACR,CAAC;AAEL,IAAa,UAAU,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAEnD,IAAa,iBAAiB,EACzB,YAAY,EACT,MAAM,EAAE,MACJ,EAAE,YAAY;CACV,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,aAAa,0BAA0B,CAAC;CACpE,OAAO,EAAE,MAAM,IAAI;CACnB,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAClD,aACI,0HACR,CAAC;AACL,CAAC,CACL,EACJ,CAAC,CAAC,CACD,KAAK,EACF,aACI,gGACR,CAAC;AAEL,IAAa,kBAAkB,EAAE,YAAY;CAAE,KAAK,EAAE,OAAO;CAAG,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;AAAE,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 { 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 ItemResponse = z.looseObject({ data: Item });\n\nexport const ListResponse = z.looseObject({ data: z.array(Item), meta: Pagination });\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 })\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});\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 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 type Item = z.infer<typeof Item>;\nexport type Pagination = z.infer<typeof Pagination>;\nexport type ItemResponse = z.infer<typeof ItemResponse>;\nexport type ListResponse = z.infer<typeof ListResponse>;\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 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>;\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,CAAC,IAAI,CAAC,CAAC,SAAS;AACxC,CAAC;AAED,IAAa,eAAe,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAExD,IAAa,eAAe,EAAE,YAAY;CAAE,MAAM,EAAE,MAAM,IAAI;CAAG,MAAM;AAAW,CAAC;AAEnF,IAAa,UAAU,EAClB,YAAY;CACT,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,aAAa,oDAAoD,CAAC;CAC1F,OAAO,EAAE,OAAO;CAChB,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG;CACzC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,UAAU,EAAE,OAAO,CAAC,C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jC,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;AACjC,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,6DAA6D,CAAC"}
@@ -113,6 +113,7 @@ export declare const Definition: z.ZodObject<{
113
113
  rule: z.ZodEnum<{
114
114
  email: "email";
115
115
  url: "url";
116
+ json: "json";
116
117
  }>;
117
118
  message: z.ZodOptional<z.ZodString>;
118
119
  }, z.core.$loose>, z.ZodObject<{
@@ -298,6 +299,7 @@ export declare const Definition: z.ZodObject<{
298
299
  rule: z.ZodEnum<{
299
300
  email: "email";
300
301
  url: "url";
302
+ json: "json";
301
303
  }>;
302
304
  message: z.ZodOptional<z.ZodString>;
303
305
  }, z.core.$loose>, z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/schemas/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,IAAI;;;;;;;iBAUf,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;iBAKvB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;iBAef,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;cAYG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;iBAIjB,CAAC;AAElD,eAAO,MAAM,IAAI;;;;;iBAQf,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;iBAQjB,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;iBAUlB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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I,CAAC,CAAC;AACxC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AACxC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAChD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AACxC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAC9C,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACpD,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -19,6 +19,7 @@ export declare const Rule: z.ZodUnion<readonly [z.ZodObject<{
19
19
  rule: z.ZodEnum<{
20
20
  email: "email";
21
21
  url: "url";
22
+ json: "json";
22
23
  }>;
23
24
  message: z.ZodOptional<z.ZodString>;
24
25
  }, z.core.$loose>, z.ZodObject<{
@@ -89,6 +90,7 @@ export declare const Field: z.ZodObject<{
89
90
  rule: z.ZodEnum<{
90
91
  email: "email";
91
92
  url: "url";
93
+ json: "json";
92
94
  }>;
93
95
  message: z.ZodOptional<z.ZodString>;
94
96
  }, z.core.$loose>, z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/schemas/field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAU,MAAM,UAAU,CAAC;AAiB7C,eAAO,MAAM,IAAI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,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;WAMxC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;;iBAQhB,CAAC;AAEjD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AACxC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC"}
@@ -22,7 +22,11 @@ var Rule = z.union([
22
22
  message
23
23
  }),
24
24
  z.looseObject({
25
- rule: z.enum(["email", "url"]),
25
+ rule: z.enum([
26
+ "email",
27
+ "url",
28
+ "json"
29
+ ]),
26
30
  message
27
31
  }),
28
32
  z.looseObject({
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","names":[],"sources":["../../src/schemas/field.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { PORTABLE_RULES } from '../constants';\nimport { 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 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 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 }),\n z.looseObject({ rule: z.enum(['min', 'max']), value: z.number(), message }),\n z.looseObject({\n rule: z.literal('pattern'),\n value: z.string(),\n flags: z.string().optional(),\n message,\n }),\n z.looseObject({ rule: z.enum(['email', 'url']), message }),\n z.looseObject({\n rule: z.literal('in'),\n value: z.array(z.union([z.string(), z.number(), z.boolean()])),\n message,\n }),\n z.looseObject({ rule: z.literal('accept'), value: z.array(z.string().min(1)), message }),\n z.looseObject({ rule: z.literal('maxSize'), value: z.number().int().positive(), message }),\n z.looseObject({ rule: z.enum(['before', 'after']), value: DateBound, message }),\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 }),\n z\n .looseObject({\n rule: z\n .string()\n .refine((rule) => !(PORTABLE_RULES as readonly string[]).includes(rule)),\n message,\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, and to the length of text and arrays. `accept` lists MIME types (`image/*`). `maxSize` is in bytes. `crop` checks the transform of each image of an `image` or `media` value (decision 0031).',\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(),\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: '`select`, `relation`, `media`, `image`, `file`: 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).',\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\n .string()\n .optional()\n .meta({ description: '`slug`: the field the slug is generated from.' }),\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\nexport type Rule = z.infer<typeof Rule>;\nexport type BlockType = z.infer<typeof BlockType>;\nexport type Field = z.infer<typeof Field>;\n"],"mappings":";;;;AAKA,IAAM,UAAU,EACX,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,iEAAiE,CAAC;AAE3F,IAAM,QAAQ,EACT,OAAO,CAAC,CACR,MAAM,2BAA2B,CAAC,CAClC,KAAK,EA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AAK,CAAC,CACZ,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,6CAA6C,CAAC;CAC3E;CACA,IAAI,QAAqD;EACrD,OAAO,EACF,MAAM,SAAS,CAAC,CAChB,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,sDAAsD,CAAC;CACpF;CACA,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS;AACzD,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,qBAAqB,CAAC"}
1
+ {"version":3,"file":"field.js","names":[],"sources":["../../src/schemas/field.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { PORTABLE_RULES } from '../constants';\nimport { 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 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 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 }),\n z.looseObject({ rule: z.enum(['min', 'max']), value: z.number(), message }),\n z.looseObject({\n rule: z.literal('pattern'),\n value: z.string(),\n flags: z.string().optional(),\n message,\n }),\n z.looseObject({ rule: z.enum(['email', 'url', 'json']), message }),\n z.looseObject({\n rule: z.literal('in'),\n value: z.array(z.union([z.string(), z.number(), z.boolean()])),\n message,\n }),\n z.looseObject({ rule: z.literal('accept'), value: z.array(z.string().min(1)), message }),\n z.looseObject({ rule: z.literal('maxSize'), value: z.number().int().positive(), message }),\n z.looseObject({ rule: z.enum(['before', 'after']), value: DateBound, message }),\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 }),\n z\n .looseObject({\n rule: z\n .string()\n .refine((rule) => !(PORTABLE_RULES as readonly string[]).includes(rule)),\n message,\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, and to the length of text and arrays. `accept` lists MIME types (`image/*`). `maxSize` is in bytes. `crop` checks the transform of each image of an `image` or `media` value (decision 0031).',\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(),\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: '`select`, `relation`, `media`, `image`, `file`: 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).',\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\n .string()\n .optional()\n .meta({ description: '`slug`: the field the slug is generated from.' }),\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\nexport type Rule = z.infer<typeof Rule>;\nexport type BlockType = z.infer<typeof BlockType>;\nexport type Field = z.infer<typeof Field>;\n"],"mappings":";;;;AAKA,IAAM,UAAU,EACX,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,iEAAiE,CAAC;AAE3F,IAAM,QAAQ,EACT,OAAO,CAAC,CACR,MAAM,2BAA2B,CAAC,CAClC,KAAK,EAAE,aAAa,8CAA8C,CAAC;AAExE,IAAM,YAAY,EAAE,MAAM,CACtB,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,aAAa,iCAAiC,CAAC,GACjE,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,aAAa,6BAA6B,CAAC,CAClG,CAAC;AAED,IAAa,OA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