@noy-db/hub 0.2.0-pre.26 → 0.2.0-pre.28

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 (182) hide show
  1. package/dist/aggregate/index.cjs +7 -0
  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 +2 -2
  6. package/dist/attestation/index.cjs.map +1 -1
  7. package/dist/attestation/index.d.cts +3 -3
  8. package/dist/attestation/index.d.ts +3 -3
  9. package/dist/attestation/index.js +4 -4
  10. package/dist/blobs/index.cjs.map +1 -1
  11. package/dist/blobs/index.d.cts +5 -5
  12. package/dist/blobs/index.d.ts +5 -5
  13. package/dist/blobs/index.js +4 -4
  14. package/dist/bundle/index.cjs +403 -149
  15. package/dist/bundle/index.cjs.map +1 -1
  16. package/dist/bundle/index.d.cts +5 -5
  17. package/dist/bundle/index.d.ts +5 -5
  18. package/dist/bundle/index.js +8 -8
  19. package/dist/{chunk-PS6PSEZL.js → chunk-2M62POB5.js} +3 -3
  20. package/dist/{chunk-C7UIT5XY.js → chunk-345PYZD6.js} +2 -2
  21. package/dist/{chunk-56ENKU46.js → chunk-3LHTFCU2.js} +186 -161
  22. package/dist/chunk-3LHTFCU2.js.map +1 -0
  23. package/dist/{chunk-ANLOD6IS.js → chunk-42EGY2FQ.js} +3 -3
  24. package/dist/{chunk-KJ37E3R5.js → chunk-4FHKQDHN.js} +2 -2
  25. package/dist/{chunk-KD253AI5.js → chunk-6LD37AMK.js} +22 -3
  26. package/dist/chunk-6LD37AMK.js.map +1 -0
  27. package/dist/{chunk-EYZJULEN.js → chunk-7GKDVWMD.js} +2 -2
  28. package/dist/{chunk-N4EXCKWP.js → chunk-7TBCLM52.js} +2 -2
  29. package/dist/{chunk-VJNV2GRF.js → chunk-AHDQYG7P.js} +3 -3
  30. package/dist/{chunk-ZCBJIDT4.js → chunk-DCYWBKQ2.js} +2 -2
  31. package/dist/{chunk-Y5CTT6K5.js → chunk-DMWUOV7X.js} +2 -2
  32. package/dist/{chunk-RZOGD7IF.js → chunk-DQ6XF2K2.js} +6 -6
  33. package/dist/{chunk-OCRDV3NU.js → chunk-ENC4C6XW.js} +3 -3
  34. package/dist/{chunk-FCIZXX56.js → chunk-GVEUI7VR.js} +2 -2
  35. package/dist/{chunk-WVYL6HM7.js → chunk-HI7FY7QZ.js} +2 -2
  36. package/dist/{chunk-JJKXJAH2.js → chunk-HQ242WNG.js} +3 -3
  37. package/dist/{chunk-GHXOVGTX.js → chunk-IMY4FXYE.js} +3 -3
  38. package/dist/{chunk-YP2AYE5W.js → chunk-JEQB2KVI.js} +2 -2
  39. package/dist/chunk-M2VZQ24Q.js +220 -0
  40. package/dist/chunk-M2VZQ24Q.js.map +1 -0
  41. package/dist/{chunk-HUXDQIVU.js → chunk-PPF7Z2YQ.js} +2 -2
  42. package/dist/{chunk-2RHBFCWQ.js → chunk-QBC2TZHC.js} +3 -3
  43. package/dist/{chunk-LR7CODVN.js → chunk-QSLIT4JZ.js} +1 -1
  44. package/dist/chunk-QSLIT4JZ.js.map +1 -0
  45. package/dist/{chunk-TSUICI5N.js → chunk-RG5KLMEU.js} +2 -2
  46. package/dist/{chunk-GPZHHTJU.js → chunk-SWGVCSIY.js} +2 -2
  47. package/dist/{chunk-UNBX2HMA.js → chunk-VSL3W2MO.js} +2 -2
  48. package/dist/{chunk-VGAN5RLD.js → chunk-WH7G2YEE.js} +2 -2
  49. package/dist/{chunk-QYQRAOEF.js → chunk-YYLFXX2K.js} +2 -2
  50. package/dist/consent/index.d.cts +4 -4
  51. package/dist/consent/index.d.ts +4 -4
  52. package/dist/{decrypt-partition-CyyJUWLR.d.ts → decrypt-partition-BtGtE-19.d.ts} +1 -1
  53. package/dist/{decrypt-partition-C71vhnND.d.cts → decrypt-partition-Cqi5gcOl.d.cts} +1 -1
  54. package/dist/derivations/index.d.cts +5 -5
  55. package/dist/derivations/index.d.ts +5 -5
  56. package/dist/{dev-unlock-BdrE0kbS.d.cts → dev-unlock-Cts_iiVv.d.cts} +1 -1
  57. package/dist/{dev-unlock-ByBkl99-.d.ts → dev-unlock-D0p9cQzN.d.ts} +1 -1
  58. package/dist/{executor-BIW4FT5R.js → executor-PJHMRZWJ.js} +4 -4
  59. package/dist/{fanout-sidecar-ZQT4Y7PF.js → fanout-sidecar-DSBVAR2P.js} +2 -2
  60. package/dist/forget/index.js +2 -2
  61. package/dist/guards/index.d.cts +5 -5
  62. package/dist/guards/index.d.ts +5 -5
  63. package/dist/{hash-CZxVv8RH.d.ts → hash-BtDtwguU.d.ts} +1 -1
  64. package/dist/{hash-BUkDp_8Q.d.cts → hash-DA75XwW2.d.cts} +1 -1
  65. package/dist/history/index.cjs.map +1 -1
  66. package/dist/history/index.d.cts +5 -5
  67. package/dist/history/index.d.ts +5 -5
  68. package/dist/history/index.js +3 -3
  69. package/dist/i18n/index.cjs +98 -1
  70. package/dist/i18n/index.cjs.map +1 -1
  71. package/dist/i18n/index.d.cts +4 -4
  72. package/dist/i18n/index.d.ts +4 -4
  73. package/dist/i18n/index.js +83 -4
  74. package/dist/i18n/index.js.map +1 -1
  75. package/dist/{index-DFhKV-6A.d.ts → index-BidHvmWf.d.ts} +3 -3
  76. package/dist/{index-CBUhOmrM.d.cts → index-CP24aYCp.d.cts} +3 -3
  77. package/dist/{index-DoxKSsMj.d.cts → index-CVnt2Qmq.d.cts} +1 -1
  78. package/dist/{index-LaexBi3v.d.ts → index-DxBNV54L.d.ts} +1 -1
  79. package/dist/index.cjs +411 -146
  80. package/dist/index.cjs.map +1 -1
  81. package/dist/index.d.cts +14 -14
  82. package/dist/index.d.ts +14 -14
  83. package/dist/index.js +24 -23
  84. package/dist/index.js.map +1 -1
  85. package/dist/{issue-LEBPVF3Y.js → issue-JSGGSVY4.js} +4 -4
  86. package/dist/kernel/index.cjs +61 -0
  87. package/dist/kernel/index.cjs.map +1 -1
  88. package/dist/kernel/index.d.cts +4 -4
  89. package/dist/kernel/index.d.ts +4 -4
  90. package/dist/kernel/index.js +9 -2
  91. package/dist/{ledger-FLRTSOYH.js → ledger-PLMSH7LD.js} +3 -3
  92. package/dist/materialized-views/index.cjs +7 -0
  93. package/dist/materialized-views/index.cjs.map +1 -1
  94. package/dist/materialized-views/index.d.cts +5 -5
  95. package/dist/materialized-views/index.d.ts +5 -5
  96. package/dist/materialized-views/index.js +4 -4
  97. package/dist/{mime-magic-C1UbcBxP.d.ts → mime-magic--NcogI82.d.ts} +1 -1
  98. package/dist/{mime-magic-BAhLjkHw.d.cts → mime-magic-i2VSlkPM.d.cts} +1 -1
  99. package/dist/noydb-PHXA5E6I.js +39 -0
  100. package/dist/overlay-views/index.d.cts +5 -5
  101. package/dist/overlay-views/index.d.ts +5 -5
  102. package/dist/periods/index.cjs.map +1 -1
  103. package/dist/periods/index.d.cts +4 -4
  104. package/dist/periods/index.d.ts +4 -4
  105. package/dist/periods/index.js +3 -3
  106. package/dist/{public-envelope-DBKJEBBF.js → public-envelope-7MTH2PVE.js} +3 -3
  107. package/dist/query/index.cjs +7 -0
  108. package/dist/query/index.cjs.map +1 -1
  109. package/dist/query/index.d.cts +2 -2
  110. package/dist/query/index.d.ts +2 -2
  111. package/dist/query/index.js +3 -3
  112. package/dist/{revoke-P5D3UTRX.js → revoke-DBAGKIDA.js} +4 -4
  113. package/dist/session/index.d.cts +5 -5
  114. package/dist/session/index.d.ts +5 -5
  115. package/dist/shadow/index.d.cts +4 -4
  116. package/dist/shadow/index.d.ts +4 -4
  117. package/dist/{signer-NEQPCHMW.js → signer-ADFJNS5W.js} +3 -3
  118. package/dist/snapshots/index.d.cts +4 -4
  119. package/dist/snapshots/index.d.ts +4 -4
  120. package/dist/snapshots/index.js +3 -3
  121. package/dist/{stale-KKCHF2VB.js → stale-BCIE3SMC.js} +2 -2
  122. package/dist/store/index.d.cts +4 -4
  123. package/dist/store/index.d.ts +4 -4
  124. package/dist/{strategy-YQ1qJWyq.d.ts → strategy-BoITAb2H.d.ts} +20 -1
  125. package/dist/{strategy-D1zjEV3n.d.cts → strategy-DDNvt_UD.d.cts} +20 -1
  126. package/dist/sync/index.cjs.map +1 -1
  127. package/dist/sync/index.d.cts +3 -3
  128. package/dist/sync/index.d.ts +3 -3
  129. package/dist/sync/index.js +2 -2
  130. package/dist/team/index.cjs.map +1 -1
  131. package/dist/team/index.d.cts +4 -4
  132. package/dist/team/index.d.ts +4 -4
  133. package/dist/team/index.js +5 -5
  134. package/dist/{transition-guard-BSLdikC_.d.ts → transition-guard-BZhOlrFT.d.ts} +1 -1
  135. package/dist/{transition-guard-DPs6al8h.d.cts → transition-guard-Bekgaxux.d.cts} +1 -1
  136. package/dist/tx/index.d.cts +4 -4
  137. package/dist/tx/index.d.ts +4 -4
  138. package/dist/{types-CCq0WHh9.d.ts → types-84nsWSDF.d.ts} +182 -11
  139. package/dist/{types-BCYvhKzr.d.cts → types-B_eCkuEI.d.cts} +182 -11
  140. package/dist/{with-materialized-view-DiD41wQp.d.ts → with-materialized-view-CAMGQroY.d.ts} +1 -1
  141. package/dist/{with-materialized-view-CTHe6uh9.d.cts → with-materialized-view-DKMaZmkJ.d.cts} +1 -1
  142. package/dist/{with-overlayed-view-Dlz5hcM8.d.cts → with-overlayed-view--lWXImbV.d.cts} +1 -1
  143. package/dist/{with-overlayed-view-DlbsJMhF.d.ts → with-overlayed-view-FnOf1v6H.d.ts} +1 -1
  144. package/dist/{with-rollup-BBWdrCvu.d.cts → with-rollup-C5875Ad5.d.cts} +1 -1
  145. package/dist/{with-rollup-mT4_CWaU.d.ts → with-rollup-xi-mkY6Y.d.ts} +1 -1
  146. package/package.json +3 -3
  147. package/dist/chunk-56ENKU46.js.map +0 -1
  148. package/dist/chunk-KD253AI5.js.map +0 -1
  149. package/dist/chunk-LR7CODVN.js.map +0 -1
  150. package/dist/noydb-6FA46A4M.js +0 -38
  151. /package/dist/{chunk-PS6PSEZL.js.map → chunk-2M62POB5.js.map} +0 -0
  152. /package/dist/{chunk-C7UIT5XY.js.map → chunk-345PYZD6.js.map} +0 -0
  153. /package/dist/{chunk-ANLOD6IS.js.map → chunk-42EGY2FQ.js.map} +0 -0
  154. /package/dist/{chunk-KJ37E3R5.js.map → chunk-4FHKQDHN.js.map} +0 -0
  155. /package/dist/{chunk-EYZJULEN.js.map → chunk-7GKDVWMD.js.map} +0 -0
  156. /package/dist/{chunk-N4EXCKWP.js.map → chunk-7TBCLM52.js.map} +0 -0
  157. /package/dist/{chunk-VJNV2GRF.js.map → chunk-AHDQYG7P.js.map} +0 -0
  158. /package/dist/{chunk-ZCBJIDT4.js.map → chunk-DCYWBKQ2.js.map} +0 -0
  159. /package/dist/{chunk-Y5CTT6K5.js.map → chunk-DMWUOV7X.js.map} +0 -0
  160. /package/dist/{chunk-RZOGD7IF.js.map → chunk-DQ6XF2K2.js.map} +0 -0
  161. /package/dist/{chunk-OCRDV3NU.js.map → chunk-ENC4C6XW.js.map} +0 -0
  162. /package/dist/{chunk-FCIZXX56.js.map → chunk-GVEUI7VR.js.map} +0 -0
  163. /package/dist/{chunk-WVYL6HM7.js.map → chunk-HI7FY7QZ.js.map} +0 -0
  164. /package/dist/{chunk-JJKXJAH2.js.map → chunk-HQ242WNG.js.map} +0 -0
  165. /package/dist/{chunk-GHXOVGTX.js.map → chunk-IMY4FXYE.js.map} +0 -0
  166. /package/dist/{chunk-YP2AYE5W.js.map → chunk-JEQB2KVI.js.map} +0 -0
  167. /package/dist/{chunk-HUXDQIVU.js.map → chunk-PPF7Z2YQ.js.map} +0 -0
  168. /package/dist/{chunk-2RHBFCWQ.js.map → chunk-QBC2TZHC.js.map} +0 -0
  169. /package/dist/{chunk-TSUICI5N.js.map → chunk-RG5KLMEU.js.map} +0 -0
  170. /package/dist/{chunk-GPZHHTJU.js.map → chunk-SWGVCSIY.js.map} +0 -0
  171. /package/dist/{chunk-UNBX2HMA.js.map → chunk-VSL3W2MO.js.map} +0 -0
  172. /package/dist/{chunk-VGAN5RLD.js.map → chunk-WH7G2YEE.js.map} +0 -0
  173. /package/dist/{chunk-QYQRAOEF.js.map → chunk-YYLFXX2K.js.map} +0 -0
  174. /package/dist/{executor-BIW4FT5R.js.map → executor-PJHMRZWJ.js.map} +0 -0
  175. /package/dist/{fanout-sidecar-ZQT4Y7PF.js.map → fanout-sidecar-DSBVAR2P.js.map} +0 -0
  176. /package/dist/{issue-LEBPVF3Y.js.map → issue-JSGGSVY4.js.map} +0 -0
  177. /package/dist/{ledger-FLRTSOYH.js.map → ledger-PLMSH7LD.js.map} +0 -0
  178. /package/dist/{noydb-6FA46A4M.js.map → noydb-PHXA5E6I.js.map} +0 -0
  179. /package/dist/{public-envelope-DBKJEBBF.js.map → public-envelope-7MTH2PVE.js.map} +0 -0
  180. /package/dist/{revoke-P5D3UTRX.js.map → revoke-DBAGKIDA.js.map} +0 -0
  181. /package/dist/{signer-NEQPCHMW.js.map → signer-ADFJNS5W.js.map} +0 -0
  182. /package/dist/{stale-KKCHF2VB.js.map → stale-BCIE3SMC.js.map} +0 -0
@@ -1,3 +1,8 @@
1
+ import {
2
+ StoreCoordinationProvider,
3
+ loadFence,
4
+ runDrainBarrier
5
+ } from "./chunk-M2VZQ24Q.js";
1
6
  import {
2
7
  resolveSchema
3
8
  } from "./chunk-EMIGCR7X.js";
@@ -17,12 +22,12 @@ import {
17
22
  decodeMoneyFields,
18
23
  quantizeMoneyFields,
19
24
  validateMoneyFieldPaths
20
- } from "./chunk-PS6PSEZL.js";
25
+ } from "./chunk-2M62POB5.js";
21
26
  import {
22
27
  EXPORT_AUDIT_COLLECTION,
23
28
  createExportBlobsHandle,
24
29
  runCompaction
25
- } from "./chunk-ZCBJIDT4.js";
30
+ } from "./chunk-DCYWBKQ2.js";
26
31
  import {
27
32
  LazyQuery,
28
33
  decodeIdxId,
@@ -30,7 +35,7 @@ import {
30
35
  } from "./chunk-H4XFA2LM.js";
31
36
  import {
32
37
  canonicalGroupKey
33
- } from "./chunk-C7UIT5XY.js";
38
+ } from "./chunk-345PYZD6.js";
34
39
  import {
35
40
  readPath
36
41
  } from "./chunk-3BANVNDH.js";
@@ -40,16 +45,16 @@ import {
40
45
  resolveManagedSecret,
41
46
  savePersistedSchema,
42
47
  saveSealedPassphrase
43
- } from "./chunk-YP2AYE5W.js";
48
+ } from "./chunk-JEQB2KVI.js";
44
49
  import {
45
50
  writeNoydbBundle
46
- } from "./chunk-N4EXCKWP.js";
51
+ } from "./chunk-7TBCLM52.js";
47
52
  import {
48
53
  loadPublicEnvelope,
49
54
  readPublicEnvelope,
50
55
  savePublicEnvelope,
51
56
  validatePublicEnvelopeInput
52
- } from "./chunk-HUXDQIVU.js";
57
+ } from "./chunk-PPF7Z2YQ.js";
53
58
  import {
54
59
  buildTombstone,
55
60
  isTombstone,
@@ -58,19 +63,20 @@ import {
58
63
  rewrapBodyToDek,
59
64
  rotateRecordCek,
60
65
  sealRecordToHost
61
- } from "./chunk-Y5CTT6K5.js";
66
+ } from "./chunk-DMWUOV7X.js";
62
67
  import {
63
68
  PERIODS_COLLECTION
64
- } from "./chunk-FCIZXX56.js";
69
+ } from "./chunk-GVEUI7VR.js";
65
70
  import {
66
71
  isDictCollectionName,
67
72
  isStaticDictDescriptor
68
- } from "./chunk-JJKXJAH2.js";
73
+ } from "./chunk-HQ242WNG.js";
69
74
  import {
70
75
  getAtPath,
71
76
  resolvePolicy,
72
- setAtPathInPlace
73
- } from "./chunk-KD253AI5.js";
77
+ setAtPathInPlace,
78
+ stripI18nFilled
79
+ } from "./chunk-6LD37AMK.js";
74
80
  import {
75
81
  ManagedRecoveryNotEnrolledError,
76
82
  PolicyDeniedError,
@@ -92,7 +98,7 @@ import {
92
98
  saveShamirRecoveryEntries,
93
99
  updateAuthenticator,
94
100
  writeMagicLinkGrant
95
- } from "./chunk-2RHBFCWQ.js";
101
+ } from "./chunk-QBC2TZHC.js";
96
102
  import {
97
103
  assertTierAccess,
98
104
  dekKey
@@ -121,7 +127,7 @@ import {
121
127
  rotateKeys,
122
128
  saveUserEnvelope,
123
129
  updateKeyringIdentity
124
- } from "./chunk-UNBX2HMA.js";
130
+ } from "./chunk-VSL3W2MO.js";
125
131
  import {
126
132
  INDEXED_STORE_POLICY
127
133
  } from "./chunk-2QR2PQTT.js";
@@ -131,7 +137,7 @@ import {
131
137
  import {
132
138
  LEDGER_COLLECTION,
133
139
  LEDGER_DELTAS_COLLECTION
134
- } from "./chunk-EYZJULEN.js";
140
+ } from "./chunk-7GKDVWMD.js";
135
141
  import {
136
142
  sha256Hex as sha256Hex2
137
143
  } from "./chunk-PDVP3C2I.js";
@@ -143,11 +149,11 @@ import {
143
149
  readDottedPath,
144
150
  rebuildSubjectIndex,
145
151
  removeSubjectRef
146
- } from "./chunk-TSUICI5N.js";
152
+ } from "./chunk-RG5KLMEU.js";
147
153
  import {
148
154
  NOYDB_BACKUP_VERSION,
149
155
  NOYDB_FORMAT_VERSION
150
- } from "./chunk-LR7CODVN.js";
156
+ } from "./chunk-QSLIT4JZ.js";
151
157
  import {
152
158
  decrypt,
153
159
  encrypt,
@@ -179,7 +185,6 @@ import {
179
185
  NoydbError,
180
186
  NumberingUncertaintyError,
181
187
  PermissionDeniedError,
182
- QuiesceTimeoutError,
183
188
  ReadOnlyError,
184
189
  ReservedCollectionNameError,
185
190
  SchemaFenceError,
@@ -414,6 +419,11 @@ var NO_I18N = {
414
419
  enforceScript(value) {
415
420
  return { value, warnings: [] };
416
421
  },
422
+ computeExemptFills() {
423
+ return /* @__PURE__ */ new Map();
424
+ },
425
+ densify() {
426
+ },
417
427
  buildDictionaryHandle() {
418
428
  throw notEnabled("vault.dictionary()");
419
429
  }
@@ -1107,6 +1117,12 @@ var Collection = class {
1107
1117
  * Declared via the `i18nFields` collection option.
1108
1118
  */
1109
1119
  i18nFields;
1120
+ /**
1121
+ * #435 — the densify-enabled subset of {@link i18nFields} (fields whose
1122
+ * descriptor opts in via `densifyOnWrite: true`). `undefined` when none opt
1123
+ * in, so the write path skips all densify work for ordinary collections.
1124
+ */
1125
+ i18nDensifyFields;
1110
1126
  /**
1111
1127
  * Map of field name → `DictKeyDescriptor` for fields declared with
1112
1128
  * `dictKey()`. Used by `get()`/`list()` to add `<field>Label` virtual
@@ -1293,6 +1309,10 @@ var Collection = class {
1293
1309
  this.refEnforcer = opts.refEnforcer;
1294
1310
  this.joinResolver = opts.joinResolver;
1295
1311
  this.i18nFields = opts.i18nFields;
1312
+ const densifyFields = opts.i18nFields ? Object.fromEntries(
1313
+ Object.entries(opts.i18nFields).filter(([, d]) => d.options.densifyOnWrite === true)
1314
+ ) : {};
1315
+ this.i18nDensifyFields = Object.keys(densifyFields).length > 0 ? densifyFields : void 0;
1296
1316
  this.dictKeyFields = opts.dictKeyFields;
1297
1317
  if (opts.moneyFields) validateMoneyFieldPaths(opts.moneyFields);
1298
1318
  this.moneyFields = opts.moneyFields;
@@ -1466,7 +1486,7 @@ var Collection = class {
1466
1486
  }
1467
1487
  }
1468
1488
  if (this.materializedViewSource !== void 0) {
1469
- const { resolveStaleMVOnRead } = await import("./stale-KKCHF2VB.js");
1489
+ const { resolveStaleMVOnRead } = await import("./stale-BCIE3SMC.js");
1470
1490
  await resolveStaleMVOnRead(this.materializedViewSource, this.name);
1471
1491
  }
1472
1492
  let record;
@@ -1612,6 +1632,32 @@ var Collection = class {
1612
1632
  if (busAfterPut) await this.subsystemBus.dispatch("afterPut", event);
1613
1633
  }
1614
1634
  }
1635
+ /**
1636
+ * #435 — resolve the prior stored record (with its `_i18nFilled` marker) for
1637
+ * densify. Eager: in-memory cache; lazy: LRU then adapter. undefined if absent.
1638
+ */
1639
+ async resolveDensifyPrior(id) {
1640
+ if (this.lazy && this.lru) {
1641
+ const cached = this.lru.get(id);
1642
+ if (cached) return cached.record;
1643
+ const env = await this.adapter.get(this.vault, this.name, id);
1644
+ if (!env) return void 0;
1645
+ const rec = await this.decryptRecord(env);
1646
+ return rec === null ? void 0 : rec;
1647
+ }
1648
+ await this.ensureHydrated();
1649
+ return this.cache.get(id)?.record;
1650
+ }
1651
+ /**
1652
+ * #435 — densify provenance for a record: which i18n slots were auto-filled,
1653
+ * e.g. `{ name: ['en'] }`. undefined when nothing was filled. The marker is
1654
+ * stripped from ordinary reads; this is the sanctioned audit accessor.
1655
+ */
1656
+ async i18nProvenance(id) {
1657
+ const prior = await this.resolveDensifyPrior(id);
1658
+ const marker = prior?.["_i18nFilled"];
1659
+ return marker && Object.keys(marker).length > 0 ? marker : void 0;
1660
+ }
1615
1661
  /**
1616
1662
  * Validate a record against this collection's schema WITHOUT writing it.
1617
1663
  * Returns the (possibly coerced) record on success; throws
@@ -1726,6 +1772,16 @@ var Collection = class {
1726
1772
  setAtPathInPlace(obj, field, translated);
1727
1773
  }
1728
1774
  }
1775
+ let densifyPrior;
1776
+ let exemptFills;
1777
+ if (this.i18nDensifyFields) {
1778
+ densifyPrior = await this.resolveDensifyPrior(id);
1779
+ exemptFills = this.i18nStrategy.computeExemptFills(
1780
+ densifyPrior,
1781
+ record,
1782
+ this.i18nDensifyFields
1783
+ );
1784
+ }
1729
1785
  if (this.i18nFields) {
1730
1786
  const obj = record;
1731
1787
  for (const [field, descriptor] of Object.entries(this.i18nFields)) {
@@ -1733,18 +1789,38 @@ var Collection = class {
1733
1789
  for (const leaf of getAtPath(obj, field)) {
1734
1790
  if (!leaf || typeof leaf !== "object" || Array.isArray(leaf)) continue;
1735
1791
  const leafMap = leaf;
1736
- const { value: cleaned } = this.i18nStrategy.enforceScript(
1792
+ const { value: cleaned, warnings } = this.i18nStrategy.enforceScript(
1737
1793
  leafMap,
1738
1794
  field,
1739
- descriptor
1795
+ descriptor,
1796
+ exemptFills?.get(field)
1740
1797
  );
1741
1798
  if (cleaned !== leafMap) Object.assign(leafMap, cleaned);
1799
+ const mode = descriptor.options.onScriptViolation;
1800
+ if (mode === "warn" || mode === "filter") {
1801
+ for (const w of warnings) {
1802
+ this.emitter.emit("i18n:script-violation", {
1803
+ vault: this.vault,
1804
+ collection: this.name,
1805
+ id,
1806
+ mode,
1807
+ warning: w
1808
+ });
1809
+ }
1810
+ }
1742
1811
  }
1743
1812
  }
1744
1813
  }
1745
1814
  if (this.i18nPutValidator !== void 0) {
1746
1815
  this.i18nPutValidator(record);
1747
1816
  }
1817
+ if (this.i18nDensifyFields) {
1818
+ this.i18nStrategy.densify(
1819
+ record,
1820
+ densifyPrior,
1821
+ this.i18nDensifyFields
1822
+ );
1823
+ }
1748
1824
  if (this.refEnforcer !== void 0) {
1749
1825
  await this.refEnforcer.enforceRefsOnPut(this.name, record);
1750
1826
  }
@@ -1925,7 +2001,7 @@ var Collection = class {
1925
2001
  if (mode === "eager") {
1926
2002
  if (executor === null) {
1927
2003
  ;
1928
- ({ MaterializedViewExecutor: executor } = await import("./executor-BIW4FT5R.js"));
2004
+ ({ MaterializedViewExecutor: executor } = await import("./executor-PJHMRZWJ.js"));
1929
2005
  }
1930
2006
  await executor.refresh(reg, {
1931
2007
  getCollection: (name) => this.materializedViewSource.getCollection(name),
@@ -1934,7 +2010,7 @@ var Collection = class {
1934
2010
  });
1935
2011
  } else if (mode === "lazy") {
1936
2012
  if (staleHelpers === null) {
1937
- staleHelpers = await import("./stale-KKCHF2VB.js");
2013
+ staleHelpers = await import("./stale-BCIE3SMC.js");
1938
2014
  }
1939
2015
  staleHelpers.markMVStale(registry, reg.spec.name);
1940
2016
  }
@@ -2127,7 +2203,7 @@ var Collection = class {
2127
2203
  const outputCollection = this.derivationSource.getCollection(outSpec.collection);
2128
2204
  const txCtx = this.derivationSource.getActiveTxContext();
2129
2205
  if (out.kind === "array") {
2130
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-ZQT4Y7PF.js");
2206
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-DSBVAR2P.js");
2131
2207
  const prior = await loadFanoutSidecar(
2132
2208
  this.adapter,
2133
2209
  this.vault,
@@ -2490,7 +2566,7 @@ var Collection = class {
2490
2566
  for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
2491
2567
  if (outSpec.shape !== "array") continue;
2492
2568
  if (helpers === null) {
2493
- helpers = await import("./fanout-sidecar-ZQT4Y7PF.js");
2569
+ helpers = await import("./fanout-sidecar-DSBVAR2P.js");
2494
2570
  }
2495
2571
  const sidecar = await helpers.loadFanoutSidecar(
2496
2572
  this.adapter,
@@ -2530,7 +2606,7 @@ var Collection = class {
2530
2606
  if (mode === "eager") {
2531
2607
  if (executor === null) {
2532
2608
  ;
2533
- ({ MaterializedViewExecutor: executor } = await import("./executor-BIW4FT5R.js"));
2609
+ ({ MaterializedViewExecutor: executor } = await import("./executor-PJHMRZWJ.js"));
2534
2610
  }
2535
2611
  await executor.refresh(reg, {
2536
2612
  getCollection: (name) => this.materializedViewSource.getCollection(name),
@@ -2539,7 +2615,7 @@ var Collection = class {
2539
2615
  });
2540
2616
  } else if (mode === "lazy") {
2541
2617
  if (staleHelpers === null) {
2542
- staleHelpers = await import("./stale-KKCHF2VB.js");
2618
+ staleHelpers = await import("./stale-BCIE3SMC.js");
2543
2619
  }
2544
2620
  staleHelpers.markMVStale(registry, reg.spec.name);
2545
2621
  }
@@ -2562,7 +2638,7 @@ var Collection = class {
2562
2638
  );
2563
2639
  }
2564
2640
  if (this.materializedViewSource !== void 0) {
2565
- const { resolveStaleMVOnRead } = await import("./stale-KKCHF2VB.js");
2641
+ const { resolveStaleMVOnRead } = await import("./stale-BCIE3SMC.js");
2566
2642
  await resolveStaleMVOnRead(this.materializedViewSource, this.name);
2567
2643
  }
2568
2644
  await this.ensureHydrated();
@@ -2598,7 +2674,7 @@ var Collection = class {
2598
2674
  }
2599
2675
  await this.ensureHydrated();
2600
2676
  const entries = [];
2601
- for (const [id, e] of this.cache) entries.push({ id, record: e.record });
2677
+ for (const [id, e] of this.cache) entries.push({ id, record: stripI18nFilled(e.record) });
2602
2678
  return searchScan(entries, field, query, opts);
2603
2679
  }
2604
2680
  // ─── Bulk operations ─────────────────────────────────────
@@ -3512,7 +3588,7 @@ var Collection = class {
3512
3588
  const hasStaticDisplay = hasDict && this.dictKeyFields !== void 0 && Object.values(this.dictKeyFields).some(
3513
3589
  (d) => isStaticDictDescriptor(d) && d.displayLocale !== void 0
3514
3590
  );
3515
- if (!locale && !hasStaticDisplay) return result;
3591
+ if (!locale && !hasStaticDisplay) return stripI18nFilled(result);
3516
3592
  const layer = localeOpts?._layer ?? "read";
3517
3593
  if (locale && hasI18n && this.i18nFields) {
3518
3594
  result = this.i18nStrategy.applyI18nLocale(result, this.i18nFields, locale, localeOpts?.fallback, layer);
@@ -3579,7 +3655,7 @@ var Collection = class {
3579
3655
  }
3580
3656
  result = withLabels;
3581
3657
  }
3582
- return result;
3658
+ return stripI18nFilled(result);
3583
3659
  }
3584
3660
  /**
3585
3661
  * Low-level: encrypt a pre-serialised JSON string into an EncryptedEnvelope.
@@ -5932,84 +6008,12 @@ var SchemaUpdateGate = class {
5932
6008
  }
5933
6009
  };
5934
6010
 
5935
- // src/schema-update/fence.ts
5936
- var FENCE_RECORD_ID = "schema-fence";
5937
- var META_COLLECTION2 = "_meta";
5938
- var DEFAULT_FENCE = { currentSchemaVersion: 0, fenceState: "normal" };
5939
- async function loadFence(store, vault) {
5940
- const envelope = await store.get(vault, META_COLLECTION2, FENCE_RECORD_ID);
5941
- if (!envelope) return DEFAULT_FENCE;
5942
- try {
5943
- const parsed = JSON.parse(envelope._data);
5944
- if (!isFenceDoc(parsed)) return DEFAULT_FENCE;
5945
- return parsed;
5946
- } catch {
5947
- return DEFAULT_FENCE;
5948
- }
5949
- }
5950
- async function saveFence(store, vault, fence) {
5951
- const envelope = {
5952
- _noydb: NOYDB_FORMAT_VERSION,
5953
- _v: 1,
5954
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
5955
- _iv: "",
5956
- _data: JSON.stringify(fence)
5957
- };
5958
- await store.put(vault, META_COLLECTION2, FENCE_RECORD_ID, envelope);
5959
- }
5960
- function isFenceDoc(x) {
5961
- if (x === null || typeof x !== "object") return false;
5962
- const o = x;
5963
- return typeof o["currentSchemaVersion"] === "number" && (o["fenceState"] === "normal" || o["fenceState"] === "draining" || o["fenceState"] === "migrating" || o["fenceState"] === "complete");
5964
- }
5965
-
5966
- // src/schema-update/client-registry.ts
5967
- var META_COLLECTION3 = "_meta";
5968
- var CLIENT_PREFIX = "schema-fence:client:";
5969
- async function writeClientDoc(store, vault, clientId, doc) {
5970
- const envelope = {
5971
- _noydb: NOYDB_FORMAT_VERSION,
5972
- _v: 1,
5973
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
5974
- _iv: "",
5975
- _data: JSON.stringify({ clientId, ...doc })
5976
- };
5977
- await store.put(vault, META_COLLECTION3, `${CLIENT_PREFIX}${clientId}`, envelope);
5978
- }
5979
- async function listClientDocs(store, vault) {
5980
- const ids = await store.list(vault, META_COLLECTION3);
5981
- const out = [];
5982
- for (const id of ids) {
5983
- if (!id.startsWith(CLIENT_PREFIX)) continue;
5984
- const env = await store.get(vault, META_COLLECTION3, id);
5985
- if (!env) continue;
5986
- try {
5987
- const parsed = JSON.parse(env._data);
5988
- if (isClientDoc(parsed)) out.push(parsed);
5989
- } catch {
5990
- }
5991
- }
5992
- return out;
5993
- }
5994
- async function activeQuiesced(store, vault, opts) {
5995
- const docs = await listClientDocs(store, vault);
5996
- const active = docs.filter(
5997
- (d) => d.lastSeen >= opts.now - opts.staleMs && d.clientId !== opts.excludeClientId
5998
- );
5999
- return active.every((d) => d.quiescedAtVersion === opts.generation);
6000
- }
6001
- function isClientDoc(x) {
6002
- if (x === null || typeof x !== "object") return false;
6003
- const o = x;
6004
- return typeof o["clientId"] === "string" && typeof o["lastSeen"] === "number" && (o["quiescedAtVersion"] === null || typeof o["quiescedAtVersion"] === "number");
6005
- }
6006
-
6007
6011
  // src/schema-update/fence-controller.ts
6008
6012
  var SchemaFenceController = class {
6009
- #store;
6013
+ #coordination;
6010
6014
  #vault;
6011
6015
  #onFlush;
6012
- #clientId;
6016
+ #writerId;
6013
6017
  #now;
6014
6018
  #staleMs;
6015
6019
  #quiesceTimeoutMs;
@@ -6017,10 +6021,10 @@ var SchemaFenceController = class {
6017
6021
  #snapshot = 0;
6018
6022
  #pending = /* @__PURE__ */ new Map();
6019
6023
  constructor(opts) {
6020
- this.#store = opts.store;
6024
+ this.#coordination = opts.coordination;
6021
6025
  this.#vault = opts.vault;
6022
6026
  this.#onFlush = opts.onFlush;
6023
- this.#clientId = opts.clientId ?? "migrator";
6027
+ this.#writerId = opts.clientId ?? "migrator";
6024
6028
  this.#now = opts.now ?? (() => Date.now());
6025
6029
  this.#staleMs = opts.staleMs ?? 3e4;
6026
6030
  this.#quiesceTimeoutMs = opts.quiesceTimeoutMs ?? 6e4;
@@ -6029,7 +6033,7 @@ var SchemaFenceController = class {
6029
6033
  }
6030
6034
  /** Capture the generation snapshot at vault-open. */
6031
6035
  async init() {
6032
- this.#snapshot = (await loadFence(this.#store, this.#vault)).currentSchemaVersion;
6036
+ this.#snapshot = (await this.#coordination.readFence(this.#vault)).currentSchemaVersion;
6033
6037
  }
6034
6038
  /** Record a per-collection pending cutover (from a registration `cutover` decision). */
6035
6039
  registerPendingCutover(collection, transform) {
@@ -6037,7 +6041,7 @@ var SchemaFenceController = class {
6037
6041
  }
6038
6042
  /** Write-path gate. Throws when behind, fenced, or this collection is cutover-pending. */
6039
6043
  async assertWritable(collection) {
6040
- const fence = await loadFence(this.#store, this.#vault);
6044
+ const fence = await this.#coordination.readFence(this.#vault);
6041
6045
  if (fence.currentSchemaVersion > this.#snapshot) {
6042
6046
  throw new MigrationRequiredError(
6043
6047
  `Vault "${this.#vault}" advanced to schema generation ${fence.currentSchemaVersion} (this client opened at ${this.#snapshot}). Reload to continue.`
@@ -6056,61 +6060,59 @@ var SchemaFenceController = class {
6056
6060
  * Admin trigger. Drain → wait for the active set to quiesce (or time out)
6057
6061
  * → migrate each pending transform → bump → complete → normal. The
6058
6062
  * migrator excludes itself from the barrier (it drained synchronously
6059
- * here). `onPoll` (tests) advances other clients between barrier checks;
6060
- * production falls back to a short real delay.
6063
+ * inside {@link runDrainBarrier}). `onPoll` (tests) advances other clients
6064
+ * between barrier checks; production falls back to a short real delay.
6061
6065
  */
6062
6066
  async runCutover(run, opts) {
6063
6067
  if (this.#pending.size === 0) return { migrated: 0 };
6064
- const base = await loadFence(this.#store, this.#vault);
6068
+ const base = await this.#coordination.readFence(this.#vault);
6065
6069
  const generation = base.currentSchemaVersion;
6066
- await this.#setState(generation, "draining");
6067
- await this.#onFlush();
6068
- const deadline = this.#now() + this.#quiesceTimeoutMs;
6069
- while (!await activeQuiesced(this.#store, this.#vault, {
6070
- generation,
6071
- now: this.#now(),
6072
- staleMs: this.#staleMs,
6073
- excludeClientId: this.#clientId
6074
- })) {
6075
- if (this.#now() >= deadline) {
6076
- throw new QuiesceTimeoutError(
6077
- `Cutover on "${this.#vault}" timed out waiting for clients to quiesce at generation ${generation}.`
6078
- );
6079
- }
6080
- await (opts?.onPoll ? opts.onPoll() : delay(50));
6081
- }
6082
- await this.#setState(generation, "migrating");
6070
+ this.#emit({ currentSchemaVersion: generation, fenceState: "draining" });
6083
6071
  let migrated = 0;
6084
- for (const [collection, transform] of this.#pending) {
6085
- await run(collection, transform);
6086
- migrated++;
6087
- }
6088
- const nextVersion = generation + 1;
6089
- await this.#setState(nextVersion, "complete");
6090
- this.#pending.clear();
6091
- await this.#setState(nextVersion, "normal");
6092
- this.#snapshot = nextVersion;
6072
+ await runDrainBarrier(
6073
+ this.#coordination,
6074
+ {
6075
+ vault: this.#vault,
6076
+ generation,
6077
+ writerId: this.#writerId,
6078
+ onFlush: this.#onFlush,
6079
+ staleMs: this.#staleMs,
6080
+ quiesceTimeoutMs: this.#quiesceTimeoutMs,
6081
+ now: this.#now,
6082
+ ...opts?.onPoll ? { onPoll: opts.onPoll } : {}
6083
+ },
6084
+ async () => {
6085
+ await this.#setState(generation, "migrating");
6086
+ for (const [collection, transform] of this.#pending) {
6087
+ await run(collection, transform);
6088
+ migrated++;
6089
+ }
6090
+ const nextVersion = generation + 1;
6091
+ await this.#setState(nextVersion, "complete");
6092
+ this.#pending.clear();
6093
+ await this.#setState(nextVersion, "normal");
6094
+ this.#snapshot = nextVersion;
6095
+ }
6096
+ );
6093
6097
  return { migrated };
6094
6098
  }
6095
6099
  /** Recover a stuck drain: reset fenceState to normal at the current version (no bump). */
6096
6100
  async abort() {
6097
- const fence = await loadFence(this.#store, this.#vault);
6101
+ const fence = await this.#coordination.readFence(this.#vault);
6098
6102
  await this.#setState(fence.currentSchemaVersion, "normal");
6099
6103
  }
6100
6104
  async #setState(currentSchemaVersion, fenceState) {
6101
- await saveFence(this.#store, this.#vault, { currentSchemaVersion, fenceState });
6105
+ await this.#coordination.setFence(this.#vault, { currentSchemaVersion, fenceState });
6102
6106
  this.#emit({ currentSchemaVersion, fenceState });
6103
6107
  }
6104
6108
  };
6105
- function delay(ms) {
6106
- return new Promise((resolve) => setTimeout(resolve, ms));
6107
- }
6108
6109
 
6109
6110
  // src/schema-update/fence-watcher.ts
6110
6111
  var FenceWatcher = class {
6111
- #store;
6112
+ #coordination;
6112
6113
  #vault;
6113
- #clientId;
6114
+ #writerId;
6115
+ #sessionId;
6114
6116
  #onFlush;
6115
6117
  #now;
6116
6118
  #emit;
@@ -6118,9 +6120,10 @@ var FenceWatcher = class {
6118
6120
  #quiescedAtVersion = null;
6119
6121
  #timer;
6120
6122
  constructor(opts) {
6121
- this.#store = opts.store;
6123
+ this.#coordination = opts.coordination;
6122
6124
  this.#vault = opts.vault;
6123
- this.#clientId = opts.clientId;
6125
+ this.#writerId = opts.clientId;
6126
+ this.#sessionId = opts.sessionId ?? opts.clientId;
6124
6127
  this.#onFlush = opts.onFlush;
6125
6128
  this.#now = opts.now ?? (() => Date.now());
6126
6129
  this.#emit = opts.emit ?? (() => {
@@ -6128,14 +6131,16 @@ var FenceWatcher = class {
6128
6131
  }
6129
6132
  /** Publish liveness (and the current ack) without changing quiesce state. */
6130
6133
  async beat() {
6131
- await writeClientDoc(this.#store, this.#vault, this.#clientId, {
6134
+ await this.#coordination.reportPresence(this.#vault, {
6135
+ writerId: this.#writerId,
6136
+ sessionId: this.#sessionId,
6132
6137
  lastSeen: this.#now(),
6133
6138
  quiescedAtVersion: this.#quiescedAtVersion
6134
6139
  });
6135
6140
  }
6136
6141
  /** Poll the fence; quiesce on draining; emit on transitions. */
6137
6142
  async check() {
6138
- const fence = await loadFence(this.#store, this.#vault);
6143
+ const fence = await this.#coordination.readFence(this.#vault);
6139
6144
  if (fence.fenceState !== this.#lastState) {
6140
6145
  this.#lastState = fence.fenceState;
6141
6146
  this.#emit({ currentSchemaVersion: fence.currentSchemaVersion, fenceState: fence.fenceState });
@@ -6752,10 +6757,11 @@ var Vault = class {
6752
6757
  this.keyring = opts.keyring;
6753
6758
  this.encrypted = opts.encrypted;
6754
6759
  this.schemaFence = new SchemaFenceController({
6755
- store: this.adapter,
6760
+ coordination: this.noydb.coordination,
6756
6761
  vault: this.name,
6757
6762
  onFlush: () => this.noydb._writeQueueTracker.onFlush(),
6758
6763
  clientId: this.noydb._clientId,
6764
+ sessionId: this.noydb._sessionId,
6759
6765
  emit: (e) => this.emitter.emit("schema:fence-changed", { vault: this.name, ...e })
6760
6766
  });
6761
6767
  this.emitter = opts.emitter;
@@ -7151,9 +7157,10 @@ var Vault = class {
7151
7157
  if (this.#fenceCoordinationStarted) return;
7152
7158
  this.#fenceCoordinationStarted = true;
7153
7159
  this.#fenceWatcher = new FenceWatcher({
7154
- store: this.adapter,
7160
+ coordination: this.noydb.coordination,
7155
7161
  vault: this.name,
7156
7162
  clientId: this.noydb._clientId,
7163
+ sessionId: this.noydb._sessionId,
7157
7164
  onFlush: () => this.noydb._writeQueueTracker.onFlush(),
7158
7165
  emit: (e) => this.emitter.emit("schema:fence-changed", { vault: this.name, ...e })
7159
7166
  });
@@ -7711,12 +7718,12 @@ var Vault = class {
7711
7718
  if (!fieldSchema) {
7712
7719
  throw new AttestationError(`issueAttestation: collection '${collectionName}' has no attestation field-schema. Declare it via vault.collection('${collectionName}', { attestation: { fields: [...] } }).`);
7713
7720
  }
7714
- const { issueAttestationCore } = await import("./issue-LEBPVF3Y.js");
7721
+ const { issueAttestationCore } = await import("./issue-JSGGSVY4.js");
7715
7722
  const out = await issueAttestationCore(this.makeIssueContext(), { collection: collectionName, id, fieldSchema });
7716
7723
  return { docId: out.docId, qr: out.qr, keyId: out.keyId, publicKeyB64: out.publicKeyB64 };
7717
7724
  }
7718
7725
  async getDocumentSigningPublicKey() {
7719
- const { loadSigner, loadOrCreateSigner } = await import("./signer-NEQPCHMW.js");
7726
+ const { loadSigner, loadOrCreateSigner } = await import("./signer-ADFJNS5W.js");
7720
7727
  const existing = await loadSigner(this.adapter, this.name, this.getDEK);
7721
7728
  if (existing) return { keyId: existing.keyId, publicKeyB64: existing.publicKeyB64 };
7722
7729
  if (this.keyring.role !== "owner") {
@@ -7742,19 +7749,19 @@ var Vault = class {
7742
7749
  };
7743
7750
  }
7744
7751
  async revokeAttestation(docId) {
7745
- const { revokeDocCore } = await import("./revoke-P5D3UTRX.js");
7752
+ const { revokeDocCore } = await import("./revoke-DBAGKIDA.js");
7746
7753
  await revokeDocCore(this.makeRevokeContext(), docId);
7747
7754
  }
7748
7755
  async unrevokeAttestation(docId) {
7749
- const { unrevokeDocCore } = await import("./revoke-P5D3UTRX.js");
7756
+ const { unrevokeDocCore } = await import("./revoke-DBAGKIDA.js");
7750
7757
  await unrevokeDocCore(this.makeRevokeContext(), docId);
7751
7758
  }
7752
7759
  async getRevokedDocIds() {
7753
- const { getRevokedDocIdsCore } = await import("./revoke-P5D3UTRX.js");
7760
+ const { getRevokedDocIdsCore } = await import("./revoke-DBAGKIDA.js");
7754
7761
  return getRevokedDocIdsCore(this.makeRevokeContext());
7755
7762
  }
7756
7763
  async publishRevocationList() {
7757
- const { publishRevocationListCore } = await import("./revoke-P5D3UTRX.js");
7764
+ const { publishRevocationListCore } = await import("./revoke-DBAGKIDA.js");
7758
7765
  return publishRevocationListCore(this.makeRevokeContext());
7759
7766
  }
7760
7767
  makeRevokeContext() {
@@ -8515,13 +8522,13 @@ var Vault = class {
8515
8522
  if (!reg) {
8516
8523
  throw new Error(`refreshView: no MV registered with name "${name}"`);
8517
8524
  }
8518
- const { MaterializedViewExecutor } = await import("./executor-BIW4FT5R.js");
8525
+ const { MaterializedViewExecutor } = await import("./executor-PJHMRZWJ.js");
8519
8526
  const result = await MaterializedViewExecutor.refresh(reg, {
8520
8527
  getCollection: (n) => this.collection(n),
8521
8528
  getActiveTxContext: () => this.noydb._activeTxContextOrNull,
8522
8529
  getQueryContext: () => this
8523
8530
  });
8524
- const { clearMVStale } = await import("./stale-KKCHF2VB.js");
8531
+ const { clearMVStale } = await import("./stale-BCIE3SMC.js");
8525
8532
  clearMVStale(registry, name);
8526
8533
  return result;
8527
8534
  }
@@ -8562,7 +8569,7 @@ var Vault = class {
8562
8569
  if (!outSpec) continue;
8563
8570
  const outputColl = this.collection(outSpec.collection);
8564
8571
  if (out.kind === "array") {
8565
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-ZQT4Y7PF.js");
8572
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-DSBVAR2P.js");
8566
8573
  const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key);
8567
8574
  const prevKeys = new Set(prior?.keys ?? []);
8568
8575
  const newKeysList = out.entries.map((e) => e.key);
@@ -9276,7 +9283,7 @@ var Vault = class {
9276
9283
  * @see docs/subsystems/public-envelope.md
9277
9284
  */
9278
9285
  async getPublicEnvelope(opts = {}) {
9279
- const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-DBKJEBBF.js");
9286
+ const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-7MTH2PVE.js");
9280
9287
  return readPublicEnvelope2(this.adapter, this.name, opts);
9281
9288
  }
9282
9289
  /**
@@ -10822,6 +10829,10 @@ var Noydb = class {
10822
10829
  writeHooks = new WriteHookRegistry();
10823
10830
  subsystemBus = new SubsystemBus();
10824
10831
  clientId = generateULID();
10832
+ /** Session that owns this instance's writers (one user's writers across vaults). */
10833
+ sessionId;
10834
+ /** Drain-barrier coordination transport for the schema fence (#469). */
10835
+ coordinationProvider;
10825
10836
  vaultCache = /* @__PURE__ */ new Map();
10826
10837
  keyringCache = /* @__PURE__ */ new Map();
10827
10838
  syncEngines = /* @__PURE__ */ new Map();
@@ -10896,6 +10907,8 @@ var Noydb = class {
10896
10907
  "[noydb] debugPlaintext is ON \u2014 records are stored UNENCRYPTED and laid out for native store inspection. NEVER use this for production or client data."
10897
10908
  );
10898
10909
  }
10910
+ this.sessionId = options.sessionId ?? generateULID();
10911
+ this.coordinationProvider = options.coordinationStrategy ?? new StoreCoordinationProvider(options.store);
10899
10912
  this.txStrategy = options.txStrategy ?? NO_TX;
10900
10913
  this.forgetStrategy = options.forgetStrategy ?? NO_FORGET;
10901
10914
  this.sessionStrategy = options.sessionStrategy ?? NO_SESSION;
@@ -11949,6 +11962,18 @@ var Noydb = class {
11949
11962
  get _clientId() {
11950
11963
  return this.clientId;
11951
11964
  }
11965
+ /** @internal Session that owns this instance's writers (#469). */
11966
+ get _sessionId() {
11967
+ return this.sessionId;
11968
+ }
11969
+ /**
11970
+ * @internal Drain-barrier coordination transport for the schema fence (#469).
11971
+ * The default store-backed provider reproduces today's fence behavior; a
11972
+ * `by-*` real-time transport is injected via `coordinationStrategy`.
11973
+ */
11974
+ get coordination() {
11975
+ return this.coordinationProvider;
11976
+ }
11952
11977
  /**
11953
11978
  * Soft-lock a single vault: clear its in-memory keyring, DEKs, vault
11954
11979
  * instance, sync engine, policy enforcer, and active-tier entry —
@@ -13184,4 +13209,4 @@ export {
13184
13209
  Noydb,
13185
13210
  createNoydb
13186
13211
  };
13187
- //# sourceMappingURL=chunk-56ENKU46.js.map
13212
+ //# sourceMappingURL=chunk-3LHTFCU2.js.map