@noy-db/hub 0.6.0-pre.4 → 0.6.0-pre.5
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/broker/index.js +3 -3
- package/dist/cargo/index.js +4 -4
- package/dist/{chunk-7V2OGKES.js → chunk-7OWLS6MF.js} +106 -55
- package/dist/chunk-7OWLS6MF.js.map +1 -0
- package/dist/{chunk-XMC2ZTRD.js → chunk-BA2L5K25.js} +3 -3
- package/dist/{chunk-IQRP74OO.js → chunk-CTHXKNMO.js} +2 -2
- package/dist/{chunk-O42AUQCP.js → chunk-CXJTWRBD.js} +2 -2
- package/dist/{chunk-AHCSWNVL.js → chunk-J5HZUP3M.js} +3 -3
- package/dist/{chunk-HY6Y2P4Y.js → chunk-LJNGRBEG.js} +3 -3
- package/dist/{chunk-MYG6WIRJ.js → chunk-PXCBVDFY.js} +49 -12
- package/dist/chunk-PXCBVDFY.js.map +1 -0
- package/dist/{chunk-LWSJG3LI.js → chunk-RTAMLDWP.js} +6 -2
- package/dist/chunk-RTAMLDWP.js.map +1 -0
- package/dist/{chunk-WDDHMAAO.js → chunk-W3AEW5CF.js} +2 -2
- package/dist/{chunk-RW3XKAF3.js → chunk-WB24CH3C.js} +29 -3
- package/dist/chunk-WB24CH3C.js.map +1 -0
- package/dist/custody/index.js +2 -2
- package/dist/guards/index.js +1 -1
- package/dist/index.js +10 -10
- package/dist/kernel/vault.d.ts +9 -11
- package/dist/{liberate-BAHOP2TQ.js → liberate-AOU6GEDB.js} +3 -3
- package/dist/{noydb-QGPKEDXK.js → noydb-XE4VECNM.js} +6 -6
- package/dist/periods/index.js +5 -1
- package/dist/pod/index.js +6 -6
- package/dist/{seed-NPF3BZGQ.js → seed-RZRHXL5E.js} +2 -2
- package/dist/team/index.js +3 -3
- package/dist/with-audit/guards/immutable-guard.d.ts +14 -0
- package/dist/with-audit/periods/active.d.ts +28 -1
- package/dist/with-audit/periods/index.d.ts +4 -2
- package/dist/with-audit/periods/periods.d.ts +79 -4
- package/dist/with-audit/periods/strategy.d.ts +13 -4
- package/dist/with-audit/periods/vault-facade.d.ts +36 -10
- package/dist/with-party/team/keyring.d.ts +0 -1
- package/package.json +3 -3
- package/dist/chunk-7V2OGKES.js.map +0 -1
- package/dist/chunk-LWSJG3LI.js.map +0 -1
- package/dist/chunk-MYG6WIRJ.js.map +0 -1
- package/dist/chunk-RW3XKAF3.js.map +0 -1
- /package/dist/{chunk-XMC2ZTRD.js.map → chunk-BA2L5K25.js.map} +0 -0
- /package/dist/{chunk-IQRP74OO.js.map → chunk-CTHXKNMO.js.map} +0 -0
- /package/dist/{chunk-O42AUQCP.js.map → chunk-CXJTWRBD.js.map} +0 -0
- /package/dist/{chunk-AHCSWNVL.js.map → chunk-J5HZUP3M.js.map} +0 -0
- /package/dist/{chunk-HY6Y2P4Y.js.map → chunk-LJNGRBEG.js.map} +0 -0
- /package/dist/{chunk-WDDHMAAO.js.map → chunk-W3AEW5CF.js.map} +0 -0
- /package/dist/{liberate-BAHOP2TQ.js.map → liberate-AOU6GEDB.js.map} +0 -0
- /package/dist/{noydb-QGPKEDXK.js.map → noydb-XE4VECNM.js.map} +0 -0
- /package/dist/{seed-NPF3BZGQ.js.map → seed-RZRHXL5E.js.map} +0 -0
package/dist/broker/index.js
CHANGED
|
@@ -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-
|
|
33
|
+
const { enrollSeed } = await import("../seed-RZRHXL5E.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-
|
|
42
|
+
const { rotateSeed } = await import("../seed-RZRHXL5E.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-
|
|
59
|
+
const { mintStoreCredentials } = await import("../seed-RZRHXL5E.js");
|
|
60
60
|
const creds = await mintStoreCredentials({ ...ctx, config }, profile);
|
|
61
61
|
capturedEntry.cached = { creds, validUntil: cacheFloor(creds, skewMs) };
|
|
62
62
|
return creds;
|
package/dist/cargo/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
diffVault,
|
|
7
7
|
unsealDeks,
|
|
8
8
|
withCargo
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-LJNGRBEG.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-
|
|
19
|
+
} from "../chunk-W3AEW5CF.js";
|
|
20
20
|
import "../chunk-FZ6NYJ7L.js";
|
|
21
21
|
import "../chunk-FFDNKRCY.js";
|
|
22
22
|
import "../chunk-PL2GHSCM.js";
|
|
@@ -33,7 +33,7 @@ import "../chunk-XWX7GL56.js";
|
|
|
33
33
|
import "../chunk-CDB2HVQW.js";
|
|
34
34
|
import {
|
|
35
35
|
CustodyApi
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-BA2L5K25.js";
|
|
37
37
|
import "../chunk-4VUPLMZ6.js";
|
|
38
38
|
import "../chunk-2BMRJ6LQ.js";
|
|
39
39
|
import {
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "../chunk-IGJCYUT5.js";
|
|
47
47
|
import "../chunk-7G6VDWXB.js";
|
|
48
48
|
import "../chunk-UHXCLPGC.js";
|
|
49
|
-
import "../chunk-
|
|
49
|
+
import "../chunk-WB24CH3C.js";
|
|
50
50
|
import "../chunk-5JY5TSVY.js";
|
|
51
51
|
import "../chunk-AHLJSVRL.js";
|
|
52
52
|
import {
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
import {
|
|
66
66
|
CustodyApi,
|
|
67
67
|
NO_CUSTODY
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-BA2L5K25.js";
|
|
69
69
|
import {
|
|
70
70
|
DEFAULT_POSTURE,
|
|
71
71
|
ViaGraph
|
|
@@ -109,8 +109,10 @@ import {
|
|
|
109
109
|
} from "./chunk-PEOZ34EM.js";
|
|
110
110
|
import {
|
|
111
111
|
NO_PERIODS,
|
|
112
|
-
purgeMarkersOn
|
|
113
|
-
|
|
112
|
+
purgeMarkersOn,
|
|
113
|
+
resolvePeriodKey,
|
|
114
|
+
samePartition
|
|
115
|
+
} from "./chunk-PXCBVDFY.js";
|
|
114
116
|
import {
|
|
115
117
|
PERIODS_COLLECTION,
|
|
116
118
|
PERIOD_ARCHIVES_COLLECTION,
|
|
@@ -215,7 +217,7 @@ import {
|
|
|
215
217
|
saveShamirRecoveryEntries,
|
|
216
218
|
updateAuthenticator,
|
|
217
219
|
writeMagicLinkGrant
|
|
218
|
-
} from "./chunk-
|
|
220
|
+
} from "./chunk-CXJTWRBD.js";
|
|
219
221
|
import {
|
|
220
222
|
assertKeyringOpenAllowed,
|
|
221
223
|
buildRecipientKeyringFile,
|
|
@@ -230,7 +232,7 @@ import {
|
|
|
230
232
|
listUsers,
|
|
231
233
|
loadKeyring,
|
|
232
234
|
updateKeyringIdentity
|
|
233
|
-
} from "./chunk-
|
|
235
|
+
} from "./chunk-WB24CH3C.js";
|
|
234
236
|
import {
|
|
235
237
|
persistDirectoryConfig,
|
|
236
238
|
readDirectoryConfig
|
|
@@ -6120,6 +6122,18 @@ var DeferredNumberingStore = class {
|
|
|
6120
6122
|
};
|
|
6121
6123
|
|
|
6122
6124
|
// src/with-audit/periods/vault-facade.ts
|
|
6125
|
+
function hasPartition(partition) {
|
|
6126
|
+
return partition !== void 0 && partition.length > 0;
|
|
6127
|
+
}
|
|
6128
|
+
function scopeSuffix(options) {
|
|
6129
|
+
return hasPartition(options?.partition) ? ` in partition [${options.partition.join(", ")}]` : "";
|
|
6130
|
+
}
|
|
6131
|
+
function assertVaultWide(op, period, why) {
|
|
6132
|
+
if (!hasPartition(period.partition)) return;
|
|
6133
|
+
throw new ValidationError(
|
|
6134
|
+
`${op}: period "${period.name}" is partitioned ([${period.partition.join(", ")}]), and ${op} ${why} \u2014 it cannot be scoped to one timeline, because the store sees only ciphertext and cannot tell which partition a stored record belongs to. Close partitioned periods for their sealing semantics; run ${op} against an unpartitioned period covering the same window.`
|
|
6135
|
+
);
|
|
6136
|
+
}
|
|
6123
6137
|
var VaultPeriods = class {
|
|
6124
6138
|
constructor(deps) {
|
|
6125
6139
|
this.deps = deps;
|
|
@@ -6134,11 +6148,11 @@ var VaultPeriods = class {
|
|
|
6134
6148
|
periodCache = null;
|
|
6135
6149
|
async closePeriod(options) {
|
|
6136
6150
|
const existing = await this.loadPeriodsCache();
|
|
6137
|
-
this.deps.strategy.validatePeriodName(options.name, existing);
|
|
6151
|
+
this.deps.strategy.validatePeriodName(options.name, existing, options.partition);
|
|
6138
6152
|
if (typeof options.endDate !== "string" || options.endDate.length === 0) {
|
|
6139
6153
|
throw new ValidationError("closePeriod: endDate must be a non-empty ISO string.");
|
|
6140
6154
|
}
|
|
6141
|
-
const anchor = await this.deps.strategy.chainAnchor(existing);
|
|
6155
|
+
const anchor = await this.deps.strategy.chainAnchor(existing, options.partition);
|
|
6142
6156
|
const record = {
|
|
6143
6157
|
name: options.name,
|
|
6144
6158
|
kind: "closed",
|
|
@@ -6147,21 +6161,26 @@ var VaultPeriods = class {
|
|
|
6147
6161
|
closedBy: this.deps.userId(),
|
|
6148
6162
|
priorPeriodHash: anchor.priorPeriodHash,
|
|
6149
6163
|
...anchor.priorPeriodName !== void 0 && { priorPeriodName: anchor.priorPeriodName },
|
|
6150
|
-
...options.dateField !== void 0 && { dateField: options.dateField }
|
|
6164
|
+
...options.dateField !== void 0 && { dateField: options.dateField },
|
|
6165
|
+
...hasPartition(options.partition) && { partition: options.partition }
|
|
6151
6166
|
};
|
|
6152
|
-
const
|
|
6153
|
-
await this.
|
|
6167
|
+
const storageKey = resolvePeriodKey(record.name, record.partition);
|
|
6168
|
+
const envelope = await this.writeReserved(PERIODS_COLLECTION, storageKey, record);
|
|
6169
|
+
await this.deps.strategy.appendPeriodLedgerEntry(this.deps.getLedgerOrNull(), this.deps.userId(), envelope, storageKey);
|
|
6154
6170
|
existing.push(record);
|
|
6155
6171
|
this.periodCache = existing;
|
|
6156
6172
|
return record;
|
|
6157
6173
|
}
|
|
6158
6174
|
async openPeriod(options) {
|
|
6159
6175
|
const existing = await this.loadPeriodsCache();
|
|
6160
|
-
this.deps.strategy.validatePeriodName(options.name, existing);
|
|
6161
|
-
const prior = existing.find(
|
|
6176
|
+
this.deps.strategy.validatePeriodName(options.name, existing, options.partition);
|
|
6177
|
+
const prior = existing.find(
|
|
6178
|
+
(p) => p.name === options.fromPeriod && samePartition(p.partition, options.partition)
|
|
6179
|
+
);
|
|
6162
6180
|
if (!prior) {
|
|
6181
|
+
const where = hasPartition(options.partition) ? ` in partition [${options.partition.join(", ")}]` : "";
|
|
6163
6182
|
throw new ValidationError(
|
|
6164
|
-
`openPeriod: fromPeriod "${options.fromPeriod}" does not exist in this vault.`
|
|
6183
|
+
`openPeriod: fromPeriod "${options.fromPeriod}" does not exist in this vault${where}.`
|
|
6165
6184
|
);
|
|
6166
6185
|
}
|
|
6167
6186
|
if (prior.kind !== "closed") {
|
|
@@ -6191,7 +6210,7 @@ var VaultPeriods = class {
|
|
|
6191
6210
|
}
|
|
6192
6211
|
openingCollections.push(collName);
|
|
6193
6212
|
}
|
|
6194
|
-
const anchor = await this.deps.strategy.chainAnchor(existing);
|
|
6213
|
+
const anchor = await this.deps.strategy.chainAnchor(existing, options.partition);
|
|
6195
6214
|
const record = {
|
|
6196
6215
|
name: options.name,
|
|
6197
6216
|
kind: "opened",
|
|
@@ -6202,10 +6221,12 @@ var VaultPeriods = class {
|
|
|
6202
6221
|
closedBy: this.deps.userId(),
|
|
6203
6222
|
priorPeriodHash: anchor.priorPeriodHash,
|
|
6204
6223
|
priorPeriodName: anchor.priorPeriodName ?? prior.name,
|
|
6205
|
-
...openingCollections.length > 0 && { openingCollections }
|
|
6224
|
+
...openingCollections.length > 0 && { openingCollections },
|
|
6225
|
+
...hasPartition(options.partition) && { partition: options.partition }
|
|
6206
6226
|
};
|
|
6207
|
-
const
|
|
6208
|
-
await this.
|
|
6227
|
+
const storageKey = resolvePeriodKey(record.name, record.partition);
|
|
6228
|
+
const envelope = await this.writeReserved(PERIODS_COLLECTION, storageKey, record);
|
|
6229
|
+
await this.deps.strategy.appendPeriodLedgerEntry(this.deps.getLedgerOrNull(), this.deps.userId(), envelope, storageKey);
|
|
6209
6230
|
existing.push(record);
|
|
6210
6231
|
this.periodCache = existing;
|
|
6211
6232
|
return record;
|
|
@@ -6219,10 +6240,11 @@ var VaultPeriods = class {
|
|
|
6219
6240
|
* read only. Idempotent: a second call is a no-op that returns the
|
|
6220
6241
|
* same merged record without re-purging or re-appending a ledger entry.
|
|
6221
6242
|
*/
|
|
6222
|
-
async freezePeriod(name) {
|
|
6243
|
+
async freezePeriod(name, options) {
|
|
6223
6244
|
const existing = await this.loadPeriodsCache();
|
|
6224
|
-
const period =
|
|
6225
|
-
if (!period) throw new ValidationError(`freezePeriod: no period named "${name}".`);
|
|
6245
|
+
const period = this.findPeriod(existing, name, options);
|
|
6246
|
+
if (!period) throw new ValidationError(`freezePeriod: no period named "${name}"${scopeSuffix(options)}.`);
|
|
6247
|
+
assertVaultWide("freezePeriod", period, "purges delete markers by write-time across the whole store");
|
|
6226
6248
|
if (period.kind !== "closed") {
|
|
6227
6249
|
throw new ValidationError(
|
|
6228
6250
|
`freezePeriod: period "${name}" is "${period.kind}"; only a closed period can be frozen.`
|
|
@@ -6262,10 +6284,11 @@ var VaultPeriods = class {
|
|
|
6262
6284
|
* through to cold) and idempotent: a second call is a no-op returning the
|
|
6263
6285
|
* same merged record.
|
|
6264
6286
|
*/
|
|
6265
|
-
async archivePeriod(name) {
|
|
6287
|
+
async archivePeriod(name, options) {
|
|
6266
6288
|
const existing = await this.loadPeriodsCache();
|
|
6267
|
-
const period =
|
|
6268
|
-
if (!period) throw new ValidationError(`archivePeriod: no period named "${name}".`);
|
|
6289
|
+
const period = this.findPeriod(existing, name, options);
|
|
6290
|
+
if (!period) throw new ValidationError(`archivePeriod: no period named "${name}"${scopeSuffix(options)}.`);
|
|
6291
|
+
assertVaultWide("archivePeriod", period, "relocates records by write-time across the whole store");
|
|
6269
6292
|
if (period.kind !== "closed") {
|
|
6270
6293
|
throw new ValidationError(
|
|
6271
6294
|
`archivePeriod: period "${name}" is "${period.kind}"; only a closed period can be archived.`
|
|
@@ -6300,10 +6323,11 @@ var VaultPeriods = class {
|
|
|
6300
6323
|
* Idempotent once run; with no push-only targets it writes no companion and
|
|
6301
6324
|
* is re-runnable.
|
|
6302
6325
|
*/
|
|
6303
|
-
async purgePeriodTargets(name) {
|
|
6326
|
+
async purgePeriodTargets(name, options) {
|
|
6304
6327
|
const existing = await this.loadPeriodsCache();
|
|
6305
|
-
const period =
|
|
6306
|
-
if (!period) throw new ValidationError(`purgePeriodTargets: no period named "${name}".`);
|
|
6328
|
+
const period = this.findPeriod(existing, name, options);
|
|
6329
|
+
if (!period) throw new ValidationError(`purgePeriodTargets: no period named "${name}"${scopeSuffix(options)}.`);
|
|
6330
|
+
assertVaultWide("purgePeriodTargets", period, "sweeps delete markers by write-time off whole sync targets");
|
|
6307
6331
|
if (period.kind !== "closed") {
|
|
6308
6332
|
throw new ValidationError(
|
|
6309
6333
|
`purgePeriodTargets: period "${name}" is "${period.kind}"; only a closed period can be target-purged.`
|
|
@@ -6363,8 +6387,15 @@ var VaultPeriods = class {
|
|
|
6363
6387
|
purgedMarkerCount: freeze.purgedMarkerCount
|
|
6364
6388
|
};
|
|
6365
6389
|
}
|
|
6366
|
-
/**
|
|
6367
|
-
|
|
6390
|
+
/**
|
|
6391
|
+
* Return every closed / opened period in `closedAt` order, merged with any
|
|
6392
|
+
* freeze + archive companions.
|
|
6393
|
+
*
|
|
6394
|
+
* With no argument this spans EVERY timeline — the pre-#1005 behaviour, and
|
|
6395
|
+
* the right default for an audit sweep. Pass `{ partition }` to scope to one
|
|
6396
|
+
* timeline; `{ partition: [] }` (or omitting it) means the vault-wide one.
|
|
6397
|
+
*/
|
|
6398
|
+
async listPeriods(options) {
|
|
6368
6399
|
this.periodCache = null;
|
|
6369
6400
|
const all = await this.loadPeriodsCache();
|
|
6370
6401
|
const freezeIds = await this.deps.adapter.list(this.deps.vault, PERIOD_FREEZES_COLLECTION);
|
|
@@ -6385,7 +6416,8 @@ var VaultPeriods = class {
|
|
|
6385
6416
|
const tp = await this.readReserved(PERIOD_TARGET_PURGES_COLLECTION, id);
|
|
6386
6417
|
if (tp) targetPurges.set(tp.period, tp);
|
|
6387
6418
|
}
|
|
6388
|
-
|
|
6419
|
+
const scoped = options === void 0 ? all : all.filter((p) => samePartition(p.partition, options.partition));
|
|
6420
|
+
return scoped.map((p) => {
|
|
6389
6421
|
const f = freezes.get(p.name);
|
|
6390
6422
|
let merged = f ? this.mergeFreeze(p, f) : p;
|
|
6391
6423
|
const a = archives.get(p.name);
|
|
@@ -6395,21 +6427,34 @@ var VaultPeriods = class {
|
|
|
6395
6427
|
return merged;
|
|
6396
6428
|
});
|
|
6397
6429
|
}
|
|
6398
|
-
/**
|
|
6399
|
-
|
|
6430
|
+
/**
|
|
6431
|
+
* Look up a single period by name within one timeline, merged with its
|
|
6432
|
+
* freeze + archive + target-purge companions if any. Returns `null` if not
|
|
6433
|
+
* found.
|
|
6434
|
+
*
|
|
6435
|
+
* Names are only unique per partition (#1005), so this resolves against the
|
|
6436
|
+
* VAULT-WIDE timeline unless `{ partition }` says otherwise — matching how
|
|
6437
|
+
* every pre-partition period is stored.
|
|
6438
|
+
*/
|
|
6439
|
+
async getPeriod(name, options) {
|
|
6400
6440
|
const all = await this.loadPeriodsCache();
|
|
6401
|
-
const period =
|
|
6441
|
+
const period = this.findPeriod(all, name, options);
|
|
6402
6442
|
if (!period) return null;
|
|
6403
|
-
const
|
|
6404
|
-
const
|
|
6443
|
+
const key = resolvePeriodKey(name, options?.partition);
|
|
6444
|
+
const freeze = await this.readReserved(PERIOD_FREEZES_COLLECTION, key);
|
|
6445
|
+
const archive = await this.readReserved(PERIOD_ARCHIVES_COLLECTION, key);
|
|
6405
6446
|
let merged = freeze ? this.mergeFreeze(period, freeze) : period;
|
|
6406
6447
|
if (archive) merged = this.mergeArchive(merged, archive);
|
|
6407
|
-
const targetPurge = await this.readReserved(PERIOD_TARGET_PURGES_COLLECTION,
|
|
6448
|
+
const targetPurge = await this.readReserved(PERIOD_TARGET_PURGES_COLLECTION, key);
|
|
6408
6449
|
if (targetPurge) merged = this.mergeTargetPurge(merged, targetPurge);
|
|
6409
6450
|
return merged;
|
|
6410
6451
|
}
|
|
6411
|
-
/**
|
|
6412
|
-
|
|
6452
|
+
/** Resolve one period within the timeline named by `options` (vault-wide when absent). */
|
|
6453
|
+
findPeriod(all, name, options) {
|
|
6454
|
+
return all.find((p) => p.name === name && samePartition(p.partition, options?.partition));
|
|
6455
|
+
}
|
|
6456
|
+
/** Called by the gate bus before put/delete. `collection` selects the subject mapping (#1005). */
|
|
6457
|
+
async assertTsWritable(existing, incoming, collection) {
|
|
6413
6458
|
if (existing === null && incoming === null) return;
|
|
6414
6459
|
if (this.periodCache === null) {
|
|
6415
6460
|
this.periodCache = await this.deps.strategy.loadPeriods(
|
|
@@ -6419,7 +6464,12 @@ var VaultPeriods = class {
|
|
|
6419
6464
|
);
|
|
6420
6465
|
}
|
|
6421
6466
|
if (this.periodCache.length === 0) return;
|
|
6422
|
-
this.deps.strategy.assertTsWritable(
|
|
6467
|
+
this.deps.strategy.assertTsWritable(
|
|
6468
|
+
existing,
|
|
6469
|
+
incoming,
|
|
6470
|
+
this.periodCache,
|
|
6471
|
+
collection !== void 0 ? { collection, ...this.deps.strategy.partitionOf !== void 0 && { resolve: this.deps.strategy.partitionOf } } : void 0
|
|
6472
|
+
);
|
|
6423
6473
|
}
|
|
6424
6474
|
async loadPeriodsCache() {
|
|
6425
6475
|
if (this.periodCache !== null) return this.periodCache;
|
|
@@ -10609,13 +10659,13 @@ var Vault = class {
|
|
|
10609
10659
|
async openPeriod(options) {
|
|
10610
10660
|
return this.periods.openPeriod(options);
|
|
10611
10661
|
}
|
|
10612
|
-
/**
|
|
10613
|
-
async listPeriods() {
|
|
10614
|
-
return this.periods.listPeriods();
|
|
10662
|
+
/** Every closed / opened period in `closedAt` order; ALL timelines unless `{ partition }` scopes it (#1005). */
|
|
10663
|
+
async listPeriods(options) {
|
|
10664
|
+
return this.periods.listPeriods(options);
|
|
10615
10665
|
}
|
|
10616
|
-
/**
|
|
10617
|
-
async getPeriod(name) {
|
|
10618
|
-
return this.periods.getPeriod(name);
|
|
10666
|
+
/** One period by name within a timeline (vault-wide unless `{ partition }`). `null` if not found. */
|
|
10667
|
+
async getPeriod(name, options) {
|
|
10668
|
+
return this.periods.getPeriod(name, options);
|
|
10619
10669
|
}
|
|
10620
10670
|
/**
|
|
10621
10671
|
* Freeze a closed period (#604): purges in-window delete markers and
|
|
@@ -10625,8 +10675,8 @@ var Vault = class {
|
|
|
10625
10675
|
* and purging re-opens the #589 resurrection window for a peer offline
|
|
10626
10676
|
* since before the cutoff (see periods.ts's "Freeze" section).
|
|
10627
10677
|
*/
|
|
10628
|
-
async freezePeriod(name) {
|
|
10629
|
-
return this.periods.freezePeriod(name);
|
|
10678
|
+
async freezePeriod(name, options) {
|
|
10679
|
+
return this.periods.freezePeriod(name, options);
|
|
10630
10680
|
}
|
|
10631
10681
|
/**
|
|
10632
10682
|
* Archive a closed period (#613): relocates its in-window records from the
|
|
@@ -10635,8 +10685,8 @@ var Vault = class {
|
|
|
10635
10685
|
* the chained `_periods` record. Non-destructive (reads fall through to
|
|
10636
10686
|
* cold) and idempotent. Requires a routeStore with a cold route.
|
|
10637
10687
|
*/
|
|
10638
|
-
async archivePeriod(name) {
|
|
10639
|
-
return this.periods.archivePeriod(name);
|
|
10688
|
+
async archivePeriod(name, options) {
|
|
10689
|
+
return this.periods.archivePeriod(name, options);
|
|
10640
10690
|
}
|
|
10641
10691
|
/**
|
|
10642
10692
|
* Target-purge a closed+frozen period (#615): sweeps delete markers off the
|
|
@@ -10646,12 +10696,12 @@ var Vault = class {
|
|
|
10646
10696
|
* frozen first. Idempotent; a vault with no push-only targets writes no
|
|
10647
10697
|
* companion and is re-runnable.
|
|
10648
10698
|
*/
|
|
10649
|
-
async purgePeriodTargets(name) {
|
|
10650
|
-
return this.periods.purgePeriodTargets(name);
|
|
10699
|
+
async purgePeriodTargets(name, options) {
|
|
10700
|
+
return this.periods.purgePeriodTargets(name, options);
|
|
10651
10701
|
}
|
|
10652
10702
|
/** @internal — called by the gate bus before put/delete. */
|
|
10653
|
-
async _assertTsWritable(existing, incoming) {
|
|
10654
|
-
return this.periods.assertTsWritable(existing, incoming);
|
|
10703
|
+
async _assertTsWritable(existing, incoming, collection) {
|
|
10704
|
+
return this.periods.assertTsWritable(existing, incoming, collection);
|
|
10655
10705
|
}
|
|
10656
10706
|
/** List all collection names in this vault. */
|
|
10657
10707
|
async collections() {
|
|
@@ -13051,7 +13101,7 @@ var Noydb = class {
|
|
|
13051
13101
|
const v = this.vaultCache.get(e.vault);
|
|
13052
13102
|
if (!v) return;
|
|
13053
13103
|
const existing = e.op === "create" ? null : { ts: e.existingTs ?? null, record: e.existing ?? null };
|
|
13054
|
-
await v._assertTsWritable(existing, e.incoming);
|
|
13104
|
+
await v._assertTsWritable(existing, e.incoming, e.collection);
|
|
13055
13105
|
});
|
|
13056
13106
|
this.subsystemBus.registerGate("beforeDelete", async (e) => {
|
|
13057
13107
|
if (e.internal) return;
|
|
@@ -13059,7 +13109,8 @@ var Noydb = class {
|
|
|
13059
13109
|
if (!v) return;
|
|
13060
13110
|
await v._assertTsWritable(
|
|
13061
13111
|
{ ts: e.existingTs ?? null, record: e.existing ?? null },
|
|
13062
|
-
null
|
|
13112
|
+
null,
|
|
13113
|
+
e.collection
|
|
13063
13114
|
);
|
|
13064
13115
|
});
|
|
13065
13116
|
}
|
|
@@ -14363,4 +14414,4 @@ export {
|
|
|
14363
14414
|
Noydb,
|
|
14364
14415
|
createNoydb
|
|
14365
14416
|
};
|
|
14366
|
-
//# sourceMappingURL=chunk-
|
|
14417
|
+
//# sourceMappingURL=chunk-7OWLS6MF.js.map
|