@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.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnErrorInput, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, StateStore, Transport, NamedTransport, ControlPlane, StalledRunInfo, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, TenantVerifier, TenantTokenSource, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, RunRequest, RunReply, DurableTopology, RunDetailOptions, RunDetail, FanPageQuery, FanPage, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, GroupHealth, RunWaiting, EngineEvent, StepInvocation,
|
|
1
|
+
import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnErrorInput, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, StateStore, Transport, NamedTransport, ControlPlane, StalledRunInfo, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, TenantVerifier, TenantTokenSource, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, RunRequest, RunReply, DurableTopology, RunDetailOptions, RunDetail, FanPageQuery, FanPage, WorkflowRun, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, GroupHealth, RunWaiting, EngineEvent, StepInvocation, TenantEvent } from '@dudousxd/nestjs-durable-core';
|
|
2
2
|
export { AttributeFilter, DynamicWorkflowCtx, EngineEvent, InferSearchAttributes, OnErrorInput, RunDetail, RunGateway, RunListItem, RunQuery, RunSchedulesOptions, RunStatus, RunWaiting, ScheduledWorkflow, SearchAttributes, SearchAttributesSchema, StepCheckpoint, StepEvent, StepLogger, TenantTokenSource, TenantVerifier, VerifiedTenant, WorkflowCtx, WorkflowEngine, WorkflowHandler, WorkflowRun, hmacTenantVerifier, prevCronFireMs, readSearchAttributes, runSchedules, scheduleRunIdAt, scheduledRunId, signTenantToken } from '@dudousxd/nestjs-durable-core';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { ConcurrencyOption, StartRunDeps, RunRedisWorkerOptions, RunningWorker, DurableWorkerRuntime } from '@dudousxd/durable-worker';
|
|
@@ -1216,6 +1216,11 @@ declare class ProxyRunGateway implements RunGateway {
|
|
|
1216
1216
|
getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
|
|
1217
1217
|
/** Paged from the full detail when the control plane is too old to page a fan itself. */
|
|
1218
1218
|
getFanMembers(runId: string, group: string, query: FanPageQuery): Promise<FanPage | null>;
|
|
1219
|
+
/**
|
|
1220
|
+
* The run alone, without its timeline. Read from the full detail when the control plane is too old
|
|
1221
|
+
* to know the verb: it then answers with no data, or with an unsupported-request error.
|
|
1222
|
+
*/
|
|
1223
|
+
getRun(runId: string): Promise<WorkflowRun | null>;
|
|
1219
1224
|
private knownUnsupported;
|
|
1220
1225
|
/** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
|
|
1221
1226
|
* it through as plain JSON, so a tenant's list rows name the wait too. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnErrorInput, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, StateStore, Transport, NamedTransport, ControlPlane, StalledRunInfo, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, TenantVerifier, TenantTokenSource, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, RunRequest, RunReply, DurableTopology, RunDetailOptions, RunDetail, FanPageQuery, FanPage, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, GroupHealth, RunWaiting, EngineEvent, StepInvocation,
|
|
1
|
+
import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnErrorInput, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, StateStore, Transport, NamedTransport, ControlPlane, StalledRunInfo, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, TenantVerifier, TenantTokenSource, WorkflowInputOf, StartOptions, RunResult, RunGateway, WorkflowEngine, EntityHandler, RunRequest, RunReply, DurableTopology, RunDetailOptions, RunDetail, FanPageQuery, FanPage, WorkflowRun, RunQuery, RunListItem, RunFacetQuery, RunFacetRow, RunValueAxis, RunValueFacetOptions, RunValueFacetRow, GroupHealth, RunWaiting, EngineEvent, StepInvocation, TenantEvent } from '@dudousxd/nestjs-durable-core';
|
|
2
2
|
export { AttributeFilter, DynamicWorkflowCtx, EngineEvent, InferSearchAttributes, OnErrorInput, RunDetail, RunGateway, RunListItem, RunQuery, RunSchedulesOptions, RunStatus, RunWaiting, ScheduledWorkflow, SearchAttributes, SearchAttributesSchema, StepCheckpoint, StepEvent, StepLogger, TenantTokenSource, TenantVerifier, VerifiedTenant, WorkflowCtx, WorkflowEngine, WorkflowHandler, WorkflowRun, hmacTenantVerifier, prevCronFireMs, readSearchAttributes, runSchedules, scheduleRunIdAt, scheduledRunId, signTenantToken } from '@dudousxd/nestjs-durable-core';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { ConcurrencyOption, StartRunDeps, RunRedisWorkerOptions, RunningWorker, DurableWorkerRuntime } from '@dudousxd/durable-worker';
|
|
@@ -1216,6 +1216,11 @@ declare class ProxyRunGateway implements RunGateway {
|
|
|
1216
1216
|
getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
|
|
1217
1217
|
/** Paged from the full detail when the control plane is too old to page a fan itself. */
|
|
1218
1218
|
getFanMembers(runId: string, group: string, query: FanPageQuery): Promise<FanPage | null>;
|
|
1219
|
+
/**
|
|
1220
|
+
* The run alone, without its timeline. Read from the full detail when the control plane is too old
|
|
1221
|
+
* to know the verb: it then answers with no data, or with an unsupported-request error.
|
|
1222
|
+
*/
|
|
1223
|
+
getRun(runId: string): Promise<WorkflowRun | null>;
|
|
1219
1224
|
private knownUnsupported;
|
|
1220
1225
|
/** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
|
|
1221
1226
|
* it through as plain JSON, so a tenant's list rows name the wait too. */
|
package/dist/index.js
CHANGED
|
@@ -1170,6 +1170,7 @@ var UNSUPPORTED_RUN_REQUEST = "unsupported-request";
|
|
|
1170
1170
|
var KNOWN_KINDS = /* @__PURE__ */ new Set([
|
|
1171
1171
|
"getRunDetail",
|
|
1172
1172
|
"getFanMembers",
|
|
1173
|
+
"getRun",
|
|
1173
1174
|
"listRuns",
|
|
1174
1175
|
"runFacets",
|
|
1175
1176
|
"runValueFacets",
|
|
@@ -1342,6 +1343,15 @@ var RunRequestResponder = class {
|
|
|
1342
1343
|
}
|
|
1343
1344
|
};
|
|
1344
1345
|
}
|
|
1346
|
+
if (body.kind === "getRun") {
|
|
1347
|
+
return {
|
|
1348
|
+
requestId: msg.requestId,
|
|
1349
|
+
result: {
|
|
1350
|
+
ok: true,
|
|
1351
|
+
data: run ?? null
|
|
1352
|
+
}
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1345
1355
|
if (body.kind === "getFanMembers") {
|
|
1346
1356
|
const data = run ? await this.gateway.getFanMembers?.(body.runId, body.group, body.query) ?? null : null;
|
|
1347
1357
|
return {
|
|
@@ -1549,6 +1559,29 @@ var ProxyRunGateway = class {
|
|
|
1549
1559
|
});
|
|
1550
1560
|
return detail ? pageFan(detail.timeline, group, query) : null;
|
|
1551
1561
|
}
|
|
1562
|
+
/**
|
|
1563
|
+
* The run alone, without its timeline. Read from the full detail when the control plane is too old
|
|
1564
|
+
* to know the verb: it then answers with no data, or with an unsupported-request error.
|
|
1565
|
+
*/
|
|
1566
|
+
async getRun(runId) {
|
|
1567
|
+
if (!this.knownUnsupported("getRun")) {
|
|
1568
|
+
try {
|
|
1569
|
+
const run = await this.request({
|
|
1570
|
+
kind: "getRun",
|
|
1571
|
+
runId
|
|
1572
|
+
});
|
|
1573
|
+
if (run !== void 0) return run;
|
|
1574
|
+
} catch (err) {
|
|
1575
|
+
if (!isUnsupported(err)) throw err;
|
|
1576
|
+
}
|
|
1577
|
+
this.unsupportedUntil.set("getRun", Date.now() + this.capabilityTtlMs);
|
|
1578
|
+
}
|
|
1579
|
+
const detail = await this.request({
|
|
1580
|
+
kind: "getRunDetail",
|
|
1581
|
+
runId
|
|
1582
|
+
});
|
|
1583
|
+
return detail?.run ?? null;
|
|
1584
|
+
}
|
|
1552
1585
|
knownUnsupported(kind) {
|
|
1553
1586
|
const until = this.unsupportedUntil.get(kind);
|
|
1554
1587
|
if (until === void 0) return false;
|
|
@@ -1771,7 +1804,7 @@ var RetentionPoller = class {
|
|
|
1771
1804
|
console.warn("[nestjs-durable] `retention` is configured but the store adapter does not implement pruneTerminalRuns; retention is disabled.");
|
|
1772
1805
|
return;
|
|
1773
1806
|
}
|
|
1774
|
-
|
|
1807
|
+
void this.sweep();
|
|
1775
1808
|
const intervalMs = retention.sweepInterval != null ? parseDuration(retention.sweepInterval) : DEFAULT_SWEEP_INTERVAL_MS;
|
|
1776
1809
|
if (intervalMs > 0) {
|
|
1777
1810
|
this.timer = setInterval(() => void this.sweep(), intervalMs);
|
|
@@ -1794,9 +1827,8 @@ var RetentionPoller = class {
|
|
|
1794
1827
|
/**
|
|
1795
1828
|
* Prune one round.
|
|
1796
1829
|
*
|
|
1797
|
-
* Never rejects, for the same reason {@link TimerPoller.poll} does not: it is
|
|
1798
|
-
*
|
|
1799
|
-
* process) and fired as `void` on the interval (so a rejection is an unhandled one, also fatal).
|
|
1830
|
+
* Never rejects, for the same reason {@link TimerPoller.poll} does not: it is fired as `void` on
|
|
1831
|
+
* boot and on the interval, so a rejection would be an unhandled one, which is fatal.
|
|
1800
1832
|
* Pruning history is the least urgent thing this package does — a `pruneTerminalRuns` that fails
|
|
1801
1833
|
* on a locked table must cost this sweep and nothing more.
|
|
1802
1834
|
*/
|
|
@@ -2157,7 +2189,7 @@ var TimerPoller = class {
|
|
|
2157
2189
|
console.error(`[nestjs-durable] could not run enqueued run ${runId}:`, error);
|
|
2158
2190
|
});
|
|
2159
2191
|
});
|
|
2160
|
-
|
|
2192
|
+
void this.poll();
|
|
2161
2193
|
const intervalMs = this.options.timerPollMs ?? 1e3;
|
|
2162
2194
|
if (intervalMs > 0) {
|
|
2163
2195
|
this.timer = setInterval(() => void this.poll(), intervalMs);
|
|
@@ -2189,12 +2221,10 @@ var TimerPoller = class {
|
|
|
2189
2221
|
/**
|
|
2190
2222
|
* One sweep of the engine's recovery work.
|
|
2191
2223
|
*
|
|
2192
|
-
* **This method never rejects, and that is a hard requirement rather than defensiveness.**
|
|
2193
|
-
*
|
|
2194
|
-
*
|
|
2195
|
-
*
|
|
2196
|
-
* an unhandled rejection. Both are fatal, and both re-occur on the next boot with the same state,
|
|
2197
|
-
* so a single unrecoverable run crash-loops every worker in the deployment — taking down every
|
|
2224
|
+
* **This method never rejects, and that is a hard requirement rather than defensiveness.** Both
|
|
2225
|
+
* callers (the boot kick-off and the interval) fire it as `void`, so a rejection would surface as
|
|
2226
|
+
* an unhandled rejection, which is fatal, and would re-occur on the next boot with the same state:
|
|
2227
|
+
* a single unrecoverable run would crash-loop every worker in the deployment, taking down every
|
|
2198
2228
|
* other workflow with it. A poll that goes wrong must cost this tick, not the pod.
|
|
2199
2229
|
*
|
|
2200
2230
|
* Each sweep is isolated separately because they are independent: a store that fails
|