@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,46 @@
1
+ import type { CompiledField, CompiledMessageEntry, ExpressionDeclarations } from '@azx-pbc/axiom-runtime';
2
+ import type { ComputedWriterIndex } from './computed.js';
3
+ import type { SchemaDiagnostic } from '../schema/validate.js';
4
+ import type { CompileWarning } from './warning.js';
5
+ /** The compiler's per-document state: diagnostics, warnings, declarations and compiled messages. */
6
+ export interface Compilation {
7
+ readonly diagnostics: SchemaDiagnostic[];
8
+ /**
9
+ * Findings that never refuse the document. Kept apart from `diagnostics` because `ok` is
10
+ * decided by the diagnostics alone; a deprecation or an undecided fold is advice, not a defect.
11
+ */
12
+ readonly warnings: CompileWarning[];
13
+ readonly declarations: ExpressionDeclarations;
14
+ /** The table ids the document itself declares, `schema.v1.json` `datasetRef`. */
15
+ readonly declaredTables: ReadonlySet<string>;
16
+ /** The version the document pins each declared table to; one pin per table. */
17
+ readonly pinnedVersions: ReadonlyMap<string, number>;
18
+ /** The table ids the caller supplied a compiled declaration for. */
19
+ readonly suppliedTables: ReadonlySet<string>;
20
+ /** The versions the caller supplied for each table, so a pin can be matched. */
21
+ readonly suppliedVersions: ReadonlyMap<string, ReadonlySet<number>>;
22
+ readonly messages: Record<string, Record<string, CompiledMessageEntry>>;
23
+ readonly options: ReadonlyMap<string, readonly string[]>;
24
+ /** The fields whose domain is dynamic, so a branch check has nothing to compare against. */
25
+ readonly dynamicOptions: ReadonlySet<string>;
26
+ readonly declaredFieldPaths: ReadonlyMap<string, CompiledField>;
27
+ /** The declared value path of every document-wide field id, including fields records hold. */
28
+ readonly declaredPathsById: ReadonlyMap<string, string>;
29
+ readonly fieldsById: ReadonlyMap<string, CompiledField>;
30
+ /** The array each declared field sits inside, so a write to a row member can name its row. */
31
+ readonly rowContainers: ReadonlyMap<string, string>;
32
+ /** The target list each `signature_capture` field declares. */
33
+ readonly signatureCovers: ReadonlyMap<string, readonly string[]>;
34
+ readonly ruleIds: Set<string>;
35
+ /** The pure computed fields a slot may inline, and the rule that owns each produced value. */
36
+ readonly computed: ComputedWriterIndex;
37
+ /**
38
+ * Every layout `stepId` and layout `sectionId` the document declares, so a step fold named
39
+ * anywhere (a rule, a declaration condition or a `rowsFrom`) resolves against one set.
40
+ */
41
+ readonly layoutTargets: ReadonlySet<string>;
42
+ /** Whether this build admits `matches` (`CompileOptions.allowRegex`). */
43
+ readonly allowRegex: boolean;
44
+ }
45
+ export declare function refuse(compilation: Compilation, code: SchemaDiagnostic['code'], path: string, detail: string, extra?: Omit<SchemaDiagnostic, 'code' | 'path' | 'detail'>): void;
46
+ //# sourceMappingURL=compilation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compilation.d.ts","sourceRoot":"","sources":["../../src/compile/compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,oGAAoG;AACpG,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,WAAW,EAAE,gBAAgB,EAAE,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;IAC9C,iFAAiF;IACjF,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,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gBAAgB,CAAC,MAAM,CAAC,EAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAM,GAC7D,IAAI,CAEN"}
@@ -0,0 +1,4 @@
1
+ export function refuse(compilation, code, path, detail, extra = {}) {
2
+ compilation.diagnostics.push({ code, path, detail, ...extra });
3
+ }
4
+ //# sourceMappingURL=compilation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compilation.js","sourceRoot":"","sources":["../../src/compile/compilation.ts"],"names":[],"mappings":"AAkDA,MAAM,UAAU,MAAM,CACpB,WAAwB,EACxB,IAA8B,EAC9B,IAAY,EACZ,MAAc,EACd,KAAK,GAAuD,EAAE;IAE9D,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import type {\n CompiledField,\n CompiledMessageEntry,\n ExpressionDeclarations,\n} from '@azx-pbc/axiom-runtime';\nimport type { ComputedWriterIndex } from './computed.js';\nimport type { SchemaDiagnostic } from '../schema/validate.js';\nimport type { CompileWarning } from './warning.js';\n\n/** The compiler's per-document state: diagnostics, warnings, declarations and compiled messages. */\nexport interface Compilation {\n readonly diagnostics: SchemaDiagnostic[];\n /**\n * Findings that never refuse the document. Kept apart from `diagnostics` because `ok` is\n * decided by the diagnostics alone; a deprecation or an undecided fold is advice, not a defect.\n */\n readonly warnings: CompileWarning[];\n readonly declarations: ExpressionDeclarations;\n /** The table ids the document itself declares, `schema.v1.json` `datasetRef`. */\n readonly declaredTables: ReadonlySet<string>;\n /** The version the document pins each declared table to; one pin per table. */\n readonly pinnedVersions: ReadonlyMap<string, number>;\n /** The table ids the caller supplied a compiled declaration for. */\n readonly suppliedTables: ReadonlySet<string>;\n /** The versions the caller supplied for each table, so a pin can be matched. */\n readonly suppliedVersions: ReadonlyMap<string, ReadonlySet<number>>;\n readonly messages: Record<string, Record<string, CompiledMessageEntry>>;\n readonly options: ReadonlyMap<string, readonly string[]>;\n /** The fields whose domain is dynamic, so a branch check has nothing to compare against. */\n readonly dynamicOptions: ReadonlySet<string>;\n readonly declaredFieldPaths: ReadonlyMap<string, CompiledField>;\n /** The declared value path of every document-wide field id, including fields records hold. */\n readonly declaredPathsById: ReadonlyMap<string, string>;\n readonly fieldsById: ReadonlyMap<string, CompiledField>;\n /** The array each declared field sits inside, so a write to a row member can name its row. */\n readonly rowContainers: ReadonlyMap<string, string>;\n /** The target list each `signature_capture` field declares. */\n readonly signatureCovers: ReadonlyMap<string, readonly string[]>;\n readonly ruleIds: Set<string>;\n /** The pure computed fields a slot may inline, and the rule that owns each produced value. */\n readonly computed: ComputedWriterIndex;\n /**\n * Every layout `stepId` and layout `sectionId` the document declares, so a step fold named\n * anywhere (a rule, a declaration condition or a `rowsFrom`) resolves against one set.\n */\n readonly layoutTargets: ReadonlySet<string>;\n /** Whether this build admits `matches` (`CompileOptions.allowRegex`). */\n readonly allowRegex: boolean;\n}\n\nexport function refuse(\n compilation: Compilation,\n code: SchemaDiagnostic['code'],\n path: string,\n detail: string,\n extra: Omit<SchemaDiagnostic, 'code' | 'path' | 'detail'> = {},\n): void {\n compilation.diagnostics.push({ code, path, detail, ...extra });\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { ExpressionDeclarations } from '@azx-pbc/axiom-runtime';
2
+ import type { ComputedFieldIndex } from '../expr/values/inline.js';
3
+ /**
4
+ * One rule that produces a declaration's value, as a check that refuses a second writer sees it.
5
+ *
6
+ * The key is the declaration whose value the rule produces rather than the member it names: an
7
+ * item-scoped writer's `fieldId` is the array it addresses and its `targetFieldId` is the member
8
+ * of one row it writes, which is the value that has an owner.
9
+ */
10
+ interface ComputedWriter {
11
+ readonly ruleId: string;
12
+ readonly kind: 'compute' | 'defaultCompute';
13
+ }
14
+ /** The computed facts of one document: what a slot may inline, and who owns each value. */
15
+ export interface ComputedWriterIndex extends ComputedFieldIndex {
16
+ /** The writer of each produced declaration, including the members a produced container carries. */
17
+ readonly writers: ReadonlyMap<string, ComputedWriter>;
18
+ }
19
+ /** Index the document's computed writers, in declaration order. */
20
+ export declare function computedFieldIndex(document: Record<string, unknown>, declarations?: ExpressionDeclarations, allowRegex?: boolean): ComputedWriterIndex;
21
+ export {};
22
+ //# sourceMappingURL=computed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../../src/compile/computed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAK/E,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,0BAA0B,CAAC;AAkCnF;;;;;;GAMG;AACH,UAAU,cAAc;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,gBAAgB,CAAC;CAC7C;AAED,2FAA2F;AAC3F,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,mGAAmG;IACnG,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACvD;AAgMD,mEAAmE;AACnE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,YAAY,CAAC,EAAE,sBAAsB,EACrC,UAAU,UAAO,GAChB,mBAAmB,CA2CrB"}
@@ -0,0 +1,245 @@
1
+ import { DATASET_BUILTINS, isRecord } from '@azx-pbc/axiom-runtime';
2
+ import { MalformedCompiledNode, exprNodeOf } from '../expr/boundary.js';
3
+ import { ExpressionCompileError } from '../expr/diagnostics.js';
4
+ import { checkExpressionBudget, parseExpression } from '../expr/parser.js';
5
+ import { checkExpression } from '../expr/typecheck.js';
6
+ import { listAt, textAt } from './document.js';
7
+ /**
8
+ * The definitions a document states through its `compute` rules.
9
+ *
10
+ * A rule group is keyed by the field it writes. Exactly one pure `compute` writer is a
11
+ * definition; two writers, a `defaultCompute`, an item-scoped writer, or a writer that reads
12
+ * a dataset or a host fact is a status the substitution pass reports rather than a definition
13
+ * it inlines. Reading the authored rule list here keeps that decision independent of the
14
+ * compiled entries, so a slot is checked against the same definition the author wrote.
15
+ */
16
+ const HOST_CALLS = new Set([
17
+ 'has_cap',
18
+ 'is_relevant',
19
+ 'rule_ok',
20
+ 'no_blocking',
21
+ 'rule_ok_in',
22
+ 'no_blocking_in',
23
+ 'required_in',
24
+ ]);
25
+ function readDefinition(rule, index) {
26
+ const kind = textAt(rule, 'kind');
27
+ if (kind !== 'compute' && kind !== 'defaultCompute')
28
+ return undefined;
29
+ const fieldId = textAt(rule, 'fieldId');
30
+ const ruleId = textAt(rule, 'ruleId');
31
+ if (fieldId === undefined || ruleId === undefined)
32
+ return undefined;
33
+ const targetFieldId = textAt(rule, 'scope') === 'item' ? textAt(rule, 'targetFieldId') : undefined;
34
+ return {
35
+ fieldId,
36
+ written: targetFieldId ?? fieldId,
37
+ path: `$.rules[${String(index)}].expr`,
38
+ ruleId,
39
+ kind,
40
+ scope: textAt(rule, 'scope') ?? 'field',
41
+ source: rule['expr'],
42
+ };
43
+ }
44
+ function parseDefinition(source) {
45
+ try {
46
+ if (typeof source === 'string') {
47
+ const parsed = parseExpression(source);
48
+ return {
49
+ node: parsed.node,
50
+ offsets: parsed.offsets,
51
+ powerOperators: parsed.powerOperators,
52
+ lengthProperties: parsed.lengthProperties,
53
+ };
54
+ }
55
+ if (isRecord(source)) {
56
+ return { node: exprNodeOf(source, 'definition'), offsets: new WeakMap() };
57
+ }
58
+ return undefined;
59
+ }
60
+ catch (error) {
61
+ if (error instanceof ExpressionCompileError || error instanceof MalformedCompiledNode) {
62
+ return undefined;
63
+ }
64
+ throw error;
65
+ }
66
+ }
67
+ /**
68
+ * Applies check-time lowerings (`.length` to `len`, string `in` to `contains`) to a pure
69
+ * computed definition before inlining so interval and lint analysis read the canonical form.
70
+ * A definition that fails static checking keeps its parsed tree; its own slot reports the error.
71
+ */
72
+ function lowerDefinition(parsed, declarations, allowRegex) {
73
+ if (declarations === undefined)
74
+ return parsed.node;
75
+ try {
76
+ checkExpressionBudget(parsed.node);
77
+ checkExpression(declarations, parsed.node, parsed.offsets, { allowRegex }, parsed.powerOperators, parsed.lengthProperties);
78
+ }
79
+ catch (error) {
80
+ if (!(error instanceof ExpressionCompileError))
81
+ throw error;
82
+ }
83
+ return parsed.node;
84
+ }
85
+ /** The first side condition that makes a computed expression not a pure definition. */
86
+ function impurity(node) {
87
+ switch (node.kind) {
88
+ case 'literal':
89
+ return undefined;
90
+ case 'path':
91
+ return node.path === 'context' || node.path.startsWith('context.')
92
+ ? `reads the host fact \`${node.path}\``
93
+ : undefined;
94
+ case 'if':
95
+ return 'uses `if`, whose branch is a side condition';
96
+ case 'list': {
97
+ for (const item of node.items) {
98
+ const found = impurity(item);
99
+ if (found !== undefined)
100
+ return found;
101
+ }
102
+ return undefined;
103
+ }
104
+ case 'comprehension': {
105
+ const source = impurity(node.source);
106
+ if (source !== undefined)
107
+ return source;
108
+ if (node.valueExpr !== undefined) {
109
+ const value = impurity(node.valueExpr);
110
+ if (value !== undefined)
111
+ return value;
112
+ }
113
+ return node.predicate === undefined ? undefined : impurity(node.predicate);
114
+ }
115
+ case 'call': {
116
+ if (DATASET_BUILTINS.has(node.op)) {
117
+ return `reads a dataset with \`${node.op}\``;
118
+ }
119
+ if (HOST_CALLS.has(node.op)) {
120
+ return `reads host or session state with \`${node.op}\``;
121
+ }
122
+ for (const arg of node.args) {
123
+ const found = impurity(arg);
124
+ if (found !== undefined)
125
+ return found;
126
+ }
127
+ return undefined;
128
+ }
129
+ default: {
130
+ for (const arg of node.args) {
131
+ const found = impurity(arg);
132
+ if (found !== undefined)
133
+ return found;
134
+ }
135
+ return undefined;
136
+ }
137
+ }
138
+ }
139
+ function statusOf(definitions, declarations, allowRegex) {
140
+ const [only] = definitions;
141
+ if (only === undefined)
142
+ throw new Error('a computed status needs at least one definition');
143
+ if (definitions.length > 1) {
144
+ return {
145
+ kind: 'multiple',
146
+ fieldId: only.fieldId,
147
+ paths: definitions.map((definition) => definition.path),
148
+ };
149
+ }
150
+ if (only.scope === 'item') {
151
+ return {
152
+ kind: 'impure',
153
+ fieldId: only.fieldId,
154
+ path: only.path,
155
+ ruleId: only.ruleId,
156
+ reason: 'writes one row member rather than a field the substitution can address',
157
+ };
158
+ }
159
+ if (only.kind !== 'compute') {
160
+ return {
161
+ kind: 'impure',
162
+ fieldId: only.fieldId,
163
+ path: only.path,
164
+ ruleId: only.ruleId,
165
+ reason: 'is a `defaultCompute` writer, whose value a host override can replace',
166
+ };
167
+ }
168
+ const parsed = parseDefinition(only.source);
169
+ if (parsed === undefined) {
170
+ return {
171
+ kind: 'unparsed',
172
+ fieldId: only.fieldId,
173
+ path: only.path,
174
+ ruleId: only.ruleId,
175
+ reason: 'it is not an expression this compiler can read',
176
+ };
177
+ }
178
+ const reason = impurity(parsed.node);
179
+ if (reason !== undefined) {
180
+ return {
181
+ kind: 'impure',
182
+ fieldId: only.fieldId,
183
+ path: only.path,
184
+ ruleId: only.ruleId,
185
+ reason,
186
+ };
187
+ }
188
+ const expr = lowerDefinition(parsed, declarations, allowRegex);
189
+ return {
190
+ kind: 'pure',
191
+ definition: {
192
+ fieldId: only.fieldId,
193
+ path: only.path,
194
+ ruleId: only.ruleId,
195
+ expr,
196
+ },
197
+ };
198
+ }
199
+ /** Index the document's computed writers, in declaration order. */
200
+ export function computedFieldIndex(document, declarations, allowRegex = true) {
201
+ const grouped = new Map();
202
+ listAt(document, 'rules').forEach((rule, index) => {
203
+ if (!isRecord(rule))
204
+ return;
205
+ const definition = readDefinition(rule, index);
206
+ if (definition === undefined)
207
+ return;
208
+ const list = grouped.get(definition.fieldId) ?? [];
209
+ list.push(definition);
210
+ grouped.set(definition.fieldId, list);
211
+ });
212
+ const definitions = new Map();
213
+ const writers = new Map();
214
+ for (const [fieldId, group] of grouped) {
215
+ definitions.set(fieldId, statusOf(group, declarations, allowRegex));
216
+ // Every writer's own target is recorded, because two item-scoped writers of one array write
217
+ // different members and each owns its own. Two writers of one value are refused by their own
218
+ // check, which names both rules; the first entry still answers who owns it, so a second writer
219
+ // is never reported as no writer at all.
220
+ for (const definition of group) {
221
+ if (writers.has(definition.written))
222
+ continue;
223
+ writers.set(definition.written, { ruleId: definition.ruleId, kind: definition.kind });
224
+ }
225
+ }
226
+ // A produced container carries its members, so its writer owns those values too. Propagate the
227
+ // nearest writer down the declaration tree; an exact writer wins where an invalid document has
228
+ // both, which the duplicate-writer check already names rather than leaving this index to choose.
229
+ const inheritWriters = (fields, inherited) => {
230
+ for (const field of fields) {
231
+ if (!isRecord(field))
232
+ continue;
233
+ const fieldId = textAt(field, 'fieldId');
234
+ const own = fieldId === undefined ? undefined : writers.get(fieldId);
235
+ const owner = own ?? inherited;
236
+ if (fieldId !== undefined && own === undefined && owner !== undefined) {
237
+ writers.set(fieldId, owner);
238
+ }
239
+ inheritWriters(listAt(field, 'fields'), owner);
240
+ }
241
+ };
242
+ inheritWriters(listAt(document, 'fields'), undefined);
243
+ return { definitions, writers };
244
+ }
245
+ //# sourceMappingURL=computed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computed.js","sourceRoot":"","sources":["../../src/compile/computed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE/C;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AAK,CAAC;gBAAE,SAAS;YAC/B,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACzC,MAAM,GAAG,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrE,MAAM,KAAK,GAAG,GAAG,IAAI,SAAS,CAAC;YAC/B,IAAI,OAAO,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACtE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC9B,CAAC;YACD,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC,CAAC;IACF,cAAc,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IACtD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC","sourcesContent":["import { DATASET_BUILTINS, isRecord } from '@azx-pbc/axiom-runtime';\nimport type { ExprNode, ExpressionDeclarations } from '@azx-pbc/axiom-runtime';\nimport { MalformedCompiledNode, exprNodeOf } from '../expr/boundary.js';\nimport { ExpressionCompileError } from '../expr/diagnostics.js';\nimport { checkExpressionBudget, parseExpression } from '../expr/parser.js';\nimport { checkExpression } from '../expr/typecheck.js';\nimport type { ComputedFieldIndex, ComputedStatus } from '../expr/values/inline.js';\nimport { listAt, textAt } from './document.js';\n\n/**\n * The definitions a document states through its `compute` rules.\n *\n * A rule group is keyed by the field it writes. Exactly one pure `compute` writer is a\n * definition; two writers, a `defaultCompute`, an item-scoped writer, or a writer that reads\n * a dataset or a host fact is a status the substitution pass reports rather than a definition\n * it inlines. Reading the authored rule list here keeps that decision independent of the\n * compiled entries, so a slot is checked against the same definition the author wrote.\n */\n\nconst HOST_CALLS: ReadonlySet<string> = new Set([\n 'has_cap',\n 'is_relevant',\n 'rule_ok',\n 'no_blocking',\n 'rule_ok_in',\n 'no_blocking_in',\n 'required_in',\n]);\n\ninterface RawDefinition {\n readonly fieldId: string;\n /** The declaration whose value the rule produces: the target member for an item writer. */\n readonly written: string;\n readonly path: string;\n readonly ruleId: string;\n readonly kind: 'compute' | 'defaultCompute';\n readonly scope: string;\n readonly source: unknown;\n}\n\n/**\n * One rule that produces a declaration's value, as a check that refuses a second writer sees it.\n *\n * The key is the declaration whose value the rule produces rather than the member it names: an\n * item-scoped writer's `fieldId` is the array it addresses and its `targetFieldId` is the member\n * of one row it writes, which is the value that has an owner.\n */\ninterface ComputedWriter {\n readonly ruleId: string;\n readonly kind: 'compute' | 'defaultCompute';\n}\n\n/** The computed facts of one document: what a slot may inline, and who owns each value. */\nexport interface ComputedWriterIndex extends ComputedFieldIndex {\n /** The writer of each produced declaration, including the members a produced container carries. */\n readonly writers: ReadonlyMap<string, ComputedWriter>;\n}\n\nfunction readDefinition(rule: Record<string, unknown>, index: number): RawDefinition | undefined {\n const kind = textAt(rule, 'kind');\n if (kind !== 'compute' && kind !== 'defaultCompute') return undefined;\n const fieldId = textAt(rule, 'fieldId');\n const ruleId = textAt(rule, 'ruleId');\n if (fieldId === undefined || ruleId === undefined) return undefined;\n const targetFieldId =\n textAt(rule, 'scope') === 'item' ? textAt(rule, 'targetFieldId') : undefined;\n return {\n fieldId,\n written: targetFieldId ?? fieldId,\n path: `$.rules[${String(index)}].expr`,\n ruleId,\n kind,\n scope: textAt(rule, 'scope') ?? 'field',\n source: rule['expr'],\n };\n}\n\ninterface ParsedDefinition {\n readonly node: ExprNode;\n readonly offsets: WeakMap<ExprNode, number>;\n readonly powerOperators?: WeakSet<ExprNode>;\n readonly lengthProperties?: WeakSet<ExprNode>;\n}\n\nfunction parseDefinition(source: unknown): ParsedDefinition | undefined {\n try {\n if (typeof source === 'string') {\n const parsed = parseExpression(source);\n return {\n node: parsed.node,\n offsets: parsed.offsets,\n powerOperators: parsed.powerOperators,\n lengthProperties: parsed.lengthProperties,\n };\n }\n if (isRecord(source)) {\n return { node: exprNodeOf(source, 'definition'), offsets: new WeakMap() };\n }\n return undefined;\n } catch (error) {\n if (error instanceof ExpressionCompileError || error instanceof MalformedCompiledNode) {\n return undefined;\n }\n throw error;\n }\n}\n\n/**\n * Applies check-time lowerings (`.length` to `len`, string `in` to `contains`) to a pure\n * computed definition before inlining so interval and lint analysis read the canonical form.\n * A definition that fails static checking keeps its parsed tree; its own slot reports the error.\n */\nfunction lowerDefinition(\n parsed: ParsedDefinition,\n declarations: ExpressionDeclarations | undefined,\n allowRegex: boolean,\n): ExprNode {\n if (declarations === undefined) return parsed.node;\n try {\n checkExpressionBudget(parsed.node);\n checkExpression(\n declarations,\n parsed.node,\n parsed.offsets,\n { allowRegex },\n parsed.powerOperators,\n parsed.lengthProperties,\n );\n } catch (error) {\n if (!(error instanceof ExpressionCompileError)) throw error;\n }\n return parsed.node;\n}\n\n/** The first side condition that makes a computed expression not a pure definition. */\nfunction impurity(node: ExprNode): string | undefined {\n switch (node.kind) {\n case 'literal':\n return undefined;\n case 'path':\n return node.path === 'context' || node.path.startsWith('context.')\n ? `reads the host fact \\`${node.path}\\``\n : undefined;\n case 'if':\n return 'uses `if`, whose branch is a side condition';\n case 'list': {\n for (const item of node.items) {\n const found = impurity(item);\n if (found !== undefined) return found;\n }\n return undefined;\n }\n case 'comprehension': {\n const source = impurity(node.source);\n if (source !== undefined) return source;\n if (node.valueExpr !== undefined) {\n const value = impurity(node.valueExpr);\n if (value !== undefined) return value;\n }\n return node.predicate === undefined ? undefined : impurity(node.predicate);\n }\n case 'call': {\n if (DATASET_BUILTINS.has(node.op)) {\n return `reads a dataset with \\`${node.op}\\``;\n }\n if (HOST_CALLS.has(node.op)) {\n return `reads host or session state with \\`${node.op}\\``;\n }\n for (const arg of node.args) {\n const found = impurity(arg);\n if (found !== undefined) return found;\n }\n return undefined;\n }\n default: {\n for (const arg of node.args) {\n const found = impurity(arg);\n if (found !== undefined) return found;\n }\n return undefined;\n }\n }\n}\n\nfunction statusOf(\n definitions: readonly RawDefinition[],\n declarations: ExpressionDeclarations | undefined,\n allowRegex: boolean,\n): ComputedStatus {\n const [only] = definitions;\n if (only === undefined) throw new Error('a computed status needs at least one definition');\n if (definitions.length > 1) {\n return {\n kind: 'multiple',\n fieldId: only.fieldId,\n paths: definitions.map((definition) => definition.path),\n };\n }\n if (only.scope === 'item') {\n return {\n kind: 'impure',\n fieldId: only.fieldId,\n path: only.path,\n ruleId: only.ruleId,\n reason: 'writes one row member rather than a field the substitution can address',\n };\n }\n if (only.kind !== 'compute') {\n return {\n kind: 'impure',\n fieldId: only.fieldId,\n path: only.path,\n ruleId: only.ruleId,\n reason: 'is a `defaultCompute` writer, whose value a host override can replace',\n };\n }\n const parsed = parseDefinition(only.source);\n if (parsed === undefined) {\n return {\n kind: 'unparsed',\n fieldId: only.fieldId,\n path: only.path,\n ruleId: only.ruleId,\n reason: 'it is not an expression this compiler can read',\n };\n }\n const reason = impurity(parsed.node);\n if (reason !== undefined) {\n return {\n kind: 'impure',\n fieldId: only.fieldId,\n path: only.path,\n ruleId: only.ruleId,\n reason,\n };\n }\n const expr = lowerDefinition(parsed, declarations, allowRegex);\n return {\n kind: 'pure',\n definition: {\n fieldId: only.fieldId,\n path: only.path,\n ruleId: only.ruleId,\n expr,\n },\n };\n}\n\n/** Index the document's computed writers, in declaration order. */\nexport function computedFieldIndex(\n document: Record<string, unknown>,\n declarations?: ExpressionDeclarations,\n allowRegex = true,\n): ComputedWriterIndex {\n const grouped = new Map<string, RawDefinition[]>();\n listAt(document, 'rules').forEach((rule, index) => {\n if (!isRecord(rule)) return;\n const definition = readDefinition(rule, index);\n if (definition === undefined) return;\n const list = grouped.get(definition.fieldId) ?? [];\n list.push(definition);\n grouped.set(definition.fieldId, list);\n });\n const definitions = new Map<string, ComputedStatus>();\n const writers = new Map<string, ComputedWriter>();\n for (const [fieldId, group] of grouped) {\n definitions.set(fieldId, statusOf(group, declarations, allowRegex));\n // Every writer's own target is recorded, because two item-scoped writers of one array write\n // different members and each owns its own. Two writers of one value are refused by their own\n // check, which names both rules; the first entry still answers who owns it, so a second writer\n // is never reported as no writer at all.\n for (const definition of group) {\n if (writers.has(definition.written)) continue;\n writers.set(definition.written, { ruleId: definition.ruleId, kind: definition.kind });\n }\n }\n // A produced container carries its members, so its writer owns those values too. Propagate the\n // nearest writer down the declaration tree; an exact writer wins where an invalid document has\n // both, which the duplicate-writer check already names rather than leaving this index to choose.\n const inheritWriters = (\n fields: readonly unknown[],\n inherited: ComputedWriter | undefined,\n ): void => {\n for (const field of fields) {\n if (!isRecord(field)) continue;\n const fieldId = textAt(field, 'fieldId');\n const own = fieldId === undefined ? undefined : writers.get(fieldId);\n const owner = own ?? inherited;\n if (fieldId !== undefined && own === undefined && owner !== undefined) {\n writers.set(fieldId, owner);\n }\n inheritWriters(listAt(field, 'fields'), owner);\n }\n };\n inheritWriters(listAt(document, 'fields'), undefined);\n return { definitions, writers };\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import type { ExprNode } from '@azx-pbc/axiom-runtime';
2
+ import type { Compilation } from './compilation.js';
3
+ /**
4
+ * Records that a condition slot can never fire, unless the expression lint already stated the
5
+ * same fact at the same path.
6
+ *
7
+ * The lint warns about the unsatisfiable conjunction itself; this names the rule, gate item or
8
+ * declaration that therefore never runs. One path earns one warning, so an author reading the
9
+ * compile sees one sentence about the condition rather than the same cause twice.
10
+ */
11
+ export declare function warnConditionNeverFires(compilation: Compilation, path: string, node: ExprNode, label: string): void;
12
+ //# sourceMappingURL=condition-warnings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition-warnings.d.ts","sourceRoot":"","sources":["../../src/compile/condition-warnings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,MAAM,GACZ,IAAI,CAaN"}
@@ -0,0 +1,26 @@
1
+ import { diagnosticDoc } from '@azx-pbc/axiom-runtime';
2
+ import { conditionNeverFires } from '../expr/lint.js';
3
+ /**
4
+ * Records that a condition slot can never fire, unless the expression lint already stated the
5
+ * same fact at the same path.
6
+ *
7
+ * The lint warns about the unsatisfiable conjunction itself; this names the rule, gate item or
8
+ * declaration that therefore never runs. One path earns one warning, so an author reading the
9
+ * compile sees one sentence about the condition rather than the same cause twice.
10
+ */
11
+ export function warnConditionNeverFires(compilation, path, node, label) {
12
+ const reason = conditionNeverFires(node);
13
+ if (reason === undefined)
14
+ return;
15
+ if (compilation.warnings.some((warning) => warning.path === path)) {
16
+ return;
17
+ }
18
+ compilation.warnings.push({
19
+ code: 'UNSATISFIABLE_CONDITION',
20
+ path,
21
+ detail: `${label} can never fire: ${reason}; change the condition so it can hold, or remove it, because it states nothing about the record`,
22
+ messageKey: diagnosticDoc('UNSATISFIABLE_CONDITION').messageKey,
23
+ suggestions: [],
24
+ });
25
+ }
26
+ //# sourceMappingURL=condition-warnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition-warnings.js","sourceRoot":"","sources":["../../src/compile/condition-warnings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAwB,EACxB,IAAY,EACZ,IAAc,EACd,KAAa;IAEb,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO;IACjC,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAClE,OAAO;IACT,CAAC;IACD,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;QACxB,IAAI,EAAE,yBAAyB;QAC/B,IAAI;QACJ,MAAM,EAAE,GAAG,KAAK,oBAAoB,MAAM,iGAAiG;QAC3I,UAAU,EAAE,aAAa,CAAC,yBAAyB,CAAC,CAAC,UAAU;QAC/D,WAAW,EAAE,EAAE;KAChB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { diagnosticDoc } from '@azx-pbc/axiom-runtime';\nimport type { ExprNode } from '@azx-pbc/axiom-runtime';\nimport { conditionNeverFires } from '../expr/lint.js';\nimport type { Compilation } from './compilation.js';\n\n/**\n * Records that a condition slot can never fire, unless the expression lint already stated the\n * same fact at the same path.\n *\n * The lint warns about the unsatisfiable conjunction itself; this names the rule, gate item or\n * declaration that therefore never runs. One path earns one warning, so an author reading the\n * compile sees one sentence about the condition rather than the same cause twice.\n */\nexport function warnConditionNeverFires(\n compilation: Compilation,\n path: string,\n node: ExprNode,\n label: string,\n): void {\n const reason = conditionNeverFires(node);\n if (reason === undefined) return;\n if (compilation.warnings.some((warning) => warning.path === path)) {\n return;\n }\n compilation.warnings.push({\n code: 'UNSATISFIABLE_CONDITION',\n path,\n detail: `${label} can never fire: ${reason}; change the condition so it can hold, or remove it, because it states nothing about the record`,\n messageKey: diagnosticDoc('UNSATISFIABLE_CONDITION').messageKey,\n suggestions: [],\n });\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import type { StaticType } from '../expr/typecheck.js';
2
+ import type { Compilation } from './compilation.js';
3
+ /**
4
+ * The one rule every condition slot obeys: it must produce a boolean outcome.
5
+ *
6
+ * A condition that compiles but has no outcome is the worst kind of artifact: it validates, it
7
+ * ships, and every evaluation is `UNKNOWN` with an `ENGINE_ERROR`. A gate's `activeWhen` is worse
8
+ * still, because only a definite `false` deactivates a gate — a wrong-typed condition leaves the
9
+ * gate in force and blocks the record its author meant to release.
10
+ *
11
+ * `null` is legitimate: it is the empty value of every domain (`EXPR-5.1.12`) and evaluates to
12
+ * `UNKNOWN`. Every other type is refused here, where the slot is, with the repair that names a
13
+ * comparison rather than leaving the author to infer one.
14
+ */
15
+ export declare function requireBooleanCondition(compilation: Compilation, slot: {
16
+ readonly type: StaticType;
17
+ }, path: string, label: string): void;
18
+ //# sourceMappingURL=conditions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../src/compile/conditions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,EACnC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,IAAI,CAYN"}
@@ -0,0 +1,22 @@
1
+ import { typeName } from '../expr/typecheck/types.js';
2
+ import { refuse } from './compilation.js';
3
+ /**
4
+ * The one rule every condition slot obeys: it must produce a boolean outcome.
5
+ *
6
+ * A condition that compiles but has no outcome is the worst kind of artifact: it validates, it
7
+ * ships, and every evaluation is `UNKNOWN` with an `ENGINE_ERROR`. A gate's `activeWhen` is worse
8
+ * still, because only a definite `false` deactivates a gate — a wrong-typed condition leaves the
9
+ * gate in force and blocks the record its author meant to release.
10
+ *
11
+ * `null` is legitimate: it is the empty value of every domain (`EXPR-5.1.12`) and evaluates to
12
+ * `UNKNOWN`. Every other type is refused here, where the slot is, with the repair that names a
13
+ * comparison rather than leaving the author to infer one.
14
+ */
15
+ export function requireBooleanCondition(compilation, slot, path, label) {
16
+ const type = slot.type;
17
+ if (type.kind === 'primitive' && (type.primitive === 'boolean' || type.primitive === 'null')) {
18
+ return;
19
+ }
20
+ refuse(compilation, 'TYPE_MISMATCH', path, `${label} must produce a boolean outcome; this expression produces ${typeName(type)}, which decides nothing — an outcome slot with no outcome answers UNKNOWN on every record. Compare the value first, such as \`f_a == 0\`, or ask \`present(f_a)\`.`, { expected: 'boolean' });
21
+ }
22
+ //# sourceMappingURL=conditions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../src/compile/conditions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAwB,EACxB,IAAmC,EACnC,IAAY,EACZ,KAAa;IAEb,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACvB,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC,EAAE,CAAC;QAC7F,OAAO;IACT,CAAC;IACD,MAAM,CACJ,WAAW,EACX,eAAe,EACf,IAAI,EACJ,GAAG,KAAK,6DAA6D,QAAQ,CAAC,IAAI,CAAC,oKAAoK,EACvP,EAAE,QAAQ,EAAE,SAAS,EAAE,CACxB,CAAC;AACJ,CAAC","sourcesContent":["import type { StaticType } from '../expr/typecheck.js';\nimport { typeName } from '../expr/typecheck/types.js';\nimport type { Compilation } from './compilation.js';\nimport { refuse } from './compilation.js';\n\n/**\n * The one rule every condition slot obeys: it must produce a boolean outcome.\n *\n * A condition that compiles but has no outcome is the worst kind of artifact: it validates, it\n * ships, and every evaluation is `UNKNOWN` with an `ENGINE_ERROR`. A gate's `activeWhen` is worse\n * still, because only a definite `false` deactivates a gate — a wrong-typed condition leaves the\n * gate in force and blocks the record its author meant to release.\n *\n * `null` is legitimate: it is the empty value of every domain (`EXPR-5.1.12`) and evaluates to\n * `UNKNOWN`. Every other type is refused here, where the slot is, with the repair that names a\n * comparison rather than leaving the author to infer one.\n */\nexport function requireBooleanCondition(\n compilation: Compilation,\n slot: { readonly type: StaticType },\n path: string,\n label: string,\n): void {\n const type = slot.type;\n if (type.kind === 'primitive' && (type.primitive === 'boolean' || type.primitive === 'null')) {\n return;\n }\n refuse(\n compilation,\n 'TYPE_MISMATCH',\n path,\n `${label} must produce a boolean outcome; this expression produces ${typeName(type)}, which decides nothing — an outcome slot with no outcome answers UNKNOWN on every record. Compare the value first, such as \\`f_a == 0\\`, or ask \\`present(f_a)\\`.`,\n { expected: 'boolean' },\n );\n}\n"]}
@@ -0,0 +1,67 @@
1
+ import type { ExprNode, RuleKind } from '@azx-pbc/axiom-runtime';
2
+ import type { Compilation } from './compilation.js';
3
+ import type { CompiledMessageBinding } from './expression.js';
4
+ import type { CompiledRuleEntry } from './rules.js';
5
+ /** One message a rule or a gate item raises, with the arguments that declaration binds. */
6
+ export interface MessageUse {
7
+ readonly key: string;
8
+ readonly path: string;
9
+ /** The rule, gate item or option that binds the arguments, named in a refusal. */
10
+ readonly owner: string;
11
+ readonly binding: CompiledMessageBinding;
12
+ /**
13
+ * The member the owner binds the arguments in, as the repair spells it. Defaults to `params`,
14
+ * which is the block a rule, gate item, screen reason and layout node carry; an option's reason
15
+ * message is bound by `unavailableParams` instead.
16
+ */
17
+ readonly member?: string;
18
+ }
19
+ /**
20
+ * The expression-wide checks one slot earns wherever it appears: signature coverage, plus the
21
+ * gate-only placement and referential integrity of `rule_ok` and `no_blocking`, and the step
22
+ * ids the three step folds name. Layout passes no rule kind, so those built-ins are refused
23
+ * there just as they are outside a gate rule.
24
+ */
25
+ export declare function crossCheckExpression(compilation: Compilation, path: string, node: ExprNode, ruleKind: RuleKind | undefined, targetIds: ReadonlySet<string>): void;
26
+ /**
27
+ * The cross-checks between a compiled rule, the message it raises and the fields it binds:
28
+ * `rule_ok`/`no_blocking` are admitted only inside a gate rule, every rule
29
+ * they name exists, every message argument is bound by the rule
30
+ * and every `select` branch of a bound option field is one of its codes.
31
+ * A `digest(...)` that verifies a signature is also checked against the coverage that
32
+ * signature declares.
33
+ */
34
+ export declare function crossCheckRule(compilation: Compilation, entry: CompiledRuleEntry, messageKeys: readonly MessageUse[], targetIds: ReadonlySet<string>): void;
35
+ /**
36
+ * One message use against the arguments its owner binds: every interpolation is bound, and every
37
+ * `select` branch a bound option field can take is one of its declared codes.
38
+ *
39
+ * Exported because a layout chrome message (`titleKey`, `textKey`) is bound by the layout node's
40
+ * own `params` block rather than by a rule, and one authority for the check keeps the two
41
+ * declarations reporting the same cause the same way.
42
+ */
43
+ export declare function crossCheckMessageBinding(compilation: Compilation, use: MessageUse): void;
44
+ /**
45
+ * The messages a params-less slot names, refused when they interpolate anything.
46
+ *
47
+ * A label, a help text, a placeholder, a title or a layout text is stated presentation: its
48
+ * slot declares no `params`, so nothing binds an argument and a `{param}` (or a `plural`'s
49
+ * count) would be a missing argument on every record — a runtime `ENGINE_ERROR` instead of a
50
+ * publish-time answer. The slot table is the one list of which members those are.
51
+ *
52
+ * A slot whose owner binds arguments is not checked here: the rule or gate-item compile
53
+ * already refuses an argument that declaration does not bind, and it can name the declaration.
54
+ */
55
+ export declare function crossCheckParamslessMessages(compilation: Compilation, document: Record<string, unknown>): void;
56
+ /**
57
+ * One params-less message use: every interpolation is refused because the slot has no binding.
58
+ *
59
+ * Exported beside the binding check because a layout `titleKey` or `textKey` is params-bearing
60
+ * only when its node carries a `params` block; the layout compile decides which of the two
61
+ * checks a node earns, and both must state the cause the same way.
62
+ */
63
+ export declare function crossCheckParamslessMessage(compilation: Compilation, use: {
64
+ readonly key: string;
65
+ readonly path: string;
66
+ }): void;
67
+ //# sourceMappingURL=cross-checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-checks.d.ts","sourceRoot":"","sources":["../../src/compile/cross-checks.ts"],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