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

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 (541) hide show
  1. package/README.md +129 -3
  2. package/dist/adapter/index.d.ts +5 -0
  3. package/dist/adapter/index.js +15 -0
  4. package/dist/aggregate/index.d.ts +6 -2
  5. package/dist/aggregate/index.js +24 -16
  6. package/dist/aggregate/index.js.map +1 -1
  7. package/dist/api-RW3KP7WU.js +14 -0
  8. package/dist/as/index.d.ts +7 -0
  9. package/dist/as/index.js +24 -0
  10. package/dist/at/index.d.ts +5 -0
  11. package/dist/at/index.js +1 -0
  12. package/dist/attestation/index.d.ts +15 -47
  13. package/dist/attestation/index.js +54 -10
  14. package/dist/attestation/index.js.map +1 -1
  15. package/dist/backup-KMJQ66MF.js +219 -0
  16. package/dist/backup-KMJQ66MF.js.map +1 -0
  17. package/dist/blobs/index.d.ts +6 -8
  18. package/dist/blobs/index.js +19 -12
  19. package/dist/blobs/index.js.map +1 -1
  20. package/dist/bundle/index.d.ts +16 -70
  21. package/dist/bundle/index.js +39 -476
  22. package/dist/bundle/index.js.map +1 -1
  23. package/dist/{ulid-CJ8RzRrm.d.ts → bundle-PwBGkhpe.d.ts} +31 -86
  24. package/dist/by/index.d.ts +1 -0
  25. package/dist/by/index.js +11 -0
  26. package/dist/cargo/index.d.ts +9 -0
  27. package/dist/cargo/index.js +89 -0
  28. package/dist/chunk-26LGBE4T.js +42 -0
  29. package/dist/chunk-26LGBE4T.js.map +1 -0
  30. package/dist/{chunk-K3DK3NU5.js → chunk-3YFXJ3ZP.js} +20 -5
  31. package/dist/chunk-3YFXJ3ZP.js.map +1 -0
  32. package/dist/chunk-4Q6HSHHL.js +90 -0
  33. package/dist/chunk-4Q6HSHHL.js.map +1 -0
  34. package/dist/chunk-5LUY7UTV.js +380 -0
  35. package/dist/chunk-5LUY7UTV.js.map +1 -0
  36. package/dist/chunk-5N6CZTCY.js +367 -0
  37. package/dist/chunk-5N6CZTCY.js.map +1 -0
  38. package/dist/chunk-5O3AOPDT.js +992 -0
  39. package/dist/chunk-5O3AOPDT.js.map +1 -0
  40. package/dist/chunk-5R3ERCDH.js +239 -0
  41. package/dist/chunk-5R3ERCDH.js.map +1 -0
  42. package/dist/chunk-5TDJ56JE.js +32 -0
  43. package/dist/chunk-5TDJ56JE.js.map +1 -0
  44. package/dist/{chunk-T7JEBOGN.js → chunk-62QYRORB.js} +18 -11
  45. package/dist/chunk-62QYRORB.js.map +1 -0
  46. package/dist/{chunk-J66GRPNH.js → chunk-6S7T6WC4.js} +2 -2
  47. package/dist/chunk-6S7T6WC4.js.map +1 -0
  48. package/dist/chunk-76722EBH.js +451 -0
  49. package/dist/chunk-76722EBH.js.map +1 -0
  50. package/dist/{chunk-Z6FNBOTC.js → chunk-AIWULCUO.js} +13 -17
  51. package/dist/chunk-AIWULCUO.js.map +1 -0
  52. package/dist/{chunk-O3VZPBZG.js → chunk-AQTBSL7R.js} +47 -11
  53. package/dist/chunk-AQTBSL7R.js.map +1 -0
  54. package/dist/chunk-AURFOK3D.js +35 -0
  55. package/dist/chunk-AURFOK3D.js.map +1 -0
  56. package/dist/{chunk-53XBRIRT.js → chunk-AXRXJTE2.js} +9 -9
  57. package/dist/chunk-AXRXJTE2.js.map +1 -0
  58. package/dist/chunk-AZAOEIKW.js +155 -0
  59. package/dist/chunk-AZAOEIKW.js.map +1 -0
  60. package/dist/{chunk-HNRHLRDC.js → chunk-BG3SPSR4.js} +3 -3
  61. package/dist/chunk-BG3SPSR4.js.map +1 -0
  62. package/dist/chunk-BGIZAFY7.js +1 -0
  63. package/dist/chunk-CHFZDSE4.js +1 -0
  64. package/dist/{chunk-DJHHA6XH.js → chunk-CMGR4ZEW.js} +50 -20
  65. package/dist/chunk-CMGR4ZEW.js.map +1 -0
  66. package/dist/chunk-CWPPNPOH.js +23 -0
  67. package/dist/chunk-CWPPNPOH.js.map +1 -0
  68. package/dist/{chunk-QODLLGQ7.js → chunk-DFEMTNPJ.js} +371 -38
  69. package/dist/chunk-DFEMTNPJ.js.map +1 -0
  70. package/dist/{chunk-ZYWZWG6G.js → chunk-DGDI2D4M.js} +10 -10
  71. package/dist/chunk-DGDI2D4M.js.map +1 -0
  72. package/dist/{chunk-SYMWGEET.js → chunk-EIZUR2XW.js} +3 -3
  73. package/dist/chunk-EIZUR2XW.js.map +1 -0
  74. package/dist/{chunk-BVRYKATC.js → chunk-FISN7WE4.js} +36 -33
  75. package/dist/chunk-FISN7WE4.js.map +1 -0
  76. package/dist/chunk-GHVIKOHT.js +1 -0
  77. package/dist/chunk-GYGWYIOZ.js +200 -0
  78. package/dist/chunk-GYGWYIOZ.js.map +1 -0
  79. package/dist/chunk-HCIPRAGS.js +45 -0
  80. package/dist/chunk-HCIPRAGS.js.map +1 -0
  81. package/dist/{chunk-PX35GA7L.js → chunk-I2NOIW44.js} +10 -10
  82. package/dist/chunk-I2NOIW44.js.map +1 -0
  83. package/dist/{chunk-OIF6LZUR.js → chunk-I3TIKTJO.js} +3 -3
  84. package/dist/chunk-I3TIKTJO.js.map +1 -0
  85. package/dist/chunk-I7FD46FF.js +9 -0
  86. package/dist/chunk-I7FD46FF.js.map +1 -0
  87. package/dist/chunk-IAGBDSCS.js +40 -0
  88. package/dist/chunk-IAGBDSCS.js.map +1 -0
  89. package/dist/{chunk-JWRVQKRZ.js → chunk-IELYAOGG.js} +6 -18
  90. package/dist/chunk-IELYAOGG.js.map +1 -0
  91. package/dist/chunk-IGUYVGGI.js +205 -0
  92. package/dist/chunk-IGUYVGGI.js.map +1 -0
  93. package/dist/{chunk-U26HQ6KJ.js → chunk-IO6GRPT6.js} +4 -4
  94. package/dist/chunk-IO6GRPT6.js.map +1 -0
  95. package/dist/chunk-IPB7FTQX.js +273 -0
  96. package/dist/chunk-IPB7FTQX.js.map +1 -0
  97. package/dist/chunk-ITNUCOXM.js +148 -0
  98. package/dist/chunk-ITNUCOXM.js.map +1 -0
  99. package/dist/{chunk-WPLVTJ5D.js → chunk-IUEN57TV.js} +10 -10
  100. package/dist/chunk-IUEN57TV.js.map +1 -0
  101. package/dist/{chunk-DL3HWOQ5.js → chunk-JNUWZ6D3.js} +9 -9
  102. package/dist/chunk-JNUWZ6D3.js.map +1 -0
  103. package/dist/chunk-K2WCO3NX.js +1 -0
  104. package/dist/chunk-KVOXU4T5.js +30 -0
  105. package/dist/chunk-KVOXU4T5.js.map +1 -0
  106. package/dist/chunk-KXGNJJXB.js +135 -0
  107. package/dist/chunk-KXGNJJXB.js.map +1 -0
  108. package/dist/chunk-LB7FD65R.js +163 -0
  109. package/dist/chunk-LB7FD65R.js.map +1 -0
  110. package/dist/{chunk-22DWZL57.js → chunk-LFLXAY2W.js} +43 -218
  111. package/dist/chunk-LFLXAY2W.js.map +1 -0
  112. package/dist/chunk-LMTH2RM6.js +129 -0
  113. package/dist/chunk-LMTH2RM6.js.map +1 -0
  114. package/dist/{aggregate/index.cjs → chunk-LV7M27WM.js} +390 -219
  115. package/dist/chunk-LV7M27WM.js.map +1 -0
  116. package/dist/{chunk-PE2FR4J3.js → chunk-LXQT4WMP.js} +16 -18
  117. package/dist/chunk-LXQT4WMP.js.map +1 -0
  118. package/dist/chunk-M2YKN37S.js +524 -0
  119. package/dist/chunk-M2YKN37S.js.map +1 -0
  120. package/dist/chunk-M6OST55S.js +14 -0
  121. package/dist/chunk-M6OST55S.js.map +1 -0
  122. package/dist/{chunk-F3GDRNUT.js → chunk-MD3Y6J3L.js} +35 -69
  123. package/dist/chunk-MD3Y6J3L.js.map +1 -0
  124. package/dist/{chunk-XJFLDA7A.js → chunk-MTMJVJ5W.js} +8 -7
  125. package/dist/chunk-MTMJVJ5W.js.map +1 -0
  126. package/dist/{chunk-DFMLEQZB.js → chunk-NF5JWERG.js} +5 -10
  127. package/dist/chunk-NF5JWERG.js.map +1 -0
  128. package/dist/{chunk-DO7C2TOG.js → chunk-PKHL44ER.js} +3 -3
  129. package/dist/{chunk-DO7C2TOG.js.map → chunk-PKHL44ER.js.map} +1 -1
  130. package/dist/{chunk-6CME4UEK.js → chunk-PSHOXR6C.js} +7008 -4827
  131. package/dist/chunk-PSHOXR6C.js.map +1 -0
  132. package/dist/chunk-PSMV73A5.js +117 -0
  133. package/dist/chunk-PSMV73A5.js.map +1 -0
  134. package/dist/chunk-PY4KJPYU.js +9 -0
  135. package/dist/chunk-PY4KJPYU.js.map +1 -0
  136. package/dist/chunk-PZ5AY32C.js +10 -0
  137. package/dist/{chunk-DE6GKS6G.js → chunk-Q7SS3IME.js} +50 -9
  138. package/dist/chunk-Q7SS3IME.js.map +1 -0
  139. package/dist/chunk-QHJW5EXU.js +54 -0
  140. package/dist/chunk-QHJW5EXU.js.map +1 -0
  141. package/dist/chunk-QZISFCVG.js +233 -0
  142. package/dist/chunk-QZISFCVG.js.map +1 -0
  143. package/dist/{chunk-NONAAENK.js → chunk-RUEKROOS.js} +11 -4
  144. package/dist/chunk-RUEKROOS.js.map +1 -0
  145. package/dist/chunk-RUIMKQTA.js +23 -0
  146. package/dist/chunk-RUIMKQTA.js.map +1 -0
  147. package/dist/{chunk-TFBP23BX.js → chunk-SKF73JOP.js} +66 -7
  148. package/dist/chunk-SKF73JOP.js.map +1 -0
  149. package/dist/chunk-SM3AVUHC.js +42 -0
  150. package/dist/chunk-SM3AVUHC.js.map +1 -0
  151. package/dist/{chunk-ML236QKC.js → chunk-SMXWYP24.js} +5 -5
  152. package/dist/chunk-SMXWYP24.js.map +1 -0
  153. package/dist/chunk-SRB2XEWB.js +148 -0
  154. package/dist/chunk-SRB2XEWB.js.map +1 -0
  155. package/dist/chunk-SVLR4POP.js +64 -0
  156. package/dist/chunk-SVLR4POP.js.map +1 -0
  157. package/dist/chunk-TA66UMI4.js +123 -0
  158. package/dist/chunk-TA66UMI4.js.map +1 -0
  159. package/dist/chunk-TEILUWOI.js +664 -0
  160. package/dist/chunk-TEILUWOI.js.map +1 -0
  161. package/dist/chunk-TJYQIGAP.js +82 -0
  162. package/dist/chunk-TJYQIGAP.js.map +1 -0
  163. package/dist/{chunk-H2X3ISXG.js → chunk-UAG5KWVA.js} +7 -7
  164. package/dist/chunk-UAG5KWVA.js.map +1 -0
  165. package/dist/chunk-UDRIWL7A.js +382 -0
  166. package/dist/chunk-UDRIWL7A.js.map +1 -0
  167. package/dist/{chunk-2GLDA55J.js → chunk-UIU2THRG.js} +498 -133
  168. package/dist/chunk-UIU2THRG.js.map +1 -0
  169. package/dist/{chunk-3YPCK6JX.js → chunk-UPJNJGGA.js} +165 -423
  170. package/dist/chunk-UPJNJGGA.js.map +1 -0
  171. package/dist/chunk-UV5MFVO3.js +21 -0
  172. package/dist/chunk-UV5MFVO3.js.map +1 -0
  173. package/dist/{chunk-2WUSG3IT.js → chunk-V7RWQRG7.js} +5 -5
  174. package/dist/chunk-V7RWQRG7.js.map +1 -0
  175. package/dist/{chunk-VTKGMEPP.js → chunk-VCTFO5CO.js} +13 -3
  176. package/dist/chunk-VCTFO5CO.js.map +1 -0
  177. package/dist/{chunk-5T22KDPN.js → chunk-VFQGRQIH.js} +8 -8
  178. package/dist/chunk-VFQGRQIH.js.map +1 -0
  179. package/dist/{chunk-2QR2PQTT.js → chunk-VQNJ7UZL.js} +5 -3
  180. package/dist/chunk-VQNJ7UZL.js.map +1 -0
  181. package/dist/{chunk-DONMZAD2.js → chunk-WWGT2MDV.js} +43 -165
  182. package/dist/chunk-WWGT2MDV.js.map +1 -0
  183. package/dist/{chunk-EMIGCR7X.js → chunk-WXSYDNBT.js} +2 -2
  184. package/dist/chunk-WXSYDNBT.js.map +1 -0
  185. package/dist/chunk-WYSO2NIH.js +30 -0
  186. package/dist/chunk-WYSO2NIH.js.map +1 -0
  187. package/dist/chunk-XXYIOFUB.js +164 -0
  188. package/dist/chunk-XXYIOFUB.js.map +1 -0
  189. package/dist/{chunk-3BFJOWSU.js → chunk-Y22T3KQE.js} +35 -7
  190. package/dist/chunk-Y22T3KQE.js.map +1 -0
  191. package/dist/{chunk-A3JMGXPG.js → chunk-YMUGBZN2.js} +2 -2
  192. package/dist/chunk-YMUGBZN2.js.map +1 -0
  193. package/dist/{chunk-I5FOWO4J.js → chunk-ZCGAHGUS.js} +52 -73
  194. package/dist/chunk-ZCGAHGUS.js.map +1 -0
  195. package/dist/{chunk-FZU343FL.js → chunk-ZJADGNYF.js} +2 -2
  196. package/dist/chunk-ZJADGNYF.js.map +1 -0
  197. package/dist/{chunk-B6PB7JLN.js → chunk-ZYUC53LT.js} +427 -6
  198. package/dist/chunk-ZYUC53LT.js.map +1 -0
  199. package/dist/collection-facade-GQAOGJP2.js +33 -0
  200. package/dist/consent/index.d.ts +5 -7
  201. package/dist/consent/index.js +7 -5
  202. package/dist/consent/index.js.map +1 -1
  203. package/dist/crdt/index.d.ts +6 -2
  204. package/dist/crdt/index.js +3 -2
  205. package/dist/crdt/index.js.map +1 -1
  206. package/dist/decrypt-partition-IHtxEnTi.d.ts +21 -0
  207. package/dist/delegation-UL5HKLER.js +19 -0
  208. package/dist/derivations/index.d.ts +7 -9
  209. package/dist/derivations/index.js +11 -6
  210. package/dist/describe/index.d.ts +1 -0
  211. package/dist/describe/index.js +1 -0
  212. package/dist/describe-Ccd1hS7a.d.ts +143 -0
  213. package/dist/{dev-unlock-B4kDxep_.d.ts → dev-unlock-h0K-UZTk.d.ts} +1 -1
  214. package/dist/discriminant-BN9REW3o.d.ts +60 -0
  215. package/dist/enclave-UL5LW66V.js +88 -0
  216. package/dist/executor-2FWQRLMG.js +15 -0
  217. package/dist/executor-QZ7BXICW.js +9 -0
  218. package/dist/executor-Z5ZLJVTV.js +9 -0
  219. package/dist/export-accessible-KRV5W4GH.js +17 -0
  220. package/dist/extract-partition-GLKBOXFQ.js +30 -0
  221. package/dist/{fanout-sidecar-OKPMMPLG.js → fanout-sidecar-GF3DJ6KR.js} +34 -14
  222. package/dist/fanout-sidecar-GF3DJ6KR.js.map +1 -0
  223. package/dist/forget/index.d.ts +36 -0
  224. package/dist/forget/index.js +19 -0
  225. package/dist/forget/index.js.map +1 -0
  226. package/dist/guards/index.d.ts +13 -9
  227. package/dist/guards/index.js +12 -5
  228. package/dist/{hash-DdpVypUp.d.cts → hash-CdSr06sm.d.ts} +5 -1
  229. package/dist/history/index.d.ts +6 -8
  230. package/dist/history/index.js +19 -12
  231. package/dist/history/index.js.map +1 -1
  232. package/dist/i18n/index.d.ts +5 -7
  233. package/dist/i18n/index.js +104 -15
  234. package/dist/i18n/index.js.map +1 -1
  235. package/dist/in/index.d.ts +5 -0
  236. package/dist/in/index.js +1 -0
  237. package/dist/in/index.js.map +1 -0
  238. package/dist/index-B9QdHytu.d.ts +123 -0
  239. package/dist/index-CGLLRtFc.d.ts +123 -0
  240. package/dist/{types-Df28QFKb.d.ts → index-_6At2_9_.d.ts} +16270 -8358
  241. package/dist/index.d.ts +1088 -450
  242. package/dist/index.js +1165 -293
  243. package/dist/index.js.map +1 -1
  244. package/dist/indexing/index.d.ts +6 -3
  245. package/dist/indexing/index.js +6 -5
  246. package/dist/indexing/index.js.map +1 -1
  247. package/dist/issue-Y6UVIR43.js +13 -0
  248. package/dist/issue-Y6UVIR43.js.map +1 -0
  249. package/dist/kernel/index.d.ts +32 -0
  250. package/dist/kernel/index.js +53 -0
  251. package/dist/kernel/index.js.map +1 -0
  252. package/dist/{ledger-TMRZYNVJ.js → ledger-RYI35CDS.js} +12 -9
  253. package/dist/ledger-RYI35CDS.js.map +1 -0
  254. package/dist/liberate-CRPZEV7O.js +18 -0
  255. package/dist/liberate-CRPZEV7O.js.map +1 -0
  256. package/dist/materialized-views/index.d.ts +6 -19
  257. package/dist/materialized-views/index.js +16 -12
  258. package/dist/mime-magic-B4RoFj3B.d.ts +103 -0
  259. package/dist/noydb-LDEBLNHY.js +50 -0
  260. package/dist/noydb-LDEBLNHY.js.map +1 -0
  261. package/dist/on/index.d.ts +5 -0
  262. package/dist/on/index.js +11 -0
  263. package/dist/on/index.js.map +1 -0
  264. package/dist/overlay-views/index.d.ts +27 -11
  265. package/dist/overlay-views/index.js +7 -6
  266. package/dist/periods/index.d.ts +5 -7
  267. package/dist/periods/index.js +13 -9
  268. package/dist/pod/index.d.ts +63 -0
  269. package/dist/pod/index.js +61 -0
  270. package/dist/pod/index.js.map +1 -0
  271. package/dist/policy-IXK4FVXP.js +41 -0
  272. package/dist/policy-IXK4FVXP.js.map +1 -0
  273. package/dist/portability/index.d.ts +20 -0
  274. package/dist/portability/index.js +43 -0
  275. package/dist/portability/index.js.map +1 -0
  276. package/dist/{public-envelope-BW6OXORV.js → public-envelope-JHDQCPSX.js} +6 -5
  277. package/dist/public-envelope-JHDQCPSX.js.map +1 -0
  278. package/dist/query/index.d.ts +5 -3
  279. package/dist/query/index.js +21 -13
  280. package/dist/read-only-facade-5ADRJVTM.js +8 -0
  281. package/dist/read-only-facade-5ADRJVTM.js.map +1 -0
  282. package/dist/registry-45RJNWGU.js +9 -0
  283. package/dist/registry-45RJNWGU.js.map +1 -0
  284. package/dist/registry-5GRV5VXI.js +13 -0
  285. package/dist/registry-5GRV5VXI.js.map +1 -0
  286. package/dist/registry-VW6P6A3J.js +8 -0
  287. package/dist/registry-VW6P6A3J.js.map +1 -0
  288. package/dist/registry-WEUCHBO4.js +11 -0
  289. package/dist/registry-WEUCHBO4.js.map +1 -0
  290. package/dist/request-withdrawal-GBPH2FDY.js +25 -0
  291. package/dist/request-withdrawal-GBPH2FDY.js.map +1 -0
  292. package/dist/revoke-TUFRGI6S.js +18 -0
  293. package/dist/revoke-TUFRGI6S.js.map +1 -0
  294. package/dist/sealed-record/index.d.ts +69 -0
  295. package/dist/sealed-record/index.js +65 -0
  296. package/dist/sealed-record/index.js.map +1 -0
  297. package/dist/session/index.d.ts +6 -8
  298. package/dist/session/index.js +7 -5
  299. package/dist/session/index.js.map +1 -1
  300. package/dist/shadow/index.d.ts +5 -7
  301. package/dist/shadow/index.js +4 -3
  302. package/dist/shadow/index.js.map +1 -1
  303. package/dist/{signer-72QAUSVW.js → signer-PNKTBVF7.js} +6 -5
  304. package/dist/signer-PNKTBVF7.js.map +1 -0
  305. package/dist/snapshots/index.d.ts +6 -8
  306. package/dist/snapshots/index.js +13 -11
  307. package/dist/snapshots/index.js.map +1 -1
  308. package/dist/{stale-6ZDBTQT7.js → stale-3JWHNDIY.js} +3 -2
  309. package/dist/stale-3JWHNDIY.js.map +1 -0
  310. package/dist/store-coordination-provider-3I7XWZZK.js +142 -0
  311. package/dist/store-coordination-provider-3I7XWZZK.js.map +1 -0
  312. package/dist/subject-index-O75wKshW.d.ts +362 -0
  313. package/dist/sync/index.d.ts +4 -6
  314. package/dist/sync/index.js +7 -6
  315. package/dist/sync/index.js.map +1 -1
  316. package/dist/team/index.d.ts +5 -7
  317. package/dist/team/index.js +20 -16
  318. package/dist/tiers/index.d.ts +5 -0
  319. package/dist/tiers/index.js +33 -0
  320. package/dist/tiers/index.js.map +1 -0
  321. package/dist/to/index.d.ts +5 -0
  322. package/dist/to/index.js +17 -0
  323. package/dist/to/index.js.map +1 -0
  324. package/dist/transition-guard-DqodPNKw.d.ts +165 -0
  325. package/dist/tx/index.d.ts +23 -9
  326. package/dist/tx/index.js +13 -8
  327. package/dist/tx/index.js.map +1 -1
  328. package/dist/ui/index.d.ts +1 -0
  329. package/dist/ui/index.js +1 -0
  330. package/dist/ui/index.js.map +1 -0
  331. package/dist/ulid-DRH25k3y.d.ts +66 -0
  332. package/dist/ulid-PTAIMDG4.js +10 -0
  333. package/dist/ulid-PTAIMDG4.js.map +1 -0
  334. package/dist/util/index.d.ts +2 -0
  335. package/dist/util/index.js +7 -2
  336. package/dist/util/index.js.map +1 -1
  337. package/dist/vault-diff-BtpiBvic.d.ts +147 -0
  338. package/dist/with/index.d.ts +38 -0
  339. package/dist/with/index.js +25 -0
  340. package/dist/with/index.js.map +1 -0
  341. package/dist/{with-materialized-view-BLkQxoQN.d.ts → with-materialized-view-DMmWtYfJ.d.ts} +1 -1
  342. package/dist/{with-overlayed-view-CRsSEwHR.d.ts → with-overlayed-view-D_IB2nkM.d.ts} +2 -3
  343. package/dist/with-rollup-em2wxoHP.d.ts +47 -0
  344. package/dist/withdraw-accessible-FFS46EOD.js +22 -0
  345. package/dist/withdraw-accessible-FFS46EOD.js.map +1 -0
  346. package/dist/zod-HAJM7LMS.js +14763 -0
  347. package/dist/zod-HAJM7LMS.js.map +1 -0
  348. package/package.json +121 -201
  349. package/dist/aggregate/index.cjs.map +0 -1
  350. package/dist/aggregate/index.d.cts +0 -38
  351. package/dist/attestation/index.cjs +0 -305
  352. package/dist/attestation/index.cjs.map +0 -1
  353. package/dist/attestation/index.d.cts +0 -52
  354. package/dist/blobs/index.cjs +0 -1480
  355. package/dist/blobs/index.cjs.map +0 -1
  356. package/dist/blobs/index.d.cts +0 -46
  357. package/dist/bundle/index.cjs +0 -19264
  358. package/dist/bundle/index.cjs.map +0 -1
  359. package/dist/bundle/index.d.cts +0 -176
  360. package/dist/chunk-22DWZL57.js.map +0 -1
  361. package/dist/chunk-2GLDA55J.js.map +0 -1
  362. package/dist/chunk-2QR2PQTT.js.map +0 -1
  363. package/dist/chunk-2WUSG3IT.js.map +0 -1
  364. package/dist/chunk-3BFJOWSU.js.map +0 -1
  365. package/dist/chunk-3YPCK6JX.js.map +0 -1
  366. package/dist/chunk-53XBRIRT.js.map +0 -1
  367. package/dist/chunk-5T22KDPN.js.map +0 -1
  368. package/dist/chunk-5XHKQ56N.js +0 -340
  369. package/dist/chunk-5XHKQ56N.js.map +0 -1
  370. package/dist/chunk-6CME4UEK.js.map +0 -1
  371. package/dist/chunk-6STK5TQP.js +0 -139
  372. package/dist/chunk-6STK5TQP.js.map +0 -1
  373. package/dist/chunk-A3JMGXPG.js.map +0 -1
  374. package/dist/chunk-B6PB7JLN.js.map +0 -1
  375. package/dist/chunk-BVRYKATC.js.map +0 -1
  376. package/dist/chunk-DE6GKS6G.js.map +0 -1
  377. package/dist/chunk-DFMLEQZB.js.map +0 -1
  378. package/dist/chunk-DJHHA6XH.js.map +0 -1
  379. package/dist/chunk-DL3HWOQ5.js.map +0 -1
  380. package/dist/chunk-DONMZAD2.js.map +0 -1
  381. package/dist/chunk-EMIGCR7X.js.map +0 -1
  382. package/dist/chunk-F3GDRNUT.js.map +0 -1
  383. package/dist/chunk-FZU343FL.js.map +0 -1
  384. package/dist/chunk-H2X3ISXG.js.map +0 -1
  385. package/dist/chunk-HNRHLRDC.js.map +0 -1
  386. package/dist/chunk-I5FOWO4J.js.map +0 -1
  387. package/dist/chunk-J66GRPNH.js.map +0 -1
  388. package/dist/chunk-JWRVQKRZ.js.map +0 -1
  389. package/dist/chunk-K3DK3NU5.js.map +0 -1
  390. package/dist/chunk-ML236QKC.js.map +0 -1
  391. package/dist/chunk-NONAAENK.js.map +0 -1
  392. package/dist/chunk-O3VZPBZG.js.map +0 -1
  393. package/dist/chunk-OIF6LZUR.js.map +0 -1
  394. package/dist/chunk-OQ6PIGHA.js +0 -19
  395. package/dist/chunk-OQ6PIGHA.js.map +0 -1
  396. package/dist/chunk-PE2FR4J3.js.map +0 -1
  397. package/dist/chunk-PP6W64Y3.js +0 -275
  398. package/dist/chunk-PP6W64Y3.js.map +0 -1
  399. package/dist/chunk-PX35GA7L.js.map +0 -1
  400. package/dist/chunk-QEILDE6R.js +0 -793
  401. package/dist/chunk-QEILDE6R.js.map +0 -1
  402. package/dist/chunk-QODLLGQ7.js.map +0 -1
  403. package/dist/chunk-RAZ4OVLL.js +0 -51
  404. package/dist/chunk-RAZ4OVLL.js.map +0 -1
  405. package/dist/chunk-SYMWGEET.js.map +0 -1
  406. package/dist/chunk-T7JEBOGN.js.map +0 -1
  407. package/dist/chunk-TFBP23BX.js.map +0 -1
  408. package/dist/chunk-TV3YZ35S.js +0 -90
  409. package/dist/chunk-TV3YZ35S.js.map +0 -1
  410. package/dist/chunk-U26HQ6KJ.js.map +0 -1
  411. package/dist/chunk-UF3BUNQZ.js +0 -1
  412. package/dist/chunk-UMLVJTYV.js +0 -20
  413. package/dist/chunk-UMLVJTYV.js.map +0 -1
  414. package/dist/chunk-VTKGMEPP.js.map +0 -1
  415. package/dist/chunk-W6EQLGMB.js +0 -100
  416. package/dist/chunk-W6EQLGMB.js.map +0 -1
  417. package/dist/chunk-WIRRPTFH.js +0 -17
  418. package/dist/chunk-WIRRPTFH.js.map +0 -1
  419. package/dist/chunk-WPLVTJ5D.js.map +0 -1
  420. package/dist/chunk-XJFLDA7A.js.map +0 -1
  421. package/dist/chunk-Z6FNBOTC.js.map +0 -1
  422. package/dist/chunk-ZYWZWG6G.js.map +0 -1
  423. package/dist/consent/index.cjs +0 -204
  424. package/dist/consent/index.cjs.map +0 -1
  425. package/dist/consent/index.d.cts +0 -25
  426. package/dist/crdt/index.cjs +0 -152
  427. package/dist/crdt/index.cjs.map +0 -1
  428. package/dist/crdt/index.d.cts +0 -30
  429. package/dist/crypto-HTZ4FJOP.js +0 -44
  430. package/dist/delegation-RI54P6I5.js +0 -17
  431. package/dist/derivations/index.cjs +0 -351
  432. package/dist/derivations/index.cjs.map +0 -1
  433. package/dist/derivations/index.d.cts +0 -72
  434. package/dist/dev-unlock-BIoEFbwm.d.cts +0 -263
  435. package/dist/executor-5PNY7LGW.js +0 -8
  436. package/dist/executor-B4QIYGZX.js +0 -8
  437. package/dist/executor-BWXXDQ7K.js +0 -11
  438. package/dist/fanout-sidecar-OKPMMPLG.js.map +0 -1
  439. package/dist/guards/index.cjs +0 -322
  440. package/dist/guards/index.cjs.map +0 -1
  441. package/dist/guards/index.d.cts +0 -31
  442. package/dist/hash-HJqD14vS.d.ts +0 -63
  443. package/dist/history/index.cjs +0 -1222
  444. package/dist/history/index.cjs.map +0 -1
  445. package/dist/history/index.d.cts +0 -63
  446. package/dist/i18n/index.cjs +0 -1100
  447. package/dist/i18n/index.cjs.map +0 -1
  448. package/dist/i18n/index.d.cts +0 -39
  449. package/dist/index-4fBVt8j9.d.cts +0 -2387
  450. package/dist/index-D8I_pyJD.d.ts +0 -2387
  451. package/dist/index.cjs +0 -24487
  452. package/dist/index.cjs.map +0 -1
  453. package/dist/index.d.cts +0 -776
  454. package/dist/indexing/index.cjs +0 -742
  455. package/dist/indexing/index.cjs.map +0 -1
  456. package/dist/indexing/index.d.cts +0 -36
  457. package/dist/issue-VGDPP4B5.js +0 -12
  458. package/dist/lazy-builder-7tIpFyWN.d.ts +0 -304
  459. package/dist/lazy-builder-wY4pMCEe.d.cts +0 -304
  460. package/dist/materialized-views/index.cjs +0 -854
  461. package/dist/materialized-views/index.cjs.map +0 -1
  462. package/dist/materialized-views/index.d.cts +0 -186
  463. package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
  464. package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
  465. package/dist/noydb-G725ZSZG.js +0 -34
  466. package/dist/overlay-views/index.cjs +0 -359
  467. package/dist/overlay-views/index.cjs.map +0 -1
  468. package/dist/overlay-views/index.d.cts +0 -82
  469. package/dist/periods/index.cjs +0 -1041
  470. package/dist/periods/index.cjs.map +0 -1
  471. package/dist/periods/index.d.cts +0 -22
  472. package/dist/predicate-BSAGEyu5.d.cts +0 -209
  473. package/dist/predicate-BSAGEyu5.d.ts +0 -209
  474. package/dist/query/index.cjs +0 -2375
  475. package/dist/query/index.cjs.map +0 -1
  476. package/dist/query/index.d.cts +0 -3
  477. package/dist/read-only-facade-ITU6L7BL.js +0 -7
  478. package/dist/registry-3QP3YKQS.js +0 -8
  479. package/dist/registry-DKEXOJVO.js +0 -7
  480. package/dist/registry-OJIOSBV6.js +0 -10
  481. package/dist/registry-USRVT6YF.js +0 -8
  482. package/dist/revoke-JCC7N56X.js +0 -17
  483. package/dist/session/index.cjs +0 -495
  484. package/dist/session/index.cjs.map +0 -1
  485. package/dist/session/index.d.cts +0 -46
  486. package/dist/shadow/index.cjs +0 -133
  487. package/dist/shadow/index.cjs.map +0 -1
  488. package/dist/shadow/index.d.cts +0 -17
  489. package/dist/snapshots/index.cjs +0 -937
  490. package/dist/snapshots/index.cjs.map +0 -1
  491. package/dist/snapshots/index.d.cts +0 -28
  492. package/dist/store/index.cjs +0 -1083
  493. package/dist/store/index.cjs.map +0 -1
  494. package/dist/store/index.d.cts +0 -492
  495. package/dist/store/index.d.ts +0 -492
  496. package/dist/store/index.js +0 -37
  497. package/dist/strategy-BSxFXGzb.d.cts +0 -110
  498. package/dist/strategy-BSxFXGzb.d.ts +0 -110
  499. package/dist/strategy-DSTrsZ8t.d.cts +0 -601
  500. package/dist/strategy-DSTrsZ8t.d.ts +0 -601
  501. package/dist/sync/index.cjs +0 -1062
  502. package/dist/sync/index.cjs.map +0 -1
  503. package/dist/sync/index.d.cts +0 -43
  504. package/dist/team/index.cjs +0 -2798
  505. package/dist/team/index.cjs.map +0 -1
  506. package/dist/team/index.d.cts +0 -118
  507. package/dist/tx/index.cjs +0 -544
  508. package/dist/tx/index.cjs.map +0 -1
  509. package/dist/tx/index.d.cts +0 -21
  510. package/dist/types-DyXYr8rE.d.cts +0 -12818
  511. package/dist/ulid-COREQ2RQ.js +0 -9
  512. package/dist/ulid-Drr7ykr6.d.cts +0 -603
  513. package/dist/util/index.cjs +0 -230
  514. package/dist/util/index.cjs.map +0 -1
  515. package/dist/util/index.d.cts +0 -77
  516. package/dist/with-derivation-DFnFByiQ.d.ts +0 -13
  517. package/dist/with-derivation-DU3Sjazm.d.cts +0 -13
  518. package/dist/with-guard-ByyxmEe7.d.cts +0 -18
  519. package/dist/with-guard-qube6BMI.d.ts +0 -18
  520. package/dist/with-materialized-view-BmEToIR1.d.cts +0 -27
  521. package/dist/with-overlayed-view-BMsQQbWm.d.cts +0 -13
  522. /package/dist/{store → adapter}/index.js.map +0 -0
  523. /package/dist/{chunk-UF3BUNQZ.js.map → api-RW3KP7WU.js.map} +0 -0
  524. /package/dist/{crypto-HTZ4FJOP.js.map → as/index.js.map} +0 -0
  525. /package/dist/{delegation-RI54P6I5.js.map → at/index.js.map} +0 -0
  526. /package/dist/{executor-5PNY7LGW.js.map → by/index.js.map} +0 -0
  527. /package/dist/{executor-B4QIYGZX.js.map → cargo/index.js.map} +0 -0
  528. /package/dist/{executor-BWXXDQ7K.js.map → chunk-BGIZAFY7.js.map} +0 -0
  529. /package/dist/{issue-VGDPP4B5.js.map → chunk-CHFZDSE4.js.map} +0 -0
  530. /package/dist/{ledger-TMRZYNVJ.js.map → chunk-GHVIKOHT.js.map} +0 -0
  531. /package/dist/{noydb-G725ZSZG.js.map → chunk-K2WCO3NX.js.map} +0 -0
  532. /package/dist/{public-envelope-BW6OXORV.js.map → chunk-PZ5AY32C.js.map} +0 -0
  533. /package/dist/{read-only-facade-ITU6L7BL.js.map → collection-facade-GQAOGJP2.js.map} +0 -0
  534. /package/dist/{registry-3QP3YKQS.js.map → delegation-UL5HKLER.js.map} +0 -0
  535. /package/dist/{registry-DKEXOJVO.js.map → describe/index.js.map} +0 -0
  536. /package/dist/{registry-OJIOSBV6.js.map → enclave-UL5LW66V.js.map} +0 -0
  537. /package/dist/{registry-USRVT6YF.js.map → executor-2FWQRLMG.js.map} +0 -0
  538. /package/dist/{revoke-JCC7N56X.js.map → executor-QZ7BXICW.js.map} +0 -0
  539. /package/dist/{signer-72QAUSVW.js.map → executor-Z5ZLJVTV.js.map} +0 -0
  540. /package/dist/{stale-6ZDBTQT7.js.map → export-accessible-KRV5W4GH.js.map} +0 -0
  541. /package/dist/{ulid-COREQ2RQ.js.map → extract-partition-GLKBOXFQ.js.map} +0 -0
@@ -1,742 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/indexing/index.ts
21
- var indexing_exports = {};
22
- __export(indexing_exports, {
23
- COMPOSITE_DELIMITER: () => COMPOSITE_DELIMITER,
24
- CollectionIndexes: () => CollectionIndexes,
25
- IDX_PREFIX: () => IDX_PREFIX,
26
- LazyQuery: () => LazyQuery,
27
- PersistedCollectionIndex: () => PersistedCollectionIndex,
28
- compositeKey: () => compositeKey,
29
- decodeIdxId: () => decodeIdxId,
30
- encodeIdxId: () => encodeIdxId,
31
- isIdxId: () => isIdxId,
32
- withIndexing: () => withIndexing
33
- });
34
- module.exports = __toCommonJS(indexing_exports);
35
-
36
- // src/query/predicate.ts
37
- function readPath(record, path) {
38
- if (record === null || record === void 0) return void 0;
39
- if (!path.includes(".")) {
40
- return record[path];
41
- }
42
- const segments = path.split(".");
43
- let cursor = record;
44
- for (const segment of segments) {
45
- if (cursor === null || cursor === void 0) return void 0;
46
- cursor = cursor[segment];
47
- }
48
- return cursor;
49
- }
50
- function evaluateFieldClause(record, clause) {
51
- const actual = readPath(record, clause.field);
52
- const { op, value } = clause;
53
- switch (op) {
54
- case "==":
55
- return actual === value;
56
- case "!=":
57
- return actual !== value;
58
- case "<":
59
- return isComparable(actual, value) && actual < value;
60
- case "<=":
61
- return isComparable(actual, value) && actual <= value;
62
- case ">":
63
- return isComparable(actual, value) && actual > value;
64
- case ">=":
65
- return isComparable(actual, value) && actual >= value;
66
- case "in":
67
- return Array.isArray(value) && value.includes(actual);
68
- case "contains":
69
- if (typeof actual === "string") return typeof value === "string" && actual.includes(value);
70
- if (Array.isArray(actual)) return actual.includes(value);
71
- return false;
72
- case "startsWith":
73
- return typeof actual === "string" && typeof value === "string" && actual.startsWith(value);
74
- case "between": {
75
- if (!Array.isArray(value) || value.length !== 2) return false;
76
- const [lo, hi] = value;
77
- if (!isComparable(actual, lo) || !isComparable(actual, hi)) return false;
78
- return actual >= lo && actual <= hi;
79
- }
80
- default: {
81
- const _exhaustive = op;
82
- void _exhaustive;
83
- return false;
84
- }
85
- }
86
- }
87
- function isComparable(a, b) {
88
- if (typeof a === "number" && typeof b === "number") return true;
89
- if (typeof a === "string" && typeof b === "string") return true;
90
- if (a instanceof Date && b instanceof Date) return true;
91
- return false;
92
- }
93
- function evaluateClause(record, clause) {
94
- switch (clause.type) {
95
- case "field":
96
- return evaluateFieldClause(record, clause);
97
- case "filter":
98
- return clause.fn(record);
99
- case "wherePredicate":
100
- return clause.fn(record, clause.ctx);
101
- case "crossJoin":
102
- throw new Error(
103
- `evaluateClause: 'crossJoin' clauses are expansion primitives and are not evaluated per-record. This is a query planner routing error \u2014 crossJoin clauses must be extracted from the clause list before calling evaluateClause or filterRecords.`
104
- );
105
- case "group":
106
- if (clause.op === "and") {
107
- for (const child of clause.clauses) {
108
- if (!evaluateClause(record, child)) return false;
109
- }
110
- return true;
111
- } else {
112
- for (const child of clause.clauses) {
113
- if (evaluateClause(record, child)) return true;
114
- }
115
- return false;
116
- }
117
- }
118
- }
119
-
120
- // src/indexing/eager-indexes.ts
121
- var CollectionIndexes = class {
122
- indexes = /* @__PURE__ */ new Map();
123
- /**
124
- * Declare an index. Subsequent record additions are tracked under it.
125
- * Calling this twice for the same field is a no-op (idempotent).
126
- */
127
- declare(field) {
128
- if (this.indexes.has(field)) return;
129
- this.indexes.set(field, { field, buckets: /* @__PURE__ */ new Map() });
130
- }
131
- /** True if the given field has a declared index. */
132
- has(field) {
133
- return this.indexes.has(field);
134
- }
135
- /** All declared field names, in declaration order. */
136
- fields() {
137
- return [...this.indexes.keys()];
138
- }
139
- /**
140
- * Build all declared indexes from a snapshot of records.
141
- * Called once per hydration. O(N × indexes.size).
142
- */
143
- build(records) {
144
- for (const idx of this.indexes.values()) {
145
- idx.buckets.clear();
146
- for (const { id, record } of records) {
147
- addToIndex(idx, id, record);
148
- }
149
- }
150
- }
151
- /**
152
- * Insert or update a single record across all indexes.
153
- * Called by `Collection.put()` after the encrypted write succeeds.
154
- *
155
- * If `previousRecord` is provided, the record is removed from any old
156
- * buckets first — this is the update path. Pass `null` for fresh adds.
157
- */
158
- upsert(id, newRecord, previousRecord) {
159
- if (this.indexes.size === 0) return;
160
- if (previousRecord !== null) {
161
- this.remove(id, previousRecord);
162
- }
163
- for (const idx of this.indexes.values()) {
164
- addToIndex(idx, id, newRecord);
165
- }
166
- }
167
- /**
168
- * Remove a record from all indexes. Called by `Collection.delete()`
169
- * (and as the first half of `upsert` for the update path).
170
- */
171
- remove(id, record) {
172
- if (this.indexes.size === 0) return;
173
- for (const idx of this.indexes.values()) {
174
- removeFromIndex(idx, id, record);
175
- }
176
- }
177
- /** Drop all index data. Called when the collection is invalidated. */
178
- clear() {
179
- for (const idx of this.indexes.values()) {
180
- idx.buckets.clear();
181
- }
182
- }
183
- /**
184
- * Equality lookup: return the set of record ids whose `field` matches
185
- * the given value. Returns `null` if no index covers the field — the
186
- * caller should fall back to a linear scan.
187
- *
188
- * The returned Set is a reference to the index's internal storage —
189
- * callers must NOT mutate it.
190
- */
191
- lookupEqual(field, value) {
192
- const idx = this.indexes.get(field);
193
- if (!idx) return null;
194
- const key = stringifyKey(value);
195
- return idx.buckets.get(key) ?? EMPTY_SET;
196
- }
197
- /**
198
- * Set lookup: return the union of record ids whose `field` matches any
199
- * of the given values. Returns `null` if no index covers the field.
200
- */
201
- lookupIn(field, values) {
202
- const idx = this.indexes.get(field);
203
- if (!idx) return null;
204
- const out = /* @__PURE__ */ new Set();
205
- for (const value of values) {
206
- const key = stringifyKey(value);
207
- const bucket = idx.buckets.get(key);
208
- if (bucket) {
209
- for (const id of bucket) out.add(id);
210
- }
211
- }
212
- return out;
213
- }
214
- };
215
- var EMPTY_SET = /* @__PURE__ */ new Set();
216
- function stringifyKey(value) {
217
- if (value === null || value === void 0) return "\0NULL\0";
218
- if (typeof value === "string") return value;
219
- if (typeof value === "number" || typeof value === "boolean") return String(value);
220
- if (value instanceof Date) return value.toISOString();
221
- return "\0OBJECT\0";
222
- }
223
- function addToIndex(idx, id, record) {
224
- const value = readPath(record, idx.field);
225
- if (value === null || value === void 0) return;
226
- const key = stringifyKey(value);
227
- let bucket = idx.buckets.get(key);
228
- if (!bucket) {
229
- bucket = /* @__PURE__ */ new Set();
230
- idx.buckets.set(key, bucket);
231
- }
232
- bucket.add(id);
233
- }
234
- function removeFromIndex(idx, id, record) {
235
- const value = readPath(record, idx.field);
236
- if (value === null || value === void 0) return;
237
- const key = stringifyKey(value);
238
- const bucket = idx.buckets.get(key);
239
- if (!bucket) return;
240
- bucket.delete(id);
241
- if (bucket.size === 0) idx.buckets.delete(key);
242
- }
243
-
244
- // src/indexing/persisted-indexes.ts
245
- var IDX_PREFIX = "_idx/";
246
- function encodeIdxId(field, recordId) {
247
- return `${IDX_PREFIX}${field}/${recordId}`;
248
- }
249
- function decodeIdxId(id) {
250
- if (!id.startsWith(IDX_PREFIX)) return null;
251
- const rest = id.slice(IDX_PREFIX.length);
252
- const firstSlash = rest.indexOf("/");
253
- if (firstSlash <= 0) return null;
254
- const field = rest.slice(0, firstSlash);
255
- const recordId = rest.slice(firstSlash + 1);
256
- if (recordId.length === 0) return null;
257
- return { field, recordId };
258
- }
259
- function isIdxId(id) {
260
- return decodeIdxId(id) !== null;
261
- }
262
- var COMPOSITE_DELIMITER = "|";
263
- function compositeKey(fields) {
264
- return fields.join(COMPOSITE_DELIMITER);
265
- }
266
- var PersistedCollectionIndex = class {
267
- indexes = /* @__PURE__ */ new Map();
268
- defs = /* @__PURE__ */ new Map();
269
- /**
270
- * Declare a single-field index. Subsequent `upsert` / `ingest` calls
271
- * populate the in-memory mirror; calls before `declare` are no-ops
272
- * (tolerant bulk-load ordering). Idempotent.
273
- */
274
- declare(field) {
275
- if (this.indexes.has(field)) return;
276
- this.indexes.set(field, { buckets: /* @__PURE__ */ new Map(), values: /* @__PURE__ */ new Map() });
277
- this.defs.set(field, { kind: "single", field, key: field });
278
- }
279
- /**
280
- * Declare a composite (multi-field) index. The synthetic
281
- * key is `fields.join('|')`; it doubles as the in-memory map key and
282
- * the `_idx/<key>/<recordId>` side-car field segment. Callers upsert
283
- * and lookup via the same `key` as single-field indexes, just with a
284
- * tuple value (JSON-stringified for bucketing).
285
- */
286
- declareComposite(fields) {
287
- if (fields.length === 0) {
288
- throw new Error("declareComposite: fields array must be non-empty");
289
- }
290
- for (const f of fields) {
291
- if (f.includes(COMPOSITE_DELIMITER)) {
292
- throw new Error(
293
- `declareComposite: field "${f}" contains the composite delimiter "${COMPOSITE_DELIMITER}" \u2014 pick a different field name or open an issue to add hash-based composite keys.`
294
- );
295
- }
296
- }
297
- const key = compositeKey(fields);
298
- if (this.indexes.has(key)) return;
299
- this.indexes.set(key, { buckets: /* @__PURE__ */ new Map(), values: /* @__PURE__ */ new Map() });
300
- this.defs.set(key, { kind: "composite", fields: [...fields], key });
301
- }
302
- /**
303
- * Every declared index's structured definition. Collection walks this
304
- * when materialising side-cars on put/delete so it can extract a
305
- * single-field value or a composite tuple appropriately.
306
- */
307
- definitions() {
308
- return [...this.defs.values()];
309
- }
310
- /** True if `field` has been declared as indexable on this mirror. */
311
- has(field) {
312
- return this.indexes.has(field);
313
- }
314
- /** All declared field names, in declaration order. */
315
- fields() {
316
- return [...this.indexes.keys()];
317
- }
318
- /**
319
- * Bulk-load the mirror from decrypted index bodies. Intended to be
320
- * called once per field after reading the collection's `_idx/<field>/*`
321
- * side-cars. Safe to call twice with the same rows — bucket Sets
322
- * deduplicate recordIds. If `field` is not declared, this is a no-op
323
- * (tolerates the case where bulk-load runs before `declare()` lands).
324
- */
325
- ingest(field, rows) {
326
- const state = this.indexes.get(field);
327
- if (!state) return;
328
- for (const row of rows) {
329
- addToState(state, row.recordId, row.value);
330
- }
331
- }
332
- /**
333
- * Incrementally update a record's index entry for one field. Called by
334
- * `Collection.put()` after the main write succeeds. If
335
- * `previousValue` is non-null, the record is removed from the old
336
- * bucket first — this is the update path. Pass `null` for fresh adds.
337
- * No-op if the field is not declared.
338
- */
339
- upsert(recordId, field, newValue, previousValue) {
340
- const state = this.indexes.get(field);
341
- if (!state) return;
342
- if (previousValue !== null && previousValue !== void 0) {
343
- removeFromState(state, recordId, previousValue);
344
- }
345
- addToState(state, recordId, newValue);
346
- }
347
- /**
348
- * Remove a record from the index for one field. Called by
349
- * `Collection.delete()`. No-op if the field is not declared or
350
- * the record isn't in the bucket. Empty buckets are dropped to keep
351
- * the Map clean.
352
- */
353
- remove(recordId, field, value) {
354
- const state = this.indexes.get(field);
355
- if (!state) return;
356
- removeFromState(state, recordId, value);
357
- }
358
- /**
359
- * Drop all bucket data while preserving field declarations. Called on
360
- * invalidation (incoming sync changes, keyring rotation) — the next
361
- * query re-populates via `ingest`.
362
- */
363
- clear() {
364
- for (const state of this.indexes.values()) {
365
- state.buckets.clear();
366
- state.values.clear();
367
- }
368
- }
369
- /**
370
- * Equality lookup — return the set of record ids whose `field` matches
371
- * `value`. Returns `null` if the field is not declared (caller falls
372
- * back to scan or throws `IndexRequiredError`). Returns a shared empty
373
- * set if the field is declared but no record matches — that set MUST
374
- * NOT be mutated by the caller.
375
- */
376
- lookupEqual(field, value) {
377
- const state = this.indexes.get(field);
378
- if (!state) return null;
379
- const key = stringifyKey2(value);
380
- return state.buckets.get(key) ?? EMPTY_SET2;
381
- }
382
- /**
383
- * Set lookup — return the union of record ids whose `field` matches any
384
- * of `values`. Returns `null` if the field is not declared. Returns a
385
- * fresh (non-shared) Set — safe for the caller to mutate.
386
- */
387
- lookupIn(field, values) {
388
- const state = this.indexes.get(field);
389
- if (!state) return null;
390
- const out = /* @__PURE__ */ new Set();
391
- for (const value of values) {
392
- const bucket = state.buckets.get(stringifyKey2(value));
393
- if (bucket) for (const id of bucket) out.add(id);
394
- }
395
- return out;
396
- }
397
- /**
398
- * Range lookup. Return record ids whose indexed value
399
- * satisfies the predicate. Comparison happens on the ORIGINAL TYPED
400
- * value carried in `state.values` — so numeric `<` sorts numerically,
401
- * not lexicographically on `String(n)`. Returns `null` if the field
402
- * is not declared.
403
- *
404
- * Supported ops: `'<'`, `'<='`, `'>'`, `'>='`, `'between'`. For
405
- * `'between'`, `value` is `[lo, hi]` and both bounds are inclusive
406
- * (matches the eager-mode operator contract in `predicate.ts`).
407
- */
408
- lookupRange(field, op, value) {
409
- const state = this.indexes.get(field);
410
- if (!state) return null;
411
- const out = /* @__PURE__ */ new Set();
412
- for (const [recordId, live] of state.values) {
413
- if (live === void 0 || live === null) continue;
414
- if (matchesRange(live, op, value)) out.add(recordId);
415
- }
416
- return out;
417
- }
418
- /**
419
- * Sorted iteration — return every entry on `field` as an
420
- * `OrderedEntry[]`, sorted by the ORIGINAL TYPED value (no more
421
- * `'10' < '2'` surprises on numeric fields). Consumers paginate with
422
- * a numeric offset. `OrderedEntry.value` is the typed value.
423
- */
424
- orderedBy(field, dir) {
425
- const state = this.indexes.get(field);
426
- if (!state) return null;
427
- const entries = [];
428
- for (const [recordId, value] of state.values) {
429
- entries.push({ recordId, value });
430
- }
431
- entries.sort((a, b) => compareTyped(a.value, b.value));
432
- if (dir === "desc") entries.reverse();
433
- return entries;
434
- }
435
- };
436
- var EMPTY_SET2 = /* @__PURE__ */ new Set();
437
- function stringifyKey2(value) {
438
- if (value === null || value === void 0) return "\0NULL\0";
439
- if (typeof value === "string") return value;
440
- if (typeof value === "number" || typeof value === "boolean") return String(value);
441
- if (value instanceof Date) return value.toISOString();
442
- if (Array.isArray(value)) {
443
- const parts = [];
444
- for (const el of value) parts.push(stringifyKey2(el));
445
- return JSON.stringify(parts);
446
- }
447
- return "\0OBJECT\0";
448
- }
449
- function addToState(state, recordId, value) {
450
- if (value === null || value === void 0) return;
451
- const key = stringifyKey2(value);
452
- let bucket = state.buckets.get(key);
453
- if (!bucket) {
454
- bucket = /* @__PURE__ */ new Set();
455
- state.buckets.set(key, bucket);
456
- }
457
- bucket.add(recordId);
458
- state.values.set(recordId, value);
459
- }
460
- function removeFromState(state, recordId, value) {
461
- if (value === null || value === void 0) return;
462
- const key = stringifyKey2(value);
463
- const bucket = state.buckets.get(key);
464
- if (bucket) {
465
- bucket.delete(recordId);
466
- if (bucket.size === 0) state.buckets.delete(key);
467
- }
468
- state.values.delete(recordId);
469
- }
470
- function matchesRange(live, op, bound) {
471
- if (op === "between") {
472
- if (!Array.isArray(bound) || bound.length !== 2) return false;
473
- return compareTyped(live, bound[0]) >= 0 && compareTyped(live, bound[1]) <= 0;
474
- }
475
- const cmp = compareTyped(live, bound);
476
- switch (op) {
477
- case "<":
478
- return cmp < 0;
479
- case "<=":
480
- return cmp <= 0;
481
- case ">":
482
- return cmp > 0;
483
- case ">=":
484
- return cmp >= 0;
485
- }
486
- }
487
- function compareTyped(a, b) {
488
- if (a === void 0 || a === null) return b === void 0 || b === null ? 0 : 1;
489
- if (b === void 0 || b === null) return -1;
490
- if (typeof a === "number" && typeof b === "number") return a - b;
491
- if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
492
- if (typeof a === "string" && typeof b === "string") return a < b ? -1 : a > b ? 1 : 0;
493
- if (typeof a === "boolean" && typeof b === "boolean") {
494
- return a === b ? 0 : a ? 1 : -1;
495
- }
496
- return 0;
497
- }
498
-
499
- // src/indexing/active.ts
500
- function withIndexing() {
501
- return {
502
- createState({ defs, lazy }) {
503
- if (lazy) {
504
- const persisted = new PersistedCollectionIndex();
505
- declareAll(persisted, defs);
506
- return makeLazyState(persisted);
507
- }
508
- const eager = new CollectionIndexes();
509
- for (const def of defs) {
510
- if (typeof def === "string") {
511
- eager.declare(def);
512
- } else if (Array.isArray(def)) {
513
- for (const f of def) eager.declare(f);
514
- } else {
515
- for (const f of def.fields) eager.declare(f);
516
- }
517
- }
518
- return makeEagerState(eager);
519
- }
520
- };
521
- }
522
- function declareAll(persisted, defs) {
523
- for (const def of defs) {
524
- if (typeof def === "string") {
525
- persisted.declare(def);
526
- } else if (Array.isArray(def)) {
527
- persisted.declareComposite(def);
528
- } else {
529
- persisted.declareComposite(def.fields);
530
- }
531
- }
532
- }
533
- function makeEagerState(eager) {
534
- return {
535
- isEnabled: true,
536
- getEagerIndexes: () => eager,
537
- getPersistedIndexes: () => null
538
- };
539
- }
540
- function makeLazyState(persisted) {
541
- return {
542
- isEnabled: true,
543
- getEagerIndexes: () => null,
544
- getPersistedIndexes: () => persisted
545
- };
546
- }
547
-
548
- // src/errors.ts
549
- var NoydbError = class extends Error {
550
- /** Machine-readable error code. Stable across library versions. */
551
- code;
552
- constructor(code, message) {
553
- super(message);
554
- this.name = "NoydbError";
555
- this.code = code;
556
- }
557
- };
558
- var IndexRequiredError = class extends NoydbError {
559
- collection;
560
- touchedFields;
561
- missingFields;
562
- constructor(args) {
563
- super(
564
- "INDEX_REQUIRED",
565
- `Collection "${args.collection}": query references unindexed fields in lazy mode (missing: ${args.missingFields.join(", ")}). Declare an index on each field, or use collection.scan() for non-indexed iteration.`
566
- );
567
- this.name = "IndexRequiredError";
568
- this.collection = args.collection;
569
- this.touchedFields = [...args.touchedFields];
570
- this.missingFields = [...args.missingFields];
571
- }
572
- };
573
-
574
- // src/indexing/lazy-builder.ts
575
- var EMPTY_PLAN = {
576
- clauses: [],
577
- orderBy: [],
578
- limit: void 0,
579
- offset: 0
580
- };
581
- var LazyQuery = class _LazyQuery {
582
- source;
583
- plan;
584
- constructor(source, plan = EMPTY_PLAN) {
585
- this.source = source;
586
- this.plan = plan;
587
- }
588
- where(field, op, value) {
589
- const clause = { type: "field", field, op, value };
590
- return new _LazyQuery(this.source, {
591
- ...this.plan,
592
- clauses: [...this.plan.clauses, clause]
593
- });
594
- }
595
- orderBy(field, direction = "asc") {
596
- return new _LazyQuery(this.source, {
597
- ...this.plan,
598
- orderBy: [...this.plan.orderBy, { field, direction }]
599
- });
600
- }
601
- limit(n) {
602
- return new _LazyQuery(this.source, { ...this.plan, limit: n });
603
- }
604
- offset(n) {
605
- return new _LazyQuery(this.source, { ...this.plan, offset: n });
606
- }
607
- async toArray() {
608
- await this.source.ensurePersistedIndexesLoaded();
609
- const touchedFields = collectTouchedFields(this.plan);
610
- const missingFields = touchedFields.filter((f) => !isFieldIndexed(f, this.source.persistedIndexes));
611
- if (missingFields.length > 0) {
612
- throw new IndexRequiredError({
613
- collection: this.source.collectionName,
614
- touchedFields,
615
- missingFields
616
- });
617
- }
618
- const candidateIds = this.resolveCandidateIds();
619
- if (candidateIds === null) {
620
- throw new IndexRequiredError({
621
- collection: this.source.collectionName,
622
- touchedFields,
623
- missingFields: touchedFields
624
- });
625
- }
626
- const records = [];
627
- for (const id of candidateIds) {
628
- const record = await this.source.getRecord(id);
629
- if (record === null) continue;
630
- if (!matchesAll(record, this.plan.clauses)) continue;
631
- records.push(record);
632
- }
633
- const sorted = this.plan.orderBy.length > 0 ? sortRecords(records, this.plan.orderBy) : records;
634
- const offset = this.plan.offset > 0 ? this.plan.offset : 0;
635
- const limited = this.plan.limit === void 0 ? sorted.slice(offset) : sorted.slice(offset, offset + this.plan.limit);
636
- return limited;
637
- }
638
- async first() {
639
- const out = await this.limit(1).toArray();
640
- return out.length > 0 ? out[0] : null;
641
- }
642
- async count() {
643
- const out = await this.toArray();
644
- return out.length;
645
- }
646
- /**
647
- * Resolve the candidate record-id set to decrypt. Returns null when the
648
- * query has no usable driver — no `==`/`in` clause and no `orderBy`
649
- * clause that can scope the scan. Callers interpret null as
650
- * IndexRequiredError (see `toArray`).
651
- */
652
- resolveCandidateIds() {
653
- const idx = this.source.persistedIndexes;
654
- const eqMap = /* @__PURE__ */ new Map();
655
- for (const clause of this.plan.clauses) {
656
- if (clause.op === "==") eqMap.set(clause.field, clause.value);
657
- }
658
- if (eqMap.size >= 2) {
659
- for (const def of idx.definitions()) {
660
- if (def.kind !== "composite") continue;
661
- if (def.fields.every((f) => eqMap.has(f))) {
662
- const tuple = def.fields.map((f) => eqMap.get(f));
663
- const ids = idx.lookupEqual(def.key, tuple);
664
- if (ids) return [...ids];
665
- }
666
- }
667
- }
668
- for (const clause of this.plan.clauses) {
669
- if (clause.op === "==") {
670
- const ids = idx.lookupEqual(clause.field, clause.value);
671
- if (ids) return [...ids];
672
- } else if (clause.op === "in" && Array.isArray(clause.value)) {
673
- const ids = idx.lookupIn(clause.field, clause.value);
674
- if (ids) return [...ids];
675
- } else if (isRangeOp(clause.op)) {
676
- const ids = idx.lookupRange(clause.field, clause.op, clause.value);
677
- if (ids) return [...ids];
678
- }
679
- }
680
- if (this.plan.orderBy.length > 0) {
681
- const primary = this.plan.orderBy[0];
682
- const entries = idx.orderedBy(primary.field, primary.direction);
683
- if (entries) return entries.map((e) => e.recordId);
684
- }
685
- return null;
686
- }
687
- };
688
- function isFieldIndexed(field, idx) {
689
- if (idx.has(field)) return true;
690
- for (const def of idx.definitions()) {
691
- if (def.kind === "composite" && def.fields.includes(field)) return true;
692
- }
693
- return false;
694
- }
695
- function isRangeOp(op) {
696
- return op === "<" || op === "<=" || op === ">" || op === ">=" || op === "between";
697
- }
698
- function collectTouchedFields(plan) {
699
- const seen = /* @__PURE__ */ new Set();
700
- for (const c of plan.clauses) seen.add(c.field);
701
- for (const o of plan.orderBy) seen.add(o.field);
702
- return [...seen];
703
- }
704
- function matchesAll(record, clauses) {
705
- for (const c of clauses) {
706
- if (!evaluateClause(record, c)) return false;
707
- }
708
- return true;
709
- }
710
- function sortRecords(records, orderBy) {
711
- return [...records].sort((a, b) => {
712
- for (const { field, direction } of orderBy) {
713
- const av = readPath(a, field);
714
- const bv = readPath(b, field);
715
- const cmp = compareValues(av, bv);
716
- if (cmp !== 0) return direction === "asc" ? cmp : -cmp;
717
- }
718
- return 0;
719
- });
720
- }
721
- function compareValues(a, b) {
722
- if (a === void 0 || a === null) return b === void 0 || b === null ? 0 : 1;
723
- if (b === void 0 || b === null) return -1;
724
- if (typeof a === "number" && typeof b === "number") return a - b;
725
- if (typeof a === "string" && typeof b === "string") return a < b ? -1 : a > b ? 1 : 0;
726
- if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
727
- return 0;
728
- }
729
- // Annotate the CommonJS export names for ESM import in node:
730
- 0 && (module.exports = {
731
- COMPOSITE_DELIMITER,
732
- CollectionIndexes,
733
- IDX_PREFIX,
734
- LazyQuery,
735
- PersistedCollectionIndex,
736
- compositeKey,
737
- decodeIdxId,
738
- encodeIdxId,
739
- isIdxId,
740
- withIndexing
741
- });
742
- //# sourceMappingURL=index.cjs.map