@noy-db/hub 0.2.0-pre.26 → 0.2.0-pre.27
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.
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +1 -1
- package/dist/attestation/index.d.ts +1 -1
- package/dist/attestation/index.js +4 -4
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +3 -3
- package/dist/blobs/index.d.ts +3 -3
- package/dist/blobs/index.js +4 -4
- package/dist/bundle/index.cjs +320 -144
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +3 -3
- package/dist/bundle/index.d.ts +3 -3
- package/dist/bundle/index.js +8 -8
- package/dist/{chunk-HUXDQIVU.js → chunk-2NYVA6FW.js} +2 -2
- package/dist/{chunk-OCRDV3NU.js → chunk-5EITJMUJ.js} +3 -3
- package/dist/{chunk-EYZJULEN.js → chunk-6H4CAHMQ.js} +2 -2
- package/dist/{chunk-VGAN5RLD.js → chunk-6M5JKTUQ.js} +2 -2
- package/dist/{chunk-N4EXCKWP.js → chunk-6ZKXFMUG.js} +2 -2
- package/dist/{chunk-KJ37E3R5.js → chunk-7DDTFGXY.js} +2 -2
- package/dist/{chunk-LR7CODVN.js → chunk-AD6RNBAW.js} +1 -1
- package/dist/chunk-AD6RNBAW.js.map +1 -0
- package/dist/{chunk-TSUICI5N.js → chunk-BMDVFBCL.js} +2 -2
- package/dist/{chunk-FCIZXX56.js → chunk-BOMH3637.js} +2 -2
- package/dist/{chunk-RZOGD7IF.js → chunk-CVTPNW2Y.js} +6 -6
- package/dist/{chunk-GPZHHTJU.js → chunk-DONPLWRC.js} +2 -2
- package/dist/{chunk-GHXOVGTX.js → chunk-HAKEZTA7.js} +3 -3
- package/dist/{chunk-QYQRAOEF.js → chunk-I2RX62RX.js} +2 -2
- package/dist/{chunk-2RHBFCWQ.js → chunk-IWGVH2RR.js} +3 -3
- package/dist/{chunk-Y5CTT6K5.js → chunk-K6PCTYAH.js} +2 -2
- package/dist/{chunk-ANLOD6IS.js → chunk-KA5A5CSD.js} +3 -3
- package/dist/{chunk-56ENKU46.js → chunk-KSKKLVPA.js} +97 -144
- package/dist/chunk-KSKKLVPA.js.map +1 -0
- package/dist/{chunk-UNBX2HMA.js → chunk-LXA2E3VI.js} +2 -2
- package/dist/{chunk-JJKXJAH2.js → chunk-PFKAT4NT.js} +3 -3
- package/dist/{chunk-ZCBJIDT4.js → chunk-RRCRITDM.js} +2 -2
- package/dist/{chunk-YP2AYE5W.js → chunk-SID2NJNF.js} +2 -2
- package/dist/chunk-Z3BJF7SF.js +220 -0
- package/dist/chunk-Z3BJF7SF.js.map +1 -0
- package/dist/consent/index.d.cts +2 -2
- package/dist/consent/index.d.ts +2 -2
- package/dist/{decrypt-partition-CyyJUWLR.d.ts → decrypt-partition-CptDdcCx.d.ts} +1 -1
- package/dist/{decrypt-partition-C71vhnND.d.cts → decrypt-partition-DmkeOB4I.d.cts} +1 -1
- package/dist/derivations/index.d.cts +3 -3
- package/dist/derivations/index.d.ts +3 -3
- package/dist/{dev-unlock-BdrE0kbS.d.cts → dev-unlock-DUTLA3Sc.d.cts} +1 -1
- package/dist/{dev-unlock-ByBkl99-.d.ts → dev-unlock-Y9znMkQ2.d.ts} +1 -1
- package/dist/{fanout-sidecar-ZQT4Y7PF.js → fanout-sidecar-OC4QVTS2.js} +2 -2
- package/dist/forget/index.js +2 -2
- package/dist/guards/index.d.cts +3 -3
- package/dist/guards/index.d.ts +3 -3
- package/dist/{hash-CZxVv8RH.d.ts → hash-Btl9IvQS.d.ts} +1 -1
- package/dist/{hash-BUkDp_8Q.d.cts → hash-DFK7cGdo.d.cts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +3 -3
- package/dist/history/index.d.ts +3 -3
- package/dist/history/index.js +3 -3
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +2 -2
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/index.js +3 -3
- package/dist/{index-CBUhOmrM.d.cts → index-CqzZml-D.d.cts} +1 -1
- package/dist/{index-DFhKV-6A.d.ts → index-wRwJVVJQ.d.ts} +1 -1
- package/dist/index.cjs +316 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +19 -18
- package/dist/index.js.map +1 -1
- package/dist/{issue-LEBPVF3Y.js → issue-ZZ2XPOGP.js} +4 -4
- package/dist/kernel/index.cjs +61 -0
- package/dist/kernel/index.cjs.map +1 -1
- package/dist/kernel/index.d.cts +2 -2
- package/dist/kernel/index.d.ts +2 -2
- package/dist/kernel/index.js +7 -0
- package/dist/{ledger-FLRTSOYH.js → ledger-XQ4KVFQ6.js} +3 -3
- package/dist/materialized-views/index.d.cts +3 -3
- package/dist/materialized-views/index.d.ts +3 -3
- package/dist/{mime-magic-BAhLjkHw.d.cts → mime-magic-Co4Pyj-O.d.cts} +1 -1
- package/dist/{mime-magic-C1UbcBxP.d.ts → mime-magic-OiPT1qed.d.ts} +1 -1
- package/dist/{noydb-6FA46A4M.js → noydb-EY52NVH4.js} +15 -14
- package/dist/overlay-views/index.d.cts +3 -3
- package/dist/overlay-views/index.d.ts +3 -3
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +2 -2
- package/dist/periods/index.d.ts +2 -2
- package/dist/periods/index.js +3 -3
- package/dist/{public-envelope-DBKJEBBF.js → public-envelope-O6X6AUUS.js} +3 -3
- package/dist/{revoke-P5D3UTRX.js → revoke-QJ2HUM4W.js} +4 -4
- package/dist/session/index.d.cts +3 -3
- package/dist/session/index.d.ts +3 -3
- package/dist/shadow/index.d.cts +2 -2
- package/dist/shadow/index.d.ts +2 -2
- package/dist/{signer-NEQPCHMW.js → signer-SCJ6C6HQ.js} +3 -3
- package/dist/snapshots/index.d.cts +2 -2
- package/dist/snapshots/index.d.ts +2 -2
- package/dist/snapshots/index.js +3 -3
- package/dist/store/index.d.cts +2 -2
- package/dist/store/index.d.ts +2 -2
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +1 -1
- package/dist/sync/index.d.ts +1 -1
- package/dist/sync/index.js +2 -2
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +2 -2
- package/dist/team/index.d.ts +2 -2
- package/dist/team/index.js +5 -5
- package/dist/{transition-guard-BSLdikC_.d.ts → transition-guard-CJmb8O8q.d.ts} +1 -1
- package/dist/{transition-guard-DPs6al8h.d.cts → transition-guard-Dzj68JWC.d.cts} +1 -1
- package/dist/tx/index.d.cts +2 -2
- package/dist/tx/index.d.ts +2 -2
- package/dist/{types-CCq0WHh9.d.ts → types-CkSWJt0H.d.ts} +137 -7
- package/dist/{types-BCYvhKzr.d.cts → types-CwrTuYFI.d.cts} +137 -7
- package/dist/{with-materialized-view-DiD41wQp.d.ts → with-materialized-view-BVfcPlaE.d.ts} +1 -1
- package/dist/{with-materialized-view-CTHe6uh9.d.cts → with-materialized-view-dPG213gd.d.cts} +1 -1
- package/dist/{with-overlayed-view-Dlz5hcM8.d.cts → with-overlayed-view-CJ2UDBol.d.cts} +1 -1
- package/dist/{with-overlayed-view-DlbsJMhF.d.ts → with-overlayed-view-zYPQzGGh.d.ts} +1 -1
- package/dist/{with-rollup-BBWdrCvu.d.cts → with-rollup-B_zbRi3f.d.cts} +1 -1
- package/dist/{with-rollup-mT4_CWaU.d.ts → with-rollup-BvaJefEs.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-56ENKU46.js.map +0 -1
- package/dist/chunk-LR7CODVN.js.map +0 -1
- /package/dist/{chunk-HUXDQIVU.js.map → chunk-2NYVA6FW.js.map} +0 -0
- /package/dist/{chunk-OCRDV3NU.js.map → chunk-5EITJMUJ.js.map} +0 -0
- /package/dist/{chunk-EYZJULEN.js.map → chunk-6H4CAHMQ.js.map} +0 -0
- /package/dist/{chunk-VGAN5RLD.js.map → chunk-6M5JKTUQ.js.map} +0 -0
- /package/dist/{chunk-N4EXCKWP.js.map → chunk-6ZKXFMUG.js.map} +0 -0
- /package/dist/{chunk-KJ37E3R5.js.map → chunk-7DDTFGXY.js.map} +0 -0
- /package/dist/{chunk-TSUICI5N.js.map → chunk-BMDVFBCL.js.map} +0 -0
- /package/dist/{chunk-FCIZXX56.js.map → chunk-BOMH3637.js.map} +0 -0
- /package/dist/{chunk-RZOGD7IF.js.map → chunk-CVTPNW2Y.js.map} +0 -0
- /package/dist/{chunk-GPZHHTJU.js.map → chunk-DONPLWRC.js.map} +0 -0
- /package/dist/{chunk-GHXOVGTX.js.map → chunk-HAKEZTA7.js.map} +0 -0
- /package/dist/{chunk-QYQRAOEF.js.map → chunk-I2RX62RX.js.map} +0 -0
- /package/dist/{chunk-2RHBFCWQ.js.map → chunk-IWGVH2RR.js.map} +0 -0
- /package/dist/{chunk-Y5CTT6K5.js.map → chunk-K6PCTYAH.js.map} +0 -0
- /package/dist/{chunk-ANLOD6IS.js.map → chunk-KA5A5CSD.js.map} +0 -0
- /package/dist/{chunk-UNBX2HMA.js.map → chunk-LXA2E3VI.js.map} +0 -0
- /package/dist/{chunk-JJKXJAH2.js.map → chunk-PFKAT4NT.js.map} +0 -0
- /package/dist/{chunk-ZCBJIDT4.js.map → chunk-RRCRITDM.js.map} +0 -0
- /package/dist/{chunk-YP2AYE5W.js.map → chunk-SID2NJNF.js.map} +0 -0
- /package/dist/{fanout-sidecar-ZQT4Y7PF.js.map → fanout-sidecar-OC4QVTS2.js.map} +0 -0
- /package/dist/{issue-LEBPVF3Y.js.map → issue-ZZ2XPOGP.js.map} +0 -0
- /package/dist/{ledger-FLRTSOYH.js.map → ledger-XQ4KVFQ6.js.map} +0 -0
- /package/dist/{noydb-6FA46A4M.js.map → noydb-EY52NVH4.js.map} +0 -0
- /package/dist/{public-envelope-DBKJEBBF.js.map → public-envelope-O6X6AUUS.js.map} +0 -0
- /package/dist/{revoke-P5D3UTRX.js.map → revoke-QJ2HUM4W.js.map} +0 -0
- /package/dist/{signer-NEQPCHMW.js.map → signer-SCJ6C6HQ.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOYDB_FORMAT_VERSION,
|
|
3
3
|
NOYDB_KEYRING_VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AD6RNBAW.js";
|
|
5
5
|
import {
|
|
6
6
|
base64ToBuffer,
|
|
7
7
|
bufferToBase64,
|
|
@@ -902,4 +902,4 @@ export {
|
|
|
902
902
|
hasImportCapability,
|
|
903
903
|
evaluateImportCapability
|
|
904
904
|
};
|
|
905
|
-
//# sourceMappingURL=chunk-
|
|
905
|
+
//# sourceMappingURL=chunk-LXA2E3VI.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureCollectionDEK
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LXA2E3VI.js";
|
|
4
4
|
import {
|
|
5
5
|
envelopePayloadHash
|
|
6
6
|
} from "./chunk-PDVP3C2I.js";
|
|
7
7
|
import {
|
|
8
8
|
NOYDB_FORMAT_VERSION
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AD6RNBAW.js";
|
|
10
10
|
import {
|
|
11
11
|
decrypt,
|
|
12
12
|
encrypt
|
|
@@ -398,4 +398,4 @@ export {
|
|
|
398
398
|
isStaticDictDescriptor,
|
|
399
399
|
DictionaryHandle
|
|
400
400
|
};
|
|
401
|
-
//# sourceMappingURL=chunk-
|
|
401
|
+
//# sourceMappingURL=chunk-PFKAT4NT.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOYDB_FORMAT_VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AD6RNBAW.js";
|
|
4
4
|
import {
|
|
5
5
|
encrypt
|
|
6
6
|
} from "./chunk-7JSP3E67.js";
|
|
@@ -258,4 +258,4 @@ export {
|
|
|
258
258
|
BLOB_EVICTION_AUDIT_COLLECTION,
|
|
259
259
|
runCompaction
|
|
260
260
|
};
|
|
261
|
-
//# sourceMappingURL=chunk-
|
|
261
|
+
//# sourceMappingURL=chunk-RRCRITDM.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOYDB_FORMAT_VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AD6RNBAW.js";
|
|
4
4
|
import {
|
|
5
5
|
decrypt,
|
|
6
6
|
encrypt
|
|
@@ -262,4 +262,4 @@ export {
|
|
|
262
262
|
loadPersistedSchema,
|
|
263
263
|
savePersistedSchema
|
|
264
264
|
};
|
|
265
|
-
//# sourceMappingURL=chunk-
|
|
265
|
+
//# sourceMappingURL=chunk-SID2NJNF.js.map
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NOYDB_FORMAT_VERSION
|
|
3
|
+
} from "./chunk-AD6RNBAW.js";
|
|
4
|
+
import {
|
|
5
|
+
QuiesceTimeoutError
|
|
6
|
+
} from "./chunk-DDOYOMAD.js";
|
|
7
|
+
|
|
8
|
+
// src/coordination/types.ts
|
|
9
|
+
function isQuorum(writers, generation, excludeWriterId) {
|
|
10
|
+
return writers.filter((w) => w.writerId !== excludeWriterId).every((w) => w.quiescedAtVersion === generation);
|
|
11
|
+
}
|
|
12
|
+
async function runDrainBarrier(provider, o, run) {
|
|
13
|
+
await provider.setFence(o.vault, { currentSchemaVersion: o.generation, fenceState: "draining" });
|
|
14
|
+
await o.onFlush();
|
|
15
|
+
const deadline = o.now() + o.quiesceTimeoutMs;
|
|
16
|
+
const seeded = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() });
|
|
17
|
+
if (!isQuorum(seeded, o.generation, o.writerId)) {
|
|
18
|
+
await new Promise((resolve, reject) => {
|
|
19
|
+
let settled = false;
|
|
20
|
+
const finish = (fn) => {
|
|
21
|
+
if (!settled) {
|
|
22
|
+
settled = true;
|
|
23
|
+
unsub();
|
|
24
|
+
fn();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const unsub = provider.observePresence(o.vault, (writers) => {
|
|
28
|
+
if (isQuorum(writers, o.generation, o.writerId)) finish(resolve);
|
|
29
|
+
});
|
|
30
|
+
const tick = async () => {
|
|
31
|
+
if (settled) return;
|
|
32
|
+
if (o.now() >= deadline) {
|
|
33
|
+
finish(
|
|
34
|
+
() => reject(
|
|
35
|
+
new QuiesceTimeoutError(
|
|
36
|
+
`Cutover of vault "${o.vault}" to generation ${o.generation} timed out after ${o.quiesceTimeoutMs}ms waiting for active writers to quiesce.`
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (o.onPoll) await o.onPoll();
|
|
43
|
+
const w = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() });
|
|
44
|
+
if (isQuorum(w, o.generation, o.writerId)) finish(resolve);
|
|
45
|
+
else setTimeout(() => void tick(), 25);
|
|
46
|
+
};
|
|
47
|
+
void tick();
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
await run();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/schema-update/fence.ts
|
|
54
|
+
var FENCE_RECORD_ID = "schema-fence";
|
|
55
|
+
var META_COLLECTION = "_meta";
|
|
56
|
+
var DEFAULT_FENCE = { currentSchemaVersion: 0, fenceState: "normal" };
|
|
57
|
+
async function loadFence(store, vault) {
|
|
58
|
+
const envelope = await store.get(vault, META_COLLECTION, FENCE_RECORD_ID);
|
|
59
|
+
if (!envelope) return DEFAULT_FENCE;
|
|
60
|
+
try {
|
|
61
|
+
const parsed = JSON.parse(envelope._data);
|
|
62
|
+
if (!isFenceDoc(parsed)) return DEFAULT_FENCE;
|
|
63
|
+
return parsed;
|
|
64
|
+
} catch {
|
|
65
|
+
return DEFAULT_FENCE;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function saveFence(store, vault, fence) {
|
|
69
|
+
const envelope = {
|
|
70
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
71
|
+
_v: 1,
|
|
72
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
73
|
+
_iv: "",
|
|
74
|
+
_data: JSON.stringify(fence)
|
|
75
|
+
};
|
|
76
|
+
await store.put(vault, META_COLLECTION, FENCE_RECORD_ID, envelope);
|
|
77
|
+
}
|
|
78
|
+
function isFenceDoc(x) {
|
|
79
|
+
if (x === null || typeof x !== "object") return false;
|
|
80
|
+
const o = x;
|
|
81
|
+
return typeof o["currentSchemaVersion"] === "number" && (o["fenceState"] === "normal" || o["fenceState"] === "draining" || o["fenceState"] === "migrating" || o["fenceState"] === "complete");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// src/schema-update/client-registry.ts
|
|
85
|
+
var META_COLLECTION2 = "_meta";
|
|
86
|
+
var CLIENT_PREFIX = "schema-fence:client:";
|
|
87
|
+
async function writeClientDoc(store, vault, clientId, doc) {
|
|
88
|
+
const envelope = {
|
|
89
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
90
|
+
_v: 1,
|
|
91
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
92
|
+
_iv: "",
|
|
93
|
+
_data: JSON.stringify({ clientId, ...doc })
|
|
94
|
+
};
|
|
95
|
+
await store.put(vault, META_COLLECTION2, `${CLIENT_PREFIX}${clientId}`, envelope);
|
|
96
|
+
}
|
|
97
|
+
async function listClientDocs(store, vault) {
|
|
98
|
+
const ids = await store.list(vault, META_COLLECTION2);
|
|
99
|
+
const out = [];
|
|
100
|
+
for (const id of ids) {
|
|
101
|
+
if (!id.startsWith(CLIENT_PREFIX)) continue;
|
|
102
|
+
const env = await store.get(vault, META_COLLECTION2, id);
|
|
103
|
+
if (!env) continue;
|
|
104
|
+
try {
|
|
105
|
+
const parsed = JSON.parse(env._data);
|
|
106
|
+
if (isClientDoc(parsed)) out.push(parsed);
|
|
107
|
+
} catch {
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
function isClientDoc(x) {
|
|
113
|
+
if (x === null || typeof x !== "object") return false;
|
|
114
|
+
const o = x;
|
|
115
|
+
return typeof o["clientId"] === "string" && typeof o["lastSeen"] === "number" && (o["quiescedAtVersion"] === null || typeof o["quiescedAtVersion"] === "number") && (o["sessionId"] === void 0 || typeof o["sessionId"] === "string");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/coordination/store-provider.ts
|
|
119
|
+
var DEFAULT_POLL_INTERVAL_MS = 50;
|
|
120
|
+
function toPresence(doc) {
|
|
121
|
+
return {
|
|
122
|
+
writerId: doc.clientId,
|
|
123
|
+
// Pre-#469 docs (and explicit empty) have no session — fall back to the
|
|
124
|
+
// writerId so every presence is session-addressable.
|
|
125
|
+
sessionId: doc.sessionId && doc.sessionId.length > 0 ? doc.sessionId : doc.clientId,
|
|
126
|
+
lastSeen: doc.lastSeen,
|
|
127
|
+
quiescedAtVersion: doc.quiescedAtVersion
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function fenceEqual(a, b) {
|
|
131
|
+
return a.currentSchemaVersion === b.currentSchemaVersion && a.fenceState === b.fenceState;
|
|
132
|
+
}
|
|
133
|
+
function presenceListEqual(a, b) {
|
|
134
|
+
if (a.length !== b.length) return false;
|
|
135
|
+
const key = (w) => `${w.writerId}\0${w.sessionId}\0${w.lastSeen}\0${String(w.quiescedAtVersion)}`;
|
|
136
|
+
const bk = new Set(b.map(key));
|
|
137
|
+
return a.every((w) => bk.has(key(w)));
|
|
138
|
+
}
|
|
139
|
+
var StoreCoordinationProvider = class {
|
|
140
|
+
#store;
|
|
141
|
+
#pollIntervalMs;
|
|
142
|
+
constructor(store, opts) {
|
|
143
|
+
this.#store = store;
|
|
144
|
+
this.#pollIntervalMs = opts?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
145
|
+
}
|
|
146
|
+
async setFence(vault, fence) {
|
|
147
|
+
await saveFence(this.#store, vault, fence);
|
|
148
|
+
}
|
|
149
|
+
async readFence(vault) {
|
|
150
|
+
return loadFence(this.#store, vault);
|
|
151
|
+
}
|
|
152
|
+
observeFence(vault, onChange) {
|
|
153
|
+
let last = null;
|
|
154
|
+
let busy = false;
|
|
155
|
+
const poll = async () => {
|
|
156
|
+
if (busy) return;
|
|
157
|
+
busy = true;
|
|
158
|
+
try {
|
|
159
|
+
const fence = await loadFence(this.#store, vault);
|
|
160
|
+
if (last === null || !fenceEqual(last, fence)) {
|
|
161
|
+
last = fence;
|
|
162
|
+
onChange(fence);
|
|
163
|
+
}
|
|
164
|
+
} catch {
|
|
165
|
+
} finally {
|
|
166
|
+
busy = false;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
void poll();
|
|
170
|
+
const timer = setInterval(() => void poll(), this.#pollIntervalMs);
|
|
171
|
+
unref(timer);
|
|
172
|
+
return () => clearInterval(timer);
|
|
173
|
+
}
|
|
174
|
+
async reportPresence(vault, p) {
|
|
175
|
+
await writeClientDoc(this.#store, vault, p.writerId, {
|
|
176
|
+
lastSeen: p.lastSeen,
|
|
177
|
+
quiescedAtVersion: p.quiescedAtVersion,
|
|
178
|
+
sessionId: p.sessionId
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
observePresence(vault, onChange) {
|
|
182
|
+
let last = null;
|
|
183
|
+
let busy = false;
|
|
184
|
+
const poll = async () => {
|
|
185
|
+
if (busy) return;
|
|
186
|
+
busy = true;
|
|
187
|
+
try {
|
|
188
|
+
const docs = await listClientDocs(this.#store, vault);
|
|
189
|
+
const writers = docs.map(toPresence);
|
|
190
|
+
if (last === null || !presenceListEqual(last, writers)) {
|
|
191
|
+
last = writers;
|
|
192
|
+
onChange(writers);
|
|
193
|
+
}
|
|
194
|
+
} catch {
|
|
195
|
+
} finally {
|
|
196
|
+
busy = false;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
void poll();
|
|
200
|
+
const timer = setInterval(() => void poll(), this.#pollIntervalMs);
|
|
201
|
+
unref(timer);
|
|
202
|
+
return () => clearInterval(timer);
|
|
203
|
+
}
|
|
204
|
+
async reachableWriters(vault, o) {
|
|
205
|
+
const docs = await listClientDocs(this.#store, vault);
|
|
206
|
+
return docs.map(toPresence).filter((w) => o.now - w.lastSeen <= o.staleMs);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
function unref(timer) {
|
|
210
|
+
const t = timer;
|
|
211
|
+
if (typeof t.unref === "function") t.unref();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export {
|
|
215
|
+
isQuorum,
|
|
216
|
+
runDrainBarrier,
|
|
217
|
+
loadFence,
|
|
218
|
+
StoreCoordinationProvider
|
|
219
|
+
};
|
|
220
|
+
//# sourceMappingURL=chunk-Z3BJF7SF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/coordination/types.ts","../src/schema-update/fence.ts","../src/schema-update/client-registry.ts","../src/coordination/store-provider.ts"],"sourcesContent":["/**\n * Kernel coordination port — the injected `CoordinationProvider` seam for the\n * schema-fence drain-barrier (#469).\n *\n * The kernel defines this port; `@noy-db/by-tabs` / `@noy-db/by-peer` implement\n * it for real-time quorum, and an external orchestrator (`@klum-db/lobby`)\n * drives it through the `Noydb` handle without ever naming a `by-*` package.\n * The dependency arrow is `by-* → kernel ← klum`, the app at the apex.\n *\n * This module carries only the port TYPES plus two pure-ish helpers:\n * {@link isQuorum} (a pure quorum predicate extracted from the legacy\n * `activeQuiesced`) and {@link runDrainBarrier} (the reusable barrier protocol\n * the migration cutover and klum both call).\n *\n * @module\n */\n\nimport { QuiesceTimeoutError } from '../errors.js'\nimport type { Unsubscribe } from '../write-hooks.js'\n\n/** Vault fence state (the existing FenceDoc shape). */\nexport interface FenceState {\n readonly currentSchemaVersion: number\n readonly fenceState: 'normal' | 'draining' | 'migrating' | 'complete'\n}\n\n/** A writer's presence + ack, tagged with the session that owns it. */\nexport interface WriterPresence {\n /** = today's clientId (one per tab/peer). */\n readonly writerId: string\n /** Groups one user's writers across vaults (consolidation is klum's job). */\n readonly sessionId: string\n readonly lastSeen: number\n readonly quiescedAtVersion: number | null\n}\n\n/** Session-addressable drain-barrier coordination transport. Per-vault ops. */\nexport interface CoordinationProvider {\n /** orchestrator → all writers */\n setFence(vault: string, fence: FenceState): Promise<void>\n /**\n * Fresh one-shot fence read for the write-path gate (`assertWritable`).\n * A direct read (not a cached `observeFence` snapshot) avoids a staleness\n * window and keeps the timing-sensitive cutover gate exact. The store\n * default reads `_meta/schema-fence`; `by-*` return their last-pushed fence.\n */\n readFence(vault: string): Promise<FenceState>\n /** writer observes fence changes (default: poll-emit; by-*: push) */\n observeFence(vault: string, onChange: (f: FenceState) => void): Unsubscribe\n /** writer → orchestrator: presence + ack (heartbeat + quiescedAtVersion) */\n reportPresence(vault: string, p: WriterPresence): Promise<void>\n /** orchestrator observes presence changes (default: poll-emit; by-*: push) */\n observePresence(vault: string, onChange: (writers: readonly WriterPresence[]) => void): Unsubscribe\n /** orchestrator one-shot snapshot of reachable writers (quorum input) */\n reachableWriters(vault: string, o: { staleMs: number; now: number }): Promise<readonly WriterPresence[]>\n}\n\n/**\n * Pure quorum predicate: true when every writer (other than `excludeWriterId`)\n * has acked at exactly `generation`. An empty set is trivially a quorum.\n *\n * Extracted from the legacy `activeQuiesced` store-polling check so the\n * migration cutover, the store default provider, and `by-*` real-time\n * providers all share one definition of \"everyone has drained\".\n */\nexport function isQuorum(\n writers: readonly WriterPresence[],\n generation: number,\n excludeWriterId?: string,\n): boolean {\n return writers.filter((w) => w.writerId !== excludeWriterId).every((w) => w.quiescedAtVersion === generation)\n}\n\n/** Inputs for {@link runDrainBarrier}. */\nexport interface DrainBarrierOptions {\n readonly vault: string\n readonly generation: number\n readonly writerId: string\n readonly onFlush: () => Promise<void>\n readonly staleMs: number\n readonly quiesceTimeoutMs: number\n readonly now: () => number\n /** Optional seam (mainly for deterministic tests) run before each poll tick. */\n readonly onPoll?: () => Promise<void>\n}\n\n/**\n * The reusable drain-barrier protocol shared by the migration cutover and klum:\n *\n * drain self → setFence(draining) → await quorum (presence push + isQuorum,\n * polling as a fallback, or timeout) → run() → release-by-caller.\n *\n * Resolves once every reachable writer (excluding `writerId`) has quiesced at\n * `generation`, at which point `run` is invoked exactly once. Rejects with\n * {@link QuiesceTimeoutError} if `quiesceTimeoutMs` elapses first.\n */\nexport async function runDrainBarrier(\n provider: CoordinationProvider,\n o: DrainBarrierOptions,\n run: () => Promise<void>,\n): Promise<void> {\n await provider.setFence(o.vault, { currentSchemaVersion: o.generation, fenceState: 'draining' })\n await o.onFlush()\n\n const deadline = o.now() + o.quiesceTimeoutMs\n const seeded = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() })\n if (!isQuorum(seeded, o.generation, o.writerId)) {\n await new Promise<void>((resolve, reject) => {\n let settled = false\n const finish = (fn: () => void) => {\n if (!settled) {\n settled = true\n unsub()\n fn()\n }\n }\n const unsub = provider.observePresence(o.vault, (writers) => {\n if (isQuorum(writers, o.generation, o.writerId)) finish(resolve)\n })\n const tick = async () => {\n if (settled) return\n if (o.now() >= deadline) {\n finish(() =>\n reject(\n new QuiesceTimeoutError(\n `Cutover of vault \"${o.vault}\" to generation ${o.generation} timed out ` +\n `after ${o.quiesceTimeoutMs}ms waiting for active writers to quiesce.`,\n ),\n ),\n )\n return\n }\n if (o.onPoll) await o.onPoll()\n const w = await provider.reachableWriters(o.vault, { staleMs: o.staleMs, now: o.now() })\n if (isQuorum(w, o.generation, o.writerId)) finish(resolve)\n else setTimeout(() => void tick(), 25)\n }\n void tick()\n })\n }\n await run()\n}\n","/**\n * Schema-fence document. Vault-level generation counter + drain\n * state, stored at `_meta/schema-fence` using the plaintext-envelope\n * pattern of `_meta/policy` (no PII — a counter + a state enum).\n */\nimport type { NoydbStore, EncryptedEnvelope } from '../types.js'\nimport { NOYDB_FORMAT_VERSION } from '../types.js'\n\nexport type FenceState = 'normal' | 'draining' | 'migrating' | 'complete'\n\nexport interface FenceDoc {\n readonly currentSchemaVersion: number\n readonly fenceState: FenceState\n}\n\nexport const FENCE_RECORD_ID = 'schema-fence'\nconst META_COLLECTION = '_meta'\n\nexport const DEFAULT_FENCE: FenceDoc = { currentSchemaVersion: 0, fenceState: 'normal' }\n\nexport async function loadFence(store: NoydbStore, vault: string): Promise<FenceDoc> {\n const envelope = await store.get(vault, META_COLLECTION, FENCE_RECORD_ID)\n if (!envelope) return DEFAULT_FENCE\n try {\n const parsed = JSON.parse(envelope._data) as unknown\n if (!isFenceDoc(parsed)) return DEFAULT_FENCE\n return parsed\n } catch {\n return DEFAULT_FENCE\n }\n}\n\nexport async function saveFence(store: NoydbStore, vault: string, fence: FenceDoc): Promise<void> {\n const envelope: EncryptedEnvelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: 1,\n _ts: new Date().toISOString(),\n _iv: '',\n _data: JSON.stringify(fence),\n }\n await store.put(vault, META_COLLECTION, FENCE_RECORD_ID, envelope)\n}\n\nfunction isFenceDoc(x: unknown): x is FenceDoc {\n if (x === null || typeof x !== 'object') return false\n const o = x as Record<string, unknown>\n return typeof o['currentSchemaVersion'] === 'number'\n && (o['fenceState'] === 'normal' || o['fenceState'] === 'draining'\n || o['fenceState'] === 'migrating' || o['fenceState'] === 'complete')\n}\n","/**\n * Schema-cutover client registry. Each client keeps a\n * heartbeat doc at `_meta/schema-fence:client:<clientId>` carrying its\n * liveness (`lastSeen`) and the fence generation it has quiesced for\n * (`quiescedAtVersion`). Plaintext envelope, like the fence doc.\n */\nimport type { NoydbStore, EncryptedEnvelope } from '../types.js'\nimport { NOYDB_FORMAT_VERSION } from '../types.js'\n\nconst META_COLLECTION = '_meta'\nconst CLIENT_PREFIX = 'schema-fence:client:'\n\nexport interface ClientDoc {\n readonly clientId: string\n readonly lastSeen: number\n readonly quiescedAtVersion: number | null\n /**\n * Session that owns this writer (one user's writers across vaults). Additive\n * and optional so pre-#469 client docs keep parsing; readers default it.\n */\n readonly sessionId?: string\n}\n\nexport async function writeClientDoc(\n store: NoydbStore,\n vault: string,\n clientId: string,\n doc: { lastSeen: number; quiescedAtVersion: number | null; sessionId?: string },\n): Promise<void> {\n const envelope: EncryptedEnvelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: 1,\n _ts: new Date().toISOString(),\n _iv: '',\n _data: JSON.stringify({ clientId, ...doc }),\n }\n await store.put(vault, META_COLLECTION, `${CLIENT_PREFIX}${clientId}`, envelope)\n}\n\nexport async function listClientDocs(store: NoydbStore, vault: string): Promise<ClientDoc[]> {\n const ids = await store.list(vault, META_COLLECTION)\n const out: ClientDoc[] = []\n for (const id of ids) {\n if (!id.startsWith(CLIENT_PREFIX)) continue\n const env = await store.get(vault, META_COLLECTION, id)\n if (!env) continue\n try {\n const parsed = JSON.parse(env._data) as unknown\n if (isClientDoc(parsed)) out.push(parsed)\n } catch { /* skip corrupt */ }\n }\n return out\n}\n\n/**\n * True when every *active* client (lastSeen within staleMs of now) has\n * `quiescedAtVersion === generation`. Stale clients are ignored. An empty\n * active set is vacuously quiesced.\n */\nexport async function activeQuiesced(\n store: NoydbStore,\n vault: string,\n opts: { generation: number; now: number; staleMs: number; excludeClientId?: string },\n): Promise<boolean> {\n const docs = await listClientDocs(store, vault)\n const active = docs.filter(\n d => d.lastSeen >= opts.now - opts.staleMs && d.clientId !== opts.excludeClientId,\n )\n return active.every(d => d.quiescedAtVersion === opts.generation)\n}\n\nfunction isClientDoc(x: unknown): x is ClientDoc {\n if (x === null || typeof x !== 'object') return false\n const o = x as Record<string, unknown>\n return typeof o['clientId'] === 'string'\n && typeof o['lastSeen'] === 'number'\n && (o['quiescedAtVersion'] === null || typeof o['quiescedAtVersion'] === 'number')\n && (o['sessionId'] === undefined || typeof o['sessionId'] === 'string')\n}\n","/**\n * Store-backed default {@link CoordinationProvider}.\n *\n * Maps the five coordination-port methods onto today's `_meta/schema-fence`\n * store ops so that, with no `by-*` provider injected, the fence subsystem\n * reproduces its current store-polling behavior byte-for-byte. The `observe*`\n * methods are poll-emit (the legacy {@link FenceWatcher} model); `by-tabs` /\n * `by-peer` override them with real-time push.\n *\n * @module\n */\n\nimport type { NoydbStore } from '../types.js'\nimport type { Unsubscribe } from '../write-hooks.js'\nimport { loadFence, saveFence, type FenceDoc } from '../schema-update/fence.js'\nimport { writeClientDoc, listClientDocs, type ClientDoc } from '../schema-update/client-registry.js'\nimport type { CoordinationProvider, FenceState, WriterPresence } from './types.js'\n\n/**\n * Default poll cadence for the `observe*` fallbacks (ms). Matches the\n * store-poll granularity the fence-controller uses while waiting for quorum\n * (`delay(50)`); the same value the migration cutover falls back to when no\n * real-time provider is injected.\n */\nconst DEFAULT_POLL_INTERVAL_MS = 50\n\n/** Map a stored {@link ClientDoc} to the port's {@link WriterPresence}. */\nfunction toPresence(doc: ClientDoc): WriterPresence {\n return {\n writerId: doc.clientId,\n // Pre-#469 docs (and explicit empty) have no session — fall back to the\n // writerId so every presence is session-addressable.\n sessionId: doc.sessionId && doc.sessionId.length > 0 ? doc.sessionId : doc.clientId,\n lastSeen: doc.lastSeen,\n quiescedAtVersion: doc.quiescedAtVersion,\n }\n}\n\nfunction fenceEqual(a: FenceState, b: FenceState): boolean {\n return a.currentSchemaVersion === b.currentSchemaVersion && a.fenceState === b.fenceState\n}\n\nfunction presenceListEqual(a: readonly WriterPresence[], b: readonly WriterPresence[]): boolean {\n if (a.length !== b.length) return false\n const key = (w: WriterPresence) => `${w.writerId}\u0000${w.sessionId}\u0000${w.lastSeen}\u0000${String(w.quiescedAtVersion)}`\n const bk = new Set(b.map(key))\n return a.every((w) => bk.has(key(w)))\n}\n\nexport class StoreCoordinationProvider implements CoordinationProvider {\n readonly #store: NoydbStore\n readonly #pollIntervalMs: number\n\n constructor(store: NoydbStore, opts?: { pollIntervalMs?: number }) {\n this.#store = store\n this.#pollIntervalMs = opts?.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS\n }\n\n async setFence(vault: string, fence: FenceState): Promise<void> {\n // FenceState is structurally FenceDoc (currentSchemaVersion + fenceState).\n await saveFence(this.#store, vault, fence as FenceDoc)\n }\n\n async readFence(vault: string): Promise<FenceState> {\n // FenceDoc is structurally FenceState (currentSchemaVersion + fenceState).\n return loadFence(this.#store, vault)\n }\n\n observeFence(vault: string, onChange: (f: FenceState) => void): Unsubscribe {\n let last: FenceState | null = null\n let busy = false\n const poll = async () => {\n if (busy) return\n busy = true\n try {\n const fence = await loadFence(this.#store, vault)\n if (last === null || !fenceEqual(last, fence)) {\n last = fence\n onChange(fence)\n }\n } catch {\n /* transient store error — retry next tick */\n } finally {\n busy = false\n }\n }\n void poll() // emit current state once immediately\n const timer = setInterval(() => void poll(), this.#pollIntervalMs)\n unref(timer)\n return () => clearInterval(timer)\n }\n\n async reportPresence(vault: string, p: WriterPresence): Promise<void> {\n await writeClientDoc(this.#store, vault, p.writerId, {\n lastSeen: p.lastSeen,\n quiescedAtVersion: p.quiescedAtVersion,\n sessionId: p.sessionId,\n })\n }\n\n observePresence(vault: string, onChange: (writers: readonly WriterPresence[]) => void): Unsubscribe {\n let last: readonly WriterPresence[] | null = null\n let busy = false\n const poll = async () => {\n if (busy) return\n busy = true\n try {\n const docs = await listClientDocs(this.#store, vault)\n const writers = docs.map(toPresence)\n if (last === null || !presenceListEqual(last, writers)) {\n last = writers\n onChange(writers)\n }\n } catch {\n /* transient store error — retry next tick */\n } finally {\n busy = false\n }\n }\n void poll() // emit current set once immediately\n const timer = setInterval(() => void poll(), this.#pollIntervalMs)\n unref(timer)\n return () => clearInterval(timer)\n }\n\n async reachableWriters(vault: string, o: { staleMs: number; now: number }): Promise<readonly WriterPresence[]> {\n const docs = await listClientDocs(this.#store, vault)\n return docs.map(toPresence).filter((w) => o.now - w.lastSeen <= o.staleMs)\n }\n}\n\n/** Best-effort `unref` so a poll timer never holds the process open (Node only). */\nfunction unref(timer: ReturnType<typeof setInterval>): void {\n const t = timer as unknown as { unref?: () => void }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AAE,UAAU;AAAA,MACnD,UAAU,EAAE;AAAA,MACZ,mBAAmB,EAAE;AAAA,MACrB,WAAW,EAAE;AAAA,IACf,CAAC;AAAA,EACH;AAAA,EAEA,gBAAgB,OAAe,UAAqE;AAClG,QAAI,OAAyC;AAC7C,QAAI,OAAO;AACX,UAAM,OAAO,YAAY;AACvB,UAAI,KAAM;AACV,aAAO;AACP,UAAI;AACF,cAAM,OAAO,MAAM,eAAe,KAAK,QAAQ,KAAK;AACpD,cAAM,UAAU,KAAK,IAAI,UAAU;AACnC,YAAI,SAAS,QAAQ,CAAC,kBAAkB,MAAM,OAAO,GAAG;AACtD,iBAAO;AACP,mBAAS,OAAO;AAAA,QAClB;AAAA,MACF,QAAQ;AAAA,MAER,UAAE;AACA,eAAO;AAAA,MACT;AAAA,IACF;AACA,SAAK,KAAK;AACV,UAAM,QAAQ,YAAY,MAAM,KAAK,KAAK,GAAG,KAAK,eAAe;AACjE,UAAM,KAAK;AACX,WAAO,MAAM,cAAc,KAAK;AAAA,EAClC;AAAA,EAEA,MAAM,iBAAiB,OAAe,GAAyE;AAC7G,UAAM,OAAO,MAAM,eAAe,KAAK,QAAQ,KAAK;AACpD,WAAO,KAAK,IAAI,UAAU,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO;AAAA,EAC3E;AACF;AAGA,SAAS,MAAM,OAA6C;AAC1D,QAAM,IAAI;AACV,MAAI,OAAO,EAAE,UAAU,WAAY,GAAE,MAAM;AAC7C;","names":["META_COLLECTION"]}
|
package/dist/consent/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a3 as ConsentStrategy } from '../types-
|
|
2
|
-
export { a4 as CONSENT_AUDIT_COLLECTION, a5 as ConsentAuditEntry, a6 as ConsentAuditFilter, a7 as ConsentContext, a8 as ConsentOp, a9 as loadConsentEntries, aa as writeConsentEntry } from '../types-
|
|
1
|
+
import { a3 as ConsentStrategy } from '../types-CwrTuYFI.cjs';
|
|
2
|
+
export { a4 as CONSENT_AUDIT_COLLECTION, a5 as ConsentAuditEntry, a6 as ConsentAuditFilter, a7 as ConsentContext, a8 as ConsentOp, a9 as loadConsentEntries, aa as writeConsentEntry } from '../types-CwrTuYFI.cjs';
|
|
3
3
|
import '../lazy-builder-eYZzLEL1.cjs';
|
|
4
4
|
import '../predicate-BmhBSPCH.cjs';
|
|
5
5
|
import '../strategy-D1zjEV3n.cjs';
|
package/dist/consent/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a3 as ConsentStrategy } from '../types-
|
|
2
|
-
export { a4 as CONSENT_AUDIT_COLLECTION, a5 as ConsentAuditEntry, a6 as ConsentAuditFilter, a7 as ConsentContext, a8 as ConsentOp, a9 as loadConsentEntries, aa as writeConsentEntry } from '../types-
|
|
1
|
+
import { a3 as ConsentStrategy } from '../types-CkSWJt0H.js';
|
|
2
|
+
export { a4 as CONSENT_AUDIT_COLLECTION, a5 as ConsentAuditEntry, a6 as ConsentAuditFilter, a7 as ConsentContext, a8 as ConsentOp, a9 as loadConsentEntries, aa as writeConsentEntry } from '../types-CkSWJt0H.js';
|
|
3
3
|
import '../lazy-builder-ChSqcF5t.js';
|
|
4
4
|
import '../predicate-BmhBSPCH.js';
|
|
5
5
|
import '../strategy-YQ1qJWyq.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bc as PublicEnvelope, bd as SealingKeyProvider, be as BundleRecipient, bf as RecipientSealer, bg as RecipientHint, bh as Vault } from './types-
|
|
1
|
+
import { bc as PublicEnvelope, bd as SealingKeyProvider, be as BundleRecipient, bf as RecipientSealer, bg as RecipientHint, bh as Vault } from './types-CkSWJt0H.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* `.noydb` container format — byte layout, header schema, validators.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bc as PublicEnvelope, bd as SealingKeyProvider, be as BundleRecipient, bf as RecipientSealer, bg as RecipientHint, bh as Vault } from './types-
|
|
1
|
+
import { bc as PublicEnvelope, bd as SealingKeyProvider, be as BundleRecipient, bf as RecipientSealer, bg as RecipientHint, bh as Vault } from './types-CwrTuYFI.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* `.noydb` container format — byte layout, header schema, validators.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { w as withDerivation, a as withRollup } from '../with-rollup-
|
|
2
|
-
import { aC as DerivationStrategy, aD as DerivationContext } from '../types-
|
|
3
|
-
export { aE as ArrayOutputSpec, aF as DerivationRegistry, aG as DerivationStrategyHandle, aH as DerivedFromMeta, aI as OutputSpec, aJ as RecordOutputSpec } from '../types-
|
|
1
|
+
export { w as withDerivation, a as withRollup } from '../with-rollup-B_zbRi3f.cjs';
|
|
2
|
+
import { aC as DerivationStrategy, aD as DerivationContext } from '../types-CwrTuYFI.cjs';
|
|
3
|
+
export { aE as ArrayOutputSpec, aF as DerivationRegistry, aG as DerivationStrategyHandle, aH as DerivedFromMeta, aI as OutputSpec, aJ as RecordOutputSpec } from '../types-CwrTuYFI.cjs';
|
|
4
4
|
export { i as DerivationCapExceededError, j as DerivationCycleError, k as DerivationDepthError, l as DerivationOutputShapeError, m as DerivationOutputUnknownError } from '../errors-Dwk2k1xY.cjs';
|
|
5
5
|
import '../lazy-builder-eYZzLEL1.cjs';
|
|
6
6
|
import '../predicate-BmhBSPCH.cjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { w as withDerivation, a as withRollup } from '../with-rollup-
|
|
2
|
-
import { aC as DerivationStrategy, aD as DerivationContext } from '../types-
|
|
3
|
-
export { aE as ArrayOutputSpec, aF as DerivationRegistry, aG as DerivationStrategyHandle, aH as DerivedFromMeta, aI as OutputSpec, aJ as RecordOutputSpec } from '../types-
|
|
1
|
+
export { w as withDerivation, a as withRollup } from '../with-rollup-BvaJefEs.js';
|
|
2
|
+
import { aC as DerivationStrategy, aD as DerivationContext } from '../types-CkSWJt0H.js';
|
|
3
|
+
export { aE as ArrayOutputSpec, aF as DerivationRegistry, aG as DerivationStrategyHandle, aH as DerivedFromMeta, aI as OutputSpec, aJ as RecordOutputSpec } from '../types-CkSWJt0H.js';
|
|
4
4
|
export { i as DerivationCapExceededError, j as DerivationCycleError, k as DerivationDepthError, l as DerivationOutputShapeError, m as DerivationOutputUnknownError } from '../errors-Dwk2k1xY.js';
|
|
5
5
|
import '../lazy-builder-ChSqcF5t.js';
|
|
6
6
|
import '../predicate-BmhBSPCH.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOYDB_FORMAT_VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AD6RNBAW.js";
|
|
4
4
|
|
|
5
5
|
// src/derivations/fanout-sidecar.ts
|
|
6
6
|
function recordId(source, sourceId, outputKey) {
|
|
@@ -48,4 +48,4 @@ export {
|
|
|
48
48
|
loadFanoutSidecar,
|
|
49
49
|
saveFanoutSidecar
|
|
50
50
|
};
|
|
51
|
-
//# sourceMappingURL=fanout-sidecar-
|
|
51
|
+
//# sourceMappingURL=fanout-sidecar-OC4QVTS2.js.map
|
package/dist/forget/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
NO_FORGET,
|
|
3
3
|
SUBJECT_INDEX_COLLECTION,
|
|
4
4
|
withForgetCascade
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-BMDVFBCL.js";
|
|
6
|
+
import "../chunk-AD6RNBAW.js";
|
|
7
7
|
import "../chunk-7JSP3E67.js";
|
|
8
8
|
import "../chunk-DDOYOMAD.js";
|
|
9
9
|
export {
|
package/dist/guards/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { I as ImmutableGuardConfig, T as TransitionGuardConfig, i as immutableGuard, t as transitionGuard, w as withGuard } from '../transition-guard-
|
|
2
|
-
import { an as GuardStrategy, ao as GuardChange, ap as GuardContext } from '../types-
|
|
3
|
-
export { aq as GuardRegistry, ar as GuardStrategyHandle, as as ReadOnlyVaultFacade } from '../types-
|
|
1
|
+
export { I as ImmutableGuardConfig, T as TransitionGuardConfig, i as immutableGuard, t as transitionGuard, w as withGuard } from '../transition-guard-Dzj68JWC.cjs';
|
|
2
|
+
import { an as GuardStrategy, ao as GuardChange, ap as GuardContext } from '../types-CwrTuYFI.cjs';
|
|
3
|
+
export { aq as GuardRegistry, ar as GuardStrategyHandle, as as ReadOnlyVaultFacade } from '../types-CwrTuYFI.cjs';
|
|
4
4
|
export { A as AmendmentForbiddenError, F as FieldFrozenError, I as IllegalTransitionError, f as InvariantError, g as RecordLockedError } from '../errors-Dwk2k1xY.cjs';
|
|
5
5
|
import '../lazy-builder-eYZzLEL1.cjs';
|
|
6
6
|
import '../predicate-BmhBSPCH.cjs';
|
package/dist/guards/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { I as ImmutableGuardConfig, T as TransitionGuardConfig, i as immutableGuard, t as transitionGuard, w as withGuard } from '../transition-guard-
|
|
2
|
-
import { an as GuardStrategy, ao as GuardChange, ap as GuardContext } from '../types-
|
|
3
|
-
export { aq as GuardRegistry, ar as GuardStrategyHandle, as as ReadOnlyVaultFacade } from '../types-
|
|
1
|
+
export { I as ImmutableGuardConfig, T as TransitionGuardConfig, i as immutableGuard, t as transitionGuard, w as withGuard } from '../transition-guard-CJmb8O8q.js';
|
|
2
|
+
import { an as GuardStrategy, ao as GuardChange, ap as GuardContext } from '../types-CkSWJt0H.js';
|
|
3
|
+
export { aq as GuardRegistry, ar as GuardStrategyHandle, as as ReadOnlyVaultFacade } from '../types-CkSWJt0H.js';
|
|
4
4
|
export { A as AmendmentForbiddenError, F as FieldFrozenError, I as IllegalTransitionError, f as InvariantError, g as RecordLockedError } from '../errors-Dwk2k1xY.js';
|
|
5
5
|
import '../lazy-builder-ChSqcF5t.js';
|
|
6
6
|
import '../predicate-BmhBSPCH.js';
|