@azx-pbc/axiom-builder 0.0.0-stage → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +648 -2
  3. package/dist/cards/selectors.d.ts +70 -0
  4. package/dist/cards/selectors.d.ts.map +1 -0
  5. package/dist/cards/selectors.js +194 -0
  6. package/dist/cards/selectors.js.map +1 -0
  7. package/dist/definition.d.ts +36 -0
  8. package/dist/definition.d.ts.map +1 -0
  9. package/dist/definition.js +48 -0
  10. package/dist/definition.js.map +1 -0
  11. package/dist/evidence/cases.d.ts +44 -0
  12. package/dist/evidence/cases.d.ts.map +1 -0
  13. package/dist/evidence/cases.js +578 -0
  14. package/dist/evidence/cases.js.map +1 -0
  15. package/dist/evidence/repairs.d.ts +99 -0
  16. package/dist/evidence/repairs.d.ts.map +1 -0
  17. package/dist/evidence/repairs.js +181 -0
  18. package/dist/evidence/repairs.js.map +1 -0
  19. package/dist/evidence/summary.d.ts +35 -0
  20. package/dist/evidence/summary.d.ts.map +1 -0
  21. package/dist/evidence/summary.js +38 -0
  22. package/dist/evidence/summary.js.map +1 -0
  23. package/dist/i18n/gaps.d.ts +3 -0
  24. package/dist/i18n/gaps.d.ts.map +1 -0
  25. package/dist/i18n/gaps.js +2 -0
  26. package/dist/i18n/gaps.js.map +1 -0
  27. package/dist/i18n/message-slots.d.ts +19 -0
  28. package/dist/i18n/message-slots.d.ts.map +1 -0
  29. package/dist/i18n/message-slots.js +101 -0
  30. package/dist/i18n/message-slots.js.map +1 -0
  31. package/dist/i18n/text-locale.d.ts +13 -0
  32. package/dist/i18n/text-locale.d.ts.map +1 -0
  33. package/dist/i18n/text-locale.js +14 -0
  34. package/dist/i18n/text-locale.js.map +1 -0
  35. package/dist/i18n/translations.d.ts +56 -0
  36. package/dist/i18n/translations.d.ts.map +1 -0
  37. package/dist/i18n/translations.js +103 -0
  38. package/dist/i18n/translations.js.map +1 -0
  39. package/dist/impact/references.d.ts +143 -0
  40. package/dist/impact/references.d.ts.map +1 -0
  41. package/dist/impact/references.js +429 -0
  42. package/dist/impact/references.js.map +1 -0
  43. package/dist/index.d.ts +86 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +58 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/preview/compile-preview.d.ts +67 -0
  48. package/dist/preview/compile-preview.d.ts.map +1 -0
  49. package/dist/preview/compile-preview.js +286 -0
  50. package/dist/preview/compile-preview.js.map +1 -0
  51. package/dist/preview/handle.d.ts +119 -0
  52. package/dist/preview/handle.d.ts.map +1 -0
  53. package/dist/preview/handle.js +2 -0
  54. package/dist/preview/handle.js.map +1 -0
  55. package/dist/preview/held.d.ts +39 -0
  56. package/dist/preview/held.d.ts.map +1 -0
  57. package/dist/preview/held.js +15 -0
  58. package/dist/preview/held.js.map +1 -0
  59. package/dist/preview/measurement.d.ts +5 -0
  60. package/dist/preview/measurement.d.ts.map +1 -0
  61. package/dist/preview/measurement.js +18 -0
  62. package/dist/preview/measurement.js.map +1 -0
  63. package/dist/publish/build.d.ts +33 -0
  64. package/dist/publish/build.d.ts.map +1 -0
  65. package/dist/publish/build.js +15 -0
  66. package/dist/publish/build.js.map +1 -0
  67. package/dist/publish/diff.d.ts +208 -0
  68. package/dist/publish/diff.d.ts.map +1 -0
  69. package/dist/publish/diff.js +227 -0
  70. package/dist/publish/diff.js.map +1 -0
  71. package/dist/publish/review.d.ts +41 -0
  72. package/dist/publish/review.d.ts.map +1 -0
  73. package/dist/publish/review.js +22 -0
  74. package/dist/publish/review.js.map +1 -0
  75. package/dist/schema/dataset-input.d.ts +30 -0
  76. package/dist/schema/dataset-input.d.ts.map +1 -0
  77. package/dist/schema/dataset-input.js +58 -0
  78. package/dist/schema/dataset-input.js.map +1 -0
  79. package/dist/schema/dataset.d.ts +166 -0
  80. package/dist/schema/dataset.d.ts.map +1 -0
  81. package/dist/schema/dataset.js +281 -0
  82. package/dist/schema/dataset.js.map +1 -0
  83. package/dist/schema/declarations.d.ts +15 -0
  84. package/dist/schema/declarations.d.ts.map +1 -0
  85. package/dist/schema/declarations.js +47 -0
  86. package/dist/schema/declarations.js.map +1 -0
  87. package/dist/schema/document.d.ts +504 -0
  88. package/dist/schema/document.d.ts.map +1 -0
  89. package/dist/schema/document.js +337 -0
  90. package/dist/schema/document.js.map +1 -0
  91. package/dist/schema/error.d.ts +15 -0
  92. package/dist/schema/error.d.ts.map +1 -0
  93. package/dist/schema/error.js +18 -0
  94. package/dist/schema/error.js.map +1 -0
  95. package/dist/schema/field-id.d.ts +8 -0
  96. package/dist/schema/field-id.d.ts.map +1 -0
  97. package/dist/schema/field-id.js +47 -0
  98. package/dist/schema/field-id.js.map +1 -0
  99. package/dist/schema/layout.d.ts +118 -0
  100. package/dist/schema/layout.d.ts.map +1 -0
  101. package/dist/schema/layout.js +101 -0
  102. package/dist/schema/layout.js.map +1 -0
  103. package/dist/schema/palette.d.ts +103 -0
  104. package/dist/schema/palette.d.ts.map +1 -0
  105. package/dist/schema/palette.js +140 -0
  106. package/dist/schema/palette.js.map +1 -0
  107. package/dist/schema/read.d.ts +49 -0
  108. package/dist/schema/read.d.ts.map +1 -0
  109. package/dist/schema/read.js +942 -0
  110. package/dist/schema/read.js.map +1 -0
  111. package/dist/store/apply-dataset.d.ts +14 -0
  112. package/dist/store/apply-dataset.d.ts.map +1 -0
  113. package/dist/store/apply-dataset.js +513 -0
  114. package/dist/store/apply-dataset.js.map +1 -0
  115. package/dist/store/apply.d.ts +37 -0
  116. package/dist/store/apply.d.ts.map +1 -0
  117. package/dist/store/apply.js +2269 -0
  118. package/dist/store/apply.js.map +1 -0
  119. package/dist/store/candidate.d.ts +37 -0
  120. package/dist/store/candidate.d.ts.map +1 -0
  121. package/dist/store/candidate.js +178 -0
  122. package/dist/store/candidate.js.map +1 -0
  123. package/dist/store/commands/coverage.d.ts +58 -0
  124. package/dist/store/commands/coverage.d.ts.map +1 -0
  125. package/dist/store/commands/coverage.js +354 -0
  126. package/dist/store/commands/coverage.js.map +1 -0
  127. package/dist/store/commands/dataset.d.ts +26 -0
  128. package/dist/store/commands/dataset.d.ts.map +1 -0
  129. package/dist/store/commands/dataset.js +368 -0
  130. package/dist/store/commands/dataset.js.map +1 -0
  131. package/dist/store/commands/document.d.ts +21 -0
  132. package/dist/store/commands/document.d.ts.map +1 -0
  133. package/dist/store/commands/document.js +160 -0
  134. package/dist/store/commands/document.js.map +1 -0
  135. package/dist/store/commands/field.d.ts +32 -0
  136. package/dist/store/commands/field.d.ts.map +1 -0
  137. package/dist/store/commands/field.js +572 -0
  138. package/dist/store/commands/field.js.map +1 -0
  139. package/dist/store/commands/layout.d.ts +16 -0
  140. package/dist/store/commands/layout.d.ts.map +1 -0
  141. package/dist/store/commands/layout.js +70 -0
  142. package/dist/store/commands/layout.js.map +1 -0
  143. package/dist/store/commands/parse.d.ts +19 -0
  144. package/dist/store/commands/parse.d.ts.map +1 -0
  145. package/dist/store/commands/parse.js +328 -0
  146. package/dist/store/commands/parse.js.map +1 -0
  147. package/dist/store/commands/readers.d.ts +198 -0
  148. package/dist/store/commands/readers.d.ts.map +1 -0
  149. package/dist/store/commands/readers.js +711 -0
  150. package/dist/store/commands/readers.js.map +1 -0
  151. package/dist/store/commands/rule.d.ts +24 -0
  152. package/dist/store/commands/rule.d.ts.map +1 -0
  153. package/dist/store/commands/rule.js +379 -0
  154. package/dist/store/commands/rule.js.map +1 -0
  155. package/dist/store/commands/shapes.d.ts +900 -0
  156. package/dist/store/commands/shapes.d.ts.map +1 -0
  157. package/dist/store/commands/shapes.js +166 -0
  158. package/dist/store/commands/shapes.js.map +1 -0
  159. package/dist/store/commands/suggestions.d.ts +37 -0
  160. package/dist/store/commands/suggestions.d.ts.map +1 -0
  161. package/dist/store/commands/suggestions.js +177 -0
  162. package/dist/store/commands/suggestions.js.map +1 -0
  163. package/dist/store/commands.d.ts +16 -0
  164. package/dist/store/commands.d.ts.map +1 -0
  165. package/dist/store/commands.js +13 -0
  166. package/dist/store/commands.js.map +1 -0
  167. package/dist/store/dataset-candidate.d.ts +33 -0
  168. package/dist/store/dataset-candidate.d.ts.map +1 -0
  169. package/dist/store/dataset-candidate.js +31 -0
  170. package/dist/store/dataset-candidate.js.map +1 -0
  171. package/dist/store/dataset-pin.d.ts +93 -0
  172. package/dist/store/dataset-pin.d.ts.map +1 -0
  173. package/dist/store/dataset-pin.js +86 -0
  174. package/dist/store/dataset-pin.js.map +1 -0
  175. package/dist/store/dataset-store.d.ts +96 -0
  176. package/dist/store/dataset-store.d.ts.map +1 -0
  177. package/dist/store/dataset-store.js +112 -0
  178. package/dist/store/dataset-store.js.map +1 -0
  179. package/dist/store/history.d.ts +149 -0
  180. package/dist/store/history.d.ts.map +1 -0
  181. package/dist/store/history.js +173 -0
  182. package/dist/store/history.js.map +1 -0
  183. package/dist/store/measurement.d.ts +5 -0
  184. package/dist/store/measurement.d.ts.map +1 -0
  185. package/dist/store/measurement.js +20 -0
  186. package/dist/store/measurement.js.map +1 -0
  187. package/dist/store/notify.d.ts +11 -0
  188. package/dist/store/notify.d.ts.map +1 -0
  189. package/dist/store/notify.js +26 -0
  190. package/dist/store/notify.js.map +1 -0
  191. package/dist/store/published.d.ts +50 -0
  192. package/dist/store/published.d.ts.map +1 -0
  193. package/dist/store/published.js +27 -0
  194. package/dist/store/published.js.map +1 -0
  195. package/dist/store/refusals.d.ts +175 -0
  196. package/dist/store/refusals.d.ts.map +1 -0
  197. package/dist/store/refusals.js +160 -0
  198. package/dist/store/refusals.js.map +1 -0
  199. package/dist/store/steps.d.ts +14 -0
  200. package/dist/store/steps.d.ts.map +1 -0
  201. package/dist/store/steps.js +124 -0
  202. package/dist/store/steps.js.map +1 -0
  203. package/dist/store/store.d.ts +142 -0
  204. package/dist/store/store.d.ts.map +1 -0
  205. package/dist/store/store.js +136 -0
  206. package/dist/store/store.js.map +1 -0
  207. package/dist/store/unchanged.d.ts +12 -0
  208. package/dist/store/unchanged.d.ts.map +1 -0
  209. package/dist/store/unchanged.js +35 -0
  210. package/dist/store/unchanged.js.map +1 -0
  211. package/dist/visual/emit.d.ts +21 -0
  212. package/dist/visual/emit.d.ts.map +1 -0
  213. package/dist/visual/emit.js +133 -0
  214. package/dist/visual/emit.js.map +1 -0
  215. package/dist/visual/parse.d.ts +32 -0
  216. package/dist/visual/parse.d.ts.map +1 -0
  217. package/dist/visual/parse.js +330 -0
  218. package/dist/visual/parse.js.map +1 -0
  219. package/dist/visual/project.d.ts +40 -0
  220. package/dist/visual/project.d.ts.map +1 -0
  221. package/dist/visual/project.js +349 -0
  222. package/dist/visual/project.js.map +1 -0
  223. package/dist/visual/represent.d.ts +50 -0
  224. package/dist/visual/represent.d.ts.map +1 -0
  225. package/dist/visual/represent.js +66 -0
  226. package/dist/visual/represent.js.map +1 -0
  227. package/dist/visual/vocabulary.d.ts +121 -0
  228. package/dist/visual/vocabulary.d.ts.map +1 -0
  229. package/dist/visual/vocabulary.js +32 -0
  230. package/dist/visual/vocabulary.js.map +1 -0
  231. package/package.json +52 -3
@@ -0,0 +1,178 @@
1
+ import { checkSchema, compileInspected, inspectSchemaDocument, layoutShapeContext, layoutShapeErrors, readLayout, } from '@azx-pbc/axiom-compiler';
2
+ import { assertNever } from '@azx-pbc/axiom-runtime';
3
+ import { serializeDocument } from '../schema/document.js';
4
+ import { noteCandidateCompile } from './measurement.js';
5
+ import { authoringRefusal, closedShapeRefusal } from './refusals.js';
6
+ /**
7
+ * The gate a candidate document passes before it becomes the store's state.
8
+ *
9
+ * The hard refusals are the compiler's own predicates, not a second copy of them: the compiled
10
+ * document's inspection (`inspectSchemaDocument`, whose closed-shape walk this gate states as
11
+ * refusals), the layout's grammar, C11 and column arithmetic (`layoutShapeErrors`), and the
12
+ * structural codes of the whole compile's verdict.
13
+ *
14
+ * The layout pass runs **between** the inspection and the compile, and that order is load bearing
15
+ * rather than an optimisation. `checkSchema` is `compile()` as one call, and its stages stop at
16
+ * the first that fails: a draft with a missing translation fails the catalogue stage and never
17
+ * reaches the layout walk, so its verdict says nothing about an illegal placement. The store's
18
+ * drafts carry missing translations almost all the time, so relying on the verdict alone would
19
+ * admit exactly the layouts this gate exists to refuse. The inspection's diagnostics are read
20
+ * here for the same reason and in the documented stage order: a closed-shape refusal first (the
21
+ * document cannot be walked), then the layout, then the compile's other hard codes.
22
+ *
23
+ * The inspection is also the compile's own first stage, so an accepted one is handed back to the
24
+ * compiler instead of being parsed and validated a second time: the authored document is checked
25
+ * once per candidate, not once by each stage. The refusal this gate states first is the
26
+ * closed-shape walk's own (`Inspection.closedShape`), not the compile's reported rendering of it:
27
+ * a curated member check replaces the metaschema clause it restates with a reason that names the
28
+ * member and the repair, and the gate's answer is the clause — the same refusal it stated when it
29
+ * ran that walk itself rather than reading the compile's report.
30
+ *
31
+ * Everything the compile reports that is *not* one of those is a diagnostic: a draft may hold an
32
+ * unfinished expression, an unresolved reference, a cycle or a missing translation, and the store
33
+ * accepts it while reporting exactly what is wrong. That is the soft-acceptance half of the
34
+ * contract — the author is mid-edit, and a store that refused every intermediate state could not
35
+ * be typed into.
36
+ */
37
+ /** The refusal a structural layout diagnostic earns, decided by the structured reason it states. */
38
+ function layoutRefusal(diagnostic) {
39
+ switch (diagnostic.layoutReason) {
40
+ case 'c11':
41
+ return authoringRefusal('C11_VIOLATION', diagnostic.path, diagnostic.detail);
42
+ case 'columns':
43
+ return authoringRefusal('COLUMN_OVERFLOW', diagnostic.path, diagnostic.detail);
44
+ case 'duplicate_field':
45
+ case 'duplicate_step':
46
+ return authoringRefusal('DUPLICATE_ID', diagnostic.path, diagnostic.detail);
47
+ case 'unknown_kind':
48
+ case 'containment':
49
+ case 'foreign_member':
50
+ case 'tone':
51
+ case 'field_missing':
52
+ case 'section_anchor':
53
+ case 'gate_reference':
54
+ case 'summary_field':
55
+ return authoringRefusal('INVALID_LAYOUT', diagnostic.path, diagnostic.detail);
56
+ case undefined:
57
+ // A structural layout diagnostic with no reason predates the structured field; the
58
+ // layout walk is the authority and it now states one, so this arm is the total default.
59
+ return authoringRefusal('INVALID_LAYOUT', diagnostic.path, diagnostic.detail);
60
+ default:
61
+ return assertNever(diagnostic.layoutReason);
62
+ }
63
+ }
64
+ /**
65
+ * The refusal a hard compile diagnostic earns, or `undefined` when a draft may carry it.
66
+ *
67
+ * Every code of the closed set is listed, the soft half included: a code the compiler adds is a
68
+ * typecheck failure here rather than a diagnostic that silently commits a document the store was
69
+ * meant to refuse.
70
+ */
71
+ function hardRefusal(diagnostic) {
72
+ switch (diagnostic.code) {
73
+ case 'JSON_INGEST_ERROR':
74
+ case 'YAML_INGEST_ERROR':
75
+ case 'INVALID_CONTROL':
76
+ case 'INVALID_ROW_KEY':
77
+ case 'INVALID_RULE_SCOPE':
78
+ return authoringRefusal('INVALID_STRUCTURE', diagnostic.path, diagnostic.detail);
79
+ case 'SCHEMA_INVALID':
80
+ return closedShapeRefusal(diagnostic);
81
+ case 'DUPLICATE_IDENTIFIER':
82
+ return authoringRefusal('DUPLICATE_ID', diagnostic.path, diagnostic.detail);
83
+ case 'LAYOUT_STRUCTURE':
84
+ return layoutRefusal(diagnostic);
85
+ // The soft half: a draft may carry each of these while the author works, so the store
86
+ // commits the state and reports the diagnostic on it.
87
+ case 'DUPLICATE_WRITER':
88
+ case 'CYCLE_DETECTED':
89
+ case 'SIGNATURE_COVERAGE':
90
+ case 'INVALID_TEST_VALUE':
91
+ case 'UNRESOLVED_MESSAGE_KEY':
92
+ case 'MESSAGE_LOCALE':
93
+ case 'DATASET_DECLARATION_MISSING':
94
+ case 'MESSAGE_COMPILE_ERROR':
95
+ case 'MESSAGE_BINDING':
96
+ case 'RULE_REFERENCE':
97
+ case 'UNKNOWN_OPTION':
98
+ case 'PRIMARY_SELECTION':
99
+ case 'EXPR_PARSE_ERROR':
100
+ case 'TYPE_MISMATCH':
101
+ case 'UNKNOWN_IDENTIFIER':
102
+ case 'MONEY_ARITHMETIC':
103
+ case 'PATTERN_UNSUPPORTED':
104
+ case 'COST_BUDGET_EXCEEDED':
105
+ case 'TABLE_NOT_DECLARED':
106
+ case 'OVERLAY_REFUSED':
107
+ case 'INVALID_CONSTANT_EXPRESSION':
108
+ return undefined;
109
+ default:
110
+ return assertNever(diagnostic.code);
111
+ }
112
+ }
113
+ /** Only the hard diagnostics of one compile, each as the refusal it earns. */
114
+ function firstHardRefusal(diagnostics) {
115
+ for (const diagnostic of diagnostics) {
116
+ const refusal = hardRefusal(diagnostic);
117
+ if (refusal !== undefined)
118
+ return refusal;
119
+ }
120
+ return undefined;
121
+ }
122
+ /**
123
+ * Checks one candidate: the compiled document's inspection, the layout walk between it and the
124
+ * compile, then the compile whose diagnostics the state carries.
125
+ *
126
+ * The inspection comes first for the reason the module states — a document whose closed shape is
127
+ * wrong cannot be walked by the semantic stages, and one that fails the catalogue stage never
128
+ * reaches the layout walk inside `compile()`. An inspection that finds only soft reasons is not a
129
+ * refusal: the layout pass still runs before the draft is accepted, which is the state an author
130
+ * types in.
131
+ */
132
+ export function checkCandidate(document) {
133
+ const source = serializeDocument(document);
134
+ const inspection = inspectSchemaDocument(source);
135
+ if (!inspection.ok) {
136
+ // The stage order the compile documents, read from one fusion of its first stage: the
137
+ // closed-shape walk's own first reason, then the layout, then the compile's remaining hard
138
+ // codes.
139
+ const closedFirst = inspection.closedShape[0];
140
+ if (closedFirst !== undefined) {
141
+ return { ok: false, refusal: closedShapeRefusal(closedFirst) };
142
+ }
143
+ const layoutFirst = layoutShapeErrors(readLayout(document), layoutShapeContext(document))[0];
144
+ if (layoutFirst !== undefined)
145
+ return { ok: false, refusal: layoutRefusal(layoutFirst) };
146
+ const hard = firstHardRefusal(inspection.diagnostics);
147
+ if (hard !== undefined)
148
+ return { ok: false, refusal: hard };
149
+ return { ok: true, diagnostics: inspection.diagnostics, artifact: undefined };
150
+ }
151
+ const layoutFirst = layoutShapeErrors(readLayout(document), layoutShapeContext(document))[0];
152
+ if (layoutFirst !== undefined)
153
+ return { ok: false, refusal: layoutRefusal(layoutFirst) };
154
+ // The accepted inspection is the compile's own first stage, kept as the artifact instead of
155
+ // discarded: the preview of the state this candidate becomes evaluates it rather than
156
+ // compiling the draft again.
157
+ noteCandidateCompile();
158
+ const checked = compileInspected(inspection);
159
+ if (checked.ok) {
160
+ return { ok: true, diagnostics: [], artifact: { source, schema: checked.schema } };
161
+ }
162
+ const refusal = firstHardRefusal(checked.diagnostics);
163
+ if (refusal !== undefined)
164
+ return { ok: false, refusal };
165
+ return { ok: true, diagnostics: checked.diagnostics, artifact: undefined };
166
+ }
167
+ /**
168
+ * The diagnostics a starting document reports.
169
+ *
170
+ * A caller may hand the store a document it did not build; the state must describe what a build
171
+ * would say about it, so this reads the compile's whole verdict — including a hard reason, which
172
+ * the caller sees here rather than only on the first dispatch that is refused.
173
+ */
174
+ export function initialDiagnostics(document) {
175
+ const checked = checkSchema(serializeDocument(document));
176
+ return checked.ok ? [] : checked.diagnostics;
177
+ }
178
+ //# sourceMappingURL=candidate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"candidate.js","sourceRoot":"","sources":["../../src/store/candidate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,GACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,oGAAoG;AACpG,SAAS,aAAa,CAAC,UAA4B;IACjD,QAAQ,UAAU,CAAC,YAAY,EAAE,CAAC;QAChC,KAAK,KAAK;YACR,OAAO,gBAAgB,CAAC,eAAe,EAAE,UAAU,CAAC,IAAI,EA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IAC7C,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IACrF,CAAC;IACD,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtD,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IACzD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAC7E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAA2B;IAC5D,MAAM,OAAO,GAAG,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzD,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;AAC/C,CAAC","sourcesContent":["import {\n checkSchema,\n compileInspected,\n inspectSchemaDocument,\n layoutShapeContext,\n layoutShapeErrors,\n readLayout,\n} from '@azx-pbc/axiom-compiler';\nimport type { SchemaDiagnostic } from '@azx-pbc/axiom-compiler';\nimport { assertNever } from '@azx-pbc/axiom-runtime';\nimport type { AuthoringDocument } from '../schema/document.js';\nimport { serializeDocument } from '../schema/document.js';\nimport type { HeldPreviewArtifact } from '../preview/held.js';\nimport { noteCandidateCompile } from './measurement.js';\nimport type { AuthoringRefusal } from './refusals.js';\nimport { authoringRefusal, closedShapeRefusal } from './refusals.js';\n\n/**\n * The gate a candidate document passes before it becomes the store's state.\n *\n * The hard refusals are the compiler's own predicates, not a second copy of them: the compiled\n * document's inspection (`inspectSchemaDocument`, whose closed-shape walk this gate states as\n * refusals), the layout's grammar, C11 and column arithmetic (`layoutShapeErrors`), and the\n * structural codes of the whole compile's verdict.\n *\n * The layout pass runs **between** the inspection and the compile, and that order is load bearing\n * rather than an optimisation. `checkSchema` is `compile()` as one call, and its stages stop at\n * the first that fails: a draft with a missing translation fails the catalogue stage and never\n * reaches the layout walk, so its verdict says nothing about an illegal placement. The store's\n * drafts carry missing translations almost all the time, so relying on the verdict alone would\n * admit exactly the layouts this gate exists to refuse. The inspection's diagnostics are read\n * here for the same reason and in the documented stage order: a closed-shape refusal first (the\n * document cannot be walked), then the layout, then the compile's other hard codes.\n *\n * The inspection is also the compile's own first stage, so an accepted one is handed back to the\n * compiler instead of being parsed and validated a second time: the authored document is checked\n * once per candidate, not once by each stage. The refusal this gate states first is the\n * closed-shape walk's own (`Inspection.closedShape`), not the compile's reported rendering of it:\n * a curated member check replaces the metaschema clause it restates with a reason that names the\n * member and the repair, and the gate's answer is the clause — the same refusal it stated when it\n * ran that walk itself rather than reading the compile's report.\n *\n * Everything the compile reports that is *not* one of those is a diagnostic: a draft may hold an\n * unfinished expression, an unresolved reference, a cycle or a missing translation, and the store\n * accepts it while reporting exactly what is wrong. That is the soft-acceptance half of the\n * contract — the author is mid-edit, and a store that refused every intermediate state could not\n * be typed into.\n */\n\n/** The refusal a structural layout diagnostic earns, decided by the structured reason it states. */\nfunction layoutRefusal(diagnostic: SchemaDiagnostic): AuthoringRefusal {\n switch (diagnostic.layoutReason) {\n case 'c11':\n return authoringRefusal('C11_VIOLATION', diagnostic.path, diagnostic.detail);\n case 'columns':\n return authoringRefusal('COLUMN_OVERFLOW', diagnostic.path, diagnostic.detail);\n case 'duplicate_field':\n case 'duplicate_step':\n return authoringRefusal('DUPLICATE_ID', diagnostic.path, diagnostic.detail);\n case 'unknown_kind':\n case 'containment':\n case 'foreign_member':\n case 'tone':\n case 'field_missing':\n case 'section_anchor':\n case 'gate_reference':\n case 'summary_field':\n return authoringRefusal('INVALID_LAYOUT', diagnostic.path, diagnostic.detail);\n case undefined:\n // A structural layout diagnostic with no reason predates the structured field; the\n // layout walk is the authority and it now states one, so this arm is the total default.\n return authoringRefusal('INVALID_LAYOUT', diagnostic.path, diagnostic.detail);\n default:\n return assertNever(diagnostic.layoutReason);\n }\n}\n\n/**\n * The refusal a hard compile diagnostic earns, or `undefined` when a draft may carry it.\n *\n * Every code of the closed set is listed, the soft half included: a code the compiler adds is a\n * typecheck failure here rather than a diagnostic that silently commits a document the store was\n * meant to refuse.\n */\nfunction hardRefusal(diagnostic: SchemaDiagnostic): AuthoringRefusal | undefined {\n switch (diagnostic.code) {\n case 'JSON_INGEST_ERROR':\n case 'YAML_INGEST_ERROR':\n case 'INVALID_CONTROL':\n case 'INVALID_ROW_KEY':\n case 'INVALID_RULE_SCOPE':\n return authoringRefusal('INVALID_STRUCTURE', diagnostic.path, diagnostic.detail);\n case 'SCHEMA_INVALID':\n return closedShapeRefusal(diagnostic);\n case 'DUPLICATE_IDENTIFIER':\n return authoringRefusal('DUPLICATE_ID', diagnostic.path, diagnostic.detail);\n case 'LAYOUT_STRUCTURE':\n return layoutRefusal(diagnostic);\n // The soft half: a draft may carry each of these while the author works, so the store\n // commits the state and reports the diagnostic on it.\n case 'DUPLICATE_WRITER':\n case 'CYCLE_DETECTED':\n case 'SIGNATURE_COVERAGE':\n case 'INVALID_TEST_VALUE':\n case 'UNRESOLVED_MESSAGE_KEY':\n case 'MESSAGE_LOCALE':\n case 'DATASET_DECLARATION_MISSING':\n case 'MESSAGE_COMPILE_ERROR':\n case 'MESSAGE_BINDING':\n case 'RULE_REFERENCE':\n case 'UNKNOWN_OPTION':\n case 'PRIMARY_SELECTION':\n case 'EXPR_PARSE_ERROR':\n case 'TYPE_MISMATCH':\n case 'UNKNOWN_IDENTIFIER':\n case 'MONEY_ARITHMETIC':\n case 'PATTERN_UNSUPPORTED':\n case 'COST_BUDGET_EXCEEDED':\n case 'TABLE_NOT_DECLARED':\n case 'OVERLAY_REFUSED':\n case 'INVALID_CONSTANT_EXPRESSION':\n return undefined;\n default:\n return assertNever(diagnostic.code);\n }\n}\n\n/** Only the hard diagnostics of one compile, each as the refusal it earns. */\nfunction firstHardRefusal(diagnostics: readonly SchemaDiagnostic[]): AuthoringRefusal | undefined {\n for (const diagnostic of diagnostics) {\n const refusal = hardRefusal(diagnostic);\n if (refusal !== undefined) return refusal;\n }\n return undefined;\n}\n\n/** Whether a candidate document may become the store's state, and what it reports if so. */\nexport type CandidateCheck =\n | {\n readonly ok: true;\n readonly diagnostics: readonly SchemaDiagnostic[];\n /**\n * The artifact the compile produced, with the source it read, when the candidate compiled.\n * A draft the compile refuses as a whole (a missing translation) has none.\n */\n readonly artifact: HeldPreviewArtifact | undefined;\n }\n | { readonly ok: false; readonly refusal: AuthoringRefusal };\n\n/**\n * Checks one candidate: the compiled document's inspection, the layout walk between it and the\n * compile, then the compile whose diagnostics the state carries.\n *\n * The inspection comes first for the reason the module states — a document whose closed shape is\n * wrong cannot be walked by the semantic stages, and one that fails the catalogue stage never\n * reaches the layout walk inside `compile()`. An inspection that finds only soft reasons is not a\n * refusal: the layout pass still runs before the draft is accepted, which is the state an author\n * types in.\n */\nexport function checkCandidate(document: AuthoringDocument): CandidateCheck {\n const source = serializeDocument(document);\n const inspection = inspectSchemaDocument(source);\n if (!inspection.ok) {\n // The stage order the compile documents, read from one fusion of its first stage: the\n // closed-shape walk's own first reason, then the layout, then the compile's remaining hard\n // codes.\n const closedFirst = inspection.closedShape[0];\n if (closedFirst !== undefined) {\n return { ok: false, refusal: closedShapeRefusal(closedFirst) };\n }\n const layoutFirst = layoutShapeErrors(readLayout(document), layoutShapeContext(document))[0];\n if (layoutFirst !== undefined) return { ok: false, refusal: layoutRefusal(layoutFirst) };\n const hard = firstHardRefusal(inspection.diagnostics);\n if (hard !== undefined) return { ok: false, refusal: hard };\n return { ok: true, diagnostics: inspection.diagnostics, artifact: undefined };\n }\n\n const layoutFirst = layoutShapeErrors(readLayout(document), layoutShapeContext(document))[0];\n if (layoutFirst !== undefined) return { ok: false, refusal: layoutRefusal(layoutFirst) };\n\n // The accepted inspection is the compile's own first stage, kept as the artifact instead of\n // discarded: the preview of the state this candidate becomes evaluates it rather than\n // compiling the draft again.\n noteCandidateCompile();\n const checked = compileInspected(inspection);\n if (checked.ok) {\n return { ok: true, diagnostics: [], artifact: { source, schema: checked.schema } };\n }\n const refusal = firstHardRefusal(checked.diagnostics);\n if (refusal !== undefined) return { ok: false, refusal };\n return { ok: true, diagnostics: checked.diagnostics, artifact: undefined };\n}\n\n/**\n * The diagnostics a starting document reports.\n *\n * A caller may hand the store a document it did not build; the state must describe what a build\n * would say about it, so this reads the compile's whole verdict — including a hard reason, which\n * the caller sees here rather than only on the first dispatch that is refused.\n */\nexport function initialDiagnostics(document: AuthoringDocument): readonly SchemaDiagnostic[] {\n const checked = checkSchema(serializeDocument(document));\n return checked.ok ? [] : checked.diagnostics;\n}\n"]}
@@ -0,0 +1,58 @@
1
+ import type { AuthoringRefusalCode } from '../refusals.js';
2
+ import type { AuthoringCommand, DatasetCommand } from './shapes.js';
3
+ /**
4
+ * The command that writes each member of the document.
5
+ *
6
+ * This is the contract `metaschema-coverage.test.ts` holds the command set to: a member
7
+ * `spec/metaschema/schema.v1.json` declares must be reachable through a command or the
8
+ * constructor, because a document the compiler admits is one an author must be able to write.
9
+ * The table is data rather than prose so a metaschema member that has no author fails the gate
10
+ * instead of being discovered by a host whose form cannot express it.
11
+ *
12
+ * `createEmptySchema` is a member of the vocabulary for the same reason: a document's identity,
13
+ * expression edition and starting locale are constructor arguments, not edits.
14
+ *
15
+ * A dataset document is a second closed contract with a second command family, so it has a second
16
+ * table beside this one. Neither store can write the other's document, and a member of either
17
+ * metaschema has exactly one vocabulary that reaches it.
18
+ */
19
+ /**
20
+ * The schema-document vocabulary, plus the two members that are not edits: `createEmptySchema`
21
+ * states the document's identity and edition, and `compilerStamp` names a member the *compiler*
22
+ * writes and an authored draft must not — `producerVersion` is the release that compiled an
23
+ * artifact, so an author who could state it could claim an artifact a runtime does not admit.
24
+ */
25
+ export type SchemaCommandAuthor = AuthoringCommand['kind'] | 'createEmptySchema' | 'compilerStamp';
26
+ /** The dataset vocabulary, whose constructor states a table's identity, clock and kind. */
27
+ export type DatasetCommandAuthor = DatasetCommand['kind'] | 'createDatasetTable';
28
+ /** Every author a member can name, across both documents. */
29
+ export type CommandAuthor = SchemaCommandAuthor | DatasetCommandAuthor;
30
+ /**
31
+ * The commands that can author one member.
32
+ *
33
+ * Most members have one author. The alternative shapes are shared by two owners, and each owner
34
+ * has its own command, so their rows name both rather than letting the rule command stand in for
35
+ * an option's list it cannot reach.
36
+ */
37
+ export type MemberAuthors<Author extends CommandAuthor = CommandAuthor> = Author | readonly Author[];
38
+ /** One metaschema definition and the command that authors each of its members. */
39
+ export interface MemberCoverage<Author extends CommandAuthor = CommandAuthor> {
40
+ /** The `$defs` key, or `document` for the root object. */
41
+ readonly definition: string;
42
+ readonly members: Readonly<Record<string, MemberAuthors<Author>>>;
43
+ }
44
+ export declare const COMMAND_COVERAGE: readonly MemberCoverage<SchemaCommandAuthor>[];
45
+ /**
46
+ * Every member `spec/metaschema/dataset.v1.json` declares, and the command that writes it.
47
+ *
48
+ * The definitions without members — the identifier, date, integer and currency patterns and the
49
+ * `scalar`/`outcome` enumerations — are types rather than shapes, so they have no row here; the gate
50
+ * requires a row for every definition that states `properties`, which is the same rule the schema
51
+ * table follows.
52
+ */
53
+ export declare const DATASET_COVERAGE: readonly MemberCoverage<DatasetCommandAuthor>[];
54
+ /** Which suite holds the case that proves a refusal code, and which door produces it. */
55
+ export type RefusalDoor = 'schema' | 'dataset' | 'publish';
56
+ /** The map above, as the exported vocabulary a suite and a host read. */
57
+ export declare const REFUSAL_COVERAGE: Readonly<Record<AuthoringRefusalCode, RefusalDoor>>;
58
+ //# sourceMappingURL=coverage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../../src/store/commands/coverage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,o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
+ schemaId: 'createEmptySchema',
6
+ schemaVersion: 'setSchemaVersion',
7
+ exprVersion: 'createEmptySchema',
8
+ producerVersion: 'compilerStamp',
9
+ titleKey: 'setDocumentTitle',
10
+ context: 'setContextRoot',
11
+ fields: 'addField',
12
+ layout: 'addLayoutNode',
13
+ rules: 'addRule',
14
+ primaryGateId: 'setPrimary',
15
+ primaryScreenId: 'setPrimary',
16
+ messages: 'setMessageText',
17
+ locales: 'setLocales',
18
+ defaultLocale: 'setLocales',
19
+ datasets: 'pinDataset',
20
+ onHide: 'setOnHide',
21
+ },
22
+ },
23
+ {
24
+ definition: 'field',
25
+ members: {
26
+ fieldId: 'addField',
27
+ primitive: 'addField',
28
+ currency: 'addField',
29
+ scale: 'addField',
30
+ units: 'addField',
31
+ unit: 'addField',
32
+ control: 'addField',
33
+ labelKey: 'addField',
34
+ descriptionKey: 'editField',
35
+ placeholderKey: 'editField',
36
+ options: 'addOption',
37
+ optionSource: 'addField',
38
+ rowKey: 'setRowKey',
39
+ items: 'addField',
40
+ fields: 'addRecordArray',
41
+ annotations: 'editField',
42
+ onHide: 'editField',
43
+ covers: 'setSignatureCovers',
44
+ required: 'setFieldDeclaration',
45
+ requiredMessageKey: 'setFieldDeclaration',
46
+ requiredWhen: 'setFieldDeclaration',
47
+ visibleWhen: 'setFieldDeclaration',
48
+ minLength: 'setFieldDeclaration',
49
+ maxLength: 'setFieldDeclaration',
50
+ minLengthMessageKey: 'setFieldDeclaration',
51
+ maxLengthMessageKey: 'setFieldDeclaration',
52
+ minItems: 'setFieldDeclaration',
53
+ maxItems: 'setFieldDeclaration',
54
+ maxScale: 'setFieldDeclaration',
55
+ maxScaleMessageKey: 'setFieldDeclaration',
56
+ minimum: 'setFieldDeclaration',
57
+ maximum: 'setFieldDeclaration',
58
+ minimumMessageKey: 'setFieldDeclaration',
59
+ maximumMessageKey: 'setFieldDeclaration',
60
+ requiredTestCases: 'setFieldDeclaration',
61
+ visibleWhenTestCases: 'setFieldDeclaration',
62
+ minimumTestCases: 'setFieldDeclaration',
63
+ maximumTestCases: 'setFieldDeclaration',
64
+ minLengthTestCases: 'setFieldDeclaration',
65
+ maxLengthTestCases: 'setFieldDeclaration',
66
+ step: 'setFieldDeclaration',
67
+ accept: 'setFieldDeclaration',
68
+ minBytes: 'setFieldDeclaration',
69
+ maxBytes: 'setFieldDeclaration',
70
+ rowsFrom: 'setFieldDeclaration',
71
+ // `rowsFromSource` carries the authored `rowsFrom` text beside the AST the compiler
72
+ // derives from it: an authored draft states the source, and the compiler writes the pair.
73
+ rowsFromSource: 'compilerStamp',
74
+ },
75
+ },
76
+ {
77
+ definition: 'rule',
78
+ members: {
79
+ ruleId: 'addRule',
80
+ kind: 'addRule',
81
+ scope: 'addRule',
82
+ severity: 'addRule',
83
+ evaluateOn: 'addRule',
84
+ expr: 'addRule',
85
+ note: 'setRuleNote',
86
+ fieldId: 'addRule',
87
+ targetFieldId: 'addRule',
88
+ fieldIds: 'addRule',
89
+ messageKey: 'addRule',
90
+ params: 'addRule',
91
+ referWhen: 'addRule',
92
+ reasons: 'addRule',
93
+ overrideFieldId: 'addRule',
94
+ gate: 'addRule',
95
+ suggests: 'setRuleSuggests',
96
+ testCases: 'addRuleTestCase',
97
+ },
98
+ },
99
+ {
100
+ definition: 'gate',
101
+ members: {
102
+ items: 'addRule',
103
+ hard: 'addRule',
104
+ activeWhen: 'addRule',
105
+ onReadOnlyError: 'addRule',
106
+ },
107
+ },
108
+ {
109
+ definition: 'gateItem',
110
+ members: {
111
+ itemId: 'addRule',
112
+ expr: 'addRule',
113
+ messageKey: 'addRule',
114
+ params: 'addRule',
115
+ },
116
+ },
117
+ {
118
+ definition: 'screenReasonDeclaration',
119
+ members: {
120
+ code: 'addRule',
121
+ messageKey: 'addRule',
122
+ params: 'addRule',
123
+ when: 'addRule',
124
+ },
125
+ },
126
+ {
127
+ definition: 'testCase',
128
+ members: {
129
+ caseId: 'addRuleTestCase',
130
+ expected: 'addRuleTestCase',
131
+ values: 'addRuleTestCase',
132
+ context: 'addRuleTestCase',
133
+ redacted: 'addRuleTestCase',
134
+ sessionWrites: 'addRuleTestCase',
135
+ accessOverlay: 'addRuleTestCase',
136
+ recordDate: 'addRuleTestCase',
137
+ capabilities: 'addRuleTestCase',
138
+ tier: 'addRuleTestCase',
139
+ },
140
+ },
141
+ {
142
+ definition: 'contextRoot',
143
+ members: {
144
+ path: 'setContextRoot',
145
+ primitive: 'setContextRoot',
146
+ items: 'setContextRoot',
147
+ nullability: 'setContextRoot',
148
+ // The value domain a host fact is read against: a money root's currency and scale, a
149
+ // quantity root's unit domain and scale, a duration root's unit.
150
+ currency: 'setContextRoot',
151
+ scale: 'setContextRoot',
152
+ units: 'setContextRoot',
153
+ unit: 'setContextRoot',
154
+ },
155
+ },
156
+ {
157
+ definition: 'datasetRef',
158
+ members: {
159
+ tableId: 'pinDataset',
160
+ tableVersion: 'pinDataset',
161
+ },
162
+ },
163
+ {
164
+ definition: 'layoutNode',
165
+ // A layout node is authored as the grammar spells it: `addLayoutNode` takes the node itself,
166
+ // so every member is reachable through that one command and the compiler's walk judges it.
167
+ members: {
168
+ kind: 'addLayoutNode',
169
+ sectionId: 'addLayoutNode',
170
+ titleKey: 'addLayoutNode',
171
+ descriptionKey: 'addLayoutNode',
172
+ textKey: 'addLayoutNode',
173
+ visibleWhen: 'addLayoutNode',
174
+ params: 'addLayoutNode',
175
+ readouts: 'addLayoutNode',
176
+ fields: 'addLayoutNode',
177
+ children: 'addLayoutNode',
178
+ columns: 'addLayoutNode',
179
+ collapsible: 'addLayoutNode',
180
+ defaultExpanded: 'addLayoutNode',
181
+ hideWhenEmpty: 'addLayoutNode',
182
+ stepId: 'addLayoutNode',
183
+ gateId: 'addLayoutNode',
184
+ fieldId: 'addLayoutNode',
185
+ colSpan: 'addLayoutNode',
186
+ tone: 'addLayoutNode',
187
+ },
188
+ },
189
+ {
190
+ definition: 'option',
191
+ members: {
192
+ code: 'addOption',
193
+ labelKey: 'addOption',
194
+ deprecated: 'deprecateOption',
195
+ availableWhen: 'setOptionAvailability',
196
+ unavailableMessageKey: 'setOptionAvailability',
197
+ unavailableParams: 'setOptionAvailability',
198
+ suggests: 'setOptionAvailability',
199
+ },
200
+ },
201
+ {
202
+ definition: 'suggestion',
203
+ // An alternative belongs to the declaration that states it: a rule's list through
204
+ // `setRuleSuggests`, an option's through `setOptionAvailability`, and both through the payload
205
+ // commands (`addRule`, `editRule`). The row names both owners so neither list is answered by a
206
+ // command that cannot find it.
207
+ members: {
208
+ labelKey: ['setRuleSuggests', 'setOptionAvailability'],
209
+ operations: ['setRuleSuggests', 'setOptionAvailability'],
210
+ },
211
+ },
212
+ {
213
+ definition: 'suggestionOperation',
214
+ // Every arm is authored by the operation list its owner states. The coverage reader folds the
215
+ // oneOf branches, so a member that exists on only one arm is still named here.
216
+ members: {
217
+ kind: ['setRuleSuggests', 'setOptionAvailability'],
218
+ ref: ['setRuleSuggests', 'setOptionAvailability'],
219
+ value: ['setRuleSuggests', 'setOptionAvailability'],
220
+ fieldId: ['setRuleSuggests', 'setOptionAvailability'],
221
+ row: ['setRuleSuggests', 'setOptionAvailability'],
222
+ rowKey: ['setRuleSuggests', 'setOptionAvailability'],
223
+ },
224
+ },
225
+ {
226
+ definition: 'suggestedRef',
227
+ members: {
228
+ fieldId: ['setRuleSuggests', 'setOptionAvailability'],
229
+ rowKey: ['setRuleSuggests', 'setOptionAvailability'],
230
+ },
231
+ },
232
+ {
233
+ definition: 'annotation',
234
+ members: {
235
+ pii: 'editField',
236
+ sectionId: 'editField',
237
+ mergeClass: 'editField',
238
+ retentionClass: 'editField',
239
+ searchable: 'editField',
240
+ promote: 'editField',
241
+ deprecated: 'editField',
242
+ },
243
+ },
244
+ ];
245
+ /**
246
+ * Every member `spec/metaschema/dataset.v1.json` declares, and the command that writes it.
247
+ *
248
+ * The definitions without members — the identifier, date, integer and currency patterns and the
249
+ * `scalar`/`outcome` enumerations — are types rather than shapes, so they have no row here; the gate
250
+ * requires a row for every definition that states `properties`, which is the same rule the schema
251
+ * table follows.
252
+ */
253
+ export const DATASET_COVERAGE = [
254
+ {
255
+ definition: 'document',
256
+ members: {
257
+ tableId: 'createDatasetTable',
258
+ tableVersion: 'createDatasetTable',
259
+ binding: 'createDatasetTable',
260
+ kind: 'createDatasetTable',
261
+ effectiveFrom: 'setDatasetEffectiveRange',
262
+ effectiveTo: 'setDatasetEffectiveRange',
263
+ columns: 'setDatasetColumns',
264
+ values: 'setDatasetValues',
265
+ rows: 'addDatasetRow',
266
+ hitPolicy: 'setDatasetHitPolicy',
267
+ collectLimit: 'setDatasetHitPolicy',
268
+ },
269
+ },
270
+ {
271
+ definition: 'column',
272
+ members: {
273
+ columnId: 'setDatasetColumns',
274
+ primitive: 'setDatasetColumns',
275
+ role: 'setDatasetColumns',
276
+ // A quantity column's unit domain and fractional scale, declared with the columns.
277
+ units: 'setDatasetColumns',
278
+ scale: 'setDatasetColumns',
279
+ },
280
+ },
281
+ {
282
+ definition: 'row',
283
+ members: {
284
+ rowId: 'addDatasetRow',
285
+ key: 'addDatasetRow',
286
+ outcome: 'replaceDatasetRow',
287
+ output: 'addDatasetRow',
288
+ },
289
+ },
290
+ {
291
+ definition: 'money',
292
+ members: {
293
+ minor: 'setDatasetCell',
294
+ currency: 'setDatasetCell',
295
+ scale: 'setDatasetCell',
296
+ },
297
+ },
298
+ {
299
+ definition: 'quantity',
300
+ // A dataset's quantity is a scalar value a `set` membership domain holds; a keyed table's
301
+ // column primitive set does not admit one, because the dataset compiler's own reader is the
302
+ // narrower authority there.
303
+ members: {
304
+ value: 'setDatasetValues',
305
+ unit: 'setDatasetValues',
306
+ },
307
+ },
308
+ ];
309
+ /**
310
+ * Every refusal code the store can answer, as a total map.
311
+ *
312
+ * The local `satisfies` is the compile-time proof: a new code in `AuthoringRefusalCode` is a missing
313
+ * key here and fails typecheck, and an extra key is an excess-property error. The exported binding
314
+ * states the same type because `isolatedDeclarations` requires an exported value's type to be
315
+ * written. The suite then asserts that each door's codes appear in that door's case table, so a code
316
+ * with no case is a failure rather than a paragraph in a README. `publish` is separate from
317
+ * `dataset` because a pin mismatch is about two documents, not about one table's own edit.
318
+ */
319
+ const refusalCoverage = {
320
+ MALFORMED_COMMAND: 'schema',
321
+ UNKNOWN_FIELD: 'schema',
322
+ UNKNOWN_OPTION: 'schema',
323
+ MISSING_OPTION_DOMAIN: 'schema',
324
+ UNKNOWN_MESSAGE: 'schema',
325
+ UNDECLARED_LOCALE: 'schema',
326
+ UNKNOWN_RULE: 'schema',
327
+ UNKNOWN_GATE: 'schema',
328
+ UNKNOWN_SCREEN: 'schema',
329
+ UNKNOWN_DATASET: 'schema',
330
+ UNKNOWN_CONTEXT_ROOT: 'schema',
331
+ UNREPRESENTABLE_EXPRESSION: 'schema',
332
+ DUPLICATE_ID: 'schema',
333
+ PUBLISHED_FIELD: 'schema',
334
+ ALREADY_DEPRECATED: 'schema',
335
+ UNKNOWN_LAYOUT: 'schema',
336
+ INVALID_STRUCTURE: 'schema',
337
+ UNKNOWN_PROPERTY: 'schema',
338
+ C11_VIOLATION: 'schema',
339
+ INVALID_LAYOUT: 'schema',
340
+ COLUMN_OVERFLOW: 'schema',
341
+ UNKNOWN_TABLE: 'dataset',
342
+ UNKNOWN_ROW: 'dataset',
343
+ UNKNOWN_COLUMN: 'dataset',
344
+ INVALID_CELL: 'dataset',
345
+ DUPLICATE_KEY: 'dataset',
346
+ INVALID_ROW: 'dataset',
347
+ INVALID_COLUMNS: 'dataset',
348
+ INVALID_TABLE: 'dataset',
349
+ DATASET_PIN_MISMATCH: 'publish',
350
+ STALE_EDITION: 'publish',
351
+ };
352
+ /** The map above, as the exported vocabulary a suite and a host read. */
353
+ export const REFUSAL_COVERAGE = refusalCoverage;
354
+ //# sourceMappingURL=coverage.js.map