@azx-pbc/axiom-runtime 0.0.0-stage → 0.0.5

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 (755) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +714 -2
  3. package/dist/cache/index.d.ts +191 -0
  4. package/dist/cache/index.d.ts.map +1 -0
  5. package/dist/cache/index.js +361 -0
  6. package/dist/cache/index.js.map +1 -0
  7. package/dist/canonical/jcs.d.ts +78 -0
  8. package/dist/canonical/jcs.d.ts.map +1 -0
  9. package/dist/canonical/jcs.js +500 -0
  10. package/dist/canonical/jcs.js.map +1 -0
  11. package/dist/canonical/restricted-json.d.ts +7 -0
  12. package/dist/canonical/restricted-json.d.ts.map +1 -0
  13. package/dist/canonical/restricted-json.js +318 -0
  14. package/dist/canonical/restricted-json.js.map +1 -0
  15. package/dist/canonical/restricted-value.d.ts +59 -0
  16. package/dist/canonical/restricted-value.d.ts.map +1 -0
  17. package/dist/canonical/restricted-value.js +156 -0
  18. package/dist/canonical/restricted-value.js.map +1 -0
  19. package/dist/canonical/restricted.d.ts +85 -0
  20. package/dist/canonical/restricted.d.ts.map +1 -0
  21. package/dist/canonical/restricted.js +163 -0
  22. package/dist/canonical/restricted.js.map +1 -0
  23. package/dist/canonical/signature.d.ts +38 -0
  24. package/dist/canonical/signature.d.ts.map +1 -0
  25. package/dist/canonical/signature.js +47 -0
  26. package/dist/canonical/signature.js.map +1 -0
  27. package/dist/eval/access/delivery.d.ts +63 -0
  28. package/dist/eval/access/delivery.d.ts.map +1 -0
  29. package/dist/eval/access/delivery.js +98 -0
  30. package/dist/eval/access/delivery.js.map +1 -0
  31. package/dist/eval/access/overlay.d.ts +72 -0
  32. package/dist/eval/access/overlay.d.ts.map +1 -0
  33. package/dist/eval/access/overlay.js +402 -0
  34. package/dist/eval/access/overlay.js.map +1 -0
  35. package/dist/eval/access/projection.d.ts +159 -0
  36. package/dist/eval/access/projection.d.ts.map +1 -0
  37. package/dist/eval/access/projection.js +211 -0
  38. package/dist/eval/access/projection.js.map +1 -0
  39. package/dist/eval/access/window.d.ts +128 -0
  40. package/dist/eval/access/window.d.ts.map +1 -0
  41. package/dist/eval/access/window.js +254 -0
  42. package/dist/eval/access/window.js.map +1 -0
  43. package/dist/eval/access/write.d.ts +113 -0
  44. package/dist/eval/access/write.d.ts.map +1 -0
  45. package/dist/eval/access/write.js +119 -0
  46. package/dist/eval/access/write.js.map +1 -0
  47. package/dist/eval/addressing.d.ts +131 -0
  48. package/dist/eval/addressing.d.ts.map +1 -0
  49. package/dist/eval/addressing.js +270 -0
  50. package/dist/eval/addressing.js.map +1 -0
  51. package/dist/eval/budget.d.ts +143 -0
  52. package/dist/eval/budget.d.ts.map +1 -0
  53. package/dist/eval/budget.js +387 -0
  54. package/dist/eval/budget.js.map +1 -0
  55. package/dist/eval/computed.d.ts +46 -0
  56. package/dist/eval/computed.d.ts.map +1 -0
  57. package/dist/eval/computed.js +89 -0
  58. package/dist/eval/computed.js.map +1 -0
  59. package/dist/eval/denials.d.ts +64 -0
  60. package/dist/eval/denials.d.ts.map +1 -0
  61. package/dist/eval/denials.js +87 -0
  62. package/dist/eval/denials.js.map +1 -0
  63. package/dist/eval/engine/cancellation.d.ts +12 -0
  64. package/dist/eval/engine/cancellation.d.ts.map +1 -0
  65. package/dist/eval/engine/cancellation.js +56 -0
  66. package/dist/eval/engine/cancellation.js.map +1 -0
  67. package/dist/eval/engine/delta.d.ts +104 -0
  68. package/dist/eval/engine/delta.d.ts.map +1 -0
  69. package/dist/eval/engine/delta.js +466 -0
  70. package/dist/eval/engine/delta.js.map +1 -0
  71. package/dist/eval/engine/deps.d.ts +136 -0
  72. package/dist/eval/engine/deps.d.ts.map +1 -0
  73. package/dist/eval/engine/deps.js +345 -0
  74. package/dist/eval/engine/deps.js.map +1 -0
  75. package/dist/eval/engine/identity.d.ts +128 -0
  76. package/dist/eval/engine/identity.d.ts.map +1 -0
  77. package/dist/eval/engine/identity.js +398 -0
  78. package/dist/eval/engine/identity.js.map +1 -0
  79. package/dist/eval/engine/index.d.ts +200 -0
  80. package/dist/eval/engine/index.d.ts.map +1 -0
  81. package/dist/eval/engine/index.js +1242 -0
  82. package/dist/eval/engine/index.js.map +1 -0
  83. package/dist/eval/engine/measurement.d.ts +23 -0
  84. package/dist/eval/engine/measurement.d.ts.map +1 -0
  85. package/dist/eval/engine/measurement.js +42 -0
  86. package/dist/eval/engine/measurement.js.map +1 -0
  87. package/dist/eval/engine/naive.d.ts +19 -0
  88. package/dist/eval/engine/naive.d.ts.map +1 -0
  89. package/dist/eval/engine/naive.js +59 -0
  90. package/dist/eval/engine/naive.js.map +1 -0
  91. package/dist/eval/engine/ops.d.ts +214 -0
  92. package/dist/eval/engine/ops.d.ts.map +1 -0
  93. package/dist/eval/engine/ops.js +1422 -0
  94. package/dist/eval/engine/ops.js.map +1 -0
  95. package/dist/eval/engine/patches.d.ts +40 -0
  96. package/dist/eval/engine/patches.d.ts.map +1 -0
  97. package/dist/eval/engine/patches.js +125 -0
  98. package/dist/eval/engine/patches.js.map +1 -0
  99. package/dist/eval/engine/ports.d.ts +71 -0
  100. package/dist/eval/engine/ports.d.ts.map +1 -0
  101. package/dist/eval/engine/ports.js +2 -0
  102. package/dist/eval/engine/ports.js.map +1 -0
  103. package/dist/eval/engine/session.d.ts +116 -0
  104. package/dist/eval/engine/session.d.ts.map +1 -0
  105. package/dist/eval/engine/session.js +653 -0
  106. package/dist/eval/engine/session.js.map +1 -0
  107. package/dist/eval/engine/snapshot.d.ts +97 -0
  108. package/dist/eval/engine/snapshot.d.ts.map +1 -0
  109. package/dist/eval/engine/snapshot.js +221 -0
  110. package/dist/eval/engine/snapshot.js.map +1 -0
  111. package/dist/eval/engine/subscriptions.d.ts +47 -0
  112. package/dist/eval/engine/subscriptions.d.ts.map +1 -0
  113. package/dist/eval/engine/subscriptions.js +103 -0
  114. package/dist/eval/engine/subscriptions.js.map +1 -0
  115. package/dist/eval/engine/trace.d.ts +77 -0
  116. package/dist/eval/engine/trace.d.ts.map +1 -0
  117. package/dist/eval/engine/trace.js +140 -0
  118. package/dist/eval/engine/trace.js.map +1 -0
  119. package/dist/eval/error-diagnostic.d.ts +26 -0
  120. package/dist/eval/error-diagnostic.d.ts.map +1 -0
  121. package/dist/eval/error-diagnostic.js +63 -0
  122. package/dist/eval/error-diagnostic.js.map +1 -0
  123. package/dist/eval/evaluate-expr.d.ts +44 -0
  124. package/dist/eval/evaluate-expr.d.ts.map +1 -0
  125. package/dist/eval/evaluate-expr.js +149 -0
  126. package/dist/eval/evaluate-expr.js.map +1 -0
  127. package/dist/eval/evaluate.d.ts +282 -0
  128. package/dist/eval/evaluate.d.ts.map +1 -0
  129. package/dist/eval/evaluate.js +391 -0
  130. package/dist/eval/evaluate.js.map +1 -0
  131. package/dist/eval/evolution/relocate.d.ts +72 -0
  132. package/dist/eval/evolution/relocate.d.ts.map +1 -0
  133. package/dist/eval/evolution/relocate.js +427 -0
  134. package/dist/eval/evolution/relocate.js.map +1 -0
  135. package/dist/eval/evolution/select.d.ts +11 -0
  136. package/dist/eval/evolution/select.d.ts.map +1 -0
  137. package/dist/eval/evolution/select.js +53 -0
  138. package/dist/eval/evolution/select.js.map +1 -0
  139. package/dist/eval/evolution/upcast.d.ts +13 -0
  140. package/dist/eval/evolution/upcast.d.ts.map +1 -0
  141. package/dist/eval/evolution/upcast.js +88 -0
  142. package/dist/eval/evolution/upcast.js.map +1 -0
  143. package/dist/eval/expr/aggregates.d.ts +75 -0
  144. package/dist/eval/expr/aggregates.d.ts.map +1 -0
  145. package/dist/eval/expr/aggregates.js +991 -0
  146. package/dist/eval/expr/aggregates.js.map +1 -0
  147. package/dist/eval/expr/arithmetic.d.ts +26 -0
  148. package/dist/eval/expr/arithmetic.d.ts.map +1 -0
  149. package/dist/eval/expr/arithmetic.js +387 -0
  150. package/dist/eval/expr/arithmetic.js.map +1 -0
  151. package/dist/eval/expr/between.d.ts +17 -0
  152. package/dist/eval/expr/between.d.ts.map +1 -0
  153. package/dist/eval/expr/between.js +46 -0
  154. package/dist/eval/expr/between.js.map +1 -0
  155. package/dist/eval/expr/binder.d.ts +96 -0
  156. package/dist/eval/expr/binder.d.ts.map +1 -0
  157. package/dist/eval/expr/binder.js +253 -0
  158. package/dist/eval/expr/binder.js.map +1 -0
  159. package/dist/eval/expr/call-dispatch.d.ts +28 -0
  160. package/dist/eval/expr/call-dispatch.d.ts.map +1 -0
  161. package/dist/eval/expr/call-dispatch.js +114 -0
  162. package/dist/eval/expr/call-dispatch.js.map +1 -0
  163. package/dist/eval/expr/collections.d.ts +20 -0
  164. package/dist/eval/expr/collections.d.ts.map +1 -0
  165. package/dist/eval/expr/collections.js +66 -0
  166. package/dist/eval/expr/collections.js.map +1 -0
  167. package/dist/eval/expr/compare.d.ts +36 -0
  168. package/dist/eval/expr/compare.d.ts.map +1 -0
  169. package/dist/eval/expr/compare.js +115 -0
  170. package/dist/eval/expr/compare.js.map +1 -0
  171. package/dist/eval/expr/datasets.d.ts +28 -0
  172. package/dist/eval/expr/datasets.d.ts.map +1 -0
  173. package/dist/eval/expr/datasets.js +304 -0
  174. package/dist/eval/expr/datasets.js.map +1 -0
  175. package/dist/eval/expr/digest.d.ts +23 -0
  176. package/dist/eval/expr/digest.d.ts.map +1 -0
  177. package/dist/eval/expr/digest.js +89 -0
  178. package/dist/eval/expr/digest.js.map +1 -0
  179. package/dist/eval/expr/domains.d.ts +19 -0
  180. package/dist/eval/expr/domains.d.ts.map +1 -0
  181. package/dist/eval/expr/domains.js +18 -0
  182. package/dist/eval/expr/domains.js.map +1 -0
  183. package/dist/eval/expr/host.d.ts +152 -0
  184. package/dist/eval/expr/host.d.ts.map +1 -0
  185. package/dist/eval/expr/host.js +36 -0
  186. package/dist/eval/expr/host.js.map +1 -0
  187. package/dist/eval/expr/lists.d.ts +24 -0
  188. package/dist/eval/expr/lists.d.ts.map +1 -0
  189. package/dist/eval/expr/lists.js +155 -0
  190. package/dist/eval/expr/lists.js.map +1 -0
  191. package/dist/eval/expr/member.d.ts +15 -0
  192. package/dist/eval/expr/member.d.ts.map +1 -0
  193. package/dist/eval/expr/member.js +32 -0
  194. package/dist/eval/expr/member.js.map +1 -0
  195. package/dist/eval/expr/money-ops.d.ts +10 -0
  196. package/dist/eval/expr/money-ops.d.ts.map +1 -0
  197. package/dist/eval/expr/money-ops.js +17 -0
  198. package/dist/eval/expr/money-ops.js.map +1 -0
  199. package/dist/eval/expr/operands.d.ts +27 -0
  200. package/dist/eval/expr/operands.d.ts.map +1 -0
  201. package/dist/eval/expr/operands.js +167 -0
  202. package/dist/eval/expr/operands.js.map +1 -0
  203. package/dist/eval/expr/presence.d.ts +27 -0
  204. package/dist/eval/expr/presence.d.ts.map +1 -0
  205. package/dist/eval/expr/presence.js +140 -0
  206. package/dist/eval/expr/presence.js.map +1 -0
  207. package/dist/eval/expr/records.d.ts +22 -0
  208. package/dist/eval/expr/records.d.ts.map +1 -0
  209. package/dist/eval/expr/records.js +101 -0
  210. package/dist/eval/expr/records.js.map +1 -0
  211. package/dist/eval/expr/rule-refs.d.ts +25 -0
  212. package/dist/eval/expr/rule-refs.d.ts.map +1 -0
  213. package/dist/eval/expr/rule-refs.js +60 -0
  214. package/dist/eval/expr/rule-refs.js.map +1 -0
  215. package/dist/eval/expr/sequences.d.ts +26 -0
  216. package/dist/eval/expr/sequences.d.ts.map +1 -0
  217. package/dist/eval/expr/sequences.js +151 -0
  218. package/dist/eval/expr/sequences.js.map +1 -0
  219. package/dist/eval/expr/value.d.ts +99 -0
  220. package/dist/eval/expr/value.d.ts.map +1 -0
  221. package/dist/eval/expr/value.js +14 -0
  222. package/dist/eval/expr/value.js.map +1 -0
  223. package/dist/eval/expression.d.ts +142 -0
  224. package/dist/eval/expression.d.ts.map +1 -0
  225. package/dist/eval/expression.js +446 -0
  226. package/dist/eval/expression.js.map +1 -0
  227. package/dist/eval/firing.d.ts +68 -0
  228. package/dist/eval/firing.d.ts.map +1 -0
  229. package/dist/eval/firing.js +222 -0
  230. package/dist/eval/firing.js.map +1 -0
  231. package/dist/eval/gate.d.ts +110 -0
  232. package/dist/eval/gate.d.ts.map +1 -0
  233. package/dist/eval/gate.js +278 -0
  234. package/dist/eval/gate.js.map +1 -0
  235. package/dist/eval/layout-visibility.d.ts +18 -0
  236. package/dist/eval/layout-visibility.d.ts.map +1 -0
  237. package/dist/eval/layout-visibility.js +61 -0
  238. package/dist/eval/layout-visibility.js.map +1 -0
  239. package/dist/eval/option-availability.d.ts +26 -0
  240. package/dist/eval/option-availability.d.ts.map +1 -0
  241. package/dist/eval/option-availability.js +580 -0
  242. package/dist/eval/option-availability.js.map +1 -0
  243. package/dist/eval/options-boundary.d.ts +15 -0
  244. package/dist/eval/options-boundary.d.ts.map +1 -0
  245. package/dist/eval/options-boundary.js +40 -0
  246. package/dist/eval/options-boundary.js.map +1 -0
  247. package/dist/eval/options.d.ts +99 -0
  248. package/dist/eval/options.d.ts.map +1 -0
  249. package/dist/eval/options.js +96 -0
  250. package/dist/eval/options.js.map +1 -0
  251. package/dist/eval/overrides.d.ts +116 -0
  252. package/dist/eval/overrides.d.ts.map +1 -0
  253. package/dist/eval/overrides.js +176 -0
  254. package/dist/eval/overrides.js.map +1 -0
  255. package/dist/eval/paths.d.ts +25 -0
  256. package/dist/eval/paths.d.ts.map +1 -0
  257. package/dist/eval/paths.js +47 -0
  258. package/dist/eval/paths.js.map +1 -0
  259. package/dist/eval/presentation-reads.d.ts +20 -0
  260. package/dist/eval/presentation-reads.d.ts.map +1 -0
  261. package/dist/eval/presentation-reads.js +2 -0
  262. package/dist/eval/presentation-reads.js.map +1 -0
  263. package/dist/eval/presentation.d.ts +122 -0
  264. package/dist/eval/presentation.d.ts.map +1 -0
  265. package/dist/eval/presentation.js +255 -0
  266. package/dist/eval/presentation.js.map +1 -0
  267. package/dist/eval/reader/context-value.d.ts +41 -0
  268. package/dist/eval/reader/context-value.d.ts.map +1 -0
  269. package/dist/eval/reader/context-value.js +129 -0
  270. package/dist/eval/reader/context-value.js.map +1 -0
  271. package/dist/eval/reader/covered.d.ts +53 -0
  272. package/dist/eval/reader/covered.d.ts.map +1 -0
  273. package/dist/eval/reader/covered.js +139 -0
  274. package/dist/eval/reader/covered.js.map +1 -0
  275. package/dist/eval/reader/declarations.d.ts +182 -0
  276. package/dist/eval/reader/declarations.d.ts.map +1 -0
  277. package/dist/eval/reader/declarations.js +153 -0
  278. package/dist/eval/reader/declarations.js.map +1 -0
  279. package/dist/eval/reader/member-access.d.ts +87 -0
  280. package/dist/eval/reader/member-access.d.ts.map +1 -0
  281. package/dist/eval/reader/member-access.js +212 -0
  282. package/dist/eval/reader/member-access.js.map +1 -0
  283. package/dist/eval/reader/memo.d.ts +34 -0
  284. package/dist/eval/reader/memo.d.ts.map +1 -0
  285. package/dist/eval/reader/memo.js +67 -0
  286. package/dist/eval/reader/memo.js.map +1 -0
  287. package/dist/eval/reader/overlay.d.ts +74 -0
  288. package/dist/eval/reader/overlay.d.ts.map +1 -0
  289. package/dist/eval/reader/overlay.js +365 -0
  290. package/dist/eval/reader/overlay.js.map +1 -0
  291. package/dist/eval/reader/questions.d.ts +37 -0
  292. package/dist/eval/reader/questions.d.ts.map +1 -0
  293. package/dist/eval/reader/questions.js +78 -0
  294. package/dist/eval/reader/questions.js.map +1 -0
  295. package/dist/eval/reader/resolve.d.ts +84 -0
  296. package/dist/eval/reader/resolve.d.ts.map +1 -0
  297. package/dist/eval/reader/resolve.js +310 -0
  298. package/dist/eval/reader/resolve.js.map +1 -0
  299. package/dist/eval/reader/value-read.d.ts +50 -0
  300. package/dist/eval/reader/value-read.d.ts.map +1 -0
  301. package/dist/eval/reader/value-read.js +133 -0
  302. package/dist/eval/reader/value-read.js.map +1 -0
  303. package/dist/eval/reader/withheld.d.ts +48 -0
  304. package/dist/eval/reader/withheld.d.ts.map +1 -0
  305. package/dist/eval/reader/withheld.js +108 -0
  306. package/dist/eval/reader/withheld.js.map +1 -0
  307. package/dist/eval/reader-paths.d.ts +24 -0
  308. package/dist/eval/reader-paths.d.ts.map +1 -0
  309. package/dist/eval/reader-paths.js +23 -0
  310. package/dist/eval/reader-paths.js.map +1 -0
  311. package/dist/eval/reader.d.ts +281 -0
  312. package/dist/eval/reader.d.ts.map +1 -0
  313. package/dist/eval/reader.js +560 -0
  314. package/dist/eval/reader.js.map +1 -0
  315. package/dist/eval/receipt.d.ts +37 -0
  316. package/dist/eval/receipt.d.ts.map +1 -0
  317. package/dist/eval/receipt.js +222 -0
  318. package/dist/eval/receipt.js.map +1 -0
  319. package/dist/eval/report/assemble.d.ts +84 -0
  320. package/dist/eval/report/assemble.d.ts.map +1 -0
  321. package/dist/eval/report/assemble.js +277 -0
  322. package/dist/eval/report/assemble.js.map +1 -0
  323. package/dist/eval/report/fold.d.ts +18 -0
  324. package/dist/eval/report/fold.d.ts.map +1 -0
  325. package/dist/eval/report/fold.js +58 -0
  326. package/dist/eval/report/fold.js.map +1 -0
  327. package/dist/eval/rule/alternatives.d.ts +23 -0
  328. package/dist/eval/rule/alternatives.d.ts.map +1 -0
  329. package/dist/eval/rule/alternatives.js +46 -0
  330. package/dist/eval/rule/alternatives.js.map +1 -0
  331. package/dist/eval/rule/behaviour.d.ts +47 -0
  332. package/dist/eval/rule/behaviour.d.ts.map +1 -0
  333. package/dist/eval/rule/behaviour.js +249 -0
  334. package/dist/eval/rule/behaviour.js.map +1 -0
  335. package/dist/eval/rule/compute.d.ts +46 -0
  336. package/dist/eval/rule/compute.d.ts.map +1 -0
  337. package/dist/eval/rule/compute.js +158 -0
  338. package/dist/eval/rule/compute.js.map +1 -0
  339. package/dist/eval/rule/create-state.d.ts +42 -0
  340. package/dist/eval/rule/create-state.d.ts.map +1 -0
  341. package/dist/eval/rule/create-state.js +134 -0
  342. package/dist/eval/rule/create-state.js.map +1 -0
  343. package/dist/eval/rule/diagnostics.d.ts +24 -0
  344. package/dist/eval/rule/diagnostics.d.ts.map +1 -0
  345. package/dist/eval/rule/diagnostics.js +45 -0
  346. package/dist/eval/rule/diagnostics.js.map +1 -0
  347. package/dist/eval/rule/execution.d.ts +24 -0
  348. package/dist/eval/rule/execution.d.ts.map +1 -0
  349. package/dist/eval/rule/execution.js +495 -0
  350. package/dist/eval/rule/execution.js.map +1 -0
  351. package/dist/eval/rule/gate.d.ts +12 -0
  352. package/dist/eval/rule/gate.d.ts.map +1 -0
  353. package/dist/eval/rule/gate.js +34 -0
  354. package/dist/eval/rule/gate.js.map +1 -0
  355. package/dist/eval/rule/item.d.ts +11 -0
  356. package/dist/eval/rule/item.d.ts.map +1 -0
  357. package/dist/eval/rule/item.js +265 -0
  358. package/dist/eval/rule/item.js.map +1 -0
  359. package/dist/eval/rule/prepare.d.ts +64 -0
  360. package/dist/eval/rule/prepare.d.ts.map +1 -0
  361. package/dist/eval/rule/prepare.js +131 -0
  362. package/dist/eval/rule/prepare.js.map +1 -0
  363. package/dist/eval/rule/result.d.ts +97 -0
  364. package/dist/eval/rule/result.d.ts.map +1 -0
  365. package/dist/eval/rule/result.js +347 -0
  366. package/dist/eval/rule/result.js.map +1 -0
  367. package/dist/eval/rule/runner.d.ts +128 -0
  368. package/dist/eval/rule/runner.d.ts.map +1 -0
  369. package/dist/eval/rule/runner.js +296 -0
  370. package/dist/eval/rule/runner.js.map +1 -0
  371. package/dist/eval/rule/screen.d.ts +32 -0
  372. package/dist/eval/rule/screen.d.ts.map +1 -0
  373. package/dist/eval/rule/screen.js +73 -0
  374. package/dist/eval/rule/screen.js.map +1 -0
  375. package/dist/eval/rule/state.d.ts +137 -0
  376. package/dist/eval/rule/state.d.ts.map +1 -0
  377. package/dist/eval/rule/state.js +2 -0
  378. package/dist/eval/rule/state.js.map +1 -0
  379. package/dist/eval/rule/steps.d.ts +44 -0
  380. package/dist/eval/rule/steps.d.ts.map +1 -0
  381. package/dist/eval/rule/steps.js +367 -0
  382. package/dist/eval/rule/steps.js.map +1 -0
  383. package/dist/eval/rule/visibility.d.ts +18 -0
  384. package/dist/eval/rule/visibility.d.ts.map +1 -0
  385. package/dist/eval/rule/visibility.js +79 -0
  386. package/dist/eval/rule/visibility.js.map +1 -0
  387. package/dist/eval/seal.d.ts +74 -0
  388. package/dist/eval/seal.d.ts.map +1 -0
  389. package/dist/eval/seal.js +154 -0
  390. package/dist/eval/seal.js.map +1 -0
  391. package/dist/eval/signature-coverage.d.ts +19 -0
  392. package/dist/eval/signature-coverage.d.ts.map +1 -0
  393. package/dist/eval/signature-coverage.js +160 -0
  394. package/dist/eval/signature-coverage.js.map +1 -0
  395. package/dist/eval/state/derive.d.ts +72 -0
  396. package/dist/eval/state/derive.d.ts.map +1 -0
  397. package/dist/eval/state/derive.js +61 -0
  398. package/dist/eval/state/derive.js.map +1 -0
  399. package/dist/eval/state/describe.d.ts +18 -0
  400. package/dist/eval/state/describe.d.ts.map +1 -0
  401. package/dist/eval/state/describe.js +19 -0
  402. package/dist/eval/state/describe.js.map +1 -0
  403. package/dist/eval/state/field-state.d.ts +471 -0
  404. package/dist/eval/state/field-state.d.ts.map +1 -0
  405. package/dist/eval/state/field-state.js +1604 -0
  406. package/dist/eval/state/field-state.js.map +1 -0
  407. package/dist/eval/state/measurement.d.ts +136 -0
  408. package/dist/eval/state/measurement.d.ts.map +1 -0
  409. package/dist/eval/state/measurement.js +209 -0
  410. package/dist/eval/state/measurement.js.map +1 -0
  411. package/dist/eval/state/options.d.ts +21 -0
  412. package/dist/eval/state/options.d.ts.map +1 -0
  413. package/dist/eval/state/options.js +3 -0
  414. package/dist/eval/state/options.js.map +1 -0
  415. package/dist/eval/state/readiness.d.ts +400 -0
  416. package/dist/eval/state/readiness.d.ts.map +1 -0
  417. package/dist/eval/state/readiness.js +1067 -0
  418. package/dist/eval/state/readiness.js.map +1 -0
  419. package/dist/eval/state/snapshot.d.ts +130 -0
  420. package/dist/eval/state/snapshot.d.ts.map +1 -0
  421. package/dist/eval/state/snapshot.js +35 -0
  422. package/dist/eval/state/snapshot.js.map +1 -0
  423. package/dist/eval/state/unavailable-options.d.ts +54 -0
  424. package/dist/eval/state/unavailable-options.d.ts.map +1 -0
  425. package/dist/eval/state/unavailable-options.js +82 -0
  426. package/dist/eval/state/unavailable-options.js.map +1 -0
  427. package/dist/eval/state/value-state.d.ts +38 -0
  428. package/dist/eval/state/value-state.d.ts.map +1 -0
  429. package/dist/eval/state/value-state.js +52 -0
  430. package/dist/eval/state/value-state.js.map +1 -0
  431. package/dist/eval/submission/admission.d.ts +50 -0
  432. package/dist/eval/submission/admission.d.ts.map +1 -0
  433. package/dist/eval/submission/admission.js +174 -0
  434. package/dist/eval/submission/admission.js.map +1 -0
  435. package/dist/eval/submission/authority.d.ts +71 -0
  436. package/dist/eval/submission/authority.d.ts.map +1 -0
  437. package/dist/eval/submission/authority.js +118 -0
  438. package/dist/eval/submission/authority.js.map +1 -0
  439. package/dist/eval/submission/datasets.d.ts +28 -0
  440. package/dist/eval/submission/datasets.d.ts.map +1 -0
  441. package/dist/eval/submission/datasets.js +109 -0
  442. package/dist/eval/submission/datasets.js.map +1 -0
  443. package/dist/eval/submission/index.d.ts +15 -0
  444. package/dist/eval/submission/index.d.ts.map +1 -0
  445. package/dist/eval/submission/index.js +13 -0
  446. package/dist/eval/submission/index.js.map +1 -0
  447. package/dist/eval/submission/refusals.d.ts +103 -0
  448. package/dist/eval/submission/refusals.d.ts.map +1 -0
  449. package/dist/eval/submission/refusals.js +15 -0
  450. package/dist/eval/submission/refusals.js.map +1 -0
  451. package/dist/eval/submission/signatures.d.ts +7 -0
  452. package/dist/eval/submission/signatures.d.ts.map +1 -0
  453. package/dist/eval/submission/signatures.js +215 -0
  454. package/dist/eval/submission/signatures.js.map +1 -0
  455. package/dist/eval/submission/writes.d.ts +51 -0
  456. package/dist/eval/submission/writes.d.ts.map +1 -0
  457. package/dist/eval/submission/writes.js +203 -0
  458. package/dist/eval/submission/writes.js.map +1 -0
  459. package/dist/eval/submission.d.ts +53 -0
  460. package/dist/eval/submission.d.ts.map +1 -0
  461. package/dist/eval/submission.js +521 -0
  462. package/dist/eval/submission.js.map +1 -0
  463. package/dist/eval/suggestions-to-engine.d.ts +18 -0
  464. package/dist/eval/suggestions-to-engine.d.ts.map +1 -0
  465. package/dist/eval/suggestions-to-engine.js +40 -0
  466. package/dist/eval/suggestions-to-engine.js.map +1 -0
  467. package/dist/eval/suggestions.d.ts +17 -0
  468. package/dist/eval/suggestions.d.ts.map +1 -0
  469. package/dist/eval/suggestions.js +314 -0
  470. package/dist/eval/suggestions.js.map +1 -0
  471. package/dist/eval/undecided.d.ts +64 -0
  472. package/dist/eval/undecided.d.ts.map +1 -0
  473. package/dist/eval/undecided.js +101 -0
  474. package/dist/eval/undecided.js.map +1 -0
  475. package/dist/eval/verdict.d.ts +66 -0
  476. package/dist/eval/verdict.d.ts.map +1 -0
  477. package/dist/eval/verdict.js +106 -0
  478. package/dist/eval/verdict.js.map +1 -0
  479. package/dist/eval/verify-signature.d.ts +78 -0
  480. package/dist/eval/verify-signature.d.ts.map +1 -0
  481. package/dist/eval/verify-signature.js +185 -0
  482. package/dist/eval/verify-signature.js.map +1 -0
  483. package/dist/eval/version-dispatch.d.ts +38 -0
  484. package/dist/eval/version-dispatch.d.ts.map +1 -0
  485. package/dist/eval/version-dispatch.js +61 -0
  486. package/dist/eval/version-dispatch.js.map +1 -0
  487. package/dist/eval/visibility.d.ts +33 -0
  488. package/dist/eval/visibility.d.ts.map +1 -0
  489. package/dist/eval/visibility.js +83 -0
  490. package/dist/eval/visibility.js.map +1 -0
  491. package/dist/evaluate.d.ts +24 -0
  492. package/dist/evaluate.d.ts.map +1 -0
  493. package/dist/evaluate.js +18 -0
  494. package/dist/evaluate.js.map +1 -0
  495. package/dist/expr/builtin-docs.d.ts +51 -0
  496. package/dist/expr/builtin-docs.d.ts.map +1 -0
  497. package/dist/expr/builtin-docs.js +874 -0
  498. package/dist/expr/builtin-docs.js.map +1 -0
  499. package/dist/expr/builtins.d.ts +50 -0
  500. package/dist/expr/builtins.d.ts.map +1 -0
  501. package/dist/expr/builtins.js +966 -0
  502. package/dist/expr/builtins.js.map +1 -0
  503. package/dist/expr/decimal-precision.d.ts +39 -0
  504. package/dist/expr/decimal-precision.d.ts.map +1 -0
  505. package/dist/expr/decimal-precision.js +62 -0
  506. package/dist/expr/decimal-precision.js.map +1 -0
  507. package/dist/expr/decimal.d.ts +172 -0
  508. package/dist/expr/decimal.d.ts.map +1 -0
  509. package/dist/expr/decimal.js +782 -0
  510. package/dist/expr/decimal.js.map +1 -0
  511. package/dist/expr/deprecations.d.ts +34 -0
  512. package/dist/expr/deprecations.d.ts.map +1 -0
  513. package/dist/expr/deprecations.js +17 -0
  514. package/dist/expr/deprecations.js.map +1 -0
  515. package/dist/expr/diagnostics.d.ts +21 -0
  516. package/dist/expr/diagnostics.d.ts.map +1 -0
  517. package/dist/expr/diagnostics.js +231 -0
  518. package/dist/expr/diagnostics.js.map +1 -0
  519. package/dist/expr/direction.d.ts +30 -0
  520. package/dist/expr/direction.d.ts.map +1 -0
  521. package/dist/expr/direction.js +77 -0
  522. package/dist/expr/direction.js.map +1 -0
  523. package/dist/expr/example-expression.d.ts +62 -0
  524. package/dist/expr/example-expression.d.ts.map +1 -0
  525. package/dist/expr/example-expression.js +670 -0
  526. package/dist/expr/example-expression.js.map +1 -0
  527. package/dist/expr/instant.d.ts +49 -0
  528. package/dist/expr/instant.d.ts.map +1 -0
  529. package/dist/expr/instant.js +111 -0
  530. package/dist/expr/instant.js.map +1 -0
  531. package/dist/expr/logic.d.ts +17 -0
  532. package/dist/expr/logic.d.ts.map +1 -0
  533. package/dist/expr/logic.js +65 -0
  534. package/dist/expr/logic.js.map +1 -0
  535. package/dist/expr/messages.d.ts +45 -0
  536. package/dist/expr/messages.d.ts.map +1 -0
  537. package/dist/expr/messages.js +280 -0
  538. package/dist/expr/messages.js.map +1 -0
  539. package/dist/expr/money.d.ts +38 -0
  540. package/dist/expr/money.d.ts.map +1 -0
  541. package/dist/expr/money.js +127 -0
  542. package/dist/expr/money.js.map +1 -0
  543. package/dist/expr/ordering.d.ts +56 -0
  544. package/dist/expr/ordering.d.ts.map +1 -0
  545. package/dist/expr/ordering.js +167 -0
  546. package/dist/expr/ordering.js.map +1 -0
  547. package/dist/expr/pattern.d.ts +44 -0
  548. package/dist/expr/pattern.d.ts.map +1 -0
  549. package/dist/expr/pattern.js +458 -0
  550. package/dist/expr/pattern.js.map +1 -0
  551. package/dist/expr/plain-date.d.ts +90 -0
  552. package/dist/expr/plain-date.d.ts.map +1 -0
  553. package/dist/expr/plain-date.js +230 -0
  554. package/dist/expr/plain-date.js.map +1 -0
  555. package/dist/expr/plural-categories.d.ts +8 -0
  556. package/dist/expr/plural-categories.d.ts.map +1 -0
  557. package/dist/expr/plural-categories.js +15 -0
  558. package/dist/expr/plural-categories.js.map +1 -0
  559. package/dist/expr/plural-keys.d.ts +39 -0
  560. package/dist/expr/plural-keys.d.ts.map +1 -0
  561. package/dist/expr/plural-keys.js +46 -0
  562. package/dist/expr/plural-keys.js.map +1 -0
  563. package/dist/expr/plural.d.ts +33 -0
  564. package/dist/expr/plural.d.ts.map +1 -0
  565. package/dist/expr/plural.js +50 -0
  566. package/dist/expr/plural.js.map +1 -0
  567. package/dist/expr/quantity.d.ts +31 -0
  568. package/dist/expr/quantity.d.ts.map +1 -0
  569. package/dist/expr/quantity.js +83 -0
  570. package/dist/expr/quantity.js.map +1 -0
  571. package/dist/expr/reduce.d.ts +50 -0
  572. package/dist/expr/reduce.d.ts.map +1 -0
  573. package/dist/expr/reduce.js +236 -0
  574. package/dist/expr/reduce.js.map +1 -0
  575. package/dist/expr/regex.d.ts +108 -0
  576. package/dist/expr/regex.d.ts.map +1 -0
  577. package/dist/expr/regex.js +1210 -0
  578. package/dist/expr/regex.js.map +1 -0
  579. package/dist/expr/select-locale.d.ts +67 -0
  580. package/dist/expr/select-locale.d.ts.map +1 -0
  581. package/dist/expr/select-locale.js +219 -0
  582. package/dist/expr/select-locale.js.map +1 -0
  583. package/dist/expr/sequences.d.ts +123 -0
  584. package/dist/expr/sequences.d.ts.map +1 -0
  585. package/dist/expr/sequences.js +234 -0
  586. package/dist/expr/sequences.js.map +1 -0
  587. package/dist/expr/strings.d.ts +50 -0
  588. package/dist/expr/strings.d.ts.map +1 -0
  589. package/dist/expr/strings.js +184 -0
  590. package/dist/expr/strings.js.map +1 -0
  591. package/dist/expr/validation.d.ts +32 -0
  592. package/dist/expr/validation.d.ts.map +1 -0
  593. package/dist/expr/validation.js +182 -0
  594. package/dist/expr/validation.js.map +1 -0
  595. package/dist/graph/freeze.d.ts +4 -0
  596. package/dist/graph/freeze.d.ts.map +1 -0
  597. package/dist/graph/freeze.js +52 -0
  598. package/dist/graph/freeze.js.map +1 -0
  599. package/dist/graph/index.d.ts +15 -0
  600. package/dist/graph/index.d.ts.map +1 -0
  601. package/dist/graph/index.js +13 -0
  602. package/dist/graph/index.js.map +1 -0
  603. package/dist/graph/inspect.d.ts +76 -0
  604. package/dist/graph/inspect.d.ts.map +1 -0
  605. package/dist/graph/inspect.js +263 -0
  606. package/dist/graph/inspect.js.map +1 -0
  607. package/dist/graph/read-walk.d.ts +101 -0
  608. package/dist/graph/read-walk.d.ts.map +1 -0
  609. package/dist/graph/read-walk.js +358 -0
  610. package/dist/graph/read-walk.js.map +1 -0
  611. package/dist/graph/record-index.d.ts +24 -0
  612. package/dist/graph/record-index.d.ts.map +1 -0
  613. package/dist/graph/record-index.js +35 -0
  614. package/dist/graph/record-index.js.map +1 -0
  615. package/dist/index.d.ts +104 -0
  616. package/dist/index.d.ts.map +1 -0
  617. package/dist/index.js +139 -0
  618. package/dist/index.js.map +1 -0
  619. package/dist/lookup/digest.d.ts +51 -0
  620. package/dist/lookup/digest.d.ts.map +1 -0
  621. package/dist/lookup/digest.js +46 -0
  622. package/dist/lookup/digest.js.map +1 -0
  623. package/dist/lookup/index.d.ts +28 -0
  624. package/dist/lookup/index.d.ts.map +1 -0
  625. package/dist/lookup/index.js +27 -0
  626. package/dist/lookup/index.js.map +1 -0
  627. package/dist/lookup/install.d.ts +48 -0
  628. package/dist/lookup/install.d.ts.map +1 -0
  629. package/dist/lookup/install.js +315 -0
  630. package/dist/lookup/install.js.map +1 -0
  631. package/dist/lookup/pass.d.ts +55 -0
  632. package/dist/lookup/pass.d.ts.map +1 -0
  633. package/dist/lookup/pass.js +212 -0
  634. package/dist/lookup/pass.js.map +1 -0
  635. package/dist/lookup/pins.d.ts +34 -0
  636. package/dist/lookup/pins.d.ts.map +1 -0
  637. package/dist/lookup/pins.js +39 -0
  638. package/dist/lookup/pins.js.map +1 -0
  639. package/dist/lookup/provenance.d.ts +23 -0
  640. package/dist/lookup/provenance.d.ts.map +1 -0
  641. package/dist/lookup/provenance.js +78 -0
  642. package/dist/lookup/provenance.js.map +1 -0
  643. package/dist/lookup/readiness.d.ts +13 -0
  644. package/dist/lookup/readiness.d.ts.map +1 -0
  645. package/dist/lookup/readiness.js +57 -0
  646. package/dist/lookup/readiness.js.map +1 -0
  647. package/dist/lookup/resolve.d.ts +24 -0
  648. package/dist/lookup/resolve.d.ts.map +1 -0
  649. package/dist/lookup/resolve.js +201 -0
  650. package/dist/lookup/resolve.js.map +1 -0
  651. package/dist/lookup/store.d.ts +41 -0
  652. package/dist/lookup/store.d.ts.map +1 -0
  653. package/dist/lookup/store.js +74 -0
  654. package/dist/lookup/store.js.map +1 -0
  655. package/dist/model/access.d.ts +200 -0
  656. package/dist/model/access.d.ts.map +1 -0
  657. package/dist/model/access.js +125 -0
  658. package/dist/model/access.js.map +1 -0
  659. package/dist/model/artifact-members.d.ts +3 -0
  660. package/dist/model/artifact-members.d.ts.map +1 -0
  661. package/dist/model/artifact-members.js +38 -0
  662. package/dist/model/artifact-members.js.map +1 -0
  663. package/dist/model/composition.d.ts +47 -0
  664. package/dist/model/composition.d.ts.map +1 -0
  665. package/dist/model/composition.js +66 -0
  666. package/dist/model/composition.js.map +1 -0
  667. package/dist/model/domain.d.ts +51 -0
  668. package/dist/model/domain.d.ts.map +1 -0
  669. package/dist/model/domain.js +75 -0
  670. package/dist/model/domain.js.map +1 -0
  671. package/dist/model/duration.d.ts +31 -0
  672. package/dist/model/duration.d.ts.map +1 -0
  673. package/dist/model/duration.js +136 -0
  674. package/dist/model/duration.js.map +1 -0
  675. package/dist/model/errors.d.ts +58 -0
  676. package/dist/model/errors.d.ts.map +1 -0
  677. package/dist/model/errors.js +81 -0
  678. package/dist/model/errors.js.map +1 -0
  679. package/dist/model/evolution.d.ts +177 -0
  680. package/dist/model/evolution.d.ts.map +1 -0
  681. package/dist/model/evolution.js +5 -0
  682. package/dist/model/evolution.js.map +1 -0
  683. package/dist/model/expr-children.d.ts +15 -0
  684. package/dist/model/expr-children.d.ts.map +1 -0
  685. package/dist/model/expr-children.js +45 -0
  686. package/dist/model/expr-children.js.map +1 -0
  687. package/dist/model/guards.d.ts +9 -0
  688. package/dist/model/guards.d.ts.map +1 -0
  689. package/dist/model/guards.js +11 -0
  690. package/dist/model/guards.js.map +1 -0
  691. package/dist/model/input.d.ts +42 -0
  692. package/dist/model/input.d.ts.map +1 -0
  693. package/dist/model/input.js +26 -0
  694. package/dist/model/input.js.map +1 -0
  695. package/dist/model/integer.d.ts +14 -0
  696. package/dist/model/integer.d.ts.map +1 -0
  697. package/dist/model/integer.js +16 -0
  698. package/dist/model/integer.js.map +1 -0
  699. package/dist/model/intrinsic.d.ts +18 -0
  700. package/dist/model/intrinsic.d.ts.map +1 -0
  701. package/dist/model/intrinsic.js +21 -0
  702. package/dist/model/intrinsic.js.map +1 -0
  703. package/dist/model/layout.d.ts +129 -0
  704. package/dist/model/layout.d.ts.map +1 -0
  705. package/dist/model/layout.js +2 -0
  706. package/dist/model/layout.js.map +1 -0
  707. package/dist/model/media.d.ts +33 -0
  708. package/dist/model/media.d.ts.map +1 -0
  709. package/dist/model/media.js +86 -0
  710. package/dist/model/media.js.map +1 -0
  711. package/dist/model/members.generated.d.ts +11 -0
  712. package/dist/model/members.generated.d.ts.map +1 -0
  713. package/dist/model/members.generated.js +71 -0
  714. package/dist/model/members.generated.js.map +1 -0
  715. package/dist/model/row-address.d.ts +27 -0
  716. package/dist/model/row-address.d.ts.map +1 -0
  717. package/dist/model/row-address.js +146 -0
  718. package/dist/model/row-address.js.map +1 -0
  719. package/dist/model/schema.d.ts +108 -0
  720. package/dist/model/schema.d.ts.map +1 -0
  721. package/dist/model/schema.js +2 -0
  722. package/dist/model/schema.js.map +1 -0
  723. package/dist/model/shape.d.ts +193 -0
  724. package/dist/model/shape.d.ts.map +1 -0
  725. package/dist/model/shape.js +2 -0
  726. package/dist/model/shape.js.map +1 -0
  727. package/dist/model/time.d.ts +61 -0
  728. package/dist/model/time.d.ts.map +1 -0
  729. package/dist/model/time.js +110 -0
  730. package/dist/model/time.js.map +1 -0
  731. package/dist/model/types.d.ts +1329 -0
  732. package/dist/model/types.d.ts.map +1 -0
  733. package/dist/model/types.js +424 -0
  734. package/dist/model/types.js.map +1 -0
  735. package/dist/model/values.d.ts +91 -0
  736. package/dist/model/values.d.ts.map +1 -0
  737. package/dist/model/values.js +195 -0
  738. package/dist/model/values.js.map +1 -0
  739. package/dist/model/wire.d.ts +356 -0
  740. package/dist/model/wire.d.ts.map +1 -0
  741. package/dist/model/wire.js +1504 -0
  742. package/dist/model/wire.js.map +1 -0
  743. package/dist/offline/index.d.ts +374 -0
  744. package/dist/offline/index.d.ts.map +1 -0
  745. package/dist/offline/index.js +422 -0
  746. package/dist/offline/index.js.map +1 -0
  747. package/dist/testing.d.ts +30 -0
  748. package/dist/testing.d.ts.map +1 -0
  749. package/dist/testing.js +42 -0
  750. package/dist/testing.js.map +1 -0
  751. package/dist/version.d.ts +30 -0
  752. package/dist/version.d.ts.map +1 -0
  753. package/dist/version.js +116 -0
  754. package/dist/version.js.map +1 -0
  755. package/package.json +98 -3
@@ -0,0 +1,78 @@
1
+ /**
2
+ * A canonical plain copy of `value`: every profile violation is refused with the path and
3
+ * the offending class of value, and the copy is a plain
4
+ * tree that hashing and reporting can consume without a second walk. Callers that read
5
+ * untrusted values use this as the single implementation of the restricted profile.
6
+ */
7
+ export declare function copyRestricted(value: unknown, path?: string): unknown;
8
+ /** The number of restricted canonicalisations since the process started. */
9
+ export declare function restrictedCanonicalizations(): number;
10
+ /**
11
+ * RFC 8785 text for a value that already satisfies the restricted profile, or a
12
+ * refusal naming the path and the offending class of value.
13
+ */
14
+ export declare function canonicalizeRestricted(value: unknown): string;
15
+ /**
16
+ * RFC 8785 text for a value the engine itself built.
17
+ *
18
+ * This is the trusted entry, and `canonicalizeRestricted` above stays the profile's only
19
+ * parser and validator: the caller promises the work is already done.
20
+ *
21
+ * The caller promises all of:
22
+ *
23
+ * - every leaf is a canonical wire value — no `undefined`, no `-0`, no NaN, no non-integer
24
+ * or unsafe integer, no `BigInt`, no function, no symbol;
25
+ * - every object is a plain object carrying only enumerable own data members, so no
26
+ * accessor, no symbol key, no callable `toJSON`, no class instance, no `Decimal`;
27
+ * - every array is dense and carries no property other than its indices and `length`;
28
+ * - the tree is acyclic;
29
+ * - no string or member name holds an unpaired surrogate.
30
+ *
31
+ * Each promise is kept by a different authority before a report is assembled: the wire
32
+ * reader copies and validates every record value it hands out, a writer's result is
33
+ * rendered against its target declaration before the overlay holds it, and the artifact's
34
+ * own identifiers were checked by the compiler. `test/fuzz/restricted-json.test.ts` proves the
35
+ * bytes are the ones `canonicalizeRestricted` produces for every generated wire value, and
36
+ * `test/corpus/vector-parity.test.ts` proves them against the shipped vectors.
37
+ */
38
+ export declare function canonicalizeOwned(value: unknown): string;
39
+ /** Lower-case hexadecimal SHA-256 of raw bytes. */
40
+ export declare function sha256HexOfBytes(bytes: Uint8Array): string;
41
+ /**
42
+ * Lower-case hexadecimal SHA-256 of `text`'s UTF-8 bytes. A lone surrogate has no UTF-8
43
+ * encoding — the encoder would substitute a replacement character, making two distinct
44
+ * strings hash alike — so it is refused rather than encoded.
45
+ */
46
+ export declare function sha256Hex(text: string): string;
47
+ /**
48
+ * The UTF-8 bytes of a string, for a caller holding text and a byte contract.
49
+ *
50
+ * `verifyArtifactHash` checks bytes, and a client's only copy of an artifact is usually text.
51
+ * The runtime ships its own encoder rather than reading a platform `TextEncoder`, because the
52
+ * Hermes build the bindings target is not required to provide one.
53
+ */
54
+ export declare function utf8BytesOf(text: string): Uint8Array;
55
+ /**
56
+ * Lower-case hexadecimal SHA-256 of a value's restricted canonical form.
57
+ *
58
+ * The encoding reads the text directly rather than through `sha256Hex`, which scans for an
59
+ * unpaired surrogate: `canonicalizeRestricted` refused one at every string leaf and every member
60
+ * name (`checkedString`) before the text existed, so the scan would re-walk text the copy just
61
+ * proved clean. The refusal path is unchanged — a value carrying one never reaches this line —
62
+ * and `canonicalHashOwned` hashes its text the same way for the same reason. `sha256Hex` stays
63
+ * the entry for text a caller has not already held to the profile.
64
+ */
65
+ export declare function canonicalHash(value: unknown): string;
66
+ /**
67
+ * Lower-case hexadecimal SHA-256 of an owned value's canonical form, for a value that keeps
68
+ * every promise `canonicalizeOwned` states.
69
+ *
70
+ * `sha256Hex` scans the text for an unpaired surrogate because the UTF-8 encoder would
71
+ * substitute a replacement character and two distinct values would hash alike. An owned
72
+ * value has no such string — the wire reader refuses one at the boundary — so the scan is
73
+ * a second walk over bytes that were just checked, and this entry hashes them directly.
74
+ */
75
+ export declare function canonicalHashOwned(value: unknown): string;
76
+ export { parseRestrictedJson } from './restricted-json.js';
77
+ export * from './restricted-value.js';
78
+ //# sourceMappingURL=jcs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jcs.d.ts","sourceRoot":"","sources":["../../src/canonical/jcs.ts"],"names":[],"mappings":"AA6QA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAM,GAAG,OAAO,CAElE;AAiID,4EAA4E;AAC5E,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAO7D;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAWxD;AAgHD,mDAAmD;AACnD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU9C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAUpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEzD;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,500 @@
1
+ import { sha256 } from '@noble/hashes/sha2.js';
2
+ import { bytesToHex } from '@noble/hashes/utils.js';
3
+ import { Decimal } from 'decimal.js';
4
+ import { AxiomError } from '../model/errors.js';
5
+ import { isSafeInteger } from '../model/integer.js';
6
+ import { MAX_NESTING_DEPTH, closeList, describePrototype, emptyList, hasUnpairedSurrogate, objectShapeViolation, prototypeOf, setOwn, tooDeep, } from './restricted.js';
7
+ /**
8
+ * Restricted canonical JSON, `spec/semantics/canonical-v1.md` section 1.
9
+ *
10
+ * The profile is closed: a value outside it is refused with the path and the class of
11
+ * value found, never repaired. A silent coercion would produce a hash that no
12
+ * independent implementation could reproduce.
13
+ */
14
+ function refuse(path, kind, remedy) {
15
+ throw new AxiomError('ENGINE_ERROR', `restricted JSON refuses ${kind}`, path, `restricted JSON refuses ${kind}; ${remedy}`);
16
+ }
17
+ function refuseDepth(path) {
18
+ const kind = `nesting deeper than ${String(MAX_NESTING_DEPTH)} levels`;
19
+ throw new AxiomError('ENGINE_ERROR', `restricted JSON refuses ${kind}`, path, `restricted JSON refuses ${kind}; flatten the value so nesting stays within ${String(MAX_NESTING_DEPTH)} levels`);
20
+ }
21
+ /** An own property that cannot be represented as a JSON member or a JSON element. */
22
+ function checkObjectShape(value, path) {
23
+ const violation = objectShapeViolation(value);
24
+ if (violation !== undefined)
25
+ refuse(path, violation, 'carry members as enumerable data under string names and without a callable toJSON; the profile admits data records only');
26
+ return Object.getOwnPropertyNames(value);
27
+ }
28
+ /**
29
+ * A record to fill. A `plain` copy is an ordinary object, because the caller that stores it
30
+ * reads it far more often than the walk writes it and `Object.create(null)` would leave it in
31
+ * dictionary mode; `setOwn` makes that fill safe. A `shielded` record is the serialiser's
32
+ * input and carries no prototype at all, so no inherited member can reach the serialiser.
33
+ */
34
+ function emptyRecord(shape) {
35
+ // `Object.create(null)` is the one expression the standard library types as `any`; the
36
+ // assertion records the record it builds rather than widening the copy's type.
37
+ return shape === 'shielded' ? Object.create(null) : {};
38
+ }
39
+ /** Whether the value wraps a primitive rather than carrying a plain record. */
40
+ function isBoxedPrimitive(value) {
41
+ return (value instanceof String ||
42
+ value instanceof Number ||
43
+ value instanceof Boolean ||
44
+ value instanceof Symbol ||
45
+ value instanceof BigInt);
46
+ }
47
+ function checkedString(value, path) {
48
+ // A lone surrogate has no UTF-8 encoding, so hashing it would hash replacement
49
+ // characters and two distinct values would collide.
50
+ if (hasUnpairedSurrogate(value))
51
+ refuse(path, 'a string with an unpaired surrogate', 'state the string with paired surrogates or escape the lone unit; the profile admits only strings with UTF-8 form');
52
+ return value;
53
+ }
54
+ function isArrayValue(value) {
55
+ return Array.isArray(value);
56
+ }
57
+ function ownValue(value, key) {
58
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
59
+ return descriptor === undefined ? undefined : descriptor.value;
60
+ }
61
+ function copyArray(value, path, seen, depth, shape) {
62
+ // The bound counts containers, so it is checked where one is opened. Counting values
63
+ // instead would admit an empty innermost container the profile refuses.
64
+ if (tooDeep(depth + 1))
65
+ refuseDepth(path);
66
+ // An `Array` subclass carries a prototype whose behaviour a canonical form would not
67
+ // preserve, so it is refused like any other non-plain object.
68
+ if (Reflect.getPrototypeOf(value) !== Array.prototype)
69
+ refuse(path, 'an Array subclass', 'use a plain array; the profile admits dense arrays with the ordinary prototype and no extra members');
70
+ const names = checkObjectShape(value, path);
71
+ const copy = emptyList();
72
+ for (let index = 0; index < value.length; index += 1) {
73
+ const childPath = `${path}[${String(index)}]`;
74
+ if (!Object.hasOwn(value, index))
75
+ refuse(childPath, 'a sparse array', 'state every index from 0 to length minus 1; the profile admits dense arrays only');
76
+ copy[index] = copyValue(value[index], childPath, seen, depth + 1, shape);
77
+ }
78
+ if (names.length !== value.length + 1)
79
+ refuse(path, 'a non-index array property', 'carry only indices and length on an array; the profile admits no extra array members');
80
+ closeList(copy, shape);
81
+ return copy;
82
+ }
83
+ function copyRecord(value, path, seen, depth, shape) {
84
+ if (tooDeep(depth + 1))
85
+ refuseDepth(path);
86
+ if (value instanceof Decimal)
87
+ refuse(path, 'a Decimal instance', 'carry a decimal as a string, such as "1.5"; the profile admits strings, not class instances');
88
+ if (isBoxedPrimitive(value))
89
+ refuse(path, 'a boxed primitive', 'carry the primitive value itself; the profile admits strings, booleans and safe integers, not wrappers');
90
+ // Refuse a custom prototype before reading any of its property behaviour.
91
+ const prototype = prototypeOf(value);
92
+ if (prototype !== Object.prototype && prototype !== null) {
93
+ refuse(path, describePrototype(value), 'use a plain object or one with no prototype; the profile admits records with Object.prototype or no prototype only');
94
+ }
95
+ const copy = emptyRecord(shape);
96
+ for (const key of checkObjectShape(value, path)) {
97
+ const childPath = `${path}.${key}`;
98
+ setOwn(copy, checkedString(key, childPath), copyValue(ownValue(value, key), childPath, seen, depth + 1, shape));
99
+ }
100
+ return copy;
101
+ }
102
+ function copyValue(value, path, seen, depth, shape) {
103
+ switch (typeof value) {
104
+ case 'string':
105
+ return checkedString(value, path);
106
+ case 'boolean':
107
+ return value;
108
+ case 'number':
109
+ if (Object.is(value, -0))
110
+ refuse(path, 'negative zero', 'write 0 instead; the profile admits the integer 0, never negative zero');
111
+ if (!Number.isFinite(value))
112
+ refuse(path, 'NaN or Infinity', 'state a safe integer or omit the member; the profile admits finite integers only');
113
+ if (!Number.isInteger(value)) {
114
+ // The repair, not only the fact: a host that serialises a decimal as a JSON number hits
115
+ // this on its first document, and the answer is to carry it as a string. The clause
116
+ // stays in the message because the submission boundary reports the message verbatim;
117
+ // the detail adds the admitted set beside it.
118
+ refuse(path, 'a non-integer number — carry a decimal as a string, such as "1.5"', 'the profile admits safe integers, and decimal text only as strings');
119
+ }
120
+ if (!isSafeInteger(value))
121
+ refuse(path, 'an unsafe integer', 'keep the integer inside -(2^53 - 1)..(2^53 - 1); the profile admits safe integers only');
122
+ return value;
123
+ case 'bigint':
124
+ return refuse(path, 'BigInt', 'carry the value as a string or a safe integer; the profile admits no BigInt values');
125
+ case 'undefined':
126
+ return refuse(path, 'undefined', 'omit the member or state null; the profile admits null, never undefined');
127
+ case 'function':
128
+ return refuse(path, 'a function', 'omit the member; the profile admits data only, never functions');
129
+ case 'symbol':
130
+ return refuse(path, 'a symbol', 'use a string instead; the profile admits strings, never symbols');
131
+ case 'object': {
132
+ if (value === null)
133
+ return null;
134
+ if (seen.has(value))
135
+ refuse(path, 'a cycle', 'repeat the shared subtree at each place or omit the repeated member; the profile admits trees, never cycles');
136
+ // One ancestor set with backtracking: copying the set per node would make the walk
137
+ // O(nodes x depth) and allocate a set at every level of a nested record.
138
+ seen.add(value);
139
+ const copy = isArrayValue(value)
140
+ ? copyArray(value, path, seen, depth, shape)
141
+ : copyRecord(value, path, seen, depth, shape);
142
+ seen.delete(value);
143
+ return copy;
144
+ }
145
+ }
146
+ }
147
+ /**
148
+ * A canonical plain copy of `value`: every profile violation is refused with the path and
149
+ * the offending class of value, and the copy is a plain
150
+ * tree that hashing and reporting can consume without a second walk. Callers that read
151
+ * untrusted values use this as the single implementation of the restricted profile.
152
+ */
153
+ export function copyRestricted(value, path = '$') {
154
+ return copyValue(value, path, new Set(), 0, 'plain');
155
+ }
156
+ /**
157
+ * The copy the serialiser is handed: the same tree, built on containers with no prototype.
158
+ *
159
+ * The serialiser below reads only own members and array indices, so a host that assigned
160
+ * `Object.prototype.toJSON`, `Array.prototype.toJSON` or any other inherited name cannot
161
+ * replace a container in the document: records carry no prototype at all, and an array is read
162
+ * by index and `length`, so nothing on its prototype contributes to the text. The bytes the
163
+ * engine commits to are a function of the copied data alone. The copy a caller receives keeps
164
+ * its ordinary prototypes, because it is a value rather than a serialisation input.
165
+ */
166
+ function shieldedCopy(value) {
167
+ return copyValue(value, '$', new Set(), 0, 'shielded');
168
+ }
169
+ /**
170
+ * RFC 8785 text for one shielded value, or `undefined` for a value with no JSON form.
171
+ *
172
+ * The tree the copy built is already restricted: `null`, booleans, safe integers, strings with
173
+ * no unpaired surrogate, dense arrays and records with own enumerable members. So the
174
+ * serializer can be small and total over that tree, and — this is the point — it never reads a
175
+ * prototype method: array elements are read by index, record members by `Object.keys`, and
176
+ * strings and numbers by the platform's JSON-safe spellings.
177
+ *
178
+ * This is hand-rolled for two constraints the adopted `canonicalize` library could not meet.
179
+ * Its 5.x line calls `String.prototype.isWellFormed`, an ES2024 method the ES2023 / Hermes V1
180
+ * target does not provide. Its 4.x line reads `toJSON` through the prototype chain and calls
181
+ * `Array.prototype.map`, so an inherited name on a container — the exact ambient dependence the
182
+ * shielded copy exists to exclude — could decide the bytes. A hard floor and the shield are both
183
+ * non-negotiable, so the serializer lives here and the dependency is gone; `canonical.test.ts`
184
+ * pins the bytes from vectors the serializer did not produce.
185
+ *
186
+ * A number is written with `String`, which is the same ECMAScript number-to-string RFC 8785
187
+ * names; every non-integer, unsafe integer, `-0`, NaN and infinity was refused by the copy.
188
+ * A string is written with `JSON.stringify`, which is the RFC's own quote rule and escapes
189
+ * control characters without escaping non-ASCII. `Object.keys(...).sort()` orders by UTF-16
190
+ * code unit, the order JCS requires, and the copy has already refused a non-index array
191
+ * property and a sparse array.
192
+ */
193
+ function serializeShielded(value, path) {
194
+ if (value === null)
195
+ return 'null';
196
+ switch (typeof value) {
197
+ case 'string':
198
+ return JSON.stringify(value);
199
+ case 'number':
200
+ return String(value);
201
+ case 'boolean':
202
+ return value ? 'true' : 'false';
203
+ case 'object':
204
+ return isArrayValue(value) ? serializeList(value, path) : serializeRecord(value, path);
205
+ default:
206
+ // A value the trusted copy passed through unchanged: no JSON form, refused by the
207
+ // caller with the path that reached it.
208
+ return undefined;
209
+ }
210
+ }
211
+ function serializeList(items, path) {
212
+ let text = '[';
213
+ for (let index = 0; index < items.length; index += 1) {
214
+ if (index > 0)
215
+ text += ',';
216
+ const at = `${path}[${String(index)}]`;
217
+ const element = serializeShielded(items[index], at);
218
+ if (element === undefined)
219
+ throw brokenPromise(at, items[index]);
220
+ text += element;
221
+ }
222
+ return `${text}]`;
223
+ }
224
+ function serializeRecord(record, path) {
225
+ const names = Object.keys(record).sort();
226
+ let text = '{';
227
+ let first = true;
228
+ for (const name of names) {
229
+ const member = Reflect.get(record, name);
230
+ const at = `${path}.${name}`;
231
+ const spelled = serializeShielded(member, at);
232
+ if (spelled === undefined)
233
+ throw brokenPromise(at, member);
234
+ text += first ? '' : ',';
235
+ first = false;
236
+ text += JSON.stringify(name);
237
+ text += ':';
238
+ text += spelled;
239
+ }
240
+ return `${text}}`;
241
+ }
242
+ /** The class of an owned value with no JSON form, named without quoting the value. */
243
+ function refusedKind(value) {
244
+ switch (typeof value) {
245
+ case 'undefined':
246
+ return 'undefined';
247
+ case 'function':
248
+ return 'a function';
249
+ case 'symbol':
250
+ return 'a symbol';
251
+ case 'bigint':
252
+ return 'a BigInt value';
253
+ case 'object':
254
+ return 'an unserializable object';
255
+ default:
256
+ return `type ${typeof value}`;
257
+ }
258
+ }
259
+ /**
260
+ * A nested value with no JSON form. The owned entry's promise is broken here: the refusal
261
+ * names the member path that carried the value and the class the caller promised never to
262
+ * hold, so a host finds the member that broke the promise instead of searching from `$`.
263
+ */
264
+ function brokenPromise(path, value) {
265
+ return new AxiomError('ENGINE_ERROR', `owned value carries ${refusedKind(value)}, which has no canonical form; the caller promised canonical wire values only`, path);
266
+ }
267
+ /**
268
+ * The restricted canonicalisations this process has performed.
269
+ *
270
+ * A measurement hook, never an input: no decision reads it. It exists so a benchmark can state
271
+ * the canonical work one evaluation performs — and fail a count gate when a cache regresses —
272
+ * instead of asserting a wall-clock duration, which is not a property of the code. Its reader is
273
+ * published on `@azx-pbc/axiom-runtime/testing`; the host doors state no counter.
274
+ */
275
+ let canonicalisationCount = 0;
276
+ /** The number of restricted canonicalisations since the process started. */
277
+ export function restrictedCanonicalizations() {
278
+ return canonicalisationCount;
279
+ }
280
+ /**
281
+ * RFC 8785 text for a value that already satisfies the restricted profile, or a
282
+ * refusal naming the path and the offending class of value.
283
+ */
284
+ export function canonicalizeRestricted(value) {
285
+ const text = serializeShielded(shieldedCopy(value), '$');
286
+ if (text === undefined) {
287
+ throw brokenPromise('$', value);
288
+ }
289
+ canonicalisationCount += 1;
290
+ return text;
291
+ }
292
+ /**
293
+ * RFC 8785 text for a value the engine itself built.
294
+ *
295
+ * This is the trusted entry, and `canonicalizeRestricted` above stays the profile's only
296
+ * parser and validator: the caller promises the work is already done.
297
+ *
298
+ * The caller promises all of:
299
+ *
300
+ * - every leaf is a canonical wire value — no `undefined`, no `-0`, no NaN, no non-integer
301
+ * or unsafe integer, no `BigInt`, no function, no symbol;
302
+ * - every object is a plain object carrying only enumerable own data members, so no
303
+ * accessor, no symbol key, no callable `toJSON`, no class instance, no `Decimal`;
304
+ * - every array is dense and carries no property other than its indices and `length`;
305
+ * - the tree is acyclic;
306
+ * - no string or member name holds an unpaired surrogate.
307
+ *
308
+ * Each promise is kept by a different authority before a report is assembled: the wire
309
+ * reader copies and validates every record value it hands out, a writer's result is
310
+ * rendered against its target declaration before the overlay holds it, and the artifact's
311
+ * own identifiers were checked by the compiler. `test/fuzz/restricted-json.test.ts` proves the
312
+ * bytes are the ones `canonicalizeRestricted` produces for every generated wire value, and
313
+ * `test/corpus/vector-parity.test.ts` proves them against the shipped vectors.
314
+ */
315
+ export function canonicalizeOwned(value) {
316
+ // One RFC 8785 implementation serves both entries, so the trusted path cannot drift from
317
+ // the untrusted one, and both hand it a shielded copy. This entry skips the profile's
318
+ // *checks*, which the promise above has already discharged — not the shield.
319
+ const text = serializeShielded(shieldedOwnedCopy(value), '$');
320
+ // `undefined` is the one input the trusted copy passes through unchanged, and a promise that
321
+ // was broken is refused at the member path that carried it rather than at no place at all.
322
+ if (text === undefined) {
323
+ throw brokenPromise('$', value);
324
+ }
325
+ return text;
326
+ }
327
+ /**
328
+ * The serialiser input for a value the engine owns: the same tree on prototype-less
329
+ * containers, copied without the profile's checks that `canonicalizeOwned`'s caller has
330
+ * already discharged.
331
+ *
332
+ * It still copies for the reason `shieldedCopy` states: a host-installed
333
+ * `Object.prototype.toJSON` (or any other inherited name) must not decide a report's bytes, so
334
+ * an uncopied report body would serialise to whatever that member returned, and two different
335
+ * bodies would seal with one `reportHash`.
336
+ *
337
+ * Own enumerable members are the only ones visited (`Object.keys`), and each is read after
338
+ * its own key is in hand, so an inherited member is never reached and the promise above
339
+ * already excludes an accessor.
340
+ */
341
+ function shieldedOwnedCopy(value) {
342
+ if (value === null || typeof value !== 'object')
343
+ return value;
344
+ if (isArrayValue(value)) {
345
+ const items = emptyList();
346
+ for (let index = 0; index < value.length; index += 1) {
347
+ items[index] = shieldedOwnedCopy(value[index]);
348
+ }
349
+ return items;
350
+ }
351
+ // An engine value with own enumerable members is a record, and each read below is by that
352
+ // own key, so no inherited member is reached.
353
+ const record = value;
354
+ const copy = emptyRecord('shielded');
355
+ for (const key of Object.keys(record)) {
356
+ setOwn(copy, key, shieldedOwnedCopy(record[key]));
357
+ }
358
+ return copy;
359
+ }
360
+ /**
361
+ * Encodes a UTF-16 string into UTF-8 bytes per RFC 3629 without reading a platform `TextEncoder`.
362
+ *
363
+ * Callers validate surrogate pairing before invoking this helper; if an unpaired surrogate still
364
+ * reaches it, U+FFFD is emitted to match RFC 3629. Two passes avoid over-allocating or copying
365
+ * buffers, and pure-ASCII strings take a direct single-byte loop.
366
+ */
367
+ function encodeUtf8(text) {
368
+ const length = text.length;
369
+ let byteLength = 0;
370
+ for (let index = 0; index < length; index += 1) {
371
+ const unit = text.charCodeAt(index);
372
+ if (unit < 0x80) {
373
+ byteLength += 1;
374
+ }
375
+ else if (unit < 0x800) {
376
+ byteLength += 2;
377
+ }
378
+ else if (unit >= 0xd800 && unit <= 0xdbff) {
379
+ const next = index + 1 < length ? text.charCodeAt(index + 1) : 0;
380
+ if (next >= 0xdc00 && next <= 0xdfff) {
381
+ byteLength += 4;
382
+ index += 1;
383
+ }
384
+ else {
385
+ byteLength += 3;
386
+ }
387
+ }
388
+ else {
389
+ byteLength += 3;
390
+ }
391
+ }
392
+ const out = new Uint8Array(byteLength);
393
+ // Every non-ASCII code unit adds at least one extra byte, so equality proves pure ASCII.
394
+ if (byteLength === length) {
395
+ for (let index = 0; index < length; index += 1) {
396
+ out[index] = text.charCodeAt(index);
397
+ }
398
+ return out;
399
+ }
400
+ let offset = 0;
401
+ for (let index = 0; index < length; index += 1) {
402
+ const unit = text.charCodeAt(index);
403
+ if (unit < 0x80) {
404
+ out[offset] = unit;
405
+ offset += 1;
406
+ }
407
+ else if (unit < 0x800) {
408
+ out[offset] = 0xc0 | (unit >> 6);
409
+ out[offset + 1] = 0x80 | (unit & 0x3f);
410
+ offset += 2;
411
+ }
412
+ else if (unit >= 0xd800 && unit <= 0xdbff) {
413
+ const next = index + 1 < length ? text.charCodeAt(index + 1) : 0;
414
+ if (next >= 0xdc00 && next <= 0xdfff) {
415
+ const codePoint = 0x10000 + ((unit - 0xd800) << 10) + (next - 0xdc00);
416
+ out[offset] = 0xf0 | (codePoint >> 18);
417
+ out[offset + 1] = 0x80 | ((codePoint >> 12) & 0x3f);
418
+ out[offset + 2] = 0x80 | ((codePoint >> 6) & 0x3f);
419
+ out[offset + 3] = 0x80 | (codePoint & 0x3f);
420
+ offset += 4;
421
+ index += 1;
422
+ }
423
+ else {
424
+ out[offset] = 0xef;
425
+ out[offset + 1] = 0xbf;
426
+ out[offset + 2] = 0xbd;
427
+ offset += 3;
428
+ }
429
+ }
430
+ else if (unit >= 0xdc00 && unit <= 0xdfff) {
431
+ out[offset] = 0xef;
432
+ out[offset + 1] = 0xbf;
433
+ out[offset + 2] = 0xbd;
434
+ offset += 3;
435
+ }
436
+ else {
437
+ out[offset] = 0xe0 | (unit >> 12);
438
+ out[offset + 1] = 0x80 | ((unit >> 6) & 0x3f);
439
+ out[offset + 2] = 0x80 | (unit & 0x3f);
440
+ offset += 3;
441
+ }
442
+ }
443
+ return out;
444
+ }
445
+ /** Lower-case hexadecimal SHA-256 of raw bytes. */
446
+ export function sha256HexOfBytes(bytes) {
447
+ return bytesToHex(sha256(bytes));
448
+ }
449
+ /**
450
+ * Lower-case hexadecimal SHA-256 of `text`'s UTF-8 bytes. A lone surrogate has no UTF-8
451
+ * encoding — the encoder would substitute a replacement character, making two distinct
452
+ * strings hash alike — so it is refused rather than encoded.
453
+ */
454
+ export function sha256Hex(text) {
455
+ if (hasUnpairedSurrogate(text)) {
456
+ throw new AxiomError('ENGINE_ERROR', 'a string with an unpaired surrogate has no UTF-8 form', '', 'a string with an unpaired surrogate has no UTF-8 form; pair the surrogate or escape the unit so the text has UTF-8 form');
457
+ }
458
+ return sha256HexOfBytes(encodeUtf8(text));
459
+ }
460
+ /**
461
+ * The UTF-8 bytes of a string, for a caller holding text and a byte contract.
462
+ *
463
+ * `verifyArtifactHash` checks bytes, and a client's only copy of an artifact is usually text.
464
+ * The runtime ships its own encoder rather than reading a platform `TextEncoder`, because the
465
+ * Hermes build the bindings target is not required to provide one.
466
+ */
467
+ export function utf8BytesOf(text) {
468
+ if (hasUnpairedSurrogate(text)) {
469
+ throw new AxiomError('ENGINE_ERROR', 'a string with an unpaired surrogate has no UTF-8 form', '', 'a string with an unpaired surrogate has no UTF-8 form; pair the surrogate or escape the unit so the text has UTF-8 form');
470
+ }
471
+ return encodeUtf8(text);
472
+ }
473
+ /**
474
+ * Lower-case hexadecimal SHA-256 of a value's restricted canonical form.
475
+ *
476
+ * The encoding reads the text directly rather than through `sha256Hex`, which scans for an
477
+ * unpaired surrogate: `canonicalizeRestricted` refused one at every string leaf and every member
478
+ * name (`checkedString`) before the text existed, so the scan would re-walk text the copy just
479
+ * proved clean. The refusal path is unchanged — a value carrying one never reaches this line —
480
+ * and `canonicalHashOwned` hashes its text the same way for the same reason. `sha256Hex` stays
481
+ * the entry for text a caller has not already held to the profile.
482
+ */
483
+ export function canonicalHash(value) {
484
+ return sha256HexOfBytes(encodeUtf8(canonicalizeRestricted(value)));
485
+ }
486
+ /**
487
+ * Lower-case hexadecimal SHA-256 of an owned value's canonical form, for a value that keeps
488
+ * every promise `canonicalizeOwned` states.
489
+ *
490
+ * `sha256Hex` scans the text for an unpaired surrogate because the UTF-8 encoder would
491
+ * substitute a replacement character and two distinct values would hash alike. An owned
492
+ * value has no such string — the wire reader refuses one at the boundary — so the scan is
493
+ * a second walk over bytes that were just checked, and this entry hashes them directly.
494
+ */
495
+ export function canonicalHashOwned(value) {
496
+ return sha256HexOfBytes(encodeUtf8(canonicalizeOwned(value)));
497
+ }
498
+ export { parseRestrictedJson } from './restricted-json.js';
499
+ export * from './restricted-value.js';
500
+ //# sourceMappingURL=jcs.js.map