@azx-pbc/axiom-builder 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +648 -2
- package/dist/cards/selectors.d.ts +70 -0
- package/dist/cards/selectors.d.ts.map +1 -0
- package/dist/cards/selectors.js +194 -0
- package/dist/cards/selectors.js.map +1 -0
- package/dist/definition.d.ts +36 -0
- package/dist/definition.d.ts.map +1 -0
- package/dist/definition.js +48 -0
- package/dist/definition.js.map +1 -0
- package/dist/evidence/cases.d.ts +44 -0
- package/dist/evidence/cases.d.ts.map +1 -0
- package/dist/evidence/cases.js +578 -0
- package/dist/evidence/cases.js.map +1 -0
- package/dist/evidence/repairs.d.ts +99 -0
- package/dist/evidence/repairs.d.ts.map +1 -0
- package/dist/evidence/repairs.js +181 -0
- package/dist/evidence/repairs.js.map +1 -0
- package/dist/evidence/summary.d.ts +35 -0
- package/dist/evidence/summary.d.ts.map +1 -0
- package/dist/evidence/summary.js +38 -0
- package/dist/evidence/summary.js.map +1 -0
- package/dist/i18n/gaps.d.ts +3 -0
- package/dist/i18n/gaps.d.ts.map +1 -0
- package/dist/i18n/gaps.js +2 -0
- package/dist/i18n/gaps.js.map +1 -0
- package/dist/i18n/message-slots.d.ts +19 -0
- package/dist/i18n/message-slots.d.ts.map +1 -0
- package/dist/i18n/message-slots.js +101 -0
- package/dist/i18n/message-slots.js.map +1 -0
- package/dist/i18n/text-locale.d.ts +13 -0
- package/dist/i18n/text-locale.d.ts.map +1 -0
- package/dist/i18n/text-locale.js +14 -0
- package/dist/i18n/text-locale.js.map +1 -0
- package/dist/i18n/translations.d.ts +56 -0
- package/dist/i18n/translations.d.ts.map +1 -0
- package/dist/i18n/translations.js +103 -0
- package/dist/i18n/translations.js.map +1 -0
- package/dist/impact/references.d.ts +143 -0
- package/dist/impact/references.d.ts.map +1 -0
- package/dist/impact/references.js +429 -0
- package/dist/impact/references.js.map +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/preview/compile-preview.d.ts +67 -0
- package/dist/preview/compile-preview.d.ts.map +1 -0
- package/dist/preview/compile-preview.js +286 -0
- package/dist/preview/compile-preview.js.map +1 -0
- package/dist/preview/handle.d.ts +119 -0
- package/dist/preview/handle.d.ts.map +1 -0
- package/dist/preview/handle.js +2 -0
- package/dist/preview/handle.js.map +1 -0
- package/dist/preview/held.d.ts +39 -0
- package/dist/preview/held.d.ts.map +1 -0
- package/dist/preview/held.js +15 -0
- package/dist/preview/held.js.map +1 -0
- package/dist/preview/measurement.d.ts +5 -0
- package/dist/preview/measurement.d.ts.map +1 -0
- package/dist/preview/measurement.js +18 -0
- package/dist/preview/measurement.js.map +1 -0
- package/dist/publish/build.d.ts +33 -0
- package/dist/publish/build.d.ts.map +1 -0
- package/dist/publish/build.js +15 -0
- package/dist/publish/build.js.map +1 -0
- package/dist/publish/diff.d.ts +208 -0
- package/dist/publish/diff.d.ts.map +1 -0
- package/dist/publish/diff.js +227 -0
- package/dist/publish/diff.js.map +1 -0
- package/dist/publish/review.d.ts +41 -0
- package/dist/publish/review.d.ts.map +1 -0
- package/dist/publish/review.js +22 -0
- package/dist/publish/review.js.map +1 -0
- package/dist/schema/dataset-input.d.ts +30 -0
- package/dist/schema/dataset-input.d.ts.map +1 -0
- package/dist/schema/dataset-input.js +58 -0
- package/dist/schema/dataset-input.js.map +1 -0
- package/dist/schema/dataset.d.ts +166 -0
- package/dist/schema/dataset.d.ts.map +1 -0
- package/dist/schema/dataset.js +281 -0
- package/dist/schema/dataset.js.map +1 -0
- package/dist/schema/declarations.d.ts +15 -0
- package/dist/schema/declarations.d.ts.map +1 -0
- package/dist/schema/declarations.js +47 -0
- package/dist/schema/declarations.js.map +1 -0
- package/dist/schema/document.d.ts +504 -0
- package/dist/schema/document.d.ts.map +1 -0
- package/dist/schema/document.js +337 -0
- package/dist/schema/document.js.map +1 -0
- package/dist/schema/error.d.ts +15 -0
- package/dist/schema/error.d.ts.map +1 -0
- package/dist/schema/error.js +18 -0
- package/dist/schema/error.js.map +1 -0
- package/dist/schema/field-id.d.ts +8 -0
- package/dist/schema/field-id.d.ts.map +1 -0
- package/dist/schema/field-id.js +47 -0
- package/dist/schema/field-id.js.map +1 -0
- package/dist/schema/layout.d.ts +118 -0
- package/dist/schema/layout.d.ts.map +1 -0
- package/dist/schema/layout.js +101 -0
- package/dist/schema/layout.js.map +1 -0
- package/dist/schema/palette.d.ts +103 -0
- package/dist/schema/palette.d.ts.map +1 -0
- package/dist/schema/palette.js +140 -0
- package/dist/schema/palette.js.map +1 -0
- package/dist/schema/read.d.ts +49 -0
- package/dist/schema/read.d.ts.map +1 -0
- package/dist/schema/read.js +942 -0
- package/dist/schema/read.js.map +1 -0
- package/dist/store/apply-dataset.d.ts +14 -0
- package/dist/store/apply-dataset.d.ts.map +1 -0
- package/dist/store/apply-dataset.js +513 -0
- package/dist/store/apply-dataset.js.map +1 -0
- package/dist/store/apply.d.ts +37 -0
- package/dist/store/apply.d.ts.map +1 -0
- package/dist/store/apply.js +2269 -0
- package/dist/store/apply.js.map +1 -0
- package/dist/store/candidate.d.ts +37 -0
- package/dist/store/candidate.d.ts.map +1 -0
- package/dist/store/candidate.js +178 -0
- package/dist/store/candidate.js.map +1 -0
- package/dist/store/commands/coverage.d.ts +58 -0
- package/dist/store/commands/coverage.d.ts.map +1 -0
- package/dist/store/commands/coverage.js +354 -0
- package/dist/store/commands/coverage.js.map +1 -0
- package/dist/store/commands/dataset.d.ts +26 -0
- package/dist/store/commands/dataset.d.ts.map +1 -0
- package/dist/store/commands/dataset.js +368 -0
- package/dist/store/commands/dataset.js.map +1 -0
- package/dist/store/commands/document.d.ts +21 -0
- package/dist/store/commands/document.d.ts.map +1 -0
- package/dist/store/commands/document.js +160 -0
- package/dist/store/commands/document.js.map +1 -0
- package/dist/store/commands/field.d.ts +32 -0
- package/dist/store/commands/field.d.ts.map +1 -0
- package/dist/store/commands/field.js +572 -0
- package/dist/store/commands/field.js.map +1 -0
- package/dist/store/commands/layout.d.ts +16 -0
- package/dist/store/commands/layout.d.ts.map +1 -0
- package/dist/store/commands/layout.js +70 -0
- package/dist/store/commands/layout.js.map +1 -0
- package/dist/store/commands/parse.d.ts +19 -0
- package/dist/store/commands/parse.d.ts.map +1 -0
- package/dist/store/commands/parse.js +328 -0
- package/dist/store/commands/parse.js.map +1 -0
- package/dist/store/commands/readers.d.ts +198 -0
- package/dist/store/commands/readers.d.ts.map +1 -0
- package/dist/store/commands/readers.js +711 -0
- package/dist/store/commands/readers.js.map +1 -0
- package/dist/store/commands/rule.d.ts +24 -0
- package/dist/store/commands/rule.d.ts.map +1 -0
- package/dist/store/commands/rule.js +379 -0
- package/dist/store/commands/rule.js.map +1 -0
- package/dist/store/commands/shapes.d.ts +900 -0
- package/dist/store/commands/shapes.d.ts.map +1 -0
- package/dist/store/commands/shapes.js +166 -0
- package/dist/store/commands/shapes.js.map +1 -0
- package/dist/store/commands/suggestions.d.ts +37 -0
- package/dist/store/commands/suggestions.d.ts.map +1 -0
- package/dist/store/commands/suggestions.js +177 -0
- package/dist/store/commands/suggestions.js.map +1 -0
- package/dist/store/commands.d.ts +16 -0
- package/dist/store/commands.d.ts.map +1 -0
- package/dist/store/commands.js +13 -0
- package/dist/store/commands.js.map +1 -0
- package/dist/store/dataset-candidate.d.ts +33 -0
- package/dist/store/dataset-candidate.d.ts.map +1 -0
- package/dist/store/dataset-candidate.js +31 -0
- package/dist/store/dataset-candidate.js.map +1 -0
- package/dist/store/dataset-pin.d.ts +93 -0
- package/dist/store/dataset-pin.d.ts.map +1 -0
- package/dist/store/dataset-pin.js +86 -0
- package/dist/store/dataset-pin.js.map +1 -0
- package/dist/store/dataset-store.d.ts +96 -0
- package/dist/store/dataset-store.d.ts.map +1 -0
- package/dist/store/dataset-store.js +112 -0
- package/dist/store/dataset-store.js.map +1 -0
- package/dist/store/history.d.ts +149 -0
- package/dist/store/history.d.ts.map +1 -0
- package/dist/store/history.js +173 -0
- package/dist/store/history.js.map +1 -0
- package/dist/store/measurement.d.ts +5 -0
- package/dist/store/measurement.d.ts.map +1 -0
- package/dist/store/measurement.js +20 -0
- package/dist/store/measurement.js.map +1 -0
- package/dist/store/notify.d.ts +11 -0
- package/dist/store/notify.d.ts.map +1 -0
- package/dist/store/notify.js +26 -0
- package/dist/store/notify.js.map +1 -0
- package/dist/store/published.d.ts +50 -0
- package/dist/store/published.d.ts.map +1 -0
- package/dist/store/published.js +27 -0
- package/dist/store/published.js.map +1 -0
- package/dist/store/refusals.d.ts +175 -0
- package/dist/store/refusals.d.ts.map +1 -0
- package/dist/store/refusals.js +160 -0
- package/dist/store/refusals.js.map +1 -0
- package/dist/store/steps.d.ts +14 -0
- package/dist/store/steps.d.ts.map +1 -0
- package/dist/store/steps.js +124 -0
- package/dist/store/steps.js.map +1 -0
- package/dist/store/store.d.ts +142 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +136 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/unchanged.d.ts +12 -0
- package/dist/store/unchanged.d.ts.map +1 -0
- package/dist/store/unchanged.js +35 -0
- package/dist/store/unchanged.js.map +1 -0
- package/dist/visual/emit.d.ts +21 -0
- package/dist/visual/emit.d.ts.map +1 -0
- package/dist/visual/emit.js +133 -0
- package/dist/visual/emit.js.map +1 -0
- package/dist/visual/parse.d.ts +32 -0
- package/dist/visual/parse.d.ts.map +1 -0
- package/dist/visual/parse.js +330 -0
- package/dist/visual/parse.js.map +1 -0
- package/dist/visual/project.d.ts +40 -0
- package/dist/visual/project.d.ts.map +1 -0
- package/dist/visual/project.js +349 -0
- package/dist/visual/project.js.map +1 -0
- package/dist/visual/represent.d.ts +50 -0
- package/dist/visual/represent.d.ts.map +1 -0
- package/dist/visual/represent.js +66 -0
- package/dist/visual/represent.js.map +1 -0
- package/dist/visual/vocabulary.d.ts +121 -0
- package/dist/visual/vocabulary.d.ts.map +1 -0
- package/dist/visual/vocabulary.js +32 -0
- package/dist/visual/vocabulary.js.map +1 -0
- package/package.json +52 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readers.js","sourceRoot":"","sources":["../../../src/store/commands/readers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,IAAI,uBAAuB,EAC1C,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,WAAW,EACX,cAAc,EACd,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAgBhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE7E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAiBlD,MAAM,UAAU,KAAK;IACnB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,OAAmB,EAAE,IAAY,EAAE,MAAc;IACpE,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,CAAC,OAAO,GAAG,gBAAgB,CAAC,mBAAmB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC1C,OAAO,KAAK,OAA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AAiB,GAAwB,IAAI,GAAG,CAAC;IACrD,QAAQ;IACR,SAAS;IACT,SAAS;IACT,UAAU;CACX,CAAC,CAAC;AAEH,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAAC,SAA6B,EAAE,KAAyB;IACpF,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC1C,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAClD,OAAO,CACL,SAAS,KAAK,OAAO;QACrB,KAAK,KAAK,SAAS;QACnB,eAAe,CAAC,KAAK,CAAC;QACtB,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,CAC9B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAA2C,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACjG,MAAM,CAAC,MAAM,WAAW,GAAqC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,gBAAgB,GAAwC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAC7F,MAAM,CAAC,MAAM,aAAa,GAA4C,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjG,0FAA0F;AAC1F,MAAM,CAAC,MAAM,eAAe,GAA6B,uBAAuB,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAW,EAAE,CAAC","sourcesContent":["import { canonicalLocale, isLocaleTag } from '@azx-pbc/axiom-compiler';\nimport {\n AxiomError,\n CURRENCY_CODE_PATTERN,\n IDENTIFIER_PATTERN,\n ITEM_PRIMITIVES as RUNTIME_ITEM_PRIMITIVES,\n UNIT_CODE_PATTERN,\n isItemPrimitive,\n isRecord,\n isWireValue,\n parsePlainDate,\n toAccessOverlay,\n} from '@azx-pbc/axiom-runtime';\nimport type {\n AccessOverlay,\n Control,\n DurationUnit,\n FieldRef,\n ItemPrimitive,\n Primitive,\n WireValue,\n} from '@azx-pbc/axiom-runtime';\nimport type {\n AuthoringAnnotations,\n AuthoringItem,\n AuthoringRowKey,\n AuthoringTestCase,\n} from '../../schema/document.js';\nimport { isCanonicalLocale } from '../../schema/document.js';\nimport { OPTION_ARRAY_ITEMS, fieldsControls } from '../../schema/palette.js';\nimport type { RuleExpression } from '../../visual/vocabulary.js';\nimport { parseVisual } from '../../visual/parse.js';\nimport { authoringRefusal } from '../refusals.js';\nimport type { AuthoringRefusal } from '../refusals.js';\nimport type { AuthoringRuleKind, LayoutPath } from './shapes.js';\n\n/**\n * The shared narrowing every command family reads through.\n *\n * A command parse accumulates rather than threading a `Result` through every member read: a\n * command has a handful of members, exactly one reason is reported (the first, in the order the\n * contract lists them), and every reader below is a two-line branch instead of a combinator.\n */\n\n/** One command's parse in progress: the first refusal met, if any. */\nexport interface ParseDraft {\n refusal: AuthoringRefusal | undefined;\n}\n\nexport function draft(): ParseDraft {\n return { refusal: undefined };\n}\n\nexport function fail(draftIn: ParseDraft, path: string, detail: string): undefined {\n if (draftIn.refusal === undefined) {\n draftIn.refusal = authoringRefusal('MALFORMED_COMMAND', path, detail);\n }\n return undefined;\n}\n\nexport function describe(value: unknown): string {\n if (value === undefined) return 'nothing';\n if (value === null) return 'null';\n if (Array.isArray(value)) return 'a list';\n return `a ${typeof value}`;\n}\n\nfunction recordAt(value: unknown): Record<string, unknown> | undefined {\n return isRecord(value) ? value : undefined;\n}\n\nexport function readRecord(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n what: string,\n): Record<string, unknown> | undefined {\n const record = recordAt(value);\n if (record === undefined) {\n return fail(draftIn, path, `${what} is an object; received ${describe(value)}`);\n }\n return record;\n}\n\n/** Refuses the first member the contract does not list, so an unknown member cannot ride along. */\nexport function onlyMembers(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n allowed: readonly string[],\n path: string,\n): void {\n for (const member of Object.keys(record)) {\n if (allowed.includes(member)) continue;\n fail(\n draftIn,\n path,\n `\\`${member}\\` is not a member this command states; the members are ${allowed.join(', ')}`,\n );\n return;\n }\n}\n\nexport function readText(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): string | undefined {\n const value = record[key];\n if (typeof value !== 'string') {\n return fail(draftIn, `${path}.${key}`, `\\`${key}\\` must be text; received ${describe(value)}`);\n }\n return value;\n}\n\n/**\n * The closed metaschema's `messageKey` pattern: a dotted lower-case identifier.\n *\n * A catalogue key is an identity a declaration names, so a key the metaschema refuses is not one\n * a command may store: the candidate gate would refuse the whole document after the store had\n * already committed the edit. The parse refuses it at the member instead, with the spelling the\n * contract admits.\n */\nconst MESSAGE_KEY_PATTERN = /^[a-z][a-z0-9_]*(?:\\.[a-z][a-z0-9_]*)*$/u;\n\n/** One message key, as the metaschema states it. */\nexport function readMessageKeyValue(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): string | undefined {\n if (typeof value !== 'string') {\n return fail(draftIn, path, `a message key is text; received ${describe(value)}`);\n }\n if (MESSAGE_KEY_PATTERN.test(value)) return value;\n return fail(\n draftIn,\n path,\n `a message key is a dotted lower-case identifier, as \\`field.f_note.required\\`; received ${describe(value)}`,\n );\n}\n\n/** One keyed message key member. */\nexport function readMessageKey(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): string | undefined {\n if (!Object.hasOwn(record, key)) return undefined;\n const value = record[key];\n if (typeof value !== 'string') {\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is a message key; received ${describe(value)}`,\n );\n }\n if (MESSAGE_KEY_PATTERN.test(value)) return value;\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is a dotted lower-case identifier, as \\`field.f_note.required\\`; received ${describe(value)}`,\n );\n}\n\nexport function readOptionalText(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): string | undefined {\n if (!Object.hasOwn(record, key)) return undefined;\n return readText(draftIn, record, key, path);\n}\n\n/**\n * A rule's author-facing `note`: plain text of 1 to 500 characters after trimming.\n *\n * A note documents why a rule exists, so an empty or whitespace-only one is refused at the\n * member rather than stored as an empty explanation. The bound is counted in code points, the\n * way the model counts string length, and the reader states the repair with the value's length.\n */\nexport function readRuleNote(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): string | undefined {\n if (typeof value !== 'string') {\n return fail(\n draftIn,\n path,\n `\\`note\\` must be text; it is author-facing documentation a respondent never sees; received ${describe(value)}`,\n );\n }\n const trimmed = value.trim();\n if (trimmed === '') {\n return fail(\n draftIn,\n path,\n '`note` is blank after trimming, so it documents nothing; write the reason the rule exists in 1 to 500 characters, or omit `note`',\n );\n }\n const length = Array.from(trimmed).length;\n if (length > 500) {\n return fail(\n draftIn,\n path,\n `\\`note\\` is ${String(length)} characters after trimming; a note is 1 to 500 characters, so shorten it to the reason the rule exists`,\n );\n }\n return value;\n}\n\nexport function readIdentifier(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): string | undefined {\n const value = readText(draftIn, record, key, path);\n if (value === undefined) return undefined;\n if (IDENTIFIER_PATTERN.test(value)) return value;\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is \\`${value}\\`; write a lower-case identifier: a letter first, then up to 63 lower-case letters, digits or underscores`,\n );\n}\n\nexport function readOptionalIdentifier(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): string | undefined {\n if (!Object.hasOwn(record, key)) return undefined;\n return readIdentifier(draftIn, record, key, path);\n}\n\nexport function readOptionalLiteral(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): string | undefined {\n if (!Object.hasOwn(record, key)) return undefined;\n return readLiteral(draftIn, record, key, path);\n}\n\n/**\n * The locale a text is written in, narrowed to a canonical tag.\n *\n * A catalogue key is compared as an exact string against `locales`, so `PT-br` and `pt-BR` are two\n * different keys and one of them can never be selected. The refusal names the canonical form when\n * the value is a tag at all, and the tag's shape when it is not — the same two repairs\n * `createEmptySchema` states.\n */\nexport function readLocale(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): string | undefined {\n return narrowLocale(draftIn, record[key], `${path}.${key}`);\n}\n\n/** One locale tag, narrowed to the canonical spelling the catalogue is keyed by. */\nexport function narrowLocale(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): string | undefined {\n if (typeof value !== 'string') {\n return fail(draftIn, path, `a locale tag is text; received ${describe(value)}`);\n }\n if (isCanonicalLocale(value)) return value;\n const canonical = isLocaleTag(value) ? canonicalLocale(value) : undefined;\n return fail(\n draftIn,\n path,\n canonical === undefined\n ? `\\`${value}\\` is not a locale tag; write a locale tag such as \\`en\\`, \\`pt-BR\\` or \\`es-419\\``\n : `\\`${value}\\` is not the canonical form; write \\`${canonical}\\``,\n );\n}\n\nexport function readLiteral(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): string | undefined {\n const value = readText(draftIn, record, key, path);\n if (value === undefined) return undefined;\n if (value.trim() !== '') return value;\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is the text a reader sees, so it is not empty`,\n );\n}\n\n/**\n * One expression slot written as source text, as a declaration member or a suggestion states it.\n *\n * The text is stored as it was written: a half-typed expression remains draft source for the\n * compiler to judge, so this refuses only what no expression could ever mean — an empty slot.\n */\nexport function readExpressionSource(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n member: string,\n): string | undefined {\n if (typeof value !== 'string') {\n return fail(\n draftIn,\n path,\n `\\`${member}\\` is an Expr v1 expression written as source text; received ${describe(value)}`,\n );\n }\n if (value.trim() === '') {\n return fail(draftIn, path, `\\`${member}\\` is an Expr v1 expression, so it is not empty`);\n }\n return value;\n}\n\nexport function isCanonicalInteger(value: unknown): value is number {\n return typeof value === 'number' && isWireValue(value);\n}\n\nexport function readInteger(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): number | undefined {\n const value = record[key];\n if (isCanonicalInteger(value)) return value;\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is a whole number; received ${describe(value)}`,\n );\n}\n\nexport function readOptionalInteger(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): number | undefined {\n if (!Object.hasOwn(record, key)) return undefined;\n return readInteger(draftIn, record, key, path);\n}\n\n/**\n * A value bound: a canonical JSON number, or the text a `date`/`instant` bound states.\n *\n * The member's domain is the field's, which the compiler decides; the command's job is only to\n * keep a number and a date string from being confused, so it accepts the two shapes the\n * metaschema's `oneOf` admits and lets `SCHEMA_INVALID` name a bound the field cannot hold.\n */\nexport function readBound(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): number | string | undefined {\n const value = record[key];\n if (isCanonicalInteger(value)) return value;\n if (typeof value === 'string' && value.trim() !== '') return value;\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is a whole number or a canonical date/instant text; received ${describe(value)}`,\n );\n}\n\nexport function readBoolean(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): boolean | undefined {\n const value = record[key];\n if (typeof value === 'boolean') return value;\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is \\`true\\` or \\`false\\`; received ${describe(value)}`,\n );\n}\n\n/**\n * The one unit a `duration` declaration may name, `MODEL-2.1.24`.\n *\n * The unit is optional on the declaration — an absent one means `minutes` — but a stated one is\n * one of the three the metaschema enumerates, because v1 defines no conversion and the unit is\n * part of the value rather than a display choice.\n */\nexport function readOptionalDurationUnit(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): DurationUnit | undefined {\n if (!Object.hasOwn(record, key)) return undefined;\n const value = readText(draftIn, record, key, path);\n if (value === undefined) return undefined;\n if (value === 'minutes' || value === 'hours' || value === 'seconds') return value;\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is \\`${value}\\`; a duration unit is \\`minutes\\`, \\`hours\\` or \\`seconds\\``,\n );\n}\n\n/**\n * A `quantity` declaration's unit domain, `MODEL-2.1.21`.\n *\n * A unit code is identifier-like and a domain is a set: the list names at least one unit, each\n * entry is a lower-case unit code, and no code appears twice. An absent member is `undefined`\n * here; whether the declaration requires one is the metaschema's `then.required`, which the\n * candidate gate reports for a quantity field that states none.\n */\nexport function readUnitList(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n what: string,\n): readonly string[] | undefined {\n if (!Array.isArray(value) || value.length === 0) {\n return fail(draftIn, path, `${what} states at least one unit code`);\n }\n const narrowed: string[] = [];\n for (const [index, entry] of value.entries()) {\n if (typeof entry !== 'string' || !UNIT_CODE_PATTERN.test(entry)) {\n return fail(\n draftIn,\n `${path}[${String(index)}]`,\n `${what} holds lower-case unit codes such as \\`sqm\\`, \\`each\\` or \\`m3\\`; received ${describe(entry)}`,\n );\n }\n if (narrowed.includes(entry)) {\n return fail(draftIn, `${path}[${String(index)}]`, `${what} names \\`${entry}\\` twice`);\n }\n narrowed.push(entry);\n }\n return narrowed;\n}\n\n/** A non-empty list of non-empty text, for the media types an `accept` list states. */\nexport function readTextList(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n what: string,\n): readonly string[] | undefined {\n if (!Array.isArray(value) || value.length === 0) {\n return fail(draftIn, path, `${what} states at least one entry`);\n }\n const narrowed: string[] = [];\n for (const [index, entry] of value.entries()) {\n if (typeof entry !== 'string' || entry === '') {\n return fail(\n draftIn,\n `${path}[${String(index)}]`,\n `${what} holds non-empty text; received ${describe(entry)}`,\n );\n }\n narrowed.push(entry);\n }\n return narrowed;\n}\n\n/** A positive whole-number member, as a byte bound states it, `MODEL-2.1.20`. */\nexport function readPositiveInteger(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): number | undefined {\n const value = readInteger(draftIn, record, key, path);\n if (value === undefined) return undefined;\n if (value > 0) return value;\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` counts at least one; received ${String(value)}`,\n );\n}\n\n/**\n * The `control` a field of this shape may state, narrowed to the matrix's own vocabulary.\n *\n * The pairing is `CONTROLS_BY_PRIMITIVE`'s answer, not a second table: a control the matrix does\n * not pair with this primitive is refused here, because a hint a renderer ignores is worse than\n * no hint at all.\n */\nexport function readControl(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n primitive: Primitive,\n items: ItemPrimitive | undefined,\n path: string,\n): Control | undefined {\n const value = readOptionalText(draftIn, record, 'control', path);\n if (value === undefined) return undefined;\n const admitted = fieldsControls(primitive, items);\n const matched = admitted.find((control) => control === value);\n if (matched !== undefined) return matched;\n return fail(\n draftIn,\n `${path}.control`,\n admitted.length === 0\n ? `a \\`${primitive}\\` field admits no control`\n : `\\`${value}\\` is not a \\`${primitive}\\` control; the matrix pairs ${admitted.join(', ')}`,\n );\n}\n\nexport function readChoice<T extends string>(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n choices: readonly T[],\n): T | undefined {\n const value = readText(draftIn, record, key, path);\n if (value === undefined) return undefined;\n const matched = choices.find((choice) => choice === value);\n if (matched !== undefined) return matched;\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is \\`${value}\\`; the vocabulary is ${choices.join(', ')}`,\n );\n}\n\nexport function readOptionalChoice<T extends string>(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n choices: readonly T[],\n): T | undefined {\n if (!Object.hasOwn(record, key)) return undefined;\n return readChoice(draftIn, record, key, path, choices);\n}\n\n/**\n * A member an edit leaves alone (`undefined`), clears (`null`) or sets.\n *\n * The reader is passed rather than the key's vocabulary because each member has its own reader:\n * a control is the matrix's choice, a message key is text, and the annotations are a block. The\n * three-state member is what makes one command express a change, a clearing and no opinion.\n */\nexport function readEditable<T>(\n record: Readonly<Record<string, unknown>>,\n key: string,\n read: () => T | undefined,\n): T | null | undefined {\n if (!Object.hasOwn(record, key)) return undefined;\n if (record[key] === null) return null;\n return read();\n}\n\nexport function readPath(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): LayoutPath | undefined {\n if (!Object.hasOwn(record, key)) return undefined;\n const value = record[key];\n if (!Array.isArray(value)) {\n return fail(draftIn, `${path}.${key}`, `\\`${key}\\` is a list of child indexes`);\n }\n const steps: number[] = [];\n for (const step of value) {\n if (typeof step !== 'number' || !Number.isSafeInteger(step) || step < 0) {\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` holds non-negative whole child indexes; received ${describe(step)}`,\n );\n }\n steps.push(step);\n }\n return steps;\n}\n\n/** A path that names one node inside `layout`; the root is the list, not a node. */\nexport function readNodePath(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): LayoutPath | undefined {\n const read = readPath(draftIn, record, key, path);\n if (read === undefined) {\n if (draftIn.refusal === undefined) {\n fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is a list of child indexes naming one layout node`,\n );\n }\n return undefined;\n }\n if (read.length === 0) {\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` names a node inside \\`layout\\`; pass at least one index, as \\`[0]\\` for the first node`,\n );\n }\n return read;\n}\n\nexport function readAnnotations(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n path: string,\n): AuthoringAnnotations | undefined {\n if (!Object.hasOwn(record, 'annotations')) return undefined;\n const value = record['annotations'];\n const annotations = readRecord(draftIn, value, `${path}.annotations`, '`annotations`');\n if (annotations === undefined) return undefined;\n const narrowed: [string, boolean | string][] = [];\n for (const [name, member] of Object.entries(annotations)) {\n if (typeof member !== 'boolean' && typeof member !== 'string') {\n return fail(\n draftIn,\n `${path}.annotations.${name}`,\n `annotation \\`${name}\\` is a boolean or a code; received ${describe(member)}`,\n );\n }\n narrowed.push([name, member]);\n }\n // Define own properties rather than assigning them: `__proto__` must reach the closed validator.\n return Object.fromEntries(narrowed);\n}\n\nexport function readRowKey(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n path: string,\n): AuthoringRowKey | undefined {\n if (!Object.hasOwn(record, 'rowKey')) return undefined;\n const value = record['rowKey'];\n const rowKey = readRecord(draftIn, value, `${path}.rowKey`, '`rowKey`');\n if (rowKey === undefined) return undefined;\n onlyMembers(draftIn, rowKey, ['mode', 'fieldId'], `${path}.rowKey`);\n const mode = readChoice(draftIn, rowKey, 'mode', `${path}.rowKey`, [\n 'natural',\n 'assigned',\n ] as const);\n const fieldId = readOptionalText(draftIn, rowKey, 'fieldId', `${path}.rowKey`);\n if (mode === 'natural' && fieldId === undefined) {\n fail(\n draftIn,\n `${path}.rowKey`,\n 'a `natural` row key names the member that identifies a row in `fieldId`',\n );\n return undefined;\n }\n if (mode === 'assigned' && fieldId !== undefined) {\n fail(\n draftIn,\n `${path}.rowKey`,\n 'an `assigned` row key is minted by the host, so it declares no `fieldId`',\n );\n return undefined;\n }\n if (mode === undefined) return undefined;\n return fieldId === undefined ? { mode } : { mode, fieldId };\n}\n\n/** One option code, as every option-bearing command states it. */\nexport function readOptionCode(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): string | number | undefined {\n if (typeof value === 'string' && value !== '') return value;\n if (isCanonicalInteger(value)) return value;\n return fail(\n draftIn,\n path,\n `an option \\`code\\` is non-empty text or a whole number; received ${describe(value)}`,\n );\n}\n\n/**\n * One rule expression, as the editor holds it.\n *\n * The visual arm is narrowed by the vocabulary's own reader, so a value that is not one of its\n * forms is refused at the bound the reader names rather than reaching the document. The source arm\n * is text and stays text: an unfinished expression is a draft state the store accepts.\n */\nexport function readRuleExpression(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): RuleExpression | undefined {\n const expression = readRecord(draftIn, value, path, 'an expression');\n if (expression === undefined) return undefined;\n const mode = readText(draftIn, expression, 'mode', path);\n if (mode === undefined) return undefined;\n if (mode === 'advanced') {\n onlyMembers(draftIn, expression, ['mode', 'source'], path);\n const source = readLiteral(draftIn, expression, 'source', path);\n return source === undefined ? undefined : { mode, source };\n }\n if (mode !== 'visual') {\n return fail(draftIn, `${path}.mode`, '`mode` is `visual` or `advanced`');\n }\n onlyMembers(draftIn, expression, ['mode', 'visual'], path);\n const parsed = parseVisual(expression['visual'], `${path}.visual`);\n if (!parsed.ok) return fail(draftIn, parsed.path, parsed.detail);\n return { mode, visual: parsed.visual };\n}\n\n/** One optional rule expression: absent leaves the member alone rather than refusing it. */\nexport function readOptionalRuleExpression(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): RuleExpression | undefined {\n if (!Object.hasOwn(record, key)) return undefined;\n return readRuleExpression(draftIn, record[key], `${path}.${key}`);\n}\n\n/** The `params` block of a rule, gate item, screen reason or option availability. */\nexport function readParams(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n path: string,\n): Readonly<Record<string, string>> | undefined {\n if (!Object.hasOwn(record, 'params')) return undefined;\n const value = record['params'];\n const params = readRecord(draftIn, value, `${path}.params`, '`params`');\n if (params === undefined) return undefined;\n const narrowed: [string, string][] = [];\n for (const [name, source] of Object.entries(params)) {\n if (typeof source !== 'string' || source.trim() === '') {\n return fail(\n draftIn,\n `${path}.params.${name}`,\n `parameter \\`${name}\\` is an expression; received ${describe(source)}`,\n );\n }\n narrowed.push([name, source]);\n }\n return Object.fromEntries(narrowed);\n}\n\n/** One canonical wire value. */\nexport function readWireValue(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): WireValue | undefined {\n if (isWireValue(value)) return value;\n return fail(\n draftIn,\n path,\n 'a value is a canonical wire value: a string, a whole number, a boolean, `null`, money, a timeslot, a list or a record of those',\n );\n}\n\n/** A map keyed by an identifier, holding canonical wire values. */\nexport function readWireRecord(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n what: string,\n): Readonly<Record<string, WireValue>> | undefined {\n const record = readRecord(draftIn, value, path, what);\n if (record === undefined) return undefined;\n const narrowed: [string, WireValue][] = [];\n for (const [key, member] of Object.entries(record)) {\n const read = readWireValue(draftIn, member, `${path}.${key}`);\n if (read === undefined) return undefined;\n narrowed.push([key, read]);\n }\n return Object.fromEntries(narrowed);\n}\n\n/**\n * One row key: a non-empty string or a safe whole number.\n *\n * A key is the record's own data, so its spelling is the record's: a text key is kept exactly as it\n * was written, and `1` and `\"1\"` stay two rows. The reserved spelling `current` is a string like any\n * other here; the engine resolves it as the row an item-scoped rule judged, which is the one place a\n * suggestion's row address is read.\n */\nexport function readRowKeyValue(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): string | number | undefined {\n if (typeof value === 'string' && value !== '') return value;\n if (isCanonicalInteger(value)) return value;\n return fail(draftIn, path, '`rowKey` is a non-empty string or a safe whole number');\n}\n\n/** One field reference, `schema.v1.json` `fieldRef`. */\nfunction readFieldRef(draftIn: ParseDraft, value: unknown, path: string): FieldRef | undefined {\n const record = readRecord(draftIn, value, path, 'a field reference');\n if (record === undefined) return undefined;\n onlyMembers(draftIn, record, ['fieldId', 'rowKey'], path);\n const fieldId = readIdentifier(draftIn, record, 'fieldId', path);\n const rowKey = record['rowKey'];\n const key = rowKey === undefined ? undefined : readRowKeyValue(draftIn, rowKey, `${path}.rowKey`);\n if (fieldId === undefined || draftIn.refusal !== undefined) return undefined;\n return key === undefined ? { fieldId } : { fieldId, rowKey: key };\n}\n\n/** A list of field references, or `undefined` when the value is not one. */\nexport function readFieldRefs(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n what: string,\n): readonly FieldRef[] | undefined {\n if (!Array.isArray(value)) {\n return fail(draftIn, path, `${what} is a list of field references`);\n }\n const narrowed: FieldRef[] = [];\n for (const [index, entry] of value.entries()) {\n const read = readFieldRef(draftIn, entry, `${path}[${String(index)}]`);\n if (read === undefined) return undefined;\n narrowed.push(read);\n }\n return narrowed;\n}\n\n/**\n * The access overlay a case evaluates under, read by the runtime's own overlay parser.\n *\n * The authored slot keeps an omitted `defaultAccess` omitted: the runtime resolves that omission\n * as the fail-closed `read_only`, and stating it here would rewrite a stored case on a\n * load-and-save that changed nothing.\n */\nexport function readAccessOverlay(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): AuthoringTestCase['accessOverlay'] | undefined {\n try {\n const overlay: AccessOverlay = toAccessOverlay(value, path);\n const stated = isRecord(value) && value['defaultAccess'] !== undefined;\n return {\n accessVersion: overlay.accessVersion,\n ...(stated ? { defaultAccess: overlay.defaultAccess } : {}),\n ...(overlay.allowMaskedRead === undefined\n ? {}\n : { allowMaskedRead: overlay.allowMaskedRead }),\n rules: overlay.rules,\n };\n } catch (cause) {\n if (!(cause instanceof AxiomError)) throw cause;\n return fail(draftIn, cause.path === '' ? path : cause.path, cause.message);\n }\n}\n\n/** A civil date text, read by the runtime's own calendar check. */\nexport function readPlainDate(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): string | undefined {\n if (typeof value !== 'string') {\n return fail(draftIn, path, `\\`recordDate\\` is a civil date; received ${describe(value)}`);\n }\n try {\n parsePlainDate(value, path);\n return value;\n } catch (cause) {\n if (!(cause instanceof AxiomError)) throw cause;\n return fail(draftIn, path, cause.message);\n }\n}\n\n/** A list of non-empty capability names. */\nexport function readCapabilities(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): readonly string[] | undefined {\n if (!Array.isArray(value)) {\n return fail(draftIn, path, '`capabilities` is a list of capability names');\n }\n const narrowed: string[] = [];\n for (const [index, entry] of value.entries()) {\n if (typeof entry !== 'string' || entry === '') {\n return fail(\n draftIn,\n `${path}[${String(index)}]`,\n `a capability is a non-empty name; received ${describe(entry)}`,\n );\n }\n narrowed.push(entry);\n }\n return narrowed;\n}\n\n/** One `diagnosticCode`: the upper-case problem grammar a screen reason states. */\nexport function readDiagnosticCode(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n key: string,\n path: string,\n): string | undefined {\n const value = readText(draftIn, record, key, path);\n if (value === undefined) return undefined;\n if (/^[A-Z][A-Z0-9_]{2,63}$/u.test(value)) return value;\n return fail(\n draftIn,\n `${path}.${key}`,\n `\\`${key}\\` is \\`${value}\\`; write an upper-case problem code, as \\`AMOUNT_REVIEW\\``,\n );\n}\n\n/** One list of identifiers, duplicate-free, for `covers` and `fieldIds`. */\nexport function readIdentifierList(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n what: string,\n): readonly string[] | undefined {\n if (!Array.isArray(value) || value.length === 0) {\n return fail(draftIn, path, `${what} states at least one identifier`);\n }\n const narrowed: string[] = [];\n for (const [index, entry] of value.entries()) {\n if (typeof entry !== 'string' || !IDENTIFIER_PATTERN.test(entry)) {\n return fail(\n draftIn,\n `${path}[${String(index)}]`,\n `${what} holds lower-case identifiers; received ${describe(entry)}`,\n );\n }\n if (narrowed.includes(entry)) {\n return fail(draftIn, `${path}[${String(index)}]`, `${what} names \\`${entry}\\` twice`);\n }\n narrowed.push(entry);\n }\n return narrowed;\n}\n\n/** One `itemDeclaration`: a scalar or attachment array's element domain. */\n/**\n * The four members that narrow a declaration's value domain, read from a record.\n *\n * A `money`, `quantity` or `duration` declaration states its currency, its scale, its unit domain\n * or its unit; every other primitive states none of them, and the metaschema says so through an\n * `if`/`then` per primitive. Field items and context roots spell the domain the same way, so they\n * read it through this one function and cannot disagree about which member belongs to which\n * primitive.\n */\nexport function readDeclarationDomain(\n draftIn: ParseDraft,\n record: Readonly<Record<string, unknown>>,\n path: string,\n primitive: string | undefined,\n):\n | {\n readonly currency?: string;\n readonly scale?: number;\n readonly units?: readonly string[];\n readonly unit?: 'minutes' | 'hours' | 'seconds';\n }\n | undefined {\n const currency = readOptionalText(draftIn, record, 'currency', path);\n const scale = readOptionalInteger(draftIn, record, 'scale', path);\n const units = Object.hasOwn(record, 'units')\n ? readIdentifierList(draftIn, record['units'], `${path}.units`, '`units`')\n : undefined;\n const unitText = readOptionalText(draftIn, record, 'unit', path);\n const unit =\n unitText === undefined\n ? undefined\n : unitText === 'minutes' || unitText === 'hours' || unitText === 'seconds'\n ? unitText\n : fail(draftIn, `${path}.unit`, 'a duration unit is `minutes`, `hours` or `seconds`');\n if (primitive === undefined) return undefined;\n if (primitive !== 'money' && currency !== undefined) {\n fail(draftIn, `${path}.currency`, 'only a `money` declaration states a currency');\n }\n // A quantity states a scale too: money carries its own scale in the value, a quantity's is the\n // declaration's (`MODEL-2.1.21`). Every other primitive holds a value whose digits are fixed.\n if (primitive !== 'money' && primitive !== 'quantity' && scale !== undefined) {\n fail(draftIn, `${path}.scale`, 'only a `money` or `quantity` declaration states a scale');\n }\n if (primitive !== 'quantity' && units !== undefined) {\n fail(draftIn, `${path}.units`, 'only a `quantity` declaration states its unit domain');\n }\n if (primitive !== 'duration' && unit !== undefined) {\n fail(draftIn, `${path}.unit`, 'only a `duration` declaration states a unit');\n }\n if (primitive === 'money') {\n if (currency === undefined) {\n fail(draftIn, `${path}.currency`, 'a `money` declaration states its ISO 4217 currency');\n } else if (!CURRENCY_CODE_PATTERN.test(currency)) {\n fail(\n draftIn,\n `${path}.currency`,\n `\\`currency\\` is \\`${currency}\\`; write three upper-case letters, as \\`USD\\``,\n );\n }\n if (scale === undefined) {\n fail(\n draftIn,\n `${path}.scale`,\n 'a `money` declaration states its `scale`, the minor-unit digits',\n );\n }\n }\n if (draftIn.refusal !== undefined) return undefined;\n return {\n ...(currency === undefined ? {} : { currency }),\n ...(scale === undefined ? {} : { scale }),\n ...(units === undefined || units.length === 0 ? {} : { units }),\n ...(unit === undefined ? {} : { unit }),\n };\n}\n\n/** One `itemDeclaration`: the element domain of a scalar or attachment array. */\nexport function readItemDeclaration(\n draftIn: ParseDraft,\n value: unknown,\n path: string,\n): AuthoringItem | undefined {\n const record = readRecord(draftIn, value, path, 'an item declaration');\n if (record === undefined) return undefined;\n onlyMembers(draftIn, record, ['primitive', 'currency', 'scale', 'units', 'unit'], path);\n const primitive = readChoice(draftIn, record, 'primitive', path, ITEM_PRIMITIVES);\n const domain = readDeclarationDomain(draftIn, record, path, primitive);\n if (primitive === undefined || domain === undefined) return undefined;\n return { primitive, ...domain };\n}\n\n/** The rule kinds the metaschema's `rule.kind` enumerates, as this module reads them. */\nexport const RULE_KINDS: readonly AuthoringRuleKind[] = [\n 'validate',\n 'visible',\n 'required',\n 'enabled',\n 'compute',\n 'defaultCompute',\n 'gate',\n 'screen',\n];\n\nexport const RULE_SCOPES: readonly ('field' | 'record' | 'array' | 'item')[] = [\n 'field',\n 'record',\n 'array',\n 'item',\n];\n\n/** The primitives whose values an option domain can name, `schema.v1.json` `field` `allOf`. */\nconst OPTION_PRIMITIVES: ReadonlySet<string> = new Set([\n 'string',\n 'integer',\n 'boolean',\n 'duration',\n]);\n\n/** Whether a field of this shape may declare an option domain at all. */\nexport function admitsOptions(primitive: string | undefined, items: string | undefined): boolean {\n if (primitive === undefined) return false;\n if (OPTION_PRIMITIVES.has(primitive)) return true;\n return (\n primitive === 'array' &&\n items !== undefined &&\n isItemPrimitive(items) &&\n OPTION_ARRAY_ITEMS.has(items)\n );\n}\n\nexport const RULE_SEVERITIES: readonly ('block' | 'warn' | 'info')[] = ['block', 'warn', 'info'];\nexport const EVALUATE_ON: readonly ('client' | 'server')[] = ['client', 'server'];\nexport const ON_HIDE_POLICIES: readonly ('preserve' | 'exclude')[] = ['preserve', 'exclude'];\nexport const GATE_POLICIES: readonly ('defer' | 'warn' | 'block')[] = ['defer', 'warn', 'block'];\n\n/** The item primitives a scalar or attachment array states, from the runtime registry. */\nexport const ITEM_PRIMITIVES: readonly ItemPrimitive[] = RUNTIME_ITEM_PRIMITIVES;\n\n/**\n * The deepest a container member tree may nest.\n *\n * A record inside a record is legal in the format, and a builder authors a handful of levels at\n * most. The bound is stated because the parse is recursive: without it a stored draft nested\n * thousands deep overflows the stack instead of being refused, and a refusal is the whole\n * contract of this door.\n */\nexport const MAX_MEMBER_NESTING: number = 16;\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AddRuleSpec, EditRuleSpec, TestCaseSpec } from './shapes.js';
|
|
2
|
+
import type { ParseDraft } from './readers.js';
|
|
3
|
+
/** One embedded vector, as a command states it. */
|
|
4
|
+
export declare function readTestCase(draftIn: ParseDraft, value: unknown, path: string): TestCaseSpec | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* One embedded case list at a named member, or `undefined` when the record states none.
|
|
7
|
+
*
|
|
8
|
+
* The rule's own `testCases` and a declaration's `<member>TestCases` are the same contract, so
|
|
9
|
+
* one reader serves both: an empty list claims nothing and is refused, and each case is read by
|
|
10
|
+
* the same `readTestCase`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readTestCaseList(draftIn: ParseDraft, record: Readonly<Record<string, unknown>>, path: string, member: string): readonly TestCaseSpec[] | undefined;
|
|
13
|
+
export declare function readRule(draftIn: ParseDraft, value: unknown, path: string): AddRuleSpec | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* One rule's edited payload, as the rule editor states it.
|
|
16
|
+
*
|
|
17
|
+
* Every member is the three-state edit `EditFieldSpec` states: absent leaves it, `null` removes it,
|
|
18
|
+
* a value replaces it. The identity members — `ruleId`, `kind`, `scope` — are not here, so the
|
|
19
|
+
* request cannot rename a rule or turn a gate into a validate under one id; a rule whose kind has
|
|
20
|
+
* to change is a second rule with its own id. The wordings reuse `addRule`'s readers, so a gate
|
|
21
|
+
* item or a screen reason is read by the same authority whether it is being added or edited.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readEditRule(draftIn: ParseDraft, value: unknown, path: string): EditRuleSpec | undefined;
|
|
24
|
+
//# sourceMappingURL=rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../src/store/commands/rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAIZ,YAAY,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAyI/C,mDAAmD;AACnD,wBAAgB,YAAY,CAC1B,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,GACX,YAAY,GAAG,SAAS,CA+D1B;AAOD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,SAAS,YAAY,EAAE,GAAG,SAAS,CAwBrC;AAUD,wBAAgB,QAAQ,CACtB,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,GACX,WAAW,GAAG,SAAS,CAqLzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,GACX,YAAY,GAAG,SAAS,CAmF1B"}
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { EVALUATE_ON, GATE_POLICIES, RULE_KINDS, RULE_SCOPES, RULE_SEVERITIES, describe, fail, onlyMembers, readAccessOverlay, readBoolean, readCapabilities, readChoice, readDiagnosticCode, readEditable, readFieldRefs, readIdentifier, readIdentifierList, readLiteral, readOptionalChoice, readOptionalIdentifier, readOptionalLiteral, readOptionalRuleExpression, readParams, readPlainDate, readRecord, readRuleExpression, readRuleNote, readWireRecord, readWireValue, } from './readers.js';
|
|
2
|
+
import { readSuggestionList } from './suggestions.js';
|
|
3
|
+
function readGateItem(draftIn, value, path) {
|
|
4
|
+
const item = readRecord(draftIn, value, path, 'a gate item');
|
|
5
|
+
if (item === undefined)
|
|
6
|
+
return undefined;
|
|
7
|
+
onlyMembers(draftIn, item, ['itemId', 'expression', 'message', 'params'], path);
|
|
8
|
+
const itemId = readIdentifier(draftIn, item, 'itemId', path);
|
|
9
|
+
const expression = readRuleExpression(draftIn, item['expression'], `${path}.expression`);
|
|
10
|
+
const message = readLiteral(draftIn, item, 'message', path);
|
|
11
|
+
const params = readParams(draftIn, item, path);
|
|
12
|
+
if (itemId === undefined || expression === undefined || message === undefined)
|
|
13
|
+
return undefined;
|
|
14
|
+
return {
|
|
15
|
+
itemId,
|
|
16
|
+
expression,
|
|
17
|
+
message,
|
|
18
|
+
...(params === undefined ? {} : { params }),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function readGate(draftIn, value, path) {
|
|
22
|
+
const gate = readRecord(draftIn, value, path, 'a gate');
|
|
23
|
+
if (gate === undefined)
|
|
24
|
+
return undefined;
|
|
25
|
+
onlyMembers(draftIn, gate, ['items', 'hard', 'activeWhen', 'onReadOnlyError'], path);
|
|
26
|
+
const rawItems = gate['items'];
|
|
27
|
+
if (!Array.isArray(rawItems) || rawItems.length === 0) {
|
|
28
|
+
return fail(draftIn, `${path}.items`, 'a gate declares at least one item in `gate.items`; the metaschema states `minItems: 1`');
|
|
29
|
+
}
|
|
30
|
+
const items = [];
|
|
31
|
+
const seen = new Set();
|
|
32
|
+
rawItems.forEach((entry, index) => {
|
|
33
|
+
const at = `${path}.items[${String(index)}]`;
|
|
34
|
+
const item = readGateItem(draftIn, entry, at);
|
|
35
|
+
if (item === undefined)
|
|
36
|
+
return;
|
|
37
|
+
if (seen.has(item.itemId)) {
|
|
38
|
+
fail(draftIn, `${at}.itemId`, `gate item id \`${item.itemId}\` is declared twice; an item's id is its identity in the report and in a gate override`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
seen.add(item.itemId);
|
|
42
|
+
items.push(item);
|
|
43
|
+
});
|
|
44
|
+
const hard = readBoolean(draftIn, gate, 'hard', path);
|
|
45
|
+
const activeWhen = readOptionalRuleExpression(draftIn, gate, 'activeWhen', path);
|
|
46
|
+
const onReadOnlyError = readOptionalChoice(draftIn, gate, 'onReadOnlyError', path, GATE_POLICIES);
|
|
47
|
+
if (hard === undefined || draftIn.refusal !== undefined)
|
|
48
|
+
return undefined;
|
|
49
|
+
const [first, ...rest] = items;
|
|
50
|
+
if (first === undefined)
|
|
51
|
+
return undefined;
|
|
52
|
+
return {
|
|
53
|
+
items: [first, ...rest],
|
|
54
|
+
hard,
|
|
55
|
+
...(activeWhen === undefined ? {} : { activeWhen }),
|
|
56
|
+
...(onReadOnlyError === undefined ? {} : { onReadOnlyError }),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function readScreenReason(draftIn, value, path) {
|
|
60
|
+
const reason = readRecord(draftIn, value, path, 'a screen reason');
|
|
61
|
+
if (reason === undefined)
|
|
62
|
+
return undefined;
|
|
63
|
+
onlyMembers(draftIn, reason, ['code', 'when', 'message', 'params'], path);
|
|
64
|
+
const code = readDiagnosticCode(draftIn, reason, 'code', path);
|
|
65
|
+
const when = readRuleExpression(draftIn, reason['when'], `${path}.when`);
|
|
66
|
+
const message = readLiteral(draftIn, reason, 'message', path);
|
|
67
|
+
const params = readParams(draftIn, reason, path);
|
|
68
|
+
if (code === undefined || when === undefined || message === undefined)
|
|
69
|
+
return undefined;
|
|
70
|
+
return {
|
|
71
|
+
code,
|
|
72
|
+
when,
|
|
73
|
+
message,
|
|
74
|
+
...(params === undefined ? {} : { params }),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** One screen's reason list, which the metaschema requires to state at least one reason. */
|
|
78
|
+
function readScreenReasons(draftIn, value, path) {
|
|
79
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
80
|
+
return fail(draftIn, path, 'a screen declares at least one reason; the metaschema states `minItems: 1`');
|
|
81
|
+
}
|
|
82
|
+
const reasons = [];
|
|
83
|
+
for (const [index, entry] of value.entries()) {
|
|
84
|
+
const reason = readScreenReason(draftIn, entry, `${path}[${String(index)}]`);
|
|
85
|
+
if (reason === undefined)
|
|
86
|
+
return undefined;
|
|
87
|
+
reasons.push(reason);
|
|
88
|
+
}
|
|
89
|
+
return reasons;
|
|
90
|
+
}
|
|
91
|
+
/** One embedded vector, as a command states it. */
|
|
92
|
+
export function readTestCase(draftIn, value, path) {
|
|
93
|
+
const testCase = readRecord(draftIn, value, path, 'a test case');
|
|
94
|
+
if (testCase === undefined)
|
|
95
|
+
return undefined;
|
|
96
|
+
onlyMembers(draftIn, testCase, [
|
|
97
|
+
'caseId',
|
|
98
|
+
'expected',
|
|
99
|
+
'values',
|
|
100
|
+
'context',
|
|
101
|
+
'redacted',
|
|
102
|
+
'sessionWrites',
|
|
103
|
+
'accessOverlay',
|
|
104
|
+
'recordDate',
|
|
105
|
+
'capabilities',
|
|
106
|
+
'tier',
|
|
107
|
+
], path);
|
|
108
|
+
const caseId = readIdentifier(draftIn, testCase, 'caseId', path);
|
|
109
|
+
const expected = readWireValue(draftIn, testCase['expected'], `${path}.expected`);
|
|
110
|
+
// The metaschema requires `values` on every case: a case with no input decides nothing.
|
|
111
|
+
const values = readWireRecord(draftIn, testCase['values'], `${path}.values`, '`values`');
|
|
112
|
+
const context = Object.hasOwn(testCase, 'context')
|
|
113
|
+
? readWireRecord(draftIn, testCase['context'], `${path}.context`, '`context`')
|
|
114
|
+
: undefined;
|
|
115
|
+
const redacted = Object.hasOwn(testCase, 'redacted')
|
|
116
|
+
? readFieldRefs(draftIn, testCase['redacted'], `${path}.redacted`, '`redacted`')
|
|
117
|
+
: undefined;
|
|
118
|
+
const sessionWrites = Object.hasOwn(testCase, 'sessionWrites')
|
|
119
|
+
? readFieldRefs(draftIn, testCase['sessionWrites'], `${path}.sessionWrites`, '`sessionWrites`')
|
|
120
|
+
: undefined;
|
|
121
|
+
const accessOverlay = Object.hasOwn(testCase, 'accessOverlay')
|
|
122
|
+
? readAccessOverlay(draftIn, testCase['accessOverlay'], `${path}.accessOverlay`)
|
|
123
|
+
: undefined;
|
|
124
|
+
const recordDate = Object.hasOwn(testCase, 'recordDate')
|
|
125
|
+
? readPlainDate(draftIn, testCase['recordDate'], `${path}.recordDate`)
|
|
126
|
+
: undefined;
|
|
127
|
+
const capabilities = Object.hasOwn(testCase, 'capabilities')
|
|
128
|
+
? readCapabilities(draftIn, testCase['capabilities'], `${path}.capabilities`)
|
|
129
|
+
: undefined;
|
|
130
|
+
const tier = readOptionalChoice(draftIn, testCase, 'tier', path, ['client', 'server']);
|
|
131
|
+
if (caseId === undefined ||
|
|
132
|
+
expected === undefined ||
|
|
133
|
+
values === undefined ||
|
|
134
|
+
draftIn.refusal !== undefined) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
caseId,
|
|
139
|
+
expected,
|
|
140
|
+
values,
|
|
141
|
+
...(context === undefined ? {} : { context }),
|
|
142
|
+
...(redacted === undefined ? {} : { redacted }),
|
|
143
|
+
...(sessionWrites === undefined ? {} : { sessionWrites }),
|
|
144
|
+
...(accessOverlay === undefined ? {} : { accessOverlay }),
|
|
145
|
+
...(recordDate === undefined ? {} : { recordDate }),
|
|
146
|
+
...(capabilities === undefined ? {} : { capabilities }),
|
|
147
|
+
...(tier === undefined ? {} : { tier }),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/** The kinds whose metaschema arm requires a `messageKey`. */
|
|
151
|
+
function needsMessage(kind) {
|
|
152
|
+
return kind === 'validate' || kind === 'gate' || kind === 'screen';
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* One embedded case list at a named member, or `undefined` when the record states none.
|
|
156
|
+
*
|
|
157
|
+
* The rule's own `testCases` and a declaration's `<member>TestCases` are the same contract, so
|
|
158
|
+
* one reader serves both: an empty list claims nothing and is refused, and each case is read by
|
|
159
|
+
* the same `readTestCase`.
|
|
160
|
+
*/
|
|
161
|
+
export function readTestCaseList(draftIn, record, path, member) {
|
|
162
|
+
if (!Object.hasOwn(record, member))
|
|
163
|
+
return undefined;
|
|
164
|
+
const value = record[member];
|
|
165
|
+
if (!Array.isArray(value)) {
|
|
166
|
+
return fail(draftIn, `${path}.${member}`, `\`${member}\` is a list of embedded test cases; received ${describe(value)}`);
|
|
167
|
+
}
|
|
168
|
+
if (value.length === 0) {
|
|
169
|
+
return fail(draftIn, `${path}.${member}`, 'an embedded case list states at least one case; the metaschema states `minItems: 1`');
|
|
170
|
+
}
|
|
171
|
+
const cases = [];
|
|
172
|
+
for (const [index, entry] of value.entries()) {
|
|
173
|
+
const one = readTestCase(draftIn, entry, `${path}.${member}[${String(index)}]`);
|
|
174
|
+
if (one === undefined)
|
|
175
|
+
return undefined;
|
|
176
|
+
cases.push(one);
|
|
177
|
+
}
|
|
178
|
+
return cases;
|
|
179
|
+
}
|
|
180
|
+
function readTestCases(draftIn, record, path) {
|
|
181
|
+
return readTestCaseList(draftIn, record, path, 'testCases');
|
|
182
|
+
}
|
|
183
|
+
export function readRule(draftIn, value, path) {
|
|
184
|
+
const spec = readRecord(draftIn, value, path, 'a rule');
|
|
185
|
+
if (spec === undefined)
|
|
186
|
+
return undefined;
|
|
187
|
+
onlyMembers(draftIn, spec, [
|
|
188
|
+
'ruleId',
|
|
189
|
+
'kind',
|
|
190
|
+
'scope',
|
|
191
|
+
'evaluateOn',
|
|
192
|
+
'severity',
|
|
193
|
+
'expression',
|
|
194
|
+
'note',
|
|
195
|
+
'fieldId',
|
|
196
|
+
'fieldIds',
|
|
197
|
+
'targetFieldId',
|
|
198
|
+
'message',
|
|
199
|
+
'params',
|
|
200
|
+
'referWhen',
|
|
201
|
+
'reasons',
|
|
202
|
+
'overrideFieldId',
|
|
203
|
+
'gate',
|
|
204
|
+
'suggests',
|
|
205
|
+
'testCases',
|
|
206
|
+
], path);
|
|
207
|
+
const ruleId = readIdentifier(draftIn, spec, 'ruleId', path);
|
|
208
|
+
const kind = readChoice(draftIn, spec, 'kind', path, RULE_KINDS);
|
|
209
|
+
const scope = readChoice(draftIn, spec, 'scope', path, RULE_SCOPES);
|
|
210
|
+
const evaluateOn = readOptionalChoice(draftIn, spec, 'evaluateOn', path, EVALUATE_ON);
|
|
211
|
+
const severity = readOptionalChoice(draftIn, spec, 'severity', path, RULE_SEVERITIES);
|
|
212
|
+
const expression = readRuleExpression(draftIn, spec['expression'], `${path}.expression`);
|
|
213
|
+
const note = Object.hasOwn(spec, 'note')
|
|
214
|
+
? readRuleNote(draftIn, spec['note'], `${path}.note`)
|
|
215
|
+
: undefined;
|
|
216
|
+
const fieldId = readOptionalIdentifier(draftIn, spec, 'fieldId', path);
|
|
217
|
+
const fieldIds = Object.hasOwn(spec, 'fieldIds')
|
|
218
|
+
? readIdentifierList(draftIn, spec['fieldIds'], `${path}.fieldIds`, '`fieldIds`')
|
|
219
|
+
: undefined;
|
|
220
|
+
const targetFieldId = readOptionalIdentifier(draftIn, spec, 'targetFieldId', path);
|
|
221
|
+
const message = readOptionalLiteral(draftIn, spec, 'message', path);
|
|
222
|
+
const params = readParams(draftIn, spec, path);
|
|
223
|
+
const referWhen = readOptionalRuleExpression(draftIn, spec, 'referWhen', path);
|
|
224
|
+
const overrideFieldId = readOptionalIdentifier(draftIn, spec, 'overrideFieldId', path);
|
|
225
|
+
const gate = Object.hasOwn(spec, 'gate')
|
|
226
|
+
? readGate(draftIn, spec['gate'], `${path}.gate`)
|
|
227
|
+
: undefined;
|
|
228
|
+
const testCases = readTestCases(draftIn, spec, path);
|
|
229
|
+
const suggests = readSuggestionList(draftIn, spec, 'suggests', path);
|
|
230
|
+
const reasonsValue = spec['reasons'];
|
|
231
|
+
const reasons = reasonsValue === undefined
|
|
232
|
+
? undefined
|
|
233
|
+
: readScreenReasons(draftIn, reasonsValue, `${path}.reasons`);
|
|
234
|
+
// The metaschema's `rule.allOf` and the validate-only `suggests` clause are the authorities for
|
|
235
|
+
// which kind carries which members; stating them here refuses the command at the member an
|
|
236
|
+
// author would repair instead of at a compile that has to name the same fact after the store has
|
|
237
|
+
// already committed it.
|
|
238
|
+
if (kind !== undefined) {
|
|
239
|
+
if (needsMessage(kind) && message === undefined && draftIn.refusal === undefined) {
|
|
240
|
+
fail(draftIn, `${path}.message`, `a \`${kind}\` rule states the text a reader sees; the metaschema requires a \`messageKey\` there, and the store mints it from \`message\``);
|
|
241
|
+
}
|
|
242
|
+
if (kind === 'gate' && gate === undefined && draftIn.refusal === undefined) {
|
|
243
|
+
fail(draftIn, `${path}.gate`, 'a `gate` rule states its items and policy in `gate`; the metaschema requires it there');
|
|
244
|
+
}
|
|
245
|
+
if (kind !== 'gate' && Object.hasOwn(spec, 'gate')) {
|
|
246
|
+
fail(draftIn, `${path}.gate`, 'only a `gate` rule states `gate`');
|
|
247
|
+
}
|
|
248
|
+
if (kind === 'defaultCompute' &&
|
|
249
|
+
overrideFieldId === undefined &&
|
|
250
|
+
draftIn.refusal === undefined) {
|
|
251
|
+
fail(draftIn, `${path}.overrideFieldId`, 'a `defaultCompute` rule names the companion field that stores a user override in `overrideFieldId`; the metaschema requires it');
|
|
252
|
+
}
|
|
253
|
+
if (kind !== 'defaultCompute' && Object.hasOwn(spec, 'overrideFieldId')) {
|
|
254
|
+
fail(draftIn, `${path}.overrideFieldId`, 'only a `defaultCompute` rule states `overrideFieldId`');
|
|
255
|
+
}
|
|
256
|
+
if (kind !== 'screen' && Object.hasOwn(spec, 'referWhen')) {
|
|
257
|
+
fail(draftIn, `${path}.referWhen`, 'only a `screen` rule states `referWhen`');
|
|
258
|
+
}
|
|
259
|
+
if (kind !== 'screen' && Object.hasOwn(spec, 'reasons')) {
|
|
260
|
+
fail(draftIn, `${path}.reasons`, 'only a `screen` rule states `reasons`');
|
|
261
|
+
}
|
|
262
|
+
if (kind !== 'validate' && Object.hasOwn(spec, 'suggests')) {
|
|
263
|
+
fail(draftIn, `${path}.suggests`, `a \`${kind}\` rule states a branch rather than a verdict, so it offers no alternative; \`suggests\` is stated on a \`validate\` rule`);
|
|
264
|
+
}
|
|
265
|
+
if (kind !== 'visible' && kind !== 'enabled' && Object.hasOwn(spec, 'fieldIds')) {
|
|
266
|
+
fail(draftIn, `${path}.fieldIds`, 'only a `visible` or `enabled` rule decides more than one field in `fieldIds`');
|
|
267
|
+
}
|
|
268
|
+
if (fieldIds !== undefined && scope !== 'record') {
|
|
269
|
+
fail(draftIn, `${path}.fieldIds`, 'a rule that names `fieldIds` is record-scoped; set `scope` to `record`');
|
|
270
|
+
}
|
|
271
|
+
if (fieldIds !== undefined && fieldId !== undefined) {
|
|
272
|
+
fail(draftIn, `${path}.fieldIds`, 'a rule names its targets once: `fieldIds` for several, `fieldId` for one, never both');
|
|
273
|
+
}
|
|
274
|
+
if ((kind === 'visible' || kind === 'enabled') &&
|
|
275
|
+
fieldId === undefined &&
|
|
276
|
+
fieldIds === undefined) {
|
|
277
|
+
fail(draftIn, `${path}.fieldIds`, `a \`${kind}\` rule names the field it decides in \`fieldId\`, or several in \`fieldIds\``);
|
|
278
|
+
}
|
|
279
|
+
if (scope !== undefined && scope !== 'record' && fieldId === undefined) {
|
|
280
|
+
fail(draftIn, `${path}.fieldId`, `a \`${scope}\`-scoped rule names the field it addresses in \`fieldId\``);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (ruleId === undefined ||
|
|
284
|
+
kind === undefined ||
|
|
285
|
+
scope === undefined ||
|
|
286
|
+
expression === undefined ||
|
|
287
|
+
draftIn.refusal !== undefined) {
|
|
288
|
+
return undefined;
|
|
289
|
+
}
|
|
290
|
+
return {
|
|
291
|
+
ruleId,
|
|
292
|
+
kind,
|
|
293
|
+
scope,
|
|
294
|
+
expression,
|
|
295
|
+
...(note === undefined ? {} : { note }),
|
|
296
|
+
...(evaluateOn === undefined ? {} : { evaluateOn }),
|
|
297
|
+
...(severity === undefined ? {} : { severity }),
|
|
298
|
+
...(fieldId === undefined ? {} : { fieldId }),
|
|
299
|
+
...(fieldIds === undefined ? {} : { fieldIds }),
|
|
300
|
+
...(targetFieldId === undefined ? {} : { targetFieldId }),
|
|
301
|
+
...(message === undefined ? {} : { message }),
|
|
302
|
+
...(params === undefined ? {} : { params }),
|
|
303
|
+
...(referWhen === undefined ? {} : { referWhen }),
|
|
304
|
+
...(reasons === undefined ? {} : { reasons }),
|
|
305
|
+
...(overrideFieldId === undefined ? {} : { overrideFieldId }),
|
|
306
|
+
...(gate === undefined ? {} : { gate }),
|
|
307
|
+
...(suggests === undefined ? {} : { suggests }),
|
|
308
|
+
...(testCases === undefined ? {} : { testCases }),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* One rule's edited payload, as the rule editor states it.
|
|
313
|
+
*
|
|
314
|
+
* Every member is the three-state edit `EditFieldSpec` states: absent leaves it, `null` removes it,
|
|
315
|
+
* a value replaces it. The identity members — `ruleId`, `kind`, `scope` — are not here, so the
|
|
316
|
+
* request cannot rename a rule or turn a gate into a validate under one id; a rule whose kind has
|
|
317
|
+
* to change is a second rule with its own id. The wordings reuse `addRule`'s readers, so a gate
|
|
318
|
+
* item or a screen reason is read by the same authority whether it is being added or edited.
|
|
319
|
+
*/
|
|
320
|
+
export function readEditRule(draftIn, value, path) {
|
|
321
|
+
const spec = readRecord(draftIn, value, path, 'a rule edit');
|
|
322
|
+
if (spec === undefined)
|
|
323
|
+
return undefined;
|
|
324
|
+
onlyMembers(draftIn, spec, [
|
|
325
|
+
'expression',
|
|
326
|
+
'evaluateOn',
|
|
327
|
+
'severity',
|
|
328
|
+
'fieldId',
|
|
329
|
+
'fieldIds',
|
|
330
|
+
'targetFieldId',
|
|
331
|
+
'message',
|
|
332
|
+
'params',
|
|
333
|
+
'referWhen',
|
|
334
|
+
'reasons',
|
|
335
|
+
'overrideFieldId',
|
|
336
|
+
'gate',
|
|
337
|
+
'suggests',
|
|
338
|
+
'testCases',
|
|
339
|
+
], path);
|
|
340
|
+
const expression = Object.hasOwn(spec, 'expression')
|
|
341
|
+
? readRuleExpression(draftIn, spec['expression'], `${path}.expression`)
|
|
342
|
+
: undefined;
|
|
343
|
+
const evaluateOn = readOptionalChoice(draftIn, spec, 'evaluateOn', path, EVALUATE_ON);
|
|
344
|
+
const severity = readEditable(spec, 'severity', () => readChoice(draftIn, spec, 'severity', path, RULE_SEVERITIES));
|
|
345
|
+
const fieldId = readEditable(spec, 'fieldId', () => readIdentifier(draftIn, spec, 'fieldId', path));
|
|
346
|
+
const fieldIds = readEditable(spec, 'fieldIds', () => readIdentifierList(draftIn, spec['fieldIds'], `${path}.fieldIds`, '`fieldIds`'));
|
|
347
|
+
const targetFieldId = readEditable(spec, 'targetFieldId', () => readIdentifier(draftIn, spec, 'targetFieldId', path));
|
|
348
|
+
const message = readEditable(spec, 'message', () => readLiteral(draftIn, spec, 'message', path));
|
|
349
|
+
const params = readEditable(spec, 'params', () => readParams(draftIn, spec, path));
|
|
350
|
+
const referWhen = readEditable(spec, 'referWhen', () => readRuleExpression(draftIn, spec['referWhen'], `${path}.referWhen`));
|
|
351
|
+
const reasons = readEditable(spec, 'reasons', () => readScreenReasons(draftIn, spec['reasons'], `${path}.reasons`));
|
|
352
|
+
const overrideFieldId = readEditable(spec, 'overrideFieldId', () => readIdentifier(draftIn, spec, 'overrideFieldId', path));
|
|
353
|
+
const gate = readEditable(spec, 'gate', () => readGate(draftIn, spec['gate'], `${path}.gate`));
|
|
354
|
+
const suggests = readEditable(spec, 'suggests', () => readSuggestionList(draftIn, spec, 'suggests', path));
|
|
355
|
+
const testCases = readEditable(spec, 'testCases', () => readTestCaseList(draftIn, spec, path, 'testCases'));
|
|
356
|
+
if (draftIn.refusal !== undefined)
|
|
357
|
+
return undefined;
|
|
358
|
+
const edited = {
|
|
359
|
+
...(expression === undefined ? {} : { expression }),
|
|
360
|
+
...(evaluateOn === undefined ? {} : { evaluateOn }),
|
|
361
|
+
...(severity === undefined ? {} : { severity }),
|
|
362
|
+
...(fieldId === undefined ? {} : { fieldId }),
|
|
363
|
+
...(fieldIds === undefined ? {} : { fieldIds }),
|
|
364
|
+
...(targetFieldId === undefined ? {} : { targetFieldId }),
|
|
365
|
+
...(message === undefined ? {} : { message }),
|
|
366
|
+
...(params === undefined ? {} : { params }),
|
|
367
|
+
...(referWhen === undefined ? {} : { referWhen }),
|
|
368
|
+
...(reasons === undefined ? {} : { reasons }),
|
|
369
|
+
...(overrideFieldId === undefined ? {} : { overrideFieldId }),
|
|
370
|
+
...(gate === undefined ? {} : { gate }),
|
|
371
|
+
...(suggests === undefined ? {} : { suggests }),
|
|
372
|
+
...(testCases === undefined ? {} : { testCases }),
|
|
373
|
+
};
|
|
374
|
+
if (Object.keys(edited).length === 0) {
|
|
375
|
+
return fail(draftIn, path, 'a rule edit states at least one member to change: `expression`, `evaluateOn`, `severity`, `fieldId`, `fieldIds`, `targetFieldId`, `message`, `params`, `referWhen`, `reasons`, `overrideFieldId`, `gate`, `suggests` or `testCases`');
|
|
376
|
+
}
|
|
377
|
+
return edited;
|
|
378
|
+
}
|
|
379
|
+
//# sourceMappingURL=rule.js.map
|