@noy-db/hub 0.6.0-pre.19 → 0.6.0-pre.20

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 (33) hide show
  1. package/dist/broker/index.js +3 -3
  2. package/dist/cargo/index.js +4 -4
  3. package/dist/{chunk-HGAR7H5M.js → chunk-6TXUVKPG.js} +4 -4
  4. package/dist/{chunk-LAFP5H5U.js → chunk-F5AJZC3U.js} +2 -2
  5. package/dist/{chunk-37P5VB4N.js → chunk-PNAIDIP7.js} +2 -2
  6. package/dist/{chunk-E6WANBD6.js → chunk-RKDH6L53.js} +34 -6
  7. package/dist/{chunk-E6WANBD6.js.map → chunk-RKDH6L53.js.map} +1 -1
  8. package/dist/{chunk-YEZW6UJA.js → chunk-RQY5UWEL.js} +3 -3
  9. package/dist/{chunk-LBDTQM3R.js → chunk-VEX2BQVX.js} +2 -2
  10. package/dist/{chunk-HUYNPLTT.js → chunk-XGQGWZ6D.js} +3 -3
  11. package/dist/{chunk-I26TE27S.js → chunk-ZXW3X3DQ.js} +3 -3
  12. package/dist/custody/index.js +2 -2
  13. package/dist/index.js +8 -8
  14. package/dist/{liberate-7QY7TULB.js → liberate-I6AOLWXW.js} +3 -3
  15. package/dist/{noydb-VZIVPDXG.js → noydb-SS6EN7TK.js} +5 -5
  16. package/dist/pod/index.js +5 -5
  17. package/dist/{seed-2KZDTFS4.js → seed-SGIF3EN4.js} +2 -2
  18. package/dist/team/index.js +3 -3
  19. package/dist/vault-head/index.js +5 -1
  20. package/dist/vault-head/index.js.map +1 -1
  21. package/dist/with-commit/vault-head/index.d.ts +1 -1
  22. package/dist/with-commit/vault-head/verify.d.ts +42 -2
  23. package/package.json +3 -3
  24. /package/dist/{chunk-HGAR7H5M.js.map → chunk-6TXUVKPG.js.map} +0 -0
  25. /package/dist/{chunk-LAFP5H5U.js.map → chunk-F5AJZC3U.js.map} +0 -0
  26. /package/dist/{chunk-37P5VB4N.js.map → chunk-PNAIDIP7.js.map} +0 -0
  27. /package/dist/{chunk-YEZW6UJA.js.map → chunk-RQY5UWEL.js.map} +0 -0
  28. /package/dist/{chunk-LBDTQM3R.js.map → chunk-VEX2BQVX.js.map} +0 -0
  29. /package/dist/{chunk-HUYNPLTT.js.map → chunk-XGQGWZ6D.js.map} +0 -0
  30. /package/dist/{chunk-I26TE27S.js.map → chunk-ZXW3X3DQ.js.map} +0 -0
  31. /package/dist/{liberate-7QY7TULB.js.map → liberate-I6AOLWXW.js.map} +0 -0
  32. /package/dist/{noydb-VZIVPDXG.js.map → noydb-SS6EN7TK.js.map} +0 -0
  33. /package/dist/{seed-2KZDTFS4.js.map → seed-SGIF3EN4.js.map} +0 -0
@@ -30,7 +30,7 @@ function withBroker(config) {
30
30
  const cache = /* @__PURE__ */ new Map();
31
31
  return {
32
32
  async enroll(ctx) {
33
- const { enrollSeed } = await import("../seed-2KZDTFS4.js");
33
+ const { enrollSeed } = await import("../seed-SGIF3EN4.js");
34
34
  return enrollSeed({ ...ctx, config });
35
35
  },
36
36
  async rotate(ctx) {
@@ -39,7 +39,7 @@ function withBroker(config) {
39
39
  const inFlight = scoped.map(([, e]) => e.inFlight).filter((p) => p !== void 0);
40
40
  await Promise.allSettled(inFlight);
41
41
  for (const [key] of scoped) cache.delete(key);
42
- const { rotateSeed } = await import("../seed-2KZDTFS4.js");
42
+ const { rotateSeed } = await import("../seed-SGIF3EN4.js");
43
43
  return rotateSeed({ ...ctx, config });
44
44
  },
45
45
  credentialSource(ctx, profile) {
@@ -56,7 +56,7 @@ function withBroker(config) {
56
56
  const skewMs = config.skewMs ?? DEFAULT_SKEW_MS;
57
57
  const capturedEntry = entry;
58
58
  const inFlight = (async () => {
59
- const { mintStoreCredentials } = await import("../seed-2KZDTFS4.js");
59
+ const { mintStoreCredentials } = await import("../seed-SGIF3EN4.js");
60
60
  const creds = await mintStoreCredentials({ ...ctx, config }, profile);
61
61
  capturedEntry.cached = { creds, validUntil: cacheFloor(creds, skewMs) };
62
62
  return creds;
@@ -6,7 +6,7 @@ import {
6
6
  diffVault,
7
7
  unsealDeks,
8
8
  withCargo
9
- } from "../chunk-YEZW6UJA.js";
9
+ } from "../chunk-RQY5UWEL.js";
10
10
  import {
11
11
  extractPartition,
12
12
  walkClosure
@@ -16,7 +16,7 @@ import {
16
16
  isDeedVault,
17
17
  liberateVault,
18
18
  loadDeedMarker
19
- } from "../chunk-37P5VB4N.js";
19
+ } from "../chunk-PNAIDIP7.js";
20
20
  import "../chunk-TC6MBEGH.js";
21
21
  import "../chunk-ZPMXYPBR.js";
22
22
  import {
@@ -28,7 +28,7 @@ import "../chunk-NRNTXBHT.js";
28
28
  import "../chunk-YVTADFTC.js";
29
29
  import {
30
30
  CustodyApi
31
- } from "../chunk-HUYNPLTT.js";
31
+ } from "../chunk-XGQGWZ6D.js";
32
32
  import "../chunk-2IK6AC6A.js";
33
33
  import "../chunk-DYASJSKI.js";
34
34
  import {
@@ -46,7 +46,7 @@ import {
46
46
  } from "../chunk-IGJCYUT5.js";
47
47
  import "../chunk-437FDIHO.js";
48
48
  import "../chunk-KDX6VEYV.js";
49
- import "../chunk-E6WANBD6.js";
49
+ import "../chunk-RKDH6L53.js";
50
50
  import "../chunk-JHO6FGZX.js";
51
51
  import "../chunk-HTMQBBF3.js";
52
52
  import {
@@ -74,7 +74,7 @@ import {
74
74
  import {
75
75
  CustodyApi,
76
76
  NO_CUSTODY
77
- } from "./chunk-HUYNPLTT.js";
77
+ } from "./chunk-XGQGWZ6D.js";
78
78
  import {
79
79
  DEFAULT_POSTURE,
80
80
  ViaGraph
@@ -223,7 +223,7 @@ import {
223
223
  saveShamirRecoveryEntries,
224
224
  updateAuthenticator,
225
225
  writeMagicLinkGrant
226
- } from "./chunk-LAFP5H5U.js";
226
+ } from "./chunk-F5AJZC3U.js";
227
227
  import {
228
228
  assertKeyringOpenAllowed,
229
229
  buildRecipientKeyringFile,
@@ -238,7 +238,7 @@ import {
238
238
  listUsers,
239
239
  loadKeyring,
240
240
  updateKeyringIdentity
241
- } from "./chunk-E6WANBD6.js";
241
+ } from "./chunk-RKDH6L53.js";
242
242
  import {
243
243
  persistDirectoryConfig,
244
244
  readDirectoryConfig
@@ -14616,4 +14616,4 @@ export {
14616
14616
  Noydb,
14617
14617
  createNoydb
14618
14618
  };
14619
- //# sourceMappingURL=chunk-HGAR7H5M.js.map
14619
+ //# sourceMappingURL=chunk-6TXUVKPG.js.map
@@ -9,7 +9,7 @@ import {
9
9
  mintKeyringCanary,
10
10
  persistKeyring,
11
11
  readKeyringFile
12
- } from "./chunk-E6WANBD6.js";
12
+ } from "./chunk-RKDH6L53.js";
13
13
  import {
14
14
  dekKey
15
15
  } from "./chunk-47ZFULEZ.js";
@@ -924,4 +924,4 @@ export {
924
924
  removeAuthenticator,
925
925
  findAuthenticator
926
926
  };
927
- //# sourceMappingURL=chunk-LAFP5H5U.js.map
927
+ //# sourceMappingURL=chunk-F5AJZC3U.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-NRNTXBHT.js";
7
7
  import {
8
8
  createOwnerKeyring
9
- } from "./chunk-E6WANBD6.js";
9
+ } from "./chunk-RKDH6L53.js";
10
10
  import {
11
11
  buildRecordEnvelope
12
12
  } from "./chunk-ZVAFJQZB.js";
@@ -128,4 +128,4 @@ export {
128
128
  isDeedVault,
129
129
  liberateVault
130
130
  };
131
- //# sourceMappingURL=chunk-37P5VB4N.js.map
131
+ //# sourceMappingURL=chunk-PNAIDIP7.js.map
@@ -643,6 +643,30 @@ async function updateKeyringIdentity(store, vault, callerKeyring, options) {
643
643
  };
644
644
  await writeKeyringFile(store, vault, options.userId, next);
645
645
  }
646
+ var HISTORY_COLLECTION = "_history";
647
+ var LEDGER_COLLECTION = "_ledger";
648
+ var LEDGER_DELTAS_COLLECTION = "_ledger_deltas";
649
+ async function listOrEmpty(store, vault, collection) {
650
+ try {
651
+ return await store.list(vault, collection);
652
+ } catch {
653
+ return [];
654
+ }
655
+ }
656
+ async function derivedRefsFor(store, vault, rotated) {
657
+ const out = [];
658
+ if (!rotated.startsWith("_")) {
659
+ for (const id of await listOrEmpty(store, vault, HISTORY_COLLECTION)) {
660
+ if (id.startsWith(`${rotated}:`)) out.push({ collection: HISTORY_COLLECTION, id });
661
+ }
662
+ }
663
+ if (rotated === LEDGER_COLLECTION) {
664
+ for (const id of await listOrEmpty(store, vault, LEDGER_DELTAS_COLLECTION)) {
665
+ out.push({ collection: LEDGER_DELTAS_COLLECTION, id });
666
+ }
667
+ }
668
+ return out;
669
+ }
646
670
  async function rotateKeys(store, vault, callerKeyring, opts) {
647
671
  const { collections } = opts;
648
672
  if (callerKeyring.role === "custodian") {
@@ -664,12 +688,16 @@ async function rotateKeys(store, vault, callerKeyring, opts) {
664
688
  const oldDek = callerKeyring.deks.get(collName);
665
689
  const newDek = newDeks.get(collName);
666
690
  if (!oldDek) continue;
667
- const ids = await store.list(vault, collName);
668
- for (const id of ids) {
669
- const envelope = await store.get(vault, collName, id);
691
+ const refs = [
692
+ ...(await store.list(vault, collName)).map((id) => ({ collection: collName, id })),
693
+ ...await derivedRefsFor(store, vault, collName)
694
+ ];
695
+ for (const ref of refs) {
696
+ const { collection: refColl, id } = ref;
697
+ const envelope = await store.get(vault, refColl, id);
670
698
  if (!envelope || !envelope._iv) continue;
671
- const newEnvelope = await rekeyEnvelopeIfNeeded({ collection: collName, id }, envelope, oldDek, newDek);
672
- if (newEnvelope !== null) await store.put(vault, collName, id, newEnvelope);
699
+ const newEnvelope = await rekeyEnvelopeIfNeeded({ collection: refColl, id }, envelope, oldDek, newDek);
700
+ if (newEnvelope !== null) await store.put(vault, refColl, id, newEnvelope);
673
701
  }
674
702
  }
675
703
  for (const [collName, newDek] of newDeks) {
@@ -1041,4 +1069,4 @@ export {
1041
1069
  hasImportCapability,
1042
1070
  evaluateImportCapability
1043
1071
  };
1044
- //# sourceMappingURL=chunk-E6WANBD6.js.map
1072
+ //# sourceMappingURL=chunk-RKDH6L53.js.map