@noy-db/hub 0.1.0-pre.9 → 0.2.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 (288) hide show
  1. package/dist/aggregate/index.cjs +91 -36
  2. package/dist/aggregate/index.cjs.map +1 -1
  3. package/dist/aggregate/index.d.cts +2 -2
  4. package/dist/aggregate/index.d.ts +2 -2
  5. package/dist/aggregate/index.js +16 -9
  6. package/dist/aggregate/index.js.map +1 -1
  7. package/dist/attestation/index.cjs +305 -0
  8. package/dist/attestation/index.cjs.map +1 -0
  9. package/dist/attestation/index.d.cts +52 -0
  10. package/dist/attestation/index.d.ts +52 -0
  11. package/dist/attestation/index.js +36 -0
  12. package/dist/attestation/index.js.map +1 -0
  13. package/dist/blobs/index.cjs.map +1 -1
  14. package/dist/blobs/index.d.cts +7 -6
  15. package/dist/blobs/index.d.ts +7 -6
  16. package/dist/blobs/index.js +10 -8
  17. package/dist/blobs/index.js.map +1 -1
  18. package/dist/bundle/index.cjs +16923 -60
  19. package/dist/bundle/index.cjs.map +1 -1
  20. package/dist/bundle/index.d.cts +175 -6
  21. package/dist/bundle/index.d.ts +175 -6
  22. package/dist/bundle/index.js +543 -4
  23. package/dist/bundle/index.js.map +1 -1
  24. package/dist/{chunk-PTVMYYON.js → chunk-243PNUA6.js} +3 -3
  25. package/dist/{chunk-MR4424N3.js → chunk-2PAQNPE3.js} +2 -2
  26. package/dist/chunk-3QAKZ37R.js +83 -0
  27. package/dist/chunk-3QAKZ37R.js.map +1 -0
  28. package/dist/chunk-3S4BJX25.js +36 -0
  29. package/dist/chunk-3S4BJX25.js.map +1 -0
  30. package/dist/chunk-3XHOCQK4.js +118 -0
  31. package/dist/chunk-3XHOCQK4.js.map +1 -0
  32. package/dist/{chunk-AVVPZ4BC.js → chunk-3Y53S2SA.js} +4 -4
  33. package/dist/chunk-3Z2TPHC4.js +291 -0
  34. package/dist/chunk-3Z2TPHC4.js.map +1 -0
  35. package/dist/chunk-4HIL6AHQ.js +57 -0
  36. package/dist/chunk-4HIL6AHQ.js.map +1 -0
  37. package/dist/chunk-5ZGZ6HIZ.js +100 -0
  38. package/dist/chunk-5ZGZ6HIZ.js.map +1 -0
  39. package/dist/{chunk-ZFKD4QMV.js → chunk-7BRE6EUA.js} +3 -3
  40. package/dist/chunk-7BUTTVMR.js +34 -0
  41. package/dist/chunk-7BUTTVMR.js.map +1 -0
  42. package/dist/{chunk-VQBTTTUN.js → chunk-7Q5PLD5C.js} +4 -4
  43. package/dist/{chunk-VQBTTTUN.js.map → chunk-7Q5PLD5C.js.map} +1 -1
  44. package/dist/{chunk-QAVUREFT.js → chunk-7Z23ZFLV.js} +12 -6
  45. package/dist/chunk-7Z23ZFLV.js.map +1 -0
  46. package/dist/chunk-AHPFONIL.js +59 -0
  47. package/dist/chunk-AHPFONIL.js.map +1 -0
  48. package/dist/chunk-CXSCDO5T.js +51 -0
  49. package/dist/chunk-CXSCDO5T.js.map +1 -0
  50. package/dist/chunk-E535SAN4.js +8834 -0
  51. package/dist/chunk-E535SAN4.js.map +1 -0
  52. package/dist/chunk-EUYOGYGV.js +830 -0
  53. package/dist/chunk-EUYOGYGV.js.map +1 -0
  54. package/dist/chunk-FAQVNJD4.js +61 -0
  55. package/dist/chunk-FAQVNJD4.js.map +1 -0
  56. package/dist/{chunk-SCZXXXU4.js → chunk-G6FRSBKK.js} +7 -32
  57. package/dist/chunk-G6FRSBKK.js.map +1 -0
  58. package/dist/chunk-GIV6DWBG.js +79 -0
  59. package/dist/chunk-GIV6DWBG.js.map +1 -0
  60. package/dist/chunk-HXJXPZRE.js +73 -0
  61. package/dist/chunk-HXJXPZRE.js.map +1 -0
  62. package/dist/{chunk-GOUT6DND.js → chunk-J4KLMEUL.js} +173 -91
  63. package/dist/chunk-J4KLMEUL.js.map +1 -0
  64. package/dist/{chunk-2CSJGFCB.js → chunk-JYQTXEIO.js} +6 -229
  65. package/dist/chunk-JYQTXEIO.js.map +1 -0
  66. package/dist/{chunk-MDDTIZUO.js → chunk-LRAZDV5X.js} +7 -119
  67. package/dist/chunk-LRAZDV5X.js.map +1 -0
  68. package/dist/{chunk-M5INGEFC.js → chunk-MRIBLZL3.js} +3 -1
  69. package/dist/chunk-MRIBLZL3.js.map +1 -0
  70. package/dist/{chunk-USKYUS74.js → chunk-MUWOSVEP.js} +2 -2
  71. package/dist/{chunk-4PWAI7Q4.js → chunk-NWZ3I6R6.js} +5 -5
  72. package/dist/chunk-OVZDFEOR.js +124 -0
  73. package/dist/chunk-OVZDFEOR.js.map +1 -0
  74. package/dist/chunk-PEULZC6M.js +118 -0
  75. package/dist/chunk-PEULZC6M.js.map +1 -0
  76. package/dist/chunk-PFSNOPBQ.js +233 -0
  77. package/dist/chunk-PFSNOPBQ.js.map +1 -0
  78. package/dist/chunk-PLI5TV7N.js +53 -0
  79. package/dist/chunk-PLI5TV7N.js.map +1 -0
  80. package/dist/{chunk-WDM5XGGS.js → chunk-Q6W2CMEJ.js} +181 -11
  81. package/dist/chunk-Q6W2CMEJ.js.map +1 -0
  82. package/dist/{chunk-QGZRWRSL.js → chunk-QPEXPHJR.js} +4 -4
  83. package/dist/{chunk-R36SIKES.js → chunk-QXQRKXCU.js} +2 -2
  84. package/dist/chunk-RTZVQAJ7.js +82 -0
  85. package/dist/chunk-RTZVQAJ7.js.map +1 -0
  86. package/dist/chunk-TBKOGSYR.js +296 -0
  87. package/dist/chunk-TBKOGSYR.js.map +1 -0
  88. package/dist/chunk-UMLVJTYV.js +20 -0
  89. package/dist/chunk-UMLVJTYV.js.map +1 -0
  90. package/dist/chunk-UND4XIB6.js +251 -0
  91. package/dist/chunk-UND4XIB6.js.map +1 -0
  92. package/dist/chunk-VCGTOS2A.js +795 -0
  93. package/dist/chunk-VCGTOS2A.js.map +1 -0
  94. package/dist/chunk-VE6YVP32.js +19 -0
  95. package/dist/chunk-VE6YVP32.js.map +1 -0
  96. package/dist/{chunk-M62XNWRA.js → chunk-VK5EER6C.js} +2 -2
  97. package/dist/{chunk-NXFEYLVG.js → chunk-VPSUZLOJ.js} +4 -3
  98. package/dist/{chunk-NXFEYLVG.js.map → chunk-VPSUZLOJ.js.map} +1 -1
  99. package/dist/{chunk-TDR6T5CJ.js → chunk-VRBCTEKQ.js} +91 -132
  100. package/dist/chunk-VRBCTEKQ.js.map +1 -0
  101. package/dist/{chunk-ACLDOTNQ.js → chunk-W3XXT26A.js} +303 -3
  102. package/dist/chunk-W3XXT26A.js.map +1 -0
  103. package/dist/{chunk-CIMZBAZB.js → chunk-XG3PTSCD.js} +1 -1
  104. package/dist/chunk-XG3PTSCD.js.map +1 -0
  105. package/dist/chunk-Y2RKOPNC.js +145 -0
  106. package/dist/chunk-Y2RKOPNC.js.map +1 -0
  107. package/dist/{chunk-NPC4LFV5.js → chunk-YMYK7US4.js} +2 -2
  108. package/dist/{chunk-RKJ6OL7K.js → chunk-YS3POABP.js} +1 -1
  109. package/dist/chunk-YS3POABP.js.map +1 -0
  110. package/dist/chunk-YTXSFG3C.js +179 -0
  111. package/dist/chunk-YTXSFG3C.js.map +1 -0
  112. package/dist/consent/index.cjs.map +1 -1
  113. package/dist/consent/index.d.cts +7 -6
  114. package/dist/consent/index.d.ts +7 -6
  115. package/dist/consent/index.js +3 -3
  116. package/dist/{crypto-IVKU7YTT.js → crypto-5ZDIY3NG.js} +3 -3
  117. package/dist/{delegation-2DBS2EOH.js → delegation-QYXZW25W.js} +5 -4
  118. package/dist/derivations/index.cjs +351 -0
  119. package/dist/derivations/index.cjs.map +1 -0
  120. package/dist/derivations/index.d.cts +72 -0
  121. package/dist/derivations/index.d.ts +72 -0
  122. package/dist/derivations/index.js +27 -0
  123. package/dist/{dev-unlock-Da1B0TIK.d.cts → dev-unlock-DQCNDfFp.d.cts} +1 -1
  124. package/dist/{dev-unlock-BdPp68qn.d.ts → dev-unlock-utkybTKb.d.ts} +1 -1
  125. package/dist/executor-AS2IDHKZ.js +11 -0
  126. package/dist/executor-HLXFXNFM.js +8 -0
  127. package/dist/executor-HLXFXNFM.js.map +1 -0
  128. package/dist/executor-HN6YBHZ5.js +8 -0
  129. package/dist/executor-HN6YBHZ5.js.map +1 -0
  130. package/dist/fanout-sidecar-VJ52RIEY.js +51 -0
  131. package/dist/fanout-sidecar-VJ52RIEY.js.map +1 -0
  132. package/dist/guards/index.cjs +315 -0
  133. package/dist/guards/index.cjs.map +1 -0
  134. package/dist/guards/index.d.cts +31 -0
  135. package/dist/guards/index.d.ts +31 -0
  136. package/dist/guards/index.js +29 -0
  137. package/dist/guards/index.js.map +1 -0
  138. package/dist/{hash-lsoL3eEW.d.ts → hash-DcoYWfJ_.d.ts} +1 -1
  139. package/dist/{hash-BEfzPKwo.d.cts → hash-jDowCrK2.d.cts} +1 -1
  140. package/dist/history/index.cjs +8 -1
  141. package/dist/history/index.cjs.map +1 -1
  142. package/dist/history/index.d.cts +8 -7
  143. package/dist/history/index.d.ts +8 -7
  144. package/dist/history/index.js +6 -6
  145. package/dist/i18n/index.cjs +81 -0
  146. package/dist/i18n/index.cjs.map +1 -1
  147. package/dist/i18n/index.d.cts +7 -6
  148. package/dist/i18n/index.d.ts +7 -6
  149. package/dist/i18n/index.js +27 -12
  150. package/dist/i18n/index.js.map +1 -1
  151. package/dist/{index-6xNpPsxR.d.cts → index-BCKdioeh.d.ts} +331 -5
  152. package/dist/{index-DJTf9yxn.d.ts → index-BMjrzNZr.d.cts} +331 -5
  153. package/dist/index.cjs +6065 -959
  154. package/dist/index.cjs.map +1 -1
  155. package/dist/index.d.cts +208 -16
  156. package/dist/index.d.ts +208 -16
  157. package/dist/index.js +242 -7392
  158. package/dist/index.js.map +1 -1
  159. package/dist/indexing/index.cjs +2 -0
  160. package/dist/indexing/index.cjs.map +1 -1
  161. package/dist/indexing/index.d.cts +3 -3
  162. package/dist/indexing/index.d.ts +3 -3
  163. package/dist/indexing/index.js +4 -4
  164. package/dist/issue-ORP37MVW.js +12 -0
  165. package/dist/issue-ORP37MVW.js.map +1 -0
  166. package/dist/{lazy-builder-CZVLKh0Z.d.cts → lazy-builder-C-rPfWG0.d.cts} +1 -1
  167. package/dist/{lazy-builder-BwEoBQZ9.d.ts → lazy-builder-Rpd-V3jP.d.ts} +1 -1
  168. package/dist/{ledger-QZTTHQAQ.js → ledger-3IU5GMXA.js} +6 -6
  169. package/dist/ledger-3IU5GMXA.js.map +1 -0
  170. package/dist/materialized-views/index.cjs +837 -0
  171. package/dist/materialized-views/index.cjs.map +1 -0
  172. package/dist/materialized-views/index.d.cts +184 -0
  173. package/dist/materialized-views/index.d.ts +184 -0
  174. package/dist/materialized-views/index.js +45 -0
  175. package/dist/materialized-views/index.js.map +1 -0
  176. package/dist/noydb-5H3C24GG.js +34 -0
  177. package/dist/noydb-5H3C24GG.js.map +1 -0
  178. package/dist/overlay-views/index.cjs +359 -0
  179. package/dist/overlay-views/index.cjs.map +1 -0
  180. package/dist/overlay-views/index.d.cts +82 -0
  181. package/dist/overlay-views/index.d.ts +82 -0
  182. package/dist/overlay-views/index.js +25 -0
  183. package/dist/overlay-views/index.js.map +1 -0
  184. package/dist/periods/index.cjs +7 -1
  185. package/dist/periods/index.cjs.map +1 -1
  186. package/dist/periods/index.d.cts +7 -6
  187. package/dist/periods/index.d.ts +7 -6
  188. package/dist/periods/index.js +6 -6
  189. package/dist/{predicate-SBHmi6D0.d.cts → predicate-Dnu81tsS.d.cts} +25 -1
  190. package/dist/{predicate-SBHmi6D0.d.ts → predicate-Dnu81tsS.d.ts} +25 -1
  191. package/dist/{public-envelope-6JTACYJV.js → public-envelope-U3CMEOMV.js} +4 -4
  192. package/dist/public-envelope-U3CMEOMV.js.map +1 -0
  193. package/dist/query/index.cjs +302 -124
  194. package/dist/query/index.cjs.map +1 -1
  195. package/dist/query/index.d.cts +3 -3
  196. package/dist/query/index.d.ts +3 -3
  197. package/dist/query/index.js +26 -11
  198. package/dist/read-only-facade-ITU6L7BL.js +7 -0
  199. package/dist/read-only-facade-ITU6L7BL.js.map +1 -0
  200. package/dist/registry-3ALP62P6.js +10 -0
  201. package/dist/registry-3ALP62P6.js.map +1 -0
  202. package/dist/registry-7HE6VJGC.js +8 -0
  203. package/dist/registry-7HE6VJGC.js.map +1 -0
  204. package/dist/registry-PSIPG2QR.js +8 -0
  205. package/dist/registry-PSIPG2QR.js.map +1 -0
  206. package/dist/registry-RFGGMVNJ.js +7 -0
  207. package/dist/registry-RFGGMVNJ.js.map +1 -0
  208. package/dist/revoke-KY2GB4KP.js +17 -0
  209. package/dist/revoke-KY2GB4KP.js.map +1 -0
  210. package/dist/session/index.cjs +7 -1
  211. package/dist/session/index.cjs.map +1 -1
  212. package/dist/session/index.d.cts +8 -7
  213. package/dist/session/index.d.ts +8 -7
  214. package/dist/session/index.js +10 -3
  215. package/dist/session/index.js.map +1 -1
  216. package/dist/shadow/index.cjs.map +1 -1
  217. package/dist/shadow/index.d.cts +7 -6
  218. package/dist/shadow/index.d.ts +7 -6
  219. package/dist/shadow/index.js +2 -2
  220. package/dist/signer-GRI5TZKH.js +18 -0
  221. package/dist/signer-GRI5TZKH.js.map +1 -0
  222. package/dist/stale-OTOF3FH7.js +13 -0
  223. package/dist/stale-OTOF3FH7.js.map +1 -0
  224. package/dist/store/index.cjs +14 -0
  225. package/dist/store/index.cjs.map +1 -1
  226. package/dist/store/index.d.cts +7 -6
  227. package/dist/store/index.d.ts +7 -6
  228. package/dist/store/index.js +5 -2
  229. package/dist/{strategy-D-SrOLCl.d.cts → strategy-DSTrsZ8t.d.cts} +72 -19
  230. package/dist/{strategy-D-SrOLCl.d.ts → strategy-DSTrsZ8t.d.ts} +72 -19
  231. package/dist/sync/index.cjs.map +1 -1
  232. package/dist/sync/index.d.cts +6 -5
  233. package/dist/sync/index.d.ts +6 -5
  234. package/dist/sync/index.js +4 -4
  235. package/dist/team/index.cjs +1554 -2
  236. package/dist/team/index.cjs.map +1 -1
  237. package/dist/team/index.d.cts +7 -6
  238. package/dist/team/index.d.ts +7 -6
  239. package/dist/team/index.js +77 -8
  240. package/dist/tx/index.cjs +296 -44
  241. package/dist/tx/index.cjs.map +1 -1
  242. package/dist/tx/index.d.cts +7 -6
  243. package/dist/tx/index.d.ts +7 -6
  244. package/dist/tx/index.js +2 -2
  245. package/dist/{types-Bo7NSXJr.d.ts → types-BoFFiskX.d.ts} +2714 -321
  246. package/dist/{types-Bnb82f5R.d.cts → types-DJG8HG6F.d.cts} +2714 -321
  247. package/dist/{index-CywCC1qZ.d.cts → ulid-BmBgooGm.d.ts} +215 -26
  248. package/dist/{index-8QDuznDr.d.ts → ulid-C7ms9oli.d.cts} +215 -26
  249. package/dist/util/index.cjs.map +1 -1
  250. package/dist/util/index.js +1 -1
  251. package/dist/with-derivation-BKXXa8Vt.d.ts +13 -0
  252. package/dist/with-derivation-BjQ7q4NE.d.cts +13 -0
  253. package/dist/with-guard-C25yNjzd.d.ts +18 -0
  254. package/dist/with-guard-DQme5DKE.d.cts +18 -0
  255. package/dist/with-materialized-view-BbEPFIIJ.d.cts +27 -0
  256. package/dist/with-materialized-view-CqnRwI2S.d.ts +27 -0
  257. package/dist/with-overlayed-view-Ct1fSJt-.d.ts +13 -0
  258. package/dist/with-overlayed-view-bwlmmFjx.d.cts +13 -0
  259. package/package.json +65 -2
  260. package/dist/chunk-2CSJGFCB.js.map +0 -1
  261. package/dist/chunk-ACLDOTNQ.js.map +0 -1
  262. package/dist/chunk-BTDCBVJW.js +0 -160
  263. package/dist/chunk-BTDCBVJW.js.map +0 -1
  264. package/dist/chunk-CIMZBAZB.js.map +0 -1
  265. package/dist/chunk-EXHNQEV4.js +0 -392
  266. package/dist/chunk-EXHNQEV4.js.map +0 -1
  267. package/dist/chunk-GOUT6DND.js.map +0 -1
  268. package/dist/chunk-M5INGEFC.js.map +0 -1
  269. package/dist/chunk-MDDTIZUO.js.map +0 -1
  270. package/dist/chunk-QAVUREFT.js.map +0 -1
  271. package/dist/chunk-RKJ6OL7K.js.map +0 -1
  272. package/dist/chunk-SCZXXXU4.js.map +0 -1
  273. package/dist/chunk-TDR6T5CJ.js.map +0 -1
  274. package/dist/chunk-WDM5XGGS.js.map +0 -1
  275. /package/dist/{chunk-PTVMYYON.js.map → chunk-243PNUA6.js.map} +0 -0
  276. /package/dist/{chunk-MR4424N3.js.map → chunk-2PAQNPE3.js.map} +0 -0
  277. /package/dist/{chunk-AVVPZ4BC.js.map → chunk-3Y53S2SA.js.map} +0 -0
  278. /package/dist/{chunk-ZFKD4QMV.js.map → chunk-7BRE6EUA.js.map} +0 -0
  279. /package/dist/{chunk-USKYUS74.js.map → chunk-MUWOSVEP.js.map} +0 -0
  280. /package/dist/{chunk-4PWAI7Q4.js.map → chunk-NWZ3I6R6.js.map} +0 -0
  281. /package/dist/{chunk-QGZRWRSL.js.map → chunk-QPEXPHJR.js.map} +0 -0
  282. /package/dist/{chunk-R36SIKES.js.map → chunk-QXQRKXCU.js.map} +0 -0
  283. /package/dist/{chunk-M62XNWRA.js.map → chunk-VK5EER6C.js.map} +0 -0
  284. /package/dist/{chunk-NPC4LFV5.js.map → chunk-YMYK7US4.js.map} +0 -0
  285. /package/dist/{crypto-IVKU7YTT.js.map → crypto-5ZDIY3NG.js.map} +0 -0
  286. /package/dist/{delegation-2DBS2EOH.js.map → delegation-QYXZW25W.js.map} +0 -0
  287. /package/dist/{ledger-QZTTHQAQ.js.map → derivations/index.js.map} +0 -0
  288. /package/dist/{public-envelope-6JTACYJV.js.map → executor-AS2IDHKZ.js.map} +0 -0
@@ -1,10 +1,11 @@
1
- import { at as NoydbStore, ar as UnlockedKeyring } from '../types-Bnb82f5R.cjs';
2
- export { c3 as PresenceHandle, cF as SyncEngine, cN as SyncTransaction, df as evaluateExportCapability, dg as evaluateImportCapability, di as hasExportCapability, dj as hasImportCapability } from '../types-Bnb82f5R.cjs';
3
- import '../lazy-builder-CZVLKh0Z.cjs';
4
- import '../predicate-SBHmi6D0.cjs';
5
- import '../strategy-D-SrOLCl.cjs';
1
+ import { aO as NoydbStore, aM as UnlockedKeyring } from '../types-DJG8HG6F.cjs';
2
+ export { bc as BundleRecipient, bW as EnrollAuthenticatorOptions, bX as EnrollAuthenticatorWrappingDEKsOptions, bY as EnrollAuthenticatorWrappingKEKOptions, cn as ListUsersOptions, cM as PaperRecoveryEntry, cU as PresenceHandle, dd as RecoverPassphraseInput, de as RecoverPassphraseResult, df as RecoverUserOptions, dg as RecoveryProof, dj as RotatePassphraseInput, du as SlotRewrapCeremony, dv as SlotRewrapContext, dC as SyncEngine, dK as SyncTransaction, dS as UpdateAuthenticatorOptions, e4 as WrappedDeksBlob, e6 as buildRecipientKeyringFile, e7 as burnPaperRecoveryEntry, eS as changeSecret, eT as createOwnerKeyring, ea as deriveMagicLinkContentKey, eb as enrollAuthenticator, eU as ensureCollectionDEK, ed as evaluateExportCapability, ee as evaluateImportCapability, ef as findAuthenticator, eV as grant, eg as hasExportCapability, eh as hasImportCapability, ej as isMagicLinkGrantExpired, eo as listMagicLinkGrants, ep as listUsers, eq as listUsersWithEnvelopes, eW as loadKeyring, es as loadPaperRecoveryEntries, ev as magicLinkGrantRecordId, ew as mintPaperRecoveryEntry, ey as mintWrappedDeksBlob, eX as persistKeyring, eA as readMagicLinkGrantRecord, em as recoverPassphrase, eB as recoverUser, eC as removeAuthenticator, eY as revoke, eF as revokeMagicLinkGrant, en as rotatePassphrase, eG as savePaperRecoveryEntries, eJ as unwrapDeksFromBlob, eK as unwrapDeksFromPaperEntry, eM as unwrapMagicLinkGrant, eZ as updateAuthenticator, e_ as updateKeyringIdentity, eR as writeMagicLinkGrant } from '../types-DJG8HG6F.cjs';
3
+ import '../lazy-builder-C-rPfWG0.cjs';
4
+ import '../predicate-Dnu81tsS.cjs';
5
+ import '../strategy-DSTrsZ8t.cjs';
6
6
  import '../strategy-BSxFXGzb.cjs';
7
- import '../index-6xNpPsxR.cjs';
7
+ import '../index-BMjrzNZr.cjs';
8
+ import '@noy-db/attestation';
8
9
 
9
10
  /**
10
11
  * _sync_credentials reserved collection —
@@ -1,10 +1,11 @@
1
- import { at as NoydbStore, ar as UnlockedKeyring } from '../types-Bo7NSXJr.js';
2
- export { c3 as PresenceHandle, cF as SyncEngine, cN as SyncTransaction, df as evaluateExportCapability, dg as evaluateImportCapability, di as hasExportCapability, dj as hasImportCapability } from '../types-Bo7NSXJr.js';
3
- import '../lazy-builder-BwEoBQZ9.js';
4
- import '../predicate-SBHmi6D0.js';
5
- import '../strategy-D-SrOLCl.js';
1
+ import { aO as NoydbStore, aM as UnlockedKeyring } from '../types-BoFFiskX.js';
2
+ export { bc as BundleRecipient, bW as EnrollAuthenticatorOptions, bX as EnrollAuthenticatorWrappingDEKsOptions, bY as EnrollAuthenticatorWrappingKEKOptions, cn as ListUsersOptions, cM as PaperRecoveryEntry, cU as PresenceHandle, dd as RecoverPassphraseInput, de as RecoverPassphraseResult, df as RecoverUserOptions, dg as RecoveryProof, dj as RotatePassphraseInput, du as SlotRewrapCeremony, dv as SlotRewrapContext, dC as SyncEngine, dK as SyncTransaction, dS as UpdateAuthenticatorOptions, e4 as WrappedDeksBlob, e6 as buildRecipientKeyringFile, e7 as burnPaperRecoveryEntry, eS as changeSecret, eT as createOwnerKeyring, ea as deriveMagicLinkContentKey, eb as enrollAuthenticator, eU as ensureCollectionDEK, ed as evaluateExportCapability, ee as evaluateImportCapability, ef as findAuthenticator, eV as grant, eg as hasExportCapability, eh as hasImportCapability, ej as isMagicLinkGrantExpired, eo as listMagicLinkGrants, ep as listUsers, eq as listUsersWithEnvelopes, eW as loadKeyring, es as loadPaperRecoveryEntries, ev as magicLinkGrantRecordId, ew as mintPaperRecoveryEntry, ey as mintWrappedDeksBlob, eX as persistKeyring, eA as readMagicLinkGrantRecord, em as recoverPassphrase, eB as recoverUser, eC as removeAuthenticator, eY as revoke, eF as revokeMagicLinkGrant, en as rotatePassphrase, eG as savePaperRecoveryEntries, eJ as unwrapDeksFromBlob, eK as unwrapDeksFromPaperEntry, eM as unwrapMagicLinkGrant, eZ as updateAuthenticator, e_ as updateKeyringIdentity, eR as writeMagicLinkGrant } from '../types-BoFFiskX.js';
3
+ import '../lazy-builder-Rpd-V3jP.js';
4
+ import '../predicate-Dnu81tsS.js';
5
+ import '../strategy-DSTrsZ8t.js';
6
6
  import '../strategy-BSxFXGzb.js';
7
- import '../index-DJTf9yxn.js';
7
+ import '../index-BCKdioeh.js';
8
+ import '@noy-db/attestation';
8
9
 
9
10
  /**
10
11
  * _sync_credentials reserved collection —
@@ -5,35 +5,104 @@ import {
5
5
  getCredential,
6
6
  listCredentials,
7
7
  putCredential
8
- } from "../chunk-4PWAI7Q4.js";
8
+ } from "../chunk-NWZ3I6R6.js";
9
+ import {
10
+ burnPaperRecoveryEntry,
11
+ deriveMagicLinkContentKey,
12
+ enrollAuthenticator,
13
+ findAuthenticator,
14
+ isMagicLinkGrantExpired,
15
+ listMagicLinkGrants,
16
+ loadPaperRecoveryEntries,
17
+ magicLinkGrantRecordId,
18
+ mintPaperRecoveryEntry,
19
+ mintWrappedDeksBlob,
20
+ readMagicLinkGrantRecord,
21
+ recoverPassphrase,
22
+ recoverUser,
23
+ removeAuthenticator,
24
+ revokeMagicLinkGrant,
25
+ rotatePassphrase,
26
+ savePaperRecoveryEntries,
27
+ unwrapDeksFromBlob,
28
+ unwrapDeksFromPaperEntry,
29
+ unwrapMagicLinkGrant,
30
+ updateAuthenticator,
31
+ writeMagicLinkGrant
32
+ } from "../chunk-EUYOGYGV.js";
33
+ import "../chunk-7BUTTVMR.js";
9
34
  import {
10
35
  PresenceHandle,
11
36
  SyncEngine,
12
37
  SyncTransaction
13
- } from "../chunk-AVVPZ4BC.js";
38
+ } from "../chunk-3Y53S2SA.js";
14
39
  import {
40
+ buildRecipientKeyringFile,
41
+ changeSecret,
42
+ createOwnerKeyring,
43
+ ensureCollectionDEK,
15
44
  evaluateExportCapability,
16
45
  evaluateImportCapability,
46
+ grant,
17
47
  hasExportCapability,
18
- hasImportCapability
19
- } from "../chunk-WDM5XGGS.js";
48
+ hasImportCapability,
49
+ listUsers,
50
+ listUsersWithEnvelopes,
51
+ loadKeyring,
52
+ persistKeyring,
53
+ revoke,
54
+ updateKeyringIdentity
55
+ } from "../chunk-Q6W2CMEJ.js";
20
56
  import "../chunk-2QR2PQTT.js";
21
- import "../chunk-RKJ6OL7K.js";
22
- import "../chunk-MR4424N3.js";
23
- import "../chunk-ACLDOTNQ.js";
57
+ import "../chunk-YS3POABP.js";
58
+ import "../chunk-2PAQNPE3.js";
59
+ import "../chunk-W3XXT26A.js";
24
60
  export {
25
61
  PresenceHandle,
26
62
  SYNC_CREDENTIALS_COLLECTION,
27
63
  SyncEngine,
28
64
  SyncTransaction,
65
+ buildRecipientKeyringFile,
66
+ burnPaperRecoveryEntry,
67
+ changeSecret,
68
+ createOwnerKeyring,
29
69
  credentialStatus,
30
70
  deleteCredential,
71
+ deriveMagicLinkContentKey,
72
+ enrollAuthenticator,
73
+ ensureCollectionDEK,
31
74
  evaluateExportCapability,
32
75
  evaluateImportCapability,
76
+ findAuthenticator,
33
77
  getCredential,
78
+ grant,
34
79
  hasExportCapability,
35
80
  hasImportCapability,
81
+ isMagicLinkGrantExpired,
36
82
  listCredentials,
37
- putCredential
83
+ listMagicLinkGrants,
84
+ listUsers,
85
+ listUsersWithEnvelopes,
86
+ loadKeyring,
87
+ loadPaperRecoveryEntries,
88
+ magicLinkGrantRecordId,
89
+ mintPaperRecoveryEntry,
90
+ mintWrappedDeksBlob,
91
+ persistKeyring,
92
+ putCredential,
93
+ readMagicLinkGrantRecord,
94
+ recoverPassphrase,
95
+ recoverUser,
96
+ removeAuthenticator,
97
+ revoke,
98
+ revokeMagicLinkGrant,
99
+ rotatePassphrase,
100
+ savePaperRecoveryEntries,
101
+ unwrapDeksFromBlob,
102
+ unwrapDeksFromPaperEntry,
103
+ unwrapMagicLinkGrant,
104
+ updateAuthenticator,
105
+ updateKeyringIdentity,
106
+ writeMagicLinkGrant
38
107
  };
39
108
  //# sourceMappingURL=index.js.map
package/dist/tx/index.cjs CHANGED
@@ -3,6 +3,9 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __esm = (fn, res) => function __init() {
7
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ };
6
9
  var __export = (target, all) => {
7
10
  for (var name in all)
8
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,6 +20,147 @@ var __copyProps = (to, from, except, desc) => {
17
20
  };
18
21
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
22
 
23
+ // src/errors.ts
24
+ var NoydbError, FieldFrozenError, InvariantError, AmendmentForbiddenError, ConflictError, ValidationError;
25
+ var init_errors = __esm({
26
+ "src/errors.ts"() {
27
+ "use strict";
28
+ NoydbError = class extends Error {
29
+ /** Machine-readable error code. Stable across library versions. */
30
+ code;
31
+ constructor(code, message) {
32
+ super(message);
33
+ this.name = "NoydbError";
34
+ this.code = code;
35
+ }
36
+ };
37
+ FieldFrozenError = class extends NoydbError {
38
+ collection;
39
+ id;
40
+ fields;
41
+ constructor(collection, id, fields) {
42
+ super(
43
+ "FIELD_FROZEN",
44
+ `Cannot change frozen field(s) on ${collection}/${id}: ${fields.join(", ")}. Use withTransactions({ amendment: true, reason }) with admin/owner role to override.`
45
+ );
46
+ this.name = "FieldFrozenError";
47
+ this.collection = collection;
48
+ this.id = id;
49
+ this.fields = fields;
50
+ }
51
+ };
52
+ InvariantError = class extends NoydbError {
53
+ constructor(message) {
54
+ super("INVARIANT_VIOLATED", message);
55
+ this.name = "InvariantError";
56
+ }
57
+ };
58
+ AmendmentForbiddenError = class extends NoydbError {
59
+ userId;
60
+ role;
61
+ constructor(userId, role) {
62
+ super(
63
+ "AMENDMENT_FORBIDDEN",
64
+ `User "${userId}" with role "${role}" cannot open an amendment transaction. Amendments require admin or owner role.`
65
+ );
66
+ this.name = "AmendmentForbiddenError";
67
+ this.userId = userId;
68
+ this.role = role;
69
+ }
70
+ };
71
+ ConflictError = class extends NoydbError {
72
+ /** The actual stored version at the time of conflict. */
73
+ version;
74
+ constructor(version, message = "Version conflict") {
75
+ super("CONFLICT", message);
76
+ this.name = "ConflictError";
77
+ this.version = version;
78
+ }
79
+ };
80
+ ValidationError = class extends NoydbError {
81
+ constructor(message = "Validation error") {
82
+ super("VALIDATION_ERROR", message);
83
+ this.name = "ValidationError";
84
+ }
85
+ };
86
+ }
87
+ });
88
+
89
+ // src/guards/executor.ts
90
+ var executor_exports = {};
91
+ __export(executor_exports, {
92
+ GuardExecutor: () => GuardExecutor
93
+ });
94
+ function deepEqual(a, b) {
95
+ if (a === b) return true;
96
+ if (a === null || b === null) return a === b;
97
+ if (typeof a !== typeof b) return false;
98
+ if (typeof a !== "object") return a === b;
99
+ if (Array.isArray(a) !== Array.isArray(b)) return false;
100
+ if (Array.isArray(a)) {
101
+ const aa = a;
102
+ const bb = b;
103
+ if (aa.length !== bb.length) return false;
104
+ for (let i = 0; i < aa.length; i++) if (!deepEqual(aa[i], bb[i])) return false;
105
+ return true;
106
+ }
107
+ const ao = a;
108
+ const bo = b;
109
+ const ak = Object.keys(ao);
110
+ const bk = Object.keys(bo);
111
+ if (ak.length !== bk.length) return false;
112
+ for (const k of ak) {
113
+ if (!Object.prototype.hasOwnProperty.call(bo, k)) return false;
114
+ if (!deepEqual(ao[k], bo[k])) return false;
115
+ }
116
+ return true;
117
+ }
118
+ var GuardExecutor;
119
+ var init_executor = __esm({
120
+ "src/guards/executor.ts"() {
121
+ "use strict";
122
+ init_errors();
123
+ GuardExecutor = {
124
+ /**
125
+ * Compare existing vs incoming for each `frozenFields.fields` entry
126
+ * when `frozenFields.when(existing)` is true. Throws
127
+ * `FieldFrozenError` listing every changed frozen field.
128
+ */
129
+ async checkFrozenFields(guard, id, existing, incoming) {
130
+ const ff = guard.frozenFields;
131
+ if (!ff) return;
132
+ if (existing === null) return;
133
+ if (!ff.when(existing)) return;
134
+ const changed = [];
135
+ for (const f of ff.fields) {
136
+ if (existing[f] !== incoming[f]) {
137
+ if (!deepEqual(existing[f], incoming[f])) changed.push(String(f));
138
+ }
139
+ }
140
+ if (changed.length > 0) {
141
+ throw new FieldFrozenError(guard.collection, id, changed);
142
+ }
143
+ },
144
+ /**
145
+ * Run a single guard's invariant over its slice of the change-set.
146
+ * Any throw is converted to `InvariantError` unless it already is one.
147
+ */
148
+ async runInvariant(guard, changes, ctx) {
149
+ const amendment = guard.amendment;
150
+ if (!amendment) return;
151
+ try {
152
+ await amendment.invariant(changes, ctx);
153
+ } catch (err) {
154
+ if (err instanceof InvariantError) throw err;
155
+ throw new InvariantError(
156
+ err instanceof Error ? err.message : `invariant violated: ${String(err)}`
157
+ );
158
+ }
159
+ }
160
+ };
161
+ }
162
+ });
163
+
20
164
  // src/tx/index.ts
21
165
  var tx_exports = {};
22
166
  __export(tx_exports, {
@@ -28,39 +172,52 @@ __export(tx_exports, {
28
172
  });
29
173
  module.exports = __toCommonJS(tx_exports);
30
174
 
31
- // src/errors.ts
32
- var NoydbError = class extends Error {
33
- /** Machine-readable error code. Stable across library versions. */
34
- code;
35
- constructor(code, message) {
36
- super(message);
37
- this.name = "NoydbError";
38
- this.code = code;
39
- }
40
- };
41
- var ConflictError = class extends NoydbError {
42
- /** The actual stored version at the time of conflict. */
43
- version;
44
- constructor(version, message = "Version conflict") {
45
- super("CONFLICT", message);
46
- this.name = "ConflictError";
47
- this.version = version;
48
- }
49
- };
50
-
51
175
  // src/tx/transaction.ts
176
+ init_errors();
52
177
  var TxContext = class {
53
178
  /** @internal */
54
179
  _ops = [];
180
+ /**
181
+ * @internal — write log built up in Phase 2. Each entry records the
182
+ * envelope captured BEFORE the write so a mid-batch failure can
183
+ * restore prior state via `revertExecuted`. Side-effect writes (e.g.
184
+ * recursive derivation outputs fired inside `Collection.put`) are
185
+ * appended here in execution order so they roll back alongside the
186
+ * main staged ops (#133).
187
+ */
188
+ _executed = [];
55
189
  /** @internal */
56
190
  _db;
191
+ /**
192
+ * @internal — true when this TxContext was opened in amendment
193
+ * mode. Toggles the lazy-`beginAmendment` + role-check path on first
194
+ * `tx.vault(name)` and unlocks the post-Phase-2 invariant + audit run.
195
+ */
196
+ _amendment;
197
+ /** @internal — vaults that have already had `beginAmendment` called. */
198
+ _amendmentVaults = /* @__PURE__ */ new Map();
57
199
  /** @internal */
58
- constructor(db) {
200
+ constructor(db, amendment = false) {
59
201
  this._db = db;
202
+ this._amendment = amendment;
60
203
  }
61
204
  /** Scope subsequent `collection()` calls to the named vault. */
62
205
  vault(name) {
63
206
  const v = this._db.vault(name);
207
+ if (this._amendment && !this._amendmentVaults.has(name)) {
208
+ const role = v.role;
209
+ if (role !== "admin" && role !== "owner") {
210
+ throw new AmendmentForbiddenError(v.userId, role);
211
+ }
212
+ const reg = v._getGuardRegistry();
213
+ if (reg === null) {
214
+ throw new ValidationError(
215
+ `Vault "${name}": amendment mode requires at least one guardStrategy registered via createNoydb({ guardStrategies }). Open the vault with guardStrategies before calling db.transaction({ amendment: true }).`
216
+ );
217
+ }
218
+ reg.beginAmendment();
219
+ this._amendmentVaults.set(name, v);
220
+ }
64
221
  return new TxVault(this, v);
65
222
  }
66
223
  };
@@ -124,6 +281,7 @@ var TxCollection = class {
124
281
  record
125
282
  };
126
283
  if (options?.expectedVersion !== void 0) op.expectedVersion = options.expectedVersion;
284
+ if (options?.reason !== void 0) op.reason = options.reason;
127
285
  this._ctx._ops.push(op);
128
286
  }
129
287
  /**
@@ -142,10 +300,28 @@ var TxCollection = class {
142
300
  this._ctx._ops.push(op);
143
301
  }
144
302
  };
145
- async function runTransaction(db, fn) {
146
- const ctx = new TxContext(db);
303
+ async function runTransaction(db, fn, options) {
304
+ if (options?.amendment) {
305
+ if (typeof options.reason !== "string" || options.reason.trim().length === 0) {
306
+ throw new ValidationError(
307
+ "db.transaction({ amendment: true }) requires a non-empty `reason` string."
308
+ );
309
+ }
310
+ }
311
+ const ctx = new TxContext(db, options?.amendment === true);
147
312
  const bodyResult = await fn(ctx);
148
- if (ctx._ops.length === 0) return bodyResult;
313
+ if (ctx._ops.length === 0) {
314
+ if (ctx._amendment) {
315
+ for (const v of ctx._amendmentVaults.values()) {
316
+ const reg = v._getGuardRegistry();
317
+ if (reg !== null) {
318
+ reg.consumeChanges();
319
+ reg.consumeMeta();
320
+ }
321
+ }
322
+ }
323
+ return bodyResult;
324
+ }
149
325
  const priorEnvelopes = /* @__PURE__ */ new Map();
150
326
  const store = db._store;
151
327
  for (const op of ctx._ops) {
@@ -165,32 +341,108 @@ async function runTransaction(db, fn) {
165
341
  }
166
342
  }
167
343
  }
168
- const executed = [];
344
+ db._setActiveTxContext(ctx);
169
345
  try {
170
- for (const op of ctx._ops) {
171
- const coll = db.vault(op.vaultName).collection(op.collectionName);
172
- const key = keyOf(op);
173
- const prior = priorEnvelopes.get(key) ?? null;
174
- if (op.type === "put") {
175
- await coll.put(op.id, op.record);
176
- } else {
177
- await coll.delete(op.id);
346
+ try {
347
+ for (const op of ctx._ops) {
348
+ const coll = db.vault(op.vaultName).collection(op.collectionName);
349
+ const key = keyOf(op);
350
+ const prior = priorEnvelopes.get(key) ?? null;
351
+ ctx._executed.push({ op, priorEnvelope: prior });
352
+ if (op.type === "put") {
353
+ await coll.put(op.id, op.record, op.reason !== void 0 ? { reason: op.reason } : void 0);
354
+ } else {
355
+ await coll.delete(op.id);
356
+ }
178
357
  }
179
- executed.push({ op, priorEnvelope: prior });
358
+ } catch (err) {
359
+ await revertExecuted(ctx._executed, store, db);
360
+ if (ctx._amendment) {
361
+ for (const v of ctx._amendmentVaults.values()) {
362
+ const reg = v._getGuardRegistry();
363
+ if (reg !== null) {
364
+ reg.consumeChanges();
365
+ reg.consumeMeta();
366
+ }
367
+ }
368
+ }
369
+ throw err;
180
370
  }
181
- return bodyResult;
182
- } catch (err) {
183
- for (const { op, priorEnvelope } of executed.slice().reverse()) {
184
- try {
185
- if (priorEnvelope) {
186
- await store.put(op.vaultName, op.collectionName, op.id, priorEnvelope);
187
- } else {
188
- await store.delete(op.vaultName, op.collectionName, op.id);
371
+ } finally {
372
+ db._clearActiveTxContext(ctx);
373
+ }
374
+ if (ctx._amendment) {
375
+ const { GuardExecutor: GuardExecutor2 } = await Promise.resolve().then(() => (init_executor(), executor_exports));
376
+ try {
377
+ for (const [vaultName, v] of ctx._amendmentVaults) {
378
+ const registry = v._getGuardRegistry();
379
+ if (registry === null) continue;
380
+ const changesByCollection = registry.consumeChanges();
381
+ const meta = registry.consumeMeta();
382
+ if (changesByCollection.size === 0) continue;
383
+ const readOnlyVault = v._getReadOnlyFacade();
384
+ if (readOnlyVault === null) continue;
385
+ const invariantsPassed = [];
386
+ for (const [collection, changes] of changesByCollection) {
387
+ const guards = registry.guardsFor(collection).filter((g) => g.amendment !== void 0);
388
+ for (const guard of guards) {
389
+ await GuardExecutor2.runInvariant(guard, changes, {
390
+ existing: null,
391
+ vault: readOnlyVault,
392
+ userId: v.userId,
393
+ role: v.role
394
+ });
395
+ }
396
+ if (guards.length > 0) invariantsPassed.push(collection);
397
+ }
398
+ const ledger = v._getLedgerOrNull();
399
+ if (ledger) {
400
+ const role = v.role;
401
+ const amendment = {
402
+ reason: options.reason,
403
+ role,
404
+ changes: meta,
405
+ invariantsPassed
406
+ };
407
+ await ledger.append({
408
+ op: "amendment",
409
+ collection: "",
410
+ id: "",
411
+ version: 0,
412
+ actor: v.userId,
413
+ // No payload to hash — the per-record entries already
414
+ // captured `payloadHash` at their own append time. We use
415
+ // a sha256 of the canonical reason string so the field is
416
+ // populated with something deterministic and non-empty.
417
+ payloadHash: "",
418
+ amendment
419
+ });
189
420
  }
190
- } catch {
421
+ void vaultName;
422
+ }
423
+ } catch (err) {
424
+ await revertExecuted(ctx._executed, store, db);
425
+ throw err instanceof InvariantError ? err : new InvariantError(
426
+ err instanceof Error ? err.message : `invariant violated: ${String(err)}`
427
+ );
428
+ }
429
+ }
430
+ return bodyResult;
431
+ }
432
+ async function revertExecuted(executed, store, db) {
433
+ for (const { op, priorEnvelope } of executed.slice().reverse()) {
434
+ try {
435
+ if (priorEnvelope) {
436
+ await store.put(op.vaultName, op.collectionName, op.id, priorEnvelope);
437
+ } else {
438
+ await store.delete(op.vaultName, op.collectionName, op.id);
439
+ }
440
+ if (db) {
441
+ const coll = db.vault(op.vaultName).collection(op.collectionName);
442
+ await coll._invalidateCacheEntry(op.id);
191
443
  }
444
+ } catch {
192
445
  }
193
- throw err;
194
446
  }
195
447
  }
196
448
  function keyOf(op) {