@azx-pbc/axiom-compiler 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 (655) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +415 -2
  3. package/dist/article.d.ts +12 -0
  4. package/dist/article.d.ts.map +1 -0
  5. package/dist/article.js +16 -0
  6. package/dist/article.js.map +1 -0
  7. package/dist/cli/args.d.ts +101 -0
  8. package/dist/cli/args.d.ts.map +1 -0
  9. package/dist/cli/args.js +158 -0
  10. package/dist/cli/args.js.map +1 -0
  11. package/dist/cli/check.d.ts +2 -0
  12. package/dist/cli/check.d.ts.map +1 -0
  13. package/dist/cli/check.js +33 -0
  14. package/dist/cli/check.js.map +1 -0
  15. package/dist/cli/compile.d.ts +2 -0
  16. package/dist/cli/compile.d.ts.map +1 -0
  17. package/dist/cli/compile.js +43 -0
  18. package/dist/cli/compile.js.map +1 -0
  19. package/dist/cli/count.d.ts +15 -0
  20. package/dist/cli/count.d.ts.map +1 -0
  21. package/dist/cli/count.js +21 -0
  22. package/dist/cli/count.js.map +1 -0
  23. package/dist/cli/dataset.d.ts +28 -0
  24. package/dist/cli/dataset.d.ts.map +1 -0
  25. package/dist/cli/dataset.js +115 -0
  26. package/dist/cli/dataset.js.map +1 -0
  27. package/dist/cli/diff.d.ts +2 -0
  28. package/dist/cli/diff.d.ts.map +1 -0
  29. package/dist/cli/diff.js +297 -0
  30. package/dist/cli/diff.js.map +1 -0
  31. package/dist/cli/explain.d.ts +2 -0
  32. package/dist/cli/explain.d.ts.map +1 -0
  33. package/dist/cli/explain.js +95 -0
  34. package/dist/cli/explain.js.map +1 -0
  35. package/dist/cli/fields.d.ts +11 -0
  36. package/dist/cli/fields.d.ts.map +1 -0
  37. package/dist/cli/fields.js +13 -0
  38. package/dist/cli/fields.js.map +1 -0
  39. package/dist/cli/main.d.ts +2 -0
  40. package/dist/cli/main.d.ts.map +1 -0
  41. package/dist/cli/main.js +40 -0
  42. package/dist/cli/main.js.map +1 -0
  43. package/dist/cli/read.d.ts +56 -0
  44. package/dist/cli/read.d.ts.map +1 -0
  45. package/dist/cli/read.js +179 -0
  46. package/dist/cli/read.js.map +1 -0
  47. package/dist/cli/render.d.ts +58 -0
  48. package/dist/cli/render.d.ts.map +1 -0
  49. package/dist/cli/render.js +422 -0
  50. package/dist/cli/render.js.map +1 -0
  51. package/dist/cli/schema.d.ts +28 -0
  52. package/dist/cli/schema.d.ts.map +1 -0
  53. package/dist/cli/schema.js +46 -0
  54. package/dist/cli/schema.js.map +1 -0
  55. package/dist/cli/suite-report.d.ts +18 -0
  56. package/dist/cli/suite-report.d.ts.map +1 -0
  57. package/dist/cli/suite-report.js +58 -0
  58. package/dist/cli/suite-report.js.map +1 -0
  59. package/dist/cli/suites.d.ts +25 -0
  60. package/dist/cli/suites.d.ts.map +1 -0
  61. package/dist/cli/suites.js +67 -0
  62. package/dist/cli/suites.js.map +1 -0
  63. package/dist/cli/terminal.d.ts +45 -0
  64. package/dist/cli/terminal.d.ts.map +1 -0
  65. package/dist/cli/terminal.js +119 -0
  66. package/dist/cli/terminal.js.map +1 -0
  67. package/dist/cli/test.d.ts +12 -0
  68. package/dist/cli/test.d.ts.map +1 -0
  69. package/dist/cli/test.js +199 -0
  70. package/dist/cli/test.js.map +1 -0
  71. package/dist/cli/usage.d.ts +15 -0
  72. package/dist/cli/usage.d.ts.map +1 -0
  73. package/dist/cli/usage.js +95 -0
  74. package/dist/cli/usage.js.map +1 -0
  75. package/dist/cli.d.ts +3 -0
  76. package/dist/cli.d.ts.map +1 -0
  77. package/dist/cli.js +51 -0
  78. package/dist/cli.js.map +1 -0
  79. package/dist/compile/artifact-members.d.ts +57 -0
  80. package/dist/compile/artifact-members.d.ts.map +1 -0
  81. package/dist/compile/artifact-members.js +130 -0
  82. package/dist/compile/artifact-members.js.map +1 -0
  83. package/dist/compile/artifact.d.ts +20 -0
  84. package/dist/compile/artifact.d.ts.map +1 -0
  85. package/dist/compile/artifact.js +87 -0
  86. package/dist/compile/artifact.js.map +1 -0
  87. package/dist/compile/compilation.d.ts +46 -0
  88. package/dist/compile/compilation.d.ts.map +1 -0
  89. package/dist/compile/compilation.js +4 -0
  90. package/dist/compile/compilation.js.map +1 -0
  91. package/dist/compile/computed.d.ts +22 -0
  92. package/dist/compile/computed.d.ts.map +1 -0
  93. package/dist/compile/computed.js +245 -0
  94. package/dist/compile/computed.js.map +1 -0
  95. package/dist/compile/condition-warnings.d.ts +12 -0
  96. package/dist/compile/condition-warnings.d.ts.map +1 -0
  97. package/dist/compile/condition-warnings.js +26 -0
  98. package/dist/compile/condition-warnings.js.map +1 -0
  99. package/dist/compile/conditions.d.ts +18 -0
  100. package/dist/compile/conditions.d.ts.map +1 -0
  101. package/dist/compile/conditions.js +22 -0
  102. package/dist/compile/conditions.js.map +1 -0
  103. package/dist/compile/cross-checks.d.ts +67 -0
  104. package/dist/compile/cross-checks.d.ts.map +1 -0
  105. package/dist/compile/cross-checks.js +238 -0
  106. package/dist/compile/cross-checks.js.map +1 -0
  107. package/dist/compile/datasets.d.ts +52 -0
  108. package/dist/compile/datasets.d.ts.map +1 -0
  109. package/dist/compile/datasets.js +183 -0
  110. package/dist/compile/datasets.js.map +1 -0
  111. package/dist/compile/dead-weight.d.ts +26 -0
  112. package/dist/compile/dead-weight.d.ts.map +1 -0
  113. package/dist/compile/dead-weight.js +244 -0
  114. package/dist/compile/dead-weight.js.map +1 -0
  115. package/dist/compile/declaration-rules.d.ts +54 -0
  116. package/dist/compile/declaration-rules.d.ts.map +1 -0
  117. package/dist/compile/declaration-rules.js +510 -0
  118. package/dist/compile/declaration-rules.js.map +1 -0
  119. package/dist/compile/declarations.d.ts +44 -0
  120. package/dist/compile/declarations.d.ts.map +1 -0
  121. package/dist/compile/declarations.js +160 -0
  122. package/dist/compile/declarations.js.map +1 -0
  123. package/dist/compile/document.d.ts +4 -0
  124. package/dist/compile/document.d.ts.map +1 -0
  125. package/dist/compile/document.js +13 -0
  126. package/dist/compile/document.js.map +1 -0
  127. package/dist/compile/expression.d.ts +38 -0
  128. package/dist/compile/expression.d.ts.map +1 -0
  129. package/dist/compile/expression.js +288 -0
  130. package/dist/compile/expression.js.map +1 -0
  131. package/dist/compile/hashes.d.ts +26 -0
  132. package/dist/compile/hashes.d.ts.map +1 -0
  133. package/dist/compile/hashes.js +96 -0
  134. package/dist/compile/hashes.js.map +1 -0
  135. package/dist/compile/item-targets.d.ts +12 -0
  136. package/dist/compile/item-targets.d.ts.map +1 -0
  137. package/dist/compile/item-targets.js +287 -0
  138. package/dist/compile/item-targets.js.map +1 -0
  139. package/dist/compile/messages.d.ts +8 -0
  140. package/dist/compile/messages.d.ts.map +1 -0
  141. package/dist/compile/messages.js +62 -0
  142. package/dist/compile/messages.js.map +1 -0
  143. package/dist/compile/option-availability.d.ts +51 -0
  144. package/dist/compile/option-availability.d.ts.map +1 -0
  145. package/dist/compile/option-availability.js +171 -0
  146. package/dist/compile/option-availability.js.map +1 -0
  147. package/dist/compile/option-codes.d.ts +27 -0
  148. package/dist/compile/option-codes.d.ts.map +1 -0
  149. package/dist/compile/option-codes.js +212 -0
  150. package/dist/compile/option-codes.js.map +1 -0
  151. package/dist/compile/references.d.ts +14 -0
  152. package/dist/compile/references.d.ts.map +1 -0
  153. package/dist/compile/references.js +126 -0
  154. package/dist/compile/references.js.map +1 -0
  155. package/dist/compile/rows-from.d.ts +27 -0
  156. package/dist/compile/rows-from.d.ts.map +1 -0
  157. package/dist/compile/rows-from.js +164 -0
  158. package/dist/compile/rows-from.js.map +1 -0
  159. package/dist/compile/rules.d.ts +58 -0
  160. package/dist/compile/rules.d.ts.map +1 -0
  161. package/dist/compile/rules.js +327 -0
  162. package/dist/compile/rules.js.map +1 -0
  163. package/dist/compile/suggestions.d.ts +52 -0
  164. package/dist/compile/suggestions.d.ts.map +1 -0
  165. package/dist/compile/suggestions.js +633 -0
  166. package/dist/compile/suggestions.js.map +1 -0
  167. package/dist/compile/targets.d.ts +22 -0
  168. package/dist/compile/targets.d.ts.map +1 -0
  169. package/dist/compile/targets.js +125 -0
  170. package/dist/compile/targets.js.map +1 -0
  171. package/dist/compile/types.d.ts +84 -0
  172. package/dist/compile/types.d.ts.map +1 -0
  173. package/dist/compile/types.js +2 -0
  174. package/dist/compile/types.js.map +1 -0
  175. package/dist/compile/warning.d.ts +45 -0
  176. package/dist/compile/warning.d.ts.map +1 -0
  177. package/dist/compile/warning.js +2 -0
  178. package/dist/compile/warning.js.map +1 -0
  179. package/dist/compile-yaml.d.ts +23 -0
  180. package/dist/compile-yaml.d.ts.map +1 -0
  181. package/dist/compile-yaml.js +30 -0
  182. package/dist/compile-yaml.js.map +1 -0
  183. package/dist/compile.d.ts +78 -0
  184. package/dist/compile.d.ts.map +1 -0
  185. package/dist/compile.js +372 -0
  186. package/dist/compile.js.map +1 -0
  187. package/dist/csv/limits.d.ts +43 -0
  188. package/dist/csv/limits.d.ts.map +1 -0
  189. package/dist/csv/limits.js +51 -0
  190. package/dist/csv/limits.js.map +1 -0
  191. package/dist/csv/scalar.d.ts +33 -0
  192. package/dist/csv/scalar.d.ts.map +1 -0
  193. package/dist/csv/scalar.js +77 -0
  194. package/dist/csv/scalar.js.map +1 -0
  195. package/dist/datasets/csv.d.ts +46 -0
  196. package/dist/datasets/csv.d.ts.map +1 -0
  197. package/dist/datasets/csv.js +293 -0
  198. package/dist/datasets/csv.js.map +1 -0
  199. package/dist/datasets/declaration.d.ts +16 -0
  200. package/dist/datasets/declaration.d.ts.map +1 -0
  201. package/dist/datasets/declaration.js +104 -0
  202. package/dist/datasets/declaration.js.map +1 -0
  203. package/dist/datasets/diagnostics.d.ts +65 -0
  204. package/dist/datasets/diagnostics.d.ts.map +1 -0
  205. package/dist/datasets/diagnostics.js +2 -0
  206. package/dist/datasets/diagnostics.js.map +1 -0
  207. package/dist/datasets/diff.d.ts +46 -0
  208. package/dist/datasets/diff.d.ts.map +1 -0
  209. package/dist/datasets/diff.js +84 -0
  210. package/dist/datasets/diff.js.map +1 -0
  211. package/dist/datasets/document.d.ts +12 -0
  212. package/dist/datasets/document.d.ts.map +1 -0
  213. package/dist/datasets/document.js +382 -0
  214. package/dist/datasets/document.js.map +1 -0
  215. package/dist/datasets/index.d.ts +43 -0
  216. package/dist/datasets/index.d.ts.map +1 -0
  217. package/dist/datasets/index.js +68 -0
  218. package/dist/datasets/index.js.map +1 -0
  219. package/dist/datasets/repair.d.ts +26 -0
  220. package/dist/datasets/repair.d.ts.map +1 -0
  221. package/dist/datasets/repair.js +60 -0
  222. package/dist/datasets/repair.js.map +1 -0
  223. package/dist/document-path.d.ts +62 -0
  224. package/dist/document-path.d.ts.map +1 -0
  225. package/dist/document-path.js +200 -0
  226. package/dist/document-path.js.map +1 -0
  227. package/dist/expr/boundary.d.ts +8 -0
  228. package/dist/expr/boundary.d.ts.map +1 -0
  229. package/dist/expr/boundary.js +243 -0
  230. package/dist/expr/boundary.js.map +1 -0
  231. package/dist/expr/compile-expr.d.ts +35 -0
  232. package/dist/expr/compile-expr.d.ts.map +1 -0
  233. package/dist/expr/compile-expr.js +66 -0
  234. package/dist/expr/compile-expr.js.map +1 -0
  235. package/dist/expr/deprecation.d.ts +23 -0
  236. package/dist/expr/deprecation.d.ts.map +1 -0
  237. package/dist/expr/deprecation.js +28 -0
  238. package/dist/expr/deprecation.js.map +1 -0
  239. package/dist/expr/diagnostics.d.ts +31 -0
  240. package/dist/expr/diagnostics.d.ts.map +1 -0
  241. package/dist/expr/diagnostics.js +34 -0
  242. package/dist/expr/diagnostics.js.map +1 -0
  243. package/dist/expr/lexer.d.ts +49 -0
  244. package/dist/expr/lexer.d.ts.map +1 -0
  245. package/dist/expr/lexer.js +277 -0
  246. package/dist/expr/lexer.js.map +1 -0
  247. package/dist/expr/lint-warnings.d.ts +11 -0
  248. package/dist/expr/lint-warnings.d.ts.map +1 -0
  249. package/dist/expr/lint-warnings.js +20 -0
  250. package/dist/expr/lint-warnings.js.map +1 -0
  251. package/dist/expr/lint.d.ts +41 -0
  252. package/dist/expr/lint.d.ts.map +1 -0
  253. package/dist/expr/lint.js +1034 -0
  254. package/dist/expr/lint.js.map +1 -0
  255. package/dist/expr/parse/aggregates.d.ts +13 -0
  256. package/dist/expr/parse/aggregates.d.ts.map +1 -0
  257. package/dist/expr/parse/aggregates.js +48 -0
  258. package/dist/expr/parse/aggregates.js.map +1 -0
  259. package/dist/expr/parse/budget.d.ts +11 -0
  260. package/dist/expr/parse/budget.d.ts.map +1 -0
  261. package/dist/expr/parse/budget.js +57 -0
  262. package/dist/expr/parse/budget.js.map +1 -0
  263. package/dist/expr/parse/grammar.d.ts +9 -0
  264. package/dist/expr/parse/grammar.d.ts.map +1 -0
  265. package/dist/expr/parse/grammar.js +699 -0
  266. package/dist/expr/parse/grammar.js.map +1 -0
  267. package/dist/expr/parse/literals.d.ts +20 -0
  268. package/dist/expr/parse/literals.d.ts.map +1 -0
  269. package/dist/expr/parse/literals.js +132 -0
  270. package/dist/expr/parse/literals.js.map +1 -0
  271. package/dist/expr/parse/stream.d.ts +60 -0
  272. package/dist/expr/parse/stream.d.ts.map +1 -0
  273. package/dist/expr/parse/stream.js +151 -0
  274. package/dist/expr/parse/stream.js.map +1 -0
  275. package/dist/expr/parser.d.ts +45 -0
  276. package/dist/expr/parser.d.ts.map +1 -0
  277. package/dist/expr/parser.js +110 -0
  278. package/dist/expr/parser.js.map +1 -0
  279. package/dist/expr/print/spell.d.ts +78 -0
  280. package/dist/expr/print/spell.d.ts.map +1 -0
  281. package/dist/expr/print/spell.js +592 -0
  282. package/dist/expr/print/spell.js.map +1 -0
  283. package/dist/expr/print.d.ts +20 -0
  284. package/dist/expr/print.d.ts.map +1 -0
  285. package/dist/expr/print.js +102 -0
  286. package/dist/expr/print.js.map +1 -0
  287. package/dist/expr/suggest.d.ts +26 -0
  288. package/dist/expr/suggest.d.ts.map +1 -0
  289. package/dist/expr/suggest.js +77 -0
  290. package/dist/expr/suggest.js.map +1 -0
  291. package/dist/expr/typecheck/aggregates.d.ts +8 -0
  292. package/dist/expr/typecheck/aggregates.d.ts.map +1 -0
  293. package/dist/expr/typecheck/aggregates.js +334 -0
  294. package/dist/expr/typecheck/aggregates.js.map +1 -0
  295. package/dist/expr/typecheck/arithmetic.d.ts +6 -0
  296. package/dist/expr/typecheck/arithmetic.d.ts.map +1 -0
  297. package/dist/expr/typecheck/arithmetic.js +258 -0
  298. package/dist/expr/typecheck/arithmetic.js.map +1 -0
  299. package/dist/expr/typecheck/arity.d.ts +38 -0
  300. package/dist/expr/typecheck/arity.d.ts.map +1 -0
  301. package/dist/expr/typecheck/arity.js +173 -0
  302. package/dist/expr/typecheck/arity.js.map +1 -0
  303. package/dist/expr/typecheck/calls.d.ts +6 -0
  304. package/dist/expr/typecheck/calls.d.ts.map +1 -0
  305. package/dist/expr/typecheck/calls.js +137 -0
  306. package/dist/expr/typecheck/calls.js.map +1 -0
  307. package/dist/expr/typecheck/comparison.d.ts +13 -0
  308. package/dist/expr/typecheck/comparison.d.ts.map +1 -0
  309. package/dist/expr/typecheck/comparison.js +200 -0
  310. package/dist/expr/typecheck/comparison.js.map +1 -0
  311. package/dist/expr/typecheck/compound.d.ts +24 -0
  312. package/dist/expr/typecheck/compound.d.ts.map +1 -0
  313. package/dist/expr/typecheck/compound.js +175 -0
  314. package/dist/expr/typecheck/compound.js.map +1 -0
  315. package/dist/expr/typecheck/context.d.ts +44 -0
  316. package/dist/expr/typecheck/context.d.ts.map +1 -0
  317. package/dist/expr/typecheck/context.js +2 -0
  318. package/dist/expr/typecheck/context.js.map +1 -0
  319. package/dist/expr/typecheck/datasets.d.ts +17 -0
  320. package/dist/expr/typecheck/datasets.d.ts.map +1 -0
  321. package/dist/expr/typecheck/datasets.js +136 -0
  322. package/dist/expr/typecheck/datasets.js.map +1 -0
  323. package/dist/expr/typecheck/digest.d.ts +7 -0
  324. package/dist/expr/typecheck/digest.d.ts.map +1 -0
  325. package/dist/expr/typecheck/digest.js +44 -0
  326. package/dist/expr/typecheck/digest.js.map +1 -0
  327. package/dist/expr/typecheck/fold.d.ts +41 -0
  328. package/dist/expr/typecheck/fold.d.ts.map +1 -0
  329. package/dist/expr/typecheck/fold.js +71 -0
  330. package/dist/expr/typecheck/fold.js.map +1 -0
  331. package/dist/expr/typecheck/gate-folds.d.ts +22 -0
  332. package/dist/expr/typecheck/gate-folds.d.ts.map +1 -0
  333. package/dist/expr/typecheck/gate-folds.js +40 -0
  334. package/dist/expr/typecheck/gate-folds.js.map +1 -0
  335. package/dist/expr/typecheck/guards.d.ts +6 -0
  336. package/dist/expr/typecheck/guards.d.ts.map +1 -0
  337. package/dist/expr/typecheck/guards.js +38 -0
  338. package/dist/expr/typecheck/guards.js.map +1 -0
  339. package/dist/expr/typecheck/member.d.ts +17 -0
  340. package/dist/expr/typecheck/member.d.ts.map +1 -0
  341. package/dist/expr/typecheck/member.js +46 -0
  342. package/dist/expr/typecheck/member.js.map +1 -0
  343. package/dist/expr/typecheck/money.d.ts +8 -0
  344. package/dist/expr/typecheck/money.d.ts.map +1 -0
  345. package/dist/expr/typecheck/money.js +49 -0
  346. package/dist/expr/typecheck/money.js.map +1 -0
  347. package/dist/expr/typecheck/numeric.d.ts +8 -0
  348. package/dist/expr/typecheck/numeric.d.ts.map +1 -0
  349. package/dist/expr/typecheck/numeric.js +84 -0
  350. package/dist/expr/typecheck/numeric.js.map +1 -0
  351. package/dist/expr/typecheck/operands.d.ts +27 -0
  352. package/dist/expr/typecheck/operands.d.ts.map +1 -0
  353. package/dist/expr/typecheck/operands.js +106 -0
  354. package/dist/expr/typecheck/operands.js.map +1 -0
  355. package/dist/expr/typecheck/paths.d.ts +21 -0
  356. package/dist/expr/typecheck/paths.d.ts.map +1 -0
  357. package/dist/expr/typecheck/paths.js +321 -0
  358. package/dist/expr/typecheck/paths.js.map +1 -0
  359. package/dist/expr/typecheck/records.d.ts +24 -0
  360. package/dist/expr/typecheck/records.d.ts.map +1 -0
  361. package/dist/expr/typecheck/records.js +53 -0
  362. package/dist/expr/typecheck/records.js.map +1 -0
  363. package/dist/expr/typecheck/sequences.d.ts +15 -0
  364. package/dist/expr/typecheck/sequences.d.ts.map +1 -0
  365. package/dist/expr/typecheck/sequences.js +55 -0
  366. package/dist/expr/typecheck/sequences.js.map +1 -0
  367. package/dist/expr/typecheck/strings.d.ts +8 -0
  368. package/dist/expr/typecheck/strings.d.ts.map +1 -0
  369. package/dist/expr/typecheck/strings.js +188 -0
  370. package/dist/expr/typecheck/strings.js.map +1 -0
  371. package/dist/expr/typecheck/temporal.d.ts +7 -0
  372. package/dist/expr/typecheck/temporal.d.ts.map +1 -0
  373. package/dist/expr/typecheck/temporal.js +80 -0
  374. package/dist/expr/typecheck/temporal.js.map +1 -0
  375. package/dist/expr/typecheck/types.d.ts +163 -0
  376. package/dist/expr/typecheck/types.d.ts.map +1 -0
  377. package/dist/expr/typecheck/types.js +404 -0
  378. package/dist/expr/typecheck/types.js.map +1 -0
  379. package/dist/expr/typecheck.d.ts +75 -0
  380. package/dist/expr/typecheck.d.ts.map +1 -0
  381. package/dist/expr/typecheck.js +242 -0
  382. package/dist/expr/typecheck.js.map +1 -0
  383. package/dist/expr/undecided.d.ts +13 -0
  384. package/dist/expr/undecided.d.ts.map +1 -0
  385. package/dist/expr/undecided.js +58 -0
  386. package/dist/expr/undecided.js.map +1 -0
  387. package/dist/expr/values/code-points.d.ts +13 -0
  388. package/dist/expr/values/code-points.d.ts.map +1 -0
  389. package/dist/expr/values/code-points.js +25 -0
  390. package/dist/expr/values/code-points.js.map +1 -0
  391. package/dist/expr/values/inline.d.ts +77 -0
  392. package/dist/expr/values/inline.d.ts.map +1 -0
  393. package/dist/expr/values/inline.js +404 -0
  394. package/dist/expr/values/inline.js.map +1 -0
  395. package/dist/expr/values/interval.d.ts +19 -0
  396. package/dist/expr/values/interval.d.ts.map +1 -0
  397. package/dist/expr/values/interval.js +1180 -0
  398. package/dist/expr/values/interval.js.map +1 -0
  399. package/dist/index.d.ts +163 -0
  400. package/dist/index.d.ts.map +1 -0
  401. package/dist/index.js +128 -0
  402. package/dist/index.js.map +1 -0
  403. package/dist/ingest/document.d.ts +58 -0
  404. package/dist/ingest/document.d.ts.map +1 -0
  405. package/dist/ingest/document.js +83 -0
  406. package/dist/ingest/document.js.map +1 -0
  407. package/dist/ingest/yaml-document.d.ts +15 -0
  408. package/dist/ingest/yaml-document.d.ts.map +1 -0
  409. package/dist/ingest/yaml-document.js +42 -0
  410. package/dist/ingest/yaml-document.js.map +1 -0
  411. package/dist/ingest/yaml.d.ts +51 -0
  412. package/dist/ingest/yaml.d.ts.map +1 -0
  413. package/dist/ingest/yaml.js +340 -0
  414. package/dist/ingest/yaml.js.map +1 -0
  415. package/dist/layout/compile.d.ts +6 -0
  416. package/dist/layout/compile.d.ts.map +1 -0
  417. package/dist/layout/compile.js +224 -0
  418. package/dist/layout/compile.js.map +1 -0
  419. package/dist/layout/context.d.ts +12 -0
  420. package/dist/layout/context.d.ts.map +1 -0
  421. package/dist/layout/context.js +26 -0
  422. package/dist/layout/context.js.map +1 -0
  423. package/dist/layout/grammar.d.ts +34 -0
  424. package/dist/layout/grammar.d.ts.map +1 -0
  425. package/dist/layout/grammar.js +171 -0
  426. package/dist/layout/grammar.js.map +1 -0
  427. package/dist/layout/read.d.ts +54 -0
  428. package/dist/layout/read.d.ts.map +1 -0
  429. package/dist/layout/read.js +101 -0
  430. package/dist/layout/read.js.map +1 -0
  431. package/dist/layout/shape.d.ts +34 -0
  432. package/dist/layout/shape.d.ts.map +1 -0
  433. package/dist/layout/shape.js +149 -0
  434. package/dist/layout/shape.js.map +1 -0
  435. package/dist/messages/compile.d.ts +47 -0
  436. package/dist/messages/compile.d.ts.map +1 -0
  437. package/dist/messages/compile.js +202 -0
  438. package/dist/messages/compile.js.map +1 -0
  439. package/dist/messages/locale.d.ts +18 -0
  440. package/dist/messages/locale.d.ts.map +1 -0
  441. package/dist/messages/locale.js +33 -0
  442. package/dist/messages/locale.js.map +1 -0
  443. package/dist/messages/slots.d.ts +54 -0
  444. package/dist/messages/slots.d.ts.map +1 -0
  445. package/dist/messages/slots.js +137 -0
  446. package/dist/messages/slots.js.map +1 -0
  447. package/dist/overlay/compile-overlay.d.ts +29 -0
  448. package/dist/overlay/compile-overlay.d.ts.map +1 -0
  449. package/dist/overlay/compile-overlay.js +120 -0
  450. package/dist/overlay/compile-overlay.js.map +1 -0
  451. package/dist/overlay/compose.d.ts +26 -0
  452. package/dist/overlay/compose.d.ts.map +1 -0
  453. package/dist/overlay/compose.js +674 -0
  454. package/dist/overlay/compose.js.map +1 -0
  455. package/dist/overlay/types.d.ts +41 -0
  456. package/dist/overlay/types.d.ts.map +1 -0
  457. package/dist/overlay/types.js +2 -0
  458. package/dist/overlay/types.js.map +1 -0
  459. package/dist/publish/classify.d.ts +50 -0
  460. package/dist/publish/classify.d.ts.map +1 -0
  461. package/dist/publish/classify.js +85 -0
  462. package/dist/publish/classify.js.map +1 -0
  463. package/dist/publish/environment.d.ts +15 -0
  464. package/dist/publish/environment.d.ts.map +1 -0
  465. package/dist/publish/environment.js +2 -0
  466. package/dist/publish/environment.js.map +1 -0
  467. package/dist/publish/migrations.d.ts +108 -0
  468. package/dist/publish/migrations.d.ts.map +1 -0
  469. package/dist/publish/migrations.js +166 -0
  470. package/dist/publish/migrations.js.map +1 -0
  471. package/dist/publish/observation.d.ts +29 -0
  472. package/dist/publish/observation.d.ts.map +1 -0
  473. package/dist/publish/observation.js +43 -0
  474. package/dist/publish/observation.js.map +1 -0
  475. package/dist/publish/readiness.d.ts +197 -0
  476. package/dist/publish/readiness.d.ts.map +1 -0
  477. package/dist/publish/readiness.js +239 -0
  478. package/dist/publish/readiness.js.map +1 -0
  479. package/dist/publish/vectors.d.ts +50 -0
  480. package/dist/publish/vectors.d.ts.map +1 -0
  481. package/dist/publish/vectors.js +306 -0
  482. package/dist/publish/vectors.js.map +1 -0
  483. package/dist/publish/verify.d.ts +146 -0
  484. package/dist/publish/verify.d.ts.map +1 -0
  485. package/dist/publish/verify.js +548 -0
  486. package/dist/publish/verify.js.map +1 -0
  487. package/dist/scenarios/branch.d.ts +36 -0
  488. package/dist/scenarios/branch.d.ts.map +1 -0
  489. package/dist/scenarios/branch.js +30 -0
  490. package/dist/scenarios/branch.js.map +1 -0
  491. package/dist/scenarios/capture.d.ts +89 -0
  492. package/dist/scenarios/capture.d.ts.map +1 -0
  493. package/dist/scenarios/capture.js +443 -0
  494. package/dist/scenarios/capture.js.map +1 -0
  495. package/dist/scenarios/classifier.d.ts +20 -0
  496. package/dist/scenarios/classifier.d.ts.map +1 -0
  497. package/dist/scenarios/classifier.js +88 -0
  498. package/dist/scenarios/classifier.js.map +1 -0
  499. package/dist/scenarios/credit.d.ts +33 -0
  500. package/dist/scenarios/credit.d.ts.map +1 -0
  501. package/dist/scenarios/credit.js +330 -0
  502. package/dist/scenarios/credit.js.map +1 -0
  503. package/dist/scenarios/csv.d.ts +34 -0
  504. package/dist/scenarios/csv.d.ts.map +1 -0
  505. package/dist/scenarios/csv.js +1047 -0
  506. package/dist/scenarios/csv.js.map +1 -0
  507. package/dist/scenarios/data-identity.d.ts +39 -0
  508. package/dist/scenarios/data-identity.d.ts.map +1 -0
  509. package/dist/scenarios/data-identity.js +28 -0
  510. package/dist/scenarios/data-identity.js.map +1 -0
  511. package/dist/scenarios/document.d.ts +148 -0
  512. package/dist/scenarios/document.d.ts.map +1 -0
  513. package/dist/scenarios/document.js +513 -0
  514. package/dist/scenarios/document.js.map +1 -0
  515. package/dist/scenarios/environment.d.ts +64 -0
  516. package/dist/scenarios/environment.d.ts.map +1 -0
  517. package/dist/scenarios/environment.js +106 -0
  518. package/dist/scenarios/environment.js.map +1 -0
  519. package/dist/scenarios/evidence.d.ts +128 -0
  520. package/dist/scenarios/evidence.d.ts.map +1 -0
  521. package/dist/scenarios/evidence.js +179 -0
  522. package/dist/scenarios/evidence.js.map +1 -0
  523. package/dist/scenarios/expectations.d.ts +63 -0
  524. package/dist/scenarios/expectations.d.ts.map +1 -0
  525. package/dist/scenarios/expectations.js +490 -0
  526. package/dist/scenarios/expectations.js.map +1 -0
  527. package/dist/scenarios/references.d.ts +15 -0
  528. package/dist/scenarios/references.d.ts.map +1 -0
  529. package/dist/scenarios/references.js +239 -0
  530. package/dist/scenarios/references.js.map +1 -0
  531. package/dist/scenarios/report.d.ts +216 -0
  532. package/dist/scenarios/report.d.ts.map +1 -0
  533. package/dist/scenarios/report.js +54 -0
  534. package/dist/scenarios/report.js.map +1 -0
  535. package/dist/scenarios/runner.d.ts +55 -0
  536. package/dist/scenarios/runner.d.ts.map +1 -0
  537. package/dist/scenarios/runner.js +205 -0
  538. package/dist/scenarios/runner.js.map +1 -0
  539. package/dist/scenarios/vocabulary.d.ts +19 -0
  540. package/dist/scenarios/vocabulary.d.ts.map +1 -0
  541. package/dist/scenarios/vocabulary.js +56 -0
  542. package/dist/scenarios/vocabulary.js.map +1 -0
  543. package/dist/schema/catalogue.d.ts +54 -0
  544. package/dist/schema/catalogue.d.ts.map +1 -0
  545. package/dist/schema/catalogue.js +221 -0
  546. package/dist/schema/catalogue.js.map +1 -0
  547. package/dist/schema/check.d.ts +22 -0
  548. package/dist/schema/check.d.ts.map +1 -0
  549. package/dist/schema/check.js +30 -0
  550. package/dist/schema/check.js.map +1 -0
  551. package/dist/schema/closed.d.ts +19 -0
  552. package/dist/schema/closed.d.ts.map +1 -0
  553. package/dist/schema/closed.js +33 -0
  554. package/dist/schema/closed.js.map +1 -0
  555. package/dist/schema/collapse.d.ts +27 -0
  556. package/dist/schema/collapse.d.ts.map +1 -0
  557. package/dist/schema/collapse.js +143 -0
  558. package/dist/schema/collapse.js.map +1 -0
  559. package/dist/schema/controls.d.ts +46 -0
  560. package/dist/schema/controls.d.ts.map +1 -0
  561. package/dist/schema/controls.js +75 -0
  562. package/dist/schema/controls.js.map +1 -0
  563. package/dist/schema/dataset-declaration.d.ts +11 -0
  564. package/dist/schema/dataset-declaration.d.ts.map +1 -0
  565. package/dist/schema/dataset-declaration.js +11 -0
  566. package/dist/schema/dataset-declaration.js.map +1 -0
  567. package/dist/schema/declaration-warnings.d.ts +14 -0
  568. package/dist/schema/declaration-warnings.d.ts.map +1 -0
  569. package/dist/schema/declaration-warnings.js +77 -0
  570. package/dist/schema/declaration-warnings.js.map +1 -0
  571. package/dist/schema/declarations.d.ts +41 -0
  572. package/dist/schema/declarations.d.ts.map +1 -0
  573. package/dist/schema/declarations.js +1299 -0
  574. package/dist/schema/declarations.js.map +1 -0
  575. package/dist/schema/diagnostic.d.ts +118 -0
  576. package/dist/schema/diagnostic.d.ts.map +1 -0
  577. package/dist/schema/diagnostic.js +39 -0
  578. package/dist/schema/diagnostic.js.map +1 -0
  579. package/dist/schema/document.d.ts +93 -0
  580. package/dist/schema/document.d.ts.map +1 -0
  581. package/dist/schema/document.js +507 -0
  582. package/dist/schema/document.js.map +1 -0
  583. package/dist/schema/fields.d.ts +11 -0
  584. package/dist/schema/fields.d.ts.map +1 -0
  585. package/dist/schema/fields.js +265 -0
  586. package/dist/schema/fields.js.map +1 -0
  587. package/dist/schema/gates.d.ts +4 -0
  588. package/dist/schema/gates.d.ts.map +1 -0
  589. package/dist/schema/gates.js +68 -0
  590. package/dist/schema/gates.js.map +1 -0
  591. package/dist/schema/located.d.ts +27 -0
  592. package/dist/schema/located.d.ts.map +1 -0
  593. package/dist/schema/located.js +56 -0
  594. package/dist/schema/located.js.map +1 -0
  595. package/dist/schema/measurement.d.ts +9 -0
  596. package/dist/schema/measurement.d.ts.map +1 -0
  597. package/dist/schema/measurement.js +38 -0
  598. package/dist/schema/measurement.js.map +1 -0
  599. package/dist/schema/member-wording.d.ts +35 -0
  600. package/dist/schema/member-wording.d.ts.map +1 -0
  601. package/dist/schema/member-wording.js +286 -0
  602. package/dist/schema/member-wording.js.map +1 -0
  603. package/dist/schema/metaschema.d.ts +20 -0
  604. package/dist/schema/metaschema.d.ts.map +1 -0
  605. package/dist/schema/metaschema.js +476 -0
  606. package/dist/schema/metaschema.js.map +1 -0
  607. package/dist/schema/pointer.d.ts +31 -0
  608. package/dist/schema/pointer.d.ts.map +1 -0
  609. package/dist/schema/pointer.js +73 -0
  610. package/dist/schema/pointer.js.map +1 -0
  611. package/dist/schema/primary.d.ts +29 -0
  612. package/dist/schema/primary.d.ts.map +1 -0
  613. package/dist/schema/primary.js +48 -0
  614. package/dist/schema/primary.js.map +1 -0
  615. package/dist/schema/publish-vector.d.ts +17 -0
  616. package/dist/schema/publish-vector.d.ts.map +1 -0
  617. package/dist/schema/publish-vector.js +34 -0
  618. package/dist/schema/publish-vector.js.map +1 -0
  619. package/dist/schema/repair.d.ts +34 -0
  620. package/dist/schema/repair.d.ts.map +1 -0
  621. package/dist/schema/repair.js +163 -0
  622. package/dist/schema/repair.js.map +1 -0
  623. package/dist/schema/schema-v1.generated.d.ts +14 -0
  624. package/dist/schema/schema-v1.generated.d.ts.map +1 -0
  625. package/dist/schema/schema-v1.generated.js +7089 -0
  626. package/dist/schema/schema-v1.generated.js.map +1 -0
  627. package/dist/schema/screens.d.ts +4 -0
  628. package/dist/schema/screens.d.ts.map +1 -0
  629. package/dist/schema/screens.js +28 -0
  630. package/dist/schema/screens.js.map +1 -0
  631. package/dist/schema/test-values.d.ts +12 -0
  632. package/dist/schema/test-values.d.ts.map +1 -0
  633. package/dist/schema/test-values.js +97 -0
  634. package/dist/schema/test-values.js.map +1 -0
  635. package/dist/schema/unions.d.ts +46 -0
  636. package/dist/schema/unions.d.ts.map +1 -0
  637. package/dist/schema/unions.js +131 -0
  638. package/dist/schema/unions.js.map +1 -0
  639. package/dist/schema/validate-yaml.d.ts +14 -0
  640. package/dist/schema/validate-yaml.d.ts.map +1 -0
  641. package/dist/schema/validate-yaml.js +17 -0
  642. package/dist/schema/validate-yaml.js.map +1 -0
  643. package/dist/schema/validate.d.ts +46 -0
  644. package/dist/schema/validate.d.ts.map +1 -0
  645. package/dist/schema/validate.js +186 -0
  646. package/dist/schema/validate.js.map +1 -0
  647. package/dist/testing.d.ts +21 -0
  648. package/dist/testing.d.ts.map +1 -0
  649. package/dist/testing.js +28 -0
  650. package/dist/testing.js.map +1 -0
  651. package/dist/vocabulary.d.ts +6 -0
  652. package/dist/vocabulary.d.ts.map +1 -0
  653. package/dist/vocabulary.js +26 -0
  654. package/dist/vocabulary.js.map +1 -0
  655. package/package.json +66 -3
@@ -0,0 +1,286 @@
1
+ import { isRecord } from '@azx-pbc/axiom-runtime';
2
+ import { indefiniteArticle } from '../article.js';
3
+ /**
4
+ * The wording a refused field member earns, in the terms an author acts on.
5
+ *
6
+ * The closed `field` definition refuses a member either through a `false` subschema at the
7
+ * member (`"else": { "properties": { "minItems": false } }`) or through a `not` clause that
8
+ * admits no member at all (`"else": { "not": { "required": ["covers"] } }`). Both arrive at the
9
+ * validator as a keyword with no repair in it — `False boolean schema.` and `Instance matched
10
+ * "not" schema.` — so the one table here states what each member means, why this field cannot
11
+ * carry it, and where it is admitted instead.
12
+ *
13
+ * A table keyed by member rather than by clause is deliberate: the same member is refused by
14
+ * several clauses (a `minimumMessageKey` with no `minimum`, and one on a primitive that admits
15
+ * no `minimum`), and the sentence an author needs is about the member, not about which `allOf`
16
+ * index happened to fire. A test walks the published metaschema and fails when a member it
17
+ * refuses by `false` has no row here, so this table cannot fall behind the contract.
18
+ */
19
+ /** The primitives that admit a `minimum`/`maximum`, `MODEL-2.1.16`. */
20
+ const BOUNDED_PRIMITIVES = new Set([
21
+ 'integer',
22
+ 'decimal',
23
+ 'money',
24
+ 'date',
25
+ 'instant',
26
+ ]);
27
+ /**
28
+ * The members the `field` definition refuses, and the sentence each refusal states.
29
+ *
30
+ * The rows cover both refusal mechanisms: a member refused by `false` on a primitive that does
31
+ * not admit it, and a member refused by `not` on a kind of field that has no use for it.
32
+ */
33
+ const FIELD_MEMBER_WORDING = {
34
+ currency: {
35
+ purpose: 'it states the currency a `money` value is denominated in, and this field holds no money',
36
+ instead: () => 'declare `currency` and `scale` together on a `money` field',
37
+ },
38
+ scale: {
39
+ purpose: 'it states the minor-unit digits of a `money` value, and this field holds no money',
40
+ instead: () => 'declare `currency` and `scale` together on a `money` field',
41
+ },
42
+ units: {
43
+ purpose: 'it states the unit domain of a `quantity` declaration, and this declaration holds no quantity',
44
+ instead: () => 'declare `units` on a `quantity` field or item',
45
+ },
46
+ unit: {
47
+ purpose: 'it states the unit of a `duration` declaration, and this declaration holds no duration',
48
+ instead: () => 'declare `unit` on a `duration` field or item',
49
+ },
50
+ step: {
51
+ purpose: 'it states the increment a number control advances by, and this declaration renders no number increment',
52
+ instead: () => 'declare `step` on an `integer` or `decimal` field',
53
+ },
54
+ minItems: {
55
+ purpose: 'it counts entries, and this field holds one value',
56
+ instead: (owner) => BOUNDED_PRIMITIVES.has(owner.primitive)
57
+ ? 'did you mean `minimum`?'
58
+ : owner.primitive === 'string'
59
+ ? 'did you mean `minLength`?'
60
+ : 'declare the count on an `array` field',
61
+ },
62
+ maxItems: {
63
+ purpose: 'it counts entries, and this field holds one value',
64
+ instead: (owner) => BOUNDED_PRIMITIVES.has(owner.primitive)
65
+ ? 'did you mean `maximum`?'
66
+ : owner.primitive === 'string'
67
+ ? 'did you mean `maxLength`?'
68
+ : 'declare the count on an `array` field',
69
+ },
70
+ minimum: {
71
+ purpose: 'it bounds one numeric or date value',
72
+ instead: (owner) => owner.primitive === 'array'
73
+ ? 'did you mean `minItems`?'
74
+ : owner.primitive === 'string'
75
+ ? 'did you mean `minLength`?'
76
+ : 'declare `minimum` on an `integer`, `decimal`, `money`, `date` or `instant` field',
77
+ },
78
+ maximum: {
79
+ purpose: 'it bounds one numeric or date value',
80
+ instead: (owner) => owner.primitive === 'array'
81
+ ? 'did you mean `maxItems`?'
82
+ : owner.primitive === 'string'
83
+ ? 'did you mean `maxLength`?'
84
+ : 'declare `maximum` on an `integer`, `decimal`, `money`, `date` or `instant` field',
85
+ },
86
+ minimumMessageKey: {
87
+ purpose: 'it names the sentence a `minimum` bound states',
88
+ instead: (owner) => owner.declares('minimum')
89
+ ? 'remove `minimumMessageKey`, because this primitive admits no `minimum`'
90
+ : 'declare `minimum` with it, or remove `minimumMessageKey`',
91
+ },
92
+ maximumMessageKey: {
93
+ purpose: 'it names the sentence a `maximum` bound states',
94
+ instead: (owner) => owner.declares('maximum')
95
+ ? 'remove `maximumMessageKey`, because this primitive admits no `maximum`'
96
+ : 'declare `maximum` with it, or remove `maximumMessageKey`',
97
+ },
98
+ minLength: {
99
+ purpose: 'it counts the characters of a `string`, and this field holds no text',
100
+ instead: (owner) => owner.primitive === 'array'
101
+ ? 'did you mean `minItems`?'
102
+ : 'declare `minLength` on a `string` field',
103
+ },
104
+ maxLength: {
105
+ purpose: 'it counts the characters of a `string`, and this field holds no text',
106
+ instead: (owner) => owner.primitive === 'array'
107
+ ? 'did you mean `maxItems`?'
108
+ : 'declare `maxLength` on a `string` field',
109
+ },
110
+ minLengthMessageKey: {
111
+ purpose: 'it names the sentence a `minLength` bound states',
112
+ instead: (owner) => owner.declares('minLength')
113
+ ? 'remove `minLengthMessageKey`, because this primitive admits no `minLength`'
114
+ : 'declare `minLength` with it, or remove `minLengthMessageKey`',
115
+ },
116
+ maxLengthMessageKey: {
117
+ purpose: 'it names the sentence a `maxLength` bound states',
118
+ instead: (owner) => owner.declares('maxLength')
119
+ ? 'remove `maxLengthMessageKey`, because this primitive admits no `maxLength`'
120
+ : 'declare `maxLength` with it, or remove `maxLengthMessageKey`',
121
+ },
122
+ maxScale: {
123
+ purpose: 'it bounds the fractional digits a `decimal` value carries',
124
+ instead: (owner) => owner.primitive === 'money' || owner.primitive === 'quantity'
125
+ ? 'state `scale` on the `money` or `quantity` field'
126
+ : owner.primitive === 'integer'
127
+ ? 'use a `decimal` field when a fraction is needed'
128
+ : 'declare `maxScale` on a `decimal` field',
129
+ },
130
+ maxScaleMessageKey: {
131
+ purpose: 'it names the sentence an over-scale `decimal` value states',
132
+ instead: (owner) => owner.declares('maxScale')
133
+ ? 'remove `maxScaleMessageKey`, because this primitive admits no `maxScale`'
134
+ : 'declare `maxScale` with it, or remove `maxScaleMessageKey`',
135
+ },
136
+ requiredMessageKey: {
137
+ purpose: 'it names the sentence a missing required value states',
138
+ instead: () => 'declare `required: true` or `requiredWhen` with it, or remove `requiredMessageKey`',
139
+ },
140
+ requiredTestCases: {
141
+ purpose: 'it is the evidence for the rule `required` compiles, and this field states no requirement',
142
+ instead: () => 'declare `required: true` or `requiredWhen` with it, or remove `requiredTestCases`',
143
+ },
144
+ visibleWhenTestCases: {
145
+ purpose: 'it is the evidence for the rule `visibleWhen` compiles, and this field states no `visibleWhen`',
146
+ instead: () => 'declare `visibleWhen` with it, or remove `visibleWhenTestCases`',
147
+ },
148
+ minimumTestCases: {
149
+ purpose: 'it is the evidence for the rule `minimum` compiles, and this field declares no `minimum`',
150
+ instead: () => 'declare `minimum` with it, or remove `minimumTestCases`',
151
+ },
152
+ maximumTestCases: {
153
+ purpose: 'it is the evidence for the rule `maximum` compiles, and this field declares no `maximum`',
154
+ instead: () => 'declare `maximum` with it, or remove `maximumTestCases`',
155
+ },
156
+ minLengthTestCases: {
157
+ purpose: 'it is the evidence for the rule `minLength` compiles, and this field declares no `minLength`',
158
+ instead: () => 'declare `minLength` with it, or remove `minLengthTestCases`',
159
+ },
160
+ maxLengthTestCases: {
161
+ purpose: 'it is the evidence for the rule `maxLength` compiles, and this field declares no `maxLength`',
162
+ instead: () => 'declare `maxLength` with it, or remove `maxLengthTestCases`',
163
+ },
164
+ fields: {
165
+ purpose: 'it declares the members of a `record` or `array`, and this field is neither',
166
+ instead: () => 'declare `fields` on a `record` or `array` field',
167
+ },
168
+ items: {
169
+ purpose: 'it declares the element domain of a scalar or attachment `array`, and this field is not one',
170
+ instead: () => 'declare `items` on an `array` field',
171
+ },
172
+ rowKey: {
173
+ purpose: 'it identifies the rows of an `array`, and this field holds one value',
174
+ instead: () => 'declare `rowKey` on the `array` field',
175
+ },
176
+ control: {
177
+ purpose: 'a `record` renders its declared members, so it offers no control',
178
+ instead: () => 'declare `control` on a scalar or array field',
179
+ },
180
+ options: {
181
+ purpose: 'it declares a closed code domain for a `string`, `integer`, `boolean` or scalar `array` field',
182
+ instead: () => 'declare `options` on one of those fields',
183
+ },
184
+ optionSource: {
185
+ purpose: 'it names a host or cross-field option domain for a `string`, `integer`, `timeslot` or scalar `array` field',
186
+ instead: () => 'declare `optionSource` on one of those fields',
187
+ },
188
+ covers: {
189
+ purpose: 'it states the targets a `signature_capture` signature binds',
190
+ instead: () => 'declare `covers` on a `signature_capture` field',
191
+ },
192
+ accept: {
193
+ purpose: 'it lists the media types a capture admits',
194
+ instead: () => 'declare `accept` on a `media_capture` field',
195
+ },
196
+ minBytes: {
197
+ purpose: 'it sets the smallest byte size a captured file may have',
198
+ instead: () => 'declare `minBytes` on a `media_capture` field',
199
+ },
200
+ maxBytes: {
201
+ purpose: 'it sets the largest byte size a captured file may have',
202
+ instead: () => 'declare `maxBytes` on a `media_capture` field',
203
+ },
204
+ rowsFrom: {
205
+ purpose: "it states the expression whose value is an `array`'s expected row count",
206
+ instead: () => 'declare `rowsFrom` on an `array` field',
207
+ },
208
+ rowsFromSource: {
209
+ purpose: 'it carries the authored `rowsFrom` text beside its compiled form',
210
+ instead: () => 'declare `rowsFromSource` beside `rowsFrom` on an `array` field',
211
+ },
212
+ };
213
+ /** The pairs the closed definition refuses together, with the one-authority sentence each earns. */
214
+ const MEMBER_PAIRS = [
215
+ {
216
+ members: ['options', 'optionSource'],
217
+ detail: (owner) => `\`options\` and \`optionSource\` on ${fieldPhrase(owner)} are two authorities for one value domain — keep \`options\` for a static list or \`optionSource\` for a dynamic one, not both`,
218
+ },
219
+ {
220
+ members: ['required', 'requiredWhen'],
221
+ detail: (owner) => `\`required\` and \`requiredWhen\` on ${fieldPhrase(owner)} state one requirement twice — keep the unconditional \`required: true\` or the conditional \`requiredWhen\`, not both`,
222
+ },
223
+ ];
224
+ /** The declaration a member was written on, in the words the sentence needs. */
225
+ function fieldPhrase(owner) {
226
+ const article = indefiniteArticle(owner.primitive);
227
+ if (owner.fieldId !== undefined) {
228
+ return `${article} \`${owner.primitive}\` field \`${owner.fieldId}\``;
229
+ }
230
+ if (owner.contextPath !== undefined) {
231
+ return `${article} \`${owner.primitive}\` context root \`${owner.contextPath}\``;
232
+ }
233
+ return `${article} \`${owner.primitive}\` item declaration`;
234
+ }
235
+ /**
236
+ * The sentence one refused member earns: the member, the declaration it was written on, what it
237
+ * states, and where it is admitted instead. An unknown member keeps the generic shape, because
238
+ * a member the table has not met is still a refusal an author must act on; the completeness test
239
+ * in `__tests__/member-refusal-wording.test.ts` fails before such a member can ship.
240
+ */
241
+ export function refusedMemberDetail(member, owner) {
242
+ const wording = FIELD_MEMBER_WORDING[member];
243
+ const where = `\`${member}\` is not admitted on ${fieldPhrase(owner)}`;
244
+ if (wording === undefined)
245
+ return `${where}; remove it, or state the member this declaration admits`;
246
+ return `${where}: ${wording.purpose} — ${wording.instead(owner)}`;
247
+ }
248
+ /**
249
+ * The sentence a `not` clause earns, from the members whose presence refused the instance.
250
+ *
251
+ * A pair that states one fact twice gets one sentence rather than two, because the repair is to
252
+ * keep one of them; every other member is stated on its own, so a `not` that refuses several
253
+ * members names each.
254
+ */
255
+ export function refusedMembersDetail(members, owner) {
256
+ if (members.length === 0)
257
+ return undefined;
258
+ const pair = MEMBER_PAIRS.find((candidate) => members.length === 2 && candidate.members.every((member) => members.includes(member)));
259
+ if (pair !== undefined)
260
+ return pair.detail(owner);
261
+ return members.map((member) => refusedMemberDetail(member, owner)).join(' ');
262
+ }
263
+ /**
264
+ * The declaration a validator instance location names, when it is a field or an item
265
+ * declaration.
266
+ *
267
+ * A `false` subschema is reported at the member (`#/fields/0/minItems`), and a `not` clause at
268
+ * the declaration (`#/fields/0`), so the caller passes the object each location names. A value
269
+ * without a `primitive` is not a declaration, and is left to the generic validator wording.
270
+ */
271
+ export function refusalOwnerOf(value) {
272
+ if (!isRecord(value))
273
+ return undefined;
274
+ const primitive = value['primitive'];
275
+ if (typeof primitive !== 'string')
276
+ return undefined;
277
+ const fieldId = value['fieldId'];
278
+ const contextPath = value['path'];
279
+ return {
280
+ primitive,
281
+ ...(typeof fieldId === 'string' ? { fieldId } : {}),
282
+ ...(typeof fieldId !== 'string' && typeof contextPath === 'string' ? { contextPath } : {}),
283
+ declares: (member) => Object.hasOwn(value, member),
284
+ };
285
+ }
286
+ //# sourceMappingURL=member-wording.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"member-wording.js","sourceRoot":"","sources":["../../src/schema/member-wording.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD;;;;;;;;;;;;;;;GAeG;AAEH,uEAAuE;AACvE,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IACtD,SAAS;IACT,SAAS;IACT,OAAO;IACP,MAAM;IACN,SAAS;CACV,CAAC,CAAC;AA2BH;;;;;GAKG;AACH,MAAM,oBAAoB,GAAiD;IACzE,QAAQ,EAAE;QACR,OAAO,EACL,yFAAyF;QAC3F,OAAO,EAAE,GAAG,EAAE,CAAC,4DAA4D;KAC5E;IACD,KAAK,EAAE;QACL,OAAO,EAAE,mFAAmF;QAC5F,OAAO,EAAE,GAAG,EAAE,CAAC,4DAA4D;KAC5E;IACD,KAAK,EAAE;QACL,OAAO,EACL,+FAA+F;QACjG,OAAO,EAAE,GAAG,EAAE,CAAC,+CAA+C;KAC/D;IACD,IAAI,EAAE;QACJ,OAAO,EACL,wFAAwF;QAC1F,OAAO,EAAE,GAAG,EAAE,CAAC,8CAA8C;KAC9D;IACD,IAAI,EAAE;QACJ,OAAO,EACL,wGAAwG;QAC1G,OAAO,EAAE,GAAG,EAAE,CAAC,mDAAmD;KACnE;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,mDAAmD;QAC5D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;YACrC,CAAC,CAAC,yBAAyB;YAC3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,GAAG,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;IACrC,IAAI,OAAO,SAAS,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACpD,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO;QACL,SAAS;QACT,GAAG,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnD,GAAG,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1F,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;KACnD,CAAC;AACJ,CAAC","sourcesContent":["import { isRecord } from '@azx-pbc/axiom-runtime';\nimport { indefiniteArticle } from '../article.js';\n\n/**\n * The wording a refused field member earns, in the terms an author acts on.\n *\n * The closed `field` definition refuses a member either through a `false` subschema at the\n * member (`\"else\": { \"properties\": { \"minItems\": false } }`) or through a `not` clause that\n * admits no member at all (`\"else\": { \"not\": { \"required\": [\"covers\"] } }`). Both arrive at the\n * validator as a keyword with no repair in it — `False boolean schema.` and `Instance matched\n * \"not\" schema.` — so the one table here states what each member means, why this field cannot\n * carry it, and where it is admitted instead.\n *\n * A table keyed by member rather than by clause is deliberate: the same member is refused by\n * several clauses (a `minimumMessageKey` with no `minimum`, and one on a primitive that admits\n * no `minimum`), and the sentence an author needs is about the member, not about which `allOf`\n * index happened to fire. A test walks the published metaschema and fails when a member it\n * refuses by `false` has no row here, so this table cannot fall behind the contract.\n */\n\n/** The primitives that admit a `minimum`/`maximum`, `MODEL-2.1.16`. */\nconst BOUNDED_PRIMITIVES: ReadonlySet<string> = new Set([\n 'integer',\n 'decimal',\n 'money',\n 'date',\n 'instant',\n]);\n\n/** The object a refused member was written on, as the sentence about it needs it. */\nexport interface RefusalOwner {\n readonly primitive: string;\n /** Absent on an item declaration or context root. */\n readonly fieldId?: string;\n /** Present on a context root, which is named by its dotted path rather than a fieldId. */\n readonly contextPath?: string;\n /** Whether the declaration states `member`, so a companion's absence is a fact. */\n readonly declares: (member: string) => boolean;\n}\n\n/** What one refused member states, and the repair that is admitted where it belongs. */\ninterface FieldMemberWording {\n /** What the member states, phrased to follow the member name. */\n readonly purpose: string;\n /** Where the same fact is admitted, or the companion the member needs. */\n readonly instead: (owner: RefusalOwner) => string;\n}\n\n/** A pair of members that are each admitted alone but never together. */\ninterface MemberPairWording {\n readonly members: readonly [string, string];\n readonly detail: (owner: RefusalOwner) => string;\n}\n\n/**\n * The members the `field` definition refuses, and the sentence each refusal states.\n *\n * The rows cover both refusal mechanisms: a member refused by `false` on a primitive that does\n * not admit it, and a member refused by `not` on a kind of field that has no use for it.\n */\nconst FIELD_MEMBER_WORDING: Readonly<Record<string, FieldMemberWording>> = {\n currency: {\n purpose:\n 'it states the currency a `money` value is denominated in, and this field holds no money',\n instead: () => 'declare `currency` and `scale` together on a `money` field',\n },\n scale: {\n purpose: 'it states the minor-unit digits of a `money` value, and this field holds no money',\n instead: () => 'declare `currency` and `scale` together on a `money` field',\n },\n units: {\n purpose:\n 'it states the unit domain of a `quantity` declaration, and this declaration holds no quantity',\n instead: () => 'declare `units` on a `quantity` field or item',\n },\n unit: {\n purpose:\n 'it states the unit of a `duration` declaration, and this declaration holds no duration',\n instead: () => 'declare `unit` on a `duration` field or item',\n },\n step: {\n purpose:\n 'it states the increment a number control advances by, and this declaration renders no number increment',\n instead: () => 'declare `step` on an `integer` or `decimal` field',\n },\n minItems: {\n purpose: 'it counts entries, and this field holds one value',\n instead: (owner) =>\n BOUNDED_PRIMITIVES.has(owner.primitive)\n ? 'did you mean `minimum`?'\n : owner.primitive === 'string'\n ? 'did you mean `minLength`?'\n : 'declare the count on an `array` field',\n },\n maxItems: {\n purpose: 'it counts entries, and this field holds one value',\n instead: (owner) =>\n BOUNDED_PRIMITIVES.has(owner.primitive)\n ? 'did you mean `maximum`?'\n : owner.primitive === 'string'\n ? 'did you mean `maxLength`?'\n : 'declare the count on an `array` field',\n },\n minimum: {\n purpose: 'it bounds one numeric or date value',\n instead: (owner) =>\n owner.primitive === 'array'\n ? 'did you mean `minItems`?'\n : owner.primitive === 'string'\n ? 'did you mean `minLength`?'\n : 'declare `minimum` on an `integer`, `decimal`, `money`, `date` or `instant` field',\n },\n maximum: {\n purpose: 'it bounds one numeric or date value',\n instead: (owner) =>\n owner.primitive === 'array'\n ? 'did you mean `maxItems`?'\n : owner.primitive === 'string'\n ? 'did you mean `maxLength`?'\n : 'declare `maximum` on an `integer`, `decimal`, `money`, `date` or `instant` field',\n },\n minimumMessageKey: {\n purpose: 'it names the sentence a `minimum` bound states',\n instead: (owner) =>\n owner.declares('minimum')\n ? 'remove `minimumMessageKey`, because this primitive admits no `minimum`'\n : 'declare `minimum` with it, or remove `minimumMessageKey`',\n },\n maximumMessageKey: {\n purpose: 'it names the sentence a `maximum` bound states',\n instead: (owner) =>\n owner.declares('maximum')\n ? 'remove `maximumMessageKey`, because this primitive admits no `maximum`'\n : 'declare `maximum` with it, or remove `maximumMessageKey`',\n },\n minLength: {\n purpose: 'it counts the characters of a `string`, and this field holds no text',\n instead: (owner) =>\n owner.primitive === 'array'\n ? 'did you mean `minItems`?'\n : 'declare `minLength` on a `string` field',\n },\n maxLength: {\n purpose: 'it counts the characters of a `string`, and this field holds no text',\n instead: (owner) =>\n owner.primitive === 'array'\n ? 'did you mean `maxItems`?'\n : 'declare `maxLength` on a `string` field',\n },\n minLengthMessageKey: {\n purpose: 'it names the sentence a `minLength` bound states',\n instead: (owner) =>\n owner.declares('minLength')\n ? 'remove `minLengthMessageKey`, because this primitive admits no `minLength`'\n : 'declare `minLength` with it, or remove `minLengthMessageKey`',\n },\n maxLengthMessageKey: {\n purpose: 'it names the sentence a `maxLength` bound states',\n instead: (owner) =>\n owner.declares('maxLength')\n ? 'remove `maxLengthMessageKey`, because this primitive admits no `maxLength`'\n : 'declare `maxLength` with it, or remove `maxLengthMessageKey`',\n },\n maxScale: {\n purpose: 'it bounds the fractional digits a `decimal` value carries',\n instead: (owner) =>\n owner.primitive === 'money' || owner.primitive === 'quantity'\n ? 'state `scale` on the `money` or `quantity` field'\n : owner.primitive === 'integer'\n ? 'use a `decimal` field when a fraction is needed'\n : 'declare `maxScale` on a `decimal` field',\n },\n maxScaleMessageKey: {\n purpose: 'it names the sentence an over-scale `decimal` value states',\n instead: (owner) =>\n owner.declares('maxScale')\n ? 'remove `maxScaleMessageKey`, because this primitive admits no `maxScale`'\n : 'declare `maxScale` with it, or remove `maxScaleMessageKey`',\n },\n requiredMessageKey: {\n purpose: 'it names the sentence a missing required value states',\n instead: () =>\n 'declare `required: true` or `requiredWhen` with it, or remove `requiredMessageKey`',\n },\n requiredTestCases: {\n purpose:\n 'it is the evidence for the rule `required` compiles, and this field states no requirement',\n instead: () =>\n 'declare `required: true` or `requiredWhen` with it, or remove `requiredTestCases`',\n },\n visibleWhenTestCases: {\n purpose:\n 'it is the evidence for the rule `visibleWhen` compiles, and this field states no `visibleWhen`',\n instead: () => 'declare `visibleWhen` with it, or remove `visibleWhenTestCases`',\n },\n minimumTestCases: {\n purpose:\n 'it is the evidence for the rule `minimum` compiles, and this field declares no `minimum`',\n instead: () => 'declare `minimum` with it, or remove `minimumTestCases`',\n },\n maximumTestCases: {\n purpose:\n 'it is the evidence for the rule `maximum` compiles, and this field declares no `maximum`',\n instead: () => 'declare `maximum` with it, or remove `maximumTestCases`',\n },\n minLengthTestCases: {\n purpose:\n 'it is the evidence for the rule `minLength` compiles, and this field declares no `minLength`',\n instead: () => 'declare `minLength` with it, or remove `minLengthTestCases`',\n },\n maxLengthTestCases: {\n purpose:\n 'it is the evidence for the rule `maxLength` compiles, and this field declares no `maxLength`',\n instead: () => 'declare `maxLength` with it, or remove `maxLengthTestCases`',\n },\n fields: {\n purpose: 'it declares the members of a `record` or `array`, and this field is neither',\n instead: () => 'declare `fields` on a `record` or `array` field',\n },\n items: {\n purpose:\n 'it declares the element domain of a scalar or attachment `array`, and this field is not one',\n instead: () => 'declare `items` on an `array` field',\n },\n rowKey: {\n purpose: 'it identifies the rows of an `array`, and this field holds one value',\n instead: () => 'declare `rowKey` on the `array` field',\n },\n control: {\n purpose: 'a `record` renders its declared members, so it offers no control',\n instead: () => 'declare `control` on a scalar or array field',\n },\n options: {\n purpose:\n 'it declares a closed code domain for a `string`, `integer`, `boolean` or scalar `array` field',\n instead: () => 'declare `options` on one of those fields',\n },\n optionSource: {\n purpose:\n 'it names a host or cross-field option domain for a `string`, `integer`, `timeslot` or scalar `array` field',\n instead: () => 'declare `optionSource` on one of those fields',\n },\n covers: {\n purpose: 'it states the targets a `signature_capture` signature binds',\n instead: () => 'declare `covers` on a `signature_capture` field',\n },\n accept: {\n purpose: 'it lists the media types a capture admits',\n instead: () => 'declare `accept` on a `media_capture` field',\n },\n minBytes: {\n purpose: 'it sets the smallest byte size a captured file may have',\n instead: () => 'declare `minBytes` on a `media_capture` field',\n },\n maxBytes: {\n purpose: 'it sets the largest byte size a captured file may have',\n instead: () => 'declare `maxBytes` on a `media_capture` field',\n },\n rowsFrom: {\n purpose: \"it states the expression whose value is an `array`'s expected row count\",\n instead: () => 'declare `rowsFrom` on an `array` field',\n },\n rowsFromSource: {\n purpose: 'it carries the authored `rowsFrom` text beside its compiled form',\n instead: () => 'declare `rowsFromSource` beside `rowsFrom` on an `array` field',\n },\n};\n\n/** The pairs the closed definition refuses together, with the one-authority sentence each earns. */\nconst MEMBER_PAIRS: readonly MemberPairWording[] = [\n {\n members: ['options', 'optionSource'],\n detail: (owner) =>\n `\\`options\\` and \\`optionSource\\` on ${fieldPhrase(owner)} are two authorities for one value domain — keep \\`options\\` for a static list or \\`optionSource\\` for a dynamic one, not both`,\n },\n {\n members: ['required', 'requiredWhen'],\n detail: (owner) =>\n `\\`required\\` and \\`requiredWhen\\` on ${fieldPhrase(owner)} state one requirement twice — keep the unconditional \\`required: true\\` or the conditional \\`requiredWhen\\`, not both`,\n },\n];\n\n/** The declaration a member was written on, in the words the sentence needs. */\nfunction fieldPhrase(owner: RefusalOwner): string {\n const article = indefiniteArticle(owner.primitive);\n if (owner.fieldId !== undefined) {\n return `${article} \\`${owner.primitive}\\` field \\`${owner.fieldId}\\``;\n }\n if (owner.contextPath !== undefined) {\n return `${article} \\`${owner.primitive}\\` context root \\`${owner.contextPath}\\``;\n }\n return `${article} \\`${owner.primitive}\\` item declaration`;\n}\n\n/**\n * The sentence one refused member earns: the member, the declaration it was written on, what it\n * states, and where it is admitted instead. An unknown member keeps the generic shape, because\n * a member the table has not met is still a refusal an author must act on; the completeness test\n * in `__tests__/member-refusal-wording.test.ts` fails before such a member can ship.\n */\nexport function refusedMemberDetail(member: string, owner: RefusalOwner): string {\n const wording = FIELD_MEMBER_WORDING[member];\n const where = `\\`${member}\\` is not admitted on ${fieldPhrase(owner)}`;\n if (wording === undefined)\n return `${where}; remove it, or state the member this declaration admits`;\n return `${where}: ${wording.purpose} — ${wording.instead(owner)}`;\n}\n\n/**\n * The sentence a `not` clause earns, from the members whose presence refused the instance.\n *\n * A pair that states one fact twice gets one sentence rather than two, because the repair is to\n * keep one of them; every other member is stated on its own, so a `not` that refuses several\n * members names each.\n */\nexport function refusedMembersDetail(\n members: readonly string[],\n owner: RefusalOwner,\n): string | undefined {\n if (members.length === 0) return undefined;\n const pair = MEMBER_PAIRS.find(\n (candidate) =>\n members.length === 2 && candidate.members.every((member) => members.includes(member)),\n );\n if (pair !== undefined) return pair.detail(owner);\n return members.map((member) => refusedMemberDetail(member, owner)).join(' ');\n}\n\n/**\n * The declaration a validator instance location names, when it is a field or an item\n * declaration.\n *\n * A `false` subschema is reported at the member (`#/fields/0/minItems`), and a `not` clause at\n * the declaration (`#/fields/0`), so the caller passes the object each location names. A value\n * without a `primitive` is not a declaration, and is left to the generic validator wording.\n */\nexport function refusalOwnerOf(value: unknown): RefusalOwner | undefined {\n if (!isRecord(value)) return undefined;\n const primitive = value['primitive'];\n if (typeof primitive !== 'string') return undefined;\n const fieldId = value['fieldId'];\n const contextPath = value['path'];\n return {\n primitive,\n ...(typeof fieldId === 'string' ? { fieldId } : {}),\n ...(typeof fieldId !== 'string' && typeof contextPath === 'string' ? { contextPath } : {}),\n declares: (member) => Object.hasOwn(value, member),\n };\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type { OutputUnit } from '@cfworker/json-schema';
2
+ import type { SchemaDiagnostic } from './diagnostic.js';
3
+ /**
4
+ * Every reason the metaschema gives, or none when it accepts the document.
5
+ *
6
+ * The exhaustive walk is the useful one — an author fixes a document in one pass — but the
7
+ * library accumulates each nested result with `errors.push(...result.errors)`, so error
8
+ * volume, not document depth, is what ends it: one member name outside the closed
9
+ * `wireValue` object grammar, restated across every element of a wide vector, fails all
10
+ * eleven branches of that union for each element, and past roughly a hundred thousand
11
+ * reasons the spread reaches V8's argument limit and `validate()` raises `RangeError`
12
+ * instead of returning a verdict. A document like that is walked again with
13
+ * `shortCircuit: true`, which stops at the first failing keyword: the author reads the one
14
+ * reason to fix rather than a run that names none.
15
+ */
16
+ export declare function metaschemaErrors(document: unknown): readonly OutputUnit[];
17
+ /** Every reason the scenario-suite metaschema gives, or none when it accepts the document. */
18
+ export declare function scenarioMetaschemaErrors(document: unknown): readonly OutputUnit[];
19
+ export declare function validatorDiagnostic(error: OutputUnit, document: unknown): SchemaDiagnostic;
20
+ //# sourceMappingURL=metaschema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metaschema.d.ts","sourceRoot":"","sources":["../../src/schema/metaschema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,uBAAuB,CAAC;AAIhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAsBxD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,UAAU,EAAE,CAEzE;AAED,8FAA8F;AAC9F,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,UAAU,EAAE,CAEjF;AAgcD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,GAAG,gBAAgB,CAkB1F"}