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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +1207 -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 @@
1
+ {"version":3,"file":"jcs.js","sourceRoot":"","sources":["../../src/canonical/jcs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB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;IACtC,IAAI,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,UAAU,CAClB,cAAc,EACd,uDAAuD,EACvD,EAAE,EACF,yHAAyH,CAC1H,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,gBAAgB,CAAC,UAAU,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,gBAAgB,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,cAAc,uBAAuB,CAAC","sourcesContent":["import { sha256 } from '@noble/hashes/sha2.js';\nimport { bytesToHex } from '@noble/hashes/utils.js';\nimport { Decimal } from 'decimal.js';\nimport { AxiomError } from '../model/errors.js';\nimport { isSafeInteger } from '../model/integer.js';\nimport {\n MAX_NESTING_DEPTH,\n closeList,\n describePrototype,\n emptyList,\n hasUnpairedSurrogate,\n objectShapeViolation,\n prototypeOf,\n setOwn,\n tooDeep,\n} from './restricted.js';\nimport type { ContainerShape } from './restricted.js';\n\n/**\n * Restricted canonical JSON, `spec/semantics/canonical-v1.md` section 1.\n *\n * The profile is closed: a value outside it is refused with the path and the class of\n * value found, never repaired. A silent coercion would produce a hash that no\n * independent implementation could reproduce.\n */\n\nfunction refuse(path: string, kind: string, remedy: string): never {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `restricted JSON refuses ${kind}`,\n path,\n `restricted JSON refuses ${kind}; ${remedy}`,\n );\n}\n\nfunction refuseDepth(path: string): never {\n const kind = `nesting deeper than ${String(MAX_NESTING_DEPTH)} levels`;\n throw new AxiomError(\n 'ENGINE_ERROR',\n `restricted JSON refuses ${kind}`,\n path,\n `restricted JSON refuses ${kind}; flatten the value so nesting stays within ${String(MAX_NESTING_DEPTH)} levels`,\n );\n}\n\n/** An own property that cannot be represented as a JSON member or a JSON element. */\nfunction checkObjectShape(value: object, path: string): readonly string[] {\n const violation = objectShapeViolation(value);\n if (violation !== undefined)\n refuse(\n path,\n violation,\n 'carry members as enumerable data under string names and without a callable toJSON; the profile admits data records only',\n );\n return Object.getOwnPropertyNames(value);\n}\n\n/**\n * A record to fill. A `plain` copy is an ordinary object, because the caller that stores it\n * reads it far more often than the walk writes it and `Object.create(null)` would leave it in\n * dictionary mode; `setOwn` makes that fill safe. A `shielded` record is the serialiser's\n * input and carries no prototype at all, so no inherited member can reach the serialiser.\n */\nfunction emptyRecord(shape: ContainerShape): Record<string, unknown> {\n // `Object.create(null)` is the one expression the standard library types as `any`; the\n // assertion records the record it builds rather than widening the copy's type.\n return shape === 'shielded' ? (Object.create(null) as Record<string, unknown>) : {};\n}\n\n/** Whether the value wraps a primitive rather than carrying a plain record. */\nfunction isBoxedPrimitive(value: object): boolean {\n return (\n value instanceof String ||\n value instanceof Number ||\n value instanceof Boolean ||\n value instanceof Symbol ||\n value instanceof BigInt\n );\n}\n\nfunction checkedString(value: string, path: string): string {\n // A lone surrogate has no UTF-8 encoding, so hashing it would hash replacement\n // characters and two distinct values would collide.\n if (hasUnpairedSurrogate(value))\n refuse(\n path,\n 'a string with an unpaired surrogate',\n 'state the string with paired surrogates or escape the lone unit; the profile admits only strings with UTF-8 form',\n );\n return value;\n}\n\nfunction isArrayValue(value: object): value is readonly unknown[] {\n return Array.isArray(value);\n}\n\nfunction ownValue(value: object, key: string): unknown {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n return descriptor === undefined ? undefined : descriptor.value;\n}\n\nfunction copyArray(\n value: readonly unknown[],\n path: string,\n seen: Set<object>,\n depth: number,\n shape: ContainerShape,\n): unknown[] {\n // The bound counts containers, so it is checked where one is opened. Counting values\n // instead would admit an empty innermost container the profile refuses.\n if (tooDeep(depth + 1)) refuseDepth(path);\n // An `Array` subclass carries a prototype whose behaviour a canonical form would not\n // preserve, so it is refused like any other non-plain object.\n if (Reflect.getPrototypeOf(value) !== Array.prototype)\n refuse(\n path,\n 'an Array subclass',\n 'use a plain array; the profile admits dense arrays with the ordinary prototype and no extra members',\n );\n const names = checkObjectShape(value, path);\n const copy = emptyList();\n for (let index = 0; index < value.length; index += 1) {\n const childPath = `${path}[${String(index)}]`;\n if (!Object.hasOwn(value, index))\n refuse(\n childPath,\n 'a sparse array',\n 'state every index from 0 to length minus 1; the profile admits dense arrays only',\n );\n copy[index] = copyValue(value[index], childPath, seen, depth + 1, shape);\n }\n if (names.length !== value.length + 1)\n refuse(\n path,\n 'a non-index array property',\n 'carry only indices and length on an array; the profile admits no extra array members',\n );\n closeList(copy, shape);\n return copy;\n}\n\nfunction copyRecord(\n value: object,\n path: string,\n seen: Set<object>,\n depth: number,\n shape: ContainerShape,\n): Record<string, unknown> {\n if (tooDeep(depth + 1)) refuseDepth(path);\n if (value instanceof Decimal)\n refuse(\n path,\n 'a Decimal instance',\n 'carry a decimal as a string, such as \"1.5\"; the profile admits strings, not class instances',\n );\n if (isBoxedPrimitive(value))\n refuse(\n path,\n 'a boxed primitive',\n 'carry the primitive value itself; the profile admits strings, booleans and safe integers, not wrappers',\n );\n // Refuse a custom prototype before reading any of its property behaviour.\n const prototype = prototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n refuse(\n path,\n describePrototype(value),\n 'use a plain object or one with no prototype; the profile admits records with Object.prototype or no prototype only',\n );\n }\n const copy = emptyRecord(shape);\n for (const key of checkObjectShape(value, path)) {\n const childPath = `${path}.${key}`;\n setOwn(\n copy,\n checkedString(key, childPath),\n copyValue(ownValue(value, key), childPath, seen, depth + 1, shape),\n );\n }\n return copy;\n}\n\nfunction copyValue(\n value: unknown,\n path: string,\n seen: Set<object>,\n depth: number,\n shape: ContainerShape,\n): unknown {\n switch (typeof value) {\n case 'string':\n return checkedString(value, path);\n case 'boolean':\n return value;\n case 'number':\n if (Object.is(value, -0))\n refuse(\n path,\n 'negative zero',\n 'write 0 instead; the profile admits the integer 0, never negative zero',\n );\n if (!Number.isFinite(value))\n refuse(\n path,\n 'NaN or Infinity',\n 'state a safe integer or omit the member; the profile admits finite integers only',\n );\n if (!Number.isInteger(value)) {\n // The repair, not only the fact: a host that serialises a decimal as a JSON number hits\n // this on its first document, and the answer is to carry it as a string. The clause\n // stays in the message because the submission boundary reports the message verbatim;\n // the detail adds the admitted set beside it.\n refuse(\n path,\n 'a non-integer number — carry a decimal as a string, such as \"1.5\"',\n 'the profile admits safe integers, and decimal text only as strings',\n );\n }\n if (!isSafeInteger(value))\n refuse(\n path,\n 'an unsafe integer',\n 'keep the integer inside -(2^53 - 1)..(2^53 - 1); the profile admits safe integers only',\n );\n return value;\n case 'bigint':\n return refuse(\n path,\n 'BigInt',\n 'carry the value as a string or a safe integer; the profile admits no BigInt values',\n );\n case 'undefined':\n return refuse(\n path,\n 'undefined',\n 'omit the member or state null; the profile admits null, never undefined',\n );\n case 'function':\n return refuse(\n path,\n 'a function',\n 'omit the member; the profile admits data only, never functions',\n );\n case 'symbol':\n return refuse(\n path,\n 'a symbol',\n 'use a string instead; the profile admits strings, never symbols',\n );\n case 'object': {\n if (value === null) return null;\n if (seen.has(value))\n refuse(\n path,\n 'a cycle',\n 'repeat the shared subtree at each place or omit the repeated member; the profile admits trees, never cycles',\n );\n // One ancestor set with backtracking: copying the set per node would make the walk\n // O(nodes x depth) and allocate a set at every level of a nested record.\n seen.add(value);\n const copy = isArrayValue(value)\n ? copyArray(value, path, seen, depth, shape)\n : copyRecord(value, path, seen, depth, shape);\n seen.delete(value);\n return copy;\n }\n }\n}\n\n/**\n * A canonical plain copy of `value`: every profile violation is refused with the path and\n * the offending class of value, and the copy is a plain\n * tree that hashing and reporting can consume without a second walk. Callers that read\n * untrusted values use this as the single implementation of the restricted profile.\n */\nexport function copyRestricted(value: unknown, path = '$'): unknown {\n return copyValue(value, path, new Set(), 0, 'plain');\n}\n\n/**\n * The copy the serialiser is handed: the same tree, built on containers with no prototype.\n *\n * The serialiser below reads only own members and array indices, so a host that assigned\n * `Object.prototype.toJSON`, `Array.prototype.toJSON` or any other inherited name cannot\n * replace a container in the document: records carry no prototype at all, and an array is read\n * by index and `length`, so nothing on its prototype contributes to the text. The bytes the\n * engine commits to are a function of the copied data alone. The copy a caller receives keeps\n * its ordinary prototypes, because it is a value rather than a serialisation input.\n */\nfunction shieldedCopy(value: unknown): unknown {\n return copyValue(value, '$', new Set(), 0, 'shielded');\n}\n\n/**\n * RFC 8785 text for one shielded value, or `undefined` for a value with no JSON form.\n *\n * The tree the copy built is already restricted: `null`, booleans, safe integers, strings with\n * no unpaired surrogate, dense arrays and records with own enumerable members. So the\n * serializer can be small and total over that tree, and — this is the point — it never reads a\n * prototype method: array elements are read by index, record members by `Object.keys`, and\n * strings and numbers by the platform's JSON-safe spellings.\n *\n * This is hand-rolled for two constraints the adopted `canonicalize` library could not meet.\n * Its 5.x line calls `String.prototype.isWellFormed`, an ES2024 method the ES2023 / Hermes V1\n * target does not provide. Its 4.x line reads `toJSON` through the prototype chain and calls\n * `Array.prototype.map`, so an inherited name on a container — the exact ambient dependence the\n * shielded copy exists to exclude — could decide the bytes. A hard floor and the shield are both\n * non-negotiable, so the serializer lives here and the dependency is gone; `canonical.test.ts`\n * pins the bytes from vectors the serializer did not produce.\n *\n * A number is written with `String`, which is the same ECMAScript number-to-string RFC 8785\n * names; every non-integer, unsafe integer, `-0`, NaN and infinity was refused by the copy.\n * A string is written with `JSON.stringify`, which is the RFC's own quote rule and escapes\n * control characters without escaping non-ASCII. `Object.keys(...).sort()` orders by UTF-16\n * code unit, the order JCS requires, and the copy has already refused a non-index array\n * property and a sparse array.\n */\nfunction serializeShielded(value: unknown, path: string): string | undefined {\n if (value === null) return 'null';\n switch (typeof value) {\n case 'string':\n return JSON.stringify(value);\n case 'number':\n return String(value);\n case 'boolean':\n return value ? 'true' : 'false';\n case 'object':\n return isArrayValue(value) ? serializeList(value, path) : serializeRecord(value, path);\n default:\n // A value the trusted copy passed through unchanged: no JSON form, refused by the\n // caller with the path that reached it.\n return undefined;\n }\n}\n\nfunction serializeList(items: readonly unknown[], path: string): string | undefined {\n let text = '[';\n for (let index = 0; index < items.length; index += 1) {\n if (index > 0) text += ',';\n const at = `${path}[${String(index)}]`;\n const element = serializeShielded(items[index], at);\n if (element === undefined) throw brokenPromise(at, items[index]);\n text += element;\n }\n return `${text}]`;\n}\n\nfunction serializeRecord(record: object, path: string): string | undefined {\n const names = Object.keys(record).sort();\n let text = '{';\n let first = true;\n for (const name of names) {\n const member: unknown = Reflect.get(record, name);\n const at = `${path}.${name}`;\n const spelled = serializeShielded(member, at);\n if (spelled === undefined) throw brokenPromise(at, member);\n text += first ? '' : ',';\n first = false;\n text += JSON.stringify(name);\n text += ':';\n text += spelled;\n }\n return `${text}}`;\n}\n\n/** The class of an owned value with no JSON form, named without quoting the value. */\nfunction refusedKind(value: unknown): string {\n switch (typeof value) {\n case 'undefined':\n return 'undefined';\n case 'function':\n return 'a function';\n case 'symbol':\n return 'a symbol';\n case 'bigint':\n return 'a BigInt value';\n case 'object':\n return 'an unserializable object';\n default:\n return `type ${typeof value}`;\n }\n}\n\n/**\n * A nested value with no JSON form. The owned entry's promise is broken here: the refusal\n * names the member path that carried the value and the class the caller promised never to\n * hold, so a host finds the member that broke the promise instead of searching from `$`.\n */\nfunction brokenPromise(path: string, value: unknown): AxiomError {\n return new AxiomError(\n 'ENGINE_ERROR',\n `owned value carries ${refusedKind(value)}, which has no canonical form; the caller promised canonical wire values only`,\n path,\n );\n}\n\n/**\n * The restricted canonicalisations this process has performed.\n *\n * A measurement hook, never an input: no decision reads it. It exists so a benchmark can state\n * the canonical work one evaluation performs — and fail a count gate when a cache regresses —\n * instead of asserting a wall-clock duration, which is not a property of the code. Its reader is\n * published on `@azx-pbc/axiom-runtime/testing`; the host doors state no counter.\n */\nlet canonicalisationCount = 0;\n\n/** The number of restricted canonicalisations since the process started. */\nexport function restrictedCanonicalizations(): number {\n return canonicalisationCount;\n}\n\n/**\n * RFC 8785 text for a value that already satisfies the restricted profile, or a\n * refusal naming the path and the offending class of value.\n */\nexport function canonicalizeRestricted(value: unknown): string {\n const text = serializeShielded(shieldedCopy(value), '$');\n if (text === undefined) {\n throw brokenPromise('$', value);\n }\n canonicalisationCount += 1;\n return text;\n}\n\n/**\n * RFC 8785 text for a value the engine itself built.\n *\n * This is the trusted entry, and `canonicalizeRestricted` above stays the profile's only\n * parser and validator: the caller promises the work is already done.\n *\n * The caller promises all of:\n *\n * - every leaf is a canonical wire value — no `undefined`, no `-0`, no NaN, no non-integer\n * or unsafe integer, no `BigInt`, no function, no symbol;\n * - every object is a plain object carrying only enumerable own data members, so no\n * accessor, no symbol key, no callable `toJSON`, no class instance, no `Decimal`;\n * - every array is dense and carries no property other than its indices and `length`;\n * - the tree is acyclic;\n * - no string or member name holds an unpaired surrogate.\n *\n * Each promise is kept by a different authority before a report is assembled: the wire\n * reader copies and validates every record value it hands out, a writer's result is\n * rendered against its target declaration before the overlay holds it, and the artifact's\n * own identifiers were checked by the compiler. `test/fuzz/restricted-json.test.ts` proves the\n * bytes are the ones `canonicalizeRestricted` produces for every generated wire value, and\n * `test/corpus/vector-parity.test.ts` proves them against the shipped vectors.\n */\nexport function canonicalizeOwned(value: unknown): string {\n // One RFC 8785 implementation serves both entries, so the trusted path cannot drift from\n // the untrusted one, and both hand it a shielded copy. This entry skips the profile's\n // *checks*, which the promise above has already discharged — not the shield.\n const text = serializeShielded(shieldedOwnedCopy(value), '$');\n // `undefined` is the one input the trusted copy passes through unchanged, and a promise that\n // was broken is refused at the member path that carried it rather than at no place at all.\n if (text === undefined) {\n throw brokenPromise('$', value);\n }\n return text;\n}\n\n/**\n * The serialiser input for a value the engine owns: the same tree on prototype-less\n * containers, copied without the profile's checks that `canonicalizeOwned`'s caller has\n * already discharged.\n *\n * It still copies for the reason `shieldedCopy` states: a host-installed\n * `Object.prototype.toJSON` (or any other inherited name) must not decide a report's bytes, so\n * an uncopied report body would serialise to whatever that member returned, and two different\n * bodies would seal with one `reportHash`.\n *\n * Own enumerable members are the only ones visited (`Object.keys`), and each is read after\n * its own key is in hand, so an inherited member is never reached and the promise above\n * already excludes an accessor.\n */\nfunction shieldedOwnedCopy(value: unknown): unknown {\n if (value === null || typeof value !== 'object') return value;\n if (isArrayValue(value)) {\n const items = emptyList();\n for (let index = 0; index < value.length; index += 1) {\n items[index] = shieldedOwnedCopy(value[index]);\n }\n return items;\n }\n // An engine value with own enumerable members is a record, and each read below is by that\n // own key, so no inherited member is reached.\n const record = value as Record<string, unknown>;\n const copy = emptyRecord('shielded');\n for (const key of Object.keys(record)) {\n setOwn(copy, key, shieldedOwnedCopy(record[key]));\n }\n return copy;\n}\n\n/**\n * Encodes a UTF-16 string into UTF-8 bytes per RFC 3629 without reading a platform `TextEncoder`.\n *\n * Callers validate surrogate pairing before invoking this helper; if an unpaired surrogate still\n * reaches it, U+FFFD is emitted to match RFC 3629. Two passes avoid over-allocating or copying\n * buffers, and pure-ASCII strings take a direct single-byte loop.\n */\nfunction encodeUtf8(text: string): Uint8Array {\n const length = text.length;\n let byteLength = 0;\n for (let index = 0; index < length; index += 1) {\n const unit = text.charCodeAt(index);\n if (unit < 0x80) {\n byteLength += 1;\n } else if (unit < 0x800) {\n byteLength += 2;\n } else if (unit >= 0xd800 && unit <= 0xdbff) {\n const next = index + 1 < length ? text.charCodeAt(index + 1) : 0;\n if (next >= 0xdc00 && next <= 0xdfff) {\n byteLength += 4;\n index += 1;\n } else {\n byteLength += 3;\n }\n } else {\n byteLength += 3;\n }\n }\n const out = new Uint8Array(byteLength);\n // Every non-ASCII code unit adds at least one extra byte, so equality proves pure ASCII.\n if (byteLength === length) {\n for (let index = 0; index < length; index += 1) {\n out[index] = text.charCodeAt(index);\n }\n return out;\n }\n let offset = 0;\n for (let index = 0; index < length; index += 1) {\n const unit = text.charCodeAt(index);\n if (unit < 0x80) {\n out[offset] = unit;\n offset += 1;\n } else if (unit < 0x800) {\n out[offset] = 0xc0 | (unit >> 6);\n out[offset + 1] = 0x80 | (unit & 0x3f);\n offset += 2;\n } else if (unit >= 0xd800 && unit <= 0xdbff) {\n const next = index + 1 < length ? text.charCodeAt(index + 1) : 0;\n if (next >= 0xdc00 && next <= 0xdfff) {\n const codePoint = 0x10000 + ((unit - 0xd800) << 10) + (next - 0xdc00);\n out[offset] = 0xf0 | (codePoint >> 18);\n out[offset + 1] = 0x80 | ((codePoint >> 12) & 0x3f);\n out[offset + 2] = 0x80 | ((codePoint >> 6) & 0x3f);\n out[offset + 3] = 0x80 | (codePoint & 0x3f);\n offset += 4;\n index += 1;\n } else {\n out[offset] = 0xef;\n out[offset + 1] = 0xbf;\n out[offset + 2] = 0xbd;\n offset += 3;\n }\n } else if (unit >= 0xdc00 && unit <= 0xdfff) {\n out[offset] = 0xef;\n out[offset + 1] = 0xbf;\n out[offset + 2] = 0xbd;\n offset += 3;\n } else {\n out[offset] = 0xe0 | (unit >> 12);\n out[offset + 1] = 0x80 | ((unit >> 6) & 0x3f);\n out[offset + 2] = 0x80 | (unit & 0x3f);\n offset += 3;\n }\n }\n return out;\n}\n\n/** Lower-case hexadecimal SHA-256 of raw bytes. */\nexport function sha256HexOfBytes(bytes: Uint8Array): string {\n return bytesToHex(sha256(bytes));\n}\n\n/**\n * Lower-case hexadecimal SHA-256 of `text`'s UTF-8 bytes. A lone surrogate has no UTF-8\n * encoding — the encoder would substitute a replacement character, making two distinct\n * strings hash alike — so it is refused rather than encoded.\n */\nexport function sha256Hex(text: string): string {\n if (hasUnpairedSurrogate(text)) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'a string with an unpaired surrogate has no UTF-8 form',\n '',\n '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',\n );\n }\n return sha256HexOfBytes(encodeUtf8(text));\n}\n\n/**\n * The UTF-8 bytes of a string, for a caller holding text and a byte contract.\n *\n * `verifyArtifactHash` checks bytes, and a client's only copy of an artifact is usually text.\n * The runtime ships its own encoder rather than reading a platform `TextEncoder`, because the\n * Hermes build the bindings target is not required to provide one.\n */\nexport function utf8BytesOf(text: string): Uint8Array {\n if (hasUnpairedSurrogate(text)) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'a string with an unpaired surrogate has no UTF-8 form',\n '',\n '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',\n );\n }\n return encodeUtf8(text);\n}\n\n/**\n * Lower-case hexadecimal SHA-256 of a value's restricted canonical form.\n *\n * The encoding reads the text directly rather than through `sha256Hex`, which scans for an\n * unpaired surrogate: `canonicalizeRestricted` refused one at every string leaf and every member\n * name (`checkedString`) before the text existed, so the scan would re-walk text the copy just\n * proved clean. The refusal path is unchanged — a value carrying one never reaches this line —\n * and `canonicalHashOwned` hashes its text the same way for the same reason. `sha256Hex` stays\n * the entry for text a caller has not already held to the profile.\n */\nexport function canonicalHash(value: unknown): string {\n return sha256HexOfBytes(encodeUtf8(canonicalizeRestricted(value)));\n}\n\n/**\n * Lower-case hexadecimal SHA-256 of an owned value's canonical form, for a value that keeps\n * every promise `canonicalizeOwned` states.\n *\n * `sha256Hex` scans the text for an unpaired surrogate because the UTF-8 encoder would\n * substitute a replacement character and two distinct values would hash alike. An owned\n * value has no such string — the wire reader refuses one at the boundary — so the scan is\n * a second walk over bytes that were just checked, and this entry hashes them directly.\n */\nexport function canonicalHashOwned(value: unknown): string {\n return sha256HexOfBytes(encodeUtf8(canonicalizeOwned(value)));\n}\n\nexport { parseRestrictedJson } from './restricted-json.js';\nexport * from './restricted-value.js';\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Ingests JSON text, refusing duplicate object member names before anything validates
3
+ * or hashes it. Numbers are read as canonical JSON integers only, so
4
+ * a float cannot hide behind a spelling like `1.0`.
5
+ */
6
+ export declare function parseRestrictedJson(text: string): unknown;
7
+ //# sourceMappingURL=restricted-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restricted-json.d.ts","sourceRoot":"","sources":["../../src/canonical/restricted-json.ts"],"names":[],"mappings":"AA0XA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD"}
@@ -0,0 +1,318 @@
1
+ import { JsonIngestError } from '../model/errors.js';
2
+ import { restrictedNumberTextRefusal } from './restricted-value.js';
3
+ import { MAX_NESTING_DEPTH, closeList, emptyList, hasUnpairedSurrogate, memberPath, setOwn, tooDeep, } from './restricted.js';
4
+ /**
5
+ * The restricted-JSON text reader.
6
+ *
7
+ * The profile is a reader, not a post-hoc validator: duplicate member names, non-integer
8
+ * numbers, lone surrogates and excessive nesting are refused before a value exists. The number
9
+ * spelling rule is `restricted-value.ts`'s, shared with the value walk a YAML front door uses,
10
+ * so one text cannot be refused by one spelling path and admitted by another. The canonical
11
+ * copier in `jcs.ts` shares the same primitives, so text that this reader accepts is in the
12
+ * shape the copier will admit.
13
+ */
14
+ const NUMBER_CHARS = new Set([
15
+ '-',
16
+ '+',
17
+ '.',
18
+ 'e',
19
+ 'E',
20
+ '0',
21
+ '1',
22
+ '2',
23
+ '3',
24
+ '4',
25
+ '5',
26
+ '6',
27
+ '7',
28
+ '8',
29
+ '9',
30
+ ]);
31
+ /**
32
+ * A number spelling: the characters a JSON number may carry, containing a digit. Wider than
33
+ * the profile (it admits `+1`, `01`, `.5`), because those are refused for being non-canonical
34
+ * integers, not for being something other than a number.
35
+ */
36
+ const NUMBER_SPELLING_PATTERN = /^[-+]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][-+]?[0-9]+)?$/;
37
+ /**
38
+ * The first code unit a JSON string's plain run cannot carry: an escape introducer, a control
39
+ * character the grammar requires to be escaped, or an unpaired surrogate that has no UTF-8
40
+ * encoding.
41
+ *
42
+ * One walk answers all three, because the run is already in hand and a second scan over a 50 MB
43
+ * value would be work for nothing. The scan is bounded by the run: searching the whole remaining
44
+ * document for a backslash once per string is quadratic in a document made of many short
45
+ * strings, which is exactly the shape a hostile body takes. A run that carries an escape falls
46
+ * through to the character loop, which owns that production and reports the same path and
47
+ * reason.
48
+ */
49
+ function stringViolation(text) {
50
+ for (let index = 0; index < text.length; index += 1) {
51
+ const unit = text.charCodeAt(index);
52
+ if (unit === 0x5c)
53
+ return { reason: 'escape', index };
54
+ if (unit < 0x20)
55
+ return { reason: 'control', index };
56
+ if (unit >= 0xd800 && unit <= 0xdbff) {
57
+ const next = text.charCodeAt(index + 1);
58
+ if (next >= 0xdc00 && next <= 0xdfff) {
59
+ index += 1;
60
+ continue;
61
+ }
62
+ // A high surrogate immediately before an escape may be completed by the `\uXXXX` that
63
+ // escape decodes, so the plain run cannot decide the pair: the character loop assembles
64
+ // the value and judges the finished string. Refusing here would reject a well-formed pair
65
+ // spelled with one unit raw and one escaped, which the grammar still produces one string
66
+ // from. A high surrogate before anything else is unpaired and refused.
67
+ if (next === 0x5c)
68
+ return { reason: 'escape', index };
69
+ return { reason: 'surrogate', index };
70
+ }
71
+ else if (unit >= 0xdc00 && unit <= 0xdfff) {
72
+ return { reason: 'surrogate', index };
73
+ }
74
+ }
75
+ return undefined;
76
+ }
77
+ class JsonReader {
78
+ index = 0;
79
+ text;
80
+ constructor(text) {
81
+ this.text = text;
82
+ }
83
+ parseDocument() {
84
+ const value = this.parseValue('$', 0);
85
+ this.skipWhitespace();
86
+ if (this.index !== this.text.length)
87
+ this.fail('unexpected trailing content; a document carries one value and ends there', '$', 'trailing_content');
88
+ return value;
89
+ }
90
+ fail(message, path, reason = 'syntax') {
91
+ throw new JsonIngestError(message, this.index, path, reason);
92
+ }
93
+ /**
94
+ * Refuses a container that would be the `depth`th level of nesting.
95
+ *
96
+ * The bound counts containers, so it is checked where one is opened rather than where a
97
+ * value is read: `'['.repeat(129) + ']'.repeat(129)` is 129 levels deep whether or not the
98
+ * innermost list is empty, and a check reached only from a child value would admit it.
99
+ */
100
+ enterContainer(path, depth) {
101
+ if (tooDeep(depth + 1)) {
102
+ this.fail(`nesting deeper than ${String(MAX_NESTING_DEPTH)} levels; flatten the value so nesting stays within ${String(MAX_NESTING_DEPTH)} levels`, path, 'nesting');
103
+ }
104
+ }
105
+ skipWhitespace() {
106
+ while (this.index < this.text.length) {
107
+ const char = this.text[this.index];
108
+ if (char !== ' ' && char !== '\t' && char !== '\n' && char !== '\r')
109
+ return;
110
+ this.index += 1;
111
+ }
112
+ }
113
+ expect(char, path) {
114
+ if (this.text[this.index] !== char)
115
+ this.fail(`expected ${JSON.stringify(char)}`, path);
116
+ this.index += 1;
117
+ }
118
+ parseValue(path, depth) {
119
+ this.skipWhitespace();
120
+ const char = this.text[this.index];
121
+ if (char === undefined) {
122
+ this.fail(this.text.trim() === ''
123
+ ? 'the document is empty; state one JSON value'
124
+ : 'expected a value, found the end of the document', path);
125
+ }
126
+ switch (char) {
127
+ case '{':
128
+ return this.parseObject(path, depth);
129
+ case '[':
130
+ return this.parseArray(path, depth);
131
+ case '"':
132
+ return this.parseString(path);
133
+ case 't':
134
+ return this.parseLiteral('true', true, path);
135
+ case 'f':
136
+ return this.parseLiteral('false', false, path);
137
+ case 'n':
138
+ return this.parseLiteral('null', null, path);
139
+ default:
140
+ return this.parseNumber(path);
141
+ }
142
+ }
143
+ parseLiteral(text, value, path) {
144
+ if (this.text.slice(this.index, this.index + text.length) !== text) {
145
+ this.fail(`expected ${text}`, path);
146
+ }
147
+ this.index += text.length;
148
+ return value;
149
+ }
150
+ parseNumber(path) {
151
+ const start = this.index;
152
+ while (this.index < this.text.length) {
153
+ const char = this.text[this.index];
154
+ if (char === undefined || !NUMBER_CHARS.has(char))
155
+ break;
156
+ this.index += 1;
157
+ }
158
+ const text = this.text.slice(start, this.index);
159
+ // The scan stops at the first character that cannot be part of a number, so a document
160
+ // whose value starts with a byte order mark, a letter or a bare sign leaves a token that
161
+ // is not a number at all. That is a syntax refusal, not a claim about an integer spelling
162
+ // the document never had; `NaN` and `Infinity` land here too. The refusal names the
163
+ // admitted shape rather than quoting the text, so no submitted value reaches the message.
164
+ if (!NUMBER_SPELLING_PATTERN.test(text)) {
165
+ this.fail('expected a value; the text at this offset starts no JSON value', path);
166
+ }
167
+ // The profile's number rule lives in `restricted-value`, so a YAML scalar and a JSON token
168
+ // cannot be judged by two different readings of it. The token is still classified before it
169
+ // is converted, so `1.0` can never silently become the integer `1`.
170
+ const refusal = restrictedNumberTextRefusal(text);
171
+ if (refusal !== undefined)
172
+ this.fail(refusal.detail, path, refusal.reason);
173
+ return Number(text);
174
+ }
175
+ parseString(path) {
176
+ this.expect('"', path);
177
+ // A string is one value however long it is — a 50 MB body is one member — and appending one
178
+ // code unit at a time made the reader a per-character loop over it. The closing quote is
179
+ // found natively and the run is sliced once; the slice is then walked once for the three
180
+ // things it cannot carry (an escape, a control character, an unpaired surrogate). Searching
181
+ // the remaining document for a backslash instead would be quadratic on a body of many short
182
+ // strings, so the scan never leaves the run.
183
+ const quote = this.text.indexOf('"', this.index);
184
+ if (quote < 0)
185
+ this.fail('unterminated string; close the string with a quote to end it', path, 'unterminated_string');
186
+ const value = this.text.slice(this.index, quote);
187
+ const violation = stringViolation(value);
188
+ if (violation?.reason === 'escape')
189
+ return this.parseEscapedString(path);
190
+ if (violation !== undefined) {
191
+ this.index += violation.index;
192
+ if (violation.reason === 'control') {
193
+ this.fail('unescaped control character in string; escape the control or remove it, since strings admit only escaped controls', path, 'control_character');
194
+ }
195
+ this.fail('string carries an unpaired surrogate; pair the surrogate or escape the unit, since strings admit only paired surrogates', path, 'unpaired_surrogate');
196
+ }
197
+ this.index = quote + 1;
198
+ return value;
199
+ }
200
+ /**
201
+ * The same string production, one code unit at a time, for a run an escape or a control
202
+ * character interrupts.
203
+ */
204
+ parseEscapedString(path) {
205
+ let result = '';
206
+ while (true) {
207
+ const char = this.text[this.index];
208
+ if (char === undefined)
209
+ this.fail('unterminated string; close the string with a quote to end it', path, 'unterminated_string');
210
+ this.index += 1;
211
+ if (char === '"') {
212
+ // A lone surrogate has no UTF-8 encoding, and
213
+ // letting it past ingestion lets downstream URI/UTF-8 encoders throw a raw `URIError`.
214
+ if (hasUnpairedSurrogate(result)) {
215
+ this.fail('string carries an unpaired surrogate; pair the surrogate or escape the unit, since strings admit only paired surrogates', path, 'unpaired_surrogate');
216
+ }
217
+ return result;
218
+ }
219
+ if (char === '\\') {
220
+ result += this.parseEscape(path);
221
+ continue;
222
+ }
223
+ if (char < ' ')
224
+ this.fail('unescaped control character in string; escape the control or remove it, since strings admit only escaped controls', path, 'control_character');
225
+ result += char;
226
+ }
227
+ }
228
+ parseEscape(path) {
229
+ const char = this.text[this.index];
230
+ this.index += 1;
231
+ switch (char) {
232
+ case '"':
233
+ return '"';
234
+ case '\\':
235
+ return '\\';
236
+ case '/':
237
+ return '/';
238
+ case 'b':
239
+ return '\b';
240
+ case 'f':
241
+ return '\f';
242
+ case 'n':
243
+ return '\n';
244
+ case 'r':
245
+ return '\r';
246
+ case 't':
247
+ return '\t';
248
+ case 'u': {
249
+ const hex = this.text.slice(this.index, this.index + 4);
250
+ if (!/^[0-9a-fA-F]{4}$/.test(hex))
251
+ this.fail('invalid unicode escape; write \\u followed by four hex digits', path, 'unicode_escape');
252
+ this.index += 4;
253
+ return String.fromCharCode(Number.parseInt(hex, 16));
254
+ }
255
+ default:
256
+ return this.fail('invalid escape; escape only the characters JSON names', path, 'invalid_escape');
257
+ }
258
+ }
259
+ parseArray(path, depth) {
260
+ this.enterContainer(path, depth);
261
+ this.expect('[', path);
262
+ const items = emptyList();
263
+ this.skipWhitespace();
264
+ if (this.text[this.index] === ']') {
265
+ this.index += 1;
266
+ closeList(items, 'plain');
267
+ return items;
268
+ }
269
+ while (true) {
270
+ items[items.length] = this.parseValue(`${path}[${String(items.length)}]`, depth + 1);
271
+ this.skipWhitespace();
272
+ if (this.text[this.index] === ',') {
273
+ this.index += 1;
274
+ continue;
275
+ }
276
+ this.expect(']', path);
277
+ closeList(items, 'plain');
278
+ return items;
279
+ }
280
+ }
281
+ parseObject(path, depth) {
282
+ this.enterContainer(path, depth);
283
+ this.expect('{', path);
284
+ const result = {};
285
+ this.skipWhitespace();
286
+ if (this.text[this.index] === '}') {
287
+ this.index += 1;
288
+ return result;
289
+ }
290
+ while (true) {
291
+ this.skipWhitespace();
292
+ const key = this.parseString(path);
293
+ const childPath = memberPath(path, key);
294
+ if (Object.hasOwn(result, key)) {
295
+ this.fail(`duplicate object member ${JSON.stringify(key)}; state each member name once`, path, 'duplicate_member');
296
+ }
297
+ this.skipWhitespace();
298
+ this.expect(':', childPath);
299
+ setOwn(result, key, this.parseValue(childPath, depth + 1));
300
+ this.skipWhitespace();
301
+ if (this.text[this.index] === ',') {
302
+ this.index += 1;
303
+ continue;
304
+ }
305
+ this.expect('}', path);
306
+ return result;
307
+ }
308
+ }
309
+ }
310
+ /**
311
+ * Ingests JSON text, refusing duplicate object member names before anything validates
312
+ * or hashes it. Numbers are read as canonical JSON integers only, so
313
+ * a float cannot hide behind a spelling like `1.0`.
314
+ */
315
+ export function parseRestrictedJson(text) {
316
+ return new JsonReader(text).parseDocument();
317
+ }
318
+ //# sourceMappingURL=restricted-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restricted-json.js","sourceRoot":"","sources":["../../src/canonical/restricted-json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,UAAU,EACV,MAAM,EACN,OAAO,GACR,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;GASG;AAEH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;I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;YACJ,CAAC;YACD,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAC5B,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YAC3D,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;gBAClC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;gBAChB,SAAS;YACX,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACvB,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["import { JsonIngestError } from '../model/errors.js';\nimport type { JsonIngestReason } from '../model/errors.js';\nimport { restrictedNumberTextRefusal } from './restricted-value.js';\nimport {\n MAX_NESTING_DEPTH,\n closeList,\n emptyList,\n hasUnpairedSurrogate,\n memberPath,\n setOwn,\n tooDeep,\n} from './restricted.js';\n\n/**\n * The restricted-JSON text reader.\n *\n * The profile is a reader, not a post-hoc validator: duplicate member names, non-integer\n * numbers, lone surrogates and excessive nesting are refused before a value exists. The number\n * spelling rule is `restricted-value.ts`'s, shared with the value walk a YAML front door uses,\n * so one text cannot be refused by one spelling path and admitted by another. The canonical\n * copier in `jcs.ts` shares the same primitives, so text that this reader accepts is in the\n * shape the copier will admit.\n */\n\nconst NUMBER_CHARS = new Set([\n '-',\n '+',\n '.',\n 'e',\n 'E',\n '0',\n '1',\n '2',\n '3',\n '4',\n '5',\n '6',\n '7',\n '8',\n '9',\n]);\n\n/**\n * A number spelling: the characters a JSON number may carry, containing a digit. Wider than\n * the profile (it admits `+1`, `01`, `.5`), because those are refused for being non-canonical\n * integers, not for being something other than a number.\n */\nconst NUMBER_SPELLING_PATTERN = /^[-+]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][-+]?[0-9]+)?$/;\n\n/**\n * The first code unit a JSON string's plain run cannot carry: an escape introducer, a control\n * character the grammar requires to be escaped, or an unpaired surrogate that has no UTF-8\n * encoding.\n *\n * One walk answers all three, because the run is already in hand and a second scan over a 50 MB\n * value would be work for nothing. The scan is bounded by the run: searching the whole remaining\n * document for a backslash once per string is quadratic in a document made of many short\n * strings, which is exactly the shape a hostile body takes. A run that carries an escape falls\n * through to the character loop, which owns that production and reports the same path and\n * reason.\n */\nfunction stringViolation(\n text: string,\n): { readonly reason: 'escape' | 'control' | 'surrogate'; readonly index: number } | undefined {\n for (let index = 0; index < text.length; index += 1) {\n const unit = text.charCodeAt(index);\n if (unit === 0x5c) return { reason: 'escape', index };\n if (unit < 0x20) return { reason: 'control', index };\n if (unit >= 0xd800 && unit <= 0xdbff) {\n const next = text.charCodeAt(index + 1);\n if (next >= 0xdc00 && next <= 0xdfff) {\n index += 1;\n continue;\n }\n // A high surrogate immediately before an escape may be completed by the `\\uXXXX` that\n // escape decodes, so the plain run cannot decide the pair: the character loop assembles\n // the value and judges the finished string. Refusing here would reject a well-formed pair\n // spelled with one unit raw and one escaped, which the grammar still produces one string\n // from. A high surrogate before anything else is unpaired and refused.\n if (next === 0x5c) return { reason: 'escape', index };\n return { reason: 'surrogate', index };\n } else if (unit >= 0xdc00 && unit <= 0xdfff) {\n return { reason: 'surrogate', index };\n }\n }\n return undefined;\n}\n\nclass JsonReader {\n private index = 0;\n private readonly text: string;\n\n constructor(text: string) {\n this.text = text;\n }\n\n parseDocument(): unknown {\n const value = this.parseValue('$', 0);\n this.skipWhitespace();\n if (this.index !== this.text.length)\n this.fail(\n 'unexpected trailing content; a document carries one value and ends there',\n '$',\n 'trailing_content',\n );\n return value;\n }\n\n private fail(message: string, path: string, reason: JsonIngestReason = 'syntax'): never {\n throw new JsonIngestError(message, this.index, path, reason);\n }\n\n /**\n * Refuses a container that would be the `depth`th level of nesting.\n *\n * The bound counts containers, so it is checked where one is opened rather than where a\n * value is read: `'['.repeat(129) + ']'.repeat(129)` is 129 levels deep whether or not the\n * innermost list is empty, and a check reached only from a child value would admit it.\n */\n private enterContainer(path: string, depth: number): void {\n if (tooDeep(depth + 1)) {\n this.fail(\n `nesting deeper than ${String(MAX_NESTING_DEPTH)} levels; flatten the value so nesting stays within ${String(MAX_NESTING_DEPTH)} levels`,\n path,\n 'nesting',\n );\n }\n }\n\n private skipWhitespace(): void {\n while (this.index < this.text.length) {\n const char = this.text[this.index];\n if (char !== ' ' && char !== '\\t' && char !== '\\n' && char !== '\\r') return;\n this.index += 1;\n }\n }\n\n private expect(char: string, path: string): void {\n if (this.text[this.index] !== char) this.fail(`expected ${JSON.stringify(char)}`, path);\n this.index += 1;\n }\n\n private parseValue(path: string, depth: number): unknown {\n this.skipWhitespace();\n const char = this.text[this.index];\n if (char === undefined) {\n this.fail(\n this.text.trim() === ''\n ? 'the document is empty; state one JSON value'\n : 'expected a value, found the end of the document',\n path,\n );\n }\n switch (char) {\n case '{':\n return this.parseObject(path, depth);\n case '[':\n return this.parseArray(path, depth);\n case '\"':\n return this.parseString(path);\n case 't':\n return this.parseLiteral('true', true, path);\n case 'f':\n return this.parseLiteral('false', false, path);\n case 'n':\n return this.parseLiteral('null', null, path);\n default:\n return this.parseNumber(path);\n }\n }\n\n private parseLiteral(text: string, value: boolean | null, path: string): unknown {\n if (this.text.slice(this.index, this.index + text.length) !== text) {\n this.fail(`expected ${text}`, path);\n }\n this.index += text.length;\n return value;\n }\n\n private parseNumber(path: string): number {\n const start = this.index;\n while (this.index < this.text.length) {\n const char = this.text[this.index];\n if (char === undefined || !NUMBER_CHARS.has(char)) break;\n this.index += 1;\n }\n const text = this.text.slice(start, this.index);\n // The scan stops at the first character that cannot be part of a number, so a document\n // whose value starts with a byte order mark, a letter or a bare sign leaves a token that\n // is not a number at all. That is a syntax refusal, not a claim about an integer spelling\n // the document never had; `NaN` and `Infinity` land here too. The refusal names the\n // admitted shape rather than quoting the text, so no submitted value reaches the message.\n if (!NUMBER_SPELLING_PATTERN.test(text)) {\n this.fail('expected a value; the text at this offset starts no JSON value', path);\n }\n // The profile's number rule lives in `restricted-value`, so a YAML scalar and a JSON token\n // cannot be judged by two different readings of it. The token is still classified before it\n // is converted, so `1.0` can never silently become the integer `1`.\n const refusal = restrictedNumberTextRefusal(text);\n if (refusal !== undefined) this.fail(refusal.detail, path, refusal.reason);\n return Number(text);\n }\n\n private parseString(path: string): string {\n this.expect('\"', path);\n // A string is one value however long it is — a 50 MB body is one member — and appending one\n // code unit at a time made the reader a per-character loop over it. The closing quote is\n // found natively and the run is sliced once; the slice is then walked once for the three\n // things it cannot carry (an escape, a control character, an unpaired surrogate). Searching\n // the remaining document for a backslash instead would be quadratic on a body of many short\n // strings, so the scan never leaves the run.\n const quote = this.text.indexOf('\"', this.index);\n if (quote < 0)\n this.fail(\n 'unterminated string; close the string with a quote to end it',\n path,\n 'unterminated_string',\n );\n const value = this.text.slice(this.index, quote);\n const violation = stringViolation(value);\n if (violation?.reason === 'escape') return this.parseEscapedString(path);\n if (violation !== undefined) {\n this.index += violation.index;\n if (violation.reason === 'control') {\n this.fail(\n 'unescaped control character in string; escape the control or remove it, since strings admit only escaped controls',\n path,\n 'control_character',\n );\n }\n this.fail(\n 'string carries an unpaired surrogate; pair the surrogate or escape the unit, since strings admit only paired surrogates',\n path,\n 'unpaired_surrogate',\n );\n }\n this.index = quote + 1;\n return value;\n }\n\n /**\n * The same string production, one code unit at a time, for a run an escape or a control\n * character interrupts.\n */\n private parseEscapedString(path: string): string {\n let result = '';\n while (true) {\n const char = this.text[this.index];\n if (char === undefined)\n this.fail(\n 'unterminated string; close the string with a quote to end it',\n path,\n 'unterminated_string',\n );\n this.index += 1;\n if (char === '\"') {\n // A lone surrogate has no UTF-8 encoding, and\n // letting it past ingestion lets downstream URI/UTF-8 encoders throw a raw `URIError`.\n if (hasUnpairedSurrogate(result)) {\n this.fail(\n 'string carries an unpaired surrogate; pair the surrogate or escape the unit, since strings admit only paired surrogates',\n path,\n 'unpaired_surrogate',\n );\n }\n return result;\n }\n if (char === '\\\\') {\n result += this.parseEscape(path);\n continue;\n }\n if (char < ' ')\n this.fail(\n 'unescaped control character in string; escape the control or remove it, since strings admit only escaped controls',\n path,\n 'control_character',\n );\n result += char;\n }\n }\n\n private parseEscape(path: string): string {\n const char = this.text[this.index];\n this.index += 1;\n switch (char) {\n case '\"':\n return '\"';\n case '\\\\':\n return '\\\\';\n case '/':\n return '/';\n case 'b':\n return '\\b';\n case 'f':\n return '\\f';\n case 'n':\n return '\\n';\n case 'r':\n return '\\r';\n case 't':\n return '\\t';\n case 'u': {\n const hex = this.text.slice(this.index, this.index + 4);\n if (!/^[0-9a-fA-F]{4}$/.test(hex))\n this.fail(\n 'invalid unicode escape; write \\\\u followed by four hex digits',\n path,\n 'unicode_escape',\n );\n this.index += 4;\n return String.fromCharCode(Number.parseInt(hex, 16));\n }\n default:\n return this.fail(\n 'invalid escape; escape only the characters JSON names',\n path,\n 'invalid_escape',\n );\n }\n }\n\n private parseArray(path: string, depth: number): unknown[] {\n this.enterContainer(path, depth);\n this.expect('[', path);\n const items = emptyList();\n this.skipWhitespace();\n if (this.text[this.index] === ']') {\n this.index += 1;\n closeList(items, 'plain');\n return items;\n }\n while (true) {\n items[items.length] = this.parseValue(`${path}[${String(items.length)}]`, depth + 1);\n this.skipWhitespace();\n if (this.text[this.index] === ',') {\n this.index += 1;\n continue;\n }\n this.expect(']', path);\n closeList(items, 'plain');\n return items;\n }\n }\n\n private parseObject(path: string, depth: number): Record<string, unknown> {\n this.enterContainer(path, depth);\n this.expect('{', path);\n const result: Record<string, unknown> = {};\n this.skipWhitespace();\n if (this.text[this.index] === '}') {\n this.index += 1;\n return result;\n }\n while (true) {\n this.skipWhitespace();\n const key = this.parseString(path);\n const childPath = memberPath(path, key);\n if (Object.hasOwn(result, key)) {\n this.fail(\n `duplicate object member ${JSON.stringify(key)}; state each member name once`,\n path,\n 'duplicate_member',\n );\n }\n this.skipWhitespace();\n this.expect(':', childPath);\n setOwn(result, key, this.parseValue(childPath, depth + 1));\n this.skipWhitespace();\n if (this.text[this.index] === ',') {\n this.index += 1;\n continue;\n }\n this.expect('}', path);\n return result;\n }\n }\n}\n\n/**\n * Ingests JSON text, refusing duplicate object member names before anything validates\n * or hashes it. Numbers are read as canonical JSON integers only, so\n * a float cannot hide behind a spelling like `1.0`.\n */\nexport function parseRestrictedJson(text: string): unknown {\n return new JsonReader(text).parseDocument();\n}\n"]}
@@ -0,0 +1,59 @@
1
+ import type { JsonIngestReason } from '../model/errors.js';
2
+ /**
3
+ * The value-level half of the restricted JSON profile.
4
+ *
5
+ * The text reader in `restricted-json.ts` refuses a document while it is still bytes; this walk
6
+ * refuses a document that arrived as a value — a YAML front door resolves its anchors, aliases
7
+ * and tags into a plain tree before asking here. The two share these predicates, so a rule that
8
+ * is added to one cannot be missing from the other: what the text reader can only state from a
9
+ * spelling (a float written `1.0`) is classified from the spelling by
10
+ * `restrictedNumberTextRefusal`, and everything a plain JavaScript value can answer — `-0`, an
11
+ * unsafe integer, a cycle, a string with no UTF-8 encoding — is answered here.
12
+ */
13
+ /** The reasons a number falls outside the profile's integer-only number domain. */
14
+ export type RestrictedNumberReason = Extract<JsonIngestReason, 'negative_zero' | 'integer' | 'unsafe_integer'>;
15
+ /** One number's refusal, stated without a path: the caller knows where it found the value. */
16
+ export interface RestrictedNumberRefusal {
17
+ readonly reason: RestrictedNumberReason;
18
+ readonly detail: string;
19
+ }
20
+ /**
21
+ * Why a number handed over as a value is outside the profile, or `undefined` when it is inside.
22
+ *
23
+ * The spelling is not available here, so a float is named by its shortest JavaScript spelling.
24
+ * The text reader uses `restrictedNumberTextRefusal` instead, which names the spelling the
25
+ * document actually wrote; the reason and the message shape are the same.
26
+ */
27
+ export declare function restrictedNumberViolation(value: number): RestrictedNumberRefusal | undefined;
28
+ /**
29
+ * Why a numeric spelling is outside the profile, or `undefined` when it is inside.
30
+ *
31
+ * This is the one implementation of the profile's number rule: the JSON reader hands it the
32
+ * token it scanned, and the YAML front door hands it the source text of a plain numeric scalar,
33
+ * so a document cannot be refused for `1e3` on one path and admitted on the other.
34
+ */
35
+ export declare function restrictedNumberTextRefusal(text: string): RestrictedNumberRefusal | undefined;
36
+ /**
37
+ * Why a value cannot be ingested, by the class of value found.
38
+ *
39
+ * `cycle` and `non_json_value` belong to the value walk: a text reader cannot construct either,
40
+ * while a YAML document can reach both through an alias and a tag.
41
+ */
42
+ export type RestrictedValueReason = RestrictedNumberReason | 'unpaired_surrogate' | 'nesting' | 'cycle' | 'non_json_value';
43
+ /** One reason a plain value is outside the profile, with the path the walk reached it by. */
44
+ export interface RestrictedValueRefusal {
45
+ /** The path in the same `$.a.b[0]` notation every compiler diagnostic states. */
46
+ readonly path: string;
47
+ readonly reason: RestrictedValueReason;
48
+ readonly detail: string;
49
+ }
50
+ /**
51
+ * The first reason a plain JavaScript value is outside the restricted profile, or `undefined`
52
+ * when the profile admits it.
53
+ *
54
+ * The walk is total over `unknown` and never throws for a value it refuses. It keeps an ancestor
55
+ * set rather than a visited set, so one value reached twice through two aliases is an ordinary
56
+ * shared subtree while a value reached from itself is the cycle it is.
57
+ */
58
+ export declare function restrictedValueRefusal(value: unknown): RestrictedValueRefusal | undefined;
59
+ //# sourceMappingURL=restricted-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restricted-value.d.ts","sourceRoot":"","sources":["../../src/canonical/restricted-value.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAY3D;;;;;;;;;;GAUG;AAEH,mFAAmF;AACnF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAC1C,gBAAgB,EAChB,eAAe,GAAG,SAAS,GAAG,gBAAgB,CAC/C,CAAC;AAEF,8FAA8F;AAC9F,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAU5F;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAa7F;AAED;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAC7B,sBAAsB,GACtB,oBAAoB,GACpB,SAAS,GACT,OAAO,GACP,gBAAgB,CAAC;AAErB,6FAA6F;AAC7F,MAAM,WAAW,sBAAsB;IACrC,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAqHD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,GAAG,SAAS,CAEzF"}