@dudousxd/nestjs-durable 0.52.6 → 0.53.0

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.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, WorkflowRun, TenantEvent } from '@dudousxd/nestjs-durable-core';
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';
@@ -563,6 +563,11 @@ interface DurableModuleOptions {
563
563
  * (a poison pill that crashes the process every boot). Omit for unlimited. Operator only.
564
564
  */
565
565
  maxRecoveryAttempts?: number;
566
+ /**
567
+ * How long (ms) a run may stay unresumable because its workflow version is registered nowhere (a
568
+ * renamed or deleted workflow) before it is dead-lettered. Default 24h; `0` skips it forever.
569
+ */
570
+ unregisteredWorkflowGraceMs?: number;
566
571
  /**
567
572
  * Opt-in liveness deadline (ms) for a remote (polyglot) workflow `advance`. If the worker neither
568
573
  * returns a decision nor sends a run-scoped heartbeat within this window, the engine presumes it dead
@@ -1216,6 +1221,11 @@ declare class ProxyRunGateway implements RunGateway {
1216
1221
  getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
1217
1222
  /** Paged from the full detail when the control plane is too old to page a fan itself. */
1218
1223
  getFanMembers(runId: string, group: string, query: FanPageQuery): Promise<FanPage | null>;
1224
+ /**
1225
+ * The run alone, without its timeline. Read from the full detail when the control plane is too old
1226
+ * to know the verb: it then answers with no data, or with an unsupported-request error.
1227
+ */
1228
+ getRun(runId: string): Promise<WorkflowRun | null>;
1219
1229
  private knownUnsupported;
1220
1230
  /** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
1221
1231
  * 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, WorkflowRun, TenantEvent } from '@dudousxd/nestjs-durable-core';
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';
@@ -563,6 +563,11 @@ interface DurableModuleOptions {
563
563
  * (a poison pill that crashes the process every boot). Omit for unlimited. Operator only.
564
564
  */
565
565
  maxRecoveryAttempts?: number;
566
+ /**
567
+ * How long (ms) a run may stay unresumable because its workflow version is registered nowhere (a
568
+ * renamed or deleted workflow) before it is dead-lettered. Default 24h; `0` skips it forever.
569
+ */
570
+ unregisteredWorkflowGraceMs?: number;
566
571
  /**
567
572
  * Opt-in liveness deadline (ms) for a remote (polyglot) workflow `advance`. If the worker neither
568
573
  * returns a decision nor sends a run-scoped heartbeat within this window, the engine presumes it dead
@@ -1216,6 +1221,11 @@ declare class ProxyRunGateway implements RunGateway {
1216
1221
  getRunDetail(runId: string, options?: RunDetailOptions): Promise<RunDetail | null>;
1217
1222
  /** Paged from the full detail when the control plane is too old to page a fan itself. */
1218
1223
  getFanMembers(runId: string, group: string, query: FanPageQuery): Promise<FanPage | null>;
1224
+ /**
1225
+ * The run alone, without its timeline. Read from the full detail when the control plane is too old
1226
+ * to know the verb: it then answers with no data, or with an unsupported-request error.
1227
+ */
1228
+ getRun(runId: string): Promise<WorkflowRun | null>;
1219
1229
  private knownUnsupported;
1220
1230
  /** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
1221
1231
  * 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;
@@ -2918,6 +2951,7 @@ var DurableModule = class _DurableModule {
2918
2951
  leaseMs: options.leaseMs,
2919
2952
  admission: options.admission,
2920
2953
  maxRecoveryAttempts: options.maxRecoveryAttempts,
2954
+ unregisteredWorkflowGraceMs: options.unregisteredWorkflowGraceMs,
2921
2955
  remoteAdvanceSilenceMs: options.remoteAdvanceSilenceMs,
2922
2956
  remoteRedispatchMs: options.remoteRedispatchMs,
2923
2957
  remoteRedispatchMax: options.remoteRedispatchMax,