@noy-db/hub 0.2.0-pre.12 → 0.2.0-pre.13

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 (249) hide show
  1. package/dist/aggregate/index.cjs.map +1 -1
  2. package/dist/aggregate/index.d.cts +2 -2
  3. package/dist/aggregate/index.d.ts +2 -2
  4. package/dist/aggregate/index.js +2 -2
  5. package/dist/attestation/index.cjs.map +1 -1
  6. package/dist/attestation/index.d.cts +3 -3
  7. package/dist/attestation/index.d.ts +3 -3
  8. package/dist/attestation/index.js +6 -6
  9. package/dist/blobs/index.cjs.map +1 -1
  10. package/dist/blobs/index.d.cts +4 -4
  11. package/dist/blobs/index.d.ts +4 -4
  12. package/dist/blobs/index.js +5 -5
  13. package/dist/bundle/index.cjs +551 -32
  14. package/dist/bundle/index.cjs.map +1 -1
  15. package/dist/bundle/index.d.cts +5 -5
  16. package/dist/bundle/index.d.ts +5 -5
  17. package/dist/bundle/index.js +9 -9
  18. package/dist/{chunk-P3Z5Y2TS.js → chunk-3OUCWHV6.js} +2 -2
  19. package/dist/{chunk-4BHFNKTP.js → chunk-3XZRRBFW.js} +2 -2
  20. package/dist/{chunk-XSIFXX54.js → chunk-4VCQH32J.js} +2 -2
  21. package/dist/{chunk-CHBXWJZQ.js → chunk-4YDZ7JPZ.js} +2 -2
  22. package/dist/{chunk-B7GGYNKQ.js → chunk-5NISHSBO.js} +2 -2
  23. package/dist/{chunk-O53RIZCC.js → chunk-7TEI2K2A.js} +5 -5
  24. package/dist/{chunk-ZCFS7U4J.js → chunk-AYNF7PVX.js} +2 -2
  25. package/dist/{chunk-GFPR7VJS.js → chunk-C3WRKABE.js} +4 -4
  26. package/dist/{chunk-EKNUBIIQ.js → chunk-CWFQTAD4.js} +4 -4
  27. package/dist/{chunk-P4EDT5ZP.js → chunk-D5Y3HIC6.js} +2 -2
  28. package/dist/{chunk-IUBHXEPJ.js → chunk-E3DIBDKA.js} +2 -2
  29. package/dist/{chunk-WNRGOVLG.js → chunk-FNVFT4HZ.js} +2 -2
  30. package/dist/{chunk-LYNNZEQD.js → chunk-GC4V7RU7.js} +1 -1
  31. package/dist/chunk-GC4V7RU7.js.map +1 -0
  32. package/dist/{chunk-5ARRXIVR.js → chunk-GL3Z7LH7.js} +2 -2
  33. package/dist/{chunk-WUG3E423.js → chunk-GZJ5JBED.js} +4 -4
  34. package/dist/{chunk-XHM2SARW.js → chunk-HHZ77DHM.js} +3 -3
  35. package/dist/{chunk-SJJQKNMP.js → chunk-HQXOEWLZ.js} +4 -4
  36. package/dist/{chunk-CILT6V3V.js → chunk-ILWQGTNH.js} +2 -2
  37. package/dist/{chunk-RRDWXNBQ.js → chunk-J67BP5EP.js} +3 -3
  38. package/dist/{chunk-HLGDYFWR.js → chunk-JPOQMXGT.js} +2 -2
  39. package/dist/{chunk-IEPT7HVP.js → chunk-JWFNOD2T.js} +2 -2
  40. package/dist/{chunk-BXOUVUES.js → chunk-KHQ3N5AB.js} +4 -4
  41. package/dist/{chunk-UA6G45ME.js → chunk-KJF7EPUE.js} +3 -3
  42. package/dist/{chunk-C2CIIQRG.js → chunk-KKB42D3Q.js} +2 -2
  43. package/dist/{chunk-M45IRXDM.js → chunk-M6KXHRIA.js} +3 -3
  44. package/dist/{chunk-VOXMU6LB.js → chunk-NIUXQDWD.js} +2 -2
  45. package/dist/{chunk-UOC7JMZO.js → chunk-NJMKHRQI.js} +135 -10
  46. package/dist/chunk-NJMKHRQI.js.map +1 -0
  47. package/dist/{chunk-AGRC7NQQ.js → chunk-NKGY3C53.js} +26 -1
  48. package/dist/chunk-NKGY3C53.js.map +1 -0
  49. package/dist/{chunk-LWSD4QPT.js → chunk-O2JW656W.js} +3 -3
  50. package/dist/{chunk-TMHJEYW7.js → chunk-P5MW7BG2.js} +302 -137
  51. package/dist/chunk-P5MW7BG2.js.map +1 -0
  52. package/dist/{chunk-LSEW3ZZ2.js → chunk-PW26DAXS.js} +3 -3
  53. package/dist/{chunk-HBAJDI2N.js → chunk-QAWCVWCX.js} +5 -5
  54. package/dist/{chunk-L6BYRCYB.js → chunk-QFYVGJLI.js} +2 -2
  55. package/dist/{chunk-6BYBVRZU.js → chunk-QIVFGU2M.js} +3 -3
  56. package/dist/{chunk-ZC7MNVYN.js → chunk-SJ24GHID.js} +2 -2
  57. package/dist/{chunk-SZ4N3IL5.js → chunk-SOU42FGB.js} +5 -5
  58. package/dist/{chunk-DLTU4M2I.js → chunk-SYSKC237.js} +6 -6
  59. package/dist/{chunk-6AD5TBF2.js → chunk-TDECYU4Y.js} +3 -3
  60. package/dist/{chunk-7JJE3OMJ.js → chunk-TEQGXA7L.js} +5 -5
  61. package/dist/{chunk-RHQYVHFH.js → chunk-UNQEWORI.js} +2 -2
  62. package/dist/{chunk-LOA2VCMS.js → chunk-VAK6NQAK.js} +5 -5
  63. package/dist/{chunk-7LVRIW4G.js → chunk-WQKZIQIL.js} +4 -4
  64. package/dist/{chunk-OPDTLHFA.js → chunk-YWBHS25M.js} +2 -2
  65. package/dist/chunk-ZC7J6ZYV.js +7 -0
  66. package/dist/chunk-ZC7J6ZYV.js.map +1 -0
  67. package/dist/consent/index.cjs.map +1 -1
  68. package/dist/consent/index.d.cts +4 -4
  69. package/dist/consent/index.d.ts +4 -4
  70. package/dist/consent/index.js +3 -3
  71. package/dist/{crypto-AJB72OKN.js → crypto-YXH6SAOW.js} +3 -3
  72. package/dist/{delegation-6FCWDRUS.js → delegation-K5ERUH6A.js} +5 -5
  73. package/dist/derivations/index.cjs.map +1 -1
  74. package/dist/derivations/index.d.cts +5 -5
  75. package/dist/derivations/index.d.ts +5 -5
  76. package/dist/derivations/index.js +4 -4
  77. package/dist/{dev-unlock-D3mpVFRc.d.ts → dev-unlock-BW0GNBEV.d.ts} +1 -1
  78. package/dist/{dev-unlock-ckqa_Nso.d.cts → dev-unlock-a7SOtaV0.d.cts} +1 -1
  79. package/dist/executor-AVJ7UEWA.js +8 -0
  80. package/dist/executor-IQO3KGXQ.js +11 -0
  81. package/dist/executor-VT7TKGE4.js +8 -0
  82. package/dist/{fanout-sidecar-ZSKEQ6NI.js → fanout-sidecar-N6OJX6QR.js} +2 -2
  83. package/dist/guards/index.cjs.map +1 -1
  84. package/dist/guards/index.d.cts +5 -5
  85. package/dist/guards/index.d.ts +5 -5
  86. package/dist/guards/index.js +3 -3
  87. package/dist/{hash-rDSSd_oW.d.cts → hash-B0cLQcq_.d.cts} +1 -1
  88. package/dist/{hash-CTZVkXLx.d.ts → hash-uMNIAAW8.d.ts} +1 -1
  89. package/dist/history/index.cjs.map +1 -1
  90. package/dist/history/index.d.cts +5 -5
  91. package/dist/history/index.d.ts +5 -5
  92. package/dist/history/index.js +5 -5
  93. package/dist/i18n/index.cjs.map +1 -1
  94. package/dist/i18n/index.d.cts +4 -4
  95. package/dist/i18n/index.d.ts +4 -4
  96. package/dist/i18n/index.js +6 -6
  97. package/dist/{immutable-guard-DyD0qg2k.d.ts → immutable-guard-B0h-ipLz.d.ts} +1 -1
  98. package/dist/{immutable-guard-C51vAHuh.d.cts → immutable-guard-BZIcYhYX.d.cts} +1 -1
  99. package/dist/{index-Cmop06zJ.d.cts → index-CUVOMtgg.d.cts} +28 -2
  100. package/dist/{index-CkFHr4OP.d.ts → index-Cqzp4tt9.d.ts} +28 -2
  101. package/dist/index.cjs +567 -35
  102. package/dist/index.cjs.map +1 -1
  103. package/dist/index.d.cts +22 -13
  104. package/dist/index.d.ts +22 -13
  105. package/dist/index.js +59 -40
  106. package/dist/index.js.map +1 -1
  107. package/dist/indexing/index.cjs.map +1 -1
  108. package/dist/indexing/index.js +2 -2
  109. package/dist/issue-ZH27C23Y.js +12 -0
  110. package/dist/{ledger-5JMVF7PY.js → ledger-64TTQMRS.js} +5 -5
  111. package/dist/materialized-views/index.cjs.map +1 -1
  112. package/dist/materialized-views/index.d.cts +5 -5
  113. package/dist/materialized-views/index.d.ts +5 -5
  114. package/dist/materialized-views/index.js +6 -6
  115. package/dist/noydb-O76SKBST.js +35 -0
  116. package/dist/overlay-views/index.cjs.map +1 -1
  117. package/dist/overlay-views/index.d.cts +5 -5
  118. package/dist/overlay-views/index.d.ts +5 -5
  119. package/dist/overlay-views/index.js +4 -4
  120. package/dist/periods/index.cjs.map +1 -1
  121. package/dist/periods/index.d.cts +4 -4
  122. package/dist/periods/index.d.ts +4 -4
  123. package/dist/periods/index.js +5 -5
  124. package/dist/{public-envelope-PFLZI5MO.js → public-envelope-MHG6YVXW.js} +4 -4
  125. package/dist/query/index.cjs +89 -7
  126. package/dist/query/index.cjs.map +1 -1
  127. package/dist/query/index.d.cts +2 -2
  128. package/dist/query/index.d.ts +2 -2
  129. package/dist/query/index.js +3 -3
  130. package/dist/registry-2PKBQDCH.js +8 -0
  131. package/dist/registry-4VXFKCBJ.js +8 -0
  132. package/dist/{registry-NCY445U5.js → registry-PV4G3OPA.js} +3 -3
  133. package/dist/{revoke-7RLGQWZ7.js → revoke-5BOLVJ3N.js} +6 -6
  134. package/dist/session/index.cjs.map +1 -1
  135. package/dist/session/index.d.cts +5 -5
  136. package/dist/session/index.d.ts +5 -5
  137. package/dist/session/index.js +3 -3
  138. package/dist/shadow/index.cjs.map +1 -1
  139. package/dist/shadow/index.d.cts +4 -4
  140. package/dist/shadow/index.d.ts +4 -4
  141. package/dist/shadow/index.js +2 -2
  142. package/dist/{signer-6JF44I4A.js → signer-GRIYBA22.js} +5 -5
  143. package/dist/snapshots/index.cjs.map +1 -1
  144. package/dist/snapshots/index.d.cts +4 -4
  145. package/dist/snapshots/index.d.ts +4 -4
  146. package/dist/snapshots/index.js +4 -4
  147. package/dist/{stale-UBLP3RJ3.js → stale-LZYMMDDS.js} +2 -2
  148. package/dist/state-vault-QFJWU23A.js +147 -0
  149. package/dist/state-vault-QFJWU23A.js.map +1 -0
  150. package/dist/store/index.cjs.map +1 -1
  151. package/dist/store/index.d.cts +4 -4
  152. package/dist/store/index.d.ts +4 -4
  153. package/dist/store/index.js +2 -2
  154. package/dist/{strategy-rtpKDfTC.d.ts → strategy-CrS7PnbE.d.cts} +20 -1
  155. package/dist/{strategy-rtpKDfTC.d.cts → strategy-CrS7PnbE.d.ts} +20 -1
  156. package/dist/sync/index.cjs.map +1 -1
  157. package/dist/sync/index.d.cts +3 -3
  158. package/dist/sync/index.d.ts +3 -3
  159. package/dist/sync/index.js +4 -4
  160. package/dist/team/index.cjs.map +1 -1
  161. package/dist/team/index.d.cts +4 -4
  162. package/dist/team/index.d.ts +4 -4
  163. package/dist/team/index.js +8 -8
  164. package/dist/tx/index.cjs.map +1 -1
  165. package/dist/tx/index.d.cts +4 -4
  166. package/dist/tx/index.d.ts +4 -4
  167. package/dist/tx/index.js +3 -3
  168. package/dist/{types-BGwjsDef.d.cts → types-CDwSSXiI.d.cts} +290 -92
  169. package/dist/{types-DRdfwgTG.d.ts → types-pax34sec.d.ts} +290 -92
  170. package/dist/{ulid-D4d0Xto3.d.cts → ulid-7bCSgIgb.d.cts} +1 -1
  171. package/dist/{ulid-DOTPZ5_h.d.ts → ulid-C_t4hL3d.d.ts} +1 -1
  172. package/dist/util/index.cjs.map +1 -1
  173. package/dist/util/index.js +1 -1
  174. package/dist/{vault-group-Z4KB75ZH.js → vault-group-UO4YUZOG.js} +53 -10
  175. package/dist/vault-group-UO4YUZOG.js.map +1 -0
  176. package/dist/{with-derivation-B082Y_WQ.d.ts → with-derivation-BjdOxUBn.d.ts} +1 -1
  177. package/dist/{with-derivation-CB1EdcFF.d.cts → with-derivation-D8wFlb6V.d.cts} +1 -1
  178. package/dist/{with-materialized-view-CzRg1Dpr.d.cts → with-materialized-view-5QMF1rS_.d.cts} +1 -1
  179. package/dist/{with-materialized-view-Dw4SwjKl.d.ts → with-materialized-view-DJb-HO65.d.ts} +1 -1
  180. package/dist/{with-overlayed-view-CaCXeW26.d.ts → with-overlayed-view-CkqTefbz.d.ts} +1 -1
  181. package/dist/{with-overlayed-view-C9YFKXzn.d.cts → with-overlayed-view-DDNflPvC.d.cts} +1 -1
  182. package/package.json +3 -3
  183. package/dist/chunk-AGRC7NQQ.js.map +0 -1
  184. package/dist/chunk-LYNNZEQD.js.map +0 -1
  185. package/dist/chunk-TMHJEYW7.js.map +0 -1
  186. package/dist/chunk-UOC7JMZO.js.map +0 -1
  187. package/dist/executor-7KSCEIFA.js +0 -8
  188. package/dist/executor-D2QMNGRJ.js +0 -8
  189. package/dist/executor-O5AZK7UW.js +0 -11
  190. package/dist/issue-YIYG4OW5.js +0 -12
  191. package/dist/noydb-D5SLAJ6V.js +0 -34
  192. package/dist/registry-BVQ5ITMF.js +0 -8
  193. package/dist/registry-JLP3QOLD.js +0 -8
  194. package/dist/vault-group-Z4KB75ZH.js.map +0 -1
  195. /package/dist/{chunk-P3Z5Y2TS.js.map → chunk-3OUCWHV6.js.map} +0 -0
  196. /package/dist/{chunk-4BHFNKTP.js.map → chunk-3XZRRBFW.js.map} +0 -0
  197. /package/dist/{chunk-XSIFXX54.js.map → chunk-4VCQH32J.js.map} +0 -0
  198. /package/dist/{chunk-CHBXWJZQ.js.map → chunk-4YDZ7JPZ.js.map} +0 -0
  199. /package/dist/{chunk-B7GGYNKQ.js.map → chunk-5NISHSBO.js.map} +0 -0
  200. /package/dist/{chunk-O53RIZCC.js.map → chunk-7TEI2K2A.js.map} +0 -0
  201. /package/dist/{chunk-ZCFS7U4J.js.map → chunk-AYNF7PVX.js.map} +0 -0
  202. /package/dist/{chunk-GFPR7VJS.js.map → chunk-C3WRKABE.js.map} +0 -0
  203. /package/dist/{chunk-EKNUBIIQ.js.map → chunk-CWFQTAD4.js.map} +0 -0
  204. /package/dist/{chunk-P4EDT5ZP.js.map → chunk-D5Y3HIC6.js.map} +0 -0
  205. /package/dist/{chunk-IUBHXEPJ.js.map → chunk-E3DIBDKA.js.map} +0 -0
  206. /package/dist/{chunk-WNRGOVLG.js.map → chunk-FNVFT4HZ.js.map} +0 -0
  207. /package/dist/{chunk-5ARRXIVR.js.map → chunk-GL3Z7LH7.js.map} +0 -0
  208. /package/dist/{chunk-WUG3E423.js.map → chunk-GZJ5JBED.js.map} +0 -0
  209. /package/dist/{chunk-XHM2SARW.js.map → chunk-HHZ77DHM.js.map} +0 -0
  210. /package/dist/{chunk-SJJQKNMP.js.map → chunk-HQXOEWLZ.js.map} +0 -0
  211. /package/dist/{chunk-CILT6V3V.js.map → chunk-ILWQGTNH.js.map} +0 -0
  212. /package/dist/{chunk-RRDWXNBQ.js.map → chunk-J67BP5EP.js.map} +0 -0
  213. /package/dist/{chunk-HLGDYFWR.js.map → chunk-JPOQMXGT.js.map} +0 -0
  214. /package/dist/{chunk-IEPT7HVP.js.map → chunk-JWFNOD2T.js.map} +0 -0
  215. /package/dist/{chunk-BXOUVUES.js.map → chunk-KHQ3N5AB.js.map} +0 -0
  216. /package/dist/{chunk-UA6G45ME.js.map → chunk-KJF7EPUE.js.map} +0 -0
  217. /package/dist/{chunk-C2CIIQRG.js.map → chunk-KKB42D3Q.js.map} +0 -0
  218. /package/dist/{chunk-M45IRXDM.js.map → chunk-M6KXHRIA.js.map} +0 -0
  219. /package/dist/{chunk-VOXMU6LB.js.map → chunk-NIUXQDWD.js.map} +0 -0
  220. /package/dist/{chunk-LWSD4QPT.js.map → chunk-O2JW656W.js.map} +0 -0
  221. /package/dist/{chunk-LSEW3ZZ2.js.map → chunk-PW26DAXS.js.map} +0 -0
  222. /package/dist/{chunk-HBAJDI2N.js.map → chunk-QAWCVWCX.js.map} +0 -0
  223. /package/dist/{chunk-L6BYRCYB.js.map → chunk-QFYVGJLI.js.map} +0 -0
  224. /package/dist/{chunk-6BYBVRZU.js.map → chunk-QIVFGU2M.js.map} +0 -0
  225. /package/dist/{chunk-ZC7MNVYN.js.map → chunk-SJ24GHID.js.map} +0 -0
  226. /package/dist/{chunk-SZ4N3IL5.js.map → chunk-SOU42FGB.js.map} +0 -0
  227. /package/dist/{chunk-DLTU4M2I.js.map → chunk-SYSKC237.js.map} +0 -0
  228. /package/dist/{chunk-6AD5TBF2.js.map → chunk-TDECYU4Y.js.map} +0 -0
  229. /package/dist/{chunk-7JJE3OMJ.js.map → chunk-TEQGXA7L.js.map} +0 -0
  230. /package/dist/{chunk-RHQYVHFH.js.map → chunk-UNQEWORI.js.map} +0 -0
  231. /package/dist/{chunk-LOA2VCMS.js.map → chunk-VAK6NQAK.js.map} +0 -0
  232. /package/dist/{chunk-7LVRIW4G.js.map → chunk-WQKZIQIL.js.map} +0 -0
  233. /package/dist/{chunk-OPDTLHFA.js.map → chunk-YWBHS25M.js.map} +0 -0
  234. /package/dist/{crypto-AJB72OKN.js.map → crypto-YXH6SAOW.js.map} +0 -0
  235. /package/dist/{delegation-6FCWDRUS.js.map → delegation-K5ERUH6A.js.map} +0 -0
  236. /package/dist/{executor-7KSCEIFA.js.map → executor-AVJ7UEWA.js.map} +0 -0
  237. /package/dist/{executor-D2QMNGRJ.js.map → executor-IQO3KGXQ.js.map} +0 -0
  238. /package/dist/{executor-O5AZK7UW.js.map → executor-VT7TKGE4.js.map} +0 -0
  239. /package/dist/{fanout-sidecar-ZSKEQ6NI.js.map → fanout-sidecar-N6OJX6QR.js.map} +0 -0
  240. /package/dist/{issue-YIYG4OW5.js.map → issue-ZH27C23Y.js.map} +0 -0
  241. /package/dist/{ledger-5JMVF7PY.js.map → ledger-64TTQMRS.js.map} +0 -0
  242. /package/dist/{noydb-D5SLAJ6V.js.map → noydb-O76SKBST.js.map} +0 -0
  243. /package/dist/{public-envelope-PFLZI5MO.js.map → public-envelope-MHG6YVXW.js.map} +0 -0
  244. /package/dist/{registry-BVQ5ITMF.js.map → registry-2PKBQDCH.js.map} +0 -0
  245. /package/dist/{registry-JLP3QOLD.js.map → registry-4VXFKCBJ.js.map} +0 -0
  246. /package/dist/{registry-NCY445U5.js.map → registry-PV4G3OPA.js.map} +0 -0
  247. /package/dist/{revoke-7RLGQWZ7.js.map → revoke-5BOLVJ3N.js.map} +0 -0
  248. /package/dist/{signer-6JF44I4A.js.map → signer-GRIYBA22.js.map} +0 -0
  249. /package/dist/{stale-UBLP3RJ3.js.map → stale-LZYMMDDS.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -46,7 +46,7 @@ var init_types = __esm({
46
46
  });
47
47
 
48
48
  // src/errors.ts
49
- var NoydbError, DecryptionError, TamperedError, InvalidKeyError, KeyringCorruptError, NoAccessError, ReadOnlyError, ReadOnlyAtInstantError, ReadOnlyFrameError, PermissionDeniedError, ExportCapabilityError, KeyringExpiredError, ImportCapabilityError, StoreCapabilityError, PrivilegeEscalationError, PeriodClosedError, RecordLockedError, FieldFrozenError, InvariantError, AmendmentForbiddenError, DirectoryDisabledError, TierNotGrantedError, ElevationExpiredError, AlreadyElevatedError, TierDemoteDeniedError, DelegationTargetMissingError, ConflictError, LedgerContentionError, SequenceContentionError, SequenceOfflineError, BundleVersionConflictError, NetworkError, NotFoundError, ValidationError, SchemaValidationError, SchemaUpdateError, NonAdditiveSchemaChangeError, SchemaLockedError, SchemaFenceError, MigrationRequiredError, QuiesceTimeoutError, GroupCardinalityError, IndexRequiredError, UniqueConstraintError, UnsupportedIndexOptionError, IndexWriteFailureError, BundleIntegrityError, BundleSealMismatchError, ReservedCollectionNameError, DictKeyMissingError, DictKeyInUseError, MissingTranslationError, LocaleNotSpecifiedError, ScriptViolationError, TranslatorNotConfiguredError, BackupLedgerError, BackupCorruptedError, AttestationError, SessionExpiredError, SessionNotFoundError, SessionPolicyError, JoinTooLargeError, CrossJoinTooLargeError, CrossJoinSourceUnknownError, DanglingReferenceError, FilenameSanitizationError, PathEscapeError, DerivationCycleError, DerivationDepthError, DerivationOutputUnknownError, DerivationOutputShapeError, DerivationCapExceededError, MaterializedViewCycleError, MaterializedViewSourceUnknownError, MaterializedViewTooLargeError, MaterializedViewConfigError, OverlayBaseIsVirtualError, OverlayCollectionUnavailableError, OverlayNameCollisionError, OverlayIdMismatchError, SnapshotNotFoundError, UnknownShardError, ShardProvisioningError, VaultTemplateNotFoundError;
49
+ var NoydbError, DecryptionError, TamperedError, InvalidKeyError, KeyringCorruptError, NoAccessError, ReadOnlyError, ReadOnlyAtInstantError, ReadOnlyFrameError, PermissionDeniedError, ExportCapabilityError, KeyringExpiredError, ImportCapabilityError, StoreCapabilityError, PrivilegeEscalationError, ReservedVaultNameError, PeriodClosedError, RecordLockedError, FieldFrozenError, InvariantError, AmendmentForbiddenError, DirectoryDisabledError, TierNotGrantedError, ElevationExpiredError, AlreadyElevatedError, TierDemoteDeniedError, DelegationTargetMissingError, ConflictError, LedgerContentionError, SequenceContentionError, SequenceOfflineError, NumberingUncertaintyError, BundleVersionConflictError, NetworkError, NotFoundError, ValidationError, SchemaValidationError, SchemaUpdateError, NonAdditiveSchemaChangeError, SchemaLockedError, SchemaFenceError, MigrationRequiredError, QuiesceTimeoutError, GroupCardinalityError, IndexRequiredError, UniqueConstraintError, UnsupportedIndexOptionError, IndexWriteFailureError, BundleIntegrityError, BundleSealMismatchError, ReservedCollectionNameError, DictKeyMissingError, DictKeyInUseError, MissingTranslationError, LocaleNotSpecifiedError, ScriptViolationError, TranslatorNotConfiguredError, BackupLedgerError, BackupCorruptedError, AttestationError, SessionExpiredError, SessionNotFoundError, SessionPolicyError, JoinTooLargeError, CrossJoinTooLargeError, CrossJoinSourceUnknownError, DanglingReferenceError, FilenameSanitizationError, PathEscapeError, DerivationCycleError, DerivationDepthError, DerivationOutputUnknownError, DerivationOutputShapeError, DerivationCapExceededError, MaterializedViewCycleError, MaterializedViewSourceUnknownError, MaterializedViewTooLargeError, MaterializedViewConfigError, OverlayBaseIsVirtualError, OverlayCollectionUnavailableError, OverlayNameCollisionError, OverlayIdMismatchError, SnapshotNotFoundError, UnknownShardError, ShardProvisioningError, VaultTemplateNotFoundError;
50
50
  var init_errors = __esm({
51
51
  "src/errors.ts"() {
52
52
  "use strict";
@@ -188,6 +188,18 @@ var init_errors = __esm({
188
188
  this.offendingCollection = offendingCollection;
189
189
  }
190
190
  };
191
+ ReservedVaultNameError = class extends NoydbError {
192
+ /** The rejected vault name. */
193
+ vaultName;
194
+ constructor(vaultName) {
195
+ super(
196
+ "RESERVED_VAULT_NAME",
197
+ `"${vaultName}" is a reserved internal vault name and cannot be used as a group name or partition key`
198
+ );
199
+ this.name = "ReservedVaultNameError";
200
+ this.vaultName = vaultName;
201
+ }
202
+ };
191
203
  PeriodClosedError = class extends NoydbError {
192
204
  periodName;
193
205
  endDate;
@@ -362,6 +374,17 @@ var init_errors = __esm({
362
374
  this.name = "SequenceOfflineError";
363
375
  }
364
376
  };
377
+ NumberingUncertaintyError = class extends NoydbError {
378
+ series;
379
+ constructor(series) {
380
+ super(
381
+ "NUMBERING_UNCERTAINTY",
382
+ `Deferred numbering for series "${series}" cannot run: the store does not expose getStoreTime() (capabilities.serverWriteTime). Use a CAS sequence or a store with serverWriteTime.`
383
+ );
384
+ this.name = "NumberingUncertaintyError";
385
+ this.series = series;
386
+ }
387
+ };
365
388
  BundleVersionConflictError = class extends NoydbError {
366
389
  /** The bundle handle of the newer remote version that rejected the push. */
367
390
  remoteVersion;
@@ -1255,6 +1278,15 @@ var init_crypto = __esm({
1255
1278
  }
1256
1279
  });
1257
1280
 
1281
+ // src/federation/constants.ts
1282
+ var STATE_VAULT_NAME;
1283
+ var init_constants = __esm({
1284
+ "src/federation/constants.ts"() {
1285
+ "use strict";
1286
+ STATE_VAULT_NAME = "__noydb_state__";
1287
+ }
1288
+ });
1289
+
1258
1290
  // src/meta/public-envelope/schema.ts
1259
1291
  function validatePublicEnvelopeInput(input, schema) {
1260
1292
  const allowed = new Set(schema.fields);
@@ -1719,7 +1751,7 @@ var init_patch = __esm({
1719
1751
 
1720
1752
  // src/history/ledger/constants.ts
1721
1753
  var LEDGER_COLLECTION, LEDGER_DELTAS_COLLECTION;
1722
- var init_constants = __esm({
1754
+ var init_constants2 = __esm({
1723
1755
  "src/history/ledger/constants.ts"() {
1724
1756
  "use strict";
1725
1757
  LEDGER_COLLECTION = "_ledger";
@@ -1754,7 +1786,7 @@ var init_store = __esm({
1754
1786
  init_errors();
1755
1787
  init_entry();
1756
1788
  init_patch();
1757
- init_constants();
1789
+ init_constants2();
1758
1790
  init_hash();
1759
1791
  MAX_APPEND_ATTEMPTS = 8;
1760
1792
  LedgerStore = class {
@@ -2330,10 +2362,10 @@ function shouldRoundUp(negative, lastKeptDigit, firstDiscarded, hasMoreNonZeroAf
2330
2362
  }
2331
2363
  }
2332
2364
  function parseToScaledInt(input, scale, rounding) {
2333
- const canonical = toCanonicalDecimalString(input);
2334
- if (canonical === null) return { ok: false, reason: "nonfinite" };
2335
- const negative = canonical.startsWith("-");
2336
- const unsigned = negative ? canonical.slice(1) : canonical;
2365
+ const canonical2 = toCanonicalDecimalString(input);
2366
+ if (canonical2 === null) return { ok: false, reason: "nonfinite" };
2367
+ const negative = canonical2.startsWith("-");
2368
+ const unsigned = negative ? canonical2.slice(1) : canonical2;
2337
2369
  const dot = unsigned.indexOf(".");
2338
2370
  const intPart = dot === -1 ? unsigned : unsigned.slice(0, dot);
2339
2371
  const fracPart = dot === -1 ? "" : unsigned.slice(dot + 1);
@@ -3466,12 +3498,12 @@ var init_dependency_analyzer = __esm({
3466
3498
 
3467
3499
  // src/materialized-views/query-hash.ts
3468
3500
  async function computeQueryHash(mvName, dependencies, queryPlanSummary) {
3469
- const canonical = JSON.stringify({
3501
+ const canonical2 = JSON.stringify({
3470
3502
  mvName,
3471
3503
  dependencies: [...dependencies].sort(),
3472
3504
  queryPlanSummary
3473
3505
  });
3474
- const bytes = new TextEncoder().encode(canonical);
3506
+ const bytes = new TextEncoder().encode(canonical2);
3475
3507
  const digest = await crypto.subtle.digest("SHA-256", bytes);
3476
3508
  return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
3477
3509
  }
@@ -4310,12 +4342,12 @@ var init_read_only_facade = __esm({
4310
4342
 
4311
4343
  // src/derivations/strategy-hash.ts
4312
4344
  async function computeStrategyHash(source, outputKeys, derive) {
4313
- const canonical = JSON.stringify({
4345
+ const canonical2 = JSON.stringify({
4314
4346
  source,
4315
4347
  outputs: [...outputKeys].sort(),
4316
4348
  derive: derive.toString()
4317
4349
  });
4318
- const bytes = new TextEncoder().encode(canonical);
4350
+ const bytes = new TextEncoder().encode(canonical2);
4319
4351
  const digest = await crypto.subtle.digest("SHA-256", bytes);
4320
4352
  return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
4321
4353
  }
@@ -4794,6 +4826,9 @@ function assertSafePartitionKey(partitionKey) {
4794
4826
  if (partitionKey.length === 0) {
4795
4827
  throw new ValidationError("partitionKey must be a non-empty string");
4796
4828
  }
4829
+ if (partitionKey === STATE_VAULT_NAME) {
4830
+ throw new ReservedVaultNameError(partitionKey);
4831
+ }
4797
4832
  if (!SAFE_PARTITION_KEY.test(partitionKey)) {
4798
4833
  throw new ValidationError(
4799
4834
  `partitionKey "${partitionKey}" contains characters outside [A-Za-z0-9._-]. Map your records to a store-safe key in sharding.keyOf.`
@@ -4810,6 +4845,7 @@ var init_vault_group = __esm({
4810
4845
  "src/federation/vault-group.ts"() {
4811
4846
  "use strict";
4812
4847
  init_errors();
4848
+ init_constants();
4813
4849
  init_classify_skip();
4814
4850
  init_cross_vault_live();
4815
4851
  init_aggregate_across();
@@ -4833,15 +4869,38 @@ var init_vault_group = __esm({
4833
4869
  registry;
4834
4870
  sharding;
4835
4871
  template;
4872
+ /** @internal — set when the group is managed (no explicit registry). */
4873
+ stateVault;
4874
+ /** @internal */
4875
+ _attachStateVault(sv) {
4876
+ this.stateVault = sv;
4877
+ }
4836
4878
  /** Deterministic vault name for a partition key, namespaced by the group. */
4837
4879
  shardVaultId(partitionKey) {
4838
4880
  assertSafePartitionKey(partitionKey);
4839
4881
  return `${this.name}${SHARD_SEPARATOR}${partitionKey}`;
4840
4882
  }
4841
- /** All registry rows (hydrates the registry collection first). */
4883
+ /**
4884
+ * @internal — group-qualified registry record key (avoids cross-group key
4885
+ * collisions). Identical to the shard vault id by design — the registry row
4886
+ * for a shard is keyed by that shard's vault id — so it delegates to
4887
+ * `shardVaultId`, reusing its partition-key validation.
4888
+ */
4889
+ registryId(partitionKey) {
4890
+ return this.shardVaultId(partitionKey);
4891
+ }
4892
+ /**
4893
+ * Registry rows for THIS group (hydrates the registry collection first).
4894
+ * The registry may be shared across groups (the auto-wired StateManagement
4895
+ * vault holds one `vaultRegistry` for the whole instance), so rows are
4896
+ * filtered by `group` — without this, a group's fan-out reads would leak
4897
+ * across into other groups' shards. Mirrors the `${group}--` scoping that
4898
+ * `liveBinding().isRelevant` already applies to the reactive path.
4899
+ */
4842
4900
  async allRows() {
4843
4901
  await this.registry.list();
4844
- return this.registry.query().toArray();
4902
+ const rows = this.registry.query().toArray();
4903
+ return rows.filter((r) => r.group === this.name);
4845
4904
  }
4846
4905
  /** Open an existing shard and apply the template. */
4847
4906
  async openShard(partitionKey) {
@@ -4859,19 +4918,32 @@ var init_vault_group = __esm({
4859
4918
  */
4860
4919
  async createShard(partitionKey) {
4861
4920
  const vaultId = this.shardVaultId(partitionKey);
4862
- const row = await this.registry.get(partitionKey);
4921
+ const row = await this.registry.get(this.registryId(partitionKey));
4863
4922
  const provisioned = await this.db._shardVaultProvisioned(vaultId);
4864
4923
  if (row && !provisioned) throw new ShardProvisioningError(vaultId, partitionKey);
4865
4924
  if (row && provisioned) return this.openShard(partitionKey);
4866
4925
  const vault = await this.db.openVault(vaultId);
4867
4926
  this.template.configure(vault);
4868
- await this.registry.put(partitionKey, {
4927
+ await this.registry.put(this.registryId(partitionKey), {
4869
4928
  vaultId,
4870
4929
  partitionKey,
4871
4930
  templateName: this.sharding.vaultTemplate,
4872
4931
  schemaVersion: this.template.version,
4873
- createdAt: Date.now()
4932
+ createdAt: Date.now(),
4933
+ group: this.name
4874
4934
  });
4935
+ if (this.stateVault) {
4936
+ try {
4937
+ await this.stateVault.appendEvent({
4938
+ type: "shard-created",
4939
+ group: this.name,
4940
+ vaultId,
4941
+ templateName: this.sharding.vaultTemplate,
4942
+ version: this.template.version
4943
+ });
4944
+ } catch {
4945
+ }
4946
+ }
4875
4947
  return vault;
4876
4948
  }
4877
4949
  /**
@@ -4881,7 +4953,7 @@ var init_vault_group = __esm({
4881
4953
  */
4882
4954
  async shard(partitionKey) {
4883
4955
  const vaultId = this.shardVaultId(partitionKey);
4884
- const row = await this.registry.get(partitionKey);
4956
+ const row = await this.registry.get(this.registryId(partitionKey));
4885
4957
  if (!row) throw new UnknownShardError(partitionKey, this.name);
4886
4958
  const provisioned = await this.db._shardVaultProvisioned(vaultId);
4887
4959
  if (!provisioned) throw new ShardProvisioningError(vaultId, partitionKey);
@@ -4920,7 +4992,7 @@ var init_vault_group = __esm({
4920
4992
  /** Route a write to the shard owning `keyOf(record)`. */
4921
4993
  async put(id, record) {
4922
4994
  const key = this.group.sharding.keyOf(record);
4923
- const row = await this.group.registry.get(key);
4995
+ const row = await this.group.registry.get(this.group.registryId(key));
4924
4996
  let vault;
4925
4997
  if (!row) {
4926
4998
  if (this.group.sharding.autoCreate === false) {
@@ -5046,6 +5118,159 @@ var init_vault_group = __esm({
5046
5118
  }
5047
5119
  });
5048
5120
 
5121
+ // src/federation/schema-manifest.ts
5122
+ function captureBlueprint(configure) {
5123
+ const recorded = [];
5124
+ const collectionStub = new Proxy(
5125
+ {},
5126
+ {
5127
+ get: () => () => collectionStub
5128
+ }
5129
+ );
5130
+ const proxy = new Proxy(
5131
+ {},
5132
+ {
5133
+ get: (_t, prop) => {
5134
+ if (prop === "collection") {
5135
+ return (name, opts) => {
5136
+ recorded.push({
5137
+ name,
5138
+ indexes: opts?.indexes ?? [],
5139
+ persistJsonSchema: !!opts?.persistJsonSchema
5140
+ });
5141
+ return collectionStub;
5142
+ };
5143
+ }
5144
+ return () => proxy;
5145
+ }
5146
+ }
5147
+ );
5148
+ configure(proxy);
5149
+ const sorted = [...recorded].sort((a, b) => a.name.localeCompare(b.name));
5150
+ const indexes = {};
5151
+ const persistJsonSchema = [];
5152
+ for (const c of sorted) {
5153
+ indexes[c.name] = c.indexes;
5154
+ if (c.persistJsonSchema) persistJsonSchema.push(c.name);
5155
+ }
5156
+ return {
5157
+ // `persistJsonSchema` is already name-sorted: it is populated while
5158
+ // iterating `sorted` (collections in name order).
5159
+ collections: sorted.map((c) => c.name),
5160
+ indexes,
5161
+ persistJsonSchema
5162
+ };
5163
+ }
5164
+ function canonical(value) {
5165
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
5166
+ if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
5167
+ const obj = value;
5168
+ const keys = Object.keys(obj).sort();
5169
+ return `{${keys.map((k) => `${JSON.stringify(k)}:${canonical(obj[k])}`).join(",")}}`;
5170
+ }
5171
+ async function fingerprintBlueprint(bp) {
5172
+ return sha256Hex(new TextEncoder().encode(canonical(bp)));
5173
+ }
5174
+ var init_schema_manifest = __esm({
5175
+ "src/federation/schema-manifest.ts"() {
5176
+ "use strict";
5177
+ init_crypto();
5178
+ }
5179
+ });
5180
+
5181
+ // src/federation/state-vault.ts
5182
+ var state_vault_exports = {};
5183
+ __export(state_vault_exports, {
5184
+ STATE_VAULT_NAME: () => STATE_VAULT_NAME,
5185
+ StateManagementVault: () => StateManagementVault
5186
+ });
5187
+ var REGISTRY, MANIFEST, EVENTS, StateManagementVault;
5188
+ var init_state_vault = __esm({
5189
+ "src/federation/state-vault.ts"() {
5190
+ "use strict";
5191
+ init_schema_manifest();
5192
+ init_constants();
5193
+ init_ulid();
5194
+ init_constants();
5195
+ REGISTRY = "vaultRegistry";
5196
+ MANIFEST = "schemaManifest";
5197
+ EVENTS = "deploymentEvents";
5198
+ StateManagementVault = class _StateManagementVault {
5199
+ constructor(registry, schemaManifest, events) {
5200
+ this.registry = registry;
5201
+ this.schemaManifest = schemaManifest;
5202
+ this.#events = events;
5203
+ }
5204
+ registry;
5205
+ schemaManifest;
5206
+ /**
5207
+ * The append-only deployment-events log is kept truly private so the raw
5208
+ * mutable Collection is never surfaced — events may only be written via
5209
+ * `appendEvent` and read via `queryEvents`. (`registry` and
5210
+ * `schemaManifest` are deliberately public: consumers read and write them.)
5211
+ */
5212
+ #events;
5213
+ /** Idempotently open the reserved state vault and bind the three control-plane collections. */
5214
+ static async open(db) {
5215
+ const vault = await db.openVault(STATE_VAULT_NAME);
5216
+ return new _StateManagementVault(
5217
+ vault.collection(REGISTRY),
5218
+ vault.collection(MANIFEST),
5219
+ vault.collection(EVENTS)
5220
+ );
5221
+ }
5222
+ /** Read-only query over the append-only deployment-events log. */
5223
+ queryEvents() {
5224
+ return this.#events.query();
5225
+ }
5226
+ /**
5227
+ * Append a deployment event with a fresh unique (ULID) id. This is the
5228
+ * only write path to the events log; no update/delete is exposed.
5229
+ * Callers should treat failures as non-fatal — this method does not
5230
+ * swallow errors, so wrap the call site in try/catch where appropriate.
5231
+ */
5232
+ async appendEvent(event) {
5233
+ const ts = event.ts ?? Date.now();
5234
+ const id = generateULID();
5235
+ await this.#events.put(id, { ...event, id, ts });
5236
+ }
5237
+ /**
5238
+ * Ensure a manifest row exists for `(templateName, template.version)`.
5239
+ * Safe to call repeatedly: the `fingerprint` is a deterministic hash of
5240
+ * the template's declared shape (stable across calls), though each call
5241
+ * refreshes `recordedAt`.
5242
+ */
5243
+ async recordManifest(templateName, template) {
5244
+ const bp = captureBlueprint(template.configure);
5245
+ const fingerprint = await fingerprintBlueprint(bp);
5246
+ await this.schemaManifest.put(`${templateName}:${template.version}`, {
5247
+ templateName,
5248
+ version: template.version,
5249
+ collections: bp.collections,
5250
+ indexes: bp.indexes,
5251
+ persistJsonSchema: bp.persistJsonSchema,
5252
+ fingerprint,
5253
+ recordedAt: Date.now()
5254
+ });
5255
+ return fingerprint;
5256
+ }
5257
+ /**
5258
+ * True when `template`'s current declared shape does not match the recorded
5259
+ * manifest for `(templateName, template.version)`. Because shards carry no
5260
+ * schema state independent of their template, this catches "a template's
5261
+ * shape changed without bumping `version`" — not independent per-shard drift.
5262
+ * A missing manifest is treated as drift (nothing to verify against).
5263
+ */
5264
+ async detectDrift(templateName, template) {
5265
+ const row = await this.schemaManifest.get(`${templateName}:${template.version}`);
5266
+ if (!row) return true;
5267
+ const current = await fingerprintBlueprint(captureBlueprint(template.configure));
5268
+ return current !== row.fingerprint;
5269
+ }
5270
+ };
5271
+ }
5272
+ });
5273
+
5049
5274
  // src/index.ts
5050
5275
  var src_exports = {};
5051
5276
  __export(src_exports, {
@@ -5150,6 +5375,7 @@ __export(src_exports, {
5150
5375
  NotFoundError: () => NotFoundError,
5151
5376
  Noydb: () => Noydb,
5152
5377
  NoydbError: () => NoydbError,
5378
+ NumberingUncertaintyError: () => NumberingUncertaintyError,
5153
5379
  OverlayBaseIsVirtualError: () => OverlayBaseIsVirtualError,
5154
5380
  OverlayCollectionUnavailableError: () => OverlayCollectionUnavailableError,
5155
5381
  OverlayIdMismatchError: () => OverlayIdMismatchError,
@@ -5179,8 +5405,10 @@ __export(src_exports, {
5179
5405
  RefRegistry: () => RefRegistry,
5180
5406
  RefScopeError: () => RefScopeError,
5181
5407
  ReservedCollectionNameError: () => ReservedCollectionNameError,
5408
+ ReservedVaultNameError: () => ReservedVaultNameError,
5182
5409
  SCHEMAS_COLLECTION: () => SCHEMAS_COLLECTION,
5183
5410
  SEALED_PASSPHRASE_RECORD_ID: () => SEALED_PASSPHRASE_RECORD_ID,
5411
+ STATE_VAULT_NAME: () => STATE_VAULT_NAME,
5184
5412
  STRICT_POLICY: () => STRICT_POLICY,
5185
5413
  SYNC_CREDENTIALS_COLLECTION: () => SYNC_CREDENTIALS_COLLECTION,
5186
5414
  ScanBuilder: () => ScanBuilder,
@@ -5392,6 +5620,7 @@ __export(src_exports, {
5392
5620
  withArchive: () => withArchive,
5393
5621
  withCache: () => withCache,
5394
5622
  withCircuitBreaker: () => withCircuitBreaker,
5623
+ withDeferredNumbering: () => withDeferredNumbering,
5395
5624
  withDerivation: () => withDerivation,
5396
5625
  withGuard: () => withGuard,
5397
5626
  withHealthCheck: () => withHealthCheck,
@@ -7543,8 +7772,20 @@ var SequenceStore = class {
7543
7772
  }
7544
7773
  };
7545
7774
 
7775
+ // src/numbering/descriptor.ts
7776
+ function withDeferredNumbering(config) {
7777
+ return {
7778
+ series: config.series,
7779
+ collection: config.collection,
7780
+ field: config.field,
7781
+ settleWindowMs: config.settleWindowMs ?? 0
7782
+ };
7783
+ }
7784
+
7546
7785
  // src/index.ts
7547
7786
  init_errors();
7787
+ init_constants();
7788
+ init_errors();
7548
7789
 
7549
7790
  // src/bundle/format.ts
7550
7791
  var NOYDB_BUNDLE_MAGIC = new Uint8Array([78, 68, 66, 49]);
@@ -8351,8 +8592,8 @@ async function derivePersistedSchema(validator) {
8351
8592
  if (kind === "Zod") {
8352
8593
  const convert = await loadZodConverter();
8353
8594
  const jsonSchema = convert(validator);
8354
- const canonical = canonicalize(jsonSchema);
8355
- const hash = await sha256Hex(new TextEncoder().encode(canonical));
8595
+ const canonical2 = canonicalize(jsonSchema);
8596
+ const hash = await sha256Hex(new TextEncoder().encode(canonical2));
8356
8597
  return { _noydb_schema: 1, kind, jsonSchema, hash, derivedAt };
8357
8598
  }
8358
8599
  return {
@@ -10983,6 +11224,7 @@ init_errors();
10983
11224
 
10984
11225
  // src/noydb.ts
10985
11226
  init_errors();
11227
+ init_constants();
10986
11228
  init_ulid();
10987
11229
  init_public_envelope();
10988
11230
 
@@ -12009,7 +12251,7 @@ var Query = class _Query {
12009
12251
  * for the ordering rationale.
12010
12252
  */
12011
12253
  toArray() {
12012
- const base = executePlanWithSource(this.source, this.plan, this.joinContext);
12254
+ const base = this.decodeMoney(executePlanWithSource(this.source, this.plan, this.joinContext));
12013
12255
  if (this.plan.joins.length === 0) return base;
12014
12256
  if (!this.joinContext) {
12015
12257
  throw new Error(
@@ -12018,6 +12260,23 @@ var Query = class _Query {
12018
12260
  }
12019
12261
  return applyJoins(base, this.plan.joins, this.joinContext);
12020
12262
  }
12263
+ /**
12264
+ * Decode this source's money fields on read (stored scaled-int → canonical
12265
+ * decimal), so `query().toArray()` agrees with `get()`/`sum()` on the value.
12266
+ * No-op when the source declares no money fields.
12267
+ *
12268
+ * The query layer carries no locale context, so we decode with `'raw'` —
12269
+ * canonical decimal, WITHOUT fabricating locale-formatted `<field>Formatted`
12270
+ * / `<field>Number` virtuals. Producing a guessed-locale string here would
12271
+ * just reintroduce #322's "two read paths disagree" failure on the virtual
12272
+ * field (e.g. it-IT via `get()` vs en-US here). Consumers who need formatted
12273
+ * money read through `get()`/`list()` with a locale.
12274
+ */
12275
+ decodeMoney(records) {
12276
+ const moneyFields = this.source.moneyFields;
12277
+ if (!moneyFields || Object.keys(moneyFields).length === 0) return records;
12278
+ return records.map((r) => decodeMoneyFields(r, moneyFields, "raw"));
12279
+ }
12021
12280
  /** Return the first matching record, or null. Joins are applied. */
12022
12281
  first() {
12023
12282
  const arr = this.limit(1).toArray();
@@ -12502,7 +12761,7 @@ function serializeClause(clause) {
12502
12761
  }
12503
12762
  function canonicalCtxHash(ctx) {
12504
12763
  if (ctx === void 0) return "";
12505
- const canonical = JSON.stringify(ctx, (_key, value) => {
12764
+ const canonical2 = JSON.stringify(ctx, (_key, value) => {
12506
12765
  if (value && typeof value === "object" && !Array.isArray(value)) {
12507
12766
  const sorted = {};
12508
12767
  for (const k of Object.keys(value).sort()) {
@@ -12513,8 +12772,8 @@ function canonicalCtxHash(ctx) {
12513
12772
  return value;
12514
12773
  });
12515
12774
  let h = 5381;
12516
- for (let i = 0; i < canonical.length; i++) {
12517
- h = (h << 5) + h ^ canonical.charCodeAt(i);
12775
+ for (let i = 0; i < canonical2.length; i++) {
12776
+ h = (h << 5) + h ^ canonical2.charCodeAt(i);
12518
12777
  }
12519
12778
  return (h >>> 0).toString(16).padStart(8, "0");
12520
12779
  }
@@ -12820,12 +13079,29 @@ var ScanBuilder = class _ScanBuilder {
12820
13079
  * context throws with an actionable error.
12821
13080
  */
12822
13081
  joinContext;
12823
- constructor(pageProvider, pageSize = DEFAULT_SCAN_PAGE_SIZE, clauses = [], joins = [], joinContext) {
13082
+ /**
13083
+ * Money field descriptors for the backing collection. When present, yielded
13084
+ * records are decoded (stored scaled-int → canonical decimal) so `scan()`
13085
+ * agrees with `get()`/`list()`/`query().toArray()` — #322. Decoded with
13086
+ * `'raw'` (canonical decimal, no locale-formatted virtuals) since the scan
13087
+ * stream carries no locale context, mirroring `Query.toArray()`.
13088
+ */
13089
+ moneyFields;
13090
+ constructor(pageProvider, pageSize = DEFAULT_SCAN_PAGE_SIZE, clauses = [], joins = [], joinContext, moneyFields) {
12824
13091
  this.pageProvider = pageProvider;
12825
13092
  this.pageSize = pageSize;
12826
13093
  this.clauses = clauses;
12827
13094
  this.joins = joins;
12828
13095
  this.joinContext = joinContext;
13096
+ this.moneyFields = moneyFields;
13097
+ }
13098
+ /**
13099
+ * Decode this scan's money fields on a record (stored scaled-int → canonical
13100
+ * decimal). No-op when no money fields are declared. See {@link moneyFields}.
13101
+ */
13102
+ decodeMoney(record) {
13103
+ if (!this.moneyFields || Object.keys(this.moneyFields).length === 0) return record;
13104
+ return decodeMoneyFields(record, this.moneyFields, "raw");
12829
13105
  }
12830
13106
  /**
12831
13107
  * Add a field comparison. Runs per record as the scan stream
@@ -12847,7 +13123,8 @@ var ScanBuilder = class _ScanBuilder {
12847
13123
  this.pageSize,
12848
13124
  [...this.clauses, clause],
12849
13125
  this.joins,
12850
- this.joinContext
13126
+ this.joinContext,
13127
+ this.moneyFields
12851
13128
  );
12852
13129
  }
12853
13130
  /**
@@ -12866,7 +13143,8 @@ var ScanBuilder = class _ScanBuilder {
12866
13143
  this.pageSize,
12867
13144
  [...this.clauses, clause],
12868
13145
  this.joins,
12869
- this.joinContext
13146
+ this.joinContext,
13147
+ this.moneyFields
12870
13148
  );
12871
13149
  }
12872
13150
  /**
@@ -12977,7 +13255,8 @@ var ScanBuilder = class _ScanBuilder {
12977
13255
  this.pageSize,
12978
13256
  this.clauses,
12979
13257
  [...this.joins, leg],
12980
- this.joinContext
13258
+ this.joinContext,
13259
+ this.moneyFields
12981
13260
  );
12982
13261
  }
12983
13262
  /**
@@ -12994,10 +13273,11 @@ var ScanBuilder = class _ScanBuilder {
12994
13273
  while (true) {
12995
13274
  for (const record of page.items) {
12996
13275
  if (!this.recordMatches(record)) continue;
13276
+ const decoded = this.decodeMoney(record);
12997
13277
  if (joinResolvers === null) {
12998
- yield record;
13278
+ yield decoded;
12999
13279
  } else {
13000
- let attached = record;
13280
+ let attached = decoded;
13001
13281
  for (const resolver of joinResolvers) {
13002
13282
  attached = this.applyOneJoinStreaming(attached, resolver);
13003
13283
  }
@@ -15332,9 +15612,17 @@ var Collection = class {
15332
15612
  }
15333
15613
  await this.ensureHydrated();
15334
15614
  const records = [...this.cache.values()].map((e) => e.record);
15335
- if (!locale) return records;
15615
+ if (!this.hasReadTransforms()) return records;
15336
15616
  return Promise.all(records.map((r) => this.applyLocaleToRecord(r, locale)));
15337
15617
  }
15618
+ /**
15619
+ * @internal — whether any read-side record transform is registered
15620
+ * (money decode, i18nText resolution, dictKey labels). Gates the
15621
+ * no-transform fast path in {@link list}.
15622
+ */
15623
+ hasReadTransforms() {
15624
+ return this.moneyFields !== void 0 && Object.keys(this.moneyFields).length > 0 || this.i18nFields !== void 0 && Object.keys(this.i18nFields).length > 0 || this.dictKeyFields !== void 0 && Object.keys(this.dictKeyFields).length > 0;
15625
+ }
15338
15626
  // ─── Bulk operations ─────────────────────────────────────
15339
15627
  /**
15340
15628
  * Put many records in one call. Each item is processed sequentially
@@ -15840,7 +16128,8 @@ var Collection = class {
15840
16128
  pageSize,
15841
16129
  [],
15842
16130
  [],
15843
- joinContext
16131
+ joinContext,
16132
+ this.moneyFields
15844
16133
  );
15845
16134
  }
15846
16135
  /** Decrypt a page of envelopes returned by `adapter.listPage`. */
@@ -17064,7 +17353,165 @@ var OverlayedCollection = class {
17064
17353
  // src/vault.ts
17065
17354
  init_errors();
17066
17355
  init_errors();
17067
- init_constants();
17356
+
17357
+ // src/numbering/index.ts
17358
+ init_types();
17359
+ init_crypto();
17360
+ init_errors();
17361
+ var NUMBERING_HEAD_COLLECTION = "_numbering_head";
17362
+ var NUMBERING_PENDING_COLLECTION = "_numbering_pending";
17363
+ var DeferredNumberingStore = class {
17364
+ adapter;
17365
+ vault;
17366
+ encrypted;
17367
+ getDEK;
17368
+ actor;
17369
+ configs;
17370
+ /**
17371
+ * Stamp a serial onto a USER record THROUGH the Collection layer (so the
17372
+ * cache, indexes, and MVs stay coherent — the engine must NOT write user
17373
+ * collections at the raw adapter level). Returns false if the record is
17374
+ * gone (the engine then skips it without burning a serial). Provided by the
17375
+ * vault; unit tests pass a Map-backed double.
17376
+ */
17377
+ stamp;
17378
+ /** In-process registry: `${series}::${recordId}` → resolver for the live next() Promise. */
17379
+ waiters = /* @__PURE__ */ new Map();
17380
+ dekCache = /* @__PURE__ */ new Map();
17381
+ constructor(opts) {
17382
+ this.adapter = opts.adapter;
17383
+ this.vault = opts.vault;
17384
+ this.encrypted = opts.encrypted;
17385
+ this.getDEK = opts.getDEK;
17386
+ this.actor = opts.actor;
17387
+ this.configs = opts.configs;
17388
+ this.stamp = opts.stamp;
17389
+ }
17390
+ has(series) {
17391
+ return this.configs.has(series);
17392
+ }
17393
+ dek(collection) {
17394
+ let p = this.dekCache.get(collection);
17395
+ if (!p) {
17396
+ p = this.getDEK(collection);
17397
+ this.dekCache.set(collection, p);
17398
+ }
17399
+ return p;
17400
+ }
17401
+ async readJson(collection, id) {
17402
+ const env = await this.adapter.get(this.vault, collection, id);
17403
+ if (!env) return { env: null, value: null };
17404
+ const json = this.encrypted ? await decrypt(env._iv, env._data, await this.dek(collection)) : env._data;
17405
+ return { env, value: JSON.parse(json) };
17406
+ }
17407
+ async writeJson(collection, id, value, expectedVersion) {
17408
+ const json = JSON.stringify(value);
17409
+ let env;
17410
+ if (!this.encrypted) {
17411
+ env = { _noydb: NOYDB_FORMAT_VERSION, _v: expectedVersion + 1, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: "", _data: json, _by: this.actor };
17412
+ } else {
17413
+ const { iv, data } = await encrypt(json, await this.dek(collection));
17414
+ env = { _noydb: NOYDB_FORMAT_VERSION, _v: expectedVersion + 1, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: iv, _data: data, _by: this.actor };
17415
+ }
17416
+ await this.adapter.put(this.vault, collection, id, env, expectedVersion);
17417
+ }
17418
+ pendingId(series, recordId3) {
17419
+ return `${series}::${recordId3}`;
17420
+ }
17421
+ /** Current last-assigned serial for a series (0 if none). */
17422
+ async peek(series) {
17423
+ const { value } = await this.readJson(NUMBERING_HEAD_COLLECTION, series);
17424
+ return value?.lastSerial ?? 0;
17425
+ }
17426
+ /**
17427
+ * Enqueue a record for numbering: stamp it with the current store clock and
17428
+ * durably write a pending entry. The returned Promise resolves once the
17429
+ * record is durably enqueued; its `assigned` field resolves with the serial
17430
+ * at the next pass (the record's `field` is the durable source of truth —
17431
+ * `assigned` is an in-process convenience that a crash may drop).
17432
+ */
17433
+ async enqueue(series, recordId3) {
17434
+ const cfg = this.configs.get(series);
17435
+ if (!cfg) throw new NumberingUncertaintyError(series);
17436
+ if (typeof this.adapter.getStoreTime !== "function") throw new NumberingUncertaintyError(series);
17437
+ const st = await this.adapter.getStoreTime();
17438
+ const id = this.pendingId(series, recordId3);
17439
+ const { env } = await this.readJson(NUMBERING_PENDING_COLLECTION, id);
17440
+ const entry = {
17441
+ series,
17442
+ recordId: recordId3,
17443
+ collection: cfg.collection,
17444
+ field: cfg.field,
17445
+ storeEarliest: st.earliest,
17446
+ storeLatest: st.latest,
17447
+ enqueuedAt: Date.now()
17448
+ };
17449
+ await this.writeJson(NUMBERING_PENDING_COLLECTION, id, entry, env?._v ?? 0);
17450
+ const assigned = new Promise((resolve, reject) => {
17451
+ this.waiters.set(id, { resolve, reject });
17452
+ });
17453
+ return { assigned };
17454
+ }
17455
+ async listPending(series) {
17456
+ const ids = await this.adapter.list(this.vault, NUMBERING_PENDING_COLLECTION);
17457
+ const prefix = `${series}::`;
17458
+ const out = [];
17459
+ for (const id of ids) {
17460
+ if (!id.startsWith(prefix)) continue;
17461
+ const { value } = await this.readJson(NUMBERING_PENDING_COLLECTION, id);
17462
+ if (value) out.push({ id, entry: value });
17463
+ }
17464
+ return out;
17465
+ }
17466
+ /**
17467
+ * Run a numbering pass for `series`: select entries provably settled
17468
+ * (`storeLatest ≤ now.earliest` — commit-wait), order by
17469
+ * `(storeEarliest, recordId)`, assign serials after the head, stamp each
17470
+ * record's field, advance the head with one CAS, and consume the entries.
17471
+ * Idempotent/convergent: a losing concurrent pass returns `[]` and the next
17472
+ * pass reconciles. Resolves any in-process enqueue() `assigned` Promises.
17473
+ */
17474
+ async runPass(series) {
17475
+ const cfg = this.configs.get(series);
17476
+ if (!cfg) throw new NumberingUncertaintyError(series);
17477
+ if (typeof this.adapter.getStoreTime !== "function") throw new NumberingUncertaintyError(series);
17478
+ const now = await this.adapter.getStoreTime();
17479
+ const settled = (await this.listPending(series)).filter((p) => p.entry.storeLatest <= now.earliest).sort(
17480
+ (a, b) => a.entry.storeEarliest - b.entry.storeEarliest || (a.entry.recordId < b.entry.recordId ? -1 : a.entry.recordId > b.entry.recordId ? 1 : 0)
17481
+ );
17482
+ if (settled.length === 0) return [];
17483
+ const { env: headEnv, value: head } = await this.readJson(NUMBERING_HEAD_COLLECTION, series);
17484
+ let serial = head?.lastSerial ?? 0;
17485
+ const assignments = [];
17486
+ for (const { entry } of settled) {
17487
+ serial += 1;
17488
+ const ok = await this.stamp(entry.collection, entry.recordId, entry.field, serial);
17489
+ if (!ok) {
17490
+ serial -= 1;
17491
+ continue;
17492
+ }
17493
+ assignments.push({ recordId: entry.recordId, serial });
17494
+ }
17495
+ try {
17496
+ await this.writeJson(NUMBERING_HEAD_COLLECTION, series, { series, lastSerial: serial, watermark: now.earliest }, headEnv?._v ?? 0);
17497
+ } catch (err) {
17498
+ if (err instanceof ConflictError) return [];
17499
+ throw err;
17500
+ }
17501
+ for (const { id, entry } of settled) {
17502
+ await this.adapter.delete(this.vault, NUMBERING_PENDING_COLLECTION, id);
17503
+ const a = assignments.find((x) => x.recordId === entry.recordId);
17504
+ if (a) {
17505
+ this.waiters.get(id)?.resolve(a.serial);
17506
+ this.waiters.delete(id);
17507
+ }
17508
+ }
17509
+ return assignments;
17510
+ }
17511
+ };
17512
+
17513
+ // src/vault.ts
17514
+ init_constants2();
17068
17515
  init_entry();
17069
17516
 
17070
17517
  // src/shadow/strategy.ts
@@ -18495,6 +18942,10 @@ var Vault = class {
18495
18942
  ledgerStore = null;
18496
18943
  /** Lazily-built atomic-sequence store. See {@link sequence}. */
18497
18944
  sequenceStore = null;
18945
+ /** Lazily-built deferred-numbering engine. See {@link runNumberingPass}. */
18946
+ deferredNumbering = null;
18947
+ /** Registered deferred-numbering series, keyed by series name. */
18948
+ numberingConfigs;
18498
18949
  /**
18499
18950
  * Background writes for persisted-schema envelopes (#schema-dump v0
18500
18951
  * slice 1). One promise per `collection({ persistJsonSchema: true })`
@@ -18581,6 +19032,7 @@ var Vault = class {
18581
19032
  constructor(opts) {
18582
19033
  this.adapter = opts.adapter;
18583
19034
  this.name = opts.name;
19035
+ this.numberingConfigs = new Map((opts.numberingConfigs ?? []).map((c) => [c.series, c]));
18584
19036
  this.noydb = opts.noydb;
18585
19037
  this.keyring = opts.keyring;
18586
19038
  this.encrypted = opts.encrypted;
@@ -19255,6 +19707,18 @@ var Vault = class {
19255
19707
  * ```
19256
19708
  */
19257
19709
  sequence(name) {
19710
+ if (this.numberingConfigs.has(name)) {
19711
+ const eng = this.deferred();
19712
+ return {
19713
+ next: async (opts) => {
19714
+ if (!opts?.for) {
19715
+ throw new ValidationError(`sequence("${name}") is a deferred-numbering series; call next({ for: recordId }).`);
19716
+ }
19717
+ return (await eng.enqueue(name, opts.for)).assigned;
19718
+ },
19719
+ peek: () => eng.peek(name)
19720
+ };
19721
+ }
19258
19722
  if (!this.sequenceStore) {
19259
19723
  this.sequenceStore = new SequenceStore({
19260
19724
  adapter: this.adapter,
@@ -19266,6 +19730,38 @@ var Vault = class {
19266
19730
  }
19267
19731
  return this.sequenceStore.handle(name);
19268
19732
  }
19733
+ /** @internal — lazily build the deferred-numbering engine with a cache-coherent stamp. */
19734
+ deferred() {
19735
+ if (!this.deferredNumbering) {
19736
+ this.deferredNumbering = new DeferredNumberingStore({
19737
+ adapter: this.adapter,
19738
+ vault: this.name,
19739
+ encrypted: this.encrypted,
19740
+ getDEK: this.getDEK,
19741
+ actor: this.keyring.userId,
19742
+ configs: this.numberingConfigs,
19743
+ // Stamp THROUGH the Collection layer so cache/indexes/MVs stay coherent —
19744
+ // `this.collection(name)` returns the shared cached instance, so a
19745
+ // subsequent user `collection.get(id)` sees the assigned serial.
19746
+ stamp: async (collection, recordId3, field, serial) => {
19747
+ const coll = this.collection(collection);
19748
+ const rec = await coll.get(recordId3);
19749
+ if (!rec) return false;
19750
+ await coll.put(recordId3, { ...rec, [field]: serial });
19751
+ return true;
19752
+ }
19753
+ });
19754
+ }
19755
+ return this.deferredNumbering;
19756
+ }
19757
+ /**
19758
+ * Run a deferred-numbering pass for `series`: assign gap-free serials to all
19759
+ * records whose store-commit-time interval has settled, in store-time order.
19760
+ * Returns the assignments made. See {@link sequence} / `withDeferredNumbering`.
19761
+ */
19762
+ async runNumberingPass(series) {
19763
+ return this.deferred().runPass(series);
19764
+ }
19269
19765
  async compact(options = {}) {
19270
19766
  return runCompaction({
19271
19767
  adapter: this.adapter,
@@ -22329,6 +22825,7 @@ var Noydb = class {
22329
22825
  ...this.options.i18nStrategy !== void 0 ? { i18nStrategy: this.options.i18nStrategy } : {},
22330
22826
  ...this.options.syncStrategy !== void 0 ? { syncStrategy: this.options.syncStrategy } : {},
22331
22827
  ...this.options.guardStrategies !== void 0 ? { guardStrategies: this.options.guardStrategies } : {},
22828
+ ...this.options.numbering !== void 0 ? { numberingConfigs: this.options.numbering } : {},
22332
22829
  locale: opts?.locale,
22333
22830
  // Thread the translator hook so Collection.put() can invoke it
22334
22831
  plaintextTranslator: this.options.plaintextTranslator ? (text, from, to, field, collection) => this.invokeTranslator(text, from, to, field, collection) : void 0,
@@ -22382,7 +22879,8 @@ var Noydb = class {
22382
22879
  ...this.options.historyStrategy !== void 0 ? { historyStrategy: this.options.historyStrategy } : {},
22383
22880
  ...this.options.i18nStrategy !== void 0 ? { i18nStrategy: this.options.i18nStrategy } : {},
22384
22881
  ...this.options.syncStrategy !== void 0 ? { syncStrategy: this.options.syncStrategy } : {},
22385
- ...this.options.guardStrategies !== void 0 ? { guardStrategies: this.options.guardStrategies } : {}
22882
+ ...this.options.guardStrategies !== void 0 ? { guardStrategies: this.options.guardStrategies } : {},
22883
+ ...this.options.numbering !== void 0 ? { numberingConfigs: this.options.numbering } : {}
22386
22884
  });
22387
22885
  this.vaultCache.set(name, comp2);
22388
22886
  return comp2;
@@ -22412,6 +22910,7 @@ var Noydb = class {
22412
22910
  ...this.options.i18nStrategy !== void 0 ? { i18nStrategy: this.options.i18nStrategy } : {},
22413
22911
  ...this.options.syncStrategy !== void 0 ? { syncStrategy: this.options.syncStrategy } : {},
22414
22912
  ...this.options.guardStrategies !== void 0 ? { guardStrategies: this.options.guardStrategies } : {},
22913
+ ...this.options.numbering !== void 0 ? { numberingConfigs: this.options.numbering } : {},
22415
22914
  emitter: this.emitter
22416
22915
  });
22417
22916
  this.vaultCache.set(name, comp);
@@ -22730,10 +23229,39 @@ var Noydb = class {
22730
23229
  */
22731
23230
  async openVaultGroup(name, opts) {
22732
23231
  if (this.closed) throw new ValidationError("Instance is closed");
23232
+ if (name === STATE_VAULT_NAME) throw new ReservedVaultNameError(name);
22733
23233
  const template = this.vaultTemplates.get(opts.sharding.vaultTemplate);
22734
23234
  if (!template) throw new VaultTemplateNotFoundError(opts.sharding.vaultTemplate);
22735
23235
  const { VaultGroup: VaultGroup2 } = await Promise.resolve().then(() => (init_vault_group(), vault_group_exports));
22736
- return new VaultGroup2(this, name, opts.registry, opts.sharding, template);
23236
+ const { StateManagementVault: StateManagementVault2 } = await Promise.resolve().then(() => (init_state_vault(), state_vault_exports));
23237
+ const stateVault = opts.registry ? void 0 : await StateManagementVault2.open(this);
23238
+ const registry = opts.registry ?? stateVault.registry;
23239
+ const group = new VaultGroup2(this, name, registry, opts.sharding, template);
23240
+ if (stateVault) {
23241
+ group._attachStateVault(stateVault);
23242
+ await stateVault.recordManifest(opts.sharding.vaultTemplate, template);
23243
+ try {
23244
+ await stateVault.appendEvent({
23245
+ type: "manifest-recorded",
23246
+ group: name,
23247
+ templateName: opts.sharding.vaultTemplate,
23248
+ version: template.version
23249
+ });
23250
+ await stateVault.appendEvent({ type: "group-opened", group: name });
23251
+ } catch {
23252
+ }
23253
+ }
23254
+ return group;
23255
+ }
23256
+ /**
23257
+ * Open the reserved StateManagement control-plane vault (registry +
23258
+ * schema-manifest + deployment-events). Lazy-loaded so the federation
23259
+ * chunk stays out of the core graph until used.
23260
+ */
23261
+ async openStateManagementVault() {
23262
+ if (this.closed) throw new ValidationError("Instance is closed");
23263
+ const { StateManagementVault: StateManagementVault2 } = await Promise.resolve().then(() => (init_state_vault(), state_vault_exports));
23264
+ return StateManagementVault2.open(this);
22737
23265
  }
22738
23266
  /**
22739
23267
  * @internal — true when an encrypted shard vault is provisioned
@@ -26074,6 +26602,7 @@ function shortJSON(value) {
26074
26602
  NotFoundError,
26075
26603
  Noydb,
26076
26604
  NoydbError,
26605
+ NumberingUncertaintyError,
26077
26606
  OverlayBaseIsVirtualError,
26078
26607
  OverlayCollectionUnavailableError,
26079
26608
  OverlayIdMismatchError,
@@ -26103,8 +26632,10 @@ function shortJSON(value) {
26103
26632
  RefRegistry,
26104
26633
  RefScopeError,
26105
26634
  ReservedCollectionNameError,
26635
+ ReservedVaultNameError,
26106
26636
  SCHEMAS_COLLECTION,
26107
26637
  SEALED_PASSPHRASE_RECORD_ID,
26638
+ STATE_VAULT_NAME,
26108
26639
  STRICT_POLICY,
26109
26640
  SYNC_CREDENTIALS_COLLECTION,
26110
26641
  ScanBuilder,
@@ -26316,6 +26847,7 @@ function shortJSON(value) {
26316
26847
  withArchive,
26317
26848
  withCache,
26318
26849
  withCircuitBreaker,
26850
+ withDeferredNumbering,
26319
26851
  withDerivation,
26320
26852
  withGuard,
26321
26853
  withHealthCheck,