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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (655) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +415 -2
  3. package/dist/article.d.ts +12 -0
  4. package/dist/article.d.ts.map +1 -0
  5. package/dist/article.js +16 -0
  6. package/dist/article.js.map +1 -0
  7. package/dist/cli/args.d.ts +101 -0
  8. package/dist/cli/args.d.ts.map +1 -0
  9. package/dist/cli/args.js +158 -0
  10. package/dist/cli/args.js.map +1 -0
  11. package/dist/cli/check.d.ts +2 -0
  12. package/dist/cli/check.d.ts.map +1 -0
  13. package/dist/cli/check.js +33 -0
  14. package/dist/cli/check.js.map +1 -0
  15. package/dist/cli/compile.d.ts +2 -0
  16. package/dist/cli/compile.d.ts.map +1 -0
  17. package/dist/cli/compile.js +43 -0
  18. package/dist/cli/compile.js.map +1 -0
  19. package/dist/cli/count.d.ts +15 -0
  20. package/dist/cli/count.d.ts.map +1 -0
  21. package/dist/cli/count.js +21 -0
  22. package/dist/cli/count.js.map +1 -0
  23. package/dist/cli/dataset.d.ts +28 -0
  24. package/dist/cli/dataset.d.ts.map +1 -0
  25. package/dist/cli/dataset.js +115 -0
  26. package/dist/cli/dataset.js.map +1 -0
  27. package/dist/cli/diff.d.ts +2 -0
  28. package/dist/cli/diff.d.ts.map +1 -0
  29. package/dist/cli/diff.js +297 -0
  30. package/dist/cli/diff.js.map +1 -0
  31. package/dist/cli/explain.d.ts +2 -0
  32. package/dist/cli/explain.d.ts.map +1 -0
  33. package/dist/cli/explain.js +95 -0
  34. package/dist/cli/explain.js.map +1 -0
  35. package/dist/cli/fields.d.ts +11 -0
  36. package/dist/cli/fields.d.ts.map +1 -0
  37. package/dist/cli/fields.js +13 -0
  38. package/dist/cli/fields.js.map +1 -0
  39. package/dist/cli/main.d.ts +2 -0
  40. package/dist/cli/main.d.ts.map +1 -0
  41. package/dist/cli/main.js +40 -0
  42. package/dist/cli/main.js.map +1 -0
  43. package/dist/cli/read.d.ts +56 -0
  44. package/dist/cli/read.d.ts.map +1 -0
  45. package/dist/cli/read.js +179 -0
  46. package/dist/cli/read.js.map +1 -0
  47. package/dist/cli/render.d.ts +58 -0
  48. package/dist/cli/render.d.ts.map +1 -0
  49. package/dist/cli/render.js +422 -0
  50. package/dist/cli/render.js.map +1 -0
  51. package/dist/cli/schema.d.ts +28 -0
  52. package/dist/cli/schema.d.ts.map +1 -0
  53. package/dist/cli/schema.js +46 -0
  54. package/dist/cli/schema.js.map +1 -0
  55. package/dist/cli/suite-report.d.ts +18 -0
  56. package/dist/cli/suite-report.d.ts.map +1 -0
  57. package/dist/cli/suite-report.js +58 -0
  58. package/dist/cli/suite-report.js.map +1 -0
  59. package/dist/cli/suites.d.ts +25 -0
  60. package/dist/cli/suites.d.ts.map +1 -0
  61. package/dist/cli/suites.js +67 -0
  62. package/dist/cli/suites.js.map +1 -0
  63. package/dist/cli/terminal.d.ts +45 -0
  64. package/dist/cli/terminal.d.ts.map +1 -0
  65. package/dist/cli/terminal.js +119 -0
  66. package/dist/cli/terminal.js.map +1 -0
  67. package/dist/cli/test.d.ts +12 -0
  68. package/dist/cli/test.d.ts.map +1 -0
  69. package/dist/cli/test.js +199 -0
  70. package/dist/cli/test.js.map +1 -0
  71. package/dist/cli/usage.d.ts +15 -0
  72. package/dist/cli/usage.d.ts.map +1 -0
  73. package/dist/cli/usage.js +95 -0
  74. package/dist/cli/usage.js.map +1 -0
  75. package/dist/cli.d.ts +3 -0
  76. package/dist/cli.d.ts.map +1 -0
  77. package/dist/cli.js +51 -0
  78. package/dist/cli.js.map +1 -0
  79. package/dist/compile/artifact-members.d.ts +57 -0
  80. package/dist/compile/artifact-members.d.ts.map +1 -0
  81. package/dist/compile/artifact-members.js +130 -0
  82. package/dist/compile/artifact-members.js.map +1 -0
  83. package/dist/compile/artifact.d.ts +20 -0
  84. package/dist/compile/artifact.d.ts.map +1 -0
  85. package/dist/compile/artifact.js +87 -0
  86. package/dist/compile/artifact.js.map +1 -0
  87. package/dist/compile/compilation.d.ts +46 -0
  88. package/dist/compile/compilation.d.ts.map +1 -0
  89. package/dist/compile/compilation.js +4 -0
  90. package/dist/compile/compilation.js.map +1 -0
  91. package/dist/compile/computed.d.ts +22 -0
  92. package/dist/compile/computed.d.ts.map +1 -0
  93. package/dist/compile/computed.js +245 -0
  94. package/dist/compile/computed.js.map +1 -0
  95. package/dist/compile/condition-warnings.d.ts +12 -0
  96. package/dist/compile/condition-warnings.d.ts.map +1 -0
  97. package/dist/compile/condition-warnings.js +26 -0
  98. package/dist/compile/condition-warnings.js.map +1 -0
  99. package/dist/compile/conditions.d.ts +18 -0
  100. package/dist/compile/conditions.d.ts.map +1 -0
  101. package/dist/compile/conditions.js +22 -0
  102. package/dist/compile/conditions.js.map +1 -0
  103. package/dist/compile/cross-checks.d.ts +67 -0
  104. package/dist/compile/cross-checks.d.ts.map +1 -0
  105. package/dist/compile/cross-checks.js +238 -0
  106. package/dist/compile/cross-checks.js.map +1 -0
  107. package/dist/compile/datasets.d.ts +52 -0
  108. package/dist/compile/datasets.d.ts.map +1 -0
  109. package/dist/compile/datasets.js +183 -0
  110. package/dist/compile/datasets.js.map +1 -0
  111. package/dist/compile/dead-weight.d.ts +26 -0
  112. package/dist/compile/dead-weight.d.ts.map +1 -0
  113. package/dist/compile/dead-weight.js +244 -0
  114. package/dist/compile/dead-weight.js.map +1 -0
  115. package/dist/compile/declaration-rules.d.ts +54 -0
  116. package/dist/compile/declaration-rules.d.ts.map +1 -0
  117. package/dist/compile/declaration-rules.js +510 -0
  118. package/dist/compile/declaration-rules.js.map +1 -0
  119. package/dist/compile/declarations.d.ts +44 -0
  120. package/dist/compile/declarations.d.ts.map +1 -0
  121. package/dist/compile/declarations.js +160 -0
  122. package/dist/compile/declarations.js.map +1 -0
  123. package/dist/compile/document.d.ts +4 -0
  124. package/dist/compile/document.d.ts.map +1 -0
  125. package/dist/compile/document.js +13 -0
  126. package/dist/compile/document.js.map +1 -0
  127. package/dist/compile/expression.d.ts +38 -0
  128. package/dist/compile/expression.d.ts.map +1 -0
  129. package/dist/compile/expression.js +288 -0
  130. package/dist/compile/expression.js.map +1 -0
  131. package/dist/compile/hashes.d.ts +26 -0
  132. package/dist/compile/hashes.d.ts.map +1 -0
  133. package/dist/compile/hashes.js +96 -0
  134. package/dist/compile/hashes.js.map +1 -0
  135. package/dist/compile/item-targets.d.ts +12 -0
  136. package/dist/compile/item-targets.d.ts.map +1 -0
  137. package/dist/compile/item-targets.js +287 -0
  138. package/dist/compile/item-targets.js.map +1 -0
  139. package/dist/compile/messages.d.ts +8 -0
  140. package/dist/compile/messages.d.ts.map +1 -0
  141. package/dist/compile/messages.js +62 -0
  142. package/dist/compile/messages.js.map +1 -0
  143. package/dist/compile/option-availability.d.ts +51 -0
  144. package/dist/compile/option-availability.d.ts.map +1 -0
  145. package/dist/compile/option-availability.js +171 -0
  146. package/dist/compile/option-availability.js.map +1 -0
  147. package/dist/compile/option-codes.d.ts +27 -0
  148. package/dist/compile/option-codes.d.ts.map +1 -0
  149. package/dist/compile/option-codes.js +212 -0
  150. package/dist/compile/option-codes.js.map +1 -0
  151. package/dist/compile/references.d.ts +14 -0
  152. package/dist/compile/references.d.ts.map +1 -0
  153. package/dist/compile/references.js +126 -0
  154. package/dist/compile/references.js.map +1 -0
  155. package/dist/compile/rows-from.d.ts +27 -0
  156. package/dist/compile/rows-from.d.ts.map +1 -0
  157. package/dist/compile/rows-from.js +164 -0
  158. package/dist/compile/rows-from.js.map +1 -0
  159. package/dist/compile/rules.d.ts +58 -0
  160. package/dist/compile/rules.d.ts.map +1 -0
  161. package/dist/compile/rules.js +327 -0
  162. package/dist/compile/rules.js.map +1 -0
  163. package/dist/compile/suggestions.d.ts +52 -0
  164. package/dist/compile/suggestions.d.ts.map +1 -0
  165. package/dist/compile/suggestions.js +633 -0
  166. package/dist/compile/suggestions.js.map +1 -0
  167. package/dist/compile/targets.d.ts +22 -0
  168. package/dist/compile/targets.d.ts.map +1 -0
  169. package/dist/compile/targets.js +125 -0
  170. package/dist/compile/targets.js.map +1 -0
  171. package/dist/compile/types.d.ts +84 -0
  172. package/dist/compile/types.d.ts.map +1 -0
  173. package/dist/compile/types.js +2 -0
  174. package/dist/compile/types.js.map +1 -0
  175. package/dist/compile/warning.d.ts +45 -0
  176. package/dist/compile/warning.d.ts.map +1 -0
  177. package/dist/compile/warning.js +2 -0
  178. package/dist/compile/warning.js.map +1 -0
  179. package/dist/compile-yaml.d.ts +23 -0
  180. package/dist/compile-yaml.d.ts.map +1 -0
  181. package/dist/compile-yaml.js +30 -0
  182. package/dist/compile-yaml.js.map +1 -0
  183. package/dist/compile.d.ts +78 -0
  184. package/dist/compile.d.ts.map +1 -0
  185. package/dist/compile.js +372 -0
  186. package/dist/compile.js.map +1 -0
  187. package/dist/csv/limits.d.ts +43 -0
  188. package/dist/csv/limits.d.ts.map +1 -0
  189. package/dist/csv/limits.js +51 -0
  190. package/dist/csv/limits.js.map +1 -0
  191. package/dist/csv/scalar.d.ts +33 -0
  192. package/dist/csv/scalar.d.ts.map +1 -0
  193. package/dist/csv/scalar.js +77 -0
  194. package/dist/csv/scalar.js.map +1 -0
  195. package/dist/datasets/csv.d.ts +46 -0
  196. package/dist/datasets/csv.d.ts.map +1 -0
  197. package/dist/datasets/csv.js +293 -0
  198. package/dist/datasets/csv.js.map +1 -0
  199. package/dist/datasets/declaration.d.ts +16 -0
  200. package/dist/datasets/declaration.d.ts.map +1 -0
  201. package/dist/datasets/declaration.js +104 -0
  202. package/dist/datasets/declaration.js.map +1 -0
  203. package/dist/datasets/diagnostics.d.ts +65 -0
  204. package/dist/datasets/diagnostics.d.ts.map +1 -0
  205. package/dist/datasets/diagnostics.js +2 -0
  206. package/dist/datasets/diagnostics.js.map +1 -0
  207. package/dist/datasets/diff.d.ts +46 -0
  208. package/dist/datasets/diff.d.ts.map +1 -0
  209. package/dist/datasets/diff.js +84 -0
  210. package/dist/datasets/diff.js.map +1 -0
  211. package/dist/datasets/document.d.ts +12 -0
  212. package/dist/datasets/document.d.ts.map +1 -0
  213. package/dist/datasets/document.js +382 -0
  214. package/dist/datasets/document.js.map +1 -0
  215. package/dist/datasets/index.d.ts +43 -0
  216. package/dist/datasets/index.d.ts.map +1 -0
  217. package/dist/datasets/index.js +68 -0
  218. package/dist/datasets/index.js.map +1 -0
  219. package/dist/datasets/repair.d.ts +26 -0
  220. package/dist/datasets/repair.d.ts.map +1 -0
  221. package/dist/datasets/repair.js +60 -0
  222. package/dist/datasets/repair.js.map +1 -0
  223. package/dist/document-path.d.ts +62 -0
  224. package/dist/document-path.d.ts.map +1 -0
  225. package/dist/document-path.js +200 -0
  226. package/dist/document-path.js.map +1 -0
  227. package/dist/expr/boundary.d.ts +8 -0
  228. package/dist/expr/boundary.d.ts.map +1 -0
  229. package/dist/expr/boundary.js +243 -0
  230. package/dist/expr/boundary.js.map +1 -0
  231. package/dist/expr/compile-expr.d.ts +35 -0
  232. package/dist/expr/compile-expr.d.ts.map +1 -0
  233. package/dist/expr/compile-expr.js +66 -0
  234. package/dist/expr/compile-expr.js.map +1 -0
  235. package/dist/expr/deprecation.d.ts +23 -0
  236. package/dist/expr/deprecation.d.ts.map +1 -0
  237. package/dist/expr/deprecation.js +28 -0
  238. package/dist/expr/deprecation.js.map +1 -0
  239. package/dist/expr/diagnostics.d.ts +31 -0
  240. package/dist/expr/diagnostics.d.ts.map +1 -0
  241. package/dist/expr/diagnostics.js +34 -0
  242. package/dist/expr/diagnostics.js.map +1 -0
  243. package/dist/expr/lexer.d.ts +49 -0
  244. package/dist/expr/lexer.d.ts.map +1 -0
  245. package/dist/expr/lexer.js +277 -0
  246. package/dist/expr/lexer.js.map +1 -0
  247. package/dist/expr/lint-warnings.d.ts +11 -0
  248. package/dist/expr/lint-warnings.d.ts.map +1 -0
  249. package/dist/expr/lint-warnings.js +20 -0
  250. package/dist/expr/lint-warnings.js.map +1 -0
  251. package/dist/expr/lint.d.ts +41 -0
  252. package/dist/expr/lint.d.ts.map +1 -0
  253. package/dist/expr/lint.js +1034 -0
  254. package/dist/expr/lint.js.map +1 -0
  255. package/dist/expr/parse/aggregates.d.ts +13 -0
  256. package/dist/expr/parse/aggregates.d.ts.map +1 -0
  257. package/dist/expr/parse/aggregates.js +48 -0
  258. package/dist/expr/parse/aggregates.js.map +1 -0
  259. package/dist/expr/parse/budget.d.ts +11 -0
  260. package/dist/expr/parse/budget.d.ts.map +1 -0
  261. package/dist/expr/parse/budget.js +57 -0
  262. package/dist/expr/parse/budget.js.map +1 -0
  263. package/dist/expr/parse/grammar.d.ts +9 -0
  264. package/dist/expr/parse/grammar.d.ts.map +1 -0
  265. package/dist/expr/parse/grammar.js +699 -0
  266. package/dist/expr/parse/grammar.js.map +1 -0
  267. package/dist/expr/parse/literals.d.ts +20 -0
  268. package/dist/expr/parse/literals.d.ts.map +1 -0
  269. package/dist/expr/parse/literals.js +132 -0
  270. package/dist/expr/parse/literals.js.map +1 -0
  271. package/dist/expr/parse/stream.d.ts +60 -0
  272. package/dist/expr/parse/stream.d.ts.map +1 -0
  273. package/dist/expr/parse/stream.js +151 -0
  274. package/dist/expr/parse/stream.js.map +1 -0
  275. package/dist/expr/parser.d.ts +45 -0
  276. package/dist/expr/parser.d.ts.map +1 -0
  277. package/dist/expr/parser.js +110 -0
  278. package/dist/expr/parser.js.map +1 -0
  279. package/dist/expr/print/spell.d.ts +78 -0
  280. package/dist/expr/print/spell.d.ts.map +1 -0
  281. package/dist/expr/print/spell.js +592 -0
  282. package/dist/expr/print/spell.js.map +1 -0
  283. package/dist/expr/print.d.ts +20 -0
  284. package/dist/expr/print.d.ts.map +1 -0
  285. package/dist/expr/print.js +102 -0
  286. package/dist/expr/print.js.map +1 -0
  287. package/dist/expr/suggest.d.ts +26 -0
  288. package/dist/expr/suggest.d.ts.map +1 -0
  289. package/dist/expr/suggest.js +77 -0
  290. package/dist/expr/suggest.js.map +1 -0
  291. package/dist/expr/typecheck/aggregates.d.ts +8 -0
  292. package/dist/expr/typecheck/aggregates.d.ts.map +1 -0
  293. package/dist/expr/typecheck/aggregates.js +334 -0
  294. package/dist/expr/typecheck/aggregates.js.map +1 -0
  295. package/dist/expr/typecheck/arithmetic.d.ts +6 -0
  296. package/dist/expr/typecheck/arithmetic.d.ts.map +1 -0
  297. package/dist/expr/typecheck/arithmetic.js +258 -0
  298. package/dist/expr/typecheck/arithmetic.js.map +1 -0
  299. package/dist/expr/typecheck/arity.d.ts +38 -0
  300. package/dist/expr/typecheck/arity.d.ts.map +1 -0
  301. package/dist/expr/typecheck/arity.js +173 -0
  302. package/dist/expr/typecheck/arity.js.map +1 -0
  303. package/dist/expr/typecheck/calls.d.ts +6 -0
  304. package/dist/expr/typecheck/calls.d.ts.map +1 -0
  305. package/dist/expr/typecheck/calls.js +137 -0
  306. package/dist/expr/typecheck/calls.js.map +1 -0
  307. package/dist/expr/typecheck/comparison.d.ts +13 -0
  308. package/dist/expr/typecheck/comparison.d.ts.map +1 -0
  309. package/dist/expr/typecheck/comparison.js +200 -0
  310. package/dist/expr/typecheck/comparison.js.map +1 -0
  311. package/dist/expr/typecheck/compound.d.ts +24 -0
  312. package/dist/expr/typecheck/compound.d.ts.map +1 -0
  313. package/dist/expr/typecheck/compound.js +175 -0
  314. package/dist/expr/typecheck/compound.js.map +1 -0
  315. package/dist/expr/typecheck/context.d.ts +44 -0
  316. package/dist/expr/typecheck/context.d.ts.map +1 -0
  317. package/dist/expr/typecheck/context.js +2 -0
  318. package/dist/expr/typecheck/context.js.map +1 -0
  319. package/dist/expr/typecheck/datasets.d.ts +17 -0
  320. package/dist/expr/typecheck/datasets.d.ts.map +1 -0
  321. package/dist/expr/typecheck/datasets.js +136 -0
  322. package/dist/expr/typecheck/datasets.js.map +1 -0
  323. package/dist/expr/typecheck/digest.d.ts +7 -0
  324. package/dist/expr/typecheck/digest.d.ts.map +1 -0
  325. package/dist/expr/typecheck/digest.js +44 -0
  326. package/dist/expr/typecheck/digest.js.map +1 -0
  327. package/dist/expr/typecheck/fold.d.ts +41 -0
  328. package/dist/expr/typecheck/fold.d.ts.map +1 -0
  329. package/dist/expr/typecheck/fold.js +71 -0
  330. package/dist/expr/typecheck/fold.js.map +1 -0
  331. package/dist/expr/typecheck/gate-folds.d.ts +22 -0
  332. package/dist/expr/typecheck/gate-folds.d.ts.map +1 -0
  333. package/dist/expr/typecheck/gate-folds.js +40 -0
  334. package/dist/expr/typecheck/gate-folds.js.map +1 -0
  335. package/dist/expr/typecheck/guards.d.ts +6 -0
  336. package/dist/expr/typecheck/guards.d.ts.map +1 -0
  337. package/dist/expr/typecheck/guards.js +38 -0
  338. package/dist/expr/typecheck/guards.js.map +1 -0
  339. package/dist/expr/typecheck/member.d.ts +17 -0
  340. package/dist/expr/typecheck/member.d.ts.map +1 -0
  341. package/dist/expr/typecheck/member.js +46 -0
  342. package/dist/expr/typecheck/member.js.map +1 -0
  343. package/dist/expr/typecheck/money.d.ts +8 -0
  344. package/dist/expr/typecheck/money.d.ts.map +1 -0
  345. package/dist/expr/typecheck/money.js +49 -0
  346. package/dist/expr/typecheck/money.js.map +1 -0
  347. package/dist/expr/typecheck/numeric.d.ts +8 -0
  348. package/dist/expr/typecheck/numeric.d.ts.map +1 -0
  349. package/dist/expr/typecheck/numeric.js +84 -0
  350. package/dist/expr/typecheck/numeric.js.map +1 -0
  351. package/dist/expr/typecheck/operands.d.ts +27 -0
  352. package/dist/expr/typecheck/operands.d.ts.map +1 -0
  353. package/dist/expr/typecheck/operands.js +106 -0
  354. package/dist/expr/typecheck/operands.js.map +1 -0
  355. package/dist/expr/typecheck/paths.d.ts +21 -0
  356. package/dist/expr/typecheck/paths.d.ts.map +1 -0
  357. package/dist/expr/typecheck/paths.js +321 -0
  358. package/dist/expr/typecheck/paths.js.map +1 -0
  359. package/dist/expr/typecheck/records.d.ts +24 -0
  360. package/dist/expr/typecheck/records.d.ts.map +1 -0
  361. package/dist/expr/typecheck/records.js +53 -0
  362. package/dist/expr/typecheck/records.js.map +1 -0
  363. package/dist/expr/typecheck/sequences.d.ts +15 -0
  364. package/dist/expr/typecheck/sequences.d.ts.map +1 -0
  365. package/dist/expr/typecheck/sequences.js +55 -0
  366. package/dist/expr/typecheck/sequences.js.map +1 -0
  367. package/dist/expr/typecheck/strings.d.ts +8 -0
  368. package/dist/expr/typecheck/strings.d.ts.map +1 -0
  369. package/dist/expr/typecheck/strings.js +188 -0
  370. package/dist/expr/typecheck/strings.js.map +1 -0
  371. package/dist/expr/typecheck/temporal.d.ts +7 -0
  372. package/dist/expr/typecheck/temporal.d.ts.map +1 -0
  373. package/dist/expr/typecheck/temporal.js +80 -0
  374. package/dist/expr/typecheck/temporal.js.map +1 -0
  375. package/dist/expr/typecheck/types.d.ts +163 -0
  376. package/dist/expr/typecheck/types.d.ts.map +1 -0
  377. package/dist/expr/typecheck/types.js +404 -0
  378. package/dist/expr/typecheck/types.js.map +1 -0
  379. package/dist/expr/typecheck.d.ts +75 -0
  380. package/dist/expr/typecheck.d.ts.map +1 -0
  381. package/dist/expr/typecheck.js +242 -0
  382. package/dist/expr/typecheck.js.map +1 -0
  383. package/dist/expr/undecided.d.ts +13 -0
  384. package/dist/expr/undecided.d.ts.map +1 -0
  385. package/dist/expr/undecided.js +58 -0
  386. package/dist/expr/undecided.js.map +1 -0
  387. package/dist/expr/values/code-points.d.ts +13 -0
  388. package/dist/expr/values/code-points.d.ts.map +1 -0
  389. package/dist/expr/values/code-points.js +25 -0
  390. package/dist/expr/values/code-points.js.map +1 -0
  391. package/dist/expr/values/inline.d.ts +77 -0
  392. package/dist/expr/values/inline.d.ts.map +1 -0
  393. package/dist/expr/values/inline.js +404 -0
  394. package/dist/expr/values/inline.js.map +1 -0
  395. package/dist/expr/values/interval.d.ts +19 -0
  396. package/dist/expr/values/interval.d.ts.map +1 -0
  397. package/dist/expr/values/interval.js +1180 -0
  398. package/dist/expr/values/interval.js.map +1 -0
  399. package/dist/index.d.ts +163 -0
  400. package/dist/index.d.ts.map +1 -0
  401. package/dist/index.js +128 -0
  402. package/dist/index.js.map +1 -0
  403. package/dist/ingest/document.d.ts +58 -0
  404. package/dist/ingest/document.d.ts.map +1 -0
  405. package/dist/ingest/document.js +83 -0
  406. package/dist/ingest/document.js.map +1 -0
  407. package/dist/ingest/yaml-document.d.ts +15 -0
  408. package/dist/ingest/yaml-document.d.ts.map +1 -0
  409. package/dist/ingest/yaml-document.js +42 -0
  410. package/dist/ingest/yaml-document.js.map +1 -0
  411. package/dist/ingest/yaml.d.ts +51 -0
  412. package/dist/ingest/yaml.d.ts.map +1 -0
  413. package/dist/ingest/yaml.js +340 -0
  414. package/dist/ingest/yaml.js.map +1 -0
  415. package/dist/layout/compile.d.ts +6 -0
  416. package/dist/layout/compile.d.ts.map +1 -0
  417. package/dist/layout/compile.js +224 -0
  418. package/dist/layout/compile.js.map +1 -0
  419. package/dist/layout/context.d.ts +12 -0
  420. package/dist/layout/context.d.ts.map +1 -0
  421. package/dist/layout/context.js +26 -0
  422. package/dist/layout/context.js.map +1 -0
  423. package/dist/layout/grammar.d.ts +34 -0
  424. package/dist/layout/grammar.d.ts.map +1 -0
  425. package/dist/layout/grammar.js +171 -0
  426. package/dist/layout/grammar.js.map +1 -0
  427. package/dist/layout/read.d.ts +54 -0
  428. package/dist/layout/read.d.ts.map +1 -0
  429. package/dist/layout/read.js +101 -0
  430. package/dist/layout/read.js.map +1 -0
  431. package/dist/layout/shape.d.ts +34 -0
  432. package/dist/layout/shape.d.ts.map +1 -0
  433. package/dist/layout/shape.js +149 -0
  434. package/dist/layout/shape.js.map +1 -0
  435. package/dist/messages/compile.d.ts +47 -0
  436. package/dist/messages/compile.d.ts.map +1 -0
  437. package/dist/messages/compile.js +202 -0
  438. package/dist/messages/compile.js.map +1 -0
  439. package/dist/messages/locale.d.ts +18 -0
  440. package/dist/messages/locale.d.ts.map +1 -0
  441. package/dist/messages/locale.js +33 -0
  442. package/dist/messages/locale.js.map +1 -0
  443. package/dist/messages/slots.d.ts +54 -0
  444. package/dist/messages/slots.d.ts.map +1 -0
  445. package/dist/messages/slots.js +137 -0
  446. package/dist/messages/slots.js.map +1 -0
  447. package/dist/overlay/compile-overlay.d.ts +29 -0
  448. package/dist/overlay/compile-overlay.d.ts.map +1 -0
  449. package/dist/overlay/compile-overlay.js +120 -0
  450. package/dist/overlay/compile-overlay.js.map +1 -0
  451. package/dist/overlay/compose.d.ts +26 -0
  452. package/dist/overlay/compose.d.ts.map +1 -0
  453. package/dist/overlay/compose.js +674 -0
  454. package/dist/overlay/compose.js.map +1 -0
  455. package/dist/overlay/types.d.ts +41 -0
  456. package/dist/overlay/types.d.ts.map +1 -0
  457. package/dist/overlay/types.js +2 -0
  458. package/dist/overlay/types.js.map +1 -0
  459. package/dist/publish/classify.d.ts +50 -0
  460. package/dist/publish/classify.d.ts.map +1 -0
  461. package/dist/publish/classify.js +85 -0
  462. package/dist/publish/classify.js.map +1 -0
  463. package/dist/publish/environment.d.ts +15 -0
  464. package/dist/publish/environment.d.ts.map +1 -0
  465. package/dist/publish/environment.js +2 -0
  466. package/dist/publish/environment.js.map +1 -0
  467. package/dist/publish/migrations.d.ts +108 -0
  468. package/dist/publish/migrations.d.ts.map +1 -0
  469. package/dist/publish/migrations.js +166 -0
  470. package/dist/publish/migrations.js.map +1 -0
  471. package/dist/publish/observation.d.ts +29 -0
  472. package/dist/publish/observation.d.ts.map +1 -0
  473. package/dist/publish/observation.js +43 -0
  474. package/dist/publish/observation.js.map +1 -0
  475. package/dist/publish/readiness.d.ts +197 -0
  476. package/dist/publish/readiness.d.ts.map +1 -0
  477. package/dist/publish/readiness.js +239 -0
  478. package/dist/publish/readiness.js.map +1 -0
  479. package/dist/publish/vectors.d.ts +50 -0
  480. package/dist/publish/vectors.d.ts.map +1 -0
  481. package/dist/publish/vectors.js +306 -0
  482. package/dist/publish/vectors.js.map +1 -0
  483. package/dist/publish/verify.d.ts +146 -0
  484. package/dist/publish/verify.d.ts.map +1 -0
  485. package/dist/publish/verify.js +548 -0
  486. package/dist/publish/verify.js.map +1 -0
  487. package/dist/scenarios/branch.d.ts +36 -0
  488. package/dist/scenarios/branch.d.ts.map +1 -0
  489. package/dist/scenarios/branch.js +30 -0
  490. package/dist/scenarios/branch.js.map +1 -0
  491. package/dist/scenarios/capture.d.ts +89 -0
  492. package/dist/scenarios/capture.d.ts.map +1 -0
  493. package/dist/scenarios/capture.js +443 -0
  494. package/dist/scenarios/capture.js.map +1 -0
  495. package/dist/scenarios/classifier.d.ts +20 -0
  496. package/dist/scenarios/classifier.d.ts.map +1 -0
  497. package/dist/scenarios/classifier.js +88 -0
  498. package/dist/scenarios/classifier.js.map +1 -0
  499. package/dist/scenarios/credit.d.ts +33 -0
  500. package/dist/scenarios/credit.d.ts.map +1 -0
  501. package/dist/scenarios/credit.js +330 -0
  502. package/dist/scenarios/credit.js.map +1 -0
  503. package/dist/scenarios/csv.d.ts +34 -0
  504. package/dist/scenarios/csv.d.ts.map +1 -0
  505. package/dist/scenarios/csv.js +1047 -0
  506. package/dist/scenarios/csv.js.map +1 -0
  507. package/dist/scenarios/data-identity.d.ts +39 -0
  508. package/dist/scenarios/data-identity.d.ts.map +1 -0
  509. package/dist/scenarios/data-identity.js +28 -0
  510. package/dist/scenarios/data-identity.js.map +1 -0
  511. package/dist/scenarios/document.d.ts +148 -0
  512. package/dist/scenarios/document.d.ts.map +1 -0
  513. package/dist/scenarios/document.js +513 -0
  514. package/dist/scenarios/document.js.map +1 -0
  515. package/dist/scenarios/environment.d.ts +64 -0
  516. package/dist/scenarios/environment.d.ts.map +1 -0
  517. package/dist/scenarios/environment.js +106 -0
  518. package/dist/scenarios/environment.js.map +1 -0
  519. package/dist/scenarios/evidence.d.ts +128 -0
  520. package/dist/scenarios/evidence.d.ts.map +1 -0
  521. package/dist/scenarios/evidence.js +179 -0
  522. package/dist/scenarios/evidence.js.map +1 -0
  523. package/dist/scenarios/expectations.d.ts +63 -0
  524. package/dist/scenarios/expectations.d.ts.map +1 -0
  525. package/dist/scenarios/expectations.js +490 -0
  526. package/dist/scenarios/expectations.js.map +1 -0
  527. package/dist/scenarios/references.d.ts +15 -0
  528. package/dist/scenarios/references.d.ts.map +1 -0
  529. package/dist/scenarios/references.js +239 -0
  530. package/dist/scenarios/references.js.map +1 -0
  531. package/dist/scenarios/report.d.ts +216 -0
  532. package/dist/scenarios/report.d.ts.map +1 -0
  533. package/dist/scenarios/report.js +54 -0
  534. package/dist/scenarios/report.js.map +1 -0
  535. package/dist/scenarios/runner.d.ts +55 -0
  536. package/dist/scenarios/runner.d.ts.map +1 -0
  537. package/dist/scenarios/runner.js +205 -0
  538. package/dist/scenarios/runner.js.map +1 -0
  539. package/dist/scenarios/vocabulary.d.ts +19 -0
  540. package/dist/scenarios/vocabulary.d.ts.map +1 -0
  541. package/dist/scenarios/vocabulary.js +56 -0
  542. package/dist/scenarios/vocabulary.js.map +1 -0
  543. package/dist/schema/catalogue.d.ts +54 -0
  544. package/dist/schema/catalogue.d.ts.map +1 -0
  545. package/dist/schema/catalogue.js +221 -0
  546. package/dist/schema/catalogue.js.map +1 -0
  547. package/dist/schema/check.d.ts +22 -0
  548. package/dist/schema/check.d.ts.map +1 -0
  549. package/dist/schema/check.js +30 -0
  550. package/dist/schema/check.js.map +1 -0
  551. package/dist/schema/closed.d.ts +19 -0
  552. package/dist/schema/closed.d.ts.map +1 -0
  553. package/dist/schema/closed.js +33 -0
  554. package/dist/schema/closed.js.map +1 -0
  555. package/dist/schema/collapse.d.ts +27 -0
  556. package/dist/schema/collapse.d.ts.map +1 -0
  557. package/dist/schema/collapse.js +143 -0
  558. package/dist/schema/collapse.js.map +1 -0
  559. package/dist/schema/controls.d.ts +46 -0
  560. package/dist/schema/controls.d.ts.map +1 -0
  561. package/dist/schema/controls.js +75 -0
  562. package/dist/schema/controls.js.map +1 -0
  563. package/dist/schema/dataset-declaration.d.ts +11 -0
  564. package/dist/schema/dataset-declaration.d.ts.map +1 -0
  565. package/dist/schema/dataset-declaration.js +11 -0
  566. package/dist/schema/dataset-declaration.js.map +1 -0
  567. package/dist/schema/declaration-warnings.d.ts +14 -0
  568. package/dist/schema/declaration-warnings.d.ts.map +1 -0
  569. package/dist/schema/declaration-warnings.js +77 -0
  570. package/dist/schema/declaration-warnings.js.map +1 -0
  571. package/dist/schema/declarations.d.ts +41 -0
  572. package/dist/schema/declarations.d.ts.map +1 -0
  573. package/dist/schema/declarations.js +1299 -0
  574. package/dist/schema/declarations.js.map +1 -0
  575. package/dist/schema/diagnostic.d.ts +118 -0
  576. package/dist/schema/diagnostic.d.ts.map +1 -0
  577. package/dist/schema/diagnostic.js +39 -0
  578. package/dist/schema/diagnostic.js.map +1 -0
  579. package/dist/schema/document.d.ts +93 -0
  580. package/dist/schema/document.d.ts.map +1 -0
  581. package/dist/schema/document.js +507 -0
  582. package/dist/schema/document.js.map +1 -0
  583. package/dist/schema/fields.d.ts +11 -0
  584. package/dist/schema/fields.d.ts.map +1 -0
  585. package/dist/schema/fields.js +265 -0
  586. package/dist/schema/fields.js.map +1 -0
  587. package/dist/schema/gates.d.ts +4 -0
  588. package/dist/schema/gates.d.ts.map +1 -0
  589. package/dist/schema/gates.js +68 -0
  590. package/dist/schema/gates.js.map +1 -0
  591. package/dist/schema/located.d.ts +27 -0
  592. package/dist/schema/located.d.ts.map +1 -0
  593. package/dist/schema/located.js +56 -0
  594. package/dist/schema/located.js.map +1 -0
  595. package/dist/schema/measurement.d.ts +9 -0
  596. package/dist/schema/measurement.d.ts.map +1 -0
  597. package/dist/schema/measurement.js +38 -0
  598. package/dist/schema/measurement.js.map +1 -0
  599. package/dist/schema/member-wording.d.ts +35 -0
  600. package/dist/schema/member-wording.d.ts.map +1 -0
  601. package/dist/schema/member-wording.js +286 -0
  602. package/dist/schema/member-wording.js.map +1 -0
  603. package/dist/schema/metaschema.d.ts +20 -0
  604. package/dist/schema/metaschema.d.ts.map +1 -0
  605. package/dist/schema/metaschema.js +476 -0
  606. package/dist/schema/metaschema.js.map +1 -0
  607. package/dist/schema/pointer.d.ts +31 -0
  608. package/dist/schema/pointer.d.ts.map +1 -0
  609. package/dist/schema/pointer.js +73 -0
  610. package/dist/schema/pointer.js.map +1 -0
  611. package/dist/schema/primary.d.ts +29 -0
  612. package/dist/schema/primary.d.ts.map +1 -0
  613. package/dist/schema/primary.js +48 -0
  614. package/dist/schema/primary.js.map +1 -0
  615. package/dist/schema/publish-vector.d.ts +17 -0
  616. package/dist/schema/publish-vector.d.ts.map +1 -0
  617. package/dist/schema/publish-vector.js +34 -0
  618. package/dist/schema/publish-vector.js.map +1 -0
  619. package/dist/schema/repair.d.ts +34 -0
  620. package/dist/schema/repair.d.ts.map +1 -0
  621. package/dist/schema/repair.js +163 -0
  622. package/dist/schema/repair.js.map +1 -0
  623. package/dist/schema/schema-v1.generated.d.ts +14 -0
  624. package/dist/schema/schema-v1.generated.d.ts.map +1 -0
  625. package/dist/schema/schema-v1.generated.js +7089 -0
  626. package/dist/schema/schema-v1.generated.js.map +1 -0
  627. package/dist/schema/screens.d.ts +4 -0
  628. package/dist/schema/screens.d.ts.map +1 -0
  629. package/dist/schema/screens.js +28 -0
  630. package/dist/schema/screens.js.map +1 -0
  631. package/dist/schema/test-values.d.ts +12 -0
  632. package/dist/schema/test-values.d.ts.map +1 -0
  633. package/dist/schema/test-values.js +97 -0
  634. package/dist/schema/test-values.js.map +1 -0
  635. package/dist/schema/unions.d.ts +46 -0
  636. package/dist/schema/unions.d.ts.map +1 -0
  637. package/dist/schema/unions.js +131 -0
  638. package/dist/schema/unions.js.map +1 -0
  639. package/dist/schema/validate-yaml.d.ts +14 -0
  640. package/dist/schema/validate-yaml.d.ts.map +1 -0
  641. package/dist/schema/validate-yaml.js +17 -0
  642. package/dist/schema/validate-yaml.js.map +1 -0
  643. package/dist/schema/validate.d.ts +46 -0
  644. package/dist/schema/validate.d.ts.map +1 -0
  645. package/dist/schema/validate.js +186 -0
  646. package/dist/schema/validate.js.map +1 -0
  647. package/dist/testing.d.ts +21 -0
  648. package/dist/testing.d.ts.map +1 -0
  649. package/dist/testing.js +28 -0
  650. package/dist/testing.js.map +1 -0
  651. package/dist/vocabulary.d.ts +6 -0
  652. package/dist/vocabulary.d.ts.map +1 -0
  653. package/dist/vocabulary.js +26 -0
  654. package/dist/vocabulary.js.map +1 -0
  655. package/package.json +66 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestions.js","sourceRoot":"","sources":["../../src/compile/suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,QAAQ,EACR,WAAW,EACX,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAUlD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AA+C1E,+EAA+E;AAC/E,MAAM,WAAW,GAAG,SAAS,CAAC;AAiB9B,SAAS,UAAU,CAAC,OAAe,EAAE,MAAmC;IACtE,4FAA4F;IAC5F,8CAA8C;IAC9C,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;AACnF,CAAC;AAED,sGAAsG;AACtG,SAAS,YAAY,CACnB,MAAmC,EACnC,OAAwB;IAExB,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,MAAM,KAAK,SAAS;QAAE,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QACnD,IAAI,kBAAkB,GAAG,KAAK,CAAC;QAC/B,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE;YAC/C,MAAM,IAAI,GAAkB;gBAC1B,EAAE,EAAE,GAAG,EAAE,IAAI,MAAM,CAAC,eAAe,CAAC,gBAAgB,MAAM,CAAC,cAAc,CAAC,GAAG;gBAC7E,OAAO;aACR,CAAC;YACF,MAAM,KAAK,GAAG,gBAAgB,CAC5B,WAAW,EACX,SAAS,EACT,IAAI,EACJ,KAAK,EACL,MAAM,EACN,cAAc,EACd,KAAK,CACN,CAAC;YACF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,kBAAkB,GAAG,IAAI,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QACH,IAAI,kBAAkB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChD,OAAO,GAAG,IAAI,CAAC;YACf,OAAO;QACT,CAAC;QACD,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AACtD,CAAC","sourcesContent":["import {\n assertNever,\n canonicalizeRestricted,\n isRecord,\n rowKeyToken,\n rowKeyValue,\n} from '@azx-pbc/axiom-runtime';\nimport { indefiniteArticle } from '../article.js';\nimport type {\n CompiledField,\n CompiledSuggestion,\n CompiledSuggestionOperation,\n ExprNode,\n ListNode,\n Primitive,\n SuggestedRef,\n} from '@azx-pbc/axiom-runtime';\nimport { constantOf } from '../expr/lint.js';\nimport { closestNames } from '../expr/suggest.js';\nimport type { Compilation } from './compilation.js';\nimport { refuse } from './compilation.js';\nimport { textAt } from './document.js';\nimport { compileExpressionSlot } from './expression.js';\nimport { crossCheckWriterLiteral } from './option-codes.js';\nimport { isArrayElementTarget, rejectTargetMismatch } from './targets.js';\n\n/**\n * The alternatives a declaration offers, compiled once for every owner that can carry them.\n *\n * A `validate` rule states them on the rule (`RULES-6.1.1`); a declared option states them beside\n * its availability, where they are evaluated only for the code the record holds and only while\n * that code is unavailable (`RULES-7.1.4`). The operations, the refusals and the compiled shape\n * are one contract for both, so they are parsed here and nowhere else: a second walk would let\n * one owner admit an operation the other refuses.\n *\n * The author writes the operations as they write a rule's expression, and the artifact carries\n * data. Every `value` expression compiles through the same slot the rule's own expression does,\n * so it is typed against the document's declarations and reaches the same cross-checks (option\n * codes, signature coverage, the gate-only built-ins). A `labelKey` is presentation, and the\n * message-slot table already holds both owners' label keys to the catalogue.\n */\n\n/** The declaration offering alternatives, so a refusal can name it and a row can be resolved. */\nexport interface SuggestionOwner {\n /** How a refusal names the owner: ``rule `r_check` `` or ``option `gold` of field `f_plan` ``. */\n readonly description: string;\n /**\n * The array whose row the owner judges, when it judges one: an `item`-scoped rule's array, or\n * the array a field with a declared option sits inside. The reserved `current` row key names a\n * row of this array, and a write to a row member of another array has to state its own key.\n */\n readonly itemFieldId?: string;\n}\n\n/** One expression the alternatives carry, so the caller's cross-checks see it. */\ninterface SuggestionSlot {\n readonly path: string;\n readonly node: ExprNode;\n}\n\n/** One compiled suggestion list, and the expression slots it contributes. */\nexport interface CompiledSuggestions {\n /**\n * The alternatives in the order the author wrote them, or `undefined` when the owner declared\n * none or one of them was refused. A document without alternatives states no member, so its\n * artifact bytes and its `ruleHash` are what they were before alternatives existed.\n */\n readonly suggestions?: readonly CompiledSuggestion[];\n readonly slots: readonly SuggestionSlot[];\n}\n\n/** The reserved row key that names the row the owner judged, `RULES-6.1.2`. */\nconst CURRENT_ROW = 'current';\n\n/** A declared binding one alternative writes: a field, and the row when the field sits in one. */\ninterface ResolvedBinding {\n readonly field: CompiledField;\n readonly rowKey?: string | number;\n /** The identity two operations of one alternative may not share. */\n readonly key: string;\n}\n\n/** Where one operation lives, so a refusal names the member the author can repair. */\ninterface OperationSite {\n readonly at: string;\n /** How a refusal names the alternative: `alternative 1 of rule \\`r_check\\``. */\n readonly subject: string;\n}\n\nfunction bindingKey(fieldId: string, rowKey: string | number | undefined): string {\n // The token carries the key's wire type, so the integer `7` and the text `\"7\"` are two rows\n // and therefore two bindings rather than one.\n return rowKey === undefined ? fieldId : `${fieldId}\\u0000${rowKeyToken(rowKey)}`;\n}\n\n/** The earlier write this binding collides with, including a literal key the current row can hold. */\nfunction earlierClaim(\n claims: ReadonlyMap<string, number>,\n binding: ResolvedBinding,\n): number | undefined {\n const direct = claims.get(binding.key);\n if (direct !== undefined) return direct;\n if (binding.rowKey === undefined) return undefined;\n const fieldId = binding.field.fieldId;\n if (binding.rowKey !== CURRENT_ROW) return claims.get(bindingKey(fieldId, CURRENT_ROW));\n // `current` resolves separately for each failing row, so no literal key on that field is\n // provably disjoint from it. Two such writes would collide on the row carrying that key.\n for (const [key, operationIndex] of claims) {\n if (key.startsWith(`${fieldId}\\u0000`)) return operationIndex;\n }\n return undefined;\n}\n\n/** The prose a refusal uses for one binding: the field, and the row when there is one. */\nfunction describeBinding(binding: ResolvedBinding): string {\n if (binding.rowKey === undefined) return `field \\`${binding.field.fieldId}\\``;\n // The wire label keeps the integer `7` and the text `\"7\"` apart, because they are two rows.\n const row =\n binding.rowKey === CURRENT_ROW\n ? 'the `current` row'\n : `row \\`${rowKeyWireLabel(binding.rowKey)}\\``;\n return `${row} of field \\`${binding.field.fieldId}\\``;\n}\n\n/** The value a binding must preserve so its row remains addressable. */\ninterface RowIdentity {\n readonly fieldId: string;\n readonly description: string;\n}\n\n/** The natural key or item value whose write can destroy this binding's row identity. */\nfunction rowIdentityOf(\n compilation: Compilation,\n binding: ResolvedBinding,\n): RowIdentity | undefined {\n const fieldId = binding.field.fieldId;\n const container = compilation.rowContainers.get(fieldId);\n const rowKey =\n container === undefined ? undefined : compilation.fieldsById.get(container)?.rowKey;\n if (rowKey?.mode === 'natural' && rowKey.fieldId === fieldId) {\n return { fieldId, description: `natural key \\`${fieldId}\\`` };\n }\n if (\n isArrayElementTarget(compilation, binding.field, binding.rowKey) &&\n binding.field.rowKey === undefined\n ) {\n return { fieldId, description: `value-identified row of \\`${fieldId}\\`` };\n }\n return undefined;\n}\n\n/** A write that would leave a row without an addressable identity. */\nfunction refuseRowIdentityValue(\n compilation: Compilation,\n path: string,\n subject: string,\n identity: RowIdentity,\n action: string,\n): undefined {\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n path,\n `${subject} ${action} ${identity.description}; a row key must be a non-empty string or a safe integer so the row remains addressable, so state a valid key value`,\n { repairStated: true },\n );\n return undefined;\n}\n\n/** The compiled ref a `value`, `null` or `remove` operation writes. */\nfunction refOf(binding: ResolvedBinding): SuggestedRef {\n return binding.rowKey === undefined\n ? { fieldId: binding.field.fieldId }\n : { fieldId: binding.field.fieldId, rowKey: binding.rowKey };\n}\n\n/** The nearest declared names, as the suggestion a refused identifier offers. */\nfunction nearestNames(name: string, candidates: Iterable<string>): readonly string[] {\n return closestNames(name, [...candidates]);\n}\n\n/** The clause a refused identifier's detail ends with, offering what the document does declare. */\nfunction didYouMean(name: string, candidates: readonly string[]): string {\n return candidates.length === 0 ? '' : `; did you mean ${candidates.join(' or ')}?`;\n}\n\n/**\n * The refusal metadata an identifier carries: the nearest declared names, when any is close.\n *\n * A detail that already asked `did you mean …` must carry the same names structurally, so an\n * editor offers the repair the sentence states rather than parsing English.\n */\nfunction nearestExtra(nearest: readonly string[]): { readonly suggestions?: readonly string[] } {\n return nearest.length === 0 ? {} : { suggestions: nearest };\n}\n\n/** The wire type a row key states, so a refusal cannot confuse the integer `7` with `\"7\"`. */\nfunction rowKeyWireLabel(rowKey: string | number): string {\n return `${typeof rowKey} ${JSON.stringify(rowKey)}`;\n}\n\n/** The wire types a row key can carry; the session addresses no row by any other value. */\ntype RowKeyWireType = 'string' | 'integer';\n\n/** The key domain one array declares, or why a declared primitive supplies no key at all. */\ntype RowKeyDomain =\n | {\n readonly outcome: 'scalar';\n readonly wireType: RowKeyWireType;\n /** How a refusal names where the domain comes from. */\n readonly source: string;\n }\n | {\n readonly outcome: 'unaddressable';\n /** How a refusal names where the declared primitive comes from. */\n readonly source: string;\n /** The repair an author can act on: replace the array or declare a scalar key. */\n readonly repair: string;\n };\n\n/**\n * The row-key wire type a declared primitive produces, or `undefined` when it produces none.\n *\n * A value-identified row's key is the item value itself and a natural key's key is its member's\n * value, so the primitive's wire form decides it: every text-shaped primitive is a string key and\n * `integer` is a numeric one. A record-shaped primitive (`money`, `quantity`, `duration`,\n * `address`, `coordinate`, `media_ref`, `signature_ref`, `timeslot`, `record`, `array`) and\n * `boolean` carry no scalar value, so no literal key addresses one of their rows.\n */\nfunction rowKeyWireTypeOf(primitive: Primitive): RowKeyWireType | undefined {\n switch (primitive) {\n case 'integer':\n return 'integer';\n case 'string':\n case 'date':\n case 'decimal':\n case 'instant':\n case 'time':\n return 'string';\n case 'boolean':\n case 'money':\n case 'quantity':\n case 'duration':\n case 'address':\n case 'coordinate':\n case 'media_ref':\n case 'signature_ref':\n case 'timeslot':\n case 'record':\n case 'array':\n return undefined;\n }\n}\n\n/**\n * The key domain one array declares, and how a refusal names where the domain comes from.\n *\n * A natural-keyed record array takes the wire type of its declared key member; a value-identified\n * scalar array takes its item domain, because the item value is the row's identity. An array that\n * states neither has no literal-key domain to check.\n */\nfunction rowKeyDomainOf(array: CompiledField): RowKeyDomain | undefined {\n const rowKey = array.rowKey;\n if (rowKey?.mode === 'natural') {\n const member = (array.fields ?? []).find((field) => field.fieldId === rowKey.fieldId);\n if (member === undefined) return undefined;\n const article = indefiniteArticle(member.primitive);\n const source = `whose natural key \\`${member.fieldId}\\` is ${article} \\`${member.primitive}\\``;\n const wireType = rowKeyWireTypeOf(member.primitive);\n return wireType === undefined\n ? {\n outcome: 'unaddressable',\n source,\n repair: `${article} \\`${member.primitive}\\` value carries no scalar key, so declare a \\`string\\` or \\`integer\\` member as the key, or declare the array with a \\`rowKey\\` the session assigns`,\n }\n : { outcome: 'scalar', wireType, source };\n }\n if (rowKey === undefined && array.items !== undefined) {\n const primitive = array.items.primitive;\n const source = `whose item domain is \\`${primitive}\\``;\n const wireType = rowKeyWireTypeOf(primitive);\n return wireType === undefined\n ? {\n outcome: 'unaddressable',\n source,\n repair: `a \\`${primitive}\\` item carries no scalar value a row key can name, so declare the array with a \\`rowKey\\` the session assigns, or choose an array whose items are \\`string\\` or \\`integer\\``,\n }\n : { outcome: 'scalar', wireType, source };\n }\n return undefined;\n}\n\n/** Whether a literal row key's wire type is the one the array's key domain declares. */\nfunction rowKeyFitsWireType(rowKey: string | number, wireType: RowKeyWireType): boolean {\n return wireType === 'integer' ? typeof rowKey === 'number' : typeof rowKey === 'string';\n}\n\n/** Refuse a literal row key whose wire type the array's key domain cannot hold. */\nfunction refuseRowKeyDomain(\n compilation: Compilation,\n array: CompiledField,\n rowKey: string | number,\n site: OperationSite,\n): boolean {\n const domain = rowKeyDomainOf(array);\n if (domain === undefined) return false;\n const names = `${site.subject} names row key \\`${rowKeyWireLabel(rowKey)}\\` in array \\`${array.fieldId}\\`, ${domain.source}`;\n if (domain.outcome === 'unaddressable') {\n refuse(compilation, 'INVALID_ROW_KEY', `${site.at}.rowKey`, `${names}; ${domain.repair}`, {\n repairStated: true,\n });\n return true;\n }\n if (rowKeyFitsWireType(rowKey, domain.wireType)) return false;\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n `${site.at}.rowKey`,\n `${names}; a row key is never coerced, so state the key as ${\n domain.wireType === 'string' ? 'a non-empty string' : 'a safe integer'\n }`,\n { expected: domain.wireType, repairStated: true },\n );\n return true;\n}\n\n/**\n * Whether a whole-array literal write states rows the runtime could not address.\n *\n * A value-identified array identifies each row by the item value itself and holds each item once;\n * a natural-keyed row is identified by its key member, which must be a key and appear once. A\n * literal that breaks any of those rules is a row the session refuses (`IDENTITY_UNSUPPORTED`,\n * `ROW_KEY_DUPLICATE`), so the compile refuses it here and names the value the author can repair.\n */\nfunction refuseLiteralArrayIdentity(\n compilation: Compilation,\n array: CompiledField,\n node: ListNode,\n path: string,\n subject: string,\n): boolean {\n if (array.rowKey === undefined && array.items !== undefined) {\n const seen = new Set<string>();\n for (const item of node.items) {\n if (item.kind !== 'literal') continue;\n // The key is the item's own wire value, so it is read with the predicate the session reads\n // before the value is canonicalised: a null or empty item names no row at all.\n const key = rowKeyValue(item.value);\n if (key === undefined) {\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n path,\n `${subject} writes array \\`${array.fieldId}\\` with a literal item that is not a row key; a value-identified array identifies each row by its own value, and that value must be a non-empty string or a safe integer, so state such a value for that row`,\n { repairStated: true },\n );\n return true;\n }\n const token = rowKeyToken(key);\n if (seen.has(token)) {\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n path,\n `${subject} writes array \\`${array.fieldId}\\` with a literal that states \\`${canonicalizeRestricted(key)}\\` more than once; a value-identified array holds each value at most once, so state each value once`,\n { repairStated: true },\n );\n return true;\n }\n seen.add(token);\n }\n }\n const naturalKey = array.rowKey?.mode === 'natural' ? array.rowKey.fieldId : undefined;\n if (naturalKey !== undefined) {\n const seen = new Set<string>();\n for (const item of node.items) {\n if (item.kind !== 'literal' || !isRecord(item.value)) continue;\n if (!Object.hasOwn(item.value, naturalKey)) {\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n path,\n `${subject} writes array \\`${array.fieldId}\\` with a literal row that omits its declared natural key \\`${naturalKey}\\`; a row is identified by that member, so state \\`\"${naturalKey}\": <value>\\` in that row`,\n { repairStated: true },\n );\n return true;\n }\n const key = rowKeyValue(item.value[naturalKey]);\n if (key === undefined) {\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n path,\n `${subject} writes array \\`${array.fieldId}\\` with a literal row whose natural key \\`${naturalKey}\\` is not a row key; a row is identified by that member, and it must be a non-empty string or a safe integer, so state such a value in \\`\"${naturalKey}\"\\``,\n { repairStated: true },\n );\n return true;\n }\n const token = rowKeyToken(key);\n if (seen.has(token)) {\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n path,\n `${subject} writes array \\`${array.fieldId}\\` with two literal rows that share the natural key \\`${canonicalizeRestricted(key)}\\`; a row is identified by that member, so state each key once`,\n { repairStated: true },\n );\n return true;\n }\n seen.add(token);\n }\n }\n return false;\n}\n\n/**\n * One declared binding, narrowed from the operation's `ref` and refused where it is not one a\n * write can address.\n *\n * A `signature_ref` is a captured value rather than one a record supplies, a value a `compute`\n * writer owns is produced by that writer, and a member of an array has no value of its own until\n * a row is named. Each is a write the host could only refuse, so the artifact never states it.\n */\nfunction resolveBinding(\n compilation: Compilation,\n authored: unknown,\n site: OperationSite,\n owner: SuggestionOwner,\n): ResolvedBinding | undefined {\n if (!isRecord(authored)) return undefined;\n const fieldId = textAt(authored, 'fieldId');\n if (fieldId === undefined) return undefined;\n const fieldAt = `${site.at}.fieldId`;\n const field = compilation.fieldsById.get(fieldId);\n if (field === undefined) {\n const nearest = nearestNames(fieldId, compilation.fieldsById.keys());\n refuse(\n compilation,\n 'UNKNOWN_IDENTIFIER',\n fieldAt,\n `${site.subject} writes field \\`${fieldId}\\`, which this document does not declare${didYouMean(fieldId, nearest)}; name a declared \\`fieldId\\`, or add the field first`,\n nearestExtra(nearest),\n );\n return undefined;\n }\n const writer = compilation.computed.writers.get(fieldId);\n if (writer !== undefined) {\n refuse(\n compilation,\n 'DUPLICATE_WRITER',\n fieldAt,\n `${site.subject} writes field \\`${fieldId}\\`, which rule \\`${writer.ruleId}\\` produces as a \\`${writer.kind}\\` value; a computed field has one writer, so name a field the record supplies, or remove that ${\n writer.kind === 'defaultCompute' ? 'default' : 'computation'\n }`,\n { repairStated: true },\n );\n return undefined;\n }\n if (field.primitive === 'signature_ref') {\n refuse(\n compilation,\n 'SCHEMA_INVALID',\n fieldAt,\n `${site.subject} writes field \\`${fieldId}\\`, which is a \\`signature_ref\\`; a signature is captured by the person who signs and never assigned, so name a field the record supplies`,\n { repairStated: true },\n );\n return undefined;\n }\n const container = compilation.rowContainers.get(fieldId);\n // A scalar array is itself the container when one of its elements is addressed. Its `items`\n // declaration supplies the element's type; a record array's members instead name their own\n // enclosing array through `rowContainers`.\n const elementContainer =\n field.primitive === 'array' && field.items !== undefined ? field.fieldId : undefined;\n const rowContainer = container ?? elementContainer;\n // A row of an array that is itself a row member needs two keys to address, and a binding carries\n // one. v1 addresses no row of a nested array, so the write would name a row no host can find.\n const outer = container === undefined ? undefined : compilation.rowContainers.get(container);\n if (container !== undefined && outer !== undefined) {\n refuse(\n compilation,\n 'INVALID_RULE_SCOPE',\n fieldAt,\n `${site.subject} writes field \\`${fieldId}\\`, a member of array \\`${container}\\`, which sits inside a row of array \\`${outer}\\`; v1 addresses no row of a nested array, so name a value the record holds once or a member of a top-level array's row`,\n { repairStated: true },\n );\n return undefined;\n }\n const rowKey = authored['rowKey'];\n if (rowKey === undefined) {\n if (container === undefined) return { field, key: fieldId };\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n fieldAt,\n `${site.subject} writes field \\`${fieldId}\\`, a member of array \\`${container}\\`; a member holds one value per row, so state the row in \\`rowKey\\`, or name the value the record holds once`,\n { repairStated: true },\n );\n return undefined;\n }\n if (rowContainer === undefined) {\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n `${site.at}.rowKey`,\n `${site.subject} writes field \\`${fieldId}\\` with a \\`rowKey\\`, and \\`${fieldId}\\` sits inside no array; a value the record holds once belongs to no row, so remove \\`rowKey\\``,\n { repairStated: true },\n );\n return undefined;\n }\n if (rowKey === CURRENT_ROW) {\n // An item-scoped owner on a nested array is refused by `itemScopeDiagnostics`, and an option\n // on a nested member is refused by `compileOption` before this walk, so no reachable owner\n // reaches `current` for a nested row. The two branches below own every case that can.\n if (owner.itemFieldId === undefined) {\n refuse(\n compilation,\n 'INVALID_RULE_SCOPE',\n `${site.at}.rowKey`,\n `${site.subject} names the \\`current\\` row, which is the row an \\`item\\`-scoped owner judged, and ${owner.description} addresses no row; state the row's literal key, or address the array \\`${rowContainer}\\` at \\`item\\` scope`,\n { repairStated: true },\n );\n return undefined;\n }\n if (owner.itemFieldId !== rowContainer) {\n refuse(\n compilation,\n 'INVALID_RULE_SCOPE',\n `${site.at}.rowKey`,\n `${site.subject} names the \\`current\\` row, which is a row of array \\`${owner.itemFieldId}\\`, and \\`${fieldId}\\` is a member of array \\`${rowContainer}\\`; state the row's literal key, or write a member of \\`${owner.itemFieldId}\\``,\n { repairStated: true },\n );\n return undefined;\n }\n return { field, rowKey: CURRENT_ROW, key: bindingKey(fieldId, CURRENT_ROW) };\n }\n if (typeof rowKey !== 'string' && typeof rowKey !== 'number') return undefined;\n // An assigned key is produced by the session's `idFactory`, so no literal the author can write\n // names one of its rows; the symbolic row is the only spelling that resolves.\n if (compilation.fieldsById.get(rowContainer)?.rowKey?.mode === 'assigned') {\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n `${site.at}.rowKey`,\n `${site.subject} writes row \\`${String(rowKey)}\\` of field \\`${fieldId}\\`, whose array \\`${rowContainer}\\` assigns its row keys at run time; the artifact cannot name a key the session creates, so write the \\`current\\` row from an \\`item\\`-scoped owner on \\`${rowContainer}\\``,\n { repairStated: true },\n );\n return undefined;\n }\n const rowArray = compilation.fieldsById.get(rowContainer);\n if (rowArray !== undefined && refuseRowKeyDomain(compilation, rowArray, rowKey, site)) {\n return undefined;\n }\n return { field, rowKey, key: bindingKey(fieldId, rowKey) };\n}\n\n/**\n * One array an `append` or `removeRow` operation names, refused where the named field is not an\n * array whose rows a write can address.\n */\nfunction resolveArray(\n compilation: Compilation,\n authored: Record<string, unknown>,\n site: OperationSite,\n): CompiledField | undefined {\n const fieldId = textAt(authored, 'fieldId');\n if (fieldId === undefined) return undefined;\n const fieldAt = `${site.at}.fieldId`;\n const field = compilation.fieldsById.get(fieldId);\n if (field === undefined) {\n const nearest = nearestNames(fieldId, compilation.fieldsById.keys());\n refuse(\n compilation,\n 'UNKNOWN_IDENTIFIER',\n fieldAt,\n `${site.subject} names array \\`${fieldId}\\`, which this document does not declare${didYouMean(fieldId, nearest)}; name a declared \\`array\\` field`,\n nearestExtra(nearest),\n );\n return undefined;\n }\n if (field.primitive !== 'array') {\n refuse(\n compilation,\n 'INVALID_RULE_SCOPE',\n fieldAt,\n `${site.subject} acts on the rows of \\`${fieldId}\\`, which is a \\`${field.primitive}\\` field; rows are held by an \\`array\\`, so name the array whose rows this operation changes`,\n { repairStated: true },\n );\n return undefined;\n }\n const writer = compilation.computed.writers.get(fieldId);\n if (writer !== undefined) {\n refuse(\n compilation,\n 'DUPLICATE_WRITER',\n fieldAt,\n `${site.subject} changes the rows of field \\`${fieldId}\\`, which rule \\`${writer.ruleId}\\` produces as a \\`${writer.kind}\\` value; a computed array has one writer, so name an array the record supplies, or remove that ${\n writer.kind === 'defaultCompute' ? 'default' : 'computation'\n }`,\n { repairStated: true },\n );\n return undefined;\n }\n const outer = compilation.rowContainers.get(field.fieldId);\n if (outer !== undefined) {\n refuse(\n compilation,\n 'INVALID_RULE_SCOPE',\n fieldAt,\n `${site.subject} changes the rows of array \\`${field.fieldId}\\`, which sits inside a row of array \\`${outer}\\`; v1 addresses no row of a nested array, so change the rows of a top-level array`,\n { repairStated: true },\n );\n return undefined;\n }\n return field;\n}\n\n/** One row-template member, compiled and checked against the member it writes. */\ninterface CompiledRowMember {\n readonly fieldId: string;\n readonly node: ExprNode;\n}\n\n/**\n * The row key one compiled expression states as data.\n *\n * A literal is read directly. Any other expression folds through the compiler's literal folder,\n * so an append writing `1 + 6` names the same natural key as one writing `7`; an expression the\n * folder cannot close is `not-constant` rather than an invalid key, because only a value the\n * compiler can prove is checked here.\n */\ntype NodeRowKey =\n | { readonly outcome: 'key'; readonly value: string | number }\n | { readonly outcome: 'not-a-key' }\n | { readonly outcome: 'not-constant' };\n\nfunction nodeRowKey(node: ExprNode): NodeRowKey {\n const constant = node.kind === 'literal' ? { value: node.value } : constantOf(node);\n if (constant === undefined) return { outcome: 'not-constant' };\n const value = rowKeyValue(constant.value);\n return value === undefined ? { outcome: 'not-a-key' } : { outcome: 'key', value };\n}\n\n/**\n * The row an `append` adds, compiled member by member.\n *\n * Each member is a declaration of the array's own item declaration, so a template naming a member\n * the row does not carry, writing a computed one, or producing another member's type is refused\n * where the author wrote it. The declared natural key is required: a row without it is a row the\n * artifact cannot identify.\n */\nfunction compileRowTemplate(\n compilation: Compilation,\n authored: Record<string, unknown>,\n site: OperationSite,\n array: CompiledField,\n owner: SuggestionOwner,\n slots: SuggestionSlot[],\n): readonly CompiledRowMember[] | undefined {\n const template = authored['row'];\n if (!isRecord(template)) return undefined;\n const members = array.fields ?? [];\n const naturalKey = array.rowKey?.mode === 'natural' ? array.rowKey.fieldId : undefined;\n if (members.length === 0) {\n refuse(\n compilation,\n 'INVALID_RULE_SCOPE',\n `${site.at}.fieldId`,\n `${site.subject} adds a row to array \\`${array.fieldId}\\`, whose rows hold one value each rather than row members; a template states the members of a record row, so name an array whose items are records`,\n { repairStated: true },\n );\n return undefined;\n }\n const compiled: CompiledRowMember[] = [];\n let refused = false;\n for (const [memberId, source] of Object.entries(template)) {\n const memberAt = `${site.at}.row.${memberId}`;\n const member = members.find((candidate) => candidate.fieldId === memberId);\n if (member === undefined) {\n const nearest = nearestNames(\n memberId,\n members.map((candidate) => candidate.fieldId),\n );\n refuse(\n compilation,\n 'UNKNOWN_IDENTIFIER',\n memberAt,\n `${site.subject} adds a row to array \\`${array.fieldId}\\` with a value for \\`${memberId}\\`, which the row does not carry${didYouMean(memberId, nearest)}; name a member of the array's item declaration`,\n nearestExtra(nearest),\n );\n refused = true;\n continue;\n }\n const writer = compilation.computed.writers.get(memberId);\n if (writer !== undefined) {\n refuse(\n compilation,\n 'DUPLICATE_WRITER',\n memberAt,\n `${site.subject} adds a row to array \\`${array.fieldId}\\` with a value for \\`${memberId}\\`, which rule \\`${writer.ruleId}\\` produces as a \\`${writer.kind}\\` value; a computed member has one writer, so leave it out of the row template`,\n { repairStated: true },\n );\n refused = true;\n continue;\n }\n if (member.primitive === 'signature_ref') {\n refuse(\n compilation,\n 'SCHEMA_INVALID',\n memberAt,\n `${site.subject} adds a row to array \\`${array.fieldId}\\` with a value for \\`${memberId}\\`, which is a \\`signature_ref\\`; a signature is captured by the person who signs and never assigned, so leave it out of the row template`,\n { repairStated: true },\n );\n refused = true;\n continue;\n }\n const slot = compileExpressionSlot(compilation, source, memberAt, owner.itemFieldId);\n if (slot === undefined) {\n refused = true;\n continue;\n }\n slots.push({ path: memberAt, node: slot.node });\n if (\n rejectTargetMismatch(compilation, memberId, slot.type, memberAt, site.subject) ||\n crossCheckWriterLiteral(compilation, memberId, slot.node, memberAt, site.subject)\n ) {\n refused = true;\n continue;\n }\n // A natural key must be a key the session can address, whether the author wrote it as a\n // literal or as a closed expression that folds to one.\n if (memberId === naturalKey && nodeRowKey(slot.node).outcome === 'not-a-key') {\n refuseRowIdentityValue(\n compilation,\n memberAt,\n site.subject,\n { fieldId: memberId, description: `natural key \\`${memberId}\\`` },\n 'states an invalid value for',\n );\n refused = true;\n continue;\n }\n compiled.push({ fieldId: memberId, node: slot.node });\n }\n // The presence test reads what the author wrote rather than the compiled members: a template\n // that states the key with an expression which did not compile already reports that cause, and\n // a second refusal for the missing key would state a defect the author does not have.\n if (naturalKey !== undefined && !Object.hasOwn(template, naturalKey)) {\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n `${site.at}.row`,\n `${site.subject} adds a row to array \\`${array.fieldId}\\` whose template omits its declared natural key \\`${naturalKey}\\`; a row is identified by that member, so state \\`\"${naturalKey}\": <expression>\\` in \\`row\\``,\n { repairStated: true },\n );\n refused = true;\n }\n return refused ? undefined : compiled;\n}\n\n/** The refusal a literal row key earns on an array whose keys a literal cannot name. */\nfunction refuseLiteralRowKey(\n compilation: Compilation,\n array: CompiledField,\n rowKey: string | number,\n site: OperationSite,\n): undefined {\n const mode = array.rowKey?.mode;\n if (mode === 'assigned') {\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n `${site.at}.rowKey`,\n `${site.subject} removes row \\`${String(rowKey)}\\` from array \\`${array.fieldId}\\`, which assigns its row keys at run time; the artifact cannot name a key the session creates, so remove the \\`current\\` row from an \\`item\\`-scoped owner on \\`${array.fieldId}\\``,\n { repairStated: true },\n );\n return undefined;\n }\n refuse(\n compilation,\n 'INVALID_ROW_KEY',\n `${site.at}.rowKey`,\n `${site.subject} removes row \\`${String(rowKey)}\\` from array \\`${array.fieldId}\\`, which declares no \\`rowKey\\`, so none of its rows has a key to name; name an array whose rows carry a natural key, or state the row the owner judged as \\`current\\``,\n { repairStated: true },\n );\n return undefined;\n}\n\n/** The row a `removeRow` names: a literal key, or the row an `item`-scoped owner judged. */\nfunction removeRowKey(\n compilation: Compilation,\n array: CompiledField,\n authored: Record<string, unknown>,\n site: OperationSite,\n owner: SuggestionOwner,\n): string | number | undefined {\n const rowKey = authored['rowKey'];\n if (rowKey === CURRENT_ROW) {\n if (owner.itemFieldId === undefined) {\n refuse(\n compilation,\n 'INVALID_RULE_SCOPE',\n `${site.at}.rowKey`,\n `${site.subject} names the \\`current\\` row of array \\`${array.fieldId}\\`, which is the row an \\`item\\`-scoped owner judged, and ${owner.description} addresses no row; state the row's literal key, or address \\`${array.fieldId}\\` at \\`item\\` scope`,\n { repairStated: true },\n );\n return undefined;\n }\n if (owner.itemFieldId !== array.fieldId) {\n refuse(\n compilation,\n 'INVALID_RULE_SCOPE',\n `${site.at}.rowKey`,\n `${site.subject} removes the \\`current\\` row of array \\`${array.fieldId}\\`, and the \\`current\\` row is a row of array \\`${owner.itemFieldId}\\`; remove the row from that array, or state this row's literal key`,\n { repairStated: true },\n );\n return undefined;\n }\n return CURRENT_ROW;\n }\n if (typeof rowKey !== 'string' && typeof rowKey !== 'number') return undefined;\n const valueIdentified = array.rowKey === undefined && array.items !== undefined;\n if (array.rowKey?.mode === 'natural' || valueIdentified) {\n if (refuseRowKeyDomain(compilation, array, rowKey, site)) return undefined;\n return rowKey;\n }\n return refuseLiteralRowKey(compilation, array, rowKey, site);\n}\n\n/** The operation kinds the artifact states, in the spelling an author writes. */\ntype SuggestionOperationKind = CompiledSuggestionOperation['kind'];\n\n/** Whether a string names one of the five operation kinds, so the switch below is exhaustive. */\nfunction isSuggestionOperationKind(value: string | undefined): value is SuggestionOperationKind {\n return (\n value === 'value' ||\n value === 'null' ||\n value === 'remove' ||\n value === 'append' ||\n value === 'removeRow'\n );\n}\n\n/** One operation compiled into the artifact shape, or `undefined` when it was refused. */\nfunction compileOperation(\n compilation: Compilation,\n authored: unknown,\n site: OperationSite,\n owner: SuggestionOwner,\n claims: Map<string, number>,\n operationIndex: number,\n slots: SuggestionSlot[],\n): CompiledSuggestionOperation | undefined {\n if (!isRecord(authored)) return undefined;\n const kind = textAt(authored, 'kind');\n // The closed metaschema refuses a `kind` outside the five before this walk runs, so an authored\n // document never reaches here. The guard stays as defence in depth for a caller that hands this\n // walk a compiled form: an operation this version does not understand is refused rather than\n // dropped, because an alternative lowered without it would apply a change set the author never\n // wrote.\n if (!isSuggestionOperationKind(kind)) {\n refuse(\n compilation,\n 'SCHEMA_INVALID',\n `${site.at}.kind`,\n kind === undefined\n ? `${site.subject} states no operation \\`kind\\`; name one of \\`value\\`, \\`null\\`, \\`remove\\`, \\`append\\` or \\`removeRow\\``\n : `${site.subject} states operation kind \\`${kind}\\`, which is not one of \\`value\\`, \\`null\\`, \\`remove\\`, \\`append\\` or \\`removeRow\\`; name one of those kinds`,\n { repairStated: true },\n );\n return undefined;\n }\n switch (kind) {\n case 'value':\n case 'null':\n case 'remove': {\n const refAt = `${site.at}.ref`;\n const binding = resolveBinding(\n compilation,\n authored['ref'],\n { at: refAt, subject: site.subject },\n owner,\n );\n if (binding === undefined) return undefined;\n const identity = rowIdentityOf(compilation, binding);\n const arrayElement = isArrayElementTarget(compilation, binding.field, binding.rowKey);\n if (identity !== undefined && (kind === 'null' || (kind === 'remove' && !arrayElement))) {\n return refuseRowIdentityValue(\n compilation,\n `${refAt}.fieldId`,\n site.subject,\n identity,\n kind === 'null' ? 'writes null to' : 'removes',\n );\n }\n const earlier = earlierClaim(claims, binding);\n if (earlier !== undefined) {\n refuse(\n compilation,\n 'DUPLICATE_WRITER',\n `${refAt}.fieldId`,\n `${site.subject} writes ${describeBinding(binding)} in operation ${String(earlier + 1)} and again in operation ${String(operationIndex + 1)}; two writes to one binding leave the value to their order, so state each binding once`,\n { repairStated: true },\n );\n return undefined;\n }\n claims.set(binding.key, operationIndex);\n if (kind === 'null') return { kind: 'null', ref: refOf(binding) };\n if (kind === 'remove') {\n if (arrayElement) {\n refuse(\n compilation,\n 'INVALID_RULE_SCOPE',\n `${refAt}.fieldId`,\n `${site.subject} removes one element of array \\`${binding.field.fieldId}\\`; an element is a row, so removing it moves the array's identity and must be stated as \\`removeRow\\` rather than \\`remove\\``,\n { repairStated: true },\n );\n return undefined;\n }\n return { kind: 'remove', ref: refOf(binding) };\n }\n const valueSlot = compileExpressionSlot(\n compilation,\n authored['value'],\n `${site.at}.value`,\n owner.itemFieldId,\n );\n if (valueSlot === undefined) return undefined;\n slots.push({ path: `${site.at}.value`, node: valueSlot.node });\n // A whole-array literal write bypasses the row-by-row identity rules an `append` states, so\n // it is checked before the type so a literal row with no identity is named as that rather\n // than as the type mismatch its shape also earns. The written field is an array either when\n // it is top level or when it is a member of an outer row; only an array-element target is\n // excluded, because that write addresses one existing element rather than the whole list.\n if (\n binding.field.primitive === 'array' &&\n !isArrayElementTarget(compilation, binding.field, binding.rowKey) &&\n valueSlot.node.kind === 'list' &&\n refuseLiteralArrayIdentity(\n compilation,\n binding.field,\n valueSlot.node,\n `${site.at}.value`,\n site.subject,\n )\n ) {\n return undefined;\n }\n if (\n rejectTargetMismatch(\n compilation,\n binding.field.fieldId,\n valueSlot.type,\n `${site.at}.value`,\n site.subject,\n binding.rowKey,\n ) ||\n crossCheckWriterLiteral(\n compilation,\n binding.field.fieldId,\n valueSlot.node,\n `${site.at}.value`,\n site.subject,\n )\n ) {\n return undefined;\n }\n if (identity !== undefined && nodeRowKey(valueSlot.node).outcome === 'not-a-key') {\n return refuseRowIdentityValue(\n compilation,\n `${site.at}.value`,\n site.subject,\n identity,\n 'states an invalid value for',\n );\n }\n return { kind: 'value', ref: refOf(binding), value: valueSlot.node };\n }\n case 'append': {\n const array = resolveArray(compilation, authored, site);\n if (array === undefined) return undefined;\n const row = compileRowTemplate(compilation, authored, site, array, owner, slots);\n if (row === undefined) return undefined;\n const naturalKey = array.rowKey?.mode === 'natural' ? array.rowKey.fieldId : undefined;\n const keyNode = row.find((member) => member.fieldId === naturalKey)?.node;\n const key = keyNode === undefined ? undefined : nodeRowKey(keyNode);\n if (naturalKey !== undefined && key?.outcome === 'key') {\n const binding: ResolvedBinding = {\n field: array,\n rowKey: key.value,\n key: bindingKey(array.fieldId, key.value),\n };\n const earlier = earlierClaim(claims, binding);\n if (earlier !== undefined) {\n refuse(\n compilation,\n 'DUPLICATE_WRITER',\n `${site.at}.row.${naturalKey}`,\n `${site.subject} names ${describeBinding(binding)} in operation ${String(earlier + 1)} and again in operation ${String(operationIndex + 1)}; two operations name one binding, so state each binding once`,\n { repairStated: true },\n );\n return undefined;\n }\n claims.set(binding.key, operationIndex);\n }\n return {\n kind: 'append',\n fieldId: array.fieldId,\n row: Object.fromEntries(row.map((member) => [member.fieldId, member.node])),\n };\n }\n case 'removeRow': {\n const array = resolveArray(compilation, authored, site);\n if (array === undefined) return undefined;\n const rowKey = removeRowKey(compilation, array, authored, site, owner);\n if (rowKey === undefined) return undefined;\n const binding: ResolvedBinding = {\n field: array,\n rowKey,\n key: bindingKey(array.fieldId, rowKey),\n };\n const earlier = earlierClaim(claims, binding);\n if (earlier !== undefined) {\n refuse(\n compilation,\n 'DUPLICATE_WRITER',\n `${site.at}.rowKey`,\n `${site.subject} names ${describeBinding(binding)} in operation ${String(earlier + 1)} and again in operation ${String(operationIndex + 1)}; two operations name one binding, so state each binding once`,\n { repairStated: true },\n );\n return undefined;\n }\n claims.set(binding.key, operationIndex);\n return { kind: 'removeRow', fieldId: array.fieldId, rowKey };\n }\n default:\n // Every kind is handled above; a sixth arm added to the union fails here at typecheck.\n return assertNever(kind);\n }\n}\n\n/**\n * Every alternative one owner declares, compiled for the artifact.\n *\n * `at` is the member that holds the list, e.g. `$.rules[0].suggests`, so a refusal names the\n * alternative and the operation the author can repair.\n */\nexport function compileSuggestions(\n compilation: Compilation,\n authored: unknown,\n at: string,\n owner: SuggestionOwner,\n): CompiledSuggestions {\n const slots: SuggestionSlot[] = [];\n if (!Array.isArray(authored)) return { slots };\n const suggestions: CompiledSuggestion[] = [];\n let refused = false;\n authored.forEach((entry, suggestionIndex) => {\n if (!isRecord(entry)) return;\n const labelKey = textAt(entry, 'labelKey');\n const operations = entry['operations'];\n if (labelKey === undefined || !Array.isArray(operations)) return;\n const subject = `alternative ${String(suggestionIndex + 1)} of ${owner.description}`;\n const claims = new Map<string, number>();\n const compiled: CompiledSuggestionOperation[] = [];\n let alternativeRefused = false;\n operations.forEach((operation, operationIndex) => {\n const site: OperationSite = {\n at: `${at}[${String(suggestionIndex)}].operations[${String(operationIndex)}]`,\n subject,\n };\n const value = compileOperation(\n compilation,\n operation,\n site,\n owner,\n claims,\n operationIndex,\n slots,\n );\n if (value === undefined) {\n alternativeRefused = true;\n return;\n }\n compiled.push(value);\n });\n if (alternativeRefused || compiled.length === 0) {\n refused = true;\n return;\n }\n suggestions.push({ labelKey, operations: compiled });\n });\n return refused ? { slots } : { suggestions, slots };\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { CompiledField } from '@azx-pbc/axiom-runtime';
2
+ import type { StaticType } from '../expr/typecheck.js';
3
+ import type { Compilation } from './compilation.js';
4
+ /**
5
+ * Whether a ref addresses one element of a scalar array rather than the declaration itself.
6
+ *
7
+ * An array declared inside another array's row is itself the member that row key addresses; only
8
+ * an array outside any enclosing row uses its own key to address an element.
9
+ */
10
+ export declare function isArrayElementTarget(compilation: Compilation, declaration: CompiledField, rowKey: string | number | undefined): boolean;
11
+ /**
12
+ * A writer's target the expression cannot produce is refused here rather than at the host, which
13
+ * would have to coerce it or fail on a value the artifact declared.
14
+ *
15
+ * `subject` names who writes, because the same check serves a rule's own writer and an alternative
16
+ * that suggests a value: the refusal has to name the declaration the author can repair.
17
+ *
18
+ * @returns whether a refusal was reported, so a caller that must omit the whole construct it is
19
+ * building knows the slot did not compile.
20
+ */
21
+ export declare function rejectTargetMismatch(compilation: Compilation, fieldId: string, type: StaticType, path: string, subject: string, rowKey?: string | number): boolean;
22
+ //# sourceMappingURL=targets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"targets.d.ts","sourceRoot":"","sources":["../../src/compile/targets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA4EpD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,aAAa,EAC1B,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAClC,OAAO,CAOT;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GACvB,OAAO,CAiCT"}
@@ -0,0 +1,125 @@
1
+ import { arrayElementType, staticTypeOf, typeName, unify } from '../expr/typecheck/types.js';
2
+ import { refuse } from './compilation.js';
3
+ /**
4
+ * Whether an expression's static type can be written to the target field without conversion.
5
+ *
6
+ * `null` is the empty value of every domain and an empty list is the empty
7
+ * value of an array, so both fit any target. A container is accepted when every member the
8
+ * expression may carry is a declared member of the target with the same primitive: a member
9
+ * the target does not declare would be refused by the wire reader, and a target member the
10
+ * expression omits is simply absent. Nothing else matches, because no conversion runs
11
+ * between the produced value and the field it is written to.
12
+ *
13
+ * A measured primitive is one level deeper than its primitive: `money`, `quantity` and
14
+ * `duration` each carry a domain the wire reader enforces, so the writer must produce a value
15
+ * that domain admits. `unify` is the same algebra the operators use, and an `unknown` slot
16
+ * unifies with anything — so a lookup output or a literal with no pinned spelling stays legal
17
+ * and the runtime decides, while two pinned, disjoint domains are refused here.
18
+ */
19
+ function matchesDeclaration(field, type) {
20
+ if (type.kind === 'primitive') {
21
+ return (type.primitive === 'null' ||
22
+ (type.primitive === field.primitive && unify(staticTypeOf(field), type) !== undefined));
23
+ }
24
+ if (type.kind === 'record') {
25
+ return field.primitive === 'record' && !type.open && declaresMembers(field, type.fields);
26
+ }
27
+ // Only an empty list literal has no element domain while still guaranteeing the target's
28
+ // item shape. An open context array also has no static element domain, but its runtime
29
+ // members are unknown and cannot be written into a closed array without validation.
30
+ if (type.element === undefined)
31
+ return field.primitive === 'array' && !type.open;
32
+ if (field.primitive !== 'array' || type.open)
33
+ return false;
34
+ if (type.element.kind === 'record') {
35
+ return (field.items === undefined && !type.element.open && declaresMembers(field, type.element.fields));
36
+ }
37
+ if (type.element.kind !== 'primitive')
38
+ return false;
39
+ // A scalar array writes its declared item domain without conversion. `null` is the empty
40
+ // value of every item primitive; a record array cannot use this arm because its rows are
41
+ // closed records rather than nullable scalar items.
42
+ if (field.items === undefined)
43
+ return false;
44
+ if (type.element.primitive === 'null')
45
+ return true;
46
+ if (type.element.primitive !== field.items.primitive)
47
+ return false;
48
+ const targetElement = arrayElementType(field);
49
+ return targetElement !== undefined && unify(targetElement, type.element) !== undefined;
50
+ }
51
+ /** Whether every member one type may carry is a declared member of the container. */
52
+ function declaresMembers(container, members) {
53
+ const declared = container.fields ?? [];
54
+ return members.every((member) => {
55
+ const target = declared.find((candidate) => candidate.fieldId === member.fieldId);
56
+ return target !== undefined && matchesDeclaration(target, staticTypeOf(member));
57
+ });
58
+ }
59
+ /**
60
+ * How a refusal names the target: its primitive, or the domain that decides the comparison when
61
+ * the primitive is a measured one. A money, quantity or duration writer that names only the
62
+ * primitive tells the author nothing they did not already know.
63
+ *
64
+ * `type` is passed rather than derived from the declaration so an array element can be described
65
+ * by its own item domain. That type carries no source field id: the array is the field the
66
+ * document declares, and naming it beside an element's quantity or duration domain would read as
67
+ * though the array itself were the measured field.
68
+ */
69
+ function targetDescription(type, primitive) {
70
+ return type.kind === 'primitive' &&
71
+ (type.primitive === 'money' || type.primitive === 'quantity' || type.primitive === 'duration')
72
+ ? `whose domain is ${typeName(type)}`
73
+ : `whose primitive is ${primitive}`;
74
+ }
75
+ /**
76
+ * Whether a ref addresses one element of a scalar array rather than the declaration itself.
77
+ *
78
+ * An array declared inside another array's row is itself the member that row key addresses; only
79
+ * an array outside any enclosing row uses its own key to address an element.
80
+ */
81
+ export function isArrayElementTarget(compilation, declaration, rowKey) {
82
+ return (rowKey !== undefined &&
83
+ declaration.primitive === 'array' &&
84
+ declaration.items !== undefined &&
85
+ compilation.rowContainers.get(declaration.fieldId) === undefined);
86
+ }
87
+ /**
88
+ * A writer's target the expression cannot produce is refused here rather than at the host, which
89
+ * would have to coerce it or fail on a value the artifact declared.
90
+ *
91
+ * `subject` names who writes, because the same check serves a rule's own writer and an alternative
92
+ * that suggests a value: the refusal has to name the declaration the author can repair.
93
+ *
94
+ * @returns whether a refusal was reported, so a caller that must omit the whole construct it is
95
+ * building knows the slot did not compile.
96
+ */
97
+ export function rejectTargetMismatch(compilation, fieldId, type, path, subject, rowKey) {
98
+ const declaration = compilation.fieldsById.get(fieldId);
99
+ // An unknown target is already named by the declaration check, which runs before this.
100
+ if (declaration === undefined)
101
+ return false;
102
+ // A row key on a scalar array outside any enclosing row addresses one element, whose domain is
103
+ // `items`, not the list container. A nested scalar array is instead the outer row member itself.
104
+ const item = isArrayElementTarget(compilation, declaration, rowKey)
105
+ ? declaration.items
106
+ : undefined;
107
+ const target = item === undefined
108
+ ? declaration
109
+ : {
110
+ fieldId: declaration.fieldId,
111
+ primitive: item.primitive,
112
+ ...(item.currency === undefined ? {} : { currency: item.currency }),
113
+ ...(item.scale === undefined ? {} : { scale: item.scale }),
114
+ ...(item.units === undefined ? {} : { units: item.units }),
115
+ ...(item.unit === undefined ? {} : { unit: item.unit }),
116
+ };
117
+ if (matchesDeclaration(target, type))
118
+ return false;
119
+ const describedType = item === undefined
120
+ ? staticTypeOf(target)
121
+ : (arrayElementType(declaration) ?? staticTypeOf(target));
122
+ refuse(compilation, 'TYPE_MISMATCH', path, `${subject} writes field \`${fieldId}\`, ${targetDescription(describedType, target.primitive)}, but the expression produces ${typeName(type)}; no conversion runs between the two, so the expression must produce the target's own type`, { expected: target.primitive });
123
+ return true;
124
+ }
125
+ //# sourceMappingURL=targets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"targets.js","sourceRoot":"","sources":["../../src/compile/targets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAE7F,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;;;;;;;;;;;GAeG;AACH,SAAS,kBAAkB,CAAC,KAAoB,EAAE,IAAgB;IAChE,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC9B,OAAO,CACL,IAAI,CAAC,SAAS,KAAK,MAAM;YACzB,CAAC,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,SAAS,CAAC,CACvF,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,eAAe,CAAC,KAA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,EAAE,MAAM,CAAC,SAAS,CAAC,iCAAiC,QAAQ,CAAC,IAAI,CAAC,4FAA4F,EACxO,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,CAC/B,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { CompiledField, Primitive } from '@azx-pbc/axiom-runtime';\nimport type { StaticType } from '../expr/typecheck.js';\nimport { arrayElementType, staticTypeOf, typeName, unify } from '../expr/typecheck/types.js';\nimport type { Compilation } from './compilation.js';\nimport { refuse } from './compilation.js';\n\n/**\n * Whether an expression's static type can be written to the target field without conversion.\n *\n * `null` is the empty value of every domain and an empty list is the empty\n * value of an array, so both fit any target. A container is accepted when every member the\n * expression may carry is a declared member of the target with the same primitive: a member\n * the target does not declare would be refused by the wire reader, and a target member the\n * expression omits is simply absent. Nothing else matches, because no conversion runs\n * between the produced value and the field it is written to.\n *\n * A measured primitive is one level deeper than its primitive: `money`, `quantity` and\n * `duration` each carry a domain the wire reader enforces, so the writer must produce a value\n * that domain admits. `unify` is the same algebra the operators use, and an `unknown` slot\n * unifies with anything — so a lookup output or a literal with no pinned spelling stays legal\n * and the runtime decides, while two pinned, disjoint domains are refused here.\n */\nfunction matchesDeclaration(field: CompiledField, type: StaticType): boolean {\n if (type.kind === 'primitive') {\n return (\n type.primitive === 'null' ||\n (type.primitive === field.primitive && unify(staticTypeOf(field), type) !== undefined)\n );\n }\n if (type.kind === 'record') {\n return field.primitive === 'record' && !type.open && declaresMembers(field, type.fields);\n }\n // Only an empty list literal has no element domain while still guaranteeing the target's\n // item shape. An open context array also has no static element domain, but its runtime\n // members are unknown and cannot be written into a closed array without validation.\n if (type.element === undefined) return field.primitive === 'array' && !type.open;\n if (field.primitive !== 'array' || type.open) return false;\n if (type.element.kind === 'record') {\n return (\n field.items === undefined && !type.element.open && declaresMembers(field, type.element.fields)\n );\n }\n if (type.element.kind !== 'primitive') return false;\n // A scalar array writes its declared item domain without conversion. `null` is the empty\n // value of every item primitive; a record array cannot use this arm because its rows are\n // closed records rather than nullable scalar items.\n if (field.items === undefined) return false;\n if (type.element.primitive === 'null') return true;\n if (type.element.primitive !== field.items.primitive) return false;\n const targetElement = arrayElementType(field);\n return targetElement !== undefined && unify(targetElement, type.element) !== undefined;\n}\n\n/** Whether every member one type may carry is a declared member of the container. */\nfunction declaresMembers(container: CompiledField, members: readonly CompiledField[]): boolean {\n const declared = container.fields ?? [];\n return members.every((member) => {\n const target = declared.find((candidate) => candidate.fieldId === member.fieldId);\n return target !== undefined && matchesDeclaration(target, staticTypeOf(member));\n });\n}\n\n/**\n * How a refusal names the target: its primitive, or the domain that decides the comparison when\n * the primitive is a measured one. A money, quantity or duration writer that names only the\n * primitive tells the author nothing they did not already know.\n *\n * `type` is passed rather than derived from the declaration so an array element can be described\n * by its own item domain. That type carries no source field id: the array is the field the\n * document declares, and naming it beside an element's quantity or duration domain would read as\n * though the array itself were the measured field.\n */\nfunction targetDescription(type: StaticType, primitive: Primitive): string {\n return type.kind === 'primitive' &&\n (type.primitive === 'money' || type.primitive === 'quantity' || type.primitive === 'duration')\n ? `whose domain is ${typeName(type)}`\n : `whose primitive is ${primitive}`;\n}\n\n/**\n * Whether a ref addresses one element of a scalar array rather than the declaration itself.\n *\n * An array declared inside another array's row is itself the member that row key addresses; only\n * an array outside any enclosing row uses its own key to address an element.\n */\nexport function isArrayElementTarget(\n compilation: Compilation,\n declaration: CompiledField,\n rowKey: string | number | undefined,\n): boolean {\n return (\n rowKey !== undefined &&\n declaration.primitive === 'array' &&\n declaration.items !== undefined &&\n compilation.rowContainers.get(declaration.fieldId) === undefined\n );\n}\n\n/**\n * A writer's target the expression cannot produce is refused here rather than at the host, which\n * would have to coerce it or fail on a value the artifact declared.\n *\n * `subject` names who writes, because the same check serves a rule's own writer and an alternative\n * that suggests a value: the refusal has to name the declaration the author can repair.\n *\n * @returns whether a refusal was reported, so a caller that must omit the whole construct it is\n * building knows the slot did not compile.\n */\nexport function rejectTargetMismatch(\n compilation: Compilation,\n fieldId: string,\n type: StaticType,\n path: string,\n subject: string,\n rowKey?: string | number,\n): boolean {\n const declaration = compilation.fieldsById.get(fieldId);\n // An unknown target is already named by the declaration check, which runs before this.\n if (declaration === undefined) return false;\n // A row key on a scalar array outside any enclosing row addresses one element, whose domain is\n // `items`, not the list container. A nested scalar array is instead the outer row member itself.\n const item = isArrayElementTarget(compilation, declaration, rowKey)\n ? declaration.items\n : undefined;\n const target =\n item === undefined\n ? declaration\n : {\n fieldId: declaration.fieldId,\n primitive: item.primitive,\n ...(item.currency === undefined ? {} : { currency: item.currency }),\n ...(item.scale === undefined ? {} : { scale: item.scale }),\n ...(item.units === undefined ? {} : { units: item.units }),\n ...(item.unit === undefined ? {} : { unit: item.unit }),\n };\n if (matchesDeclaration(target, type)) return false;\n const describedType =\n item === undefined\n ? staticTypeOf(target)\n : (arrayElementType(declaration) ?? staticTypeOf(target));\n refuse(\n compilation,\n 'TYPE_MISMATCH',\n path,\n `${subject} writes field \\`${fieldId}\\`, ${targetDescription(describedType, target.primitive)}, but the expression produces ${typeName(type)}; no conversion runs between the two, so the expression must produce the target's own type`,\n { expected: target.primitive },\n );\n return true;\n}\n"]}
@@ -0,0 +1,84 @@
1
+ import type { CompiledSchema, DependencyReport, Tier } from '@azx-pbc/axiom-runtime';
2
+ import type { CompiledDatasetDeclaration } from '../datasets/index.js';
3
+ import type { SchemaDiagnostic } from '../schema/validate.js';
4
+ import type { DeclaredEvidence, DeclaredRuleOrigin } from '../publish/readiness.js';
5
+ import type { CompileWarning } from './warning.js';
6
+ export type { CompileWarning } from './warning.js';
7
+ /** What the caller knows that the document does not. */
8
+ export interface CompileOptions {
9
+ /** The tier the artifact is for; a server artifact is the default. */
10
+ readonly target?: Tier;
11
+ /**
12
+ * The Axiom release to stamp on the artifact as `producerVersion`.
13
+ *
14
+ * A runtime refuses an artifact produced by a newer release than itself, so a stamped artifact
15
+ * lets a device say "this came from 0.0.2, I am 0.0.1" instead of evaluating only the members
16
+ * it recognises. The three arms are:
17
+ *
18
+ * - `undefined` (the default) stamps `AXIOM_VERSION`, the release this compiler was built as.
19
+ * - a string stamps that release, after the compiler refuses a value that is not a release
20
+ * version. A caller doing its own coordinated release uses this to name the artifact's
21
+ * producer when it differs from the compiler package it links.
22
+ * - `null` omits the member. It exists for a build whose bytes measure behaviour rather than
23
+ * release identity: the committed corpus fixtures and every byte gate over them, which stay
24
+ * comparable across the releases that regenerate nothing.
25
+ */
26
+ readonly producerVersion?: string | null;
27
+ /**
28
+ * The compiled declarations of the tables the document names, from `compileDataset`.
29
+ * A `datasetRef` carries only a `tableId` and the version it pins, so the table's kind, columns
30
+ * and clock binding reach the checker here; an expression that names a declared table this list
31
+ * does not describe — or describes only at another version — is refused rather than left
32
+ * unchecked, because the artifact would pin the version the document states.
33
+ */
34
+ readonly datasets?: readonly CompiledDatasetDeclaration[];
35
+ /**
36
+ * Whether the document may use `matches`, defaulting to true.
37
+ *
38
+ * A build that forbids regular expressions — a vendor that must not run one in its client
39
+ * tier, or a review process that will not admit a pattern — sets this false: every `matches`
40
+ * call is then refused at compile time, naming the build rather than the pattern, and a form
41
+ * that does not use the operator is unaffected. It is a property of the build because the
42
+ * language has no document-level capability gate to hang it on.
43
+ */
44
+ readonly allowRegex?: boolean;
45
+ }
46
+ /**
47
+ * The branches the artifact's embedded vectors leave unproven.
48
+ *
49
+ * This is not a publish verdict: a compile executes nothing, so only `verifyPublishReadiness()`
50
+ * may state that a rule is ready. `axiom-cli test` reports the same gaps beside the executed evidence
51
+ * the fold derives from a run.
52
+ */
53
+ export type { DeclaredEvidence, PublishGap } from '../publish/readiness.js';
54
+ /** A document compiled into the runtime's artifact contract. */
55
+ export interface CompileSuccess {
56
+ readonly ok: true;
57
+ readonly schema: CompiledSchema;
58
+ /** The derived dependency graph the artifact was checked against. */
59
+ readonly deps: DependencyReport;
60
+ /** The gaps the artifact's own vectors leave, never a claim that a rule is ready. */
61
+ readonly declaredEvidence: DeclaredEvidence;
62
+ /**
63
+ * Where each rule a field declaration compiles to came from, so a publish gap names the
64
+ * member the author wrote rather than the id the compiler synthesised. Authoring metadata,
65
+ * never artifact data: it is not part of `schema`, so a declaration with evidence and the
66
+ * hand-written rule with the same cases are still one artifact.
67
+ */
68
+ readonly declarationOrigins: readonly DeclaredRuleOrigin[];
69
+ /**
70
+ * Findings that do not refuse the document, such as a call to a deprecated built-in
71
+ * (`EXPR-7.1.6`) or an aggregate over a list that may be empty (`EXPR-18.1.2`). Empty when
72
+ * the document states none.
73
+ */
74
+ readonly warnings: readonly CompileWarning[];
75
+ }
76
+ /** A document that did not compile, with every reason found. */
77
+ export interface CompileFailure {
78
+ readonly ok: false;
79
+ readonly diagnostics: readonly SchemaDiagnostic[];
80
+ /** Warning findings collected before the refusal, so a repair loop sees both. */
81
+ readonly warnings: readonly CompileWarning[];
82
+ }
83
+ export type CompileResult = CompileSuccess | CompileFailure;
84
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compile/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC;IACvB;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAC1D;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE5E,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,qFAAqF;IACrF,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,kBAAkB,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC3D;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;CAC9C;AAED,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAClD,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;CAC9C;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/compile/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CompiledSchema, DependencyReport, Tier } from '@azx-pbc/axiom-runtime';\nimport type { CompiledDatasetDeclaration } from '../datasets/index.js';\nimport type { SchemaDiagnostic } from '../schema/validate.js';\nimport type { DeclaredEvidence, DeclaredRuleOrigin } from '../publish/readiness.js';\nimport type { CompileWarning } from './warning.js';\n\nexport type { CompileWarning } from './warning.js';\n\n/** What the caller knows that the document does not. */\nexport interface CompileOptions {\n /** The tier the artifact is for; a server artifact is the default. */\n readonly target?: Tier;\n /**\n * The Axiom release to stamp on the artifact as `producerVersion`.\n *\n * A runtime refuses an artifact produced by a newer release than itself, so a stamped artifact\n * lets a device say \"this came from 0.0.2, I am 0.0.1\" instead of evaluating only the members\n * it recognises. The three arms are:\n *\n * - `undefined` (the default) stamps `AXIOM_VERSION`, the release this compiler was built as.\n * - a string stamps that release, after the compiler refuses a value that is not a release\n * version. A caller doing its own coordinated release uses this to name the artifact's\n * producer when it differs from the compiler package it links.\n * - `null` omits the member. It exists for a build whose bytes measure behaviour rather than\n * release identity: the committed corpus fixtures and every byte gate over them, which stay\n * comparable across the releases that regenerate nothing.\n */\n readonly producerVersion?: string | null;\n /**\n * The compiled declarations of the tables the document names, from `compileDataset`.\n * A `datasetRef` carries only a `tableId` and the version it pins, so the table's kind, columns\n * and clock binding reach the checker here; an expression that names a declared table this list\n * does not describe — or describes only at another version — is refused rather than left\n * unchecked, because the artifact would pin the version the document states.\n */\n readonly datasets?: readonly CompiledDatasetDeclaration[];\n /**\n * Whether the document may use `matches`, defaulting to true.\n *\n * A build that forbids regular expressions — a vendor that must not run one in its client\n * tier, or a review process that will not admit a pattern — sets this false: every `matches`\n * call is then refused at compile time, naming the build rather than the pattern, and a form\n * that does not use the operator is unaffected. It is a property of the build because the\n * language has no document-level capability gate to hang it on.\n */\n readonly allowRegex?: boolean;\n}\n\n/**\n * The branches the artifact's embedded vectors leave unproven.\n *\n * This is not a publish verdict: a compile executes nothing, so only `verifyPublishReadiness()`\n * may state that a rule is ready. `axiom-cli test` reports the same gaps beside the executed evidence\n * the fold derives from a run.\n */\nexport type { DeclaredEvidence, PublishGap } from '../publish/readiness.js';\n\n/** A document compiled into the runtime's artifact contract. */\nexport interface CompileSuccess {\n readonly ok: true;\n readonly schema: CompiledSchema;\n /** The derived dependency graph the artifact was checked against. */\n readonly deps: DependencyReport;\n /** The gaps the artifact's own vectors leave, never a claim that a rule is ready. */\n readonly declaredEvidence: DeclaredEvidence;\n /**\n * Where each rule a field declaration compiles to came from, so a publish gap names the\n * member the author wrote rather than the id the compiler synthesised. Authoring metadata,\n * never artifact data: it is not part of `schema`, so a declaration with evidence and the\n * hand-written rule with the same cases are still one artifact.\n */\n readonly declarationOrigins: readonly DeclaredRuleOrigin[];\n /**\n * Findings that do not refuse the document, such as a call to a deprecated built-in\n * (`EXPR-7.1.6`) or an aggregate over a list that may be empty (`EXPR-18.1.2`). Empty when\n * the document states none.\n */\n readonly warnings: readonly CompileWarning[];\n}\n\n/** A document that did not compile, with every reason found. */\nexport interface CompileFailure {\n readonly ok: false;\n readonly diagnostics: readonly SchemaDiagnostic[];\n /** Warning findings collected before the refusal, so a repair loop sees both. */\n readonly warnings: readonly CompileWarning[];\n}\n\nexport type CompileResult = CompileSuccess | CompileFailure;\n"]}
@@ -0,0 +1,45 @@
1
+ import type { CompileDiagnosticCode } from '@azx-pbc/axiom-runtime';
2
+ /**
3
+ * A warning the compiler owns rather than the runtime's diagnostic catalogue.
4
+ *
5
+ * These name a construct whose only possible effect is none (`EMPTY_STEP`, `UNUSED_FIELD`).
6
+ * They are advice, not refusals: the runtime never evaluates them, so they are not part of
7
+ * `COMPILE_DIAGNOSTIC_CODES`; a host renders them beside the artifact exactly as it renders the
8
+ * runtime's warnings.
9
+ */
10
+ type CompilerWarningCode = 'EMPTY_STEP' | 'UNUSED_FIELD' | 'NESTED_ARRAY_INERT';
11
+ /**
12
+ * One finding a compile reports without refusing the document.
13
+ *
14
+ * A warning is not a `SchemaDiagnostic`: `ok` is decided by diagnostics alone, so a deprecated
15
+ * built-in or an aggregate that may decide nothing must not turn into a compile failure. The
16
+ * shape is deliberately the same members a diagnostic carries — code, path, detail, suggestion
17
+ * and the source offset an editor underlines — so a host can render both lists with one routine
18
+ * while branching on the list they arrived in.
19
+ */
20
+ export interface CompileWarning {
21
+ /**
22
+ * The warning code the compiler can report: a deprecated built-in (`DEPRECATED_BUILTIN`), a
23
+ * fold that is legal but undecided on an empty list (`UNDECIDED_AGGREGATE`), a `required`
24
+ * array that admits an empty list (`REQUIRED_ON_ARRAY`), an unsatisfiable or redundant
25
+ * condition (`UNSATISFIABLE_CONDITION`, `REDUNDANT_CONDITION`, `CONSTANT_COMPARISON`,
26
+ * `REQUIRED_NEVER_VISIBLE`), or one of the compiler's own dead-weight codes (`EMPTY_STEP`,
27
+ * `UNUSED_FIELD`, `NESTED_ARRAY_INERT`). The language vocabulary is the runtime's; the
28
+ * dead-weight codes are the compiler's because the runtime never evaluates them.
29
+ */
30
+ readonly code: Extract<CompileDiagnosticCode, 'DEPRECATED_BUILTIN' | 'UNDECIDED_AGGREGATE' | 'REQUIRED_ON_ARRAY' | 'CONSTANT_COMPARISON' | 'UNSATISFIABLE_CONDITION' | 'REDUNDANT_CONDITION' | 'REQUIRED_NEVER_VISIBLE'> | CompilerWarningCode;
31
+ /** Where in the document, as `$.rules[0].expr`. */
32
+ readonly path: string;
33
+ /** The concrete cause, naming the deprecated name and the form to write instead. */
34
+ readonly detail: string;
35
+ /** The catalogue's message key, so a host renders the warning in its own locale. */
36
+ readonly messageKey: string;
37
+ /** The source spellings the warning names as a repair, when one can be offered. */
38
+ readonly suggestions: readonly string[];
39
+ /** The 0-based UTF-16 offset of the call in its expression source. */
40
+ readonly offset?: number;
41
+ /** The offset indexes the expression carried in one slot, not the document bytes. */
42
+ readonly offsetSource?: 'expression';
43
+ }
44
+ export {};
45
+ //# sourceMappingURL=warning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warning.d.ts","sourceRoot":"","sources":["../../src/compile/warning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE;;;;;;;GAOG;AACH,KAAK,mBAAmB,GAAG,YAAY,GAAG,cAAc,GAAG,oBAAoB,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAI,EACT,OAAO,CACL,qBAAqB,EACnB,oBAAoB,GACpB,qBAAqB,GACrB,mBAAmB,GACnB,qBAAqB,GACrB,yBAAyB,GACzB,qBAAqB,GACrB,wBAAwB,CAC3B,GACD,mBAAmB,CAAC;IACxB,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,mFAAmF;IACnF,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,qFAAqF;IACrF,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;CACtC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=warning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warning.js","sourceRoot":"","sources":["../../src/compile/warning.ts"],"names":[],"mappings":"","sourcesContent":["import type { CompileDiagnosticCode } from '@azx-pbc/axiom-runtime';\n\n/**\n * A warning the compiler owns rather than the runtime's diagnostic catalogue.\n *\n * These name a construct whose only possible effect is none (`EMPTY_STEP`, `UNUSED_FIELD`).\n * They are advice, not refusals: the runtime never evaluates them, so they are not part of\n * `COMPILE_DIAGNOSTIC_CODES`; a host renders them beside the artifact exactly as it renders the\n * runtime's warnings.\n */\ntype CompilerWarningCode = 'EMPTY_STEP' | 'UNUSED_FIELD' | 'NESTED_ARRAY_INERT';\n\n/**\n * One finding a compile reports without refusing the document.\n *\n * A warning is not a `SchemaDiagnostic`: `ok` is decided by diagnostics alone, so a deprecated\n * built-in or an aggregate that may decide nothing must not turn into a compile failure. The\n * shape is deliberately the same members a diagnostic carries — code, path, detail, suggestion\n * and the source offset an editor underlines — so a host can render both lists with one routine\n * while branching on the list they arrived in.\n */\nexport interface CompileWarning {\n /**\n * The warning code the compiler can report: a deprecated built-in (`DEPRECATED_BUILTIN`), a\n * fold that is legal but undecided on an empty list (`UNDECIDED_AGGREGATE`), a `required`\n * array that admits an empty list (`REQUIRED_ON_ARRAY`), an unsatisfiable or redundant\n * condition (`UNSATISFIABLE_CONDITION`, `REDUNDANT_CONDITION`, `CONSTANT_COMPARISON`,\n * `REQUIRED_NEVER_VISIBLE`), or one of the compiler's own dead-weight codes (`EMPTY_STEP`,\n * `UNUSED_FIELD`, `NESTED_ARRAY_INERT`). The language vocabulary is the runtime's; the\n * dead-weight codes are the compiler's because the runtime never evaluates them.\n */\n readonly code:\n | Extract<\n CompileDiagnosticCode,\n | 'DEPRECATED_BUILTIN'\n | 'UNDECIDED_AGGREGATE'\n | 'REQUIRED_ON_ARRAY'\n | 'CONSTANT_COMPARISON'\n | 'UNSATISFIABLE_CONDITION'\n | 'REDUNDANT_CONDITION'\n | 'REQUIRED_NEVER_VISIBLE'\n >\n | CompilerWarningCode;\n /** Where in the document, as `$.rules[0].expr`. */\n readonly path: string;\n /** The concrete cause, naming the deprecated name and the form to write instead. */\n readonly detail: string;\n /** The catalogue's message key, so a host renders the warning in its own locale. */\n readonly messageKey: string;\n /** The source spellings the warning names as a repair, when one can be offered. */\n readonly suggestions: readonly string[];\n /** The 0-based UTF-16 offset of the call in its expression source. */\n readonly offset?: number;\n /** The offset indexes the expression carried in one slot, not the document bytes. */\n readonly offsetSource?: 'expression';\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import type { CompileOptions, CompileResult } from './compile/types.js';
2
+ import type { DocumentFormat } from './ingest/document.js';
3
+ /**
4
+ * The YAML authoring front door.
5
+ *
6
+ * YAML is a second spelling of the same document, not a second language: the strict reader in
7
+ * `ingest/yaml.ts` resolves anchors and aliases into a plain value and refuses the constructs
8
+ * JSON cannot express, then the same inspection, language and artifact stages `compile()` runs
9
+ * see it. `compile()` keeps its JSON meaning, so an existing caller cannot silently start
10
+ * accepting a different grammar.
11
+ *
12
+ * This module is separate from `compile.ts` on purpose: it is the only place the compiler's
13
+ * compile path reaches `yaml`, so an import of `compile` alone does not carry the parser into a
14
+ * browser or device bundle (`test/packaging/size-budget` holds the measured cost).
15
+ */
16
+ export declare function compileYaml(source: string, options?: CompileOptions): CompileResult;
17
+ /**
18
+ * Compiles one document by the format its path names. The format is chosen by the caller from
19
+ * the extension, never sniffed from the text, so a `.json` document is always read by the JSON
20
+ * reader and a `.yaml`/`.yml` document by the YAML one.
21
+ */
22
+ export declare function compileDocument(source: string, format: DocumentFormat, options?: CompileOptions): CompileResult;
23
+ //# sourceMappingURL=compile-yaml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-yaml.d.ts","sourceRoot":"","sources":["../src/compile-yaml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D;;;;;;;;;;;;GAYG;AAEH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,aAAa,CAIvF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,cAAmB,GAC3B,aAAa,CAEf"}
@@ -0,0 +1,30 @@
1
+ import { compile, compileInspected, sourceTextRefusal } from './compile.js';
2
+ import { inspectYamlDocument } from './schema/validate-yaml.js';
3
+ /**
4
+ * The YAML authoring front door.
5
+ *
6
+ * YAML is a second spelling of the same document, not a second language: the strict reader in
7
+ * `ingest/yaml.ts` resolves anchors and aliases into a plain value and refuses the constructs
8
+ * JSON cannot express, then the same inspection, language and artifact stages `compile()` runs
9
+ * see it. `compile()` keeps its JSON meaning, so an existing caller cannot silently start
10
+ * accepting a different grammar.
11
+ *
12
+ * This module is separate from `compile.ts` on purpose: it is the only place the compiler's
13
+ * compile path reaches `yaml`, so an import of `compile` alone does not carry the parser into a
14
+ * browser or device bundle (`test/packaging/size-budget` holds the measured cost).
15
+ */
16
+ export function compileYaml(source, options = {}) {
17
+ const refusal = sourceTextRefusal(source, 'YAML_INGEST_ERROR');
18
+ if (refusal !== undefined)
19
+ return refusal;
20
+ return compileInspected(inspectYamlDocument(source), options);
21
+ }
22
+ /**
23
+ * Compiles one document by the format its path names. The format is chosen by the caller from
24
+ * the extension, never sniffed from the text, so a `.json` document is always read by the JSON
25
+ * reader and a `.yaml`/`.yml` document by the YAML one.
26
+ */
27
+ export function compileDocument(source, format, options = {}) {
28
+ return format === 'yaml' ? compileYaml(source, options) : compile(source, options);
29
+ }
30
+ //# sourceMappingURL=compile-yaml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-yaml.js","sourceRoot":"","sources":["../src/compile-yaml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAG5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;;;;;;;;;;GAYG;AAEH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,OAAO,GAAmB,EAAE;IACtE,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC/D,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IAC1C,OAAO,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAc,EACd,MAAsB,EACtB,OAAO,GAAmB,EAAE;IAE5B,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrF,CAAC","sourcesContent":["import { compile, compileInspected, sourceTextRefusal } from './compile.js';\nimport type { CompileOptions, CompileResult } from './compile/types.js';\nimport type { DocumentFormat } from './ingest/document.js';\nimport { inspectYamlDocument } from './schema/validate-yaml.js';\n\n/**\n * The YAML authoring front door.\n *\n * YAML is a second spelling of the same document, not a second language: the strict reader in\n * `ingest/yaml.ts` resolves anchors and aliases into a plain value and refuses the constructs\n * JSON cannot express, then the same inspection, language and artifact stages `compile()` runs\n * see it. `compile()` keeps its JSON meaning, so an existing caller cannot silently start\n * accepting a different grammar.\n *\n * This module is separate from `compile.ts` on purpose: it is the only place the compiler's\n * compile path reaches `yaml`, so an import of `compile` alone does not carry the parser into a\n * browser or device bundle (`test/packaging/size-budget` holds the measured cost).\n */\n\nexport function compileYaml(source: string, options: CompileOptions = {}): CompileResult {\n const refusal = sourceTextRefusal(source, 'YAML_INGEST_ERROR');\n if (refusal !== undefined) return refusal;\n return compileInspected(inspectYamlDocument(source), options);\n}\n\n/**\n * Compiles one document by the format its path names. The format is chosen by the caller from\n * the extension, never sniffed from the text, so a `.json` document is always read by the JSON\n * reader and a `.yaml`/`.yml` document by the YAML one.\n */\nexport function compileDocument(\n source: string,\n format: DocumentFormat,\n options: CompileOptions = {},\n): CompileResult {\n return format === 'yaml' ? compileYaml(source, options) : compile(source, options);\n}\n"]}