@powerhousedao/reactor 6.2.2-dev.41 → 6.2.2-dev.43
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/{build-worker-executor-CAEZD_yJ.js → build-worker-executor-CBWALjgq.js} +2 -2
- package/dist/{build-worker-executor-CAEZD_yJ.js.map → build-worker-executor-CBWALjgq.js.map} +1 -1
- package/dist/{document-indexer-C0GB0b8Q.js → document-indexer-BfdCgjG-.js} +15 -14
- package/dist/document-indexer-BfdCgjG-.js.map +1 -0
- package/dist/{drive-container-types-BJCKXJwH.js → drive-container-types-CU1ZUfD1.js} +178 -26
- package/dist/drive-container-types-CU1ZUfD1.js.map +1 -0
- package/dist/entry.js +2 -2
- package/dist/index.d.ts +104 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +93 -18
- package/dist/index.js.map +1 -1
- package/dist/projection-entry.js +3 -3
- package/dist/{worker-jEJW6_j7.js → worker-CeW6WsVF.js} +2 -2
- package/dist/{worker-jEJW6_j7.js.map → worker-CeW6WsVF.js.map} +1 -1
- package/package.json +4 -4
- package/dist/document-indexer-C0GB0b8Q.js.map +0 -1
- package/dist/drive-container-types-BJCKXJwH.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ReactorEventTypes, t as EventBusAggregateError } from "./types-DMKLa0Ok.js";
|
|
2
|
-
import { AUTH_ACTION_TYPES, AUTH_DENIED_BY_GRANT_REASON, AUTH_NO_GRANT_REASON, AUTH_VERSION_UNSUPPORTED_REASON, DOCUMENT_DELETED_REASON, DowngradeNotSupportedError, appendWithoutApplying, applyAuthAction, applyDeleteDocumentAction, applyDeleteDocumentAction as applyDeleteDocumentAction$1, applyUpgradeDocumentAction, applyUpgradeDocumentAction as applyUpgradeDocumentAction$1, baseReducerVersion, createPresignedHeader, decide, defaultBaseState, deriveOperationId, evaluate, garbageCollect, hashDocumentStateForScope, isDenied, isUndoRedo, sortOperations } from "@powerhousedao/shared/document-model";
|
|
2
|
+
import { AUTH_ACTION_TYPES, AUTH_DENIED_BY_GRANT_REASON, AUTH_NO_GRANT_REASON, AUTH_VERSION_UNSUPPORTED_REASON, DOCUMENT_DELETED_REASON, DowngradeNotSupportedError as DowngradeNotSupportedError$1, appendWithoutApplying, applyAuthAction, applyDeleteDocumentAction, applyDeleteDocumentAction as applyDeleteDocumentAction$1, applyUpgradeDocumentAction, applyUpgradeDocumentAction as applyUpgradeDocumentAction$1, baseReducerVersion, createPresignedHeader, decide, defaultBaseState, deriveOperationId, evaluate, garbageCollect, hashDocumentStateForScope, isDenied, isUndoRedo, normalizeDocumentModelVersion, sortOperations } from "@powerhousedao/shared/document-model";
|
|
3
3
|
import { v4 } from "uuid";
|
|
4
4
|
import { Migrator, sql } from "kysely";
|
|
5
5
|
//#region \0rolldown/runtime.js
|
|
@@ -182,6 +182,28 @@ var InvalidSignatureError = class InvalidSignatureError extends Error {
|
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
/**
|
|
185
|
+
* An UPGRADE_DOCUMENT action's preconditions (fromVersion and the per-scope
|
|
186
|
+
* revision snapshot) did not match the document state the executor loaded.
|
|
187
|
+
*
|
|
188
|
+
* Terminal rather than retryable: the action carries the client's snapshot,
|
|
189
|
+
* which stays stale no matter how often the job re-runs. The client is
|
|
190
|
+
* expected to re-read the document and submit a fresh action instead.
|
|
191
|
+
*/
|
|
192
|
+
var UpgradePreconditionFailedError = class UpgradePreconditionFailedError extends Error {
|
|
193
|
+
documentId;
|
|
194
|
+
detail;
|
|
195
|
+
constructor(documentId, detail) {
|
|
196
|
+
super(`Upgrade precondition failed for document ${documentId}: ${detail}`);
|
|
197
|
+
this.name = "UpgradePreconditionFailedError";
|
|
198
|
+
this.documentId = documentId;
|
|
199
|
+
this.detail = detail;
|
|
200
|
+
Error.captureStackTrace(this, UpgradePreconditionFailedError);
|
|
201
|
+
}
|
|
202
|
+
static isError(error) {
|
|
203
|
+
return Error.isError(error) && error.name === "UpgradePreconditionFailedError";
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
185
207
|
* Error thrown when a document is not found (no operations exist for the document ID).
|
|
186
208
|
*/
|
|
187
209
|
var DocumentNotFoundError = class DocumentNotFoundError extends Error {
|
|
@@ -1097,7 +1119,7 @@ function keyframeRevision(keyframe, documentId, scope) {
|
|
|
1097
1119
|
}
|
|
1098
1120
|
function extractModuleVersion(doc) {
|
|
1099
1121
|
const v = doc.state.document.version;
|
|
1100
|
-
return v
|
|
1122
|
+
return normalizeDocumentModelVersion(v);
|
|
1101
1123
|
}
|
|
1102
1124
|
/** The highest revision held, latest push winning a tie. */
|
|
1103
1125
|
function highestRevision(snapshots) {
|
|
@@ -1360,6 +1382,18 @@ var KyselyWriteCache = class KyselyWriteCache {
|
|
|
1360
1382
|
document: keyframe.document
|
|
1361
1383
|
};
|
|
1362
1384
|
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Rebuilds a scope from a keyframe or from the whole operation history.
|
|
1387
|
+
*
|
|
1388
|
+
* The document scope is always rebuilt first, because it carries the type,
|
|
1389
|
+
* the upgrades and the deletion marker. Its version-changing upgrades are not
|
|
1390
|
+
* applied there though: an upgrade reducer must see the state the requested
|
|
1391
|
+
* scope has reached at that upgrade's boundary, so each one is held back and
|
|
1392
|
+
* applied when the replay below crosses the boundary that
|
|
1393
|
+
* resolveModuleVersionForOp derives from it. Upgrades whose boundary lies past
|
|
1394
|
+
* the last replayed operation are applied at the end. Creation-time 0->N seed
|
|
1395
|
+
* upgrades carry the initial state, so they still apply immediately.
|
|
1396
|
+
*/
|
|
1363
1397
|
async coldMissRebuild(documentId, scope, branch, targetRevision, signal) {
|
|
1364
1398
|
const effectiveTargetRevision = targetRevision || Number.MAX_SAFE_INTEGER;
|
|
1365
1399
|
const keyframe = await this.findNearestKeyframe(documentId, scope, branch, effectiveTargetRevision, signal);
|
|
@@ -1368,6 +1402,7 @@ var KyselyWriteCache = class KyselyWriteCache {
|
|
|
1368
1402
|
let startRevision;
|
|
1369
1403
|
let documentType;
|
|
1370
1404
|
const validatedUpgrades = [];
|
|
1405
|
+
const pendingUpgrades = [];
|
|
1371
1406
|
let lastDocumentScopeOperation;
|
|
1372
1407
|
if (keyframe) {
|
|
1373
1408
|
document = keyframe.document;
|
|
@@ -1397,9 +1432,17 @@ var KyselyWriteCache = class KyselyWriteCache {
|
|
|
1397
1432
|
revision: upgradeAction.input.revision,
|
|
1398
1433
|
timestampUtcMs: operation.timestampUtcMs
|
|
1399
1434
|
});
|
|
1400
|
-
|
|
1435
|
+
pendingUpgrades.push({
|
|
1436
|
+
action: upgradeAction,
|
|
1437
|
+
upgradePath,
|
|
1438
|
+
index: operation.index,
|
|
1439
|
+
subsequentDeletes: []
|
|
1440
|
+
});
|
|
1401
1441
|
}
|
|
1402
|
-
} else if (operation.action.type === "DELETE_DOCUMENT")
|
|
1442
|
+
} else if (operation.action.type === "DELETE_DOCUMENT") {
|
|
1443
|
+
applyDeleteDocumentAction(document, operation.action);
|
|
1444
|
+
for (const pending of pendingUpgrades) pending.subsequentDeletes.push(operation.action);
|
|
1445
|
+
}
|
|
1403
1446
|
}
|
|
1404
1447
|
} else {
|
|
1405
1448
|
startRevision = -1;
|
|
@@ -1426,8 +1469,8 @@ var KyselyWriteCache = class KyselyWriteCache {
|
|
|
1426
1469
|
const upgradeAction = operation.action;
|
|
1427
1470
|
const fromVersion = upgradeAction.input.fromVersion;
|
|
1428
1471
|
const toVersion = upgradeAction.input.toVersion;
|
|
1429
|
-
let upgradePath;
|
|
1430
1472
|
if (fromVersion > 0 && fromVersion < toVersion) {
|
|
1473
|
+
let upgradePath;
|
|
1431
1474
|
try {
|
|
1432
1475
|
upgradePath = this.registry.computeUpgradePath(documentType, fromVersion, toVersion);
|
|
1433
1476
|
} catch (err) {
|
|
@@ -1440,11 +1483,18 @@ var KyselyWriteCache = class KyselyWriteCache {
|
|
|
1440
1483
|
revision: upgradeAction.input.revision,
|
|
1441
1484
|
timestampUtcMs: operation.timestampUtcMs
|
|
1442
1485
|
});
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1486
|
+
pendingUpgrades.push({
|
|
1487
|
+
action: upgradeAction,
|
|
1488
|
+
upgradePath,
|
|
1489
|
+
index: operation.index,
|
|
1490
|
+
subsequentDeletes: []
|
|
1491
|
+
});
|
|
1492
|
+
} else document = applyUpgradeDocumentAction(document, upgradeAction, void 0);
|
|
1493
|
+
docModule = this.registry.getModule(documentType, normalizeDocumentModelVersion(toVersion));
|
|
1494
|
+
} else if (operation.action.type === "DELETE_DOCUMENT") {
|
|
1495
|
+
applyDeleteDocumentAction(document, operation.action);
|
|
1496
|
+
for (const pending of pendingUpgrades) pending.subsequentDeletes.push(operation.action);
|
|
1497
|
+
} else {
|
|
1448
1498
|
const protocolVersion = baseReducerVersion(document.header);
|
|
1449
1499
|
document = docModule.reducer(document, operation.action, void 0, {
|
|
1450
1500
|
skip: operation.skip,
|
|
@@ -1454,6 +1504,7 @@ var KyselyWriteCache = class KyselyWriteCache {
|
|
|
1454
1504
|
}
|
|
1455
1505
|
}
|
|
1456
1506
|
if (scope === "document") {
|
|
1507
|
+
document = this.applyPendingUpgrades(document, pendingUpgrades, Number.MAX_SAFE_INTEGER);
|
|
1457
1508
|
const last = lastDocumentScopeOperation ?? await this.operationAt(documentId, "document", branch, startRevision, signal);
|
|
1458
1509
|
document.operations = {
|
|
1459
1510
|
...document.operations,
|
|
@@ -1478,6 +1529,7 @@ var KyselyWriteCache = class KyselyWriteCache {
|
|
|
1478
1529
|
}
|
|
1479
1530
|
return mod;
|
|
1480
1531
|
};
|
|
1532
|
+
const finalVersion = validatedUpgrades.at(-1)?.toVersion ?? extractModuleVersion(document);
|
|
1481
1533
|
let cursor = void 0;
|
|
1482
1534
|
const pageSize = 100;
|
|
1483
1535
|
let hasMorePages;
|
|
@@ -1491,7 +1543,8 @@ var KyselyWriteCache = class KyselyWriteCache {
|
|
|
1491
1543
|
const result = await this.operationStore.getSince(documentId, scope, branch, startRevision, void 0, paging, signal);
|
|
1492
1544
|
for (const operation of result.results) {
|
|
1493
1545
|
if (targetRevision !== void 0 && operation.index > targetRevision) break;
|
|
1494
|
-
const moduleVersion = this.resolveModuleVersionForOp(operation.index, operation.timestampUtcMs, scope, validatedUpgrades,
|
|
1546
|
+
const moduleVersion = this.resolveModuleVersionForOp(operation.index, operation.timestampUtcMs, scope, validatedUpgrades, finalVersion);
|
|
1547
|
+
document = this.applyPendingUpgrades(document, pendingUpgrades, moduleVersion ?? Number.MAX_SAFE_INTEGER);
|
|
1495
1548
|
if (isDenied(operation)) document = appendWithoutApplying(document, operation, scope);
|
|
1496
1549
|
else {
|
|
1497
1550
|
const protocolVersion = baseReducerVersion(document.header);
|
|
@@ -1508,7 +1561,62 @@ var KyselyWriteCache = class KyselyWriteCache {
|
|
|
1508
1561
|
throw new Error(`Failed to rebuild document ${documentId}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
1509
1562
|
}
|
|
1510
1563
|
} while (hasMorePages);
|
|
1511
|
-
|
|
1564
|
+
document = this.applyTailPendingUpgrades(document, pendingUpgrades, scope, targetRevision);
|
|
1565
|
+
document = await this.stampRevisions(document, documentId, scope, branch, targetRevision, signal);
|
|
1566
|
+
if (pendingUpgrades.length > 0) {
|
|
1567
|
+
const firstHeldBack = pendingUpgrades[0];
|
|
1568
|
+
const stamped = document.header.revision["document"] ?? 0;
|
|
1569
|
+
document.header.revision = {
|
|
1570
|
+
...document.header.revision,
|
|
1571
|
+
document: Math.min(stamped, firstHeldBack.index)
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
return document;
|
|
1575
|
+
}
|
|
1576
|
+
/**
|
|
1577
|
+
* Applies and removes every held-back upgrade whose target version is at or
|
|
1578
|
+
* below `throughVersion`, in the order the document scope recorded them.
|
|
1579
|
+
*/
|
|
1580
|
+
applyPendingUpgrades(document, pendingUpgrades, throughVersion) {
|
|
1581
|
+
while (pendingUpgrades.length > 0) {
|
|
1582
|
+
const pending = pendingUpgrades[0];
|
|
1583
|
+
if (throughVersion < pending.action.input.toVersion) break;
|
|
1584
|
+
pendingUpgrades.shift();
|
|
1585
|
+
document = this.applyPendingUpgrade(document, pending);
|
|
1586
|
+
}
|
|
1587
|
+
return document;
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Applies the remaining held-back upgrades after the requested scope's
|
|
1591
|
+
* replay has finished. A head read applies them all. A positional read
|
|
1592
|
+
* applies only those whose boundary for this scope lies at or before the
|
|
1593
|
+
* target position: applying a later one would label migrated state with a
|
|
1594
|
+
* pre-upgrade revision, and a keyframe stored from that poisons every
|
|
1595
|
+
* rebuild that resumes from it. Boundaries come from the upgrade's revision
|
|
1596
|
+
* snapshot; an upgrade without one records no position for this scope, and
|
|
1597
|
+
* the replay loop not having crossed it already places it past the target.
|
|
1598
|
+
*/
|
|
1599
|
+
applyTailPendingUpgrades(document, pendingUpgrades, scope, targetRevision) {
|
|
1600
|
+
while (pendingUpgrades.length > 0) {
|
|
1601
|
+
const pending = pendingUpgrades[0];
|
|
1602
|
+
if (targetRevision !== void 0) {
|
|
1603
|
+
const snapshot = pending.action.input.revision;
|
|
1604
|
+
if (snapshot === void 0) break;
|
|
1605
|
+
if ((snapshot[scope] ?? 0) > targetRevision) break;
|
|
1606
|
+
}
|
|
1607
|
+
pendingUpgrades.shift();
|
|
1608
|
+
document = this.applyPendingUpgrade(document, pending);
|
|
1609
|
+
}
|
|
1610
|
+
return document;
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Applies one held-back upgrade, then re-applies the deletes the document
|
|
1614
|
+
* scope recorded after it so the hold-back cannot invert their order.
|
|
1615
|
+
*/
|
|
1616
|
+
applyPendingUpgrade(document, pending) {
|
|
1617
|
+
document = applyUpgradeDocumentAction(document, pending.action, pending.upgradePath);
|
|
1618
|
+
for (const deleteAction of pending.subsequentDeletes) document = applyDeleteDocumentAction(document, deleteAction);
|
|
1619
|
+
return document;
|
|
1512
1620
|
}
|
|
1513
1621
|
/**
|
|
1514
1622
|
* Copies the current document revisions onto the document. Overwrites the
|
|
@@ -2442,13 +2550,6 @@ var DocumentActionHandler = class {
|
|
|
2442
2550
|
}
|
|
2443
2551
|
const documentState = document.state.document;
|
|
2444
2552
|
if (documentState.isDeleted && !this.alreadyEvaluated(executing)) return buildErrorResult(job, new DocumentDeletedError(documentId, documentState.deletedAtUtcIso), startTime);
|
|
2445
|
-
const nextIndex = getNextIndexForScope(document, job.scope);
|
|
2446
|
-
let upgradePath;
|
|
2447
|
-
if (fromVersion > 0 && fromVersion < toVersion) try {
|
|
2448
|
-
upgradePath = this.registry.computeUpgradePath(document.header.documentType, fromVersion, toVersion);
|
|
2449
|
-
} catch (error) {
|
|
2450
|
-
return buildErrorResult(job, error instanceof Error ? error : new Error(String(error)), startTime);
|
|
2451
|
-
}
|
|
2452
2553
|
if (fromVersion === toVersion && fromVersion > 0) return {
|
|
2453
2554
|
job,
|
|
2454
2555
|
success: true,
|
|
@@ -2456,6 +2557,48 @@ var DocumentActionHandler = class {
|
|
|
2456
2557
|
operationsWithContext: [],
|
|
2457
2558
|
duration: Date.now() - startTime
|
|
2458
2559
|
};
|
|
2560
|
+
const arrivesDecided = executing.replayingAcceptedHistory || executing.evaluatedByPosition;
|
|
2561
|
+
if (fromVersion > 0 && !arrivesDecided) {
|
|
2562
|
+
const stampedVersion = normalizeDocumentModelVersion(documentState.version);
|
|
2563
|
+
if (fromVersion !== stampedVersion) return buildErrorResult(job, new UpgradePreconditionFailedError(documentId, `fromVersion ${fromVersion} does not match the document's version ${stampedVersion}`), startTime);
|
|
2564
|
+
if (input.revision !== void 0) {
|
|
2565
|
+
let actualRevisions;
|
|
2566
|
+
try {
|
|
2567
|
+
actualRevisions = (await stores.operationStore.getRevisions(documentId, job.branch, signal)).revision;
|
|
2568
|
+
} catch (error) {
|
|
2569
|
+
return buildErrorResult(job, /* @__PURE__ */ new Error(`Failed to fetch revisions for upgrade: ${error instanceof Error ? error.message : String(error)}`), startTime);
|
|
2570
|
+
}
|
|
2571
|
+
const revisionScopes = new Set([...Object.keys(input.revision), ...Object.keys(actualRevisions)]);
|
|
2572
|
+
for (const revisionScope of revisionScopes) {
|
|
2573
|
+
const snapshot = input.revision[revisionScope] ?? 0;
|
|
2574
|
+
const actual = actualRevisions[revisionScope] ?? 0;
|
|
2575
|
+
if (snapshot !== actual) return buildErrorResult(job, new UpgradePreconditionFailedError(documentId, `revision snapshot for scope "${revisionScope}" is ${snapshot} but the document is at ${actual}`), startTime);
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
let upgradePath;
|
|
2580
|
+
if (fromVersion > 0 && fromVersion < toVersion) try {
|
|
2581
|
+
upgradePath = this.registry.computeUpgradePath(document.header.documentType, fromVersion, toVersion);
|
|
2582
|
+
} catch (error) {
|
|
2583
|
+
return buildErrorResult(job, error instanceof Error ? error : new Error(String(error)), startTime);
|
|
2584
|
+
}
|
|
2585
|
+
const otherScopes = Object.keys(document.state).filter((scope) => scope !== job.scope);
|
|
2586
|
+
if (fromVersion > 0) for (const scope of otherScopes) {
|
|
2587
|
+
let scopedDocument;
|
|
2588
|
+
try {
|
|
2589
|
+
scopedDocument = await stores.writeCache.getState(documentId, scope, job.branch, void 0, signal);
|
|
2590
|
+
} catch (error) {
|
|
2591
|
+
return buildErrorResult(job, /* @__PURE__ */ new Error(`Failed to fetch ${scope} scope for upgrade: ${error instanceof Error ? error.message : String(error)}`), startTime);
|
|
2592
|
+
}
|
|
2593
|
+
document = {
|
|
2594
|
+
...document,
|
|
2595
|
+
state: {
|
|
2596
|
+
...document.state,
|
|
2597
|
+
[scope]: scopedDocument.state[scope]
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
}
|
|
2601
|
+
const nextIndex = getNextIndexForScope(document, job.scope);
|
|
2459
2602
|
try {
|
|
2460
2603
|
document = applyUpgradeDocumentAction$1(document, action, upgradePath);
|
|
2461
2604
|
} catch (error) {
|
|
@@ -2470,6 +2613,7 @@ var DocumentActionHandler = class {
|
|
|
2470
2613
|
header: document.header,
|
|
2471
2614
|
...document.state
|
|
2472
2615
|
};
|
|
2616
|
+
if (fromVersion > 0) resultingStateObj.__migrated = true;
|
|
2473
2617
|
const resultingState = JSON.stringify(resultingStateObj);
|
|
2474
2618
|
const writeResult = await this.writeOperationToStore({
|
|
2475
2619
|
documentId,
|
|
@@ -2485,6 +2629,11 @@ var DocumentActionHandler = class {
|
|
|
2485
2629
|
[job.scope]: [...document.operations[job.scope] ?? [], operation]
|
|
2486
2630
|
};
|
|
2487
2631
|
stores.writeCache.putState(documentId, job.scope, job.branch, operation.index, document, SnapshotPosition.Head);
|
|
2632
|
+
for (const scope of otherScopes) executing.postCommitInvalidations.push({
|
|
2633
|
+
documentId,
|
|
2634
|
+
scope,
|
|
2635
|
+
branch: job.branch
|
|
2636
|
+
});
|
|
2488
2637
|
indexTxn.write([{
|
|
2489
2638
|
...operation,
|
|
2490
2639
|
documentId,
|
|
@@ -2711,6 +2860,7 @@ var SimpleJobExecutor = class {
|
|
|
2711
2860
|
async executeJob(job, signal) {
|
|
2712
2861
|
const startTime = Date.now();
|
|
2713
2862
|
const touchedCacheEntries = [];
|
|
2863
|
+
const postCommitInvalidations = [];
|
|
2714
2864
|
let pendingEvent;
|
|
2715
2865
|
let result;
|
|
2716
2866
|
try {
|
|
@@ -2724,7 +2874,8 @@ var SimpleJobExecutor = class {
|
|
|
2724
2874
|
stores,
|
|
2725
2875
|
signal,
|
|
2726
2876
|
replayingAcceptedHistory: true,
|
|
2727
|
-
evaluatedByPosition: false
|
|
2877
|
+
evaluatedByPosition: false,
|
|
2878
|
+
postCommitInvalidations
|
|
2728
2879
|
});
|
|
2729
2880
|
if (loadResult.success && loadResult.operationsWithContext) {
|
|
2730
2881
|
for (const owc of loadResult.operationsWithContext) touchedCacheEntries.push({
|
|
@@ -2753,7 +2904,8 @@ var SimpleJobExecutor = class {
|
|
|
2753
2904
|
stores,
|
|
2754
2905
|
signal,
|
|
2755
2906
|
replayingAcceptedHistory: false,
|
|
2756
|
-
evaluatedByPosition: positioned.evaluatedByPosition
|
|
2907
|
+
evaluatedByPosition: positioned.evaluatedByPosition,
|
|
2908
|
+
postCommitInvalidations
|
|
2757
2909
|
};
|
|
2758
2910
|
const actionResult = await this.processActions(positioned.writes, executing);
|
|
2759
2911
|
if (!actionResult.success) return {
|
|
@@ -2803,6 +2955,7 @@ var SimpleJobExecutor = class {
|
|
|
2803
2955
|
}
|
|
2804
2956
|
throw error;
|
|
2805
2957
|
}
|
|
2958
|
+
if (result.success) for (const entry of postCommitInvalidations) this.writeCache.invalidate(entry.documentId, entry.scope, entry.branch);
|
|
2806
2959
|
if (pendingEvent) this.eventBus.emit(ReactorEventTypes.JOB_WRITE_READY, pendingEvent).catch((error) => {
|
|
2807
2960
|
this.logger.error("Failed to emit JOB_WRITE_READY event: @Event : @Error", pendingEvent, error);
|
|
2808
2961
|
});
|
|
@@ -2918,8 +3071,7 @@ var SimpleJobExecutor = class {
|
|
|
2918
3071
|
}
|
|
2919
3072
|
let module;
|
|
2920
3073
|
try {
|
|
2921
|
-
|
|
2922
|
-
module = this.registry.getModule(document.header.documentType, moduleVersion);
|
|
3074
|
+
module = this.registry.getModule(document.header.documentType, normalizeDocumentModelVersion(documentVersion));
|
|
2923
3075
|
} catch (error) {
|
|
2924
3076
|
return buildErrorResult(job, error instanceof Error ? error : new Error(String(error)), startTime);
|
|
2925
3077
|
}
|
|
@@ -3527,7 +3679,7 @@ var DocumentModelRegistry = class {
|
|
|
3527
3679
|
}
|
|
3528
3680
|
computeUpgradePath(documentType, fromVersion, toVersion) {
|
|
3529
3681
|
if (fromVersion === toVersion) return [];
|
|
3530
|
-
if (toVersion < fromVersion) throw new DowngradeNotSupportedError(documentType, fromVersion, toVersion);
|
|
3682
|
+
if (toVersion < fromVersion) throw new DowngradeNotSupportedError$1(documentType, fromVersion, toVersion);
|
|
3531
3683
|
const manifest = this.getUpgradeManifest(documentType);
|
|
3532
3684
|
const path = [];
|
|
3533
3685
|
for (let v = fromVersion + 1; v <= toVersion; v++) {
|
|
@@ -4271,6 +4423,6 @@ async function getMigrationStatus(db, schema = REACTOR_SCHEMA) {
|
|
|
4271
4423
|
//#region src/core/drive-container-types.ts
|
|
4272
4424
|
const DEFAULT_DRIVE_CONTAINER_TYPES = new Set(["powerhouse/document-drive", "powerhouse/reactor-drive"]);
|
|
4273
4425
|
//#endregion
|
|
4274
|
-
export { OptimisticLockError as A, ExcessiveReshuffleError as B, DocumentMetaCache as C, APPEND_CONDITION_FAILED_PREFIX as D, CollectionMembershipCache as E, ModuleNotFoundError as F,
|
|
4426
|
+
export { OptimisticLockError as A, ExcessiveReshuffleError as B, DocumentMetaCache as C, APPEND_CONDITION_FAILED_PREFIX as D, CollectionMembershipCache as E, ModuleNotFoundError as F, throwIfAborted as G, UpgradePreconditionFailedError as H, AuthTimestampNotMonotonicError as I, __exportAll as K, AuthorizationDeniedError as L, DuplicateManifestError as M, DuplicateModuleError as N, AppendConditionFailedError as O, InvalidModuleError as P, DocumentDeletedError as R, KyselyOperationIndex as S, createEmptyConsistencyToken as T, matchesScope as U, InvalidOperationTimestampError as V, parsePagingOptions as W, KyselyExecutionScope as _, createForwardingPoolInstrumentation as a, EventBus as b, KyselyKeyframeStore as c, DriveCollectionId as d, decideAtHead as f, authDecisionModel as g, buildDecisionModel as h, runMigrations as i, RevisionMismatchError as j, DuplicateOperationError as k, DocumentModelRegistry as l, documentDecisionModel as m, REACTOR_SCHEMA as n, instrumentPgPool as o, selectDecisionModel as p, getMigrationStatus as r, KyselyOperationStore as s, DEFAULT_DRIVE_CONTAINER_TYPES as t, SimpleJobExecutor as u, FLAG_PREREQUISITES as v, createConsistencyToken as w, KyselyWriteCache as x, validateFeatureFlags as y, DocumentNotFoundError as z };
|
|
4275
4427
|
|
|
4276
|
-
//# sourceMappingURL=drive-container-types-
|
|
4428
|
+
//# sourceMappingURL=drive-container-types-CU1ZUfD1.js.map
|