@dudousxd/nestjs-durable 0.54.0 → 0.55.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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnEventEntry, OnErrorInput, LifecycleEventOf, WorkflowLifecycleEvent, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, EventBatchConfig, 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, RepublishLifecycleTarget, RepublishLifecycleResult, WorkflowLifecycleLinks, EngineEvent, StepInvocation, LifecycleKind, TenantEvent } from '@dudousxd/nestjs-durable-core';
1
+ import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnEventEntry, OnErrorInput, LifecycleEventOf, WorkflowLifecycleEvent, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, EventBatchConfig, 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, RepublishLifecycleTarget, RepublishLifecycleResult, WorkflowLifecycleLinks, EngineEvent, StepInvocation, LifecycleKind, TenantEvent, SignalOptions } from '@dudousxd/nestjs-durable-core';
2
2
  export { AttributeFilter, DynamicWorkflowCtx, EngineEvent, EventSubscription, InferSearchAttributes, LIFECYCLE_PENDING_TAG, LifecycleEventOf, LifecycleKind, OnErrorInput, OnEventEntry, RunDetail, RunGateway, RunListItem, RunQuery, RunSchedulesOptions, RunStatus, RunWaiting, ScheduledWorkflow, SearchAttributes, SearchAttributesSchema, StepCheckpoint, StepEvent, StepLogger, TenantTokenSource, TenantVerifier, VerifiedTenant, WorkflowCtx, WorkflowEngine, WorkflowHandler, WorkflowLifecycleEvent, WorkflowRun, hmacTenantVerifier, lifecycleRunId, lifecycleSourceOf, prevCronFireMs, readSearchAttributes, runCompletedEvent, runFailedEvent, runSchedules, scheduleRunIdAt, scheduledRunId, signTenantToken, triggeredRunsOf } from '@dudousxd/nestjs-durable-core';
3
3
  import { z } from 'zod';
4
4
  import { ConcurrencyOption, StartRunDeps, RunRedisWorkerOptions, RunningWorker, DurableWorkerRuntime } from '@dudousxd/durable-worker';
@@ -740,6 +740,12 @@ interface DurableModuleOptions {
740
740
  * default. See `WorkflowEngineDeps.eventBufferTtlMs`. Operator only.
741
741
  */
742
742
  eventBufferTtlMs?: number;
743
+ /**
744
+ * How long `signal(token, payload, { id })` remembers an id (ms, or a duration like `'7d'`); a
745
+ * re-send with the same token and id within it is dropped. Default 7 days. See
746
+ * `WorkflowEngineDeps.signalIdTtl`.
747
+ */
748
+ signalIdTtl?: string | number;
743
749
  /**
744
750
  * How long (ms) a run parked `blocked` (no capable, protocol-compatible live worker) waits before
745
751
  * the blocked-recovery poll re-checks the fleet. Defaults to 5000. See
@@ -752,6 +758,21 @@ interface DurableModuleOptions {
752
758
  * halve their checkpoint writes. See `WorkflowEngineDeps.trackStepStart`. Operator only.
753
759
  */
754
760
  trackStepStart?: boolean;
761
+ /**
762
+ * How many workflow bodies parked on dispatched `ctx.step` calls this instance keeps in memory
763
+ * between turns, so a step's result continues the body instead of replaying it over the run's
764
+ * whole history. Default 1000 (~26 KB of heap each); `0` turns it off. See `WorkflowEngineDeps.stickyRuns` and the
765
+ * "Performance" section of the production guide. Operator only.
766
+ */
767
+ stickyRuns?: number;
768
+ /** How long a parked body may stay idle in that cache. Default 5 min. Operator only. */
769
+ stickyIdleMs?: number;
770
+ /**
771
+ * Send each dispatched `ctx.step` result back to the engine instance that dispatched it (and holds
772
+ * the parked body), on transports that can route replies (BullMQ). Default `true`. See
773
+ * `WorkflowEngineDeps.routeReplies`. Operator only.
774
+ */
775
+ routeReplies?: boolean;
755
776
  /**
756
777
  * The **default** workflow to route dead-lettered runs to, for workflows that don't declare their
757
778
  * own. When a run is moved to `dead` (exceeded `maxRecoveryAttempts`), the started handler gets a
@@ -1566,8 +1587,12 @@ declare class WorkflowService {
1566
1587
  timeoutMs?: number;
1567
1588
  until?: 'settled' | 'terminal';
1568
1589
  }): Promise<RunResult>;
1569
- /** Deliver an external signal (e.g. from a webhook) to the run waiting on `token`. */
1570
- signal(token: string, payload: unknown): Promise<RunResult | null>;
1590
+ /**
1591
+ * Deliver an external signal (e.g. from a webhook) to the run waiting on `token`, or buffer it for
1592
+ * the next wait on it. With `{ id }`, a re-send with the same token and id is dropped (resolves
1593
+ * `null`): see {@link SignalOptions}.
1594
+ */
1595
+ signal(token: string, payload: unknown, opts?: SignalOptions): Promise<RunResult | null>;
1571
1596
  /**
1572
1597
  * Ensure a run exists for `runId`, then deliver a signal to it — race-free (the signal is buffered
1573
1598
  * until the run reaches its `waitForSignal`). The durable-entity / accumulator pattern: one
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnEventEntry, OnErrorInput, LifecycleEventOf, WorkflowLifecycleEvent, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, EventBatchConfig, 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, RepublishLifecycleTarget, RepublishLifecycleResult, WorkflowLifecycleLinks, EngineEvent, StepInvocation, LifecycleKind, TenantEvent } from '@dudousxd/nestjs-durable-core';
1
+ import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnEventEntry, OnErrorInput, LifecycleEventOf, WorkflowLifecycleEvent, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, EventBatchConfig, 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, RepublishLifecycleTarget, RepublishLifecycleResult, WorkflowLifecycleLinks, EngineEvent, StepInvocation, LifecycleKind, TenantEvent, SignalOptions } from '@dudousxd/nestjs-durable-core';
2
2
  export { AttributeFilter, DynamicWorkflowCtx, EngineEvent, EventSubscription, InferSearchAttributes, LIFECYCLE_PENDING_TAG, LifecycleEventOf, LifecycleKind, OnErrorInput, OnEventEntry, RunDetail, RunGateway, RunListItem, RunQuery, RunSchedulesOptions, RunStatus, RunWaiting, ScheduledWorkflow, SearchAttributes, SearchAttributesSchema, StepCheckpoint, StepEvent, StepLogger, TenantTokenSource, TenantVerifier, VerifiedTenant, WorkflowCtx, WorkflowEngine, WorkflowHandler, WorkflowLifecycleEvent, WorkflowRun, hmacTenantVerifier, lifecycleRunId, lifecycleSourceOf, prevCronFireMs, readSearchAttributes, runCompletedEvent, runFailedEvent, runSchedules, scheduleRunIdAt, scheduledRunId, signTenantToken, triggeredRunsOf } from '@dudousxd/nestjs-durable-core';
3
3
  import { z } from 'zod';
4
4
  import { ConcurrencyOption, StartRunDeps, RunRedisWorkerOptions, RunningWorker, DurableWorkerRuntime } from '@dudousxd/durable-worker';
@@ -740,6 +740,12 @@ interface DurableModuleOptions {
740
740
  * default. See `WorkflowEngineDeps.eventBufferTtlMs`. Operator only.
741
741
  */
742
742
  eventBufferTtlMs?: number;
743
+ /**
744
+ * How long `signal(token, payload, { id })` remembers an id (ms, or a duration like `'7d'`); a
745
+ * re-send with the same token and id within it is dropped. Default 7 days. See
746
+ * `WorkflowEngineDeps.signalIdTtl`.
747
+ */
748
+ signalIdTtl?: string | number;
743
749
  /**
744
750
  * How long (ms) a run parked `blocked` (no capable, protocol-compatible live worker) waits before
745
751
  * the blocked-recovery poll re-checks the fleet. Defaults to 5000. See
@@ -752,6 +758,21 @@ interface DurableModuleOptions {
752
758
  * halve their checkpoint writes. See `WorkflowEngineDeps.trackStepStart`. Operator only.
753
759
  */
754
760
  trackStepStart?: boolean;
761
+ /**
762
+ * How many workflow bodies parked on dispatched `ctx.step` calls this instance keeps in memory
763
+ * between turns, so a step's result continues the body instead of replaying it over the run's
764
+ * whole history. Default 1000 (~26 KB of heap each); `0` turns it off. See `WorkflowEngineDeps.stickyRuns` and the
765
+ * "Performance" section of the production guide. Operator only.
766
+ */
767
+ stickyRuns?: number;
768
+ /** How long a parked body may stay idle in that cache. Default 5 min. Operator only. */
769
+ stickyIdleMs?: number;
770
+ /**
771
+ * Send each dispatched `ctx.step` result back to the engine instance that dispatched it (and holds
772
+ * the parked body), on transports that can route replies (BullMQ). Default `true`. See
773
+ * `WorkflowEngineDeps.routeReplies`. Operator only.
774
+ */
775
+ routeReplies?: boolean;
755
776
  /**
756
777
  * The **default** workflow to route dead-lettered runs to, for workflows that don't declare their
757
778
  * own. When a run is moved to `dead` (exceeded `maxRecoveryAttempts`), the started handler gets a
@@ -1566,8 +1587,12 @@ declare class WorkflowService {
1566
1587
  timeoutMs?: number;
1567
1588
  until?: 'settled' | 'terminal';
1568
1589
  }): Promise<RunResult>;
1569
- /** Deliver an external signal (e.g. from a webhook) to the run waiting on `token`. */
1570
- signal(token: string, payload: unknown): Promise<RunResult | null>;
1590
+ /**
1591
+ * Deliver an external signal (e.g. from a webhook) to the run waiting on `token`, or buffer it for
1592
+ * the next wait on it. With `{ id }`, a re-send with the same token and id is dropped (resolves
1593
+ * `null`): see {@link SignalOptions}.
1594
+ */
1595
+ signal(token: string, payload: unknown, opts?: SignalOptions): Promise<RunResult | null>;
1571
1596
  /**
1572
1597
  * Ensure a run exists for `runId`, then deliver a signal to it — race-free (the signal is buffered
1573
1598
  * until the run reaches its `waitForSignal`). The durable-entity / accumulator pattern: one