@panneau/protocol 5.0.0-alpha.37 → 5.0.0-alpha.38
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/lint.d.ts.map +1 -1
- package/dist/lint.js +12 -0
- package/dist/lint.js.map +1 -1
- package/dist/schemas/action.d.ts +1 -0
- package/dist/schemas/action.d.ts.map +1 -1
- package/dist/schemas/definition.d.ts +2 -0
- package/dist/schemas/definition.d.ts.map +1 -1
- package/dist/schemas/field.d.ts +1 -0
- package/dist/schemas/field.d.ts.map +1 -1
- package/dist/schemas/field.js +1 -0
- package/dist/schemas/field.js.map +1 -1
- package/dist/schemas/index.d.ts +6 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/resource.d.ts +2 -0
- package/dist/schemas/resource.d.ts.map +1 -1
- package/package.json +1 -1
- package/schema/boot.schema.json +3 -0
- package/schema/definition.schema.json +3 -0
- package/schema/openapi.json +4 -0
package/dist/lint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,eAAe,EAMlB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAqQlD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,eAAe,GAAG,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../src/lint.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,eAAe,EAMlB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAqQlD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,eAAe,GAAG,eAAe,EAAE,CAuF7E"}
|
package/dist/lint.js
CHANGED
|
@@ -235,6 +235,18 @@ function lintDefinition(definition) {
|
|
|
235
235
|
message: `No resource of kind \`media\` named \`${id}\`.`
|
|
236
236
|
});
|
|
237
237
|
});
|
|
238
|
+
if (field.transforms === false) {
|
|
239
|
+
if (field.ratios !== void 0 && field.ratios.length > 0) issues.push({
|
|
240
|
+
path: `${path}.ratios`,
|
|
241
|
+
message: "A field without transforms has no editor to suggest ratios."
|
|
242
|
+
});
|
|
243
|
+
field.rules?.forEach((rule, ruleIndex) => {
|
|
244
|
+
if (rule.rule === "crop") issues.push({
|
|
245
|
+
path: `${path}.rules.${String(ruleIndex)}`,
|
|
246
|
+
message: "A field without transforms keeps no crop for the `crop` rule."
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
}
|
|
238
250
|
}
|
|
239
251
|
});
|
|
240
252
|
});
|
package/dist/lint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.js","names":[],"sources":["../src/lint.ts"],"sourcesContent":["import { parseAggregateGroup, parseAggregateMeasure } from './aggregates';\nimport { DASHBOARD_COMPONENT, HOME_PAGE, getSummaryPeriodFilter } from './dashboards';\nimport { ITEM_TYPE_KEY } from './resourceTypes';\nimport type {\n DefinitionInput,\n Field,\n LayoutNode,\n OverviewPeriod,\n ResourceInput,\n Widget,\n} from './schemas';\nimport type { ValidationIssue } from './validate';\nimport {\n GROUPED_WIDGET_TYPES,\n RESOURCE_WIDGET_TYPES,\n WIDGET_RESERVED_QUERY_PARAMS,\n getWidgetResource,\n isBuiltInWidgetType,\n} from './widgets';\n\nfunction fieldNames(fields: Field[]): Set<string> {\n return new Set(fields.map((field) => field.name));\n}\n\nfunction checkLayout(\n nodes: LayoutNode[],\n names: Set<string>,\n path: string,\n issues: ValidationIssue[],\n) {\n nodes.forEach((node, index) => {\n const nodePath = `${path}.${index}`;\n if (node.type === 'field') {\n if (node.name === undefined) {\n issues.push({ path: nodePath, message: 'A `field` node needs a `name`.' });\n } else if (!names.has(node.name)) {\n issues.push({\n path: `${nodePath}.name`,\n message: `No field named \\`${node.name}\\`.`,\n });\n }\n }\n if (node.type === 'component' && node.component === undefined) {\n issues.push({ path: nodePath, message: 'A `component` node needs a `component`.' });\n }\n if (node.type === 'tabs' && node.children?.some((child) => child.type !== 'tab')) {\n issues.push({\n path: `${nodePath}.children`,\n message: 'The children of `tabs` must be `tab` nodes.',\n });\n }\n if (node.children !== undefined) {\n checkLayout(node.children, names, `${nodePath}.children`, issues);\n }\n });\n}\n\n/**\n * The types of a resource (decision 0077): unique ids, fields named apart from those of the\n * resource, and no field `type` in the form, which holds the item's type.\n */\nfunction checkTypes(\n resource: ResourceInput,\n names: Set<string>,\n path: string,\n issues: ValidationIssue[],\n) {\n const ids = new Set<string>();\n (resource.types ?? []).forEach((type, index) => {\n const typePath = `${path}.types.${index}`;\n if (ids.has(type.id)) {\n issues.push({ path: `${typePath}.id`, message: `Duplicate type id \\`${type.id}\\`.` });\n }\n ids.add(type.id);\n const own = fieldNames(type.fields);\n if (own.size !== type.fields.length) {\n issues.push({ path: `${typePath}.fields`, message: 'Field names must be unique.' });\n }\n type.fields.forEach((field, fieldIndex) => {\n if (names.has(field.name)) {\n issues.push({\n path: `${typePath}.fields.${fieldIndex}.name`,\n message: `The resource already has a field named \\`${field.name}\\`.`,\n });\n } else if (field.name === ITEM_TYPE_KEY) {\n issues.push({\n path: `${typePath}.fields.${fieldIndex}.name`,\n message: `\\`${ITEM_TYPE_KEY}\\` holds the type of the item.`,\n });\n }\n });\n });\n const typeField = resource.fields.findIndex((field) => field.name === ITEM_TYPE_KEY);\n if (ids.size > 0 && typeField !== -1 && resource.fields[typeField]?.notInForm !== true) {\n issues.push({\n path: `${path}.fields.${typeField}`,\n message: `\\`${ITEM_TYPE_KEY}\\` holds the type of the item, set when it is created: its field must be \\`notInForm\\`.`,\n });\n }\n}\n\n/** The fields of a resource and of its types, with their paths. */\nfunction allFields(resource: ResourceInput, path: string): { field: Field; path: string }[] {\n return [\n ...resource.fields.map((field, index) => ({ field, path: `${path}.fields.${index}` })),\n ...(resource.types ?? []).flatMap((type, typeIndex) =>\n type.fields.map((field, index) => ({\n field,\n path: `${path}.types.${typeIndex}.fields.${index}`,\n })),\n ),\n ];\n}\n\n/** Field types whose values can be summed: numbers, and amounts of `money` of one currency. */\nconst SUMMABLE_TYPES = ['number', 'range', 'duration', 'money'];\n/** Field types whose days can be grouped by. */\nconst DATE_TYPES = ['date', 'datetime'];\n/** Field types whose values are structures that can't be grouped by. */\nconst UNGROUPABLE_TYPES = [\n 'richtext',\n 'media',\n 'image',\n 'file',\n 'group',\n 'repeater',\n 'json',\n 'embed',\n 'location',\n 'address',\n 'link',\n 'daterange',\n 'money',\n];\n\n/**\n * The aggregates of a list (decision 0084): each one names a field of the resource that the user\n * can view, `sum` a number or `money` of one currency, `dates` a date, `groupBy` a value.\n */\nfunction checkAggregates(resource: ResourceInput, path: string, issues: ValidationIssue[]) {\n const aggregates = resource.list?.aggregates;\n if (aggregates === undefined) {\n return;\n }\n const fields = allFields(resource, path).map(({ field }) => field);\n const check = (key: 'sum' | 'groupBy' | 'dates', accepts: (field: Field) => string | null) => {\n (aggregates[key] ?? []).forEach((name, index) => {\n const issuePath = `${path}.list.aggregates.${key}.${index}`;\n const field = fields.find((candidate) => candidate.name === name);\n const message =\n field === undefined\n ? `No field named \\`${name}\\`.`\n : field.abilities?.view === false\n ? `The user can't view \\`${name}\\`: it can't be aggregated.`\n : accepts(field);\n if (message !== null) {\n issues.push({ path: issuePath, message });\n }\n });\n };\n check('sum', (field) => {\n if (!SUMMABLE_TYPES.includes(field.type)) {\n return `\\`${field.name}\\` can't be summed: only \\`number\\`, \\`range\\`, \\`duration\\` and \\`money\\` fields can.`;\n }\n const currency = (field.settings as { currency?: unknown } | undefined)?.currency;\n return field.type === 'money' && typeof currency !== 'string'\n ? `\\`${field.name}\\` can't be summed: amounts add up only in one \\`currency\\`.`\n : null;\n });\n check('dates', (field) =>\n DATE_TYPES.includes(field.type)\n ? null\n : `\\`${field.name}\\` must be a \\`date\\` or a \\`datetime\\` to be grouped by period.`,\n );\n check('groupBy', (field) =>\n UNGROUPABLE_TYPES.includes(field.type)\n ? `The items can't be grouped by a \\`${field.type}\\` field.`\n : null,\n );\n}\n\nfunction checkResource(resource: ResourceInput, path: string, issues: ValidationIssue[]) {\n const names = fieldNames(resource.fields);\n if (names.size !== resource.fields.length) {\n issues.push({ path: `${path}.fields`, message: 'Field names must be unique.' });\n }\n checkTypes(resource, names, path, issues);\n if (resource.form?.layout !== undefined) {\n // The layout can name the fields of the types: the forms of the other types leave them out.\n const typeNames = (resource.types ?? []).flatMap((type) => [...fieldNames(type.fields)]);\n checkLayout(\n resource.form.layout,\n new Set([...names, ...typeNames]),\n `${path}.form.layout`,\n issues,\n );\n }\n (resource.list?.columns ?? []).forEach((column, index) => {\n if (column.field !== undefined && !names.has(column.field)) {\n issues.push({\n path: `${path}.list.columns.${index}.field`,\n message: `No field named \\`${column.field}\\`.`,\n });\n }\n });\n const calendar = resource.list?.calendar;\n if (calendar !== undefined) {\n const field = resource.fields.find((candidate) => candidate.name === calendar.field);\n const filter = calendar.filter ?? calendar.field;\n if (field === undefined) {\n issues.push({\n path: `${path}.list.calendar.field`,\n message: `No field named \\`${calendar.field}\\`.`,\n });\n } else if (!['date', 'datetime', 'daterange'].includes(field.type)) {\n issues.push({\n path: `${path}.list.calendar.field`,\n message: 'The field of a calendar must be a `date`, a `datetime` or a `daterange`.',\n });\n }\n if (\n !(resource.list?.filters ?? []).some(\n (candidate) => candidate.id === filter && candidate.type === 'date-range',\n )\n ) {\n issues.push({\n path: `${path}.list.calendar`,\n message: `The calendar needs a \\`date-range\\` filter \\`${filter}\\` in the list.`,\n });\n }\n }\n checkAggregates(resource, path, issues);\n (resource.actions ?? []).forEach((action, index) => {\n if (action.layout !== undefined) {\n checkLayout(\n action.layout,\n fieldNames(action.fields ?? []),\n `${path}.actions.${index}.layout`,\n issues,\n );\n }\n });\n if (resource.kind === 'media') {\n const file = resource.fields.findIndex((field) => field.name === 'file');\n const field = resource.fields[file];\n if (field === undefined) {\n issues.push({\n path: `${path}.fields`,\n message: 'A resource of kind `media` needs a `file` field.',\n });\n } else if (field.type !== 'file' || field.multiple === true) {\n issues.push({\n path: `${path}.fields.${file}`,\n message: 'The `file` field of a `media` resource must be a single `file`.',\n });\n }\n }\n allFields(resource, path).forEach(({ field, path: fieldPath }) => {\n if (field.type === 'relation' && field.resource === undefined) {\n issues.push({\n path: `${fieldPath}.resource`,\n message: 'A `relation` field needs a `resource`.',\n });\n } else if (field.type === 'relation' && Array.isArray(field.resource)) {\n issues.push({\n path: `${fieldPath}.resource`,\n message: 'A `relation` field names one resource.',\n });\n }\n });\n}\n\n/**\n * Checks what the schema can't: references between parts of a definition (layout nodes and\n * columns that name existing fields, relations, `media` and `image` fields that name a resource,\n * unique names), the types of resources, and the `file` field of `media` resources.\n */\nexport function lintDefinition(definition: DefinitionInput): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n const resourceIds = new Set(definition.resources.map((resource) => resource.id));\n const libraries = definition.resources\n .filter((resource) => resource.kind === 'media')\n .map((resource) => resource.id);\n definition.resources.forEach((resource, index) => {\n checkResource(resource, `resources.${index}`, issues);\n if (resource.summary !== undefined) {\n const summaryPath = `resources.${index}.summary`;\n const period = resource.summary.period;\n if (period !== undefined) {\n checkPeriod(period, `${summaryPath}.period`, issues);\n if (getSummaryPeriodFilter(resource) === null) {\n issues.push({\n path: `${summaryPath}.period${period.filter !== undefined ? '.filter' : ''}`,\n message:\n period.filter !== undefined\n ? `The list of \\`${resource.id}\\` has no \\`date-range\\` filter \\`${period.filter}\\`.`\n : `The period of a summary is a \\`date-range\\` filter of the list of \\`${resource.id}\\`: it has none.`,\n });\n }\n }\n checkWidgets(definition, resource.summary.widgets, `${summaryPath}.widgets`, issues, {\n summaryOf: resource.id,\n hasPeriod: period !== undefined,\n });\n }\n allFields(resource, `resources.${index}`).forEach(({ field, path }) => {\n if (\n field.type === 'relation' &&\n typeof field.resource === 'string' &&\n !resourceIds.has(field.resource)\n ) {\n issues.push({\n path: `${path}.resource`,\n message: `No resource \\`${field.resource}\\`.`,\n });\n }\n if (field.type === 'media' || field.type === 'image') {\n const fieldPath = `${path}.resource`;\n if (field.resource === undefined) {\n // Every library of the definition (decision 0027).\n if (libraries.length === 0) {\n issues.push({\n path: fieldPath,\n message: `${field.type === 'image' ? 'An' : 'A'} \\`${field.type}\\` field needs a resource of kind \\`media\\`.`,\n });\n }\n } else {\n const named =\n typeof field.resource === 'string' ? [field.resource] : field.resource;\n named.forEach((id, idIndex) => {\n if (!libraries.includes(id)) {\n issues.push({\n path:\n typeof field.resource === 'string'\n ? fieldPath\n : `${fieldPath}.${String(idIndex)}`,\n message: `No resource of kind \\`media\\` named \\`${id}\\`.`,\n });\n }\n });\n }\n }\n });\n });\n checkDashboards(definition, issues);\n return issues;\n}\n\n/**\n * The dashboards (decision 0084): the widgets of each page whose component is the built-in\n * `dashboard`, and those of `dashboard`, the shorthand of the home page, unless `pages.home` has\n * its own, which can't come with them. Only a `dashboard` page has widgets.\n */\nfunction checkDashboards(definition: DefinitionInput, issues: ValidationIssue[]) {\n const home = definition.pages?.[HOME_PAGE];\n const homePeriod =\n (home?.component === DASHBOARD_COMPONENT ? home.period : undefined) ??\n definition.dashboard?.period;\n Object.entries(definition.pages ?? {}).forEach(([id, page]) => {\n if (page.period !== undefined) {\n if (page.component !== DASHBOARD_COMPONENT) {\n issues.push({\n path: `pages.${id}.period`,\n message: `Only a \\`${DASHBOARD_COMPONENT}\\` page has a period.`,\n });\n } else {\n checkPeriod(page.period, `pages.${id}.period`, issues);\n }\n }\n if (page.widgets === undefined) {\n return;\n }\n if (page.component !== DASHBOARD_COMPONENT) {\n issues.push({\n path: `pages.${id}.widgets`,\n message: `Only a \\`${DASHBOARD_COMPONENT}\\` page has widgets.`,\n });\n return;\n }\n checkWidgets(definition, page.widgets, `pages.${id}.widgets`, issues, {\n hasPeriod: (id === HOME_PAGE ? homePeriod : page.period) !== undefined,\n });\n });\n if (definition.dashboard === undefined) {\n return;\n }\n if (definition.dashboard.period !== undefined) {\n if (home?.component === DASHBOARD_COMPONENT && home.period !== undefined) {\n issues.push({\n path: 'dashboard.period',\n message: `\\`pages.${HOME_PAGE}.period\\` replaces it: set only one.`,\n });\n } else {\n checkPeriod(definition.dashboard.period, 'dashboard.period', issues);\n }\n }\n if (home?.component === DASHBOARD_COMPONENT && home.widgets !== undefined) {\n if (definition.dashboard.widgets.length > 0) {\n issues.push({\n path: 'dashboard.widgets',\n message: `\\`pages.${HOME_PAGE}.widgets\\` replaces them: set only one.`,\n });\n }\n return;\n }\n checkWidgets(definition, definition.dashboard.widgets, 'dashboard.widgets', issues, {\n hasPeriod: homePeriod !== undefined,\n });\n}\n\n/** A period (decision 0084): its options once each, and its default among them. */\nfunction checkPeriod(period: OverviewPeriod, path: string, issues: ValidationIssue[]) {\n if (new Set(period.options).size !== period.options.length) {\n issues.push({ path: `${path}.options`, message: 'Each period is offered once.' });\n }\n if (period.default !== undefined && !period.options.includes(period.default)) {\n issues.push({\n path: `${path}.default`,\n message: `\\`${period.default}\\` isn't one of the options.`,\n });\n }\n}\n\nconst FILTER_PARAM = /^filter\\[([^\\]]+)\\]/;\n\n/** The settings of a widget that go with a `resource`. */\nconst RESOURCE_SETTINGS = ['query', 'measure', 'group', 'target'] as const;\n\n/**\n * The measure and the group of a widget on a resource (decision 0084): a `sum:` and a group name\n * aggregates of its list, a `series` needs a period of a date, a `breakdown` a field of `groupBy`,\n * and a `list` has neither.\n */\nfunction checkAggregateSettings(\n widget: { type: string; settings?: Record<string, unknown> | undefined },\n resource: ResourceInput,\n path: string,\n issues: ValidationIssue[],\n) {\n const settings = widget.settings ?? {};\n const aggregates = resource.list?.aggregates ?? {};\n const grouped = (GROUPED_WIDGET_TYPES as readonly string[]).includes(widget.type);\n if (widget.type === 'list') {\n ['measure', 'group'].forEach((key) => {\n if (settings[key] !== undefined) {\n issues.push({\n path: `${path}.settings.${key}`,\n message: `A \\`list\\` shows items: it has no \\`${key}\\`.`,\n });\n }\n });\n return;\n }\n if (settings.measure !== undefined) {\n const measure =\n typeof settings.measure === 'string' ? parseAggregateMeasure(settings.measure) : null;\n if (measure === null) {\n issues.push({\n path: `${path}.settings.measure`,\n message: 'The measure must be `count` or `sum:{field}`.',\n });\n } else if (measure.type === 'sum' && !(aggregates.sum ?? []).includes(measure.field)) {\n issues.push({\n path: `${path}.settings.measure`,\n message: `The list of \\`${resource.id}\\` can't sum \\`${measure.field}\\`: it isn't in the \\`sum\\` of its aggregates.`,\n });\n }\n }\n if (!grouped) {\n if (settings.group !== undefined) {\n issues.push({\n path: `${path}.settings.group`,\n message: `A \\`${widget.type}\\` isn't grouped: only a \\`series\\` and a \\`breakdown\\` are.`,\n });\n }\n return;\n }\n const group = typeof settings.group === 'string' ? parseAggregateGroup(settings.group) : null;\n if (widget.type === 'series') {\n if (group?.type !== 'period') {\n issues.push({\n path: `${path}.settings.group`,\n message:\n 'A `series` on a resource needs a `group` on the period of a date: `day:created_at`.',\n });\n } else if (!(aggregates.dates ?? []).includes(group.field)) {\n issues.push({\n path: `${path}.settings.group`,\n message: `The list of \\`${resource.id}\\` can't group by \\`${group.field}\\`: it isn't in the \\`dates\\` of its aggregates.`,\n });\n }\n return;\n }\n if (group?.type !== 'field') {\n issues.push({\n path: `${path}.settings.group`,\n message: 'A `breakdown` on a resource needs a `group` on a field: `status`.',\n });\n } else if (!(aggregates.groupBy ?? []).includes(group.field)) {\n issues.push({\n path: `${path}.settings.group`,\n message: `The list of \\`${resource.id}\\` can't group by \\`${group.field}\\`: it isn't in the \\`groupBy\\` of its aggregates.`,\n });\n }\n}\n\n/**\n * The widgets of a dashboard or of the summary of a resource (decisions 0064 and 0084): unique ids,\n * and the built-in types on a resource that exists, with filters of its list and aggregates it\n * declares. A `stat` that counts reads the total of the list, so the list can't be paged with\n * cursors, which give no total. Only the widgets of a summary follow its list (`followsList`): those\n * on its resource, and those with data of their own.\n */\nfunction checkWidgets(\n definition: DefinitionInput,\n widgets: Widget[],\n widgetsPath: string,\n issues: ValidationIssue[],\n { summaryOf, hasPeriod = false }: { summaryOf?: string; hasPeriod?: boolean } = {},\n) {\n const ids = new Set<string>();\n widgets.forEach((widget, index) => {\n const path = `${widgetsPath}.${index}`;\n if (ids.has(widget.id)) {\n issues.push({ path: `${path}.id`, message: `Duplicate widget id \\`${widget.id}\\`.` });\n }\n ids.add(widget.id);\n const follows = widget.settings?.followsList;\n if (follows !== undefined) {\n const other = getWidgetResource(widget)?.resource;\n if (summaryOf === undefined) {\n issues.push({\n path: `${path}.settings.followsList`,\n message: 'Only the widgets of the summary of a resource follow its list.',\n });\n } else if (other !== undefined && other !== summaryOf) {\n issues.push({\n path: `${path}.settings.followsList`,\n message: `A widget on \\`${other}\\` doesn't follow the list of \\`${summaryOf}\\`.`,\n });\n }\n }\n if (!isBuiltInWidgetType(widget.type)) {\n return;\n }\n const settings = widget.settings ?? {};\n const onResource = typeof settings.resource === 'string';\n if (settings.period !== undefined && !hasPeriod) {\n issues.push({\n path: `${path}.settings.period`,\n message: `Its ${summaryOf !== undefined ? 'summary' : 'dashboard'} has no \\`period\\`.`,\n });\n }\n if (!onResource) {\n if (typeof settings.period === 'string') {\n issues.push({\n path: `${path}.settings.period`,\n message:\n '`period` names a `date-range` filter of the list of its `resource`: without one, it can only be `false`.',\n });\n }\n RESOURCE_SETTINGS.forEach((key) => {\n if (settings[key] !== undefined) {\n issues.push({\n path: `${path}.settings.${key}`,\n message: `\\`${key}\\` goes with a \\`resource\\`.`,\n });\n }\n });\n return;\n }\n if (!(RESOURCE_WIDGET_TYPES as readonly string[]).includes(widget.type)) {\n issues.push({\n path: `${path}.settings.resource`,\n message: `A \\`${widget.type}\\` widget has data of its own: it can't read a resource.`,\n });\n return;\n }\n const resource = definition.resources.find(\n (candidate) => candidate.id === settings.resource,\n );\n if (resource === undefined) {\n issues.push({\n path: `${path}.settings.resource`,\n message: `No resource \\`${String(settings.resource)}\\`.`,\n });\n return;\n }\n if (settings.target !== undefined && widget.type !== 'stat') {\n issues.push({\n path: `${path}.settings.target`,\n message: 'Only a `stat` has a `target`.',\n });\n }\n checkAggregateSettings(widget, resource, path, issues);\n const sums = typeof settings.measure === 'string' && settings.measure.startsWith('sum:');\n if (widget.type === 'stat' && !sums && resource.list?.pagination === 'cursor') {\n issues.push({\n path: `${path}.settings.resource`,\n message: `The list of \\`${resource.id}\\` is paged with cursors and has no total: it can't feed a \\`stat\\` that counts.`,\n });\n }\n if (\n typeof settings.period === 'string' &&\n !(resource.list?.filters ?? []).some(\n (filter) => filter.id === settings.period && filter.type === 'date-range',\n )\n ) {\n issues.push({\n path: `${path}.settings.period`,\n message: `The list of \\`${resource.id}\\` has no \\`date-range\\` filter \\`${settings.period}\\`.`,\n });\n }\n const filters = new Set((resource.list?.filters ?? []).map((filter) => filter.id));\n Object.keys(settings.query ?? {}).forEach((key) => {\n const filter = FILTER_PARAM.exec(key)?.[1];\n if ((WIDGET_RESERVED_QUERY_PARAMS as readonly string[]).includes(key)) {\n issues.push({\n path: `${path}.settings.query.${key}`,\n message: `The client sets \\`${key}\\`.`,\n });\n } else if (filter !== undefined && !filters.has(filter)) {\n issues.push({\n path: `${path}.settings.query.${key}`,\n message: `The list of \\`${resource.id}\\` has no filter \\`${filter}\\`.`,\n });\n }\n });\n });\n}\n"],"mappings":";;;;;AAoBA,SAAS,WAAW,QAA8B;CAC9C,OAAO,IAAI,IAAI,OAAO,KAAK,UAAU,MAAM,IAAI,CAAC;AACpD;AAEA,SAAS,YACL,OACA,OACA,MACA,QACF;CACE,MAAM,SAAS,MAAM,UAAU;EAC3B,MAAM,WAAW,GAAG,KAAK,GAAG;EAC5B,IAAI,KAAK,SAAS,SAAS;GACvB,IAAI,KAAK,SAAS,KAAA,GACd,OAAO,KAAK;IAAE,MAAM;IAAU,SAAS;GAAiC,CAAC;QACtE,IAAI,CAAC,MAAM,IAAI,KAAK,IAAI,GAC3B,OAAO,KAAK;IACR,MAAM,GAAG,SAAS;IAClB,SAAS,oBAA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OAAO,KAAK;IACR,MAAM,GAAG,KAAK,kBAAkB;IAChC,SAAS,iBAAiB,SAAS,GAAG,qBAAqB,OAAO;GACtE,CAAC;EAET,CAAC;CACL,CAAC;AACL"}
|
|
1
|
+
{"version":3,"file":"lint.js","names":[],"sources":["../src/lint.ts"],"sourcesContent":["import { parseAggregateGroup, parseAggregateMeasure } from './aggregates';\nimport { DASHBOARD_COMPONENT, HOME_PAGE, getSummaryPeriodFilter } from './dashboards';\nimport { ITEM_TYPE_KEY } from './resourceTypes';\nimport type {\n DefinitionInput,\n Field,\n LayoutNode,\n OverviewPeriod,\n ResourceInput,\n Widget,\n} from './schemas';\nimport type { ValidationIssue } from './validate';\nimport {\n GROUPED_WIDGET_TYPES,\n RESOURCE_WIDGET_TYPES,\n WIDGET_RESERVED_QUERY_PARAMS,\n getWidgetResource,\n isBuiltInWidgetType,\n} from './widgets';\n\nfunction fieldNames(fields: Field[]): Set<string> {\n return new Set(fields.map((field) => field.name));\n}\n\nfunction checkLayout(\n nodes: LayoutNode[],\n names: Set<string>,\n path: string,\n issues: ValidationIssue[],\n) {\n nodes.forEach((node, index) => {\n const nodePath = `${path}.${index}`;\n if (node.type === 'field') {\n if (node.name === undefined) {\n issues.push({ path: nodePath, message: 'A `field` node needs a `name`.' });\n } else if (!names.has(node.name)) {\n issues.push({\n path: `${nodePath}.name`,\n message: `No field named \\`${node.name}\\`.`,\n });\n }\n }\n if (node.type === 'component' && node.component === undefined) {\n issues.push({ path: nodePath, message: 'A `component` node needs a `component`.' });\n }\n if (node.type === 'tabs' && node.children?.some((child) => child.type !== 'tab')) {\n issues.push({\n path: `${nodePath}.children`,\n message: 'The children of `tabs` must be `tab` nodes.',\n });\n }\n if (node.children !== undefined) {\n checkLayout(node.children, names, `${nodePath}.children`, issues);\n }\n });\n}\n\n/**\n * The types of a resource (decision 0077): unique ids, fields named apart from those of the\n * resource, and no field `type` in the form, which holds the item's type.\n */\nfunction checkTypes(\n resource: ResourceInput,\n names: Set<string>,\n path: string,\n issues: ValidationIssue[],\n) {\n const ids = new Set<string>();\n (resource.types ?? []).forEach((type, index) => {\n const typePath = `${path}.types.${index}`;\n if (ids.has(type.id)) {\n issues.push({ path: `${typePath}.id`, message: `Duplicate type id \\`${type.id}\\`.` });\n }\n ids.add(type.id);\n const own = fieldNames(type.fields);\n if (own.size !== type.fields.length) {\n issues.push({ path: `${typePath}.fields`, message: 'Field names must be unique.' });\n }\n type.fields.forEach((field, fieldIndex) => {\n if (names.has(field.name)) {\n issues.push({\n path: `${typePath}.fields.${fieldIndex}.name`,\n message: `The resource already has a field named \\`${field.name}\\`.`,\n });\n } else if (field.name === ITEM_TYPE_KEY) {\n issues.push({\n path: `${typePath}.fields.${fieldIndex}.name`,\n message: `\\`${ITEM_TYPE_KEY}\\` holds the type of the item.`,\n });\n }\n });\n });\n const typeField = resource.fields.findIndex((field) => field.name === ITEM_TYPE_KEY);\n if (ids.size > 0 && typeField !== -1 && resource.fields[typeField]?.notInForm !== true) {\n issues.push({\n path: `${path}.fields.${typeField}`,\n message: `\\`${ITEM_TYPE_KEY}\\` holds the type of the item, set when it is created: its field must be \\`notInForm\\`.`,\n });\n }\n}\n\n/** The fields of a resource and of its types, with their paths. */\nfunction allFields(resource: ResourceInput, path: string): { field: Field; path: string }[] {\n return [\n ...resource.fields.map((field, index) => ({ field, path: `${path}.fields.${index}` })),\n ...(resource.types ?? []).flatMap((type, typeIndex) =>\n type.fields.map((field, index) => ({\n field,\n path: `${path}.types.${typeIndex}.fields.${index}`,\n })),\n ),\n ];\n}\n\n/** Field types whose values can be summed: numbers, and amounts of `money` of one currency. */\nconst SUMMABLE_TYPES = ['number', 'range', 'duration', 'money'];\n/** Field types whose days can be grouped by. */\nconst DATE_TYPES = ['date', 'datetime'];\n/** Field types whose values are structures that can't be grouped by. */\nconst UNGROUPABLE_TYPES = [\n 'richtext',\n 'media',\n 'image',\n 'file',\n 'group',\n 'repeater',\n 'json',\n 'embed',\n 'location',\n 'address',\n 'link',\n 'daterange',\n 'money',\n];\n\n/**\n * The aggregates of a list (decision 0084): each one names a field of the resource that the user\n * can view, `sum` a number or `money` of one currency, `dates` a date, `groupBy` a value.\n */\nfunction checkAggregates(resource: ResourceInput, path: string, issues: ValidationIssue[]) {\n const aggregates = resource.list?.aggregates;\n if (aggregates === undefined) {\n return;\n }\n const fields = allFields(resource, path).map(({ field }) => field);\n const check = (key: 'sum' | 'groupBy' | 'dates', accepts: (field: Field) => string | null) => {\n (aggregates[key] ?? []).forEach((name, index) => {\n const issuePath = `${path}.list.aggregates.${key}.${index}`;\n const field = fields.find((candidate) => candidate.name === name);\n const message =\n field === undefined\n ? `No field named \\`${name}\\`.`\n : field.abilities?.view === false\n ? `The user can't view \\`${name}\\`: it can't be aggregated.`\n : accepts(field);\n if (message !== null) {\n issues.push({ path: issuePath, message });\n }\n });\n };\n check('sum', (field) => {\n if (!SUMMABLE_TYPES.includes(field.type)) {\n return `\\`${field.name}\\` can't be summed: only \\`number\\`, \\`range\\`, \\`duration\\` and \\`money\\` fields can.`;\n }\n const currency = (field.settings as { currency?: unknown } | undefined)?.currency;\n return field.type === 'money' && typeof currency !== 'string'\n ? `\\`${field.name}\\` can't be summed: amounts add up only in one \\`currency\\`.`\n : null;\n });\n check('dates', (field) =>\n DATE_TYPES.includes(field.type)\n ? null\n : `\\`${field.name}\\` must be a \\`date\\` or a \\`datetime\\` to be grouped by period.`,\n );\n check('groupBy', (field) =>\n UNGROUPABLE_TYPES.includes(field.type)\n ? `The items can't be grouped by a \\`${field.type}\\` field.`\n : null,\n );\n}\n\nfunction checkResource(resource: ResourceInput, path: string, issues: ValidationIssue[]) {\n const names = fieldNames(resource.fields);\n if (names.size !== resource.fields.length) {\n issues.push({ path: `${path}.fields`, message: 'Field names must be unique.' });\n }\n checkTypes(resource, names, path, issues);\n if (resource.form?.layout !== undefined) {\n // The layout can name the fields of the types: the forms of the other types leave them out.\n const typeNames = (resource.types ?? []).flatMap((type) => [...fieldNames(type.fields)]);\n checkLayout(\n resource.form.layout,\n new Set([...names, ...typeNames]),\n `${path}.form.layout`,\n issues,\n );\n }\n (resource.list?.columns ?? []).forEach((column, index) => {\n if (column.field !== undefined && !names.has(column.field)) {\n issues.push({\n path: `${path}.list.columns.${index}.field`,\n message: `No field named \\`${column.field}\\`.`,\n });\n }\n });\n const calendar = resource.list?.calendar;\n if (calendar !== undefined) {\n const field = resource.fields.find((candidate) => candidate.name === calendar.field);\n const filter = calendar.filter ?? calendar.field;\n if (field === undefined) {\n issues.push({\n path: `${path}.list.calendar.field`,\n message: `No field named \\`${calendar.field}\\`.`,\n });\n } else if (!['date', 'datetime', 'daterange'].includes(field.type)) {\n issues.push({\n path: `${path}.list.calendar.field`,\n message: 'The field of a calendar must be a `date`, a `datetime` or a `daterange`.',\n });\n }\n if (\n !(resource.list?.filters ?? []).some(\n (candidate) => candidate.id === filter && candidate.type === 'date-range',\n )\n ) {\n issues.push({\n path: `${path}.list.calendar`,\n message: `The calendar needs a \\`date-range\\` filter \\`${filter}\\` in the list.`,\n });\n }\n }\n checkAggregates(resource, path, issues);\n (resource.actions ?? []).forEach((action, index) => {\n if (action.layout !== undefined) {\n checkLayout(\n action.layout,\n fieldNames(action.fields ?? []),\n `${path}.actions.${index}.layout`,\n issues,\n );\n }\n });\n if (resource.kind === 'media') {\n const file = resource.fields.findIndex((field) => field.name === 'file');\n const field = resource.fields[file];\n if (field === undefined) {\n issues.push({\n path: `${path}.fields`,\n message: 'A resource of kind `media` needs a `file` field.',\n });\n } else if (field.type !== 'file' || field.multiple === true) {\n issues.push({\n path: `${path}.fields.${file}`,\n message: 'The `file` field of a `media` resource must be a single `file`.',\n });\n }\n }\n allFields(resource, path).forEach(({ field, path: fieldPath }) => {\n if (field.type === 'relation' && field.resource === undefined) {\n issues.push({\n path: `${fieldPath}.resource`,\n message: 'A `relation` field needs a `resource`.',\n });\n } else if (field.type === 'relation' && Array.isArray(field.resource)) {\n issues.push({\n path: `${fieldPath}.resource`,\n message: 'A `relation` field names one resource.',\n });\n }\n });\n}\n\n/**\n * Checks what the schema can't: references between parts of a definition (layout nodes and\n * columns that name existing fields, relations, `media` and `image` fields that name a resource,\n * unique names), the types of resources, and the `file` field of `media` resources.\n */\nexport function lintDefinition(definition: DefinitionInput): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n const resourceIds = new Set(definition.resources.map((resource) => resource.id));\n const libraries = definition.resources\n .filter((resource) => resource.kind === 'media')\n .map((resource) => resource.id);\n definition.resources.forEach((resource, index) => {\n checkResource(resource, `resources.${index}`, issues);\n if (resource.summary !== undefined) {\n const summaryPath = `resources.${index}.summary`;\n const period = resource.summary.period;\n if (period !== undefined) {\n checkPeriod(period, `${summaryPath}.period`, issues);\n if (getSummaryPeriodFilter(resource) === null) {\n issues.push({\n path: `${summaryPath}.period${period.filter !== undefined ? '.filter' : ''}`,\n message:\n period.filter !== undefined\n ? `The list of \\`${resource.id}\\` has no \\`date-range\\` filter \\`${period.filter}\\`.`\n : `The period of a summary is a \\`date-range\\` filter of the list of \\`${resource.id}\\`: it has none.`,\n });\n }\n }\n checkWidgets(definition, resource.summary.widgets, `${summaryPath}.widgets`, issues, {\n summaryOf: resource.id,\n hasPeriod: period !== undefined,\n });\n }\n allFields(resource, `resources.${index}`).forEach(({ field, path }) => {\n if (\n field.type === 'relation' &&\n typeof field.resource === 'string' &&\n !resourceIds.has(field.resource)\n ) {\n issues.push({\n path: `${path}.resource`,\n message: `No resource \\`${field.resource}\\`.`,\n });\n }\n if (field.type === 'media' || field.type === 'image') {\n const fieldPath = `${path}.resource`;\n if (field.resource === undefined) {\n // Every library of the definition (decision 0027).\n if (libraries.length === 0) {\n issues.push({\n path: fieldPath,\n message: `${field.type === 'image' ? 'An' : 'A'} \\`${field.type}\\` field needs a resource of kind \\`media\\`.`,\n });\n }\n } else {\n const named =\n typeof field.resource === 'string' ? [field.resource] : field.resource;\n named.forEach((id, idIndex) => {\n if (!libraries.includes(id)) {\n issues.push({\n path:\n typeof field.resource === 'string'\n ? fieldPath\n : `${fieldPath}.${String(idIndex)}`,\n message: `No resource of kind \\`media\\` named \\`${id}\\`.`,\n });\n }\n });\n }\n // A field without transforms keeps no crop (decision 0087).\n if (field.transforms === false) {\n if (field.ratios !== undefined && field.ratios.length > 0) {\n issues.push({\n path: `${path}.ratios`,\n message: 'A field without transforms has no editor to suggest ratios.',\n });\n }\n field.rules?.forEach((rule, ruleIndex) => {\n if (rule.rule === 'crop') {\n issues.push({\n path: `${path}.rules.${String(ruleIndex)}`,\n message:\n 'A field without transforms keeps no crop for the `crop` rule.',\n });\n }\n });\n }\n }\n });\n });\n checkDashboards(definition, issues);\n return issues;\n}\n\n/**\n * The dashboards (decision 0084): the widgets of each page whose component is the built-in\n * `dashboard`, and those of `dashboard`, the shorthand of the home page, unless `pages.home` has\n * its own, which can't come with them. Only a `dashboard` page has widgets.\n */\nfunction checkDashboards(definition: DefinitionInput, issues: ValidationIssue[]) {\n const home = definition.pages?.[HOME_PAGE];\n const homePeriod =\n (home?.component === DASHBOARD_COMPONENT ? home.period : undefined) ??\n definition.dashboard?.period;\n Object.entries(definition.pages ?? {}).forEach(([id, page]) => {\n if (page.period !== undefined) {\n if (page.component !== DASHBOARD_COMPONENT) {\n issues.push({\n path: `pages.${id}.period`,\n message: `Only a \\`${DASHBOARD_COMPONENT}\\` page has a period.`,\n });\n } else {\n checkPeriod(page.period, `pages.${id}.period`, issues);\n }\n }\n if (page.widgets === undefined) {\n return;\n }\n if (page.component !== DASHBOARD_COMPONENT) {\n issues.push({\n path: `pages.${id}.widgets`,\n message: `Only a \\`${DASHBOARD_COMPONENT}\\` page has widgets.`,\n });\n return;\n }\n checkWidgets(definition, page.widgets, `pages.${id}.widgets`, issues, {\n hasPeriod: (id === HOME_PAGE ? homePeriod : page.period) !== undefined,\n });\n });\n if (definition.dashboard === undefined) {\n return;\n }\n if (definition.dashboard.period !== undefined) {\n if (home?.component === DASHBOARD_COMPONENT && home.period !== undefined) {\n issues.push({\n path: 'dashboard.period',\n message: `\\`pages.${HOME_PAGE}.period\\` replaces it: set only one.`,\n });\n } else {\n checkPeriod(definition.dashboard.period, 'dashboard.period', issues);\n }\n }\n if (home?.component === DASHBOARD_COMPONENT && home.widgets !== undefined) {\n if (definition.dashboard.widgets.length > 0) {\n issues.push({\n path: 'dashboard.widgets',\n message: `\\`pages.${HOME_PAGE}.widgets\\` replaces them: set only one.`,\n });\n }\n return;\n }\n checkWidgets(definition, definition.dashboard.widgets, 'dashboard.widgets', issues, {\n hasPeriod: homePeriod !== undefined,\n });\n}\n\n/** A period (decision 0084): its options once each, and its default among them. */\nfunction checkPeriod(period: OverviewPeriod, path: string, issues: ValidationIssue[]) {\n if (new Set(period.options).size !== period.options.length) {\n issues.push({ path: `${path}.options`, message: 'Each period is offered once.' });\n }\n if (period.default !== undefined && !period.options.includes(period.default)) {\n issues.push({\n path: `${path}.default`,\n message: `\\`${period.default}\\` isn't one of the options.`,\n });\n }\n}\n\nconst FILTER_PARAM = /^filter\\[([^\\]]+)\\]/;\n\n/** The settings of a widget that go with a `resource`. */\nconst RESOURCE_SETTINGS = ['query', 'measure', 'group', 'target'] as const;\n\n/**\n * The measure and the group of a widget on a resource (decision 0084): a `sum:` and a group name\n * aggregates of its list, a `series` needs a period of a date, a `breakdown` a field of `groupBy`,\n * and a `list` has neither.\n */\nfunction checkAggregateSettings(\n widget: { type: string; settings?: Record<string, unknown> | undefined },\n resource: ResourceInput,\n path: string,\n issues: ValidationIssue[],\n) {\n const settings = widget.settings ?? {};\n const aggregates = resource.list?.aggregates ?? {};\n const grouped = (GROUPED_WIDGET_TYPES as readonly string[]).includes(widget.type);\n if (widget.type === 'list') {\n ['measure', 'group'].forEach((key) => {\n if (settings[key] !== undefined) {\n issues.push({\n path: `${path}.settings.${key}`,\n message: `A \\`list\\` shows items: it has no \\`${key}\\`.`,\n });\n }\n });\n return;\n }\n if (settings.measure !== undefined) {\n const measure =\n typeof settings.measure === 'string' ? parseAggregateMeasure(settings.measure) : null;\n if (measure === null) {\n issues.push({\n path: `${path}.settings.measure`,\n message: 'The measure must be `count` or `sum:{field}`.',\n });\n } else if (measure.type === 'sum' && !(aggregates.sum ?? []).includes(measure.field)) {\n issues.push({\n path: `${path}.settings.measure`,\n message: `The list of \\`${resource.id}\\` can't sum \\`${measure.field}\\`: it isn't in the \\`sum\\` of its aggregates.`,\n });\n }\n }\n if (!grouped) {\n if (settings.group !== undefined) {\n issues.push({\n path: `${path}.settings.group`,\n message: `A \\`${widget.type}\\` isn't grouped: only a \\`series\\` and a \\`breakdown\\` are.`,\n });\n }\n return;\n }\n const group = typeof settings.group === 'string' ? parseAggregateGroup(settings.group) : null;\n if (widget.type === 'series') {\n if (group?.type !== 'period') {\n issues.push({\n path: `${path}.settings.group`,\n message:\n 'A `series` on a resource needs a `group` on the period of a date: `day:created_at`.',\n });\n } else if (!(aggregates.dates ?? []).includes(group.field)) {\n issues.push({\n path: `${path}.settings.group`,\n message: `The list of \\`${resource.id}\\` can't group by \\`${group.field}\\`: it isn't in the \\`dates\\` of its aggregates.`,\n });\n }\n return;\n }\n if (group?.type !== 'field') {\n issues.push({\n path: `${path}.settings.group`,\n message: 'A `breakdown` on a resource needs a `group` on a field: `status`.',\n });\n } else if (!(aggregates.groupBy ?? []).includes(group.field)) {\n issues.push({\n path: `${path}.settings.group`,\n message: `The list of \\`${resource.id}\\` can't group by \\`${group.field}\\`: it isn't in the \\`groupBy\\` of its aggregates.`,\n });\n }\n}\n\n/**\n * The widgets of a dashboard or of the summary of a resource (decisions 0064 and 0084): unique ids,\n * and the built-in types on a resource that exists, with filters of its list and aggregates it\n * declares. A `stat` that counts reads the total of the list, so the list can't be paged with\n * cursors, which give no total. Only the widgets of a summary follow its list (`followsList`): those\n * on its resource, and those with data of their own.\n */\nfunction checkWidgets(\n definition: DefinitionInput,\n widgets: Widget[],\n widgetsPath: string,\n issues: ValidationIssue[],\n { summaryOf, hasPeriod = false }: { summaryOf?: string; hasPeriod?: boolean } = {},\n) {\n const ids = new Set<string>();\n widgets.forEach((widget, index) => {\n const path = `${widgetsPath}.${index}`;\n if (ids.has(widget.id)) {\n issues.push({ path: `${path}.id`, message: `Duplicate widget id \\`${widget.id}\\`.` });\n }\n ids.add(widget.id);\n const follows = widget.settings?.followsList;\n if (follows !== undefined) {\n const other = getWidgetResource(widget)?.resource;\n if (summaryOf === undefined) {\n issues.push({\n path: `${path}.settings.followsList`,\n message: 'Only the widgets of the summary of a resource follow its list.',\n });\n } else if (other !== undefined && other !== summaryOf) {\n issues.push({\n path: `${path}.settings.followsList`,\n message: `A widget on \\`${other}\\` doesn't follow the list of \\`${summaryOf}\\`.`,\n });\n }\n }\n if (!isBuiltInWidgetType(widget.type)) {\n return;\n }\n const settings = widget.settings ?? {};\n const onResource = typeof settings.resource === 'string';\n if (settings.period !== undefined && !hasPeriod) {\n issues.push({\n path: `${path}.settings.period`,\n message: `Its ${summaryOf !== undefined ? 'summary' : 'dashboard'} has no \\`period\\`.`,\n });\n }\n if (!onResource) {\n if (typeof settings.period === 'string') {\n issues.push({\n path: `${path}.settings.period`,\n message:\n '`period` names a `date-range` filter of the list of its `resource`: without one, it can only be `false`.',\n });\n }\n RESOURCE_SETTINGS.forEach((key) => {\n if (settings[key] !== undefined) {\n issues.push({\n path: `${path}.settings.${key}`,\n message: `\\`${key}\\` goes with a \\`resource\\`.`,\n });\n }\n });\n return;\n }\n if (!(RESOURCE_WIDGET_TYPES as readonly string[]).includes(widget.type)) {\n issues.push({\n path: `${path}.settings.resource`,\n message: `A \\`${widget.type}\\` widget has data of its own: it can't read a resource.`,\n });\n return;\n }\n const resource = definition.resources.find(\n (candidate) => candidate.id === settings.resource,\n );\n if (resource === undefined) {\n issues.push({\n path: `${path}.settings.resource`,\n message: `No resource \\`${String(settings.resource)}\\`.`,\n });\n return;\n }\n if (settings.target !== undefined && widget.type !== 'stat') {\n issues.push({\n path: `${path}.settings.target`,\n message: 'Only a `stat` has a `target`.',\n });\n }\n checkAggregateSettings(widget, resource, path, issues);\n const sums = typeof settings.measure === 'string' && settings.measure.startsWith('sum:');\n if (widget.type === 'stat' && !sums && resource.list?.pagination === 'cursor') {\n issues.push({\n path: `${path}.settings.resource`,\n message: `The list of \\`${resource.id}\\` is paged with cursors and has no total: it can't feed a \\`stat\\` that counts.`,\n });\n }\n if (\n typeof settings.period === 'string' &&\n !(resource.list?.filters ?? []).some(\n (filter) => filter.id === settings.period && filter.type === 'date-range',\n )\n ) {\n issues.push({\n path: `${path}.settings.period`,\n message: `The list of \\`${resource.id}\\` has no \\`date-range\\` filter \\`${settings.period}\\`.`,\n });\n }\n const filters = new Set((resource.list?.filters ?? []).map((filter) => filter.id));\n Object.keys(settings.query ?? {}).forEach((key) => {\n const filter = FILTER_PARAM.exec(key)?.[1];\n if ((WIDGET_RESERVED_QUERY_PARAMS as readonly string[]).includes(key)) {\n issues.push({\n path: `${path}.settings.query.${key}`,\n message: `The client sets \\`${key}\\`.`,\n });\n } else if (filter !== undefined && !filters.has(filter)) {\n issues.push({\n path: `${path}.settings.query.${key}`,\n message: `The list of \\`${resource.id}\\` has no filter \\`${filter}\\`.`,\n });\n }\n });\n });\n}\n"],"mappings":";;;;;AAoBA,SAAS,WAAW,QAA8B;CAC9C,OAAO,IAAI,IAAI,OAAO,KAAK,UAAU,MAAM,IAAI,CAAC;AACpD;AAEA,SAAS,YACL,OACA,OACA,MACA,QACF;CACE,MAAM,SAAS,MAAM,UAAU;EAC3B,MAAM,WAAW,GAAG,KAAK,GAAG;EAC5B,IAAI,KAAK,SAAS,SAAS;GACvB,IAAI,KAAK,SAAS,KAAA,GACd,OAAO,KAAK;IAAE,MAAM;IAAU,SAAS;GAAiC,CAAC;QACtE,IAAI,CAAC,MAAM,IAAI,KAAK,IAAI,GAC3B,OAAO,KAAK;IACR,MAAM,GAAG,SAAS;IAClB,SAAS,oBAAoB,KAAK,KAAK;GAC3C,CAAC;EAET;EACA,IAAI,KAAK,SAAS,eAAe,KAAK,cAAc,KAAA,GAChD,OAAO,KAAK;GAAE,MAAM;GAAU,SAA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AG;GACxC,IAAK,6BAAmD,SAAS,GAAG,GAChE,OAAO,KAAK;IACR,MAAM,GAAG,KAAK,kBAAkB;IAChC,SAAS,qBAAqB,IAAI;GACtC,CAAC;QACE,IAAI,WAAW,KAAA,KAAa,CAAC,QAAQ,IAAI,MAAM,GAClD,OAAO,KAAK;IACR,MAAM,GAAG,KAAK,kBAAkB;IAChC,SAAS,iBAAiB,SAAS,GAAG,qBAAqB,OAAO;GACtE,CAAC;EAET,CAAC;CACL,CAAC;AACL"}
|
package/dist/schemas/action.d.ts
CHANGED
|
@@ -225,6 +225,7 @@ export declare const Action: z.ZodObject<{
|
|
|
225
225
|
original: "original";
|
|
226
226
|
choose: "choose";
|
|
227
227
|
}>>;
|
|
228
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
228
229
|
from: z.ZodOptional<z.ZodString>;
|
|
229
230
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
230
231
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/schemas/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,WAAW;;;;EAA4C,CAAC;AAErE,eAAO,MAAM,eAAe;;;;;EAA6C,CAAC;AAE1E,eAAO,MAAM,aAAa;;;;;mBAWxB,CAAC;AAEH,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/schemas/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,WAAW;;;;EAA4C,CAAC;AAErE,eAAO,MAAM,eAAe;;;;;EAA6C,CAAC;AAE1E,eAAO,MAAM,aAAa;;;;;mBAWxB,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6Eb,CAAC;AAEP,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,qEAAqE;AACrE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
|
@@ -352,6 +352,7 @@ export declare const Definition: z.ZodObject<{
|
|
|
352
352
|
original: "original";
|
|
353
353
|
choose: "choose";
|
|
354
354
|
}>>;
|
|
355
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
355
356
|
from: z.ZodOptional<z.ZodString>;
|
|
356
357
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
357
358
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -645,6 +646,7 @@ export declare const Definition: z.ZodObject<{
|
|
|
645
646
|
original: "original";
|
|
646
647
|
choose: "choose";
|
|
647
648
|
}>>;
|
|
649
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
648
650
|
from: z.ZodOptional<z.ZodString>;
|
|
649
651
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
650
652
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -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;AASxB,eAAO,MAAM,IAAI;;;;;;;iBAUf,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;iBAQvB,CAAC;AAEH,eAAO,MAAM,SAAS;;;iBAGpB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;iBA0Cf,CAAC;AAEH,eAAO,MAAM,eAAe;;;;iBAWkD,CAAC;AAE/E,eAAO,MAAM,QAAQ;;;;;;;;;;;cAuBG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;iBAIjB,CAAC;AAElD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Bf,CAAC;AAEH,eAAO,MAAM,aAAa;;;;iBAMuC,CAAC;AAElE,eAAO,MAAM,YAAY;;;;;;;;;;;;;iBAqCoD,CAAC;AAE9E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;iBAUxB,CAAC;AAEP,eAAO,MAAM,OAAO;;;;;;;;iBAUlB,CAAC;AAEH,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/schemas/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,IAAI;;;;;;;iBAUf,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;iBAQvB,CAAC;AAEH,eAAO,MAAM,SAAS;;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G,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"}
|
package/dist/schemas/field.d.ts
CHANGED
|
@@ -326,6 +326,7 @@ export declare const Field: z.ZodObject<{
|
|
|
326
326
|
original: "original";
|
|
327
327
|
choose: "choose";
|
|
328
328
|
}>>;
|
|
329
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
329
330
|
from: z.ZodOptional<z.ZodString>;
|
|
330
331
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
331
332
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -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;AAUxB,OAAO,EAAa,SAAS,EAAU,MAAM,UAAU,CAAC;AAmCxD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAiHX,CAAC;AAEP,eAAO,MAAM,SAAS;;;;YAKJ,CAAC,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC;iBAGxC,CAAC;AAEH,eAAO,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/schemas/field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,OAAO,EAAa,SAAS,EAAU,MAAM,UAAU,CAAC;AAmCxD,eAAO,MAAM,IAA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eAAO,MAAM,aAAa;;;iBAapB,CAAC;AAEP,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;AAC1C,2CAA2C;AAC3C,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,4CAA4C;AAC5C,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,yDAAyD;AACzD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,4CAA4C;AAC5C,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,6CAA6C;AAC7C,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,yCAAyC;AACzC,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,4CAA4C;AAC5C,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/schemas/field.js
CHANGED
|
@@ -145,6 +145,7 @@ var Field = z.looseObject({
|
|
|
145
145
|
"original",
|
|
146
146
|
"choose"
|
|
147
147
|
]).optional().meta({ description: "`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)." }),
|
|
148
|
+
transforms: z.boolean().optional().meta({ description: "`media`, `image`: whether values keep a transform for one use. Defaults to true. With `false`, the backend ignores the `transform` of values and items give none, clients send none, and an `image` field has no editor; it can't have `ratios` or the `crop` rule (decision 0087)." }),
|
|
148
149
|
from: z.string().optional().meta({ description: "`slug`: the field the slug is generated from. `region`: the field of the same object that holds its country." }),
|
|
149
150
|
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." }),
|
|
150
151
|
display: z.string().optional().meta({ description: "Display used in lists, when it differs from the default one of the type." }),
|
|
@@ -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 notInForm: z.boolean().optional().meta({\n description:\n 'Forms leave the field out, even when their layout names it, and never add it at the end. Items still give its value, which lists, details, item panels and references read: the URL of a page, shown under its title (decision 0071). The backend ignores its value on create and update, as it ignores `readOnly` fields, and the field is not edited inline. For the fields at the top of a resource and of its types.',\n }),\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,CAA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MAAM,cAAc,SAAS;CAC7B,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACxC,aACI,oIACR,CAAC;CACD,gBAAgB,EAAE,QAAQ,CAAC,CAAC,SAAS,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 notInForm: z.boolean().optional().meta({\n description:\n 'Forms leave the field out, even when their layout names it, and never add it at the end. Items still give its value, which lists, details, item panels and references read: the URL of a page, shown under its title (decision 0071). The backend ignores its value on create and update, as it ignores `readOnly` fields, and the field is not edited inline. For the fields at the top of a resource and of its types.',\n }),\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 transforms: z.boolean().optional().meta({\n description:\n \"`media`, `image`: whether values keep a transform for one use. Defaults to true. With `false`, the backend ignores the `transform` of values and items give none, clients send none, and an `image` field has no editor; it can't have `ratios` or the `crop` rule (decision 0087).\",\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,eAAe,EAChB,OAAO,CAAC,CACR,MAAM,YAAY,CAAC,CACnB,KAAK,EAAE,aAAa,iDAAiD,CAAC;AAE3E,IAAM,gBAAgB,EAAE,KAAK,sBAAsB,CAAC,CAAC,KAAK,EACtD,aAAa,qEACjB,CAAC;AAED,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,OAAO,EACf,MAAM;CACH,EAAE,YAAY;EAAE,MAAM,EAAE,QAAQ,UAAU;EAAG;EAAS;CAAK,CAAC;CAC5D,EAAE,YAAY;EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,KAAK,CAAC;EAAG,OAAO,EAAE,OAAO;EAAG;EAAS;CAAK,CAAC;CAChF,EAAE,YAAY;EACV,MAAM,EAAE,QAAQ,SAAS;EACzB,OAAO,EAAE,OAAO;EAChB,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;EAC3B;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D,OAAO,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC/B,aAAa,yDACjB,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EACF,aACI,gKACR,CAAC;;AAGL,IAAa,oBAAoB,EAC5B,YAAY;CACT,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC9B,aACI,gIACR,CAAC;CACD,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAChC,aACI,mGACR,CAAC;CACD,MAAM,cAAc,SAAS;CAC7B,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACxC,aACI,oIACR,CAAC;CACD,gBAAgB,EAAE,QAAQ,CAAC,CAAC,SAAS,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"}
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -365,6 +365,7 @@ export declare const namedSchemas: {
|
|
|
365
365
|
original: "original";
|
|
366
366
|
choose: "choose";
|
|
367
367
|
}>>;
|
|
368
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
368
369
|
from: z.ZodOptional<z.ZodString>;
|
|
369
370
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
370
371
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -838,6 +839,7 @@ export declare const namedSchemas: {
|
|
|
838
839
|
original: "original";
|
|
839
840
|
choose: "choose";
|
|
840
841
|
}>>;
|
|
842
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
841
843
|
from: z.ZodOptional<z.ZodString>;
|
|
842
844
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
843
845
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -1147,6 +1149,7 @@ export declare const namedSchemas: {
|
|
|
1147
1149
|
original: "original";
|
|
1148
1150
|
choose: "choose";
|
|
1149
1151
|
}>>;
|
|
1152
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
1150
1153
|
from: z.ZodOptional<z.ZodString>;
|
|
1151
1154
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
1152
1155
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -1440,6 +1443,7 @@ export declare const namedSchemas: {
|
|
|
1440
1443
|
original: "original";
|
|
1441
1444
|
choose: "choose";
|
|
1442
1445
|
}>>;
|
|
1446
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
1443
1447
|
from: z.ZodOptional<z.ZodString>;
|
|
1444
1448
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
1445
1449
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -2104,6 +2108,7 @@ export declare const namedSchemas: {
|
|
|
2104
2108
|
original: "original";
|
|
2105
2109
|
choose: "choose";
|
|
2106
2110
|
}>>;
|
|
2111
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
2107
2112
|
from: z.ZodOptional<z.ZodString>;
|
|
2108
2113
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
2109
2114
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -2397,6 +2402,7 @@ export declare const namedSchemas: {
|
|
|
2397
2402
|
original: "original";
|
|
2398
2403
|
choose: "choose";
|
|
2399
2404
|
}>>;
|
|
2405
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
2400
2406
|
from: z.ZodOptional<z.ZodString>;
|
|
2401
2407
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
2402
2408
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAsBH,cAAc,EAoBjB,MAAM,OAAO,CAAC;AACf,OAAO,EAAa,SAAS,EAA8B,MAAM,UAAU,CAAC;AAC5E,OAAO,EASH,QAAQ,EAIX,MAAM,cAAc,CAAC;AACtB,OAAO,EAEH,SAAS,EAGT,KAAK,EAOR,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAiCtC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AAEvB,wGAAwG;AACxG,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAsBH,cAAc,EAoBjB,MAAM,OAAO,CAAC;AACf,OAAO,EAAa,SAAS,EAA8B,MAAM,UAAU,CAAC;AAC5E,OAAO,EASH,QAAQ,EAIX,MAAM,cAAc,CAAC;AACtB,OAAO,EAEH,SAAS,EAGT,KAAK,EAOR,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAiCtC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGY,CAAC;AAEtC,0FAA0F;AAC1F,wBAAgB,oBAAoB;QACE,MAAM;4GAK3C"}
|
|
@@ -272,6 +272,7 @@ export declare const Resource: z.ZodObject<{
|
|
|
272
272
|
original: "original";
|
|
273
273
|
choose: "choose";
|
|
274
274
|
}>>;
|
|
275
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
275
276
|
from: z.ZodOptional<z.ZodString>;
|
|
276
277
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
277
278
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -565,6 +566,7 @@ export declare const Resource: z.ZodObject<{
|
|
|
565
566
|
original: "original";
|
|
566
567
|
choose: "choose";
|
|
567
568
|
}>>;
|
|
569
|
+
transforms: z.ZodOptional<z.ZodBoolean>;
|
|
568
570
|
from: z.ZodOptional<z.ZodString>;
|
|
569
571
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
570
572
|
display: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/schemas/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,eAAO,MAAM,gBAAgB;;;;;;;;;;;iBAmB3B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;YAeH,CAAC,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC;;iBAcxC,CAAC;AAEP,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;iBAQxB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAetB,CAAC;AAEP,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/schemas/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,eAAO,MAAM,gBAAgB;;;;;;;;;;;iBAmB3B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;YAeH,CAAC,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC;;iBAcxC,CAAC;AAEP,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;iBAQxB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAetB,CAAC;AAEP,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
4196
|
+
"transforms": {
|
|
4197
|
+
"description": "`media`, `image`: whether values keep a transform for one use. Defaults to true. With `false`, the backend ignores the `transform` of values and items give none, clients send none, and an `image` field has no editor; it can't have `ratios` or the `crop` rule (decision 0087).",
|
|
4198
|
+
"type": "boolean"
|
|
4199
|
+
},
|
|
4196
4200
|
"from": {
|
|
4197
4201
|
"description": "`slug`: the field the slug is generated from. `region`: the field of the same object that holds its country.",
|
|
4198
4202
|
"type": "string"
|