@dudousxd/nestjs-durable 0.52.5 → 0.52.7
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/index.cjs +41 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +41 -11
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.cjs
CHANGED
|
@@ -1267,6 +1267,7 @@ var UNSUPPORTED_RUN_REQUEST = "unsupported-request";
|
|
|
1267
1267
|
var KNOWN_KINDS = /* @__PURE__ */ new Set([
|
|
1268
1268
|
"getRunDetail",
|
|
1269
1269
|
"getFanMembers",
|
|
1270
|
+
"getRun",
|
|
1270
1271
|
"listRuns",
|
|
1271
1272
|
"runFacets",
|
|
1272
1273
|
"runValueFacets",
|
|
@@ -1439,6 +1440,15 @@ var RunRequestResponder = class {
|
|
|
1439
1440
|
}
|
|
1440
1441
|
};
|
|
1441
1442
|
}
|
|
1443
|
+
if (body.kind === "getRun") {
|
|
1444
|
+
return {
|
|
1445
|
+
requestId: msg.requestId,
|
|
1446
|
+
result: {
|
|
1447
|
+
ok: true,
|
|
1448
|
+
data: run ?? null
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1442
1452
|
if (body.kind === "getFanMembers") {
|
|
1443
1453
|
const data = run ? await this.gateway.getFanMembers?.(body.runId, body.group, body.query) ?? null : null;
|
|
1444
1454
|
return {
|
|
@@ -1646,6 +1656,29 @@ var ProxyRunGateway = class {
|
|
|
1646
1656
|
});
|
|
1647
1657
|
return detail ? (0, import_nestjs_durable_core11.pageFan)(detail.timeline, group, query) : null;
|
|
1648
1658
|
}
|
|
1659
|
+
/**
|
|
1660
|
+
* The run alone, without its timeline. Read from the full detail when the control plane is too old
|
|
1661
|
+
* to know the verb: it then answers with no data, or with an unsupported-request error.
|
|
1662
|
+
*/
|
|
1663
|
+
async getRun(runId) {
|
|
1664
|
+
if (!this.knownUnsupported("getRun")) {
|
|
1665
|
+
try {
|
|
1666
|
+
const run = await this.request({
|
|
1667
|
+
kind: "getRun",
|
|
1668
|
+
runId
|
|
1669
|
+
});
|
|
1670
|
+
if (run !== void 0) return run;
|
|
1671
|
+
} catch (err) {
|
|
1672
|
+
if (!isUnsupported(err)) throw err;
|
|
1673
|
+
}
|
|
1674
|
+
this.unsupportedUntil.set("getRun", Date.now() + this.capabilityTtlMs);
|
|
1675
|
+
}
|
|
1676
|
+
const detail = await this.request({
|
|
1677
|
+
kind: "getRunDetail",
|
|
1678
|
+
runId
|
|
1679
|
+
});
|
|
1680
|
+
return detail?.run ?? null;
|
|
1681
|
+
}
|
|
1649
1682
|
knownUnsupported(kind) {
|
|
1650
1683
|
const until = this.unsupportedUntil.get(kind);
|
|
1651
1684
|
if (until === void 0) return false;
|
|
@@ -1868,7 +1901,7 @@ var RetentionPoller = class {
|
|
|
1868
1901
|
console.warn("[nestjs-durable] `retention` is configured but the store adapter does not implement pruneTerminalRuns; retention is disabled.");
|
|
1869
1902
|
return;
|
|
1870
1903
|
}
|
|
1871
|
-
|
|
1904
|
+
void this.sweep();
|
|
1872
1905
|
const intervalMs = retention.sweepInterval != null ? (0, import_nestjs_durable_core12.parseDuration)(retention.sweepInterval) : DEFAULT_SWEEP_INTERVAL_MS;
|
|
1873
1906
|
if (intervalMs > 0) {
|
|
1874
1907
|
this.timer = setInterval(() => void this.sweep(), intervalMs);
|
|
@@ -1891,9 +1924,8 @@ var RetentionPoller = class {
|
|
|
1891
1924
|
/**
|
|
1892
1925
|
* Prune one round.
|
|
1893
1926
|
*
|
|
1894
|
-
* Never rejects, for the same reason {@link TimerPoller.poll} does not: it is
|
|
1895
|
-
*
|
|
1896
|
-
* process) and fired as `void` on the interval (so a rejection is an unhandled one, also fatal).
|
|
1927
|
+
* Never rejects, for the same reason {@link TimerPoller.poll} does not: it is fired as `void` on
|
|
1928
|
+
* boot and on the interval, so a rejection would be an unhandled one, which is fatal.
|
|
1897
1929
|
* Pruning history is the least urgent thing this package does — a `pruneTerminalRuns` that fails
|
|
1898
1930
|
* on a locked table must cost this sweep and nothing more.
|
|
1899
1931
|
*/
|
|
@@ -2254,7 +2286,7 @@ var TimerPoller = class {
|
|
|
2254
2286
|
console.error(`[nestjs-durable] could not run enqueued run ${runId}:`, error);
|
|
2255
2287
|
});
|
|
2256
2288
|
});
|
|
2257
|
-
|
|
2289
|
+
void this.poll();
|
|
2258
2290
|
const intervalMs = this.options.timerPollMs ?? 1e3;
|
|
2259
2291
|
if (intervalMs > 0) {
|
|
2260
2292
|
this.timer = setInterval(() => void this.poll(), intervalMs);
|
|
@@ -2286,12 +2318,10 @@ var TimerPoller = class {
|
|
|
2286
2318
|
/**
|
|
2287
2319
|
* One sweep of the engine's recovery work.
|
|
2288
2320
|
*
|
|
2289
|
-
* **This method never rejects, and that is a hard requirement rather than defensiveness.**
|
|
2290
|
-
*
|
|
2291
|
-
*
|
|
2292
|
-
*
|
|
2293
|
-
* an unhandled rejection. Both are fatal, and both re-occur on the next boot with the same state,
|
|
2294
|
-
* so a single unrecoverable run crash-loops every worker in the deployment — taking down every
|
|
2321
|
+
* **This method never rejects, and that is a hard requirement rather than defensiveness.** Both
|
|
2322
|
+
* callers (the boot kick-off and the interval) fire it as `void`, so a rejection would surface as
|
|
2323
|
+
* an unhandled rejection, which is fatal, and would re-occur on the next boot with the same state:
|
|
2324
|
+
* a single unrecoverable run would crash-loop every worker in the deployment, taking down every
|
|
2295
2325
|
* other workflow with it. A poll that goes wrong must cost this tick, not the pod.
|
|
2296
2326
|
*
|
|
2297
2327
|
* Each sweep is isolated separately because they are independent: a store that fails
|