@panneau/protocol 5.0.0-alpha.42 → 5.0.0-alpha.44
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/blockTypeSets.d.ts +11 -0
- package/dist/blockTypeSets.d.ts.map +1 -0
- package/dist/blockTypeSets.js +73 -0
- package/dist/blockTypeSets.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/schemas/action.d.ts +2 -0
- package/dist/schemas/action.d.ts.map +1 -1
- package/dist/schemas/action.js +1 -0
- package/dist/schemas/action.js.map +1 -1
- package/dist/schemas/definition.d.ts +12 -2
- package/dist/schemas/definition.d.ts.map +1 -1
- package/dist/schemas/definition.js +2 -0
- package/dist/schemas/definition.js.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 +15 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/resource.d.ts +3 -0
- package/dist/schemas/resource.d.ts.map +1 -1
- package/dist/validate.d.ts +3 -2
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +15 -9
- package/dist/validate.js.map +1 -1
- package/package.json +1 -1
- package/schema/boot.schema.json +21 -0
- package/schema/definition.schema.json +21 -0
- package/schema/openapi.json +24 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Definition } from './schemas/index.js';
|
|
2
|
+
import type { ValidationIssue } from './validate.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the shared block types of a definition (decision 0094): gives each `repeater` with a
|
|
5
|
+
* `typeSet` the `types` of that set in `blockTypeSets`. Repeaters that name the same set share
|
|
6
|
+
* the same array, so a definition stays as small in memory as on the wire. Changes the
|
|
7
|
+
* definition in place, and returns what can't be resolved: a set that doesn't exist, a repeater
|
|
8
|
+
* with both `types` and `typeSet`, or a set whose blocks hold the set itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveBlockTypeSets(definition: Definition, path?: string): ValidationIssue[];
|
|
11
|
+
//# sourceMappingURL=blockTypeSets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockTypeSets.d.ts","sourceRoot":"","sources":["../src/blockTypeSets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,UAAU,EAAS,MAAM,WAAW,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,SAAK,GAAG,eAAe,EAAE,CAyEzF"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//#region src/blockTypeSets.ts
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the shared block types of a definition (decision 0094): gives each `repeater` with a
|
|
4
|
+
* `typeSet` the `types` of that set in `blockTypeSets`. Repeaters that name the same set share
|
|
5
|
+
* the same array, so a definition stays as small in memory as on the wire. Changes the
|
|
6
|
+
* definition in place, and returns what can't be resolved: a set that doesn't exist, a repeater
|
|
7
|
+
* with both `types` and `typeSet`, or a set whose blocks hold the set itself.
|
|
8
|
+
*/
|
|
9
|
+
function resolveBlockTypeSets(definition, path = "") {
|
|
10
|
+
const sets = definition.blockTypeSets ?? {};
|
|
11
|
+
const prefix = path === "" ? "" : `${path}.`;
|
|
12
|
+
const issues = [];
|
|
13
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
14
|
+
const resolveSet = (key, from) => {
|
|
15
|
+
const known = resolved.get(key);
|
|
16
|
+
if (known === null) {
|
|
17
|
+
issues.push({
|
|
18
|
+
path: from,
|
|
19
|
+
message: `The block type set \`${key}\` holds itself: blocks can't nest without end.`
|
|
20
|
+
});
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (known !== void 0) return known;
|
|
24
|
+
const set = sets[key];
|
|
25
|
+
if (set === void 0) {
|
|
26
|
+
issues.push({
|
|
27
|
+
path: from,
|
|
28
|
+
message: `No block type set \`${key}\` in \`blockTypeSets\`.`
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
resolved.set(key, null);
|
|
33
|
+
set.forEach((type, index) => {
|
|
34
|
+
visit(type.fields, `${prefix}blockTypeSets.${key}.${String(index)}.fields`);
|
|
35
|
+
});
|
|
36
|
+
resolved.set(key, set);
|
|
37
|
+
return set;
|
|
38
|
+
};
|
|
39
|
+
const visit = (fields, fieldsPath) => {
|
|
40
|
+
fields.forEach((field, index) => {
|
|
41
|
+
const fieldPath = `${fieldsPath}.${String(index)}`;
|
|
42
|
+
if (field.typeSet !== void 0) {
|
|
43
|
+
if (field.types !== void 0) issues.push({
|
|
44
|
+
path: `${fieldPath}.typeSet`,
|
|
45
|
+
message: "A field has `types` or a `typeSet`, not both."
|
|
46
|
+
});
|
|
47
|
+
else {
|
|
48
|
+
const types = resolveSet(field.typeSet, `${fieldPath}.typeSet`);
|
|
49
|
+
if (types !== void 0) field.types = types;
|
|
50
|
+
}
|
|
51
|
+
} else field.types?.forEach((type, typeIndex) => {
|
|
52
|
+
visit(type.fields, `${fieldPath}.types.${String(typeIndex)}.fields`);
|
|
53
|
+
});
|
|
54
|
+
visit(field.fields ?? [], `${fieldPath}.fields`);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
definition.resources.forEach((resource, index) => {
|
|
58
|
+
const resourcePath = `${prefix}resources.${String(index)}`;
|
|
59
|
+
visit(resource.fields, `${resourcePath}.fields`);
|
|
60
|
+
resource.types?.forEach((type, typeIndex) => {
|
|
61
|
+
visit(type.fields, `${resourcePath}.types.${String(typeIndex)}.fields`);
|
|
62
|
+
});
|
|
63
|
+
resource.actions?.forEach((action, actionIndex) => {
|
|
64
|
+
visit(action.fields ?? [], `${resourcePath}.actions.${String(actionIndex)}.fields`);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
Object.keys(sets).forEach((key) => resolveSet(key, `${prefix}blockTypeSets.${key}`));
|
|
68
|
+
return issues;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { resolveBlockTypeSets };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=blockTypeSets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockTypeSets.js","names":[],"sources":["../src/blockTypeSets.ts"],"sourcesContent":["import type { BlockType, Definition, Field } from './schemas';\nimport type { ValidationIssue } from './validate';\n\ntype Sets = NonNullable<Definition['blockTypeSets']>;\n\n/**\n * Resolves the shared block types of a definition (decision 0094): gives each `repeater` with a\n * `typeSet` the `types` of that set in `blockTypeSets`. Repeaters that name the same set share\n * the same array, so a definition stays as small in memory as on the wire. Changes the\n * definition in place, and returns what can't be resolved: a set that doesn't exist, a repeater\n * with both `types` and `typeSet`, or a set whose blocks hold the set itself.\n */\nexport function resolveBlockTypeSets(definition: Definition, path = ''): ValidationIssue[] {\n const sets: Sets = definition.blockTypeSets ?? {};\n const prefix = path === '' ? '' : `${path}.`;\n const issues: ValidationIssue[] = [];\n const resolved = new Map<string, BlockType[] | null>();\n\n const resolveSet = (key: string, from: string): BlockType[] | undefined => {\n const known = resolved.get(key);\n if (known === null) {\n issues.push({\n path: from,\n message: `The block type set \\`${key}\\` holds itself: blocks can't nest without end.`,\n });\n return undefined;\n }\n if (known !== undefined) {\n return known;\n }\n const set = sets[key];\n if (set === undefined) {\n issues.push({\n path: from,\n message: `No block type set \\`${key}\\` in \\`blockTypeSets\\`.`,\n });\n return undefined;\n }\n // Pending while its own blocks resolve: a set they name again is a loop\n resolved.set(key, null);\n set.forEach((type, index) => {\n visit(type.fields, `${prefix}blockTypeSets.${key}.${String(index)}.fields`);\n });\n resolved.set(key, set);\n return set;\n };\n\n const visit = (fields: readonly Field[], fieldsPath: string): void => {\n fields.forEach((field, index) => {\n const fieldPath = `${fieldsPath}.${String(index)}`;\n if (field.typeSet !== undefined) {\n if (field.types !== undefined) {\n issues.push({\n path: `${fieldPath}.typeSet`,\n message: 'A field has `types` or a `typeSet`, not both.',\n });\n } else {\n const types = resolveSet(field.typeSet, `${fieldPath}.typeSet`);\n if (types !== undefined) {\n field.types = types;\n }\n }\n } else {\n field.types?.forEach((type, typeIndex) => {\n visit(type.fields, `${fieldPath}.types.${String(typeIndex)}.fields`);\n });\n }\n visit(field.fields ?? [], `${fieldPath}.fields`);\n });\n };\n\n definition.resources.forEach((resource, index) => {\n const resourcePath = `${prefix}resources.${String(index)}`;\n visit(resource.fields, `${resourcePath}.fields`);\n resource.types?.forEach((type, typeIndex) => {\n visit(type.fields, `${resourcePath}.types.${String(typeIndex)}.fields`);\n });\n resource.actions?.forEach((action, actionIndex) => {\n visit(action.fields ?? [], `${resourcePath}.actions.${String(actionIndex)}.fields`);\n });\n });\n // The sets no repeater names are still checked\n Object.keys(sets).forEach((key) => resolveSet(key, `${prefix}blockTypeSets.${key}`));\n\n return issues;\n}\n"],"mappings":";;;;;;;;AAYA,SAAgB,qBAAqB,YAAwB,OAAO,IAAuB;CACvF,MAAM,OAAa,WAAW,iBAAiB,CAAC;CAChD,MAAM,SAAS,SAAS,KAAK,KAAK,GAAG,KAAK;CAC1C,MAAM,SAA4B,CAAC;CACnC,MAAM,2BAAW,IAAI,IAAgC;CAErD,MAAM,cAAc,KAAa,SAA0C;EACvE,MAAM,QAAQ,SAAS,IAAI,GAAG;EAC9B,IAAI,UAAU,MAAM;GAChB,OAAO,KAAK;IACR,MAAM;IACN,SAAS,wBAAwB,IAAI;GACzC,CAAC;GACD;EACJ;EACA,IAAI,UAAU,KAAA,GACV,OAAO;EAEX,MAAM,MAAM,KAAK;EACjB,IAAI,QAAQ,KAAA,GAAW;GACnB,OAAO,KAAK;IACR,MAAM;IACN,SAAS,uBAAuB,IAAI;GACxC,CAAC;GACD;EACJ;EAEA,SAAS,IAAI,KAAK,IAAI;EACtB,IAAI,SAAS,M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ist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,GACxB,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,GACxB,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveBlockTypeSets } from "./blockTypeSets.js";
|
|
1
2
|
import { PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION } from "./version.js";
|
|
2
3
|
import { ADDRESS_PARTS, AUTH_ERROR_CODES, AUTH_ERROR_PARAM, AUTH_PAGE_PATHS, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_ITEM_ACTIONS, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LINK_ACTIONS, BUILT_IN_LINK_TYPES, BUILT_IN_LIST_LAYOUTS, CONTEXT_HEADER, CONTEXT_PROBLEM_TYPE, DATE_RANGE_OPEN_BOUNDS, DEFAULT_ADDRESS_REQUIRED_PARTS, DURATION_UNITS, EMAIL_UNVERIFIED_PROBLEM_TYPE, IDS_FILTER, IDS_FILTER_LIMIT, ITEM_ACTION_ABILITIES, PASSWORD_CONFIRMATION_PROBLEM_TYPE, PORTABLE_RULES, RESERVED_ROUTE_SEGMENTS, RICH_TEXT_STYLE_ELEMENTS, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, UNDO_LIMIT, isBuiltInItemAction, isBuiltInLink } from "./constants.js";
|
|
3
4
|
import { CURRENCY_CODES, fromMinorUnits, getCurrencyDigits, isCurrencyCode, toMinorUnits } from "./currencies.js";
|
|
@@ -34,4 +35,4 @@ import { BootConfig } from "./schemas/boot.js";
|
|
|
34
35
|
import { createSchemaRegistry, namedSchemas } from "./schemas/index.js";
|
|
35
36
|
import { validate, validateBootConfig, validateDefinition } from "./validate.js";
|
|
36
37
|
import { createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument, createThemeJsonSchema } from "./openapi.js";
|
|
37
|
-
export { ADDRESS_PARTS, AGGREGATE_COUNT, AGGREGATE_MAX_POINTS, AUTH_ERROR_CODES, AUTH_ERROR_PARAM, AUTH_PAGE_PATHS, Abilities, Action, ActionConfirm, ActionItemResult, ActionPlacement, ActionRequest, ActionResult, ActionRun, ActionRunResponse, ActionScope, AddressSettings, AddressValue, Auth, AuthProvider, AuthToken, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_ITEM_ACTIONS, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LINK_ACTIONS, BUILT_IN_LINK_TYPES, BUILT_IN_LIST_LAYOUTS, BUILT_IN_WIDGET_TYPES, BlockType, BootConfig, BreakdownWidgetData, BreakdownWidgetItem, CONTEXT_HEADER, CONTEXT_PROBLEM_TYPE, CURRENCY_CODES, Column, Condition, ContextOption, ContextOptionsResponse, ContextParam, CursorPagination, DASHBOARD_COMPONENT, DATE_RANGE_OPEN_BOUNDS, DEFAULT_ADDRESS_REQUIRED_PARTS, DURATION_UNITS, DateRangeSettings, DateRangeValue, Definition, DefinitionContext, DefinitionTheme, DurationSettings, EMAIL_UNVERIFIED_PROBLEM_TYPE, EmbedResponse, EmbedValue, Field, FieldCheckRequest, FieldCheckResponse, Filter, GROUPED_WIDGET_TYPES, HOME_PAGE, IDS_FILTER, IDS_FILTER_LIMIT, ITEM_ACTION_ABILITIES, ITEM_TYPE_KEY, Id, InterfaceLocale, Item, ItemResponse, LayoutNode, LinkSettings, LinkTypeSetting, LinkValue, ListAggregates, ListCalendar, ListDefinition, ListResponse, ListWidgetData, ListWidgetItem, LocationValue, MediaInfo, MediaItem, MediaReference, MediaTransform, MenuItem, MetricWidgetData, MoneySettings, MoneyValue, OVERVIEW_PERIODS, Option, OverviewPeriod, PASSWORD_CONFIRMATION_PROBLEM_TYPE, PERIOD_PARAM, PORTABLE_RULES, POSTAL_CODE_COUNTRIES, PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION, Page, Pagination, Passkey, PreviewResponse, Problem, RESERVED_ROUTE_SEGMENTS, RESOURCE_WIDGET_TYPES, RICH_TEXT_STYLE_ELEMENTS, RecoveryCodes, Resource, ResourceFeatures, ResourceSummary, ResourceType, RichTextSettings, RichTextStyle, RouteReference, Rule, SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_LENGTH, SearchResponse, Selection, SeriesPoint, SeriesWidgetData, SeriesWidgetSeries, Session, StatWidgetData, StoredFile, SummaryPeriod, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, TableWidgetCell, TableWidgetColumn, TableWidgetData, TableWidgetRow, Theme, ThemeFont, ThemeFontFace, ThemeFontStylesheet, ThemeTokens, ToneInput, ToneValues, TwoFactorChallenge, TwoFactorSetup, TwoFactorStatus, UNDO_LIMIT, Upload, UploadReference, UploadResponse, UploadSignRequest, UploadSignResponse, Uploads, User, WIDGET_BREAKDOWN_MAX_ITEMS, WIDGET_FORMAT_CURRENCY_DISPLAYS, WIDGET_FORMAT_NOTATIONS, WIDGET_FORMAT_SIGN_DISPLAYS, WIDGET_FORMAT_STYLES, WIDGET_FORMAT_UNITS, WIDGET_FORMAT_UNIT_DISPLAYS, WIDGET_GOOD_WHEN, WIDGET_LIST_MAX_ITEMS, WIDGET_METRIC_MAX_PARTS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_MAX_SERIES, WIDGET_SERIES_PERIODS, WIDGET_SOURCES_MAX, WIDGET_TABLE_ALIGNS, WIDGET_TABLE_MAX_COLUMNS, WIDGET_TABLE_MAX_ROWS, WebAuthnOptions, Widget, WidgetAlert, WidgetAlertSettings, WidgetBadge, WidgetNumberFormat, WidgetRowSource, WidgetSeriesSource, WidgetSettings, aggregateItems, checkRules, checkValues, checkWidgetData, contextBefore, createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument, createSchemaRegistry, createThemeJsonSchema, evaluateCondition, findPeriodOption, followsList, followsPeriod, formatContextHeader, fromMinorUnits, fromSearchParams, getAddressRequiredParts, getAggregateWidgetType, getChangeTone, getCreatableTypes, getCurrencyDigits, getDashboardPages, getDashboardPeriod, getDashboardWidgets, getDefaultPeriod, getFilterRange, getImageUrl, getItemImageField, getItemType, getLinkNewTab, getLinkTypes, getMediaLibraries, getNestedShape, getPeriodRange, getPreviousRange, getResourceType, getSummaryPeriodFilter, getSummaryResources, getSummaryWidgets, getTypeFields, getValue, getWidgetAggregates, getWidgetChange, getWidgetResource, getWidgetSources, hasResourceTypes, isAddressPart, isBuiltInFieldType, isBuiltInItemAction, isBuiltInLink, isBuiltInLinkType, isBuiltInWidgetType, isCombinedWidget, isCompoundField, isCurrencyCode, isCursorPage, isDay, isExternalUrl, isFilled, isFilterRange, isOverviewPeriod, isPostalCode, isProblem, isSearchableResource, isWidgetDataEmpty, isWidgetUnit, lintDefinition, listPeriods, localDay, matchesFilterRange, matchesRatio, mergeThemes, namedSchemas, nextPeriod, normalizePostalCode, parseAggregateGroup, parseAggregateMeasure, parseContextHeader, parseRatio, readAggregateQuery, readPeriodOption, readSearchQuery, readWidgetDataQuery, readWidgetFormat, readsResources, renderedCropSize, resolveLinkNewTab, startOfPeriod, toAggregateParams, toMinorUnits, toSearchParams, toSearchQueryParams, toWidgetDataParams, validate, validateBootConfig, validateDefinition, widgetDataSchemas };
|
|
38
|
+
export { ADDRESS_PARTS, AGGREGATE_COUNT, AGGREGATE_MAX_POINTS, AUTH_ERROR_CODES, AUTH_ERROR_PARAM, AUTH_PAGE_PATHS, Abilities, Action, ActionConfirm, ActionItemResult, ActionPlacement, ActionRequest, ActionResult, ActionRun, ActionRunResponse, ActionScope, AddressSettings, AddressValue, Auth, AuthProvider, AuthToken, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_ITEM_ACTIONS, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LINK_ACTIONS, BUILT_IN_LINK_TYPES, BUILT_IN_LIST_LAYOUTS, BUILT_IN_WIDGET_TYPES, BlockType, BootConfig, BreakdownWidgetData, BreakdownWidgetItem, CONTEXT_HEADER, CONTEXT_PROBLEM_TYPE, CURRENCY_CODES, Column, Condition, ContextOption, ContextOptionsResponse, ContextParam, CursorPagination, DASHBOARD_COMPONENT, DATE_RANGE_OPEN_BOUNDS, DEFAULT_ADDRESS_REQUIRED_PARTS, DURATION_UNITS, DateRangeSettings, DateRangeValue, Definition, DefinitionContext, DefinitionTheme, DurationSettings, EMAIL_UNVERIFIED_PROBLEM_TYPE, EmbedResponse, EmbedValue, Field, FieldCheckRequest, FieldCheckResponse, Filter, GROUPED_WIDGET_TYPES, HOME_PAGE, IDS_FILTER, IDS_FILTER_LIMIT, ITEM_ACTION_ABILITIES, ITEM_TYPE_KEY, Id, InterfaceLocale, Item, ItemResponse, LayoutNode, LinkSettings, LinkTypeSetting, LinkValue, ListAggregates, ListCalendar, ListDefinition, ListResponse, ListWidgetData, ListWidgetItem, LocationValue, MediaInfo, MediaItem, MediaReference, MediaTransform, MenuItem, MetricWidgetData, MoneySettings, MoneyValue, OVERVIEW_PERIODS, Option, OverviewPeriod, PASSWORD_CONFIRMATION_PROBLEM_TYPE, PERIOD_PARAM, PORTABLE_RULES, POSTAL_CODE_COUNTRIES, PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION, Page, Pagination, Passkey, PreviewResponse, Problem, RESERVED_ROUTE_SEGMENTS, RESOURCE_WIDGET_TYPES, RICH_TEXT_STYLE_ELEMENTS, RecoveryCodes, Resource, ResourceFeatures, ResourceSummary, ResourceType, RichTextSettings, RichTextStyle, RouteReference, Rule, SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_LENGTH, SearchResponse, Selection, SeriesPoint, SeriesWidgetData, SeriesWidgetSeries, Session, StatWidgetData, StoredFile, SummaryPeriod, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, TableWidgetCell, TableWidgetColumn, TableWidgetData, TableWidgetRow, Theme, ThemeFont, ThemeFontFace, ThemeFontStylesheet, ThemeTokens, ToneInput, ToneValues, TwoFactorChallenge, TwoFactorSetup, TwoFactorStatus, UNDO_LIMIT, Upload, UploadReference, UploadResponse, UploadSignRequest, UploadSignResponse, Uploads, User, WIDGET_BREAKDOWN_MAX_ITEMS, WIDGET_FORMAT_CURRENCY_DISPLAYS, WIDGET_FORMAT_NOTATIONS, WIDGET_FORMAT_SIGN_DISPLAYS, WIDGET_FORMAT_STYLES, WIDGET_FORMAT_UNITS, WIDGET_FORMAT_UNIT_DISPLAYS, WIDGET_GOOD_WHEN, WIDGET_LIST_MAX_ITEMS, WIDGET_METRIC_MAX_PARTS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_MAX_SERIES, WIDGET_SERIES_PERIODS, WIDGET_SOURCES_MAX, WIDGET_TABLE_ALIGNS, WIDGET_TABLE_MAX_COLUMNS, WIDGET_TABLE_MAX_ROWS, WebAuthnOptions, Widget, WidgetAlert, WidgetAlertSettings, WidgetBadge, WidgetNumberFormat, WidgetRowSource, WidgetSeriesSource, WidgetSettings, aggregateItems, checkRules, checkValues, checkWidgetData, contextBefore, createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument, createSchemaRegistry, createThemeJsonSchema, evaluateCondition, findPeriodOption, followsList, followsPeriod, formatContextHeader, fromMinorUnits, fromSearchParams, getAddressRequiredParts, getAggregateWidgetType, getChangeTone, getCreatableTypes, getCurrencyDigits, getDashboardPages, getDashboardPeriod, getDashboardWidgets, getDefaultPeriod, getFilterRange, getImageUrl, getItemImageField, getItemType, getLinkNewTab, getLinkTypes, getMediaLibraries, getNestedShape, getPeriodRange, getPreviousRange, getResourceType, getSummaryPeriodFilter, getSummaryResources, getSummaryWidgets, getTypeFields, getValue, getWidgetAggregates, getWidgetChange, getWidgetResource, getWidgetSources, hasResourceTypes, isAddressPart, isBuiltInFieldType, isBuiltInItemAction, isBuiltInLink, isBuiltInLinkType, isBuiltInWidgetType, isCombinedWidget, isCompoundField, isCurrencyCode, isCursorPage, isDay, isExternalUrl, isFilled, isFilterRange, isOverviewPeriod, isPostalCode, isProblem, isSearchableResource, isWidgetDataEmpty, isWidgetUnit, lintDefinition, listPeriods, localDay, matchesFilterRange, matchesRatio, mergeThemes, namedSchemas, nextPeriod, normalizePostalCode, parseAggregateGroup, parseAggregateMeasure, parseContextHeader, parseRatio, readAggregateQuery, readPeriodOption, readSearchQuery, readWidgetDataQuery, readWidgetFormat, readsResources, renderedCropSize, resolveBlockTypeSets, resolveLinkNewTab, startOfPeriod, toAggregateParams, toMinorUnits, toSearchParams, toSearchQueryParams, toWidgetDataParams, validate, validateBootConfig, validateDefinition, widgetDataSchemas };
|
package/dist/schemas/action.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare const Action: z.ZodObject<{
|
|
|
39
39
|
menu: "menu";
|
|
40
40
|
}>>>;
|
|
41
41
|
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
tone: z.ZodOptional<z.ZodString>;
|
|
42
43
|
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
43
44
|
title: z.ZodOptional<z.ZodString>;
|
|
44
45
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -231,6 +232,7 @@ export declare const Action: z.ZodObject<{
|
|
|
231
232
|
display: z.ZodOptional<z.ZodString>;
|
|
232
233
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
233
234
|
types: z.ZodOptional<z.ZodArray<typeof import("./field.js").BlockType>>;
|
|
235
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
234
236
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
235
237
|
}, z.core.$loose>>>;
|
|
236
238
|
layout: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/schemas/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqFb,CAAC;AAEP,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,qEAAqE;AACrE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
package/dist/schemas/action.js
CHANGED
|
@@ -34,6 +34,7 @@ var Action = z.looseObject({
|
|
|
34
34
|
scope: z.array(ActionScope).min(1),
|
|
35
35
|
placement: z.array(ActionPlacement).optional(),
|
|
36
36
|
destructive: z.boolean().optional(),
|
|
37
|
+
tone: z.string().regex(/^[a-z0-9-]+$/).optional().meta({ description: "The color of its icon in rows and of its button in the header of an item (decision 0091): a tone of the theme, such as `info`. An action that destroys is always `danger`." }),
|
|
37
38
|
confirm: ActionConfirm.optional(),
|
|
38
39
|
fields: z.array(Field).optional().meta({ description: "Parameters, shown in a modal." }),
|
|
39
40
|
layout: z.array(LayoutNode).optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","names":[],"sources":["../../src/schemas/action.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { isBuiltInItemAction, isBuiltInLink } from '../constants';\nimport { Abilities } from './common';\nimport { Field } from './field';\nimport { actionJsonRules } from './jsonRules';\nimport { LayoutNode } from './layout';\n\nexport const ActionScope = z.enum(['item', 'selection', 'resource']);\n\nexport const ActionPlacement = z.enum(['row', 'toolbar', 'form', 'menu']);\n\nexport const ActionConfirm = z.union([\n z.boolean(),\n z.looseObject({\n title: z.string().optional(),\n message: z\n .string()\n .optional()\n .meta({ description: 'ICU message. `{count}` is the number of items.' }),\n confirmLabel: z.string().optional(),\n cancelLabel: z.string().optional(),\n }),\n]);\n\nexport const Action = z\n .looseObject({\n id: z.string().min(1),\n label: z.string().optional().meta({\n description:\n 'Required, except for the built-in item actions (`show`, `edit`, `duplicate`, `delete`), which the client labels in its locale.',\n }),\n icon: z.string().optional(),\n kind: z.enum(['server', 'link', 'client']).default('server').meta({\n description:\n '`server` calls the action endpoint; `link` navigates; `client` runs a plugin handler.',\n }),\n scope: z.array(ActionScope).min(1),\n placement: z.array(ActionPlacement).optional(),\n destructive: z.boolean().optional(),\n confirm: ActionConfirm.optional(),\n fields: z.array(Field).optional().meta({ description: 'Parameters, shown in a modal.' }),\n layout: z.array(LayoutNode).optional(),\n queued: z\n .boolean()\n .optional()\n .meta({ description: 'The action always answers `202` with a run.' }),\n dryRun: z.boolean().optional().meta({\n description:\n 'The backend answers dry runs of this action (`dryRun` in the request): lists ask it how many items of a query selection will be skipped. Without it, the UI never sends `dryRun`, since a backend that ignores it would run the action.',\n }),\n undoable: z.boolean().optional().meta({\n description:\n 'Its runs can be undone: the client runs it without a confirmation (unless it sets `confirm`), and shows \"Undo\" when its result has an `undo`. Above `UNDO_LIMIT` items (100), and for queued runs, the client confirms it first (decision 0063). The `delete` of a resource with a trash declares it, undone by `restore`.',\n }),\n url: z\n .string()\n .optional()\n .meta({ description: '`link`: URL template, with `{id}` for the item.' }),\n route: z\n .string()\n .optional()\n .meta({ description: '`link`: name of a route in the definition.' }),\n component: z.string().optional().meta({ description: '`client`: the plugin handler.' }),\n abilities: Abilities.optional().meta({\n description: '`run`: whether the current user can run the action on the resource.',\n }),\n })\n .superRefine((action, context) => {\n const builtInLink = isBuiltInLink(action.id);\n if (builtInLink && action.kind !== 'link') {\n context.addIssue({\n code: 'custom',\n path: ['kind'],\n message: `The id \\`${action.id}\\` is reserved for the built-in link: its \\`kind\\` must be \\`link\\`.`,\n });\n }\n if (action.label === undefined && !isBuiltInItemAction(action.id)) {\n context.addIssue({\n code: 'custom',\n path: ['label'],\n message: 'An action needs a `label`.',\n });\n }\n if (\n action.kind === 'link' &&\n action.url === undefined &&\n action.route === undefined &&\n !builtInLink\n ) {\n context.addIssue({\n code: 'custom',\n message: 'A `link` action needs a `url` or a `route`.',\n });\n }\n if (action.kind === 'client' && action.component === undefined) {\n context.addIssue({ code: 'custom', message: 'A `client` action needs a `component`.' });\n }\n })\n .meta({\n description: 'An operation on one item, a selection, or the whole resource.',\n ...actionJsonRules,\n });\n\nexport type ActionScope = z.infer<typeof ActionScope>;\nexport type ActionPlacement = z.infer<typeof ActionPlacement>;\nexport type ActionConfirm = z.infer<typeof ActionConfirm>;\nexport type Action = z.infer<typeof Action>;\n/** An action as a backend writes it: `kind` defaults to `server`. */\nexport type ActionInput = z.input<typeof Action>;\n"],"mappings":";;;;;;;AAQA,IAAa,cAAc,EAAE,KAAK;CAAC;CAAQ;CAAa;AAAU,CAAC;AAEnE,IAAa,kBAAkB,EAAE,KAAK;CAAC;CAAO;CAAW;CAAQ;AAAM,CAAC;AAExE,IAAa,gBAAgB,EAAE,MAAM,CACjC,EAAE,QAAQ,GACV,EAAE,YAAY;CACV,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,SAAS,EACJ,OA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CACvE,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,gCAAgC,CAAC;CACtF,WAAW,UAAU,SAAS,CAAC,CAAC,KAAK,EACjC,aAAa,sEACjB,CAAC;AACL,CAAC,CAAC,CACD,aAAa,QAAQ,YAAY;CAC9B,MAAM,cAAc,cAAc,OAAO,EAAE;CAC3C,IAAI,eAAe,OAAO,SAAS,QAC/B,QAAQ,SAAS;EACb,MAAM;EACN,MAAM,CAAC,MAAM;EACb,SAAS,YAAY,OAAO,GAAG;CACnC,CAAC;CAEL,IAAI,OAAO,UAAU,KAAA,KAAa,CAAC,oBAAoB,OAAO,EAAE,GAC5D,QAAQ,SAAS;EACb,MAAM;EACN,MAAM,CAAC,OAAO;EACd,SAAS;CACb,CAAC;CAEL,IACI,OAAO,SAAS,UAChB,OAAO,QAAQ,KAAA,KACf,OAAO,UAAU,KAAA,KACjB,CAAC,aAED,QAAQ,SAAS;EACb,MAAM;EACN,SAAS;CACb,CAAC;CAEL,IAAI,OAAO,SAAS,YAAY,OAAO,cAAc,KAAA,GACjD,QAAQ,SAAS;EAAE,MAAM;EAAU,SAAS;CAAyC,CAAC;AAE9F,CAAC,CAAC,CACD,KAAK;CACF,aAAa;CACb,GAAG;AACP,CAAC"}
|
|
1
|
+
{"version":3,"file":"action.js","names":[],"sources":["../../src/schemas/action.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { isBuiltInItemAction, isBuiltInLink } from '../constants';\nimport { Abilities } from './common';\nimport { Field } from './field';\nimport { actionJsonRules } from './jsonRules';\nimport { LayoutNode } from './layout';\n\nexport const ActionScope = z.enum(['item', 'selection', 'resource']);\n\nexport const ActionPlacement = z.enum(['row', 'toolbar', 'form', 'menu']);\n\nexport const ActionConfirm = z.union([\n z.boolean(),\n z.looseObject({\n title: z.string().optional(),\n message: z\n .string()\n .optional()\n .meta({ description: 'ICU message. `{count}` is the number of items.' }),\n confirmLabel: z.string().optional(),\n cancelLabel: z.string().optional(),\n }),\n]);\n\nexport const Action = z\n .looseObject({\n id: z.string().min(1),\n label: z.string().optional().meta({\n description:\n 'Required, except for the built-in item actions (`show`, `edit`, `duplicate`, `delete`), which the client labels in its locale.',\n }),\n icon: z.string().optional(),\n kind: z.enum(['server', 'link', 'client']).default('server').meta({\n description:\n '`server` calls the action endpoint; `link` navigates; `client` runs a plugin handler.',\n }),\n scope: z.array(ActionScope).min(1),\n placement: z.array(ActionPlacement).optional(),\n destructive: z.boolean().optional(),\n tone: z\n .string()\n .regex(/^[a-z0-9-]+$/)\n .optional()\n .meta({\n description:\n 'The color of its icon in rows and of its button in the header of an item (decision 0091): a tone of the theme, such as `info`. An action that destroys is always `danger`.',\n }),\n confirm: ActionConfirm.optional(),\n fields: z.array(Field).optional().meta({ description: 'Parameters, shown in a modal.' }),\n layout: z.array(LayoutNode).optional(),\n queued: z\n .boolean()\n .optional()\n .meta({ description: 'The action always answers `202` with a run.' }),\n dryRun: z.boolean().optional().meta({\n description:\n 'The backend answers dry runs of this action (`dryRun` in the request): lists ask it how many items of a query selection will be skipped. Without it, the UI never sends `dryRun`, since a backend that ignores it would run the action.',\n }),\n undoable: z.boolean().optional().meta({\n description:\n 'Its runs can be undone: the client runs it without a confirmation (unless it sets `confirm`), and shows \"Undo\" when its result has an `undo`. Above `UNDO_LIMIT` items (100), and for queued runs, the client confirms it first (decision 0063). The `delete` of a resource with a trash declares it, undone by `restore`.',\n }),\n url: z\n .string()\n .optional()\n .meta({ description: '`link`: URL template, with `{id}` for the item.' }),\n route: z\n .string()\n .optional()\n .meta({ description: '`link`: name of a route in the definition.' }),\n component: z.string().optional().meta({ description: '`client`: the plugin handler.' }),\n abilities: Abilities.optional().meta({\n description: '`run`: whether the current user can run the action on the resource.',\n }),\n })\n .superRefine((action, context) => {\n const builtInLink = isBuiltInLink(action.id);\n if (builtInLink && action.kind !== 'link') {\n context.addIssue({\n code: 'custom',\n path: ['kind'],\n message: `The id \\`${action.id}\\` is reserved for the built-in link: its \\`kind\\` must be \\`link\\`.`,\n });\n }\n if (action.label === undefined && !isBuiltInItemAction(action.id)) {\n context.addIssue({\n code: 'custom',\n path: ['label'],\n message: 'An action needs a `label`.',\n });\n }\n if (\n action.kind === 'link' &&\n action.url === undefined &&\n action.route === undefined &&\n !builtInLink\n ) {\n context.addIssue({\n code: 'custom',\n message: 'A `link` action needs a `url` or a `route`.',\n });\n }\n if (action.kind === 'client' && action.component === undefined) {\n context.addIssue({ code: 'custom', message: 'A `client` action needs a `component`.' });\n }\n })\n .meta({\n description: 'An operation on one item, a selection, or the whole resource.',\n ...actionJsonRules,\n });\n\nexport type ActionScope = z.infer<typeof ActionScope>;\nexport type ActionPlacement = z.infer<typeof ActionPlacement>;\nexport type ActionConfirm = z.infer<typeof ActionConfirm>;\nexport type Action = z.infer<typeof Action>;\n/** An action as a backend writes it: `kind` defaults to `server`. */\nexport type ActionInput = z.input<typeof Action>;\n"],"mappings":";;;;;;;AAQA,IAAa,cAAc,EAAE,KAAK;CAAC;CAAQ;CAAa;AAAU,CAAC;AAEnE,IAAa,kBAAkB,EAAE,KAAK;CAAC;CAAO;CAAW;CAAQ;AAAM,CAAC;AAExE,IAAa,gBAAgB,EAAE,MAAM,CACjC,EAAE,QAAQ,GACV,EAAE,YAAY;CACV,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,SAAS,EACJ,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,iDAAiD,CAAC;CAC3E,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;AACrC,CAAC,CACL,CAAC;AAED,IAAa,SAAS,EACjB,YAAY;CACT,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACpB,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC9B,aACI,iIACR,CAAC;CACD,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,MA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S;EACb,MAAM;EACN,MAAM,CAAC,MAAM;EACb,SAAS,YAAY,OAAO,GAAG;CACnC,CAAC;CAEL,IAAI,OAAO,UAAU,KAAA,KAAa,CAAC,oBAAoB,OAAO,EAAE,GAC5D,QAAQ,SAAS;EACb,MAAM;EACN,MAAM,CAAC,OAAO;EACd,SAAS;CACb,CAAC;CAEL,IACI,OAAO,SAAS,UAChB,OAAO,QAAQ,KAAA,KACf,OAAO,UAAU,KAAA,KACjB,CAAC,aAED,QAAQ,SAAS;EACb,MAAM;EACN,SAAS;CACb,CAAC;CAEL,IAAI,OAAO,SAAS,YAAY,OAAO,cAAc,KAAA,GACjD,QAAQ,SAAS;EAAE,MAAM;EAAU,SAAS;CAAyC,CAAC;AAE9F,CAAC,CAAC,CACD,KAAK;CACF,aAAa;CACb,GAAG;AACP,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { BlockType } from './field.js';
|
|
2
3
|
export declare const User: z.ZodObject<{
|
|
3
4
|
id: z.ZodString;
|
|
4
5
|
name: z.ZodString;
|
|
@@ -589,7 +590,8 @@ export declare const Definition: z.ZodObject<{
|
|
|
589
590
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
590
591
|
display: z.ZodOptional<z.ZodString>;
|
|
591
592
|
fields: z.ZodOptional<z.ZodArray<typeof import("./field.js").Field>>;
|
|
592
|
-
types: z.ZodOptional<z.ZodArray<typeof
|
|
593
|
+
types: z.ZodOptional<z.ZodArray<typeof BlockType>>;
|
|
594
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
593
595
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
594
596
|
}, z.core.$loose>>;
|
|
595
597
|
form: z.ZodOptional<z.ZodObject<{
|
|
@@ -692,6 +694,7 @@ export declare const Definition: z.ZodObject<{
|
|
|
692
694
|
menu: "menu";
|
|
693
695
|
}>>>;
|
|
694
696
|
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
697
|
+
tone: z.ZodOptional<z.ZodString>;
|
|
695
698
|
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
696
699
|
title: z.ZodOptional<z.ZodString>;
|
|
697
700
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -883,7 +886,8 @@ export declare const Definition: z.ZodObject<{
|
|
|
883
886
|
check: z.ZodOptional<z.ZodBoolean>;
|
|
884
887
|
display: z.ZodOptional<z.ZodString>;
|
|
885
888
|
fields: z.ZodOptional<z.ZodArray<typeof import("./field.js").Field>>;
|
|
886
|
-
types: z.ZodOptional<z.ZodArray<typeof
|
|
889
|
+
types: z.ZodOptional<z.ZodArray<typeof BlockType>>;
|
|
890
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
887
891
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
888
892
|
}, z.core.$loose>>>;
|
|
889
893
|
layout: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1209,6 +1213,12 @@ export declare const Definition: z.ZodObject<{
|
|
|
1209
1213
|
}, z.core.$loose>>;
|
|
1210
1214
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1211
1215
|
}, z.core.$loose>>;
|
|
1216
|
+
blockTypeSets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
1217
|
+
id: z.ZodString;
|
|
1218
|
+
label: z.ZodString;
|
|
1219
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1220
|
+
fields: z.ZodArray<typeof import("./field.js").Field>;
|
|
1221
|
+
}, z.core.$loose>>>>;
|
|
1212
1222
|
pages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1213
1223
|
component: z.ZodString;
|
|
1214
1224
|
path: 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;
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/schemas/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKpC,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;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AAC,CAAC;AACxC,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAC9C,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACpD,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "../version.js";
|
|
2
2
|
import { RESERVED_ROUTE_SEGMENTS } from "../constants.js";
|
|
3
3
|
import { Abilities, Id } from "./common.js";
|
|
4
|
+
import { BlockType } from "./field.js";
|
|
4
5
|
import { OverviewPeriod, Widget } from "./widget.js";
|
|
5
6
|
import { Resource } from "./resource.js";
|
|
6
7
|
import { DefinitionTheme } from "./theme.js";
|
|
@@ -100,6 +101,7 @@ var Definition = z.looseObject({
|
|
|
100
101
|
interfaceLocales: z.array(InterfaceLocale).optional().meta({ description: "The languages of the interface, `locale` among them: with two or more, the shell has a switcher (decision 0083). Not the locales of the content, which are `locales`." }),
|
|
101
102
|
api: z.looseObject({ baseUrl: z.string() }),
|
|
102
103
|
resources: z.array(Resource),
|
|
104
|
+
blockTypeSets: z.record(z.string().min(1), z.array(BlockType)).optional().meta({ description: "Lists of block types shared by `repeater` fields, by key (decision 0094): a repeater names one with `typeSet` rather than repeating its `types`, such as the blocks of every type of page. Their block types can hold repeaters that name other sets, never their own." }),
|
|
103
105
|
pages: z.record(z.string(), Page).optional(),
|
|
104
106
|
menus: z.record(z.string(), z.array(MenuItem)).optional(),
|
|
105
107
|
routes: z.record(z.string(), z.string()).optional().meta({ description: "Named paths of the frontend, for `link` actions and redirects." }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.js","names":[],"sources":["../../src/schemas/definition.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { RESERVED_ROUTE_SEGMENTS } from '../constants';\nimport { PROTOCOL_VERSION } from '../version';\nimport { Abilities, Id } from './common';\nimport { Resource } from './resource';\nimport { DefinitionTheme } from './theme';\nimport { OverviewPeriod, Widget } from './widget';\n\nexport const User = z.looseObject({\n id: Id,\n name: z.string(),\n email: z.string().optional(),\n avatarUrl: z.string().optional(),\n abilities: Abilities.optional(),\n resource: z.string().nullable().optional().meta({\n description:\n 'The resource of users: its item with this `id` is the profile of the user. Without it, clients look for a resource `users`. `null` when the user has no item they can edit in a resource: clients show no link to a profile.',\n }),\n});\n\nexport const AuthProvider = z.looseObject({\n id: z.string().min(1),\n label: z.string(),\n url: z.string().optional().meta({\n description:\n 'Where the login with this provider starts, with a full navigation. The app adds `next`, the path to come back to.',\n }),\n icon: z.string().optional(),\n});\n\nexport const AuthToken = z.looseObject({\n label: z.string().optional().meta({ description: 'Label of the field. Defaults to \"Token\".' }),\n help: z.string().optional().meta({ description: 'Help under the field: where to find it.' }),\n});\n\nexport const Auth = z.looseObject({\n mode: z.enum(['panneau', 'external']).meta({\n description: \"`panneau`: Panneau's own login pages. `external`: the site handles login.\",\n }),\n loginUrl: z\n .string()\n .nullable()\n .optional()\n .meta({ description: '`external`: where unauthenticated users are sent.' }),\n logoutUrl: z.string().nullable().optional().meta({\n description:\n \"`external`: where the browser goes to log out, the site's own logout. Without it, the app offers no logout.\",\n }),\n password: z.boolean().optional().meta({\n description:\n '`panneau`: a login with an email and a password. Defaults to true without `token`.',\n }),\n token: AuthToken.optional().meta({\n description:\n '`panneau`: a login with a single secret, such as an access token, sent as `token` to `POST /auth/login`.',\n }),\n providers: z.array(AuthProvider).optional(),\n account: z.boolean().optional().meta({\n description:\n '`panneau`: the account page of the user, on `/account`: their name and email, their password, their two-factor authentication.',\n }),\n passwordReset: z.boolean().optional().meta({\n description:\n '`panneau`: a \"Forgot your password?\" link on the login page, through `POST /auth/password/forgot` and `POST /auth/password/reset`.',\n }),\n twoFactor: z.boolean().optional().meta({\n description:\n '`panneau`: two-factor authentication, which users set up through `/account/two-factor`, and which a password login asks for with a `202`.',\n }),\n passkeys: z.boolean().optional().meta({\n description:\n '`panneau`: logins with a passkey (WebAuthn), which users add on the account page.',\n }),\n emailVerification: z.boolean().optional().meta({\n description:\n \"`panneau`: the backend refuses users whose email address isn't verified with a `403` problem of type `urn:panneau:problem:email-unverified`, and verifies it through `POST /auth/email/verification` and `POST /auth/email/verify`.\",\n }),\n});\n\nexport const InterfaceLocale = z\n .looseObject({\n locale: z.string().min(2).meta({ description: 'BCP 47 locale of the interface.' }),\n label: z.string().meta({\n description: 'The name of the language in that language, such as \"Français\".',\n }),\n url: z.string().min(1).meta({\n description:\n 'Where the browser goes to switch to this locale, with a full navigation. The app adds `next`, the path and query to come back to (decision 0083).',\n }),\n })\n .meta({ description: 'A language the user can switch the interface to.' });\n\nexport const MenuItem = z\n .looseObject({\n type: z.string().min(1).meta({\n description: 'Built-in: `resources`, `resource`, `page`, `link`, `separator`, `group`.',\n }),\n label: z.string().optional(),\n icon: z.string().optional(),\n resource: z.string().optional(),\n page: z.string().optional(),\n url: z.string().optional(),\n external: z.boolean().optional(),\n collapsible: z.boolean().optional().meta({\n description:\n '`group` with a `label`: the user shows or hides its links, and the browser remembers it (decision 0079).',\n }),\n collapsed: z.boolean().optional().meta({\n description:\n '`group`: collapsible, and closed until the user opens it, unless it holds the current page.',\n }),\n emphasis: z.boolean().optional().meta({\n description: '`resource`, `page` or `link`: its label is bold, for the main entries.',\n }),\n // The return type is written out so that declaration files keep the recursion.\n get children(): z.ZodOptional<z.ZodArray<typeof MenuItem>> {\n return z.array(MenuItem).optional();\n },\n })\n .meta({ description: 'An entry of a menu.' });\n\nexport const Page = z.looseObject({\n component: z\n .string()\n .min(1)\n .meta({ description: 'A page provided by a plugin, or a built-in page.' }),\n path: z.string().optional().meta({ description: 'Path of a custom page.' }),\n label: z.string().optional(),\n props: z.record(z.string(), z.unknown()).optional(),\n params: z\n .array(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/))\n .optional()\n .meta({\n description:\n 'Names of the path segments after the page: `[\"id\"]` makes `{basePath}/pages/{page}/{id}`. The component gets them as `params`, and route references (`{ \"route\": \"<page>\", \"params\": { \"id\": … } }`) can link to the page. A page with `params` is not in menus.',\n }),\n abilities: Abilities.optional().meta({\n description:\n 'What the current user can do with the page (decision 0046). `view: false` leaves it out of menus, and its route shows a forbidden state; `pages.home` falls back to the built-in home. Without it, the page is allowed.',\n }),\n widgets: z.array(Widget).optional().meta({\n description:\n 'A page whose component is the built-in `dashboard`: its widgets for the user, in order (decision 0084), fed by `GET /dashboard/widgets/{widget}?page={page}`. On `pages.home`, they replace `dashboard.widgets`.',\n }),\n period: OverviewPeriod.optional().meta({\n description:\n 'A page whose component is the built-in `dashboard`: one period for its widgets (decision 0084). On `pages.home`, it replaces `dashboard.period`.',\n }),\n});\n\nexport const ContextOption = z\n .looseObject({\n value: z.string().min(1),\n label: z.string(),\n description: z.string().optional(),\n })\n .meta({ description: 'A choice of a param of the context.' });\n\nexport const ContextParam = z\n .looseObject({\n name: z\n .string()\n .regex(\n new RegExp(`^(?!(?:${RESERVED_ROUTE_SEGMENTS.join('|')})$)[A-Za-z_][A-Za-z0-9_]*$`),\n )\n .meta({\n description:\n 'The name of the param, in the `Panneau-Context` header and in the client routes (`{basePath}/{name}/{value}/…`): an identifier, not a reserved first segment of the routes.',\n }),\n label: z.string(),\n required: z.boolean().optional().meta({\n description:\n 'Whether the app needs a value: without one, it shows a page to pick it in place of the page of the route.',\n }),\n fixed: z.boolean().optional().meta({\n description:\n 'The backend sets the value from the request, such as its domain: the app shows it without a picker, and leaves it out of the path and of the `Panneau-Context` header. Another value in the header is a `403` context problem. A fixed param has a `value`.',\n }),\n allLabel: z.string().optional().meta({\n description: 'An optional param: the label of no value, such as \"All clients\".',\n }),\n options: z.array(ContextOption).optional().meta({\n description:\n 'The choices, inline. Without them, the client searches them with `GET /context/{name}/options`.',\n }),\n value: z.string().min(1).nullable().optional().meta({\n description:\n 'The value the definition was built for: the one the client sent, checked, or the one the backend chose for a required param.',\n }),\n valueLabel: z\n .string()\n .nullable()\n .optional()\n .meta({ description: 'The label of `value`, for the picker.' }),\n })\n .meta({ description: 'A param of the current context (decision 0045).' });\n\nexport const DefinitionContext = z\n .looseObject({\n params: z.array(ContextParam).min(1).meta({\n description:\n 'In order: each param depends on the params before it. The params are the same whatever the values.',\n }),\n })\n .meta({\n description:\n 'The current context the user picks in the app, sent with every request in the `Panneau-Context` header (decision 0045).',\n });\n\nexport const Uploads = z.looseObject({\n mode: z.enum(['multipart', 'tus', 'presigned']).meta({\n description:\n '`multipart`: files go through `POST /media` and the requests that take them. `presigned`: the browser also sends files to storage itself, with URLs that `POST /uploads/sign` signs, then `POST /uploads/{upload}/complete` gives an upload that values reference.',\n }),\n endpoint: z.string().optional().meta({\n description:\n '`presigned`: the base URL of the upload routes, when they are not `{api.baseUrl}/uploads`.',\n }),\n maxSize: z.number().int().positive().optional(),\n});\n\nexport const Definition = z\n .looseObject({\n protocol: z.literal(PROTOCOL_VERSION),\n name: z.string(),\n locale: z\n .string()\n .min(2)\n .meta({ description: 'BCP 47 locale of the labels and messages.' }),\n locales: z\n .array(z.string().min(2))\n .min(1)\n .meta({ description: 'Locales of localized content fields.' }),\n interfaceLocales: z.array(InterfaceLocale).optional().meta({\n description:\n 'The languages of the interface, `locale` among them: with two or more, the shell has a switcher (decision 0083). Not the locales of the content, which are `locales`.',\n }),\n api: z.looseObject({ baseUrl: z.string() }),\n resources: z.array(Resource),\n pages: z.record(z.string(), Page).optional(),\n menus: z.record(z.string(), z.array(MenuItem)).optional(),\n routes: z.record(z.string(), z.string()).optional().meta({\n description: 'Named paths of the frontend, for `link` actions and redirects.',\n }),\n auth: Auth.optional(),\n dashboard: z\n .looseObject({ widgets: z.array(Widget), period: OverviewPeriod.optional() })\n .optional()\n .meta({\n description:\n 'The widgets of the home page for the user, in order, when `pages.home` is the `dashboard` (decision 0064): the shorthand of `pages.home.widgets`, which wins when set.',\n }),\n search: z.looseObject({ enabled: z.boolean() }).optional(),\n uploads: Uploads.optional(),\n context: DefinitionContext.optional(),\n theme: DefinitionTheme.optional(),\n user: User.nullable().optional(),\n })\n .superRefine((definition, context) => {\n const ids = new Set<string>();\n definition.resources.forEach((resource, index) => {\n if (ids.has(resource.id)) {\n context.addIssue({\n code: 'custom',\n message: `Duplicate resource id \\`${resource.id}\\`.`,\n path: ['resources', index, 'id'],\n });\n }\n ids.add(resource.id);\n });\n const names = new Set<string>();\n definition.context?.params.forEach((param, index) => {\n if (names.has(param.name)) {\n context.addIssue({\n code: 'custom',\n message: `Duplicate context param \\`${param.name}\\`.`,\n path: ['context', 'params', index, 'name'],\n });\n }\n names.add(param.name);\n if (param.fixed === true && (param.value ?? null) === null) {\n context.addIssue({\n code: 'custom',\n message: `The context param \\`${param.name}\\` is fixed without a value.`,\n path: ['context', 'params', index, 'value'],\n });\n }\n });\n })\n .meta({ description: 'Everything a frontend needs to render the admin for the current user.' });\n\nexport type User = z.infer<typeof User>;\nexport type AuthProvider = z.infer<typeof AuthProvider>;\nexport type AuthToken = z.infer<typeof AuthToken>;\nexport type Auth = z.infer<typeof Auth>;\nexport type InterfaceLocale = z.infer<typeof InterfaceLocale>;\nexport type MenuItem = z.infer<typeof MenuItem>;\nexport type Page = z.infer<typeof Page>;\nexport type ContextOption = z.infer<typeof ContextOption>;\nexport type ContextParam = z.infer<typeof ContextParam>;\nexport type DefinitionContext = z.infer<typeof DefinitionContext>;\nexport type Uploads = z.infer<typeof Uploads>;\nexport type Definition = z.infer<typeof Definition>;\n/** A definition as a backend writes it, before defaults are applied. */\nexport type DefinitionInput = z.input<typeof Definition>;\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AClC,MAAM,sBAAM,IAAI,IAAY;CAC5B,WAAW,UAAU,SAAS,UAAU,UAAU;EAC9C,IAAI,IAAI,IAAI,SAAS,EAAE,GACnB,QAAQ,SAAS;GACb,MAAM;GACN,SAAS,2BAA2B,SAAS,GAAG;GAChD,MAAM;IAAC;IAAa;IAAO;GAAI;EACnC,CAAC;EAEL,IAAI,IAAI,SAAS,EAAE;CACvB,CAAC;CACD,MAAM,wBAAQ,IAAI,IAAY;CAC9B,WAAW,SAAS,OAAO,SAAS,OAAO,UAAU;EACjD,IAAI,MAAM,IAAI,MAAM,IAAI,GACpB,QAAQ,SAAS;GACb,MAAM;GACN,SAAS,6BAA6B,MAAM,KAAK;GACjD,MAAM;IAAC;IAAW;IAAU;IAAO;GAAM;EAC7C,CAAC;EAEL,MAAM,IAAI,MAAM,IAAI;EACpB,IAAI,MAAM,UAAU,SAAS,MAAM,SAAS,UAAU,MAClD,QAAQ,SAAS;GACb,MAAM;GACN,SAAS,uBAAuB,MAAM,KAAK;GAC3C,MAAM;IAAC;IAAW;IAAU;IAAO;GAAO;EAC9C,CAAC;CAET,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,wEAAwE,CAAC"}
|
|
1
|
+
{"version":3,"file":"definition.js","names":[],"sources":["../../src/schemas/definition.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { RESERVED_ROUTE_SEGMENTS } from '../constants';\nimport { PROTOCOL_VERSION } from '../version';\nimport { Abilities, Id } from './common';\nimport { BlockType } from './field';\nimport { Resource } from './resource';\nimport { DefinitionTheme } from './theme';\nimport { OverviewPeriod, Widget } from './widget';\n\nexport const User = z.looseObject({\n id: Id,\n name: z.string(),\n email: z.string().optional(),\n avatarUrl: z.string().optional(),\n abilities: Abilities.optional(),\n resource: z.string().nullable().optional().meta({\n description:\n 'The resource of users: its item with this `id` is the profile of the user. Without it, clients look for a resource `users`. `null` when the user has no item they can edit in a resource: clients show no link to a profile.',\n }),\n});\n\nexport const AuthProvider = z.looseObject({\n id: z.string().min(1),\n label: z.string(),\n url: z.string().optional().meta({\n description:\n 'Where the login with this provider starts, with a full navigation. The app adds `next`, the path to come back to.',\n }),\n icon: z.string().optional(),\n});\n\nexport const AuthToken = z.looseObject({\n label: z.string().optional().meta({ description: 'Label of the field. Defaults to \"Token\".' }),\n help: z.string().optional().meta({ description: 'Help under the field: where to find it.' }),\n});\n\nexport const Auth = z.looseObject({\n mode: z.enum(['panneau', 'external']).meta({\n description: \"`panneau`: Panneau's own login pages. `external`: the site handles login.\",\n }),\n loginUrl: z\n .string()\n .nullable()\n .optional()\n .meta({ description: '`external`: where unauthenticated users are sent.' }),\n logoutUrl: z.string().nullable().optional().meta({\n description:\n \"`external`: where the browser goes to log out, the site's own logout. Without it, the app offers no logout.\",\n }),\n password: z.boolean().optional().meta({\n description:\n '`panneau`: a login with an email and a password. Defaults to true without `token`.',\n }),\n token: AuthToken.optional().meta({\n description:\n '`panneau`: a login with a single secret, such as an access token, sent as `token` to `POST /auth/login`.',\n }),\n providers: z.array(AuthProvider).optional(),\n account: z.boolean().optional().meta({\n description:\n '`panneau`: the account page of the user, on `/account`: their name and email, their password, their two-factor authentication.',\n }),\n passwordReset: z.boolean().optional().meta({\n description:\n '`panneau`: a \"Forgot your password?\" link on the login page, through `POST /auth/password/forgot` and `POST /auth/password/reset`.',\n }),\n twoFactor: z.boolean().optional().meta({\n description:\n '`panneau`: two-factor authentication, which users set up through `/account/two-factor`, and which a password login asks for with a `202`.',\n }),\n passkeys: z.boolean().optional().meta({\n description:\n '`panneau`: logins with a passkey (WebAuthn), which users add on the account page.',\n }),\n emailVerification: z.boolean().optional().meta({\n description:\n \"`panneau`: the backend refuses users whose email address isn't verified with a `403` problem of type `urn:panneau:problem:email-unverified`, and verifies it through `POST /auth/email/verification` and `POST /auth/email/verify`.\",\n }),\n});\n\nexport const InterfaceLocale = z\n .looseObject({\n locale: z.string().min(2).meta({ description: 'BCP 47 locale of the interface.' }),\n label: z.string().meta({\n description: 'The name of the language in that language, such as \"Français\".',\n }),\n url: z.string().min(1).meta({\n description:\n 'Where the browser goes to switch to this locale, with a full navigation. The app adds `next`, the path and query to come back to (decision 0083).',\n }),\n })\n .meta({ description: 'A language the user can switch the interface to.' });\n\nexport const MenuItem = z\n .looseObject({\n type: z.string().min(1).meta({\n description: 'Built-in: `resources`, `resource`, `page`, `link`, `separator`, `group`.',\n }),\n label: z.string().optional(),\n icon: z.string().optional(),\n resource: z.string().optional(),\n page: z.string().optional(),\n url: z.string().optional(),\n external: z.boolean().optional(),\n collapsible: z.boolean().optional().meta({\n description:\n '`group` with a `label`: the user shows or hides its links, and the browser remembers it (decision 0079).',\n }),\n collapsed: z.boolean().optional().meta({\n description:\n '`group`: collapsible, and closed until the user opens it, unless it holds the current page.',\n }),\n emphasis: z.boolean().optional().meta({\n description: '`resource`, `page` or `link`: its label is bold, for the main entries.',\n }),\n // The return type is written out so that declaration files keep the recursion.\n get children(): z.ZodOptional<z.ZodArray<typeof MenuItem>> {\n return z.array(MenuItem).optional();\n },\n })\n .meta({ description: 'An entry of a menu.' });\n\nexport const Page = z.looseObject({\n component: z\n .string()\n .min(1)\n .meta({ description: 'A page provided by a plugin, or a built-in page.' }),\n path: z.string().optional().meta({ description: 'Path of a custom page.' }),\n label: z.string().optional(),\n props: z.record(z.string(), z.unknown()).optional(),\n params: z\n .array(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/))\n .optional()\n .meta({\n description:\n 'Names of the path segments after the page: `[\"id\"]` makes `{basePath}/pages/{page}/{id}`. The component gets them as `params`, and route references (`{ \"route\": \"<page>\", \"params\": { \"id\": … } }`) can link to the page. A page with `params` is not in menus.',\n }),\n abilities: Abilities.optional().meta({\n description:\n 'What the current user can do with the page (decision 0046). `view: false` leaves it out of menus, and its route shows a forbidden state; `pages.home` falls back to the built-in home. Without it, the page is allowed.',\n }),\n widgets: z.array(Widget).optional().meta({\n description:\n 'A page whose component is the built-in `dashboard`: its widgets for the user, in order (decision 0084), fed by `GET /dashboard/widgets/{widget}?page={page}`. On `pages.home`, they replace `dashboard.widgets`.',\n }),\n period: OverviewPeriod.optional().meta({\n description:\n 'A page whose component is the built-in `dashboard`: one period for its widgets (decision 0084). On `pages.home`, it replaces `dashboard.period`.',\n }),\n});\n\nexport const ContextOption = z\n .looseObject({\n value: z.string().min(1),\n label: z.string(),\n description: z.string().optional(),\n })\n .meta({ description: 'A choice of a param of the context.' });\n\nexport const ContextParam = z\n .looseObject({\n name: z\n .string()\n .regex(\n new RegExp(`^(?!(?:${RESERVED_ROUTE_SEGMENTS.join('|')})$)[A-Za-z_][A-Za-z0-9_]*$`),\n )\n .meta({\n description:\n 'The name of the param, in the `Panneau-Context` header and in the client routes (`{basePath}/{name}/{value}/…`): an identifier, not a reserved first segment of the routes.',\n }),\n label: z.string(),\n required: z.boolean().optional().meta({\n description:\n 'Whether the app needs a value: without one, it shows a page to pick it in place of the page of the route.',\n }),\n fixed: z.boolean().optional().meta({\n description:\n 'The backend sets the value from the request, such as its domain: the app shows it without a picker, and leaves it out of the path and of the `Panneau-Context` header. Another value in the header is a `403` context problem. A fixed param has a `value`.',\n }),\n allLabel: z.string().optional().meta({\n description: 'An optional param: the label of no value, such as \"All clients\".',\n }),\n options: z.array(ContextOption).optional().meta({\n description:\n 'The choices, inline. Without them, the client searches them with `GET /context/{name}/options`.',\n }),\n value: z.string().min(1).nullable().optional().meta({\n description:\n 'The value the definition was built for: the one the client sent, checked, or the one the backend chose for a required param.',\n }),\n valueLabel: z\n .string()\n .nullable()\n .optional()\n .meta({ description: 'The label of `value`, for the picker.' }),\n })\n .meta({ description: 'A param of the current context (decision 0045).' });\n\nexport const DefinitionContext = z\n .looseObject({\n params: z.array(ContextParam).min(1).meta({\n description:\n 'In order: each param depends on the params before it. The params are the same whatever the values.',\n }),\n })\n .meta({\n description:\n 'The current context the user picks in the app, sent with every request in the `Panneau-Context` header (decision 0045).',\n });\n\nexport const Uploads = z.looseObject({\n mode: z.enum(['multipart', 'tus', 'presigned']).meta({\n description:\n '`multipart`: files go through `POST /media` and the requests that take them. `presigned`: the browser also sends files to storage itself, with URLs that `POST /uploads/sign` signs, then `POST /uploads/{upload}/complete` gives an upload that values reference.',\n }),\n endpoint: z.string().optional().meta({\n description:\n '`presigned`: the base URL of the upload routes, when they are not `{api.baseUrl}/uploads`.',\n }),\n maxSize: z.number().int().positive().optional(),\n});\n\nexport const Definition = z\n .looseObject({\n protocol: z.literal(PROTOCOL_VERSION),\n name: z.string(),\n locale: z\n .string()\n .min(2)\n .meta({ description: 'BCP 47 locale of the labels and messages.' }),\n locales: z\n .array(z.string().min(2))\n .min(1)\n .meta({ description: 'Locales of localized content fields.' }),\n interfaceLocales: z.array(InterfaceLocale).optional().meta({\n description:\n 'The languages of the interface, `locale` among them: with two or more, the shell has a switcher (decision 0083). Not the locales of the content, which are `locales`.',\n }),\n api: z.looseObject({ baseUrl: z.string() }),\n resources: z.array(Resource),\n blockTypeSets: z.record(z.string().min(1), z.array(BlockType)).optional().meta({\n description:\n 'Lists of block types shared by `repeater` fields, by key (decision 0094): a repeater names one with `typeSet` rather than repeating its `types`, such as the blocks of every type of page. Their block types can hold repeaters that name other sets, never their own.',\n }),\n pages: z.record(z.string(), Page).optional(),\n menus: z.record(z.string(), z.array(MenuItem)).optional(),\n routes: z.record(z.string(), z.string()).optional().meta({\n description: 'Named paths of the frontend, for `link` actions and redirects.',\n }),\n auth: Auth.optional(),\n dashboard: z\n .looseObject({ widgets: z.array(Widget), period: OverviewPeriod.optional() })\n .optional()\n .meta({\n description:\n 'The widgets of the home page for the user, in order, when `pages.home` is the `dashboard` (decision 0064): the shorthand of `pages.home.widgets`, which wins when set.',\n }),\n search: z.looseObject({ enabled: z.boolean() }).optional(),\n uploads: Uploads.optional(),\n context: DefinitionContext.optional(),\n theme: DefinitionTheme.optional(),\n user: User.nullable().optional(),\n })\n .superRefine((definition, context) => {\n const ids = new Set<string>();\n definition.resources.forEach((resource, index) => {\n if (ids.has(resource.id)) {\n context.addIssue({\n code: 'custom',\n message: `Duplicate resource id \\`${resource.id}\\`.`,\n path: ['resources', index, 'id'],\n });\n }\n ids.add(resource.id);\n });\n const names = new Set<string>();\n definition.context?.params.forEach((param, index) => {\n if (names.has(param.name)) {\n context.addIssue({\n code: 'custom',\n message: `Duplicate context param \\`${param.name}\\`.`,\n path: ['context', 'params', index, 'name'],\n });\n }\n names.add(param.name);\n if (param.fixed === true && (param.value ?? null) === null) {\n context.addIssue({\n code: 'custom',\n message: `The context param \\`${param.name}\\` is fixed without a value.`,\n path: ['context', 'params', index, 'value'],\n });\n }\n });\n })\n .meta({ description: 'Everything a frontend needs to render the admin for the current user.' });\n\nexport type User = z.infer<typeof User>;\nexport type AuthProvider = z.infer<typeof AuthProvider>;\nexport type AuthToken = z.infer<typeof AuthToken>;\nexport type Auth = z.infer<typeof Auth>;\nexport type InterfaceLocale = z.infer<typeof InterfaceLocale>;\nexport type MenuItem = z.infer<typeof MenuItem>;\nexport type Page = z.infer<typeof Page>;\nexport type ContextOption = z.infer<typeof ContextOption>;\nexport type ContextParam = z.infer<typeof ContextParam>;\nexport type DefinitionContext = z.infer<typeof DefinitionContext>;\nexport type Uploads = z.infer<typeof Uploads>;\nexport type Definition = z.infer<typeof Definition>;\n/** A definition as a backend writes it, before defaults are applied. */\nexport type DefinitionInput = z.input<typeof Definition>;\n"],"mappings":";;;;;;;;;AAUA,IAAa,OAAO,EAAE,YAAY;CAC9B,IAAI;CACJ,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,WAAW,UAAU,SAAS;CAC9B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAC5C,aACI,+NACR,CAAC;AACL,CAAC;AAED,IAAa,eAAe,EAAE,YAAY;CACtC,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACpB,OAAO,EAAE,OAA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D,MAAM,wBAAQ,IAAI,IAAY;CAC9B,WAAW,SAAS,OAAO,SAAS,OAAO,UAAU;EACjD,IAAI,MAAM,IAAI,MAAM,IAAI,GACpB,QAAQ,SAAS;GACb,MAAM;GACN,SAAS,6BAA6B,MAAM,KAAK;GACjD,MAAM;IAAC;IAAW;IAAU;IAAO;GAAM;EAC7C,CAAC;EAEL,MAAM,IAAI,MAAM,IAAI;EACpB,IAAI,MAAM,UAAU,SAAS,MAAM,SAAS,UAAU,MAClD,QAAQ,SAAS;GACb,MAAM;GACN,SAAS,uBAAuB,MAAM,KAAK;GAC3C,MAAM;IAAC;IAAW;IAAU;IAAO;GAAO;EAC9C,CAAC;CAET,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,wEAAwE,CAAC"}
|
package/dist/schemas/field.d.ts
CHANGED
|
@@ -332,6 +332,7 @@ export declare const Field: z.ZodObject<{
|
|
|
332
332
|
display: z.ZodOptional<z.ZodString>;
|
|
333
333
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
334
334
|
types: z.ZodOptional<z.ZodArray<typeof BlockType>>;
|
|
335
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
335
336
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
336
337
|
}, z.core.$loose>;
|
|
337
338
|
/** A block style of a `richtext` field: a named class on an element (`<p class="big">`). */
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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
|
@@ -155,6 +155,7 @@ var Field = z.looseObject({
|
|
|
155
155
|
get types() {
|
|
156
156
|
return z.array(BlockType).optional().meta({ description: "`repeater`: typed blocks, each with its own fields." });
|
|
157
157
|
},
|
|
158
|
+
typeSet: z.string().min(1).optional().meta({ description: "`repeater`: the key of its block types in the definition's `blockTypeSets`, in place of `types` (decision 0094). Clients resolve it into `types` when they read the definition." }),
|
|
158
159
|
settings: z.record(z.string(), z.unknown()).optional()
|
|
159
160
|
}).meta({ description: "A field of a form." });
|
|
160
161
|
/** A block style of a `richtext` field: a named class on an element (`<p class="big">`). */
|
|
@@ -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 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,EA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ACrD,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 typeSet: z.string().min(1).optional().meta({\n description:\n \"`repeater`: the key of its block types in the definition's `blockTypeSets`, in place of `types` (decision 0094). Clients resolve it into `types` when they read the definition.\",\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,2BA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B,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
|
@@ -371,6 +371,7 @@ export declare const namedSchemas: {
|
|
|
371
371
|
display: z.ZodOptional<z.ZodString>;
|
|
372
372
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
373
373
|
types: z.ZodOptional<z.ZodArray<typeof BlockType>>;
|
|
374
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
374
375
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
375
376
|
}, z.core.$loose>;
|
|
376
377
|
RichTextStyle: z.ZodObject<{
|
|
@@ -653,6 +654,7 @@ export declare const namedSchemas: {
|
|
|
653
654
|
menu: "menu";
|
|
654
655
|
}>>>;
|
|
655
656
|
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
657
|
+
tone: z.ZodOptional<z.ZodString>;
|
|
656
658
|
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
657
659
|
title: z.ZodOptional<z.ZodString>;
|
|
658
660
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -845,6 +847,7 @@ export declare const namedSchemas: {
|
|
|
845
847
|
display: z.ZodOptional<z.ZodString>;
|
|
846
848
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
847
849
|
types: z.ZodOptional<z.ZodArray<typeof BlockType>>;
|
|
850
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
848
851
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
849
852
|
}, z.core.$loose>>>;
|
|
850
853
|
layout: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1387,6 +1390,7 @@ export declare const namedSchemas: {
|
|
|
1387
1390
|
display: z.ZodOptional<z.ZodString>;
|
|
1388
1391
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
1389
1392
|
types: z.ZodOptional<z.ZodArray<typeof BlockType>>;
|
|
1393
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
1390
1394
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1391
1395
|
}, z.core.$loose>>;
|
|
1392
1396
|
form: z.ZodOptional<z.ZodObject<{
|
|
@@ -1489,6 +1493,7 @@ export declare const namedSchemas: {
|
|
|
1489
1493
|
menu: "menu";
|
|
1490
1494
|
}>>>;
|
|
1491
1495
|
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
1496
|
+
tone: z.ZodOptional<z.ZodString>;
|
|
1492
1497
|
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
1493
1498
|
title: z.ZodOptional<z.ZodString>;
|
|
1494
1499
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -1681,6 +1686,7 @@ export declare const namedSchemas: {
|
|
|
1681
1686
|
display: z.ZodOptional<z.ZodString>;
|
|
1682
1687
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
1683
1688
|
types: z.ZodOptional<z.ZodArray<typeof BlockType>>;
|
|
1689
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
1684
1690
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1685
1691
|
}, z.core.$loose>>>;
|
|
1686
1692
|
layout: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -3502,6 +3508,7 @@ export declare const namedSchemas: {
|
|
|
3502
3508
|
display: z.ZodOptional<z.ZodString>;
|
|
3503
3509
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
3504
3510
|
types: z.ZodOptional<z.ZodArray<typeof BlockType>>;
|
|
3511
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
3505
3512
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3506
3513
|
}, z.core.$loose>>;
|
|
3507
3514
|
form: z.ZodOptional<z.ZodObject<{
|
|
@@ -3604,6 +3611,7 @@ export declare const namedSchemas: {
|
|
|
3604
3611
|
menu: "menu";
|
|
3605
3612
|
}>>>;
|
|
3606
3613
|
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
3614
|
+
tone: z.ZodOptional<z.ZodString>;
|
|
3607
3615
|
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
3608
3616
|
title: z.ZodOptional<z.ZodString>;
|
|
3609
3617
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -3796,6 +3804,7 @@ export declare const namedSchemas: {
|
|
|
3796
3804
|
display: z.ZodOptional<z.ZodString>;
|
|
3797
3805
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
3798
3806
|
types: z.ZodOptional<z.ZodArray<typeof BlockType>>;
|
|
3807
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
3799
3808
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3800
3809
|
}, z.core.$loose>>>;
|
|
3801
3810
|
layout: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -4121,6 +4130,12 @@ export declare const namedSchemas: {
|
|
|
4121
4130
|
}, z.core.$loose>>;
|
|
4122
4131
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
4123
4132
|
}, z.core.$loose>>;
|
|
4133
|
+
blockTypeSets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
4134
|
+
id: z.ZodString;
|
|
4135
|
+
label: z.ZodString;
|
|
4136
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
4137
|
+
fields: z.ZodArray<typeof Field>;
|
|
4138
|
+
}, z.core.$loose>>>>;
|
|
4124
4139
|
pages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
4125
4140
|
component: z.ZodString;
|
|
4126
4141
|
path: 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;AA4CtC,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,cA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AAEtC,0FAA0F;AAC1F,wBAAgB,oBAAoB;QACE,MAAM;4GAK3C"}
|
|
@@ -510,6 +510,7 @@ export declare const Resource: z.ZodObject<{
|
|
|
510
510
|
display: z.ZodOptional<z.ZodString>;
|
|
511
511
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
512
512
|
types: z.ZodOptional<z.ZodArray<typeof import("./field.js").BlockType>>;
|
|
513
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
513
514
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
514
515
|
}, z.core.$loose>>;
|
|
515
516
|
form: z.ZodOptional<z.ZodObject<{
|
|
@@ -612,6 +613,7 @@ export declare const Resource: z.ZodObject<{
|
|
|
612
613
|
menu: "menu";
|
|
613
614
|
}>>>;
|
|
614
615
|
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
616
|
+
tone: z.ZodOptional<z.ZodString>;
|
|
615
617
|
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
616
618
|
title: z.ZodOptional<z.ZodString>;
|
|
617
619
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -804,6 +806,7 @@ export declare const Resource: z.ZodObject<{
|
|
|
804
806
|
display: z.ZodOptional<z.ZodString>;
|
|
805
807
|
fields: z.ZodOptional<z.ZodArray<typeof Field>>;
|
|
806
808
|
types: z.ZodOptional<z.ZodArray<typeof import("./field.js").BlockType>>;
|
|
809
|
+
typeSet: z.ZodOptional<z.ZodString>;
|
|
807
810
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
808
811
|
}, z.core.$loose>>>;
|
|
809
812
|
layout: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/schemas/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4FoB,CAAC;AAEnE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAChD,sEAAsE;AACtE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC"}
|
package/dist/validate.d.ts
CHANGED
|
@@ -17,14 +17,15 @@ export type ValidationResult<T> = {
|
|
|
17
17
|
export declare function validate<T extends z.ZodType>(schema: T, input: unknown): ValidationResult<z.infer<T>>;
|
|
18
18
|
/**
|
|
19
19
|
* Validates a definition, as returned by `GET /definition`: against the schema, then the
|
|
20
|
-
* references between its parts (see `lintDefinition()`), and the settings of field types that
|
|
20
|
+
* shared block types, which it resolves (see `resolveBlockTypeSets()`), the references between its parts (see `lintDefinition()`), and the settings of field types that
|
|
21
21
|
* the protocol describes (`RichTextSettings`, `DurationSettings`, `DateRangeSettings`,
|
|
22
22
|
* `MoneySettings`, `LinkSettings`, `AddressSettings`).
|
|
23
23
|
*/
|
|
24
24
|
export declare function validateDefinition(input: unknown): ValidationResult<Definition>;
|
|
25
25
|
/**
|
|
26
26
|
* Validates a boot config, as a server writes it in the page: against the schema, then the
|
|
27
|
-
*
|
|
27
|
+
* shared block types of its inlined definition, which it resolves, and the references between
|
|
28
|
+
* its parts, if any.
|
|
28
29
|
*/
|
|
29
30
|
export declare function validateBootConfig(input: unknown): ValidationResult<BootConfig>;
|
|
30
31
|
//# sourceMappingURL=validate.d.ts.map
|
package/dist/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAWlD,MAAM,WAAW,eAAe;IAC5B,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAC1B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAE/E,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EACxC,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,OAAO,GACf,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAY9B;AAqCD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAyB/E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAa/E"}
|
package/dist/validate.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveBlockTypeSets } from "./blockTypeSets.js";
|
|
1
2
|
import { lintDefinition } from "./lint.js";
|
|
2
3
|
import { AddressSettings, DateRangeSettings, DurationSettings, LinkSettings, MoneySettings, RichTextSettings } from "./schemas/field.js";
|
|
3
4
|
import { Definition } from "./schemas/definition.js";
|
|
@@ -47,18 +48,22 @@ function checkFieldSettings(fields, path) {
|
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
49
50
|
* Validates a definition, as returned by `GET /definition`: against the schema, then the
|
|
50
|
-
* references between its parts (see `lintDefinition()`), and the settings of field types that
|
|
51
|
+
* shared block types, which it resolves (see `resolveBlockTypeSets()`), the references between its parts (see `lintDefinition()`), and the settings of field types that
|
|
51
52
|
* the protocol describes (`RichTextSettings`, `DurationSettings`, `DateRangeSettings`,
|
|
52
53
|
* `MoneySettings`, `LinkSettings`, `AddressSettings`).
|
|
53
54
|
*/
|
|
54
55
|
function validateDefinition(input) {
|
|
55
56
|
const result = validate(Definition, input);
|
|
56
57
|
if (!result.success) return result;
|
|
57
|
-
const issues = [
|
|
58
|
-
...
|
|
59
|
-
...(
|
|
60
|
-
...
|
|
61
|
-
|
|
58
|
+
const issues = [
|
|
59
|
+
...resolveBlockTypeSets(result.data),
|
|
60
|
+
...lintDefinition(result.data),
|
|
61
|
+
...result.data.resources.flatMap((resource, index) => [
|
|
62
|
+
...checkFieldSettings(resource.fields, `resources.${String(index)}.fields`),
|
|
63
|
+
...(resource.types ?? []).flatMap((type, typeIndex) => checkFieldSettings(type.fields, `resources.${String(index)}.types.${String(typeIndex)}.fields`)),
|
|
64
|
+
...(resource.actions ?? []).flatMap((action, actionIndex) => checkFieldSettings(action.fields ?? [], `resources.${String(index)}.actions.${String(actionIndex)}.fields`))
|
|
65
|
+
])
|
|
66
|
+
];
|
|
62
67
|
return issues.length > 0 ? {
|
|
63
68
|
success: false,
|
|
64
69
|
issues
|
|
@@ -66,15 +71,16 @@ function validateDefinition(input) {
|
|
|
66
71
|
}
|
|
67
72
|
/**
|
|
68
73
|
* Validates a boot config, as a server writes it in the page: against the schema, then the
|
|
69
|
-
*
|
|
74
|
+
* shared block types of its inlined definition, which it resolves, and the references between
|
|
75
|
+
* its parts, if any.
|
|
70
76
|
*/
|
|
71
77
|
function validateBootConfig(input) {
|
|
72
78
|
const result = validate(BootConfig, input);
|
|
73
79
|
if (!result.success || result.data.definition === void 0) return result;
|
|
74
|
-
const issues = lintDefinition(result.data.definition).map((issue) => ({
|
|
80
|
+
const issues = [...resolveBlockTypeSets(result.data.definition, "definition"), ...lintDefinition(result.data.definition).map((issue) => ({
|
|
75
81
|
...issue,
|
|
76
82
|
path: issue.path === "" ? "definition" : `definition.${issue.path}`
|
|
77
|
-
}));
|
|
83
|
+
}))];
|
|
78
84
|
return issues.length > 0 ? {
|
|
79
85
|
success: false,
|
|
80
86
|
issues
|
package/dist/validate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","names":[],"sources":["../src/validate.ts"],"sourcesContent":["import type { z } from 'zod';\n\nimport { lintDefinition } from './lint';\nimport { BootConfig } from './schemas/boot';\nimport { Definition } from './schemas/definition';\nimport {\n AddressSettings,\n DateRangeSettings,\n DurationSettings,\n type Field,\n LinkSettings,\n MoneySettings,\n RichTextSettings,\n} from './schemas/field';\n\nexport interface ValidationIssue {\n /** Dot path of the invalid value (`resources.0.fields.2.type`), empty for the root. */\n path: string;\n message: string;\n}\n\nexport type ValidationResult<T> =\n { success: true; data: T } | { success: false; issues: ValidationIssue[] };\n\n/** Validates a value against one of the protocol's schemas. */\nexport function validate<T extends z.ZodType>(\n schema: T,\n input: unknown,\n): ValidationResult<z.infer<T>> {\n const result = schema.safeParse(input);\n if (result.success) {\n return { success: true, data: result.data };\n }\n return {\n success: false,\n issues: result.error.issues.map((issue) => ({\n path: issue.path.map(String).join('.'),\n message: issue.message,\n })),\n };\n}\n\n/** The schemas of the settings of the types that the protocol describes. */\nconst SETTINGS: Readonly<Record<string, z.ZodType>> = {\n richtext: RichTextSettings,\n duration: DurationSettings,\n daterange: DateRangeSettings,\n money: MoneySettings,\n link: LinkSettings,\n address: AddressSettings,\n};\n\n/**\n * Checks the settings of the fields whose type the protocol describes the settings of (`richtext`,\n * `duration`, `daterange`, `money`, `link`, `address`), nested ones included.\n */\nfunction checkFieldSettings(fields: readonly Field[], path: string): ValidationIssue[] {\n return fields.flatMap((field, index) => {\n const fieldPath = `${path}.${String(index)}`;\n const schema = SETTINGS[field.type];\n const own =\n schema !== undefined && field.settings !== undefined\n ? (schema.safeParse(field.settings).error?.issues ?? []).map((issue) => ({\n path: [`${fieldPath}.settings`, ...issue.path.map(String)].join('.'),\n message: issue.message,\n }))\n : [];\n return [\n ...own,\n ...checkFieldSettings(field.fields ?? [], `${fieldPath}.fields`),\n ...(field.types ?? []).flatMap((type, typeIndex) =>\n checkFieldSettings(type.fields, `${fieldPath}.types.${String(typeIndex)}.fields`),\n ),\n ];\n });\n}\n\n/**\n * Validates a definition, as returned by `GET /definition`: against the schema, then the\n * references between its parts (see `lintDefinition()`), and the settings of field types that\n * the protocol describes (`RichTextSettings`, `DurationSettings`, `DateRangeSettings`,\n * `MoneySettings`, `LinkSettings`, `AddressSettings`).\n */\nexport function validateDefinition(input: unknown): ValidationResult<Definition> {\n const result = validate(Definition, input);\n if (!result.success) {\n return result;\n }\n const issues = [\n ...lintDefinition(result.data),\n ...result.data.resources.flatMap((resource, index) => [\n ...checkFieldSettings(resource.fields, `resources.${String(index)}.fields`),\n ...(resource.types ?? []).flatMap((type, typeIndex) =>\n checkFieldSettings(\n type.fields,\n `resources.${String(index)}.types.${String(typeIndex)}.fields`,\n ),\n ),\n ...(resource.actions ?? []).flatMap((action, actionIndex) =>\n checkFieldSettings(\n action.fields ?? [],\n `resources.${String(index)}.actions.${String(actionIndex)}.fields`,\n ),\n ),\n ]),\n ];\n return issues.length > 0 ? { success: false, issues } : result;\n}\n\n/**\n * Validates a boot config, as a server writes it in the page: against the schema, then the\n *
|
|
1
|
+
{"version":3,"file":"validate.js","names":[],"sources":["../src/validate.ts"],"sourcesContent":["import type { z } from 'zod';\n\nimport { resolveBlockTypeSets } from './blockTypeSets';\nimport { lintDefinition } from './lint';\nimport { BootConfig } from './schemas/boot';\nimport { Definition } from './schemas/definition';\nimport {\n AddressSettings,\n DateRangeSettings,\n DurationSettings,\n type Field,\n LinkSettings,\n MoneySettings,\n RichTextSettings,\n} from './schemas/field';\n\nexport interface ValidationIssue {\n /** Dot path of the invalid value (`resources.0.fields.2.type`), empty for the root. */\n path: string;\n message: string;\n}\n\nexport type ValidationResult<T> =\n { success: true; data: T } | { success: false; issues: ValidationIssue[] };\n\n/** Validates a value against one of the protocol's schemas. */\nexport function validate<T extends z.ZodType>(\n schema: T,\n input: unknown,\n): ValidationResult<z.infer<T>> {\n const result = schema.safeParse(input);\n if (result.success) {\n return { success: true, data: result.data };\n }\n return {\n success: false,\n issues: result.error.issues.map((issue) => ({\n path: issue.path.map(String).join('.'),\n message: issue.message,\n })),\n };\n}\n\n/** The schemas of the settings of the types that the protocol describes. */\nconst SETTINGS: Readonly<Record<string, z.ZodType>> = {\n richtext: RichTextSettings,\n duration: DurationSettings,\n daterange: DateRangeSettings,\n money: MoneySettings,\n link: LinkSettings,\n address: AddressSettings,\n};\n\n/**\n * Checks the settings of the fields whose type the protocol describes the settings of (`richtext`,\n * `duration`, `daterange`, `money`, `link`, `address`), nested ones included.\n */\nfunction checkFieldSettings(fields: readonly Field[], path: string): ValidationIssue[] {\n return fields.flatMap((field, index) => {\n const fieldPath = `${path}.${String(index)}`;\n const schema = SETTINGS[field.type];\n const own =\n schema !== undefined && field.settings !== undefined\n ? (schema.safeParse(field.settings).error?.issues ?? []).map((issue) => ({\n path: [`${fieldPath}.settings`, ...issue.path.map(String)].join('.'),\n message: issue.message,\n }))\n : [];\n return [\n ...own,\n ...checkFieldSettings(field.fields ?? [], `${fieldPath}.fields`),\n ...(field.types ?? []).flatMap((type, typeIndex) =>\n checkFieldSettings(type.fields, `${fieldPath}.types.${String(typeIndex)}.fields`),\n ),\n ];\n });\n}\n\n/**\n * Validates a definition, as returned by `GET /definition`: against the schema, then the\n * shared block types, which it resolves (see `resolveBlockTypeSets()`), the references between its parts (see `lintDefinition()`), and the settings of field types that\n * the protocol describes (`RichTextSettings`, `DurationSettings`, `DateRangeSettings`,\n * `MoneySettings`, `LinkSettings`, `AddressSettings`).\n */\nexport function validateDefinition(input: unknown): ValidationResult<Definition> {\n const result = validate(Definition, input);\n if (!result.success) {\n return result;\n }\n const issues = [\n ...resolveBlockTypeSets(result.data),\n ...lintDefinition(result.data),\n ...result.data.resources.flatMap((resource, index) => [\n ...checkFieldSettings(resource.fields, `resources.${String(index)}.fields`),\n ...(resource.types ?? []).flatMap((type, typeIndex) =>\n checkFieldSettings(\n type.fields,\n `resources.${String(index)}.types.${String(typeIndex)}.fields`,\n ),\n ),\n ...(resource.actions ?? []).flatMap((action, actionIndex) =>\n checkFieldSettings(\n action.fields ?? [],\n `resources.${String(index)}.actions.${String(actionIndex)}.fields`,\n ),\n ),\n ]),\n ];\n return issues.length > 0 ? { success: false, issues } : result;\n}\n\n/**\n * Validates a boot config, as a server writes it in the page: against the schema, then the\n * shared block types of its inlined definition, which it resolves, and the references between\n * its parts, if any.\n */\nexport function validateBootConfig(input: unknown): ValidationResult<BootConfig> {\n const result = validate(BootConfig, input);\n if (!result.success || result.data.definition === undefined) {\n return result;\n }\n const issues = [\n ...resolveBlockTypeSets(result.data.definition, 'definition'),\n ...lintDefinition(result.data.definition).map((issue) => ({\n ...issue,\n path: issue.path === '' ? 'definition' : `definition.${issue.path}`,\n })),\n ];\n return issues.length > 0 ? { success: false, issues } : result;\n}\n"],"mappings":";;;;;;;AA0BA,SAAgB,SACZ,QACA,OAC4B;CAC5B,MAAM,SAAS,OAAO,UAAU,KAAK;CACrC,IAAI,OAAO,SACP,OAAO;EAAE,SAAS;EAAM,MAAM,OAAO;CAAK;CAE9C,OAAO;EACH,SA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A,CAAG,SAAS,MAAM,cACrC,mBACI,KAAK,QACL,aAAa,OAAO,KAAK,EAAE,SAAS,OAAO,SAAS,EAAE,QAC1D,CACJ;GACA,IAAI,SAAS,WAAW,CAAC,EAAA,CAAG,SAAS,QAAQ,gBACzC,mBACI,OAAO,UAAU,CAAC,GAClB,aAAa,OAAO,KAAK,EAAE,WAAW,OAAO,WAAW,EAAE,QAC9D,CACJ;EACJ,CAAC;CACL;CACA,OAAO,OAAO,SAAS,IAAI;EAAE,SAAS;EAAO;CAAO,IAAI;AAC5D;;;;;;AAOA,SAAgB,mBAAmB,OAA8C;CAC7E,MAAM,SAAS,SAAS,YAAY,KAAK;CACzC,IAAI,CAAC,OAAO,WAAW,OAAO,KAAK,eAAe,KAAA,GAC9C,OAAO;CAEX,MAAM,SAAS,CACX,GAAG,qBAAqB,OAAO,KAAK,YAAY,YAAY,GAC5D,GAAG,eAAe,OAAO,KAAK,UAAU,CAAC,CAAC,KAAK,WAAW;EACtD,GAAG;EACH,MAAM,MAAM,SAAS,KAAK,eAAe,cAAc,MAAM;CACjE,EAAE,CACN;CACA,OAAO,OAAO,SAAS,IAAI;EAAE,SAAS;EAAO;CAAO,IAAI;AAC5D"}
|
package/package.json
CHANGED
package/schema/boot.schema.json
CHANGED
|
@@ -86,6 +86,19 @@
|
|
|
86
86
|
"$ref": "#/$defs/Resource"
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
|
+
"blockTypeSets": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"propertyNames": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"minLength": 1
|
|
94
|
+
},
|
|
95
|
+
"additionalProperties": {
|
|
96
|
+
"type": "array",
|
|
97
|
+
"items": {
|
|
98
|
+
"$ref": "#/$defs/BlockType"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
89
102
|
"pages": {
|
|
90
103
|
"type": "object",
|
|
91
104
|
"propertyNames": {
|
|
@@ -446,6 +459,10 @@
|
|
|
446
459
|
"$ref": "#/$defs/BlockType"
|
|
447
460
|
}
|
|
448
461
|
},
|
|
462
|
+
"typeSet": {
|
|
463
|
+
"type": "string",
|
|
464
|
+
"minLength": 1
|
|
465
|
+
},
|
|
449
466
|
"settings": {
|
|
450
467
|
"type": "object",
|
|
451
468
|
"propertyNames": {
|
|
@@ -1339,6 +1356,10 @@
|
|
|
1339
1356
|
"destructive": {
|
|
1340
1357
|
"type": "boolean"
|
|
1341
1358
|
},
|
|
1359
|
+
"tone": {
|
|
1360
|
+
"type": "string",
|
|
1361
|
+
"pattern": "^[a-z0-9-]+$"
|
|
1362
|
+
},
|
|
1342
1363
|
"confirm": {
|
|
1343
1364
|
"$ref": "#/$defs/ActionConfirm"
|
|
1344
1365
|
},
|
|
@@ -49,6 +49,19 @@
|
|
|
49
49
|
"$ref": "#/$defs/Resource"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
+
"blockTypeSets": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"propertyNames": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"minLength": 1
|
|
57
|
+
},
|
|
58
|
+
"additionalProperties": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"items": {
|
|
61
|
+
"$ref": "#/$defs/BlockType"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
52
65
|
"pages": {
|
|
53
66
|
"type": "object",
|
|
54
67
|
"propertyNames": {
|
|
@@ -409,6 +422,10 @@
|
|
|
409
422
|
"$ref": "#/$defs/BlockType"
|
|
410
423
|
}
|
|
411
424
|
},
|
|
425
|
+
"typeSet": {
|
|
426
|
+
"type": "string",
|
|
427
|
+
"minLength": 1
|
|
428
|
+
},
|
|
412
429
|
"settings": {
|
|
413
430
|
"type": "object",
|
|
414
431
|
"propertyNames": {
|
|
@@ -1302,6 +1319,10 @@
|
|
|
1302
1319
|
"destructive": {
|
|
1303
1320
|
"type": "boolean"
|
|
1304
1321
|
},
|
|
1322
|
+
"tone": {
|
|
1323
|
+
"type": "string",
|
|
1324
|
+
"pattern": "^[a-z0-9-]+$"
|
|
1325
|
+
},
|
|
1305
1326
|
"confirm": {
|
|
1306
1327
|
"$ref": "#/$defs/ActionConfirm"
|
|
1307
1328
|
},
|
package/schema/openapi.json
CHANGED
|
@@ -4229,6 +4229,11 @@
|
|
|
4229
4229
|
"$ref": "#/components/schemas/BlockType"
|
|
4230
4230
|
}
|
|
4231
4231
|
},
|
|
4232
|
+
"typeSet": {
|
|
4233
|
+
"description": "`repeater`: the key of its block types in the definition's `blockTypeSets`, in place of `types` (decision 0094). Clients resolve it into `types` when they read the definition.",
|
|
4234
|
+
"type": "string",
|
|
4235
|
+
"minLength": 1
|
|
4236
|
+
},
|
|
4232
4237
|
"settings": {
|
|
4233
4238
|
"type": "object",
|
|
4234
4239
|
"propertyNames": {
|
|
@@ -4924,6 +4929,11 @@
|
|
|
4924
4929
|
"destructive": {
|
|
4925
4930
|
"type": "boolean"
|
|
4926
4931
|
},
|
|
4932
|
+
"tone": {
|
|
4933
|
+
"description": "The color of its icon in rows and of its button in the header of an item (decision 0091): a tone of the theme, such as `info`. An action that destroys is always `danger`.",
|
|
4934
|
+
"type": "string",
|
|
4935
|
+
"pattern": "^[a-z0-9-]+$"
|
|
4936
|
+
},
|
|
4927
4937
|
"confirm": {
|
|
4928
4938
|
"$ref": "#/components/schemas/ActionConfirm"
|
|
4929
4939
|
},
|
|
@@ -6848,6 +6858,20 @@
|
|
|
6848
6858
|
"$ref": "#/components/schemas/Resource"
|
|
6849
6859
|
}
|
|
6850
6860
|
},
|
|
6861
|
+
"blockTypeSets": {
|
|
6862
|
+
"description": "Lists of block types shared by `repeater` fields, by key (decision 0094): a repeater names one with `typeSet` rather than repeating its `types`, such as the blocks of every type of page. Their block types can hold repeaters that name other sets, never their own.",
|
|
6863
|
+
"type": "object",
|
|
6864
|
+
"propertyNames": {
|
|
6865
|
+
"type": "string",
|
|
6866
|
+
"minLength": 1
|
|
6867
|
+
},
|
|
6868
|
+
"additionalProperties": {
|
|
6869
|
+
"type": "array",
|
|
6870
|
+
"items": {
|
|
6871
|
+
"$ref": "#/components/schemas/BlockType"
|
|
6872
|
+
}
|
|
6873
|
+
}
|
|
6874
|
+
},
|
|
6851
6875
|
"pages": {
|
|
6852
6876
|
"type": "object",
|
|
6853
6877
|
"propertyNames": {
|