@azx-pbc/axiom-compiler 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,78 @@
1
+ import type { CompositionReport } from '@azx-pbc/axiom-runtime';
2
+ import type { CompileFailure, CompileOptions, CompileResult } from './compile/types.js';
3
+ import type { Inspection } from './schema/diagnostic.js';
4
+ /**
5
+ * Compiles a schema document into the artifact `@azx-pbc/axiom-runtime` evaluates.
6
+ *
7
+ * Compilation runs four stages over the authored document:
8
+ *
9
+ * 1. Ingestion and closed metaschema validation, plus the document checks no JSON Schema
10
+ * keyword can express — declarations, row keys, message keys and every embedded vector's
11
+ * values (`schema/validate.ts`). The document may be spelled in restricted JSON or in YAML;
12
+ * both front doors produce one plain value and the same walk, so the artifact cannot depend on
13
+ * which one the author used (`ingest/`).
14
+ * 2. The language: every authored Expr v1 slot is parsed and statically typed against the
15
+ * document's own fields, context roots and datasets, and every authored ICU MF1 message
16
+ * is compiled to a data-only AST (`messages/compile.ts`). `rule_ok`/`no_blocking` are
17
+ * admitted only inside a gate rule, and the rules and message branches they name must
18
+ * exist. The layout's chrome expressions compile through the same path, after the
19
+ * structural walk (`layout/`).
20
+ * 3. The cross-checks that relate one declaration to another: a table an expression names
21
+ * must have a compiled declaration, and a message argument must be bound by the rule — or
22
+ * the layout node — that raises it.
23
+ * 4. The artifact: computed cycles, an item rule that reads its own target and duplicate
24
+ * writers are refused, a client target replaces every server-tier rule with a `DEFERRED`
25
+ * stub, and the derived dependency graph is emitted beside the schema.
26
+ *
27
+ * This entry holds the stages together; the public result shape is `compile/types`, the
28
+ * per-document state `compile/compilation`, rule compilation `compile/rules`, the layout
29
+ * grammar, read, shape and expression stages `layout/`, and the cross-checks and artifact
30
+ * narrowing their own modules under `compile/`. The branches this compile's vectors declare are
31
+ * stated by `publish/readiness`, whose fold `publish/verify` also derives the publish verdict
32
+ * from over evidence it executed: a compile states declared evidence, never readiness.
33
+ */
34
+ export type { CompileFailure, CompileOptions, CompileResult, CompileSuccess, CompileWarning, DeclaredEvidence, PublishGap, } from './compile/types.js';
35
+ /**
36
+ * Compiles `source` into a `CompiledSchema`. A document that is valid in the metaschema's
37
+ * authored state is compiled into the artifact the runtime evaluates; a
38
+ * document with any problem is a compile failure carrying every reason found, never a
39
+ * pass-through, because the runtime never parses source text.
40
+ *
41
+ * `source` is declared as text, and a JavaScript caller can still hand over anything: a value
42
+ * that is not text is refused at the ingest boundary like unreadable JSON, so a caller never
43
+ * receives a `TypeError` from inside the reader.
44
+ */
45
+ export declare function compile(source: string, options?: CompileOptions): CompileResult;
46
+ /**
47
+ * Compiles a document `inspectSchemaDocument` has already parsed and validated: its refusal when
48
+ * the inspection found one, otherwise the artifact.
49
+ *
50
+ * The inspection is the compile's own first stage — ingestion, the curated member checks and the
51
+ * closed metaschema — so a caller that must read that stage's diagnostics before deciding what to
52
+ * do with the draft (an authoring store's candidate gate runs the layout walk between them) hands
53
+ * the result back here instead of paying for a second parse and validation. `Inspection` is the
54
+ * compiler's own value: a tree a caller assembles by hand has not been through the boundary this
55
+ * entry trusts it to have passed. The accepted arm is sealed and its parsed tree is frozen, so
56
+ * a caller cannot forge that provenance or edit the tree after its checks.
57
+ */
58
+ export declare function compileInspected(inspection: Inspection, options?: CompileOptions): CompileResult;
59
+ /**
60
+ * Compiles an accepted inspection with the composition report a layered compile produced.
61
+ *
62
+ * Not part of the package entry: `compileOverlay` is the only caller, and a public door that
63
+ * accepted a composition would let a caller mint a version report no overlay list produced.
64
+ * The composition is placed in the composed tree before `validateCompiledArtifact` runs, so the
65
+ * artifact-only member is refused by the same gate as every other member rather than attached
66
+ * after the check.
67
+ */
68
+ export declare function compileComposed(inspection: Inspection, options: CompileOptions, composition: CompositionReport): CompileResult;
69
+ /**
70
+ * The refusal a non-text source earns before either reader sees it: a caller that hands over a
71
+ * value instead of text is a misuse of this entry, and it is answered with the same structured
72
+ * diagnostic a failed ingest produces rather than a `TypeError` from inside a reader.
73
+ *
74
+ * Exported for `compile-yaml.ts` only: the YAML front door lives in its own module so this one
75
+ * never imports the parser, and both doors must answer a non-text source identically.
76
+ */
77
+ export declare function sourceTextRefusal(source: unknown, code: 'JSON_INGEST_ERROR' | 'YAML_INGEST_ERROR'): CompileFailure | undefined;
78
+ //# sourceMappingURL=compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAsC,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAuCpG,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAUxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,YAAY,EACV,cAAc,EACd,cAAc,EACd,aAAa,EACb,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,UAAU,GACX,MAAM,oBAAoB,CAAC;AAyS5B;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,aAAa,CAKnF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,cAAmB,GAC3B,aAAa,CAcf;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,iBAAiB,GAC7B,aAAa,CAef;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,mBAAmB,GAAG,mBAAmB,GAC9C,cAAc,GAAG,SAAS,CAQ5B"}
@@ -0,0 +1,372 @@
1
+ import { artifactBehaviour, AXIOM_VERSION, DEFAULT_EVIDENCE_TIER, inspectDeps, isRecord, isVersionText, } from '@azx-pbc/axiom-runtime';
2
+ import { compiledSchemaOf } from './compile/artifact.js';
3
+ import { validateCompiledArtifact } from './compile/artifact-members.js';
4
+ import { refuse } from './compile/compilation.js';
5
+ import { computedFieldIndex } from './compile/computed.js';
6
+ import { compileOptionAvailability, withCompiledOptions, withOptionSlots, } from './compile/option-availability.js';
7
+ import { compileRowsFrom, withRowsFrom } from './compile/rows-from.js';
8
+ import { crossCheckParamslessMessages, crossCheckRule } from './compile/cross-checks.js';
9
+ import { deadWeightWarnings } from './compile/dead-weight.js';
10
+ import { declarationsOf, declaredOptions, declaredSignatureCovers, dynamicOptionFields, fieldsById, fieldsByPath, rowContainers, } from './compile/declarations.js';
11
+ import { artifactDatasetPins, declaredTablesOf, pinnedVersionsOf, suppliedDigestsOf, suppliedTablesOf, suppliedVersionsOf, } from './compile/datasets.js';
12
+ import { listAt, textAt } from './compile/document.js';
13
+ import { crossCheckItemTargets } from './compile/item-targets.js';
14
+ import { checkDeclaredMessages, declarationRules } from './compile/declaration-rules.js';
15
+ import { compileMessages } from './compile/messages.js';
16
+ import { declaredEvidenceOf } from './publish/readiness.js';
17
+ import { clientStub, compileRule } from './compile/rules.js';
18
+ import { nonTextSourceDetail } from './ingest/document.js';
19
+ import { compileLayout } from './layout/compile.js';
20
+ import { layoutShapeContext } from './layout/context.js';
21
+ import { declaredFoldTargets, readLayout } from './layout/read.js';
22
+ import { layoutShapeErrors } from './layout/shape.js';
23
+ import { DATASET_DECLARATION_CHANNELS } from './schema/dataset-declaration.js';
24
+ import { declarationWarnings } from './schema/declaration-warnings.js';
25
+ import { compiledDocumentOnHide, declaredFieldList } from './schema/document.js';
26
+ import { isAcceptedInspection } from './schema/diagnostic.js';
27
+ import { inspectSchemaDocument } from './schema/validate.js';
28
+ /**
29
+ * Compiles a document that already passed ingestion and the metaschema.
30
+ * Every stage reports into one diagnostic list, so one compile names every reason the
31
+ * document cannot be published rather than the first.
32
+ */
33
+ function compileInspectedDocument(document, options, composition) {
34
+ // The producer stamp is the runtime's package-skew key, so a malformed one would produce an
35
+ // artifact every runtime refuses after it has already been written. Refuse it at the compile,
36
+ // where the caller can fix the value. `undefined` selects this build's release, and `null`
37
+ // omits the member by design, so neither arm reaches the version check.
38
+ const producerVersion = options.producerVersion === undefined ? AXIOM_VERSION : options.producerVersion;
39
+ if (producerVersion !== null && !isVersionText(producerVersion)) {
40
+ return {
41
+ ok: false,
42
+ diagnostics: [
43
+ {
44
+ code: 'SCHEMA_INVALID',
45
+ path: '$',
46
+ detail: `producerVersion must be a release version such as 1.2.3; received ${JSON.stringify(producerVersion)}`,
47
+ },
48
+ ],
49
+ warnings: [],
50
+ };
51
+ }
52
+ const declarations = declarationsOf(document, options.datasets ?? []);
53
+ const declaredFieldPaths = fieldsByPath(declarations.fields ?? []);
54
+ const declaredPathsById = new Map();
55
+ for (const [path, field] of declaredFieldPaths)
56
+ declaredPathsById.set(field.fieldId, path);
57
+ // The layout is read once, before any expression compiles: a step fold names a step or a
58
+ // section the layout declares (`RULES-1.1.12`), so the target ids are part of the state every
59
+ // slot reads. The structural walk and the layout compile still run after the rules, so one
60
+ // compile states the same diagnostics in the same order.
61
+ const rawLayout = readLayout(document);
62
+ const layoutTargetIds = declaredFoldTargets(rawLayout);
63
+ const messages = {};
64
+ const compilation = {
65
+ diagnostics: [],
66
+ warnings: [],
67
+ declarations,
68
+ declaredTables: declaredTablesOf(document),
69
+ pinnedVersions: pinnedVersionsOf(document),
70
+ suppliedTables: suppliedTablesOf(options.datasets ?? []),
71
+ suppliedVersions: suppliedVersionsOf(options.datasets ?? []),
72
+ messages,
73
+ options: declaredOptions(document),
74
+ dynamicOptions: dynamicOptionFields(document),
75
+ declaredFieldPaths,
76
+ declaredPathsById,
77
+ fieldsById: fieldsById(declarations.fields ?? []),
78
+ rowContainers: rowContainers(declarations.fields ?? []),
79
+ signatureCovers: declaredSignatureCovers(document),
80
+ ruleIds: new Set(listAt(document, 'rules').flatMap((rule) => {
81
+ const ruleId = isRecord(rule) ? textAt(rule, 'ruleId') : undefined;
82
+ return ruleId === undefined ? [] : [ruleId];
83
+ })),
84
+ computed: computedFieldIndex(document, declarations, options.allowRegex ?? true),
85
+ layoutTargets: layoutTargetIds,
86
+ allowRegex: options.allowRegex ?? true,
87
+ };
88
+ compileMessages(compilation, document);
89
+ crossCheckParamslessMessages(compilation, document);
90
+ const entries = [];
91
+ listAt(document, 'rules').forEach((rule, index) => {
92
+ if (!isRecord(rule))
93
+ return;
94
+ const entry = compileRule(compilation, rule, index);
95
+ if (entry === undefined)
96
+ return;
97
+ entries.push(entry);
98
+ });
99
+ // The declarations that compile to a rule are generated here, after the authored rules are
100
+ // compiled but before any cross-check reads the rule set: a gate may name a required rule
101
+ // this document declared rather than wrote, and the id must resolve.
102
+ const declared = declarationRules(compilation, document);
103
+ compilation.warnings.push(...declarationWarnings(document));
104
+ compilation.diagnostics.push(...declared.diagnostics);
105
+ checkDeclaredMessages(compilation, document);
106
+ for (const rule of declared.rules)
107
+ compilation.ruleIds.add(rule.ruleId);
108
+ for (const entry of entries) {
109
+ const uses = [];
110
+ if (entry.rule.messageKey !== undefined) {
111
+ uses.push({
112
+ key: entry.rule.messageKey,
113
+ path: `$.rules[${String(entry.index)}].messageKey`,
114
+ owner: `rule \`${entry.rule.ruleId}\``,
115
+ binding: {
116
+ nodes: entry.rule.params ?? {},
117
+ paramFields: entry.paramFields,
118
+ ...(entry.paramUnparsed.size === 0 ? {} : { unparsedParams: entry.paramUnparsed }),
119
+ },
120
+ });
121
+ }
122
+ for (const [itemIndex, item] of (entry.rule.gate?.items ?? []).entries()) {
123
+ uses.push({
124
+ key: item.messageKey,
125
+ path: `$.rules[${String(entry.index)}].gate.items[${String(itemIndex)}].messageKey`,
126
+ // A gate item's message is bound by that item, not by its rule.
127
+ owner: `gate item \`${item.itemId}\``,
128
+ binding: entry.gateItems.get(itemIndex) ?? { nodes: {}, paramFields: new Map() },
129
+ });
130
+ }
131
+ const declaredReasons = entry.rule.kind === 'screen' ? (entry.rule.reasons ?? []) : [];
132
+ for (const [reasonIndex, reason] of declaredReasons.entries()) {
133
+ uses.push({
134
+ key: reason.messageKey,
135
+ path: `$.rules[${String(entry.index)}].reasons[${String(reasonIndex)}].messageKey`,
136
+ // A reason's message is bound by that reason, not by its screen.
137
+ owner: `screen reason \`${reason.code}\``,
138
+ binding: entry.screenReasons.get(reasonIndex) ?? { nodes: {}, paramFields: new Map() },
139
+ });
140
+ }
141
+ crossCheckRule(compilation, entry, uses, layoutTargetIds);
142
+ }
143
+ // An item-scoped rule's target is a row member, so a read of it is a self-reference rather
144
+ // than an ordinary dependency; checked over every rule at once because one writer's read is
145
+ // another rule's write (`RULES-5.1.3`).
146
+ crossCheckItemTargets(compilation, entries);
147
+ // The layout is read, structurally checked and compiled before the failure gate, so one
148
+ // compile states every reason the document cannot publish. `LAYOUT_STRUCTURE` is a
149
+ // diagnostic, never a throw: a presentation defect is an author's to repair, not a crash.
150
+ compilation.diagnostics.push(...layoutShapeErrors(rawLayout, layoutShapeContext(document)));
151
+ const layout = compileLayout(compilation, rawLayout);
152
+ const target = options.target ?? DEFAULT_EVIDENCE_TIER;
153
+ const rules = [
154
+ ...entries.map((entry) => target === 'client' && entry.rule.evaluateOn === 'server'
155
+ ? clientStub(entry.rule)
156
+ : entry.rule),
157
+ // A declaration always compiles to a client rule, so no generated rule is stubbed.
158
+ ...declared.rules,
159
+ ];
160
+ // The rows a field's count derives are an independent declaration, so they are checked even
161
+ // when a rule or a layout node already failed: one compile states every reason the document
162
+ // cannot publish, and the report is stable because each stage appends in declaration order.
163
+ const rowsFrom = compileRowsFrom(compilation, document, rules);
164
+ // A declared option's availability, reason and alternatives are expression slots too, so they
165
+ // compile before the failure gate for the same reason: one compile states every reason the
166
+ // document cannot publish. A dynamically sourced field declares no static option, so this walk
167
+ // leaves the invalid pair alone and the member pass owns that refusal.
168
+ const optionSlots = compileOptionAvailability(compilation, document);
169
+ // The composed field tree states each compiled slot, and the artifact is the one narrowing of
170
+ // it. The dataset pins read the narrowed declarations because a field's own expressions reach
171
+ // tables too, so the narrowing happens before the pins rather than after them.
172
+ const fieldsWithRowsFrom = withRowsFrom(document['fields'], rowsFrom);
173
+ const composedFields = withOptionSlots(fieldsWithRowsFrom, optionSlots);
174
+ const artifactFields = withCompiledOptions([...declaredFieldList(composedFields, document['onHide']).values()], optionSlots);
175
+ // The pins the artifact ships, each bound to the table's canonical bytes. Only a table some
176
+ // expression in the artifact can read is pinned: a pin nothing reaches asks a host to carry
177
+ // bytes no evaluation can use. A client artifact narrows that to the tables its client-tier
178
+ // rules read, because every server-tier rule became a deferred stub; a declared field's own
179
+ // expressions are device-side either way. A kept pin with no supplied declaration is named
180
+ // here rather than shipped unbound.
181
+ const datasets = artifactDatasetPins(document, rules, artifactFields, target, suppliedDigestsOf(options.datasets ?? []));
182
+ for (const gap of datasets.gaps) {
183
+ refuse(compilation, 'DATASET_DECLARATION_MISSING', `$.datasets[${String(gap.index)}]`, `the document's \`datasets\` member pins table \`${gap.tableId}\` at version ${String(gap.tableVersion)}, but no compiled declaration binds its bytes; pass that declaration with ${DATASET_DECLARATION_CHANNELS}`);
184
+ }
185
+ compilation.warnings.push(...deadWeightWarnings(document, entries, declared.rules, layout, rawLayout, artifactFields));
186
+ if (compilation.diagnostics.length > 0) {
187
+ return {
188
+ ok: false,
189
+ diagnostics: compilation.diagnostics,
190
+ warnings: compilation.warnings,
191
+ };
192
+ }
193
+ // The hiding policy decides what a submission carries, so it is behaviour and travels with
194
+ // the artifact; `preserve` is the default the runtime applies when the member is absent, so
195
+ // the artifact never spells it. One policy therefore has one spelling and one pin, whichever
196
+ // way the author wrote the default (`schema/document`).
197
+ const onHide = compiledDocumentOnHide(document['onHide']);
198
+ const schema = {
199
+ schemaId: document['schemaId'],
200
+ schemaVersion: document['schemaVersion'],
201
+ exprVersion: document['exprVersion'],
202
+ fields: composedFields,
203
+ ...(document['locales'] === undefined ? {} : { locales: document['locales'] }),
204
+ ...(document['defaultLocale'] === undefined
205
+ ? {}
206
+ : { defaultLocale: document['defaultLocale'] }),
207
+ // The designation is the author's, not a derived member: the artifact states which gate and
208
+ // screen a caller acts on when it names none, so no consumer has to infer one from the
209
+ // rule list.
210
+ ...(document['primaryGateId'] === undefined
211
+ ? {}
212
+ : { primaryGateId: document['primaryGateId'] }),
213
+ ...(document['primaryScreenId'] === undefined
214
+ ? {}
215
+ : { primaryScreenId: document['primaryScreenId'] }),
216
+ ...(document['context'] === undefined ? {} : { context: document['context'] }),
217
+ ...(layout.length === 0 ? {} : { layout }),
218
+ ...(rules.length === 0 ? {} : { rules }),
219
+ ...(Object.keys(messages).length === 0 ? {} : { messages }),
220
+ ...(datasets.pins.length === 0 ? {} : { datasets: datasets.pins }),
221
+ ...(document['titleKey'] === undefined ? {} : { titleKey: document['titleKey'] }),
222
+ ...(onHide === undefined ? {} : { onHide }),
223
+ // The composed artifact names its tier before the check runs, so the one member the closed
224
+ // document contract cannot state is still validated by the contract that admits it. The
225
+ // narrowing later elides `server`, the runtime's documented default (`compile/artifact`).
226
+ target,
227
+ // A layered compilation names its base edition and every overlay edition in the artifact
228
+ // itself, because the report copies the member and `reportHash` must cover it. A single
229
+ // document adds nothing, so its bytes and `behaviorHash` are what they were before overlays.
230
+ ...(composition === undefined ? {} : { composition }),
231
+ };
232
+ // The compiler is the only producer of the compiled form, so the composed tree is checked
233
+ // against the closed contract plus the artifact-only list before it leaves: a compiler bug
234
+ // fails here instead of shipping an artifact the runtime's contract does not admit.
235
+ const invalid = validateCompiledArtifact(schema);
236
+ if (invalid.length > 0) {
237
+ return { ok: false, diagnostics: invalid, warnings: compilation.warnings };
238
+ }
239
+ // The validated tree is then narrowed into the artifact contract member by member, so the
240
+ // emitted type is produced by a parse rather than asserted over an erased value.
241
+ const compiledSchema = compiledSchemaOf(schema, {
242
+ fields: artifactFields,
243
+ rules,
244
+ messages,
245
+ layout,
246
+ ...(producerVersion === null ? {} : { producerVersion }),
247
+ ...(composition === undefined ? {} : { composition }),
248
+ });
249
+ const inspection = inspectDeps(compiledSchema);
250
+ if (!inspection.ok) {
251
+ return {
252
+ ok: false,
253
+ diagnostics: inspection.problems.map((problem) => ({
254
+ code: problem.code,
255
+ // `RULES-5.1.3` reports a cycle at the expression that reads the target; a second
256
+ // writer is reported at the member the author can move (`RULES-5.1.4`).
257
+ path: `$.rules[${String(ruleIndex(entries, problem.ruleIds))}].${problem.code === 'CYCLE_DETECTED' ? 'expr' : 'fieldId'}`,
258
+ detail: problem.code === 'CYCLE_DETECTED'
259
+ ? `computed field \`${problem.fieldId}\` depends on itself through ${problem.ruleIds.map((ruleId) => `\`${ruleId}\``).join(', ')}`
260
+ : `computed field \`${problem.fieldId}\` is written by more than one rule (${problem.ruleIds.map((ruleId) => `\`${ruleId}\``).join(', ')})`,
261
+ })),
262
+ warnings: compilation.warnings,
263
+ };
264
+ }
265
+ return {
266
+ ok: true,
267
+ schema: compiledSchema,
268
+ deps: inspection.report,
269
+ warnings: compilation.warnings,
270
+ // One derivation serves both folds of the declared evidence: the rule hashes it records
271
+ // and the identity the verdict is bound to are the same walk. The origins name the
272
+ // declaration behind each synthesized rule, so a gap points at the member the author wrote.
273
+ declaredEvidence: declaredEvidenceOf(compiledSchema, artifactBehaviour(compiledSchema), declared.origins),
274
+ declarationOrigins: declared.origins,
275
+ };
276
+ }
277
+ /** The declaration index of the first rule a dependency problem names. */
278
+ function ruleIndex(entries, ruleIds) {
279
+ for (const entry of entries) {
280
+ if (ruleIds.includes(entry.rule.ruleId))
281
+ return entry.index;
282
+ }
283
+ return 0;
284
+ }
285
+ /**
286
+ * Compiles `source` into a `CompiledSchema`. A document that is valid in the metaschema's
287
+ * authored state is compiled into the artifact the runtime evaluates; a
288
+ * document with any problem is a compile failure carrying every reason found, never a
289
+ * pass-through, because the runtime never parses source text.
290
+ *
291
+ * `source` is declared as text, and a JavaScript caller can still hand over anything: a value
292
+ * that is not text is refused at the ingest boundary like unreadable JSON, so a caller never
293
+ * receives a `TypeError` from inside the reader.
294
+ */
295
+ export function compile(source, options = {}) {
296
+ const refusal = sourceTextRefusal(source, 'JSON_INGEST_ERROR');
297
+ if (refusal !== undefined)
298
+ return refusal;
299
+ const inspection = inspectSchemaDocument(source);
300
+ return compileInspected(inspection, options);
301
+ }
302
+ /**
303
+ * Compiles a document `inspectSchemaDocument` has already parsed and validated: its refusal when
304
+ * the inspection found one, otherwise the artifact.
305
+ *
306
+ * The inspection is the compile's own first stage — ingestion, the curated member checks and the
307
+ * closed metaschema — so a caller that must read that stage's diagnostics before deciding what to
308
+ * do with the draft (an authoring store's candidate gate runs the layout walk between them) hands
309
+ * the result back here instead of paying for a second parse and validation. `Inspection` is the
310
+ * compiler's own value: a tree a caller assembles by hand has not been through the boundary this
311
+ * entry trusts it to have passed. The accepted arm is sealed and its parsed tree is frozen, so
312
+ * a caller cannot forge that provenance or edit the tree after its checks.
313
+ */
314
+ export function compileInspected(inspection, options = {}) {
315
+ // The inspection's stage answers are the compiler's own; the verdict states the diagnostics a
316
+ // caller reports and nothing else.
317
+ if (!inspection.ok) {
318
+ return { ok: false, diagnostics: inspection.diagnostics, warnings: [] };
319
+ }
320
+ if (!isAcceptedInspection(inspection)) {
321
+ throw new Error('compileInspected requires an inspection inspectSchemaDocument accepted');
322
+ }
323
+ const document = inspection.document;
324
+ if (!isRecord(document)) {
325
+ throw new Error('the metaschema accepted a document that is not an object');
326
+ }
327
+ return compileInspectedDocument(document, options);
328
+ }
329
+ /**
330
+ * Compiles an accepted inspection with the composition report a layered compile produced.
331
+ *
332
+ * Not part of the package entry: `compileOverlay` is the only caller, and a public door that
333
+ * accepted a composition would let a caller mint a version report no overlay list produced.
334
+ * The composition is placed in the composed tree before `validateCompiledArtifact` runs, so the
335
+ * artifact-only member is refused by the same gate as every other member rather than attached
336
+ * after the check.
337
+ */
338
+ export function compileComposed(inspection, options, composition) {
339
+ if (!inspection.ok) {
340
+ return { ok: false, diagnostics: inspection.diagnostics, warnings: [] };
341
+ }
342
+ if (!isAcceptedInspection(inspection)) {
343
+ throw new Error('compileComposed requires an inspection inspectSchemaDocument accepted');
344
+ }
345
+ const document = inspection.document;
346
+ if (!isRecord(document)) {
347
+ throw new Error('the metaschema accepted a document that is not an object');
348
+ }
349
+ if (composition.baseVersion !== document['schemaVersion']) {
350
+ throw new Error('the composition names a base edition the compiled document does not state');
351
+ }
352
+ return compileInspectedDocument(document, options, composition);
353
+ }
354
+ /**
355
+ * The refusal a non-text source earns before either reader sees it: a caller that hands over a
356
+ * value instead of text is a misuse of this entry, and it is answered with the same structured
357
+ * diagnostic a failed ingest produces rather than a `TypeError` from inside a reader.
358
+ *
359
+ * Exported for `compile-yaml.ts` only: the YAML front door lives in its own module so this one
360
+ * never imports the parser, and both doors must answer a non-text source identically.
361
+ */
362
+ export function sourceTextRefusal(source, code) {
363
+ const detail = nonTextSourceDetail(source, 'the document');
364
+ if (detail === undefined)
365
+ return undefined;
366
+ return {
367
+ ok: false,
368
+ diagnostics: [{ code, path: '$', detail }],
369
+ warnings: [],
370
+ };
371
+ }
372
+ //# sourceMappingURL=compile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,QAAQ,EACR,aAAa,GACd,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE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AC;IACD,OAAO,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAe,EACf,IAA+C;IAE/C,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC3D,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC3C,OAAO;QACL,EAAE,EAAE,KAAK;QACT,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;QAC1C,QAAQ,EAAE,EAAE;KACb,CAAC;AACJ,CAAC","sourcesContent":["import {\n artifactBehaviour,\n AXIOM_VERSION,\n DEFAULT_EVIDENCE_TIER,\n inspectDeps,\n isRecord,\n isVersionText,\n} from '@azx-pbc/axiom-runtime';\nimport type { CompiledMessageEntry, CompiledRule, CompositionReport } from '@azx-pbc/axiom-runtime';\nimport { compiledSchemaOf } from './compile/artifact.js';\nimport { validateCompiledArtifact } from './compile/artifact-members.js';\nimport type { Compilation } from './compile/compilation.js';\nimport { refuse } from './compile/compilation.js';\nimport { computedFieldIndex } from './compile/computed.js';\nimport {\n compileOptionAvailability,\n withCompiledOptions,\n withOptionSlots,\n} from './compile/option-availability.js';\nimport { compileRowsFrom, withRowsFrom } from './compile/rows-from.js';\nimport { crossCheckParamslessMessages, crossCheckRule } from './compile/cross-checks.js';\nimport type { MessageUse } from './compile/cross-checks.js';\nimport { deadWeightWarnings } from './compile/dead-weight.js';\nimport {\n declarationsOf,\n declaredOptions,\n declaredSignatureCovers,\n dynamicOptionFields,\n fieldsById,\n fieldsByPath,\n rowContainers,\n} from './compile/declarations.js';\nimport {\n artifactDatasetPins,\n declaredTablesOf,\n pinnedVersionsOf,\n suppliedDigestsOf,\n suppliedTablesOf,\n suppliedVersionsOf,\n} from './compile/datasets.js';\nimport { listAt, textAt } from './compile/document.js';\nimport { crossCheckItemTargets } from './compile/item-targets.js';\nimport { checkDeclaredMessages, declarationRules } from './compile/declaration-rules.js';\nimport { compileMessages } from './compile/messages.js';\nimport { declaredEvidenceOf } from './publish/readiness.js';\nimport type { CompiledRuleEntry } from './compile/rules.js';\nimport { clientStub, compileRule } from './compile/rules.js';\nimport type { CompileFailure, CompileOptions, CompileResult } from './compile/types.js';\nimport { nonTextSourceDetail } from './ingest/document.js';\nimport { compileLayout } from './layout/compile.js';\nimport { layoutShapeContext } from './layout/context.js';\nimport { declaredFoldTargets, readLayout } from './layout/read.js';\nimport { layoutShapeErrors } from './layout/shape.js';\nimport { DATASET_DECLARATION_CHANNELS } from './schema/dataset-declaration.js';\nimport { declarationWarnings } from './schema/declaration-warnings.js';\nimport { compiledDocumentOnHide, declaredFieldList } from './schema/document.js';\nimport { isAcceptedInspection } from './schema/diagnostic.js';\nimport type { Inspection } from './schema/diagnostic.js';\nimport { inspectSchemaDocument } from './schema/validate.js';\n\n/**\n * Compiles a schema document into the artifact `@azx-pbc/axiom-runtime` evaluates.\n *\n * Compilation runs four stages over the authored document:\n *\n * 1. Ingestion and closed metaschema validation, plus the document checks no JSON Schema\n * keyword can express — declarations, row keys, message keys and every embedded vector's\n * values (`schema/validate.ts`). The document may be spelled in restricted JSON or in YAML;\n * both front doors produce one plain value and the same walk, so the artifact cannot depend on\n * which one the author used (`ingest/`).\n * 2. The language: every authored Expr v1 slot is parsed and statically typed against the\n * document's own fields, context roots and datasets, and every authored ICU MF1 message\n * is compiled to a data-only AST (`messages/compile.ts`). `rule_ok`/`no_blocking` are\n * admitted only inside a gate rule, and the rules and message branches they name must\n * exist. The layout's chrome expressions compile through the same path, after the\n * structural walk (`layout/`).\n * 3. The cross-checks that relate one declaration to another: a table an expression names\n * must have a compiled declaration, and a message argument must be bound by the rule — or\n * the layout node — that raises it.\n * 4. The artifact: computed cycles, an item rule that reads its own target and duplicate\n * writers are refused, a client target replaces every server-tier rule with a `DEFERRED`\n * stub, and the derived dependency graph is emitted beside the schema.\n *\n * This entry holds the stages together; the public result shape is `compile/types`, the\n * per-document state `compile/compilation`, rule compilation `compile/rules`, the layout\n * grammar, read, shape and expression stages `layout/`, and the cross-checks and artifact\n * narrowing their own modules under `compile/`. The branches this compile's vectors declare are\n * stated by `publish/readiness`, whose fold `publish/verify` also derives the publish verdict\n * from over evidence it executed: a compile states declared evidence, never readiness.\n */\n\nexport type {\n CompileFailure,\n CompileOptions,\n CompileResult,\n CompileSuccess,\n CompileWarning,\n DeclaredEvidence,\n PublishGap,\n} from './compile/types.js';\n\n/**\n * Compiles a document that already passed ingestion and the metaschema.\n * Every stage reports into one diagnostic list, so one compile names every reason the\n * document cannot be published rather than the first.\n */\nfunction compileInspectedDocument(\n document: Record<string, unknown>,\n options: CompileOptions,\n composition?: CompositionReport,\n): CompileResult {\n // The producer stamp is the runtime's package-skew key, so a malformed one would produce an\n // artifact every runtime refuses after it has already been written. Refuse it at the compile,\n // where the caller can fix the value. `undefined` selects this build's release, and `null`\n // omits the member by design, so neither arm reaches the version check.\n const producerVersion =\n options.producerVersion === undefined ? AXIOM_VERSION : options.producerVersion;\n if (producerVersion !== null && !isVersionText(producerVersion)) {\n return {\n ok: false,\n diagnostics: [\n {\n code: 'SCHEMA_INVALID',\n path: '$',\n detail: `producerVersion must be a release version such as 1.2.3; received ${JSON.stringify(producerVersion)}`,\n },\n ],\n warnings: [],\n };\n }\n const declarations = declarationsOf(document, options.datasets ?? []);\n const declaredFieldPaths = fieldsByPath(declarations.fields ?? []);\n const declaredPathsById = new Map<string, string>();\n for (const [path, field] of declaredFieldPaths) declaredPathsById.set(field.fieldId, path);\n // The layout is read once, before any expression compiles: a step fold names a step or a\n // section the layout declares (`RULES-1.1.12`), so the target ids are part of the state every\n // slot reads. The structural walk and the layout compile still run after the rules, so one\n // compile states the same diagnostics in the same order.\n const rawLayout = readLayout(document);\n const layoutTargetIds = declaredFoldTargets(rawLayout);\n const messages: Record<string, Record<string, CompiledMessageEntry>> = {};\n const compilation: Compilation = {\n diagnostics: [],\n warnings: [],\n declarations,\n declaredTables: declaredTablesOf(document),\n pinnedVersions: pinnedVersionsOf(document),\n suppliedTables: suppliedTablesOf(options.datasets ?? []),\n suppliedVersions: suppliedVersionsOf(options.datasets ?? []),\n messages,\n options: declaredOptions(document),\n dynamicOptions: dynamicOptionFields(document),\n declaredFieldPaths,\n declaredPathsById,\n fieldsById: fieldsById(declarations.fields ?? []),\n rowContainers: rowContainers(declarations.fields ?? []),\n signatureCovers: declaredSignatureCovers(document),\n ruleIds: new Set(\n listAt(document, 'rules').flatMap((rule) => {\n const ruleId = isRecord(rule) ? textAt(rule, 'ruleId') : undefined;\n return ruleId === undefined ? [] : [ruleId];\n }),\n ),\n computed: computedFieldIndex(document, declarations, options.allowRegex ?? true),\n layoutTargets: layoutTargetIds,\n allowRegex: options.allowRegex ?? true,\n };\n\n compileMessages(compilation, document);\n crossCheckParamslessMessages(compilation, document);\n\n const entries: CompiledRuleEntry[] = [];\n listAt(document, 'rules').forEach((rule, index) => {\n if (!isRecord(rule)) return;\n const entry = compileRule(compilation, rule, index);\n if (entry === undefined) return;\n entries.push(entry);\n });\n\n // The declarations that compile to a rule are generated here, after the authored rules are\n // compiled but before any cross-check reads the rule set: a gate may name a required rule\n // this document declared rather than wrote, and the id must resolve.\n const declared = declarationRules(compilation, document);\n compilation.warnings.push(...declarationWarnings(document));\n compilation.diagnostics.push(...declared.diagnostics);\n checkDeclaredMessages(compilation, document);\n for (const rule of declared.rules) compilation.ruleIds.add(rule.ruleId);\n\n for (const entry of entries) {\n const uses: MessageUse[] = [];\n if (entry.rule.messageKey !== undefined) {\n uses.push({\n key: entry.rule.messageKey,\n path: `$.rules[${String(entry.index)}].messageKey`,\n owner: `rule \\`${entry.rule.ruleId}\\``,\n binding: {\n nodes: entry.rule.params ?? {},\n paramFields: entry.paramFields,\n ...(entry.paramUnparsed.size === 0 ? {} : { unparsedParams: entry.paramUnparsed }),\n },\n });\n }\n for (const [itemIndex, item] of (entry.rule.gate?.items ?? []).entries()) {\n uses.push({\n key: item.messageKey,\n path: `$.rules[${String(entry.index)}].gate.items[${String(itemIndex)}].messageKey`,\n // A gate item's message is bound by that item, not by its rule.\n owner: `gate item \\`${item.itemId}\\``,\n binding: entry.gateItems.get(itemIndex) ?? { nodes: {}, paramFields: new Map() },\n });\n }\n const declaredReasons = entry.rule.kind === 'screen' ? (entry.rule.reasons ?? []) : [];\n for (const [reasonIndex, reason] of declaredReasons.entries()) {\n uses.push({\n key: reason.messageKey,\n path: `$.rules[${String(entry.index)}].reasons[${String(reasonIndex)}].messageKey`,\n // A reason's message is bound by that reason, not by its screen.\n owner: `screen reason \\`${reason.code}\\``,\n binding: entry.screenReasons.get(reasonIndex) ?? { nodes: {}, paramFields: new Map() },\n });\n }\n crossCheckRule(compilation, entry, uses, layoutTargetIds);\n }\n\n // An item-scoped rule's target is a row member, so a read of it is a self-reference rather\n // than an ordinary dependency; checked over every rule at once because one writer's read is\n // another rule's write (`RULES-5.1.3`).\n crossCheckItemTargets(compilation, entries);\n\n // The layout is read, structurally checked and compiled before the failure gate, so one\n // compile states every reason the document cannot publish. `LAYOUT_STRUCTURE` is a\n // diagnostic, never a throw: a presentation defect is an author's to repair, not a crash.\n compilation.diagnostics.push(...layoutShapeErrors(rawLayout, layoutShapeContext(document)));\n const layout = compileLayout(compilation, rawLayout);\n\n const target = options.target ?? DEFAULT_EVIDENCE_TIER;\n const rules: readonly CompiledRule[] = [\n ...entries.map((entry) =>\n target === 'client' && entry.rule.evaluateOn === 'server'\n ? clientStub(entry.rule)\n : entry.rule,\n ),\n // A declaration always compiles to a client rule, so no generated rule is stubbed.\n ...declared.rules,\n ];\n // The rows a field's count derives are an independent declaration, so they are checked even\n // when a rule or a layout node already failed: one compile states every reason the document\n // cannot publish, and the report is stable because each stage appends in declaration order.\n const rowsFrom = compileRowsFrom(compilation, document, rules);\n // A declared option's availability, reason and alternatives are expression slots too, so they\n // compile before the failure gate for the same reason: one compile states every reason the\n // document cannot publish. A dynamically sourced field declares no static option, so this walk\n // leaves the invalid pair alone and the member pass owns that refusal.\n const optionSlots = compileOptionAvailability(compilation, document);\n // The composed field tree states each compiled slot, and the artifact is the one narrowing of\n // it. The dataset pins read the narrowed declarations because a field's own expressions reach\n // tables too, so the narrowing happens before the pins rather than after them.\n const fieldsWithRowsFrom = withRowsFrom(document['fields'], rowsFrom);\n const composedFields = withOptionSlots(fieldsWithRowsFrom, optionSlots);\n const artifactFields = withCompiledOptions(\n [...declaredFieldList(composedFields, document['onHide']).values()],\n optionSlots,\n );\n // The pins the artifact ships, each bound to the table's canonical bytes. Only a table some\n // expression in the artifact can read is pinned: a pin nothing reaches asks a host to carry\n // bytes no evaluation can use. A client artifact narrows that to the tables its client-tier\n // rules read, because every server-tier rule became a deferred stub; a declared field's own\n // expressions are device-side either way. A kept pin with no supplied declaration is named\n // here rather than shipped unbound.\n const datasets = artifactDatasetPins(\n document,\n rules,\n artifactFields,\n target,\n suppliedDigestsOf(options.datasets ?? []),\n );\n for (const gap of datasets.gaps) {\n refuse(\n compilation,\n 'DATASET_DECLARATION_MISSING',\n `$.datasets[${String(gap.index)}]`,\n `the document's \\`datasets\\` member pins table \\`${gap.tableId}\\` at version ${String(gap.tableVersion)}, but no compiled declaration binds its bytes; pass that declaration with ${DATASET_DECLARATION_CHANNELS}`,\n );\n }\n compilation.warnings.push(\n ...deadWeightWarnings(document, entries, declared.rules, layout, rawLayout, artifactFields),\n );\n if (compilation.diagnostics.length > 0) {\n return {\n ok: false,\n diagnostics: compilation.diagnostics,\n warnings: compilation.warnings,\n };\n }\n // The hiding policy decides what a submission carries, so it is behaviour and travels with\n // the artifact; `preserve` is the default the runtime applies when the member is absent, so\n // the artifact never spells it. One policy therefore has one spelling and one pin, whichever\n // way the author wrote the default (`schema/document`).\n const onHide = compiledDocumentOnHide(document['onHide']);\n const schema = {\n schemaId: document['schemaId'],\n schemaVersion: document['schemaVersion'],\n exprVersion: document['exprVersion'],\n fields: composedFields,\n ...(document['locales'] === undefined ? {} : { locales: document['locales'] }),\n ...(document['defaultLocale'] === undefined\n ? {}\n : { defaultLocale: document['defaultLocale'] }),\n // The designation is the author's, not a derived member: the artifact states which gate and\n // screen a caller acts on when it names none, so no consumer has to infer one from the\n // rule list.\n ...(document['primaryGateId'] === undefined\n ? {}\n : { primaryGateId: document['primaryGateId'] }),\n ...(document['primaryScreenId'] === undefined\n ? {}\n : { primaryScreenId: document['primaryScreenId'] }),\n ...(document['context'] === undefined ? {} : { context: document['context'] }),\n ...(layout.length === 0 ? {} : { layout }),\n ...(rules.length === 0 ? {} : { rules }),\n ...(Object.keys(messages).length === 0 ? {} : { messages }),\n ...(datasets.pins.length === 0 ? {} : { datasets: datasets.pins }),\n ...(document['titleKey'] === undefined ? {} : { titleKey: document['titleKey'] }),\n ...(onHide === undefined ? {} : { onHide }),\n // The composed artifact names its tier before the check runs, so the one member the closed\n // document contract cannot state is still validated by the contract that admits it. The\n // narrowing later elides `server`, the runtime's documented default (`compile/artifact`).\n target,\n // A layered compilation names its base edition and every overlay edition in the artifact\n // itself, because the report copies the member and `reportHash` must cover it. A single\n // document adds nothing, so its bytes and `behaviorHash` are what they were before overlays.\n ...(composition === undefined ? {} : { composition }),\n };\n\n // The compiler is the only producer of the compiled form, so the composed tree is checked\n // against the closed contract plus the artifact-only list before it leaves: a compiler bug\n // fails here instead of shipping an artifact the runtime's contract does not admit.\n const invalid = validateCompiledArtifact(schema);\n if (invalid.length > 0) {\n return { ok: false, diagnostics: invalid, warnings: compilation.warnings };\n }\n // The validated tree is then narrowed into the artifact contract member by member, so the\n // emitted type is produced by a parse rather than asserted over an erased value.\n const compiledSchema = compiledSchemaOf(schema, {\n fields: artifactFields,\n rules,\n messages,\n layout,\n ...(producerVersion === null ? {} : { producerVersion }),\n ...(composition === undefined ? {} : { composition }),\n });\n\n const inspection = inspectDeps(compiledSchema);\n if (!inspection.ok) {\n return {\n ok: false,\n diagnostics: inspection.problems.map((problem) => ({\n code: problem.code,\n // `RULES-5.1.3` reports a cycle at the expression that reads the target; a second\n // writer is reported at the member the author can move (`RULES-5.1.4`).\n path: `$.rules[${String(ruleIndex(entries, problem.ruleIds))}].${\n problem.code === 'CYCLE_DETECTED' ? 'expr' : 'fieldId'\n }`,\n detail:\n problem.code === 'CYCLE_DETECTED'\n ? `computed field \\`${problem.fieldId}\\` depends on itself through ${problem.ruleIds.map((ruleId) => `\\`${ruleId}\\``).join(', ')}`\n : `computed field \\`${problem.fieldId}\\` is written by more than one rule (${problem.ruleIds.map((ruleId) => `\\`${ruleId}\\``).join(', ')})`,\n })),\n warnings: compilation.warnings,\n };\n }\n return {\n ok: true,\n schema: compiledSchema,\n deps: inspection.report,\n warnings: compilation.warnings,\n // One derivation serves both folds of the declared evidence: the rule hashes it records\n // and the identity the verdict is bound to are the same walk. The origins name the\n // declaration behind each synthesized rule, so a gap points at the member the author wrote.\n declaredEvidence: declaredEvidenceOf(\n compiledSchema,\n artifactBehaviour(compiledSchema),\n declared.origins,\n ),\n declarationOrigins: declared.origins,\n };\n}\n\n/** The declaration index of the first rule a dependency problem names. */\nfunction ruleIndex(entries: readonly CompiledRuleEntry[], ruleIds: readonly string[]): number {\n for (const entry of entries) {\n if (ruleIds.includes(entry.rule.ruleId)) return entry.index;\n }\n return 0;\n}\n\n/**\n * Compiles `source` into a `CompiledSchema`. A document that is valid in the metaschema's\n * authored state is compiled into the artifact the runtime evaluates; a\n * document with any problem is a compile failure carrying every reason found, never a\n * pass-through, because the runtime never parses source text.\n *\n * `source` is declared as text, and a JavaScript caller can still hand over anything: a value\n * that is not text is refused at the ingest boundary like unreadable JSON, so a caller never\n * receives a `TypeError` from inside the reader.\n */\nexport function compile(source: string, options: CompileOptions = {}): CompileResult {\n const refusal = sourceTextRefusal(source, 'JSON_INGEST_ERROR');\n if (refusal !== undefined) return refusal;\n const inspection = inspectSchemaDocument(source);\n return compileInspected(inspection, options);\n}\n\n/**\n * Compiles a document `inspectSchemaDocument` has already parsed and validated: its refusal when\n * the inspection found one, otherwise the artifact.\n *\n * The inspection is the compile's own first stage — ingestion, the curated member checks and the\n * closed metaschema — so a caller that must read that stage's diagnostics before deciding what to\n * do with the draft (an authoring store's candidate gate runs the layout walk between them) hands\n * the result back here instead of paying for a second parse and validation. `Inspection` is the\n * compiler's own value: a tree a caller assembles by hand has not been through the boundary this\n * entry trusts it to have passed. The accepted arm is sealed and its parsed tree is frozen, so\n * a caller cannot forge that provenance or edit the tree after its checks.\n */\nexport function compileInspected(\n inspection: Inspection,\n options: CompileOptions = {},\n): CompileResult {\n // The inspection's stage answers are the compiler's own; the verdict states the diagnostics a\n // caller reports and nothing else.\n if (!inspection.ok) {\n return { ok: false, diagnostics: inspection.diagnostics, warnings: [] };\n }\n if (!isAcceptedInspection(inspection)) {\n throw new Error('compileInspected requires an inspection inspectSchemaDocument accepted');\n }\n const document = inspection.document;\n if (!isRecord(document)) {\n throw new Error('the metaschema accepted a document that is not an object');\n }\n return compileInspectedDocument(document, options);\n}\n\n/**\n * Compiles an accepted inspection with the composition report a layered compile produced.\n *\n * Not part of the package entry: `compileOverlay` is the only caller, and a public door that\n * accepted a composition would let a caller mint a version report no overlay list produced.\n * The composition is placed in the composed tree before `validateCompiledArtifact` runs, so the\n * artifact-only member is refused by the same gate as every other member rather than attached\n * after the check.\n */\nexport function compileComposed(\n inspection: Inspection,\n options: CompileOptions,\n composition: CompositionReport,\n): CompileResult {\n if (!inspection.ok) {\n return { ok: false, diagnostics: inspection.diagnostics, warnings: [] };\n }\n if (!isAcceptedInspection(inspection)) {\n throw new Error('compileComposed requires an inspection inspectSchemaDocument accepted');\n }\n const document = inspection.document;\n if (!isRecord(document)) {\n throw new Error('the metaschema accepted a document that is not an object');\n }\n if (composition.baseVersion !== document['schemaVersion']) {\n throw new Error('the composition names a base edition the compiled document does not state');\n }\n return compileInspectedDocument(document, options, composition);\n}\n\n/**\n * The refusal a non-text source earns before either reader sees it: a caller that hands over a\n * value instead of text is a misuse of this entry, and it is answered with the same structured\n * diagnostic a failed ingest produces rather than a `TypeError` from inside a reader.\n *\n * Exported for `compile-yaml.ts` only: the YAML front door lives in its own module so this one\n * never imports the parser, and both doors must answer a non-text source identically.\n */\nexport function sourceTextRefusal(\n source: unknown,\n code: 'JSON_INGEST_ERROR' | 'YAML_INGEST_ERROR',\n): CompileFailure | undefined {\n const detail = nonTextSourceDetail(source, 'the document');\n if (detail === undefined) return undefined;\n return {\n ok: false,\n diagnostics: [{ code, path: '$', detail }],\n warnings: [],\n };\n}\n"]}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The declared bounds of a CSV front-end, stated once.
3
+ *
4
+ * Two front-ends read CSV text — the scenario matrix and a dataset file — and both are fed a
5
+ * document a caller holds whole. The matrix's bounds exist so a spreadsheet pasted into a studio
6
+ * cannot exhaust the tab, and a dataset carries the same shape of risk in CI: one file is one
7
+ * allocation, so the same four bounds are applied to it rather than a second policy an operator
8
+ * would have to learn.
9
+ *
10
+ * The numbers are a contract, not a tuning knob: they are pinned by both front-ends' tests, and a
11
+ * caller that needs more must state a different, documented limit rather than raise one silently.
12
+ */
13
+ /** The 8 MiB bound on the input text, in UTF-8 bytes. */
14
+ export declare const MAX_INPUT_BYTES: number;
15
+ /** The bound on data rows. */
16
+ export declare const MAX_DATA_ROWS: number;
17
+ /** The bound on columns, header included. */
18
+ export declare const MAX_COLUMNS: number;
19
+ /** The bound on one decoded cell, in UTF-8 bytes. */
20
+ export declare const MAX_CELL_BYTES: number;
21
+ /** Where a text first passes a byte limit. */
22
+ export interface Utf8Crossing {
23
+ /** The limit that was passed. */
24
+ readonly limit: number;
25
+ /**
26
+ * The 1-based byte offset of the character whose bytes crossed the limit.
27
+ *
28
+ * A surrogate pair's first code unit names the pair, so an emoji that straddles the limit is
29
+ * reported at the byte its four-byte sequence starts, which is the offset an editor jumps to.
30
+ */
31
+ readonly offset: number;
32
+ }
33
+ /**
34
+ * Where `text` first passes `limit` UTF-8 bytes, or `undefined` when it does not.
35
+ *
36
+ * Counted rather than measured with `TextEncoder` so an over-long document is refused before a
37
+ * byte array is materialised, and so the scan stops at the crossing instead of walking a file
38
+ * that is already known to be too large.
39
+ */
40
+ export declare function utf8Crossing(text: string, limit: number): Utf8Crossing | undefined;
41
+ /** Whether `text` is longer than `limit` UTF-8 bytes. */
42
+ export declare function exceedsUtf8Bytes(text: string, limit: number): boolean;
43
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/csv/limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,yDAAyD;AACzD,eAAO,MAAM,eAAe,EAAE,MAAwB,CAAC;AACvD,8BAA8B;AAC9B,eAAO,MAAM,aAAa,EAAE,MAAc,CAAC;AAC3C,6CAA6C;AAC7C,eAAO,MAAM,WAAW,EAAE,MAAY,CAAC;AACvC,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE,MAAkB,CAAC;AAEhD,8CAA8C;AAC9C,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAiBlF;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAErE"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The declared bounds of a CSV front-end, stated once.
3
+ *
4
+ * Two front-ends read CSV text — the scenario matrix and a dataset file — and both are fed a
5
+ * document a caller holds whole. The matrix's bounds exist so a spreadsheet pasted into a studio
6
+ * cannot exhaust the tab, and a dataset carries the same shape of risk in CI: one file is one
7
+ * allocation, so the same four bounds are applied to it rather than a second policy an operator
8
+ * would have to learn.
9
+ *
10
+ * The numbers are a contract, not a tuning knob: they are pinned by both front-ends' tests, and a
11
+ * caller that needs more must state a different, documented limit rather than raise one silently.
12
+ */
13
+ /** The 8 MiB bound on the input text, in UTF-8 bytes. */
14
+ export const MAX_INPUT_BYTES = 8 * 1024 * 1024;
15
+ /** The bound on data rows. */
16
+ export const MAX_DATA_ROWS = 1_000;
17
+ /** The bound on columns, header included. */
18
+ export const MAX_COLUMNS = 256;
19
+ /** The bound on one decoded cell, in UTF-8 bytes. */
20
+ export const MAX_CELL_BYTES = 64 * 1024;
21
+ /**
22
+ * Where `text` first passes `limit` UTF-8 bytes, or `undefined` when it does not.
23
+ *
24
+ * Counted rather than measured with `TextEncoder` so an over-long document is refused before a
25
+ * byte array is materialised, and so the scan stops at the crossing instead of walking a file
26
+ * that is already known to be too large.
27
+ */
28
+ export function utf8Crossing(text, limit) {
29
+ let bytes = 0;
30
+ for (let index = 0; index < text.length; index += 1) {
31
+ const start = bytes + 1;
32
+ const code = text.charCodeAt(index);
33
+ const paired = code >= 0xd800 &&
34
+ code <= 0xdbff &&
35
+ index + 1 < text.length &&
36
+ (text.charCodeAt(index + 1) & 0xfc00) === 0xdc00;
37
+ // Completing a pair consumes its second unit; leaving it to the next turn would count the
38
+ // low surrogate on its own and overstate the size of a well-formed string.
39
+ if (paired)
40
+ index += 1;
41
+ bytes += code < 0x80 ? 1 : code < 0x800 ? 2 : paired ? 4 : 3;
42
+ if (bytes > limit)
43
+ return { limit, offset: start };
44
+ }
45
+ return undefined;
46
+ }
47
+ /** Whether `text` is longer than `limit` UTF-8 bytes. */
48
+ export function exceedsUtf8Bytes(text, limit) {
49
+ return utf8Crossing(text, limit) !== undefined;
50
+ }
51
+ //# sourceMappingURL=limits.js.map