@noy-db/hub 0.2.0-pre.9 → 0.3.0-pre.10

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 (615) hide show
  1. package/README.md +129 -3
  2. package/dist/aggregate/index.d.ts +5 -2
  3. package/dist/aggregate/index.js +25 -16
  4. package/dist/aggregate/index.js.map +1 -1
  5. package/dist/api-TX2EX2FX.js +20 -0
  6. package/dist/as/index.d.ts +6 -0
  7. package/dist/as/index.js +30 -0
  8. package/dist/at/index.d.ts +4 -0
  9. package/dist/at/index.js +1 -0
  10. package/dist/attestation/index.d.ts +14 -47
  11. package/dist/attestation/index.js +60 -10
  12. package/dist/attestation/index.js.map +1 -1
  13. package/dist/backup-R7NTDFKY.js +225 -0
  14. package/dist/backup-R7NTDFKY.js.map +1 -0
  15. package/dist/blobs/index.d.ts +5 -8
  16. package/dist/blobs/index.js +25 -12
  17. package/dist/blobs/index.js.map +1 -1
  18. package/dist/bundle/index.d.ts +15 -70
  19. package/dist/bundle/index.js +45 -476
  20. package/dist/bundle/index.js.map +1 -1
  21. package/dist/{ulid-CJ8RzRrm.d.ts → bundle-D6GxiUfq.d.ts} +31 -86
  22. package/dist/by/index.d.ts +1 -0
  23. package/dist/by/index.js +11 -0
  24. package/dist/cargo/index.d.ts +7 -0
  25. package/dist/cargo/index.js +95 -0
  26. package/dist/chunk-2OV5NVE7.js +95 -0
  27. package/dist/chunk-2OV5NVE7.js.map +1 -0
  28. package/dist/chunk-2OZXVKVP.js +367 -0
  29. package/dist/chunk-2OZXVKVP.js.map +1 -0
  30. package/dist/{chunk-HNRHLRDC.js → chunk-2REPHKET.js} +6 -5
  31. package/dist/chunk-2REPHKET.js.map +1 -0
  32. package/dist/{chunk-PE2FR4J3.js → chunk-3JXPAHOZ.js} +17 -17
  33. package/dist/chunk-3JXPAHOZ.js.map +1 -0
  34. package/dist/{chunk-H2X3ISXG.js → chunk-3MATJ6O4.js} +7 -7
  35. package/dist/chunk-3MATJ6O4.js.map +1 -0
  36. package/dist/{chunk-PP6W64Y3.js → chunk-3OPY6MK2.js} +132 -3
  37. package/dist/chunk-3OPY6MK2.js.map +1 -0
  38. package/dist/{chunk-T7JEBOGN.js → chunk-3QSIU3UT.js} +49 -71
  39. package/dist/chunk-3QSIU3UT.js.map +1 -0
  40. package/dist/{chunk-ZYWZWG6G.js → chunk-4OMCIY6F.js} +32 -12
  41. package/dist/chunk-4OMCIY6F.js.map +1 -0
  42. package/dist/chunk-4Q6HSHHL.js +90 -0
  43. package/dist/chunk-4Q6HSHHL.js.map +1 -0
  44. package/dist/chunk-5I35DOHK.js +94 -0
  45. package/dist/chunk-5I35DOHK.js.map +1 -0
  46. package/dist/chunk-5VG4IJR7.js +235 -0
  47. package/dist/chunk-5VG4IJR7.js.map +1 -0
  48. package/dist/chunk-5YESYH2C.js +155 -0
  49. package/dist/chunk-5YESYH2C.js.map +1 -0
  50. package/dist/chunk-6G5ORS5D.js +202 -0
  51. package/dist/chunk-6G5ORS5D.js.map +1 -0
  52. package/dist/{chunk-VTKGMEPP.js → chunk-6P5XCKSD.js} +13 -3
  53. package/dist/chunk-6P5XCKSD.js.map +1 -0
  54. package/dist/{chunk-J66GRPNH.js → chunk-6S7T6WC4.js} +2 -2
  55. package/dist/chunk-6S7T6WC4.js.map +1 -0
  56. package/dist/{chunk-U26HQ6KJ.js → chunk-7BWJHO2A.js} +4 -4
  57. package/dist/chunk-7BWJHO2A.js.map +1 -0
  58. package/dist/chunk-7P2SDJG3.js +279 -0
  59. package/dist/chunk-7P2SDJG3.js.map +1 -0
  60. package/dist/chunk-ANB77BVV.js +150 -0
  61. package/dist/chunk-ANB77BVV.js.map +1 -0
  62. package/dist/chunk-AURFOK3D.js +35 -0
  63. package/dist/chunk-AURFOK3D.js.map +1 -0
  64. package/dist/chunk-BKARNZJN.js +382 -0
  65. package/dist/chunk-BKARNZJN.js.map +1 -0
  66. package/dist/{chunk-3BFJOWSU.js → chunk-BQISD5ZV.js} +35 -7
  67. package/dist/chunk-BQISD5ZV.js.map +1 -0
  68. package/dist/{chunk-2GLDA55J.js → chunk-BUAQ7YI3.js} +260 -135
  69. package/dist/chunk-BUAQ7YI3.js.map +1 -0
  70. package/dist/{chunk-2WUSG3IT.js → chunk-CB7CWSKW.js} +5 -5
  71. package/dist/chunk-CB7CWSKW.js.map +1 -0
  72. package/dist/chunk-CHFZDSE4.js +1 -0
  73. package/dist/{aggregate/index.cjs → chunk-DFVUTGT2.js} +206 -222
  74. package/dist/chunk-DFVUTGT2.js.map +1 -0
  75. package/dist/chunk-DJ7KIPLV.js +23 -0
  76. package/dist/chunk-DJ7KIPLV.js.map +1 -0
  77. package/dist/chunk-DSKDQP3G.js +14066 -0
  78. package/dist/chunk-DSKDQP3G.js.map +1 -0
  79. package/dist/{chunk-5T22KDPN.js → chunk-DV4HUP5G.js} +10 -8
  80. package/dist/chunk-DV4HUP5G.js.map +1 -0
  81. package/dist/chunk-EOXAAJTY.js +621 -0
  82. package/dist/chunk-EOXAAJTY.js.map +1 -0
  83. package/dist/chunk-ET67AY6B.js +74 -0
  84. package/dist/chunk-ET67AY6B.js.map +1 -0
  85. package/dist/chunk-F4CEK5YM.js +123 -0
  86. package/dist/chunk-F4CEK5YM.js.map +1 -0
  87. package/dist/chunk-FORYWFN6.js +130 -0
  88. package/dist/chunk-FORYWFN6.js.map +1 -0
  89. package/dist/{chunk-JWRVQKRZ.js → chunk-FRP6D2DM.js} +21 -20
  90. package/dist/chunk-FRP6D2DM.js.map +1 -0
  91. package/dist/chunk-FUOE7UUV.js +341 -0
  92. package/dist/chunk-FUOE7UUV.js.map +1 -0
  93. package/dist/chunk-G4JYND6L.js +42 -0
  94. package/dist/chunk-G4JYND6L.js.map +1 -0
  95. package/dist/{chunk-53XBRIRT.js → chunk-G6XV4H65.js} +9 -9
  96. package/dist/chunk-G6XV4H65.js.map +1 -0
  97. package/dist/chunk-GHVIKOHT.js +1 -0
  98. package/dist/{chunk-PX35GA7L.js → chunk-GNMXXTMN.js} +11 -9
  99. package/dist/chunk-GNMXXTMN.js.map +1 -0
  100. package/dist/chunk-GYGLAVCX.js +19 -0
  101. package/dist/chunk-GYGLAVCX.js.map +1 -0
  102. package/dist/chunk-HPWKV3YB.js +21 -0
  103. package/dist/chunk-HPWKV3YB.js.map +1 -0
  104. package/dist/chunk-HY3AUMFI.js +41 -0
  105. package/dist/chunk-HY3AUMFI.js.map +1 -0
  106. package/dist/chunk-HYR4WZZ3.js +69 -0
  107. package/dist/chunk-HYR4WZZ3.js.map +1 -0
  108. package/dist/chunk-I7FD46FF.js +9 -0
  109. package/dist/chunk-I7FD46FF.js.map +1 -0
  110. package/dist/{chunk-TFBP23BX.js → chunk-ICXIFFYZ.js} +66 -7
  111. package/dist/chunk-ICXIFFYZ.js.map +1 -0
  112. package/dist/{chunk-TV3YZ35S.js → chunk-IGJCYUT5.js} +17 -8
  113. package/dist/chunk-IGJCYUT5.js.map +1 -0
  114. package/dist/{chunk-F3GDRNUT.js → chunk-IVLTXX4W.js} +36 -68
  115. package/dist/chunk-IVLTXX4W.js.map +1 -0
  116. package/dist/{chunk-DONMZAD2.js → chunk-J4LPNIGK.js} +62 -169
  117. package/dist/chunk-J4LPNIGK.js.map +1 -0
  118. package/dist/chunk-JJZ2LW6T.js +36 -0
  119. package/dist/chunk-JJZ2LW6T.js.map +1 -0
  120. package/dist/chunk-JK733I5V.js +23 -0
  121. package/dist/chunk-JK733I5V.js.map +1 -0
  122. package/dist/{chunk-3YPCK6JX.js → chunk-KJ2BCBTL.js} +181 -422
  123. package/dist/chunk-KJ2BCBTL.js.map +1 -0
  124. package/dist/chunk-KNZB6JMR.js +129 -0
  125. package/dist/chunk-KNZB6JMR.js.map +1 -0
  126. package/dist/{chunk-OIF6LZUR.js → chunk-KPZS5QAQ.js} +30 -11
  127. package/dist/chunk-KPZS5QAQ.js.map +1 -0
  128. package/dist/chunk-LB7FD65R.js +163 -0
  129. package/dist/chunk-LB7FD65R.js.map +1 -0
  130. package/dist/{chunk-DO7C2TOG.js → chunk-LEJIKBBB.js} +3 -3
  131. package/dist/{chunk-DO7C2TOG.js.map → chunk-LEJIKBBB.js.map} +1 -1
  132. package/dist/{chunk-O3VZPBZG.js → chunk-LL2NIVUR.js} +56 -13
  133. package/dist/chunk-LL2NIVUR.js.map +1 -0
  134. package/dist/chunk-LP7BEXCT.js +32 -0
  135. package/dist/chunk-LP7BEXCT.js.map +1 -0
  136. package/dist/chunk-MCHVVJIA.js +968 -0
  137. package/dist/chunk-MCHVVJIA.js.map +1 -0
  138. package/dist/chunk-NO272T7Q.js +194 -0
  139. package/dist/chunk-NO272T7Q.js.map +1 -0
  140. package/dist/{chunk-22DWZL57.js → chunk-NUEQU36L.js} +70 -267
  141. package/dist/chunk-NUEQU36L.js.map +1 -0
  142. package/dist/chunk-O45M6LDB.js +38 -0
  143. package/dist/chunk-O45M6LDB.js.map +1 -0
  144. package/dist/chunk-OBKWYKYC.js +117 -0
  145. package/dist/chunk-OBKWYKYC.js.map +1 -0
  146. package/dist/{chunk-DJHHA6XH.js → chunk-OHHKHSJP.js} +50 -20
  147. package/dist/chunk-OHHKHSJP.js.map +1 -0
  148. package/dist/chunk-OT76OZL6.js +45 -0
  149. package/dist/chunk-OT76OZL6.js.map +1 -0
  150. package/dist/chunk-OVYRLHPE.js +150 -0
  151. package/dist/chunk-OVYRLHPE.js.map +1 -0
  152. package/dist/{chunk-ML236QKC.js → chunk-OXCSVM3B.js} +5 -5
  153. package/dist/chunk-OXCSVM3B.js.map +1 -0
  154. package/dist/chunk-P33LUIML.js +205 -0
  155. package/dist/chunk-P33LUIML.js.map +1 -0
  156. package/dist/{chunk-DL3HWOQ5.js → chunk-PLS64NCS.js} +10 -8
  157. package/dist/chunk-PLS64NCS.js.map +1 -0
  158. package/dist/{chunk-SYMWGEET.js → chunk-PS2NEWEX.js} +3 -3
  159. package/dist/chunk-PS2NEWEX.js.map +1 -0
  160. package/dist/chunk-PY4KJPYU.js +9 -0
  161. package/dist/chunk-PY4KJPYU.js.map +1 -0
  162. package/dist/chunk-PZ5AY32C.js +10 -0
  163. package/dist/chunk-QA2KUPCP.js +45 -0
  164. package/dist/chunk-QA2KUPCP.js.map +1 -0
  165. package/dist/chunk-QOC3VYL2.js +30 -0
  166. package/dist/chunk-QOC3VYL2.js.map +1 -0
  167. package/dist/{chunk-BVRYKATC.js → chunk-QSFOZUYL.js} +62 -34
  168. package/dist/chunk-QSFOZUYL.js.map +1 -0
  169. package/dist/chunk-RHK32N73.js +30 -0
  170. package/dist/chunk-RHK32N73.js.map +1 -0
  171. package/dist/{chunk-K3DK3NU5.js → chunk-RW3Y22MW.js} +20 -5
  172. package/dist/chunk-RW3Y22MW.js.map +1 -0
  173. package/dist/{chunk-B6PB7JLN.js → chunk-S7VFUQM2.js} +541 -6
  174. package/dist/chunk-S7VFUQM2.js.map +1 -0
  175. package/dist/chunk-SVLR4POP.js +64 -0
  176. package/dist/chunk-SVLR4POP.js.map +1 -0
  177. package/dist/chunk-T7WSLRAU.js +49 -0
  178. package/dist/chunk-T7WSLRAU.js.map +1 -0
  179. package/dist/{chunk-WPLVTJ5D.js → chunk-TAKWLZZX.js} +285 -63
  180. package/dist/chunk-TAKWLZZX.js.map +1 -0
  181. package/dist/chunk-THNJ3IKU.js +17 -0
  182. package/dist/chunk-THNJ3IKU.js.map +1 -0
  183. package/dist/{chunk-XJFLDA7A.js → chunk-TMBXVJKT.js} +9 -6
  184. package/dist/chunk-TMBXVJKT.js.map +1 -0
  185. package/dist/chunk-TWKKOM55.js +54 -0
  186. package/dist/chunk-TWKKOM55.js.map +1 -0
  187. package/dist/chunk-U3WZCU7E.js +14 -0
  188. package/dist/chunk-U3WZCU7E.js.map +1 -0
  189. package/dist/{chunk-Z6FNBOTC.js → chunk-UF362QVH.js} +15 -17
  190. package/dist/chunk-UF362QVH.js.map +1 -0
  191. package/dist/chunk-UN4FVIBH.js +135 -0
  192. package/dist/chunk-UN4FVIBH.js.map +1 -0
  193. package/dist/chunk-VEAVKDDB.js +29 -0
  194. package/dist/chunk-VEAVKDDB.js.map +1 -0
  195. package/dist/chunk-VEPTFUJY.js +29 -0
  196. package/dist/chunk-VEPTFUJY.js.map +1 -0
  197. package/dist/chunk-VJV7GKQK.js +662 -0
  198. package/dist/chunk-VJV7GKQK.js.map +1 -0
  199. package/dist/{chunk-2QR2PQTT.js → chunk-VQNJ7UZL.js} +5 -3
  200. package/dist/chunk-VQNJ7UZL.js.map +1 -0
  201. package/dist/chunk-VQRAIPYF.js +50 -0
  202. package/dist/chunk-VQRAIPYF.js.map +1 -0
  203. package/dist/{chunk-DFMLEQZB.js → chunk-VRIYFLBA.js} +5 -10
  204. package/dist/chunk-VRIYFLBA.js.map +1 -0
  205. package/dist/chunk-VWM3DAVB.js +265 -0
  206. package/dist/chunk-VWM3DAVB.js.map +1 -0
  207. package/dist/{chunk-NONAAENK.js → chunk-VWRRVE6D.js} +11 -4
  208. package/dist/chunk-VWRRVE6D.js.map +1 -0
  209. package/dist/chunk-VYYM3MEN.js +98 -0
  210. package/dist/chunk-VYYM3MEN.js.map +1 -0
  211. package/dist/chunk-WBJIQSLL.js +167 -0
  212. package/dist/chunk-WBJIQSLL.js.map +1 -0
  213. package/dist/chunk-WIGQB62E.js +164 -0
  214. package/dist/chunk-WIGQB62E.js.map +1 -0
  215. package/dist/{chunk-EMIGCR7X.js → chunk-WXSYDNBT.js} +2 -2
  216. package/dist/chunk-WXSYDNBT.js.map +1 -0
  217. package/dist/chunk-WZSCE6RM.js +466 -0
  218. package/dist/chunk-WZSCE6RM.js.map +1 -0
  219. package/dist/chunk-XGDAPN6M.js +255 -0
  220. package/dist/chunk-XGDAPN6M.js.map +1 -0
  221. package/dist/{chunk-QODLLGQ7.js → chunk-XH7XP3OL.js} +372 -37
  222. package/dist/chunk-XH7XP3OL.js.map +1 -0
  223. package/dist/chunk-XREOISSI.js +40 -0
  224. package/dist/chunk-XREOISSI.js.map +1 -0
  225. package/dist/chunk-XUBPSPKD.js +164 -0
  226. package/dist/chunk-XUBPSPKD.js.map +1 -0
  227. package/dist/chunk-Y3A5CB5G.js +247 -0
  228. package/dist/chunk-Y3A5CB5G.js.map +1 -0
  229. package/dist/{chunk-I5FOWO4J.js → chunk-YCXCR7VG.js} +52 -73
  230. package/dist/chunk-YCXCR7VG.js.map +1 -0
  231. package/dist/{chunk-A3JMGXPG.js → chunk-YMUGBZN2.js} +2 -2
  232. package/dist/chunk-YMUGBZN2.js.map +1 -0
  233. package/dist/chunk-YMVQD5Q5.js +453 -0
  234. package/dist/chunk-YMVQD5Q5.js.map +1 -0
  235. package/dist/chunk-YN5IAHN6.js +32 -0
  236. package/dist/chunk-YN5IAHN6.js.map +1 -0
  237. package/dist/{chunk-FZU343FL.js → chunk-ZJADGNYF.js} +2 -2
  238. package/dist/chunk-ZJADGNYF.js.map +1 -0
  239. package/dist/chunk-ZYJ55N7N.js +86 -0
  240. package/dist/chunk-ZYJ55N7N.js.map +1 -0
  241. package/dist/classified/index.d.ts +16 -0
  242. package/dist/classified/index.js +40 -0
  243. package/dist/classified-marker-H6YSHYNK.js +24 -0
  244. package/dist/classified-marker-H6YSHYNK.js.map +1 -0
  245. package/dist/collection-facade-LVD22JLM.js +39 -0
  246. package/dist/computed-EXDMQODG.js +11 -0
  247. package/dist/consent/index.d.ts +4 -7
  248. package/dist/consent/index.js +13 -5
  249. package/dist/consent/index.js.map +1 -1
  250. package/dist/crdt/index.d.ts +5 -2
  251. package/dist/crdt/index.js +3 -2
  252. package/dist/crdt/index.js.map +1 -1
  253. package/dist/dead-filter-HQIE2YG7.js +28 -0
  254. package/dist/dead-filter-HQIE2YG7.js.map +1 -0
  255. package/dist/decrypt-partition-IHtxEnTi.d.ts +21 -0
  256. package/dist/delegation-BJP73GAP.js +25 -0
  257. package/dist/derivations/index.d.ts +6 -9
  258. package/dist/derivations/index.js +18 -6
  259. package/dist/derive-BME7HDWO.js +21 -0
  260. package/dist/{dev-unlock-B4kDxep_.d.ts → dev-unlock-Bmm2pgJ0.d.ts} +1 -1
  261. package/dist/discriminant-BN9REW3o.d.ts +60 -0
  262. package/dist/enclave-NHORSWSF.js +125 -0
  263. package/dist/executor-FE6X4LFX.js +9 -0
  264. package/dist/executor-KSHKRJXP.js +25 -0
  265. package/dist/executor-ZHTJJICG.js +9 -0
  266. package/dist/export-accessible-DACHM5VT.js +23 -0
  267. package/dist/extract-partition-RNENZZ4T.js +36 -0
  268. package/dist/fanout-sidecar-OFWN3NM7.js +74 -0
  269. package/dist/fanout-sidecar-OFWN3NM7.js.map +1 -0
  270. package/dist/fence-watcher-DHQ775JB.js +69 -0
  271. package/dist/fence-watcher-DHQ775JB.js.map +1 -0
  272. package/dist/find-BNGBJNKP.js +11 -0
  273. package/dist/forget/index.d.ts +36 -0
  274. package/dist/forget/index.js +25 -0
  275. package/dist/forget/index.js.map +1 -0
  276. package/dist/guards/index.d.ts +12 -9
  277. package/dist/guards/index.js +12 -5
  278. package/dist/{hash-DdpVypUp.d.cts → hash-DAJjMsCE.d.ts} +10 -1
  279. package/dist/history/index.d.ts +5 -8
  280. package/dist/history/index.js +25 -12
  281. package/dist/history/index.js.map +1 -1
  282. package/dist/i18n/index.d.ts +25 -8
  283. package/dist/i18n/index.js +137 -29
  284. package/dist/i18n/index.js.map +1 -1
  285. package/dist/in/index.d.ts +4 -0
  286. package/dist/in/index.js +1 -0
  287. package/dist/in/index.js.map +1 -0
  288. package/dist/index-B9QdHytu.d.ts +123 -0
  289. package/dist/index-DjWbxsjb.d.ts +23579 -0
  290. package/dist/index-qwuNvO2B.d.ts +144 -0
  291. package/dist/index.d.ts +1179 -449
  292. package/dist/index.js +2524 -312
  293. package/dist/index.js.map +1 -1
  294. package/dist/indexing/index.d.ts +5 -3
  295. package/dist/indexing/index.js +6 -5
  296. package/dist/indexing/index.js.map +1 -1
  297. package/dist/issue-NDI4CVZU.js +19 -0
  298. package/dist/issue-NDI4CVZU.js.map +1 -0
  299. package/dist/json-schema-I22JCYCG.js +44 -0
  300. package/dist/json-schema-I22JCYCG.js.map +1 -0
  301. package/dist/lazy/index.d.ts +20 -0
  302. package/dist/lazy/index.js +12 -0
  303. package/dist/lazy/index.js.map +1 -0
  304. package/dist/ledger-6NDS2EO4.js +42 -0
  305. package/dist/ledger-6NDS2EO4.js.map +1 -0
  306. package/dist/liberate-HN3RIGIP.js +24 -0
  307. package/dist/liberate-HN3RIGIP.js.map +1 -0
  308. package/dist/link-set-SJB2MVJV.js +31 -0
  309. package/dist/link-set-SJB2MVJV.js.map +1 -0
  310. package/dist/materialized-views/index.d.ts +23 -20
  311. package/dist/materialized-views/index.js +26 -12
  312. package/dist/mime-magic-bBj5OgUC.d.ts +103 -0
  313. package/dist/noydb-BWF6EPIR.js +66 -0
  314. package/dist/noydb-BWF6EPIR.js.map +1 -0
  315. package/dist/on/index.d.ts +4 -0
  316. package/dist/on/index.js +17 -0
  317. package/dist/on/index.js.map +1 -0
  318. package/dist/overlay-views/index.d.ts +26 -11
  319. package/dist/overlay-views/index.js +7 -6
  320. package/dist/periods/index.d.ts +4 -7
  321. package/dist/periods/index.js +27 -9
  322. package/dist/pod/index.d.ts +62 -0
  323. package/dist/pod/index.js +67 -0
  324. package/dist/pod/index.js.map +1 -0
  325. package/dist/policy-WGNAG5H6.js +41 -0
  326. package/dist/policy-WGNAG5H6.js.map +1 -0
  327. package/dist/portability/index.d.ts +19 -0
  328. package/dist/portability/index.js +43 -0
  329. package/dist/portability/index.js.map +1 -0
  330. package/dist/post-register-CWKBQRC7.js +55 -0
  331. package/dist/post-register-CWKBQRC7.js.map +1 -0
  332. package/dist/{public-envelope-BW6OXORV.js → public-envelope-EJLVIFX7.js} +6 -5
  333. package/dist/public-envelope-EJLVIFX7.js.map +1 -0
  334. package/dist/query/index.d.ts +4 -3
  335. package/dist/query/index.js +24 -13
  336. package/dist/read-only-facade-CHCKSEPD.js +8 -0
  337. package/dist/read-only-facade-CHCKSEPD.js.map +1 -0
  338. package/dist/register-SBIX7TVV.js +23 -0
  339. package/dist/register-SBIX7TVV.js.map +1 -0
  340. package/dist/registry-3EQG6OOE.js +18 -0
  341. package/dist/registry-3EQG6OOE.js.map +1 -0
  342. package/dist/registry-CA327ACV.js +9 -0
  343. package/dist/registry-CA327ACV.js.map +1 -0
  344. package/dist/registry-E7OXOTSV.js +19 -0
  345. package/dist/registry-E7OXOTSV.js.map +1 -0
  346. package/dist/registry-VW6P6A3J.js +8 -0
  347. package/dist/registry-VW6P6A3J.js.map +1 -0
  348. package/dist/request-withdrawal-KAH2AAXC.js +31 -0
  349. package/dist/request-withdrawal-KAH2AAXC.js.map +1 -0
  350. package/dist/reveal-R3JLHMUF.js +38 -0
  351. package/dist/reveal-R3JLHMUF.js.map +1 -0
  352. package/dist/revoke-IXLOJ3IH.js +24 -0
  353. package/dist/revoke-IXLOJ3IH.js.map +1 -0
  354. package/dist/satellites/index.d.ts +4 -0
  355. package/dist/satellites/index.js +8 -0
  356. package/dist/satellites/index.js.map +1 -0
  357. package/dist/sealed-record/index.d.ts +68 -0
  358. package/dist/sealed-record/index.js +71 -0
  359. package/dist/sealed-record/index.js.map +1 -0
  360. package/dist/session/index.d.ts +5 -8
  361. package/dist/session/index.js +13 -5
  362. package/dist/session/index.js.map +1 -1
  363. package/dist/shadow/index.d.ts +4 -7
  364. package/dist/shadow/index.js +4 -3
  365. package/dist/shadow/index.js.map +1 -1
  366. package/dist/signer-Y46N2GJ3.js +25 -0
  367. package/dist/signer-Y46N2GJ3.js.map +1 -0
  368. package/dist/snapshots/index.d.ts +5 -8
  369. package/dist/snapshots/index.js +19 -11
  370. package/dist/snapshots/index.js.map +1 -1
  371. package/dist/{stale-6ZDBTQT7.js → stale-Z7IW6RIL.js} +3 -2
  372. package/dist/stale-Z7IW6RIL.js.map +1 -0
  373. package/dist/storage-ADNP2UWI.js +23 -0
  374. package/dist/storage-ADNP2UWI.js.map +1 -0
  375. package/dist/store-coordination-provider-DTDMI6VL.js +142 -0
  376. package/dist/store-coordination-provider-DTDMI6VL.js.map +1 -0
  377. package/dist/subject-index-CyOgGMJL.d.ts +380 -0
  378. package/dist/sync/index.d.ts +3 -6
  379. package/dist/sync/index.js +13 -6
  380. package/dist/sync/index.js.map +1 -1
  381. package/dist/team/index.d.ts +46 -10
  382. package/dist/team/index.js +35 -18
  383. package/dist/tiers/index.d.ts +4 -0
  384. package/dist/tiers/index.js +39 -0
  385. package/dist/tiers/index.js.map +1 -0
  386. package/dist/to/index.d.ts +4 -0
  387. package/dist/to/index.js +16 -0
  388. package/dist/to/index.js.map +1 -0
  389. package/dist/transition-guard-DI-krBsZ.d.ts +165 -0
  390. package/dist/tx/index.d.ts +22 -9
  391. package/dist/tx/index.js +13 -8
  392. package/dist/tx/index.js.map +1 -1
  393. package/dist/ui/index.d.ts +4 -0
  394. package/dist/ui/index.js +1 -0
  395. package/dist/ui/index.js.map +1 -0
  396. package/dist/ulid-DRH25k3y.d.ts +66 -0
  397. package/dist/ulid-PTAIMDG4.js +10 -0
  398. package/dist/ulid-PTAIMDG4.js.map +1 -0
  399. package/dist/util/index.d.ts +2 -0
  400. package/dist/util/index.js +7 -2
  401. package/dist/util/index.js.map +1 -1
  402. package/dist/validators-BUcli5Nh.d.ts +101 -0
  403. package/dist/vault-diff-Z2DUayMe.d.ts +147 -0
  404. package/dist/verify-JPF2YR5E.js +139 -0
  405. package/dist/verify-JPF2YR5E.js.map +1 -0
  406. package/dist/walk-XYA2O3LW.js +241 -0
  407. package/dist/walk-XYA2O3LW.js.map +1 -0
  408. package/dist/with/index.d.ts +37 -0
  409. package/dist/with/index.js +31 -0
  410. package/dist/with/index.js.map +1 -0
  411. package/dist/{with-materialized-view-BLkQxoQN.d.ts → with-materialized-view-BUmzlXue.d.ts} +1 -1
  412. package/dist/{with-overlayed-view-CRsSEwHR.d.ts → with-overlayed-view-m4FaXXTO.d.ts} +2 -3
  413. package/dist/with-rollup-DEKGI9vb.d.ts +47 -0
  414. package/dist/withdraw-accessible-WLV4MTEN.js +28 -0
  415. package/dist/withdraw-accessible-WLV4MTEN.js.map +1 -0
  416. package/dist/zod-HAJM7LMS.js +14763 -0
  417. package/dist/zod-HAJM7LMS.js.map +1 -0
  418. package/package.json +122 -202
  419. package/dist/aggregate/index.cjs.map +0 -1
  420. package/dist/aggregate/index.d.cts +0 -38
  421. package/dist/attestation/index.cjs +0 -305
  422. package/dist/attestation/index.cjs.map +0 -1
  423. package/dist/attestation/index.d.cts +0 -52
  424. package/dist/blobs/index.cjs +0 -1480
  425. package/dist/blobs/index.cjs.map +0 -1
  426. package/dist/blobs/index.d.cts +0 -46
  427. package/dist/bundle/index.cjs +0 -19264
  428. package/dist/bundle/index.cjs.map +0 -1
  429. package/dist/bundle/index.d.cts +0 -176
  430. package/dist/chunk-22DWZL57.js.map +0 -1
  431. package/dist/chunk-2GLDA55J.js.map +0 -1
  432. package/dist/chunk-2QR2PQTT.js.map +0 -1
  433. package/dist/chunk-2WUSG3IT.js.map +0 -1
  434. package/dist/chunk-3BFJOWSU.js.map +0 -1
  435. package/dist/chunk-3YPCK6JX.js.map +0 -1
  436. package/dist/chunk-53XBRIRT.js.map +0 -1
  437. package/dist/chunk-5T22KDPN.js.map +0 -1
  438. package/dist/chunk-5XHKQ56N.js +0 -340
  439. package/dist/chunk-5XHKQ56N.js.map +0 -1
  440. package/dist/chunk-6CME4UEK.js +0 -10329
  441. package/dist/chunk-6CME4UEK.js.map +0 -1
  442. package/dist/chunk-6STK5TQP.js +0 -139
  443. package/dist/chunk-6STK5TQP.js.map +0 -1
  444. package/dist/chunk-A3JMGXPG.js.map +0 -1
  445. package/dist/chunk-B6PB7JLN.js.map +0 -1
  446. package/dist/chunk-BVRYKATC.js.map +0 -1
  447. package/dist/chunk-DE6GKS6G.js +0 -79
  448. package/dist/chunk-DE6GKS6G.js.map +0 -1
  449. package/dist/chunk-DFMLEQZB.js.map +0 -1
  450. package/dist/chunk-DJHHA6XH.js.map +0 -1
  451. package/dist/chunk-DL3HWOQ5.js.map +0 -1
  452. package/dist/chunk-DONMZAD2.js.map +0 -1
  453. package/dist/chunk-EMIGCR7X.js.map +0 -1
  454. package/dist/chunk-F3GDRNUT.js.map +0 -1
  455. package/dist/chunk-FZU343FL.js.map +0 -1
  456. package/dist/chunk-H2X3ISXG.js.map +0 -1
  457. package/dist/chunk-HNRHLRDC.js.map +0 -1
  458. package/dist/chunk-I5FOWO4J.js.map +0 -1
  459. package/dist/chunk-J66GRPNH.js.map +0 -1
  460. package/dist/chunk-JWRVQKRZ.js.map +0 -1
  461. package/dist/chunk-K3DK3NU5.js.map +0 -1
  462. package/dist/chunk-ML236QKC.js.map +0 -1
  463. package/dist/chunk-NONAAENK.js.map +0 -1
  464. package/dist/chunk-O3VZPBZG.js.map +0 -1
  465. package/dist/chunk-OIF6LZUR.js.map +0 -1
  466. package/dist/chunk-OQ6PIGHA.js +0 -19
  467. package/dist/chunk-OQ6PIGHA.js.map +0 -1
  468. package/dist/chunk-PE2FR4J3.js.map +0 -1
  469. package/dist/chunk-PP6W64Y3.js.map +0 -1
  470. package/dist/chunk-PX35GA7L.js.map +0 -1
  471. package/dist/chunk-QEILDE6R.js +0 -793
  472. package/dist/chunk-QEILDE6R.js.map +0 -1
  473. package/dist/chunk-QODLLGQ7.js.map +0 -1
  474. package/dist/chunk-RAZ4OVLL.js +0 -51
  475. package/dist/chunk-RAZ4OVLL.js.map +0 -1
  476. package/dist/chunk-SYMWGEET.js.map +0 -1
  477. package/dist/chunk-T7JEBOGN.js.map +0 -1
  478. package/dist/chunk-TFBP23BX.js.map +0 -1
  479. package/dist/chunk-TV3YZ35S.js.map +0 -1
  480. package/dist/chunk-U26HQ6KJ.js.map +0 -1
  481. package/dist/chunk-UF3BUNQZ.js +0 -1
  482. package/dist/chunk-UMLVJTYV.js +0 -20
  483. package/dist/chunk-UMLVJTYV.js.map +0 -1
  484. package/dist/chunk-VTKGMEPP.js.map +0 -1
  485. package/dist/chunk-W6EQLGMB.js +0 -100
  486. package/dist/chunk-W6EQLGMB.js.map +0 -1
  487. package/dist/chunk-WIRRPTFH.js +0 -17
  488. package/dist/chunk-WIRRPTFH.js.map +0 -1
  489. package/dist/chunk-WPLVTJ5D.js.map +0 -1
  490. package/dist/chunk-XJFLDA7A.js.map +0 -1
  491. package/dist/chunk-Z6FNBOTC.js.map +0 -1
  492. package/dist/chunk-ZYWZWG6G.js.map +0 -1
  493. package/dist/consent/index.cjs +0 -204
  494. package/dist/consent/index.cjs.map +0 -1
  495. package/dist/consent/index.d.cts +0 -25
  496. package/dist/crdt/index.cjs +0 -152
  497. package/dist/crdt/index.cjs.map +0 -1
  498. package/dist/crdt/index.d.cts +0 -30
  499. package/dist/crypto-HTZ4FJOP.js +0 -44
  500. package/dist/delegation-RI54P6I5.js +0 -17
  501. package/dist/derivations/index.cjs +0 -351
  502. package/dist/derivations/index.cjs.map +0 -1
  503. package/dist/derivations/index.d.cts +0 -72
  504. package/dist/dev-unlock-BIoEFbwm.d.cts +0 -263
  505. package/dist/executor-5PNY7LGW.js +0 -8
  506. package/dist/executor-B4QIYGZX.js +0 -8
  507. package/dist/executor-BWXXDQ7K.js +0 -11
  508. package/dist/fanout-sidecar-OKPMMPLG.js +0 -51
  509. package/dist/fanout-sidecar-OKPMMPLG.js.map +0 -1
  510. package/dist/guards/index.cjs +0 -322
  511. package/dist/guards/index.cjs.map +0 -1
  512. package/dist/guards/index.d.cts +0 -31
  513. package/dist/hash-HJqD14vS.d.ts +0 -63
  514. package/dist/history/index.cjs +0 -1222
  515. package/dist/history/index.cjs.map +0 -1
  516. package/dist/history/index.d.cts +0 -63
  517. package/dist/i18n/index.cjs +0 -1100
  518. package/dist/i18n/index.cjs.map +0 -1
  519. package/dist/i18n/index.d.cts +0 -39
  520. package/dist/index-4fBVt8j9.d.cts +0 -2387
  521. package/dist/index-D8I_pyJD.d.ts +0 -2387
  522. package/dist/index.cjs +0 -24487
  523. package/dist/index.cjs.map +0 -1
  524. package/dist/index.d.cts +0 -776
  525. package/dist/indexing/index.cjs +0 -742
  526. package/dist/indexing/index.cjs.map +0 -1
  527. package/dist/indexing/index.d.cts +0 -36
  528. package/dist/issue-VGDPP4B5.js +0 -12
  529. package/dist/lazy-builder-7tIpFyWN.d.ts +0 -304
  530. package/dist/lazy-builder-wY4pMCEe.d.cts +0 -304
  531. package/dist/ledger-TMRZYNVJ.js +0 -33
  532. package/dist/materialized-views/index.cjs +0 -854
  533. package/dist/materialized-views/index.cjs.map +0 -1
  534. package/dist/materialized-views/index.d.cts +0 -186
  535. package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
  536. package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
  537. package/dist/noydb-G725ZSZG.js +0 -34
  538. package/dist/overlay-views/index.cjs +0 -359
  539. package/dist/overlay-views/index.cjs.map +0 -1
  540. package/dist/overlay-views/index.d.cts +0 -82
  541. package/dist/periods/index.cjs +0 -1041
  542. package/dist/periods/index.cjs.map +0 -1
  543. package/dist/periods/index.d.cts +0 -22
  544. package/dist/predicate-BSAGEyu5.d.cts +0 -209
  545. package/dist/predicate-BSAGEyu5.d.ts +0 -209
  546. package/dist/query/index.cjs +0 -2375
  547. package/dist/query/index.cjs.map +0 -1
  548. package/dist/query/index.d.cts +0 -3
  549. package/dist/read-only-facade-ITU6L7BL.js +0 -7
  550. package/dist/registry-3QP3YKQS.js +0 -8
  551. package/dist/registry-DKEXOJVO.js +0 -7
  552. package/dist/registry-OJIOSBV6.js +0 -10
  553. package/dist/registry-USRVT6YF.js +0 -8
  554. package/dist/revoke-JCC7N56X.js +0 -17
  555. package/dist/session/index.cjs +0 -495
  556. package/dist/session/index.cjs.map +0 -1
  557. package/dist/session/index.d.cts +0 -46
  558. package/dist/shadow/index.cjs +0 -133
  559. package/dist/shadow/index.cjs.map +0 -1
  560. package/dist/shadow/index.d.cts +0 -17
  561. package/dist/signer-72QAUSVW.js +0 -18
  562. package/dist/snapshots/index.cjs +0 -937
  563. package/dist/snapshots/index.cjs.map +0 -1
  564. package/dist/snapshots/index.d.cts +0 -28
  565. package/dist/store/index.cjs +0 -1083
  566. package/dist/store/index.cjs.map +0 -1
  567. package/dist/store/index.d.cts +0 -492
  568. package/dist/store/index.d.ts +0 -492
  569. package/dist/store/index.js +0 -37
  570. package/dist/strategy-BSxFXGzb.d.cts +0 -110
  571. package/dist/strategy-BSxFXGzb.d.ts +0 -110
  572. package/dist/strategy-DSTrsZ8t.d.cts +0 -601
  573. package/dist/strategy-DSTrsZ8t.d.ts +0 -601
  574. package/dist/sync/index.cjs +0 -1062
  575. package/dist/sync/index.cjs.map +0 -1
  576. package/dist/sync/index.d.cts +0 -43
  577. package/dist/team/index.cjs +0 -2798
  578. package/dist/team/index.cjs.map +0 -1
  579. package/dist/team/index.d.cts +0 -118
  580. package/dist/tx/index.cjs +0 -544
  581. package/dist/tx/index.cjs.map +0 -1
  582. package/dist/tx/index.d.cts +0 -21
  583. package/dist/types-Df28QFKb.d.ts +0 -12818
  584. package/dist/types-DyXYr8rE.d.cts +0 -12818
  585. package/dist/ulid-COREQ2RQ.js +0 -9
  586. package/dist/ulid-Drr7ykr6.d.cts +0 -603
  587. package/dist/util/index.cjs +0 -230
  588. package/dist/util/index.cjs.map +0 -1
  589. package/dist/util/index.d.cts +0 -77
  590. package/dist/with-derivation-DFnFByiQ.d.ts +0 -13
  591. package/dist/with-derivation-DU3Sjazm.d.cts +0 -13
  592. package/dist/with-guard-ByyxmEe7.d.cts +0 -18
  593. package/dist/with-guard-qube6BMI.d.ts +0 -18
  594. package/dist/with-materialized-view-BmEToIR1.d.cts +0 -27
  595. package/dist/with-overlayed-view-BMsQQbWm.d.cts +0 -13
  596. /package/dist/{chunk-UF3BUNQZ.js.map → api-TX2EX2FX.js.map} +0 -0
  597. /package/dist/{store → as}/index.js.map +0 -0
  598. /package/dist/{crypto-HTZ4FJOP.js.map → at/index.js.map} +0 -0
  599. /package/dist/{delegation-RI54P6I5.js.map → by/index.js.map} +0 -0
  600. /package/dist/{executor-5PNY7LGW.js.map → cargo/index.js.map} +0 -0
  601. /package/dist/{executor-B4QIYGZX.js.map → chunk-CHFZDSE4.js.map} +0 -0
  602. /package/dist/{executor-BWXXDQ7K.js.map → chunk-GHVIKOHT.js.map} +0 -0
  603. /package/dist/{issue-VGDPP4B5.js.map → chunk-PZ5AY32C.js.map} +0 -0
  604. /package/dist/{ledger-TMRZYNVJ.js.map → classified/index.js.map} +0 -0
  605. /package/dist/{noydb-G725ZSZG.js.map → collection-facade-LVD22JLM.js.map} +0 -0
  606. /package/dist/{public-envelope-BW6OXORV.js.map → computed-EXDMQODG.js.map} +0 -0
  607. /package/dist/{read-only-facade-ITU6L7BL.js.map → delegation-BJP73GAP.js.map} +0 -0
  608. /package/dist/{registry-3QP3YKQS.js.map → derive-BME7HDWO.js.map} +0 -0
  609. /package/dist/{registry-DKEXOJVO.js.map → enclave-NHORSWSF.js.map} +0 -0
  610. /package/dist/{registry-OJIOSBV6.js.map → executor-FE6X4LFX.js.map} +0 -0
  611. /package/dist/{registry-USRVT6YF.js.map → executor-KSHKRJXP.js.map} +0 -0
  612. /package/dist/{revoke-JCC7N56X.js.map → executor-ZHTJJICG.js.map} +0 -0
  613. /package/dist/{signer-72QAUSVW.js.map → export-accessible-DACHM5VT.js.map} +0 -0
  614. /package/dist/{stale-6ZDBTQT7.js.map → extract-partition-RNENZZ4T.js.map} +0 -0
  615. /package/dist/{ulid-COREQ2RQ.js.map → find-BNGBJNKP.js.map} +0 -0
@@ -1,20 +1,22 @@
1
1
  import {
2
2
  dekKey
3
- } from "./chunk-U26HQ6KJ.js";
3
+ } from "./chunk-7BWJHO2A.js";
4
4
  import {
5
5
  generateULID
6
- } from "./chunk-FZU343FL.js";
6
+ } from "./chunk-ZJADGNYF.js";
7
+ import {
8
+ openEnvelopeJson
9
+ } from "./chunk-MCHVVJIA.js";
7
10
  import {
8
- decrypt,
9
11
  encrypt,
10
12
  unwrapKey,
11
13
  wrapKey
12
- } from "./chunk-PP6W64Y3.js";
14
+ } from "./chunk-3OPY6MK2.js";
13
15
  import {
14
16
  DelegationTargetMissingError
15
- } from "./chunk-B6PB7JLN.js";
17
+ } from "./chunk-S7VFUQM2.js";
16
18
 
17
- // src/team/delegation.ts
19
+ // src/with-party/team/delegation.ts
18
20
  var DELEGATIONS_COLLECTION = "_delegations";
19
21
  async function issueDelegation(store, vault, grantor, targetKek, delegationsDek, opts) {
20
22
  if (!targetKek) {
@@ -64,7 +66,7 @@ async function loadActiveDelegations(store, vault, user, delegationsDek, now = /
64
66
  if (!env) continue;
65
67
  let token;
66
68
  try {
67
- const plaintext = await decrypt(env._iv, env._data, delegationsDek);
69
+ const plaintext = await openEnvelopeJson(env, delegationsDek);
68
70
  token = JSON.parse(plaintext);
69
71
  } catch {
70
72
  continue;
@@ -94,4 +96,4 @@ export {
94
96
  loadActiveDelegations,
95
97
  revokeDelegation
96
98
  };
97
- //# sourceMappingURL=chunk-5T22KDPN.js.map
99
+ //# sourceMappingURL=chunk-DV4HUP5G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-party/team/delegation.ts"],"sourcesContent":["/**\n * Time-boxed cross-tier delegation tokens.\n *\n * A higher-tier user can issue a delegation that grants another user\n * temporary access to records at a specified tier. The delegation is\n * persisted as an encrypted envelope in the reserved `_delegations`\n * collection. The target user's runtime scans this collection on every\n * open and, while `until` is still in the future, merges the\n * unwrapped tier DEKs into their in-memory DEK map.\n *\n * ## Token shape\n *\n * ```\n * {\n * id, // ULID, also the _delegations record id\n * toUser, // grantee user id\n * fromUser, // grantor user id (owner/admin/higher-tier principal)\n * tier, // tier being delegated\n * collection, // collection name OR null for \"every collection\"\n * record, // optional specific record id\n * until, // ISO timestamp — token expires at this instant\n * wrappedDek, // base64 AES-KW-wrapped tier DEK, wrapped under target KEK\n * createdAt, // ISO timestamp\n * }\n * ```\n *\n * The ciphertext is stored as a normal noy-db envelope — the\n * `_delegations` collection has its own DEK shared across all vault\n * users, so an operator can enumerate active delegations for audit\n * without being able to *use* them (the `wrappedDek` inside is still\n * keyed to the target user's KEK).\n *\n * ## Revocation\n *\n * Delete the `_delegations/<id>` envelope. The target user's runtime\n * reloads the delegation list at each open and at periodic intervals\n * (tracked by the caller — this module is pure logic).\n *\n * @module\n */\n\nimport type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport type { UnlockedKeyring } from './keyring.js'\nimport { encrypt, openEnvelopeJson, wrapKey, unwrapKey, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport { dekKey } from './tiers.js'\nimport { DelegationTargetMissingError } from '../../kernel/errors.js'\nimport { generateULID } from '../../with-pod/ulid.js'\n\nexport const DELEGATIONS_COLLECTION = '_delegations'\n\n/**\n * Durable payload of a delegation token. Encrypted under the vault's\n * `_delegations` DEK; the `wrappedDek` inside is additionally wrapped\n * under the target user's KEK.\n */\nexport interface DelegationToken {\n readonly id: string\n readonly toUser: string\n readonly fromUser: string\n readonly tier: number\n /** Collection name or `null` for all collections. */\n readonly collection: string | null\n /** Optional specific record id scope. */\n readonly record?: string\n readonly until: string\n readonly wrappedDek: string\n readonly createdAt: string\n}\n\nexport interface IssueDelegationOptions {\n readonly toUser: string\n readonly tier: number\n readonly collection?: string\n readonly record?: string\n readonly until: Date | string\n}\n\n/**\n * Build and persist a delegation token. The caller must hold a tier-N\n * DEK and must have already located the target user's keyring file\n * (so the `wrappedDek` can be re-wrapped against their KEK).\n */\nexport async function issueDelegation(\n store: NoydbStore,\n vault: string,\n grantor: UnlockedKeyring,\n targetKek: EnclaveKey | null,\n delegationsDek: EnclaveKey,\n opts: IssueDelegationOptions,\n): Promise<DelegationToken> {\n if (!targetKek) {\n throw new DelegationTargetMissingError(opts.toUser)\n }\n const tier = opts.tier\n const collectionName = opts.collection ?? null\n const dekLookupCollection = collectionName ?? ''\n // Tier DEK to delegate — fetched from the grantor's own keyring.\n const sourceDek = collectionName\n ? grantor.deks.get(dekKey(collectionName, tier))\n : undefined\n if (!sourceDek) {\n throw new DelegationTargetMissingError(\n `grantor cannot find tier ${tier} DEK for ${dekLookupCollection || '(any)'}`,\n )\n }\n const wrappedDek = await wrapKey(sourceDek, targetKek)\n\n const until = typeof opts.until === 'string' ? opts.until : opts.until.toISOString()\n const token: DelegationToken = {\n id: generateULID(),\n toUser: opts.toUser,\n fromUser: grantor.userId,\n tier,\n collection: collectionName,\n ...(opts.record && { record: opts.record }),\n until,\n wrappedDek,\n createdAt: new Date().toISOString(),\n }\n\n const plaintext = JSON.stringify(token)\n const { iv, data } = await encrypt(plaintext, delegationsDek)\n const envelope: EncryptedEnvelope = {\n _noydb: 1,\n _v: 1,\n _ts: token.createdAt,\n _iv: iv,\n _data: data,\n _by: grantor.userId,\n }\n await store.put(vault, DELEGATIONS_COLLECTION, token.id, envelope)\n return token\n}\n\n/**\n * Enumerate every live (non-expired) delegation addressed to `toUser`\n * and merge the unwrapped tier DEKs into their keyring. Returns the\n * list of merged delegations so the caller can register per-access\n * audit context.\n */\nexport async function loadActiveDelegations(\n store: NoydbStore,\n vault: string,\n user: UnlockedKeyring,\n delegationsDek: EnclaveKey,\n now: Date = new Date(),\n): Promise<DelegationToken[]> {\n const ids = await store.list(vault, DELEGATIONS_COLLECTION)\n const merged: DelegationToken[] = []\n const nowIso = now.toISOString()\n for (const id of ids) {\n const env = await store.get(vault, DELEGATIONS_COLLECTION, id)\n if (!env) continue\n let token: DelegationToken\n try {\n const plaintext = await openEnvelopeJson(env, delegationsDek)\n token = JSON.parse(plaintext) as DelegationToken\n } catch {\n continue\n }\n if (token.toUser !== user.userId) continue\n if (token.until <= nowIso) continue\n\n // A user without a KEK in memory (tier-3 PIN resume, wrap-DEKs\n // tier-2 unlock, session restore) cannot unwrap delegation tokens\n // — those were wrapped under the user's KEK at issue time. Skip\n // this token; the consumer reaches it again at tier-1 unlock.\n if (!user.kek) continue\n let dek: EnclaveKey\n try {\n dek = await unwrapKey(token.wrappedDek, user.kek)\n } catch {\n continue\n }\n const k = token.collection\n ? dekKey(token.collection, token.tier)\n : `__any#${token.tier}`\n user.deks.set(k, dek)\n merged.push(token)\n }\n return merged\n}\n\n/**\n * Revoke a delegation by id — the caller resolves the envelope and\n * issues a `delete`. Provided as a stable helper so the naming is\n * symmetric to `issueDelegation`.\n */\nexport async function revokeDelegation(\n store: NoydbStore,\n vault: string,\n id: string,\n): Promise<void> {\n await store.delete(vault, DELEGATIONS_COLLECTION, id)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgDO,IAAM,yBAAyB;AAkCtC,eAAsB,gBACpB,OACA,OACA,SACA,WACA,gBACA,MAC0B;AAC1B,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,6BAA6B,KAAK,MAAM;AAAA,EACpD;AACA,QAAM,OAAO,KAAK;AAClB,QAAM,iBAAiB,KAAK,cAAc;AAC1C,QAAM,sBAAsB,kBAAkB;AAE9C,QAAM,YAAY,iBACd,QAAQ,KAAK,IAAI,OAAO,gBAAgB,IAAI,CAAC,IAC7C;AACJ,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR,4BAA4B,IAAI,YAAY,uBAAuB,OAAO;AAAA,IAC5E;AAAA,EACF;AACA,QAAM,aAAa,MAAM,QAAQ,WAAW,SAAS;AAErD,QAAM,QAAQ,OAAO,KAAK,UAAU,WAAW,KAAK,QAAQ,KAAK,MAAM,YAAY;AACnF,QAAM,QAAyB;AAAA,IAC7B,IAAI,aAAa;AAAA,IACjB,QAAQ,KAAK;AAAA,IACb,UAAU,QAAQ;AAAA,IAClB;AAAA,IACA,YAAY;AAAA,IACZ,GAAI,KAAK,UAAU,EAAE,QAAQ,KAAK,OAAO;AAAA,IACzC;AAAA,IACA;AAAA,IACA,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,EACpC;AAEA,QAAM,YAAY,KAAK,UAAU,KAAK;AACtC,QAAM,EAAE,IAAI,KAAK,IAAI,MAAM,QAAQ,WAAW,cAAc;AAC5D,QAAM,WAA8B;AAAA,IAClC,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,KAAK,MAAM;AAAA,IACX,KAAK;AAAA,IACL,OAAO;AAAA,IACP,KAAK,QAAQ;AAAA,EACf;AACA,QAAM,MAAM,IAAI,OAAO,wBAAwB,MAAM,IAAI,QAAQ;AACjE,SAAO;AACT;AAQA,eAAsB,sBACpB,OACA,OACA,MACA,gBACA,MAAY,oBAAI,KAAK,GACO;AAC5B,QAAM,MAAM,MAAM,MAAM,KAAK,OAAO,sBAAsB;AAC1D,QAAM,SAA4B,CAAC;AACnC,QAAM,SAAS,IAAI,YAAY;AAC/B,aAAW,MAAM,KAAK;AACpB,UAAM,MAAM,MAAM,MAAM,IAAI,OAAO,wBAAwB,EAAE;AAC7D,QAAI,CAAC,IAAK;AACV,QAAI;AACJ,QAAI;AACF,YAAM,YAAY,MAAM,iBAAiB,KAAK,cAAc;AAC5D,cAAQ,KAAK,MAAM,SAAS;AAAA,IAC9B,QAAQ;AACN;AAAA,IACF;AACA,QAAI,MAAM,WAAW,KAAK,OAAQ;AAClC,QAAI,MAAM,SAAS,OAAQ;AAM3B,QAAI,CAAC,KAAK,IAAK;AACf,QAAI;AACJ,QAAI;AACF,YAAM,MAAM,UAAU,MAAM,YAAY,KAAK,GAAG;AAAA,IAClD,QAAQ;AACN;AAAA,IACF;AACA,UAAM,IAAI,MAAM,aACZ,OAAO,MAAM,YAAY,MAAM,IAAI,IACnC,SAAS,MAAM,IAAI;AACvB,SAAK,KAAK,IAAI,GAAG,GAAG;AACpB,WAAO,KAAK,KAAK;AAAA,EACnB;AACA,SAAO;AACT;AAOA,eAAsB,iBACpB,OACA,OACA,IACe;AACf,QAAM,MAAM,OAAO,OAAO,wBAAwB,EAAE;AACtD;","names":[]}
@@ -0,0 +1,621 @@
1
+ import {
2
+ installViaBinder
3
+ } from "./chunk-VEAVKDDB.js";
4
+ import {
5
+ LocaleNotSpecifiedError,
6
+ MissingTranslationError,
7
+ ScriptViolationError,
8
+ TranslatorNotConfiguredError
9
+ } from "./chunk-S7VFUQM2.js";
10
+
11
+ // src/port/with/i18n-strategy.ts
12
+ function notEnabled(op) {
13
+ return new Error(
14
+ `${op} requires the i18n strategy. Import \`{ withI18n }\` from "@noy-db/hub/i18n" and pass it to \`createNoydb({ i18nStrategy: withI18n() })\`.`
15
+ );
16
+ }
17
+ var NO_I18N = {
18
+ applyI18nLocale(record) {
19
+ return record;
20
+ },
21
+ validateI18nTextValue() {
22
+ throw notEnabled("i18nText field validation");
23
+ },
24
+ enforceScript(value) {
25
+ return { value, warnings: [] };
26
+ },
27
+ computeExemptFills() {
28
+ return /* @__PURE__ */ new Map();
29
+ },
30
+ densify() {
31
+ },
32
+ buildDictionaryHandle() {
33
+ throw notEnabled("vault.dictionary()");
34
+ }
35
+ };
36
+ function isDictCollectionName(name) {
37
+ return name.startsWith("_dict_");
38
+ }
39
+ function isStaticDictDescriptor(x) {
40
+ return typeof x === "object" && x !== null && x._noydbStaticDict === true;
41
+ }
42
+ function isI18nTextDescriptor(x) {
43
+ return typeof x === "object" && x !== null && x._noydbI18nText === true;
44
+ }
45
+ function isDictKeyDescriptor(x) {
46
+ return typeof x === "object" && x !== null && x._noydbDictKey === true;
47
+ }
48
+
49
+ // src/kernel/paths.ts
50
+ function getAtPath(obj, path) {
51
+ const arrayIdx = path.indexOf("[].");
52
+ if (arrayIdx !== -1) {
53
+ const arrayKey = path.slice(0, arrayIdx);
54
+ const restPath = path.slice(arrayIdx + 3);
55
+ const arr = obj[arrayKey];
56
+ if (!Array.isArray(arr)) return [];
57
+ return arr.flatMap((item) => {
58
+ if (!item || typeof item !== "object" || Array.isArray(item)) return [];
59
+ return getAtPath(item, restPath);
60
+ });
61
+ }
62
+ const dotIdx = path.indexOf(".");
63
+ if (dotIdx !== -1) {
64
+ const head = path.slice(0, dotIdx);
65
+ const rest = path.slice(dotIdx + 1);
66
+ const nested = obj[head];
67
+ if (!nested || typeof nested !== "object" || Array.isArray(nested)) return [];
68
+ return getAtPath(nested, rest);
69
+ }
70
+ const val = obj[path];
71
+ return val !== void 0 ? [val] : [];
72
+ }
73
+ function setAtPathInPlace(obj, path, value) {
74
+ const dotIdx = path.indexOf(".");
75
+ if (dotIdx !== -1) {
76
+ const head = path.slice(0, dotIdx);
77
+ const rest = path.slice(dotIdx + 1);
78
+ const nested = obj[head];
79
+ if (!nested || typeof nested !== "object" || Array.isArray(nested)) return;
80
+ setAtPathInPlace(nested, rest, value);
81
+ return;
82
+ }
83
+ obj[path] = value;
84
+ }
85
+
86
+ // src/via/i18n/policy.ts
87
+ function resolvePolicy(onMissing, layer) {
88
+ const explicit = onMissing && typeof onMissing === "object" ? onMissing[layer] : void 0;
89
+ const scalar = typeof onMissing === "string" ? onMissing : void 0;
90
+ const layerDefault = layer === "guard" ? "substitute" : void 0;
91
+ return explicit ?? layerDefault ?? scalar ?? "throw";
92
+ }
93
+
94
+ // src/via/i18n/script.ts
95
+ var LATIN_BASE = /* @__PURE__ */ new Set([
96
+ "en",
97
+ "fr",
98
+ "de",
99
+ "es",
100
+ "it",
101
+ "pt",
102
+ "nl",
103
+ "sv",
104
+ "no",
105
+ "da",
106
+ "fi",
107
+ "is",
108
+ "pl",
109
+ "cs",
110
+ "sk",
111
+ "hu",
112
+ "ro",
113
+ "hr",
114
+ "sl",
115
+ "et",
116
+ "lv",
117
+ "lt",
118
+ "tr",
119
+ "vi",
120
+ "id",
121
+ "ms",
122
+ "tl",
123
+ "sw",
124
+ "af",
125
+ "ca",
126
+ "gl",
127
+ "eu",
128
+ "cy",
129
+ "ga"
130
+ ]);
131
+ var SCRIPT_TABLE = {
132
+ th: ["Thai"],
133
+ ko: ["Hangul", "Han"],
134
+ ja: ["Han", "Hiragana", "Katakana"],
135
+ zh: ["Han"],
136
+ ar: ["Arabic"],
137
+ fa: ["Arabic"],
138
+ ur: ["Arabic"],
139
+ ru: ["Cyrillic"],
140
+ uk: ["Cyrillic"],
141
+ bg: ["Cyrillic"],
142
+ sr: ["Cyrillic"],
143
+ he: ["Hebrew"],
144
+ el: ["Greek"],
145
+ hi: ["Devanagari"],
146
+ ta: ["Tamil"],
147
+ km: ["Khmer"],
148
+ lo: ["Lao"],
149
+ my: ["Myanmar"]
150
+ };
151
+ var SUBTAG_SCRIPTS = {
152
+ Latn: ["Latin"],
153
+ Cyrl: ["Cyrillic", "Latin"],
154
+ Hans: ["Han", "Latin"],
155
+ Hant: ["Han", "Latin"],
156
+ Thai: ["Thai", "Latin"],
157
+ Arab: ["Arabic", "Latin"]
158
+ };
159
+ function inferScripts(locale) {
160
+ const parts = locale.split("-");
161
+ const subtag = parts.find((t) => /^[A-Z][a-z]{3}$/.test(t));
162
+ if (subtag && SUBTAG_SCRIPTS[subtag]) return SUBTAG_SCRIPTS[subtag];
163
+ const base = (parts[0] ?? "").toLowerCase();
164
+ if (LATIN_BASE.has(base)) return ["Latin"];
165
+ const primary = SCRIPT_TABLE[base];
166
+ if (primary) return [...primary, "Latin"];
167
+ return ["Latin"];
168
+ }
169
+ function allowedFor(descriptor, locale) {
170
+ const script = descriptor.options.script;
171
+ if (script && script !== "auto") {
172
+ const explicit = script[locale];
173
+ if (explicit) return explicit;
174
+ }
175
+ return inferScripts(locale);
176
+ }
177
+ var BASELINE = String.raw`\p{White_Space}\p{Script=Common}\p{Script=Inherited}\p{Mark}`;
178
+ function fullMatcher(scripts) {
179
+ const cls = scripts.map((s) => `\\p{Script=${s}}`).join("");
180
+ return new RegExp(`^[${BASELINE}${cls}]*$`, "u");
181
+ }
182
+ function charMatcher(scripts) {
183
+ const cls = scripts.map((s) => `\\p{Script=${s}}`).join("");
184
+ return new RegExp(`[${BASELINE}${cls}]`, "u");
185
+ }
186
+ function offendingSample(str, scripts) {
187
+ const ok = charMatcher(scripts);
188
+ const bad = [];
189
+ for (const ch of str) {
190
+ if (!ok.test(ch)) bad.push(ch);
191
+ if (bad.length >= 8) break;
192
+ }
193
+ return bad.join("");
194
+ }
195
+ function stripDisallowed(str, scripts) {
196
+ const ok = charMatcher(scripts);
197
+ let out = "";
198
+ for (const ch of str) if (ok.test(ch)) out += ch;
199
+ return out;
200
+ }
201
+ function enforceScript(value, field, descriptor, exempt) {
202
+ const opt = descriptor.options;
203
+ if (!opt.script) return { value, warnings: [] };
204
+ const mode = opt.onScriptViolation ?? "reject";
205
+ const warnings = [];
206
+ let out = value;
207
+ for (const [locale, raw] of Object.entries(value)) {
208
+ if (exempt?.has(locale)) continue;
209
+ if (typeof raw !== "string") continue;
210
+ const allowed = allowedFor(descriptor, locale);
211
+ if (fullMatcher(allowed).test(raw)) continue;
212
+ const sample = offendingSample(raw, allowed);
213
+ if (mode === "reject") {
214
+ throw new ScriptViolationError(field, locale, allowed, sample);
215
+ }
216
+ warnings.push({ field, locale, expected: allowed, sample });
217
+ if (mode === "filter") {
218
+ if (out === value) out = { ...value };
219
+ out[locale] = stripDisallowed(raw, allowed);
220
+ }
221
+ }
222
+ return { value: out, warnings };
223
+ }
224
+
225
+ // src/via/i18n/binding.ts
226
+ async function runI18nAutoTranslate(record, i18nFields, cfg) {
227
+ for (const [field, descriptor] of Object.entries(i18nFields)) {
228
+ if (!descriptor.options.autoTranslate) continue;
229
+ const leafValues = getAtPath(record, field);
230
+ if (leafValues.length !== 1) continue;
231
+ const value = leafValues[0];
232
+ if (!value || typeof value !== "object" || Array.isArray(value)) continue;
233
+ const map = value;
234
+ const { languages, required } = descriptor.options;
235
+ const missing = languages.filter(
236
+ (lang) => !(lang in map) || map[lang] === ""
237
+ );
238
+ if (missing.length === 0) continue;
239
+ const sourceLocale = languages.find((l) => l in map && map[l] !== "");
240
+ if (!sourceLocale) continue;
241
+ if (!cfg.autoTranslateHook) {
242
+ throw new TranslatorNotConfiguredError(field, cfg.collectionName);
243
+ }
244
+ const toTranslate = required === "any" ? [] : required === "all" ? missing : missing.filter((l) => required.includes(l));
245
+ const translated = { ...map };
246
+ for (const targetLocale of toTranslate) {
247
+ translated[targetLocale] = await cfg.autoTranslateHook(
248
+ map[sourceLocale],
249
+ sourceLocale,
250
+ targetLocale,
251
+ field,
252
+ cfg.collectionName
253
+ );
254
+ }
255
+ setAtPathInPlace(record, field, translated);
256
+ }
257
+ }
258
+ function runI18nScriptEnforcement(record, i18nFields, strategy, exemptFills, ctx, cfg) {
259
+ for (const [field, descriptor] of Object.entries(i18nFields)) {
260
+ if (!descriptor.options.script) continue;
261
+ for (const leaf of getAtPath(record, field)) {
262
+ if (!leaf || typeof leaf !== "object" || Array.isArray(leaf)) continue;
263
+ const leafMap = leaf;
264
+ const { value: cleaned, warnings } = strategy.enforceScript(
265
+ leafMap,
266
+ field,
267
+ descriptor,
268
+ exemptFills?.get(field)
269
+ );
270
+ if (cleaned !== leafMap) Object.assign(leafMap, cleaned);
271
+ const mode = descriptor.options.onScriptViolation;
272
+ if (mode === "warn" || mode === "filter") {
273
+ for (const w of warnings) {
274
+ ctx.emit("i18n:script-violation", {
275
+ vault: ctx.vault,
276
+ collection: cfg.collectionName,
277
+ id: ctx.id,
278
+ mode,
279
+ warning: w
280
+ });
281
+ }
282
+ }
283
+ }
284
+ }
285
+ }
286
+ async function runI18nWriteStages(record, ctx, cfg) {
287
+ const i18nFields = cfg.i18nFields;
288
+ const i18nDensifyFields = cfg.i18nDensifyFields;
289
+ const strategy = cfg.strategy;
290
+ if (i18nFields) {
291
+ await runI18nAutoTranslate(record, i18nFields, cfg);
292
+ }
293
+ let densifyPrior;
294
+ let exemptFills;
295
+ if (i18nDensifyFields) {
296
+ densifyPrior = await ctx.prior() ?? void 0;
297
+ exemptFills = strategy.computeExemptFills(densifyPrior, record, i18nDensifyFields);
298
+ }
299
+ if (i18nFields) {
300
+ runI18nScriptEnforcement(record, i18nFields, strategy, exemptFills, ctx, cfg);
301
+ }
302
+ cfg.i18nPutValidator?.(record);
303
+ if (i18nDensifyFields) {
304
+ strategy.densify(record, densifyPrior, i18nDensifyFields);
305
+ }
306
+ return record;
307
+ }
308
+ async function runI18nPresent(record, ctx, cfg) {
309
+ const i18nFields = cfg.i18nFields;
310
+ const dictKeyFields = cfg.dictKeyFields;
311
+ const strategy = cfg.strategy;
312
+ const hasI18n = i18nFields !== void 0 && Object.keys(i18nFields).length > 0;
313
+ const hasDict = dictKeyFields !== void 0 && Object.keys(dictKeyFields).length > 0;
314
+ if (!hasI18n && !hasDict) return record;
315
+ const locale = typeof ctx.locale === "string" ? ctx.locale : void 0;
316
+ const fallback = ctx.fallback;
317
+ const layer = ctx.layer;
318
+ let result = record;
319
+ const hasStaticDisplay = hasDict && dictKeyFields !== void 0 && Object.values(dictKeyFields).some(
320
+ (d) => isStaticDictDescriptor(d) && d.displayLocale !== void 0
321
+ );
322
+ if (!locale && !hasStaticDisplay) return stripI18nFilled(result);
323
+ if (locale && hasI18n && i18nFields) {
324
+ result = strategy.applyI18nLocale(result, i18nFields, locale, fallback, layer);
325
+ }
326
+ if (hasDict && dictKeyFields && cfg.dictLabelResolver && locale !== "raw") {
327
+ const withLabels = { ...result };
328
+ const resolver = cfg.dictLabelResolver;
329
+ for (const [field, desc] of Object.entries(dictKeyFields)) {
330
+ const policy = desc.onMissing ? resolvePolicy(desc.onMissing, layer) : "null";
331
+ const fieldFallback = policy === "substitute" ? fallback ?? desc.substitute : fallback;
332
+ const effLocale = locale ?? (isStaticDictDescriptor(desc) ? desc.displayLocale : void 0);
333
+ const resolveKey = async (key) => {
334
+ if (!effLocale) {
335
+ if (policy === "throw") {
336
+ throw new LocaleNotSpecifiedError(
337
+ field,
338
+ `dictKey "${field}": no locale active to resolve key "${key}".`
339
+ );
340
+ }
341
+ return null;
342
+ }
343
+ const label = await resolver(desc.name, key, effLocale, fieldFallback);
344
+ if (label === void 0) {
345
+ if (policy === "throw") {
346
+ throw new LocaleNotSpecifiedError(
347
+ field,
348
+ `dictKey "${field}": no label for key "${key}" in locale "${effLocale}".`
349
+ );
350
+ }
351
+ return null;
352
+ }
353
+ return label;
354
+ };
355
+ if (field.includes("[].")) {
356
+ const parts = field.split("[].");
357
+ const arrayKey = parts[0];
358
+ const leaf = parts[1];
359
+ if (!leaf || leaf.includes(".")) continue;
360
+ const arr = withLabels[arrayKey];
361
+ if (!Array.isArray(arr)) continue;
362
+ const labelKey = `${leaf}Label`;
363
+ withLabels[arrayKey] = await Promise.all(
364
+ arr.map(async (el) => {
365
+ if (!el || typeof el !== "object" || Array.isArray(el)) return el;
366
+ const k = el[leaf];
367
+ if (typeof k !== "string") return el;
368
+ return { ...el, [labelKey]: await resolveKey(k) };
369
+ })
370
+ );
371
+ continue;
372
+ }
373
+ const val = result[field];
374
+ if (Array.isArray(val)) {
375
+ withLabels[`${field}Label`] = await Promise.all(
376
+ val.map(async (k) => ({
377
+ key: k,
378
+ label: typeof k === "string" ? await resolveKey(k) : null
379
+ }))
380
+ );
381
+ } else if (typeof val === "string") {
382
+ const label = await resolveKey(val);
383
+ if (label !== null) withLabels[`${field}Label`] = label;
384
+ }
385
+ }
386
+ result = withLabels;
387
+ }
388
+ return stripI18nFilled(result);
389
+ }
390
+ function buildI18nDescribeFragment(cfg) {
391
+ return {
392
+ i18nFields: cfg.i18nFields ? Object.keys(cfg.i18nFields) : [],
393
+ dictKeyFields: cfg.dictKeyFields ? Object.keys(cfg.dictKeyFields) : [],
394
+ ...cfg.defaultLocale !== void 0 ? { defaultLocale: cfg.defaultLocale } : {}
395
+ };
396
+ }
397
+ function i18nBinding(cfg) {
398
+ return {
399
+ brand: "i18n",
400
+ posture: { encryptedAtRest: "envelope", queryable: "full", exportable: true, forgettable: true },
401
+ // DictionaryHandle's `_dict_*` reserved collections (#629 Task 4) — the
402
+ // codec boundary's `reservedEnvelopes` door may address any collection
403
+ // name under this prefix.
404
+ reservedPrefixes: ["_dict_"],
405
+ covers: (field) => cfg.i18nFields !== void 0 && field in cfg.i18nFields || cfg.dictKeyFields !== void 0 && field in cfg.dictKeyFields,
406
+ encodeWrite: async (record, ctx) => runI18nWriteStages(record, ctx, cfg),
407
+ present: async (record, ctx) => runI18nPresent(record, ctx, cfg),
408
+ describeFragment: () => buildI18nDescribeFragment(cfg)
409
+ };
410
+ }
411
+ function linkI18nVia() {
412
+ installViaBinder("i18n", (c) => i18nBinding(c));
413
+ }
414
+
415
+ // src/via/i18n/core.ts
416
+ function i18nText(options) {
417
+ linkI18nVia();
418
+ if (options.densifyOnWrite === true && hasThrowPolicy(options.onMissing)) {
419
+ throw new Error(
420
+ `i18nText: densifyOnWrite cannot be combined with an explicit onMissing 'throw' policy \u2014 densify fills every empty slot, so a 'throw' would be unreachable. Remove the 'throw' policy or disable densifyOnWrite.`
421
+ );
422
+ }
423
+ return { _noydbI18nText: true, _viaBrand: "i18n", options };
424
+ }
425
+ function hasThrowPolicy(onMissing) {
426
+ if (onMissing === void 0) return false;
427
+ if (typeof onMissing === "string") return onMissing === "throw";
428
+ return Object.values(onMissing).includes("throw");
429
+ }
430
+ function validateI18nTextValue(value, field, descriptor) {
431
+ const { options } = descriptor;
432
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
433
+ throw new MissingTranslationError(
434
+ field,
435
+ options.languages,
436
+ `Field "${field}" must be a { [locale]: string } map, got ${typeof value}.`
437
+ );
438
+ }
439
+ const map = value;
440
+ for (const [locale, v] of Object.entries(map)) {
441
+ if (typeof v !== "string") {
442
+ throw new MissingTranslationError(
443
+ field,
444
+ [locale],
445
+ `Field "${field}": locale "${locale}" must be a string, got ${typeof v}.`
446
+ );
447
+ }
448
+ }
449
+ const { required } = options;
450
+ if (required === "all") {
451
+ const missing = options.languages.filter(
452
+ (lang) => !(lang in map) || map[lang] === ""
453
+ );
454
+ if (missing.length > 0) {
455
+ throw new MissingTranslationError(
456
+ field,
457
+ missing,
458
+ `Field "${field}" requires all declared languages. Missing: ${missing.join(", ")}.`
459
+ );
460
+ }
461
+ } else if (required === "any") {
462
+ const present = options.languages.some(
463
+ (lang) => lang in map && map[lang] !== ""
464
+ );
465
+ if (!present) {
466
+ throw new MissingTranslationError(
467
+ field,
468
+ options.languages,
469
+ `Field "${field}" requires at least one declared language. None present.`
470
+ );
471
+ }
472
+ } else {
473
+ const requiredList = required;
474
+ const missing = requiredList.filter(
475
+ (lang) => !(lang in map) || map[lang] === ""
476
+ );
477
+ if (missing.length > 0) {
478
+ throw new MissingTranslationError(
479
+ field,
480
+ missing,
481
+ `Field "${field}" requires: ${requiredList.join(", ")}. Missing: ${missing.join(", ")}.`
482
+ );
483
+ }
484
+ }
485
+ }
486
+ function toChain(fallback) {
487
+ return Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
488
+ }
489
+ function pickFromChain(value, chain) {
490
+ for (const fb of chain) {
491
+ if (fb === "any") {
492
+ const any = Object.values(value).find((v) => v !== "");
493
+ if (any !== void 0) return any;
494
+ } else if (value[fb] !== void 0 && value[fb] !== "") {
495
+ return value[fb];
496
+ }
497
+ }
498
+ return void 0;
499
+ }
500
+ function resolveI18nText(value, locale, fallback, field, opts) {
501
+ if (locale === "raw") {
502
+ return value;
503
+ }
504
+ if (!locale) {
505
+ throw new LocaleNotSpecifiedError(field ?? "<unknown>");
506
+ }
507
+ if (value[locale] !== void 0 && value[locale] !== "") {
508
+ return value[locale];
509
+ }
510
+ const policy = opts?.policy ?? "throw";
511
+ const callerChain = toChain(fallback);
512
+ const callerHit = pickFromChain(value, callerChain);
513
+ if (callerHit !== void 0) return callerHit;
514
+ if (policy === "substitute") {
515
+ const subHit = pickFromChain(value, toChain(opts?.substitute));
516
+ if (subHit !== void 0) return subHit;
517
+ if (opts?.smartSubstitute) {
518
+ const smartHit = pickNearestScript(value, locale);
519
+ if (smartHit !== void 0) return smartHit;
520
+ }
521
+ }
522
+ if (policy === "throw") {
523
+ throw new LocaleNotSpecifiedError(
524
+ field ?? "<unknown>",
525
+ `No translation available for locale "${locale}"` + (callerChain.length > 0 ? ` or fallback chain [${callerChain.join(", ")}]` : "") + "."
526
+ );
527
+ }
528
+ return null;
529
+ }
530
+ function pickNearestScript(value, target) {
531
+ const targetScript = inferScripts(target)[0] ?? "Latin";
532
+ let best;
533
+ for (const [loc, v] of Object.entries(value)) {
534
+ if (typeof v !== "string" || v === "") continue;
535
+ const s = inferScripts(loc)[0] ?? "Latin";
536
+ const score = s === targetScript ? 0 : s === "Latin" ? 1 : 2;
537
+ if (best === void 0 || score < best.score) best = { score, v };
538
+ if (score === 0) break;
539
+ }
540
+ return best?.v;
541
+ }
542
+ function applyAtPath(obj, path, locale, fallback, opts) {
543
+ const arrayIdx = path.indexOf("[].");
544
+ if (arrayIdx !== -1) {
545
+ const arrayKey = path.slice(0, arrayIdx);
546
+ const restPath = path.slice(arrayIdx + 3);
547
+ const arr = obj[arrayKey];
548
+ if (!Array.isArray(arr)) return obj;
549
+ return {
550
+ ...obj,
551
+ [arrayKey]: arr.map((item) => {
552
+ if (!item || typeof item !== "object" || Array.isArray(item)) return item;
553
+ return applyAtPath(item, restPath, locale, fallback, opts);
554
+ })
555
+ };
556
+ }
557
+ const dotIdx = path.indexOf(".");
558
+ if (dotIdx !== -1) {
559
+ const head = path.slice(0, dotIdx);
560
+ const rest = path.slice(dotIdx + 1);
561
+ const nested = obj[head];
562
+ if (!nested || typeof nested !== "object" || Array.isArray(nested)) return obj;
563
+ return {
564
+ ...obj,
565
+ [head]: applyAtPath(nested, rest, locale, fallback, opts)
566
+ };
567
+ }
568
+ const raw = obj[path];
569
+ if (raw === void 0 || raw === null) return obj;
570
+ if (typeof raw !== "object" || Array.isArray(raw)) return obj;
571
+ return {
572
+ ...obj,
573
+ [path]: resolveI18nText(raw, locale, fallback, path, opts)
574
+ };
575
+ }
576
+ function applyI18nLocale(record, i18nFields, locale, fallback, layer = "read") {
577
+ const fieldNames = Object.keys(i18nFields);
578
+ if (fieldNames.length === 0) return record;
579
+ let result = record;
580
+ for (const [field, descriptor] of Object.entries(i18nFields)) {
581
+ const { onMissing, substitute, smartSubstitute } = descriptor.options;
582
+ const opts = {
583
+ policy: resolvePolicy(onMissing, layer),
584
+ ...substitute !== void 0 ? { substitute } : {},
585
+ ...smartSubstitute ? { smartSubstitute } : {}
586
+ };
587
+ result = applyAtPath(result, field, locale, fallback, opts);
588
+ }
589
+ result = stripI18nFilled(result);
590
+ return result;
591
+ }
592
+ function presentI18nForJoin(record, i18nFields, locale) {
593
+ return applyI18nLocale(record, i18nFields, locale, void 0, "join");
594
+ }
595
+ function stripI18nFilled(record) {
596
+ if (!Object.prototype.hasOwnProperty.call(record, "_i18nFilled")) return record;
597
+ const rest = { ...record };
598
+ delete rest._i18nFilled;
599
+ return rest;
600
+ }
601
+
602
+ export {
603
+ NO_I18N,
604
+ isDictCollectionName,
605
+ isStaticDictDescriptor,
606
+ isI18nTextDescriptor,
607
+ isDictKeyDescriptor,
608
+ getAtPath,
609
+ setAtPathInPlace,
610
+ resolvePolicy,
611
+ inferScripts,
612
+ enforceScript,
613
+ linkI18nVia,
614
+ i18nText,
615
+ validateI18nTextValue,
616
+ resolveI18nText,
617
+ applyI18nLocale,
618
+ presentI18nForJoin,
619
+ stripI18nFilled
620
+ };
621
+ //# sourceMappingURL=chunk-EOXAAJTY.js.map