@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 @@
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/cli/test.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EACL,aAAa,EACb,eAAe,EACf,WAAW,EACX,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,YAAY,GAAG;IACnB,GAAG,eAAe;IAClB,GAAG,sBAAsB;IACzB,GAAG,WAAW;IACd,KAAK,EAAE,EAAE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W,CAAC,CAAC,CAAC,OAAO,CAAC;AACzC,CAAC","sourcesContent":["/** `axiom-cli test`: execute a schema's evidence and enforce publish readiness. */\nimport { parseArgs } from 'node:util';\nimport { assertNever, DEFAULT_EVIDENCE_TIER } from '@azx-pbc/axiom-runtime';\nimport type { EmbeddedVector, VectorVerdict } from '../publish/vectors.js';\nimport { publishReport, verifyPublishReadiness } from '../publish/verify.js';\nimport type { PublishGap } from '../publish/readiness.js';\nimport { describeTarget } from '../scenarios/report.js';\nimport {\n COMMAND_PARSE,\n DATASET_OPTIONS,\n HELP_OPTION,\n MAX_DIAGNOSTICS_OPTION,\n handleUniversalOptions,\n parsedOrUsage,\n readCoverage,\n readDiagnosticCap,\n singlePositional,\n} from './args.js';\nimport type { DiagnosticCap } from './args.js';\nimport { agrees, counted, noun } from './count.js';\nimport { displayPath, STDIO_PATH } from './read.js';\nimport { emitCanonicalJson } from './render.js';\nimport { loadSchema } from './schema.js';\nimport { suiteReport } from './suite-report.js';\nimport { readSuites } from './suites.js';\nimport { printErrorLine, printLine } from './terminal.js';\nimport { USAGE, EXIT_FAILED, EXIT_OK, EXIT_USAGE } from './usage.js';\n\nconst TEST_OPTIONS = {\n ...DATASET_OPTIONS,\n ...MAX_DIAGNOSTICS_OPTION,\n ...HELP_OPTION,\n suite: { type: 'string', multiple: true },\n coverage: { type: 'string' },\n out: { type: 'string' },\n} as const;\n\n/**\n * Prints the failed vectors within the diagnostic budget the operator named.\n *\n * A case is one line plus the explanation lines that name its repair, so the budget is spent in\n * that order: the first cases are explained whole and a matrix larger than the cap ends by\n * counting what it withheld, exactly like a suite's failure lines. A vector matrix is authored\n * evidence like a suite, and neither may outgrow the interface that reports it.\n */\nfunction reportVectorFailures(\n label: string,\n vectors: readonly EmbeddedVector[],\n cap: DiagnosticCap,\n): void {\n const failed = vectors.filter(isFailedVector);\n let remaining = cap === 'all' ? Number.POSITIVE_INFINITY : cap;\n let shown = 0;\n let withheldLines = 0;\n for (const vector of failed) {\n if (remaining === 0) break;\n const verdict = vector.verdict;\n // A vector that could not be read at all states that in its detail; every other failure names\n // the case the author wrote.\n const subject =\n vector.caseId === undefined\n ? `rule ${vector.ruleId}`\n : `rule ${vector.ruleId} case ${vector.caseId}`;\n printErrorLine(`${label}: ${subject}: ${verdict.detail}`);\n remaining -= 1;\n shown += 1;\n for (const line of verdict.explanation) {\n if (remaining === 0) {\n withheldLines += 1;\n continue;\n }\n printErrorLine(`${label}: ${subject}:${line}`);\n remaining -= 1;\n }\n }\n const withheldCases = failed.length - shown;\n if (withheldCases > 0) {\n printErrorLine(\n `${label}: … and ${String(withheldCases)} more ${noun(withheldCases, 'failing case')} withheld; run again with --max-diagnostics=all to see them`,\n );\n }\n if (withheldLines > 0) {\n printErrorLine(\n `${label}: … and ${String(withheldLines)} more ${noun(withheldLines, 'explanation line')} withheld; run again with --max-diagnostics=all to see them`,\n );\n }\n}\n\n/** Whether a vector's verdict is a claim the run executed and that did not hold. */\nfunction isFailedVector(\n vector: EmbeddedVector,\n): vector is EmbeddedVector & { readonly verdict: Extract<VectorVerdict, { ok: false }> } {\n return !vector.verdict.ok;\n}\n\n/** Prints a report line list, bounded by the cap, with one line counting what was withheld. */\nfunction printBounded(\n label: string,\n lines: readonly string[],\n cap: DiagnosticCap,\n singular: string,\n): void {\n const shown = cap === 'all' ? lines : lines.slice(0, cap);\n for (const line of shown) printErrorLine(line);\n const withheld = lines.length - shown.length;\n if (withheld > 0) {\n printErrorLine(\n `${label}: … and ${String(withheld)} more ${noun(withheld, singular)} withheld; run again with --max-diagnostics=all to see them`,\n );\n }\n}\n\n/**\n * Whether a gap is a claim the run executed and that did not hold.\n *\n * `--coverage=report` reports missing coverage but refuses a run whose evidence failed: reading a\n * gap about a branch nobody asserted is a coverage decision, while a failed assertion, an\n * unreadable embedded expectation, a refused suite, an unbound table or a device artifact the run\n * cannot execute is a run that could not do what it was asked.\n */\nexport function isFailedClaim(gap: PublishGap): boolean {\n switch (gap.kind) {\n case 'failed_vector':\n case 'failed_scenario':\n case 'unreadable_expectation':\n case 'invalid_suite':\n case 'stale_behavior':\n case 'stale_dataset':\n case 'client_artifact':\n case 'conflicting_environment':\n return true;\n case 'no_evidence':\n case 'no_firing':\n case 'no_non_firing':\n return false;\n default:\n return assertNever(gap.kind);\n }\n}\n\nexport async function runTest(args: readonly string[]): Promise<number> {\n const parsed = parsedOrUsage(\n () => parseArgs({ args, options: TEST_OPTIONS, ...COMMAND_PARSE }),\n USAGE.test,\n TEST_OPTIONS,\n );\n if (parsed === undefined) return EXIT_USAGE;\n const handled = handleUniversalOptions(parsed, TEST_OPTIONS, USAGE.test);\n if (handled !== undefined) return handled;\n const target = singlePositional(parsed.positionals, USAGE.test);\n if (target === undefined) return EXIT_USAGE;\n const cap = readDiagnosticCap(parsed.values['max-diagnostics'], USAGE.test);\n if (cap === undefined) return EXIT_USAGE;\n const mode = readCoverage(parsed.values.coverage, USAGE.test);\n if (mode === undefined) return EXIT_USAGE;\n // A vector states what the artifact does, so it runs on the evidence default tier: a client\n // artifact replaces server rules with stubs, and their vectors would report the stub's verdict.\n // A case may name its own tier, capabilities and record date.\n const loaded = await loadSchema(\n target,\n parsed.values.dataset ?? [],\n parsed.values.declaration ?? [],\n USAGE.test,\n cap,\n DEFAULT_EVIDENCE_TIER,\n );\n if (!loaded.ok) return loaded.exitCode;\n const suites = await readSuites(parsed.values.suite ?? [], cap, loaded.compiled.schema);\n if (!suites.ok) return suites.exitCode;\n\n const label = displayPath(target);\n const verification = verifyPublishReadiness(loaded.compiled.schema, {\n ...(loaded.datasets.length === 0\n ? {}\n : { datasets: loaded.datasets.map((dataset) => dataset.document) }),\n ...(suites.suites.length === 0 ? {} : { suites: suites.suites.map((suite) => suite.suite) }),\n // A rule a declaration compiled to is part of the gate, but its id is not the author's\n // spelling; the compile reports where each one came from so the gap names the member.\n ...(loaded.compiled.declarationOrigins.length === 0\n ? {}\n : { declarations: loaded.compiled.declarationOrigins }),\n });\n // `--out -` makes stdout the report, so every human line moves to the diagnostics stream and a\n // caller piping the report reads only the report.\n const written = parsed.values.out;\n const summary = written === STDIO_PATH ? printErrorLine : printLine;\n\n reportVectorFailures(label, verification.vectors, cap);\n // A suite the run could not execute (its data identity could not be stated) is named with the\n // reason rather than dropped: silence would read as \"nothing ran\", which is a different fact.\n const refusal = verification.ready ? undefined : verification.gaps[0]?.detail;\n const notRun = suites.suites.length > verification.suites.length ? refusal : undefined;\n const suiteLines = suiteReport(suites.suites, verification.suites, notRun);\n for (const line of suiteLines.summaries) summary(line);\n printBounded(label, suiteLines.failures, cap, 'assertion failure');\n // A hint names a target, and a row-scoped target is one per row of the record the suite carried,\n // so this channel grows with the run's data rather than with the artifact: it is bounded by the\n // same cap, and the whole list stays in the `--out` report's `observedOnly`.\n // A hint says \"this observation proves nothing, assert one that does\". A ready run has no gap\n // left to act on, so the terminal stays quiet about hints it cannot fix; the `--out` report\n // still carries every one of them for a later reader.\n if (!verification.ready) {\n printBounded(\n label,\n verification.observedOnly.map(\n (hint) =>\n `${label}: not credited: ${describeTarget(hint.target)}: observed, but proves nothing (${hint.refusal})`,\n ),\n cap,\n 'uncredited observation',\n );\n }\n\n const total = verification.vectors.length;\n const failed = verification.vectors.filter((vector) => !vector.verdict.ok).length;\n summary(\n `${label}: ${counted(total, 'case')}, ${String(total - failed)} passed, ${String(failed)} failed`,\n );\n\n const gaps = verification.ready ? [] : verification.gaps;\n if (mode === 'report') {\n // A gap names a rule whose evidence is still owed or did not hold, so the rules without one\n // are the rules the run covered. Counting that way keeps the summary tied to the same gaps\n // the line below prints, and a constant rule's one reachable branch is the requirement it is\n // measured against.\n const unproven = new Set(gaps.flatMap((gap) => (gap.ruleId === undefined ? [] : [gap.ruleId])));\n const satisfied = verification.coverage.filter(\n (entry) => entry.attempts > 0 && !unproven.has(entry.ruleId),\n ).length;\n summary(\n `${label}: coverage: ${String(satisfied)} of ${counted(verification.coverage.length, 'rule')} ${agrees(satisfied, 'has', 'have')} the evidence publishing requires`,\n );\n }\n // The gaps are a diagnostics channel like the vector and suite failures, and a run over a\n // large artifact earns one per rule. The cap bounds the terminal, never the verdict: the\n // `--out` report keeps every gap, which is the count a later reader acts on.\n printBounded(\n label,\n gaps.map((gap) =>\n mode === 'require'\n ? `${label}: ${gap.path}: not ready to publish: ${gap.detail}`\n : `${label}: ${gap.path}: publish gap (${gap.kind}): ${gap.detail}`,\n ),\n cap,\n 'publish gap',\n );\n\n const refused = mode === 'require' ? gaps.length > 0 : gaps.some(isFailedClaim);\n if (written !== undefined) {\n // Every document this run read is an input, so `--out` cannot replace the schema, a suite or\n // the table a run judged its evidence against.\n const emitted = await emitCanonicalJson(written, publishReport(verification), [\n target,\n ...(parsed.values.suite ?? []),\n ...(parsed.values.dataset ?? []),\n ...(parsed.values.declaration ?? []),\n ]);\n if (emitted !== EXIT_OK) return emitted;\n }\n return refused ? EXIT_FAILED : EXIT_OK;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ export declare const EXIT_OK = 0;
2
+ export declare const EXIT_FAILED = 1;
3
+ export declare const EXIT_USAGE = 2;
4
+ export declare const USAGE: {
5
+ readonly summary: 'usage: axiom-cli <check|compile|compile-dataset|test|diff|explain-deps> [options]';
6
+ readonly check: 'usage: axiom-cli check <schema.json|schema.yaml> [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all]';
7
+ readonly compile: 'usage: axiom-cli compile <schema.json|schema.yaml> [--target server|client] [--producer-version <release>|none] [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all] [--out <file>]';
8
+ readonly compileDataset: 'usage: axiom-cli compile-dataset <file>... [--declaration <file>]... [--out <file>]';
9
+ readonly test: 'usage: axiom-cli test <schema.json|schema.yaml> [--suite <file>]... [--dataset <file>]... [--declaration <file>]... [--coverage=require|report] [--out <file>] [--max-diagnostics=N|all]';
10
+ readonly diff: 'usage: axiom-cli diff <before.json|.yaml> <after.json|.yaml> [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all]';
11
+ readonly explainDeps: 'usage: axiom-cli explain-deps <schema.json|schema.yaml> [--field <fieldId>] [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all]';
12
+ };
13
+ /** Prints the help screen and reports success, which is what naming --help means. */
14
+ export declare function showHelp(): number;
15
+ //# sourceMappingURL=usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/cli/usage.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B,eAAO,MAAM,KAAK;aAChB,OAAO,EAAE,mFAAmF;aAC5F,KAAK,EACH,4HAA4H;aAC9H,OAAO,EACL,0MAA0M;aAC5M,cAAc,EACZ,qFAAqF;aACvF,IAAI,EAAE,0LAA0L;aAChM,IAAI,EAAE,wIAAwI;aAC9I,WAAW,EACT,uJAAuJ;CACjJ,CAAC;AAwEX,qFAAqF;AACrF,wBAAgB,QAAQ,IAAI,MAAM,CAGjC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * The command line's published surface: the usage line each command refuses an invocation
3
+ * with, the help screen, and the exit code every verdict maps onto.
4
+ *
5
+ * A refusal is only useful if it says what would have worked, so each usage line names every
6
+ * option together with the values it accepts.
7
+ */
8
+ import { printStaticText } from './terminal.js';
9
+ export const EXIT_OK = 0;
10
+ export const EXIT_FAILED = 1;
11
+ export const EXIT_USAGE = 2;
12
+ export const USAGE = {
13
+ summary: 'usage: axiom-cli <check|compile|compile-dataset|test|diff|explain-deps> [options]',
14
+ check: 'usage: axiom-cli check <schema.json|schema.yaml> [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all]',
15
+ compile: 'usage: axiom-cli compile <schema.json|schema.yaml> [--target server|client] [--producer-version <release>|none] [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all] [--out <file>]',
16
+ compileDataset: 'usage: axiom-cli compile-dataset <file>... [--declaration <file>]... [--out <file>]',
17
+ test: 'usage: axiom-cli test <schema.json|schema.yaml> [--suite <file>]... [--dataset <file>]... [--declaration <file>]... [--coverage=require|report] [--out <file>] [--max-diagnostics=N|all]',
18
+ diff: 'usage: axiom-cli diff <before.json|.yaml> <after.json|.yaml> [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all]',
19
+ explainDeps: 'usage: axiom-cli explain-deps <schema.json|schema.yaml> [--field <fieldId>] [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all]',
20
+ };
21
+ const HELP = `${USAGE.summary}
22
+ ${USAGE.check.slice('usage: '.length)}
23
+ ${USAGE.compile.slice('usage: '.length)}
24
+ ${USAGE.compileDataset.slice('usage: '.length)}
25
+ ${USAGE.test.slice('usage: '.length)}
26
+ ${USAGE.diff.slice('usage: '.length)}
27
+ ${USAGE.explainDeps.slice('usage: '.length)}
28
+
29
+ check Validate one schema document against the closed metaschema and the
30
+ language, and report every diagnostic.
31
+ compile Compile one authored schema into the artifact a target evaluates.
32
+ --target client replaces every \`evaluateOn: 'server'\` rule with a
33
+ DEFERRED stub, so a device never carries server logic.
34
+ The artifact is stamped with the release this compiler was built
35
+ as (producerVersion); \`--producer-version none\` omits the member
36
+ for bytes that must stay independent of the release that wrote them.
37
+ compile-dataset Compile CSV and JSON tables into one installable catalog. A duplicate or
38
+ overlapping version of one table is refused.
39
+ test Run the evidence a schema publishes: the vectors embedded in it and any
40
+ scenario suite named by --suite, against the compiled artifact and the tables
41
+ --dataset supplies. Publish readiness needs a case on each branch a rule
42
+ can take. A literal-boolean validate, visible, required or enabled rule leaves one
43
+ branch; every other rule needs firing and non-firing cases. A rule may be covered
44
+ by a suite instead of a vector.
45
+ A vector may declare the environment it runs under: capabilities (the flags
46
+ has_cap reports), recordDate (the local record date a data-bound set resolves
47
+ in_set against) and tier (default server).
48
+ --coverage=require (the default) exits 1 on any gap; --coverage=report prints the
49
+ gaps and exits 0 unless an executed assertion or table binding failed.
50
+ --out writes the verification as canonical JSON (\`-\` writes it to stdout and
51
+ moves the human lines to stderr).
52
+ A --suite file is a JSON suite document unless the path ends in \`.csv\`: a CSV is a
53
+ flat scenario matrix, one row to a scenario, with the columns and the cell
54
+ spelling documented in docs/authoring/publishing.md. A cell is never coerced: an
55
+ empty value cell is absent, \`null\` is the wire null, a text value is a JSON
56
+ string literal, and numbers, dates and instants are their canonical spelling.
57
+ Use a JSON suite for a nested record, an array, money, an attachment, a
58
+ redaction, a capability or a row key.
59
+ diff Compare two versions of one schema (behaviour and declarations) or of
60
+ one dataset table, and print the deterministic summary.
61
+ explain-deps Print the derived dependency graph: what each rule reads, which rules a
62
+ gate folds, and the order computed fields must be recalculated in.
63
+
64
+ Every command accepts --help (or -h) in place of running, and every option takes one
65
+ value: naming a scalar option twice is a usage error. A document argument of \`-\` reads
66
+ standard input, once per run, and \`--out -\` writes the artifact to standard output.
67
+ Everything after \`--\` is read as a positional, so a document whose name begins with \`-\`
68
+ can still be named.
69
+
70
+ A schema document named with a \`.yaml\` or \`.yml\` extension is read by the YAML front
71
+ door; every other name is read as JSON. The format is the extension and nothing else — there
72
+ is no content sniffing, and standard input has no extension, so it keeps the JSON meaning.
73
+ The artifact is JSON either way: \`compile --out\` writes the same bytes from either spelling.
74
+
75
+ Dataset sources named by --dataset (and by position in compile-dataset) are JSON
76
+ documents unless the path ends in \`.csv\`; a CSV carries no metadata, so each CSV file
77
+ pairs with one --declaration JSON file, in the order both are given. A diff of two dataset
78
+ documents takes neither: they supply the tables a schema names.
79
+
80
+ Every command that reports schema diagnostics accepts --max-diagnostics=N|all (default
81
+ 200). The cap bounds what is printed, never what is checked: the compile itself stays
82
+ exhaustive, and a capped report ends with a line counting the diagnostics withheld.
83
+
84
+ Exit codes:
85
+ 0 the command succeeded (for \`diff\`, the comparison completed, changed or not)
86
+ 1 the document is invalid, the compile failed, a case failed, or the schema is not
87
+ ready to publish
88
+ 2 usage error, an unreadable file, or bytes that are not valid UTF-8, or a file that
89
+ cannot be written`;
90
+ /** Prints the help screen and reports success, which is what naming --help means. */
91
+ export function showHelp() {
92
+ printStaticText(`${HELP}\n`);
93
+ return EXIT_OK;
94
+ }
95
+ //# sourceMappingURL=usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/cli/usage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAE5B,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,OAAO,EAAE,mFAAmF;IAC5F,KAAK,EACH,4HAA4H;IAC9H,OAAO,EACL,0MAA0M;IAC5M,cAAc,EACZ,qFAAqF;IACvF,IAAI,EAAE,0LAA0L;IAChM,IAAI,EAAE,wIAAwI;IAC9I,WAAW,EACT,uJAAuJ;CACjJ,CAAC;AAEX,MAAM,IAAI,GAAW,GAAG,KAAK,CAAC,OAAO;SAC5B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;SACnC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;SACrC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;SAC5C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;SAClC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;SAClC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA8D3B,CAAC;AAExB,qFAAqF;AACrF,MAAM,UAAU,QAAQ;IACtB,eAAe,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;IAC7B,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/**\n * The command line's published surface: the usage line each command refuses an invocation\n * with, the help screen, and the exit code every verdict maps onto.\n *\n * A refusal is only useful if it says what would have worked, so each usage line names every\n * option together with the values it accepts.\n */\nimport { printStaticText } from './terminal.js';\n\nexport const EXIT_OK = 0;\nexport const EXIT_FAILED = 1;\nexport const EXIT_USAGE = 2;\n\nexport const USAGE = {\n summary: 'usage: axiom-cli <check|compile|compile-dataset|test|diff|explain-deps> [options]',\n check:\n 'usage: axiom-cli check <schema.json|schema.yaml> [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all]',\n compile:\n 'usage: axiom-cli compile <schema.json|schema.yaml> [--target server|client] [--producer-version <release>|none] [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all] [--out <file>]',\n compileDataset:\n 'usage: axiom-cli compile-dataset <file>... [--declaration <file>]... [--out <file>]',\n test: 'usage: axiom-cli test <schema.json|schema.yaml> [--suite <file>]... [--dataset <file>]... [--declaration <file>]... [--coverage=require|report] [--out <file>] [--max-diagnostics=N|all]',\n diff: 'usage: axiom-cli diff <before.json|.yaml> <after.json|.yaml> [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all]',\n explainDeps:\n 'usage: axiom-cli explain-deps <schema.json|schema.yaml> [--field <fieldId>] [--dataset <file>]... [--declaration <file>]... [--max-diagnostics=N|all]',\n} as const;\n\nconst HELP: string = `${USAGE.summary}\n ${USAGE.check.slice('usage: '.length)}\n ${USAGE.compile.slice('usage: '.length)}\n ${USAGE.compileDataset.slice('usage: '.length)}\n ${USAGE.test.slice('usage: '.length)}\n ${USAGE.diff.slice('usage: '.length)}\n ${USAGE.explainDeps.slice('usage: '.length)}\n\ncheck Validate one schema document against the closed metaschema and the\n language, and report every diagnostic.\ncompile Compile one authored schema into the artifact a target evaluates.\n --target client replaces every \\`evaluateOn: 'server'\\` rule with a\n DEFERRED stub, so a device never carries server logic.\n The artifact is stamped with the release this compiler was built\n as (producerVersion); \\`--producer-version none\\` omits the member\n for bytes that must stay independent of the release that wrote them.\ncompile-dataset Compile CSV and JSON tables into one installable catalog. A duplicate or\n overlapping version of one table is refused.\ntest Run the evidence a schema publishes: the vectors embedded in it and any\n scenario suite named by --suite, against the compiled artifact and the tables\n --dataset supplies. Publish readiness needs a case on each branch a rule\n can take. A literal-boolean validate, visible, required or enabled rule leaves one\n branch; every other rule needs firing and non-firing cases. A rule may be covered\n by a suite instead of a vector.\n A vector may declare the environment it runs under: capabilities (the flags\n has_cap reports), recordDate (the local record date a data-bound set resolves\n in_set against) and tier (default server).\n --coverage=require (the default) exits 1 on any gap; --coverage=report prints the\n gaps and exits 0 unless an executed assertion or table binding failed.\n --out writes the verification as canonical JSON (\\`-\\` writes it to stdout and\n moves the human lines to stderr).\n A --suite file is a JSON suite document unless the path ends in \\`.csv\\`: a CSV is a\n flat scenario matrix, one row to a scenario, with the columns and the cell\n spelling documented in docs/authoring/publishing.md. A cell is never coerced: an\n empty value cell is absent, \\`null\\` is the wire null, a text value is a JSON\n string literal, and numbers, dates and instants are their canonical spelling.\n Use a JSON suite for a nested record, an array, money, an attachment, a\n redaction, a capability or a row key.\ndiff Compare two versions of one schema (behaviour and declarations) or of\n one dataset table, and print the deterministic summary.\nexplain-deps Print the derived dependency graph: what each rule reads, which rules a\n gate folds, and the order computed fields must be recalculated in.\n\nEvery command accepts --help (or -h) in place of running, and every option takes one\nvalue: naming a scalar option twice is a usage error. A document argument of \\`-\\` reads\nstandard input, once per run, and \\`--out -\\` writes the artifact to standard output.\nEverything after \\`--\\` is read as a positional, so a document whose name begins with \\`-\\`\ncan still be named.\n\nA schema document named with a \\`.yaml\\` or \\`.yml\\` extension is read by the YAML front\ndoor; every other name is read as JSON. The format is the extension and nothing else — there\nis no content sniffing, and standard input has no extension, so it keeps the JSON meaning.\nThe artifact is JSON either way: \\`compile --out\\` writes the same bytes from either spelling.\n\nDataset sources named by --dataset (and by position in compile-dataset) are JSON\ndocuments unless the path ends in \\`.csv\\`; a CSV carries no metadata, so each CSV file\npairs with one --declaration JSON file, in the order both are given. A diff of two dataset\ndocuments takes neither: they supply the tables a schema names.\n\nEvery command that reports schema diagnostics accepts --max-diagnostics=N|all (default\n200). The cap bounds what is printed, never what is checked: the compile itself stays\nexhaustive, and a capped report ends with a line counting the diagnostics withheld.\n\nExit codes:\n 0 the command succeeded (for \\`diff\\`, the comparison completed, changed or not)\n 1 the document is invalid, the compile failed, a case failed, or the schema is not\n ready to publish\n 2 usage error, an unreadable file, or bytes that are not valid UTF-8, or a file that\n cannot be written`;\n\n/** Prints the help screen and reports success, which is what naming --help means. */\nexport function showHelp(): number {\n printStaticText(`${HELP}\\n`);\n return EXIT_OK;\n}\n"]}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * The `axiom-cli` command line — the bin entry.
4
+ *
5
+ * This file is the process boundary and nothing else: it decides whether the module is the
6
+ * program rather than an import, keeps a closed pipe from becoming a stack trace, and maps a
7
+ * throw no command anticipated onto the exit code a failed compile already has. The six
8
+ * commands, their argument grammar, the document readers and the terminal boundary live in
9
+ * `./cli/`.
10
+ *
11
+ * Nothing that reaches a terminal is trusted; the escaping itself lives beside the writes in
12
+ * `./cli/terminal.ts`.
13
+ */
14
+ import { realpathSync } from 'node:fs';
15
+ import process from 'node:process';
16
+ import { fileURLToPath } from 'node:url';
17
+ import { main } from './cli/main.js';
18
+ import { causeText, ignoreClosedPipe, printErrorLine } from './cli/terminal.js';
19
+ import { EXIT_FAILED } from './cli/usage.js';
20
+ const modulePath = realpathSync(fileURLToPath(import.meta.url));
21
+ /** Whether this module is the program, compared by real path so a bin symlink still runs. */
22
+ function invokedDirectly() {
23
+ const entry = process.argv[1];
24
+ if (entry === undefined)
25
+ return false;
26
+ try {
27
+ return realpathSync(entry) === modulePath;
28
+ }
29
+ catch {
30
+ return false;
31
+ }
32
+ }
33
+ if (invokedDirectly()) {
34
+ ignoreClosedPipe(process.stdout);
35
+ ignoreClosedPipe(process.stderr);
36
+ // The process boundary is total: a command that cannot complete reports one line naming the
37
+ // cause rather than the Node stack trace of whichever callee gave out. `main` returns an exit
38
+ // code for every refusal it knows about, but a document can still drive a callee past its own
39
+ // limits — a vector wide enough makes the metaschema validator accumulate more errors than its
40
+ // recursion carries, and it raises instead of returning diagnostics. The compile did fail, so
41
+ // the exit code is the one the contract already names for that; the cause is reported, not
42
+ // swallowed.
43
+ try {
44
+ process.exitCode = await main(process.argv.slice(2));
45
+ }
46
+ catch (cause) {
47
+ printErrorLine(`axiom-cli: the command could not complete: ${causeText(cause)}`);
48
+ process.exitCode = EXIT_FAILED;
49
+ }
50
+ }
51
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,UAAU,GAAG,YAAY,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhE,6FAA6F;AAC7F,SAAS,eAAe;IACtB,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,IAAI,eAAe,EAAE,EAAE,CAAC;IACtB,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,4FAA4F;IAC5F,8FAA8F;IAC9F,8FAA8F;IAC9F,+FAA+F;IAC/F,8FAA8F;IAC9F,2FAA2F;IAC3F,aAAa;IACb,IAAI,CAAC;QACH,OAAO,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,cAAc,CAAC,8CAA8C,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACjF,OAAO,CAAC,QAAQ,GAAG,WAAW,CAAC;IACjC,CAAC;AACH,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * The `axiom-cli` command line — the bin entry.\n *\n * This file is the process boundary and nothing else: it decides whether the module is the\n * program rather than an import, keeps a closed pipe from becoming a stack trace, and maps a\n * throw no command anticipated onto the exit code a failed compile already has. The six\n * commands, their argument grammar, the document readers and the terminal boundary live in\n * `./cli/`.\n *\n * Nothing that reaches a terminal is trusted; the escaping itself lives beside the writes in\n * `./cli/terminal.ts`.\n */\nimport { realpathSync } from 'node:fs';\nimport process from 'node:process';\nimport { fileURLToPath } from 'node:url';\nimport { main } from './cli/main.js';\nimport { causeText, ignoreClosedPipe, printErrorLine } from './cli/terminal.js';\nimport { EXIT_FAILED } from './cli/usage.js';\n\nconst modulePath = realpathSync(fileURLToPath(import.meta.url));\n\n/** Whether this module is the program, compared by real path so a bin symlink still runs. */\nfunction invokedDirectly(): boolean {\n const entry = process.argv[1];\n if (entry === undefined) return false;\n try {\n return realpathSync(entry) === modulePath;\n } catch {\n return false;\n }\n}\n\nif (invokedDirectly()) {\n ignoreClosedPipe(process.stdout);\n ignoreClosedPipe(process.stderr);\n // The process boundary is total: a command that cannot complete reports one line naming the\n // cause rather than the Node stack trace of whichever callee gave out. `main` returns an exit\n // code for every refusal it knows about, but a document can still drive a callee past its own\n // limits — a vector wide enough makes the metaschema validator accumulate more errors than its\n // recursion carries, and it raises instead of returning diagnostics. The compile did fail, so\n // the exit code is the one the contract already names for that; the cause is reported, not\n // swallowed.\n try {\n process.exitCode = await main(process.argv.slice(2));\n } catch (cause) {\n printErrorLine(`axiom-cli: the command could not complete: ${causeText(cause)}`);\n process.exitCode = EXIT_FAILED;\n }\n}\n"]}
@@ -0,0 +1,57 @@
1
+ import type { Tier } from '@azx-pbc/axiom-runtime';
2
+ import type { SchemaDiagnostic } from '../schema/diagnostic.js';
3
+ /**
4
+ * One root member the compiled artifact states that the authored document contract does not.
5
+ *
6
+ * The closed metaschema is the document contract: it admits no member a compile invented, so
7
+ * an artifact-only fact has to be named here, with the reason it cannot be authored, and the
8
+ * artifact check has to read this list rather than exempting the member somewhere else.
9
+ */
10
+ export interface ArtifactOnlyMember {
11
+ /** The root member name, exactly as the artifact spells it. */
12
+ readonly member: string;
13
+ /** Why the closed document contract cannot state it, and the artifact must. */
14
+ readonly reason: string;
15
+ /** Whether a present value is one the artifact contract admits. */
16
+ readonly admits: (value: unknown) => boolean;
17
+ /**
18
+ * Whether every artifact must state the member.
19
+ *
20
+ * `target` is always present because the compile always knows its tier; `composition` is
21
+ * present only when an overlay was applied, so a single-document artifact keeps the bytes it
22
+ * had before overlays existed.
23
+ */
24
+ readonly required: boolean;
25
+ }
26
+ /**
27
+ * Every root member the compiled artifact states outside the closed document contract.
28
+ *
29
+ * `target` and `composition` are the entries today: a compile option selects the tier, and a
30
+ * layered compile states the base and overlay editions, so an authored document can spell
31
+ * neither (the metaschema closes the root), while the artifact states the facts the compile
32
+ * knows. `target` is always present; `composition` only after an overlay was applied. The
33
+ * artifact's other invented member is nested — `datasets[].sha256` — and is handled by
34
+ * `compiledDatasets` below, because this list describes root members. A member added to
35
+ * `CompiledSchema` but not to the metaschema belongs in one of the two places; the alignment
36
+ * gate compares the root sets and fails until it is.
37
+ */
38
+ export declare const ARTIFACT_ONLY_MEMBERS: readonly ArtifactOnlyMember[];
39
+ /** The artifact-only member names, in the order the contract states them. */
40
+ export declare function artifactOnlyMemberNames(): readonly string[];
41
+ /**
42
+ * The artifact-only target, narrowed from the composed tree the check has already admitted.
43
+ * A value outside the two tiers is a compiler defect, not an author's mistake.
44
+ */
45
+ export declare function compiledTargetOf(value: unknown): Tier;
46
+ /**
47
+ * Validates the composed artifact: the closed metaschema over every member it owns, plus
48
+ * exactly the artifact-only members this module names.
49
+ *
50
+ * The compiler assembles an artifact with `target` already present, so this is the gate the
51
+ * emitted form passes. The metaschema never sees an artifact-only member, and an artifact-only
52
+ * member is never accepted by accident: a member in neither place is refused by the metaschema's
53
+ * closed root, while a malformed artifact-only member — or a required one that is missing — is
54
+ * refused here. `composition` is optional because a single-document compile applies no overlay.
55
+ */
56
+ export declare function validateCompiledArtifact(artifact: unknown): readonly SchemaDiagnostic[];
57
+ //# sourceMappingURL=artifact-members.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-members.d.ts","sourceRoot":"","sources":["../../src/compile/artifact-members.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAOD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAe9D,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,uBAAuB,IAAI,SAAS,MAAM,EAAE,CAE3D;AAsCD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAKrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,gBAAgB,EAAE,CAkCvF"}
@@ -0,0 +1,130 @@
1
+ import { SHA256_HEX_PATTERN, isCompositionReport, isRecord, isTier } from '@azx-pbc/axiom-runtime';
2
+ import { validateCompiledDocument } from '../schema/validate.js';
3
+ /** Whether `value` is a tier the artifact contract admits, as the one runtime vocabulary states it. */
4
+ function isTierValue(value) {
5
+ return typeof value === 'string' && isTier(value);
6
+ }
7
+ /**
8
+ * Every root member the compiled artifact states outside the closed document contract.
9
+ *
10
+ * `target` and `composition` are the entries today: a compile option selects the tier, and a
11
+ * layered compile states the base and overlay editions, so an authored document can spell
12
+ * neither (the metaschema closes the root), while the artifact states the facts the compile
13
+ * knows. `target` is always present; `composition` only after an overlay was applied. The
14
+ * artifact's other invented member is nested — `datasets[].sha256` — and is handled by
15
+ * `compiledDatasets` below, because this list describes root members. A member added to
16
+ * `CompiledSchema` but not to the metaschema belongs in one of the two places; the alignment
17
+ * gate compares the root sets and fails until it is.
18
+ */
19
+ export const ARTIFACT_ONLY_MEMBERS = [
20
+ {
21
+ member: 'target',
22
+ reason: 'the tier is a compile option, so the closed document contract admits no authored `target`; the artifact states the tier it was built for',
23
+ admits: isTierValue,
24
+ required: true,
25
+ },
26
+ {
27
+ member: 'composition',
28
+ reason: 'the base edition and the overlay editions are a compile-time composition, so the closed document contract admits no authored `composition`; the artifact states the configuration that produced it',
29
+ admits: isCompositionReport,
30
+ required: false,
31
+ },
32
+ ];
33
+ /** The artifact-only member names, in the order the contract states them. */
34
+ export function artifactOnlyMemberNames() {
35
+ return ARTIFACT_ONLY_MEMBERS.map((entry) => entry.member);
36
+ }
37
+ /**
38
+ * The dataset pins as the closed document contract sees them, and the diagnostics for the one
39
+ * nested artifact-only member the contract cannot state.
40
+ *
41
+ * A `datasetRef` is closed to `tableId` and `tableVersion` in the authored document, because an
42
+ * author names a table and the version they compiled against; the bytes that version resolves to
43
+ * are a fact of the build, not of the draft. The compiled artifact therefore adds `sha256` to
44
+ * each ref (`DATA-4.1.6`), and this projection holds that member to its own shape before the
45
+ * closed check runs over the rest. The member is stripped rather than exempted, so the metaschema
46
+ * still refuses every other invented member at every depth.
47
+ */
48
+ function compiledDatasets(value) {
49
+ if (!Array.isArray(value))
50
+ return { value, diagnostics: [] };
51
+ const diagnostics = [];
52
+ const stripped = value.map((entry, index) => {
53
+ if (!isRecord(entry))
54
+ return entry;
55
+ const sha256 = entry['sha256'];
56
+ if (typeof sha256 !== 'string' || !SHA256_HEX_PATTERN.test(sha256)) {
57
+ diagnostics.push({
58
+ code: 'SCHEMA_INVALID',
59
+ path: `$.datasets[${String(index)}].sha256`,
60
+ detail: `the compiled artifact pins table \`${String(entry['tableId'])}\` without the lowercase hexadecimal SHA-256 of the document it pins; the pin would bind a version name rather than the table's bytes`,
61
+ });
62
+ }
63
+ const document = {};
64
+ for (const [member, memberValue] of Object.entries(entry)) {
65
+ if (member !== 'sha256')
66
+ document[member] = memberValue;
67
+ }
68
+ return document;
69
+ });
70
+ return { value: stripped, diagnostics };
71
+ }
72
+ /**
73
+ * The artifact-only target, narrowed from the composed tree the check has already admitted.
74
+ * A value outside the two tiers is a compiler defect, not an author's mistake.
75
+ */
76
+ export function compiledTargetOf(value) {
77
+ if (!isTierValue(value)) {
78
+ throw new Error('the compiled artifact carries a target outside the two tiers');
79
+ }
80
+ return value;
81
+ }
82
+ /**
83
+ * Validates the composed artifact: the closed metaschema over every member it owns, plus
84
+ * exactly the artifact-only members this module names.
85
+ *
86
+ * The compiler assembles an artifact with `target` already present, so this is the gate the
87
+ * emitted form passes. The metaschema never sees an artifact-only member, and an artifact-only
88
+ * member is never accepted by accident: a member in neither place is refused by the metaschema's
89
+ * closed root, while a malformed artifact-only member — or a required one that is missing — is
90
+ * refused here. `composition` is optional because a single-document compile applies no overlay.
91
+ */
92
+ export function validateCompiledArtifact(artifact) {
93
+ if (!isRecord(artifact))
94
+ return validateCompiledDocument(artifact);
95
+ const document = {};
96
+ const diagnostics = [];
97
+ for (const [member, value] of Object.entries(artifact)) {
98
+ const artifactOnly = ARTIFACT_ONLY_MEMBERS.find((entry) => entry.member === member);
99
+ if (artifactOnly === undefined) {
100
+ if (member === 'datasets') {
101
+ const datasets = compiledDatasets(value);
102
+ document[member] = datasets.value;
103
+ diagnostics.push(...datasets.diagnostics);
104
+ continue;
105
+ }
106
+ document[member] = value;
107
+ continue;
108
+ }
109
+ if (!artifactOnly.admits(value)) {
110
+ diagnostics.push({
111
+ code: 'SCHEMA_INVALID',
112
+ path: `$.${member}`,
113
+ detail: `the compiled artifact carries \`${member}\`, which is outside the values its contract admits`,
114
+ });
115
+ }
116
+ }
117
+ for (const entry of ARTIFACT_ONLY_MEMBERS) {
118
+ if (Object.hasOwn(artifact, entry.member))
119
+ continue;
120
+ if (!entry.required)
121
+ continue;
122
+ diagnostics.push({
123
+ code: 'SCHEMA_INVALID',
124
+ path: `$.${entry.member}`,
125
+ detail: `the compiled artifact is missing \`${entry.member}\`: ${entry.reason}`,
126
+ });
127
+ }
128
+ return [...diagnostics, ...validateCompiledDocument(document)];
129
+ }
130
+ //# sourceMappingURL=artifact-members.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-members.js","sourceRoot":"","sources":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{ Tier } from '@azx-pbc/axiom-runtime';\nimport type { SchemaDiagnostic } from '../schema/diagnostic.js';\nimport { validateCompiledDocument } from '../schema/validate.js';\n\n/**\n * One root member the compiled artifact states that the authored document contract does not.\n *\n * The closed metaschema is the document contract: it admits no member a compile invented, so\n * an artifact-only fact has to be named here, with the reason it cannot be authored, and the\n * artifact check has to read this list rather than exempting the member somewhere else.\n */\nexport interface ArtifactOnlyMember {\n /** The root member name, exactly as the artifact spells it. */\n readonly member: string;\n /** Why the closed document contract cannot state it, and the artifact must. */\n readonly reason: string;\n /** Whether a present value is one the artifact contract admits. */\n readonly admits: (value: unknown) => boolean;\n /**\n * Whether every artifact must state the member.\n *\n * `target` is always present because the compile always knows its tier; `composition` is\n * present only when an overlay was applied, so a single-document artifact keeps the bytes it\n * had before overlays existed.\n */\n readonly required: boolean;\n}\n\n/** Whether `value` is a tier the artifact contract admits, as the one runtime vocabulary states it. */\nfunction isTierValue(value: unknown): value is Tier {\n return typeof value === 'string' && isTier(value);\n}\n\n/**\n * Every root member the compiled artifact states outside the closed document contract.\n *\n * `target` and `composition` are the entries today: a compile option selects the tier, and a\n * layered compile states the base and overlay editions, so an authored document can spell\n * neither (the metaschema closes the root), while the artifact states the facts the compile\n * knows. `target` is always present; `composition` only after an overlay was applied. The\n * artifact's other invented member is nested — `datasets[].sha256` — and is handled by\n * `compiledDatasets` below, because this list describes root members. A member added to\n * `CompiledSchema` but not to the metaschema belongs in one of the two places; the alignment\n * gate compares the root sets and fails until it is.\n */\nexport const ARTIFACT_ONLY_MEMBERS: readonly ArtifactOnlyMember[] = [\n {\n member: 'target',\n reason:\n 'the tier is a compile option, so the closed document contract admits no authored `target`; the artifact states the tier it was built for',\n admits: isTierValue,\n required: true,\n },\n {\n member: 'composition',\n reason:\n 'the base edition and the overlay editions are a compile-time composition, so the closed document contract admits no authored `composition`; the artifact states the configuration that produced it',\n admits: isCompositionReport,\n required: false,\n },\n];\n\n/** The artifact-only member names, in the order the contract states them. */\nexport function artifactOnlyMemberNames(): readonly string[] {\n return ARTIFACT_ONLY_MEMBERS.map((entry) => entry.member);\n}\n\n/**\n * The dataset pins as the closed document contract sees them, and the diagnostics for the one\n * nested artifact-only member the contract cannot state.\n *\n * A `datasetRef` is closed to `tableId` and `tableVersion` in the authored document, because an\n * author names a table and the version they compiled against; the bytes that version resolves to\n * are a fact of the build, not of the draft. The compiled artifact therefore adds `sha256` to\n * each ref (`DATA-4.1.6`), and this projection holds that member to its own shape before the\n * closed check runs over the rest. The member is stripped rather than exempted, so the metaschema\n * still refuses every other invented member at every depth.\n */\nfunction compiledDatasets(value: unknown): {\n readonly value: unknown;\n readonly diagnostics: readonly SchemaDiagnostic[];\n} {\n if (!Array.isArray(value)) return { value, diagnostics: [] };\n const diagnostics: SchemaDiagnostic[] = [];\n const stripped = value.map((entry, index) => {\n if (!isRecord(entry)) return entry;\n const sha256 = entry['sha256'];\n if (typeof sha256 !== 'string' || !SHA256_HEX_PATTERN.test(sha256)) {\n diagnostics.push({\n code: 'SCHEMA_INVALID',\n path: `$.datasets[${String(index)}].sha256`,\n detail: `the compiled artifact pins table \\`${String(entry['tableId'])}\\` without the lowercase hexadecimal SHA-256 of the document it pins; the pin would bind a version name rather than the table's bytes`,\n });\n }\n const document: Record<string, unknown> = {};\n for (const [member, memberValue] of Object.entries(entry)) {\n if (member !== 'sha256') document[member] = memberValue;\n }\n return document;\n });\n return { value: stripped, diagnostics };\n}\n\n/**\n * The artifact-only target, narrowed from the composed tree the check has already admitted.\n * A value outside the two tiers is a compiler defect, not an author's mistake.\n */\nexport function compiledTargetOf(value: unknown): Tier {\n if (!isTierValue(value)) {\n throw new Error('the compiled artifact carries a target outside the two tiers');\n }\n return value;\n}\n\n/**\n * Validates the composed artifact: the closed metaschema over every member it owns, plus\n * exactly the artifact-only members this module names.\n *\n * The compiler assembles an artifact with `target` already present, so this is the gate the\n * emitted form passes. The metaschema never sees an artifact-only member, and an artifact-only\n * member is never accepted by accident: a member in neither place is refused by the metaschema's\n * closed root, while a malformed artifact-only member — or a required one that is missing — is\n * refused here. `composition` is optional because a single-document compile applies no overlay.\n */\nexport function validateCompiledArtifact(artifact: unknown): readonly SchemaDiagnostic[] {\n if (!isRecord(artifact)) return validateCompiledDocument(artifact);\n const document: Record<string, unknown> = {};\n const diagnostics: SchemaDiagnostic[] = [];\n for (const [member, value] of Object.entries(artifact)) {\n const artifactOnly = ARTIFACT_ONLY_MEMBERS.find((entry) => entry.member === member);\n if (artifactOnly === undefined) {\n if (member === 'datasets') {\n const datasets = compiledDatasets(value);\n document[member] = datasets.value;\n diagnostics.push(...datasets.diagnostics);\n continue;\n }\n document[member] = value;\n continue;\n }\n if (!artifactOnly.admits(value)) {\n diagnostics.push({\n code: 'SCHEMA_INVALID',\n path: `$.${member}`,\n detail: `the compiled artifact carries \\`${member}\\`, which is outside the values its contract admits`,\n });\n }\n }\n for (const entry of ARTIFACT_ONLY_MEMBERS) {\n if (Object.hasOwn(artifact, entry.member)) continue;\n if (!entry.required) continue;\n diagnostics.push({\n code: 'SCHEMA_INVALID',\n path: `$.${entry.member}`,\n detail: `the compiled artifact is missing \\`${entry.member}\\`: ${entry.reason}`,\n });\n }\n return [...diagnostics, ...validateCompiledDocument(document)];\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import type { CompiledField, CompiledMessageEntry, CompiledRule, CompiledSchema, CompositionReport, ContextRoot, LayoutNode } from '@azx-pbc/axiom-runtime';
2
+ /** The declared context roots, in the form the artifact carries them. */
3
+ export declare function documentContextRoots(document: Record<string, unknown>): readonly ContextRoot[];
4
+ /**
5
+ * The artifact the runtime consumes: the validated tree narrowed member by member.
6
+ *
7
+ * Every value here has just passed the artifact check (`validateCompiledArtifact`), so a member
8
+ * that cannot be narrowed is a compiler defect and fails loudly instead of shipping a
9
+ * half-artifact. The members the compile already typed — the declared fields with their compiled
10
+ * slots, the rules, the message catalogue and the layout — are passed in rather than re-encoded.
11
+ */
12
+ export declare function compiledSchemaOf(schema: Record<string, unknown>, compiled: {
13
+ readonly fields: readonly CompiledField[];
14
+ readonly rules: readonly CompiledRule[];
15
+ readonly messages: Readonly<Record<string, Readonly<Record<string, CompiledMessageEntry>>>>;
16
+ readonly layout: readonly LayoutNode[];
17
+ readonly producerVersion?: string;
18
+ readonly composition?: CompositionReport;
19
+ }): CompiledSchema;
20
+ //# sourceMappingURL=artifact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../src/compile/artifact.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,WAAW,EAEX,UAAU,EACX,MAAM,wBAAwB,CAAC;AAKhC,yEAAyE;AACzE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,WAAW,EAAE,CAQ9F;AAwBD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,QAAQ,EAAE;IACR,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5F,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC;CAC1C,GACA,cAAc,CA+ChB"}
@@ -0,0 +1,87 @@
1
+ import { DEFAULT_EVIDENCE_TIER, isRecord } from '@azx-pbc/axiom-runtime';
2
+ import { documentContextRoot } from '../schema/validate.js';
3
+ import { compiledTargetOf } from './artifact-members.js';
4
+ import { listAt, textAt } from './document.js';
5
+ /** The declared context roots, in the form the artifact carries them. */
6
+ export function documentContextRoots(document) {
7
+ const context = document['context'];
8
+ if (!isRecord(context))
9
+ return [];
10
+ return listAt(context, 'roots').map((root) => {
11
+ if (!isRecord(root))
12
+ throw new Error('the compiled document carries a context root that is not an object');
13
+ return documentContextRoot(root);
14
+ });
15
+ }
16
+ /** The tables the artifact pins, each with the version and the canonical digest it binds. */
17
+ function compiledDatasets(document) {
18
+ return listAt(document, 'datasets')
19
+ .filter(isRecord)
20
+ .map((ref) => {
21
+ const tableId = textAt(ref, 'tableId');
22
+ const tableVersion = ref['tableVersion'];
23
+ const sha256 = ref['sha256'];
24
+ if (tableId === undefined ||
25
+ typeof tableVersion !== 'number' ||
26
+ !Number.isSafeInteger(tableVersion) ||
27
+ typeof sha256 !== 'string') {
28
+ throw new Error('the compiled document carries a dataset reference without an identity or digest');
29
+ }
30
+ return { tableId, tableVersion, sha256 };
31
+ });
32
+ }
33
+ /**
34
+ * The artifact the runtime consumes: the validated tree narrowed member by member.
35
+ *
36
+ * Every value here has just passed the artifact check (`validateCompiledArtifact`), so a member
37
+ * that cannot be narrowed is a compiler defect and fails loudly instead of shipping a
38
+ * half-artifact. The members the compile already typed — the declared fields with their compiled
39
+ * slots, the rules, the message catalogue and the layout — are passed in rather than re-encoded.
40
+ */
41
+ export function compiledSchemaOf(schema, compiled) {
42
+ const schemaId = textAt(schema, 'schemaId');
43
+ const schemaVersion = schema['schemaVersion'];
44
+ if (typeof schemaId !== 'string' || typeof schemaVersion !== 'number') {
45
+ throw new Error('the compiled document lost its schemaId or schemaVersion');
46
+ }
47
+ if (schema['exprVersion'] !== 1) {
48
+ throw new Error('the compiled document is not Expr v1');
49
+ }
50
+ const target = compiledTargetOf(schema['target']);
51
+ const roots = documentContextRoots(schema);
52
+ const datasets = compiledDatasets(schema);
53
+ const layout = compiled.layout;
54
+ const titleKey = textAt(schema, 'titleKey');
55
+ const onHide = textAt(schema, 'onHide');
56
+ const locales = listAt(schema, 'locales').filter((locale) => typeof locale === 'string');
57
+ const defaultLocale = textAt(schema, 'defaultLocale');
58
+ const primaryGateId = textAt(schema, 'primaryGateId');
59
+ const primaryScreenId = textAt(schema, 'primaryScreenId');
60
+ return {
61
+ schemaId,
62
+ schemaVersion,
63
+ exprVersion: 1,
64
+ ...(compiled.producerVersion === undefined
65
+ ? {}
66
+ : { producerVersion: compiled.producerVersion }),
67
+ // The default is never materialised: a server artifact states no target, and a device
68
+ // artifact is the one a publisher must refuse, so the member is emitted only when a caller
69
+ // asked for something other than the default. The composed tree carried it either way, so
70
+ // the artifact check saw the tier before this narrowing applied the runtime's default.
71
+ ...(target === DEFAULT_EVIDENCE_TIER ? {} : { target }),
72
+ fields: compiled.fields,
73
+ ...(locales.length === 0 ? {} : { locales }),
74
+ ...(defaultLocale === undefined ? {} : { defaultLocale }),
75
+ ...(primaryGateId === undefined ? {} : { primaryGateId }),
76
+ ...(primaryScreenId === undefined ? {} : { primaryScreenId }),
77
+ ...(titleKey === undefined ? {} : { titleKey }),
78
+ ...(roots.length === 0 ? {} : { context: { roots } }),
79
+ ...(layout.length === 0 ? {} : { layout }),
80
+ ...(compiled.rules.length === 0 ? {} : { rules: compiled.rules }),
81
+ ...(Object.keys(compiled.messages).length === 0 ? {} : { messages: compiled.messages }),
82
+ ...(datasets.length === 0 ? {} : { datasets }),
83
+ ...(onHide !== 'preserve' && onHide !== 'exclude' ? {} : { onHide }),
84
+ ...(compiled.composition === undefined ? {} : { composition: compiled.composition }),
85
+ };
86
+ }
87
+ //# sourceMappingURL=artifact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../src/compile/artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAWzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,C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,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACvF,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;QAC9C,GAAG,CAAC,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;QACpE,GAAG,CAAC,QAAQ,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC;KACrF,CAAC;AACJ,CAAC","sourcesContent":["import { DEFAULT_EVIDENCE_TIER, isRecord } from '@azx-pbc/axiom-runtime';\nimport type {\n CompiledField,\n CompiledMessageEntry,\n CompiledRule,\n CompiledSchema,\n CompositionReport,\n ContextRoot,\n DatasetRef,\n LayoutNode,\n} from '@azx-pbc/axiom-runtime';\nimport { documentContextRoot } from '../schema/validate.js';\nimport { compiledTargetOf } from './artifact-members.js';\nimport { listAt, textAt } from './document.js';\n\n/** The declared context roots, in the form the artifact carries them. */\nexport function documentContextRoots(document: Record<string, unknown>): readonly ContextRoot[] {\n const context = document['context'];\n if (!isRecord(context)) return [];\n return listAt(context, 'roots').map((root) => {\n if (!isRecord(root))\n throw new Error('the compiled document carries a context root that is not an object');\n return documentContextRoot(root);\n });\n}\n\n/** The tables the artifact pins, each with the version and the canonical digest it binds. */\nfunction compiledDatasets(document: Record<string, unknown>): readonly DatasetRef[] {\n return listAt(document, 'datasets')\n .filter(isRecord)\n .map((ref) => {\n const tableId = textAt(ref, 'tableId');\n const tableVersion = ref['tableVersion'];\n const sha256 = ref['sha256'];\n if (\n tableId === undefined ||\n typeof tableVersion !== 'number' ||\n !Number.isSafeInteger(tableVersion) ||\n typeof sha256 !== 'string'\n ) {\n throw new Error(\n 'the compiled document carries a dataset reference without an identity or digest',\n );\n }\n return { tableId, tableVersion, sha256 };\n });\n}\n\n/**\n * The artifact the runtime consumes: the validated tree narrowed member by member.\n *\n * Every value here has just passed the artifact check (`validateCompiledArtifact`), so a member\n * that cannot be narrowed is a compiler defect and fails loudly instead of shipping a\n * half-artifact. The members the compile already typed — the declared fields with their compiled\n * slots, the rules, the message catalogue and the layout — are passed in rather than re-encoded.\n */\nexport function compiledSchemaOf(\n schema: Record<string, unknown>,\n compiled: {\n readonly fields: readonly CompiledField[];\n readonly rules: readonly CompiledRule[];\n readonly messages: Readonly<Record<string, Readonly<Record<string, CompiledMessageEntry>>>>;\n readonly layout: readonly LayoutNode[];\n readonly producerVersion?: string;\n readonly composition?: CompositionReport;\n },\n): CompiledSchema {\n const schemaId = textAt(schema, 'schemaId');\n const schemaVersion = schema['schemaVersion'];\n if (typeof schemaId !== 'string' || typeof schemaVersion !== 'number') {\n throw new Error('the compiled document lost its schemaId or schemaVersion');\n }\n if (schema['exprVersion'] !== 1) {\n throw new Error('the compiled document is not Expr v1');\n }\n const target = compiledTargetOf(schema['target']);\n const roots = documentContextRoots(schema);\n const datasets = compiledDatasets(schema);\n const layout = compiled.layout;\n const titleKey = textAt(schema, 'titleKey');\n const onHide = textAt(schema, 'onHide');\n const locales = listAt(schema, 'locales').filter(\n (locale): locale is string => typeof locale === 'string',\n );\n const defaultLocale = textAt(schema, 'defaultLocale');\n const primaryGateId = textAt(schema, 'primaryGateId');\n const primaryScreenId = textAt(schema, 'primaryScreenId');\n return {\n schemaId,\n schemaVersion,\n exprVersion: 1,\n ...(compiled.producerVersion === undefined\n ? {}\n : { producerVersion: compiled.producerVersion }),\n // The default is never materialised: a server artifact states no target, and a device\n // artifact is the one a publisher must refuse, so the member is emitted only when a caller\n // asked for something other than the default. The composed tree carried it either way, so\n // the artifact check saw the tier before this narrowing applied the runtime's default.\n ...(target === DEFAULT_EVIDENCE_TIER ? {} : { target }),\n fields: compiled.fields,\n ...(locales.length === 0 ? {} : { locales }),\n ...(defaultLocale === undefined ? {} : { defaultLocale }),\n ...(primaryGateId === undefined ? {} : { primaryGateId }),\n ...(primaryScreenId === undefined ? {} : { primaryScreenId }),\n ...(titleKey === undefined ? {} : { titleKey }),\n ...(roots.length === 0 ? {} : { context: { roots } }),\n ...(layout.length === 0 ? {} : { layout }),\n ...(compiled.rules.length === 0 ? {} : { rules: compiled.rules }),\n ...(Object.keys(compiled.messages).length === 0 ? {} : { messages: compiled.messages }),\n ...(datasets.length === 0 ? {} : { datasets }),\n ...(onHide !== 'preserve' && onHide !== 'exclude' ? {} : { onHide }),\n ...(compiled.composition === undefined ? {} : { composition: compiled.composition }),\n };\n}\n"]}