@rivetkit/workflow-engine 3.0.1-preview.1 → 3.0.1
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/tsup/{chunk-OQDLVTH2.js → chunk-JMOI2OHA.js} +25 -27
- package/dist/tsup/chunk-JMOI2OHA.js.map +1 -0
- package/dist/tsup/{chunk-AO3IZAQ4.cjs → chunk-L4MA54VF.cjs} +25 -27
- package/dist/tsup/chunk-L4MA54VF.cjs.map +1 -0
- package/dist/tsup/index.cjs +2 -2
- package/dist/tsup/index.js +1 -1
- package/dist/tsup/testing.cjs +25 -25
- package/dist/tsup/testing.js +1 -1
- package/package.json +1 -1
- package/src/storage.ts +27 -40
- package/dist/tsup/chunk-AO3IZAQ4.cjs.map +0 -1
- package/dist/tsup/chunk-OQDLVTH2.js.map +0 -1
|
@@ -1669,48 +1669,46 @@ function splitBatchDeletes(keys) {
|
|
|
1669
1669
|
return chunks;
|
|
1670
1670
|
}
|
|
1671
1671
|
async function runDeletes(driver, deletions) {
|
|
1672
|
-
const
|
|
1672
|
+
const metadataOps = splitBatchDeletes(deletions.keys).map(
|
|
1673
|
+
(chunk) => () => driver.batchDelete(chunk)
|
|
1674
|
+
);
|
|
1675
|
+
const historyOps = [
|
|
1673
1676
|
...deletions.prefixes.map(
|
|
1674
1677
|
(prefix) => () => driver.deletePrefix(prefix)
|
|
1675
1678
|
),
|
|
1676
1679
|
...deletions.ranges.map(
|
|
1677
1680
|
(range) => () => driver.deleteRange(range.start, range.end)
|
|
1678
|
-
),
|
|
1679
|
-
...splitBatchDeletes(deletions.keys).map(
|
|
1680
|
-
(chunk) => () => driver.batchDelete(chunk)
|
|
1681
1681
|
)
|
|
1682
1682
|
];
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1683
|
+
for (const ops of [metadataOps, historyOps]) {
|
|
1684
|
+
for (let i = 0; i < ops.length; i += MAX_CONCURRENT_DELETES) {
|
|
1685
|
+
const results = await Promise.allSettled(
|
|
1686
|
+
ops.slice(i, i + MAX_CONCURRENT_DELETES).map((op) => Promise.resolve().then(op))
|
|
1687
|
+
);
|
|
1688
|
+
const failed = results.find(
|
|
1689
|
+
(result) => result.status === "rejected"
|
|
1690
|
+
);
|
|
1691
|
+
if ((failed == null ? void 0 : failed.status) === "rejected") throw failed.reason;
|
|
1692
|
+
}
|
|
1690
1693
|
}
|
|
1691
|
-
return
|
|
1694
|
+
return metadataOps.length > 0 || historyOps.length > 0;
|
|
1692
1695
|
}
|
|
1693
1696
|
async function deleteEntriesWithPrefix(storage, driver, prefixLocation, onHistoryUpdated) {
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
function collectDeletionsForPrefix(storage, prefixLocation) {
|
|
1701
|
-
const pending = {
|
|
1697
|
+
const entries = [...storage.history.entries].filter(
|
|
1698
|
+
([, entry]) => isLocationPrefix(prefixLocation, entry.location)
|
|
1699
|
+
);
|
|
1700
|
+
await runDeletes(driver, {
|
|
1702
1701
|
prefixes: [buildHistoryPrefix(prefixLocation)],
|
|
1703
|
-
keys: [],
|
|
1702
|
+
keys: entries.map(([, entry]) => buildEntryMetadataKey(entry.id)),
|
|
1704
1703
|
ranges: []
|
|
1705
|
-
};
|
|
1706
|
-
for (const [key, entry] of
|
|
1707
|
-
if (
|
|
1708
|
-
pending.keys.push(buildEntryMetadataKey(entry.id));
|
|
1704
|
+
});
|
|
1705
|
+
for (const [key, entry] of entries) {
|
|
1706
|
+
if (storage.history.entries.get(key) === entry) {
|
|
1709
1707
|
storage.entryMetadata.delete(entry.id);
|
|
1710
1708
|
storage.history.entries.delete(key);
|
|
1711
1709
|
}
|
|
1712
1710
|
}
|
|
1713
|
-
|
|
1711
|
+
if (entries.length > 0 && onHistoryUpdated) onHistoryUpdated();
|
|
1714
1712
|
}
|
|
1715
1713
|
function getEntry(storage, location) {
|
|
1716
1714
|
const key = locationToKey(storage, location);
|
|
@@ -4447,4 +4445,4 @@ export {
|
|
|
4447
4445
|
runWorkflow,
|
|
4448
4446
|
replayWorkflowFromStep
|
|
4449
4447
|
};
|
|
4450
|
-
//# sourceMappingURL=chunk-
|
|
4448
|
+
//# sourceMappingURL=chunk-JMOI2OHA.js.map
|