@dudousxd/nestjs-durable 0.55.1 → 0.56.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, 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';
1
+ import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnEventEntry, OnErrorInput, LifecycleEventOf, WorkflowLifecycleEvent, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, EventBatchConfig, TenantVerifier, VerifiedTenant, TenantTokenSource, StateStore, Transport, NamedTransport, ControlPlane, StalledRunInfo, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, 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';
@@ -575,6 +575,58 @@ declare const OnEvent: typeof OnDurableEvent;
575
575
  */
576
576
  declare function getOnEvents(meta: WorkflowMeta, target: object): OnEventEntry[];
577
577
 
578
+ /** What a tenant verifier receives for each request a tenant process sends. */
579
+ interface TenantVerifierInput {
580
+ /** The token presented on the request (the wire `tenant` field). */
581
+ token?: string | undefined;
582
+ /** The tenant the request *claims* to be. Advisory only: derive the real one from the token. */
583
+ tenant?: string | undefined;
584
+ }
585
+ /**
586
+ * The object/class form of `verifyTenant`. Runs on the control plane for every request a tenant
587
+ * process sends.
588
+ */
589
+ interface TenantVerifierContract {
590
+ /**
591
+ * Turn the wire token into the tenant it authenticates as. Return `null` to reject: the request is
592
+ * answered `unauthorized` and never touches a run. Throw when you cannot decide (the identity
593
+ * provider is down): the request fails with the error and the next one calls `verify` again. The
594
+ * returned `tenant` is trusted as-is, so derive it from the verified token, never from
595
+ * `input.tenant`.
596
+ */
597
+ verify(input: TenantVerifierInput): VerifiedTenant | null | Promise<VerifiedTenant | null>;
598
+ }
599
+ /**
600
+ * The object/class form of `tenantToken`. Runs on the tenant process before every request it sends.
601
+ */
602
+ interface TenantCredentialsContract {
603
+ /**
604
+ * The token to present on the next request, sent as-is in the wire `tenant` field. Called once per
605
+ * request, so cache the token and fetch a new one before it expires. A throw (or an empty string)
606
+ * fails that request; the next request calls `token()` again.
607
+ */
608
+ token(): string | Promise<string>;
609
+ }
610
+ /** A class implementing a contract; its constructor parameters are resolved by Nest DI. */
611
+ type ContractClass<T> = new (...args: any[]) => T;
612
+ /** A lazy import of a module whose default export is a contract class or object. */
613
+ type LazyContract<T> = () => Promise<{
614
+ default: ContractClass<T> | T;
615
+ }>;
616
+ /**
617
+ * The `verifyTenant` option: a function (e.g. `hmacTenantVerifier(secret)`), an object implementing
618
+ * {@link TenantVerifierContract}, a class implementing it (built once through Nest DI: the registered
619
+ * provider when there is one, else `ModuleRef.create`), or a lazy import of a module whose default
620
+ * export is such a class or object (imported once).
621
+ */
622
+ type TenantVerifierOption = TenantVerifier | TenantVerifierContract | ContractClass<TenantVerifierContract> | LazyContract<TenantVerifierContract>;
623
+ /**
624
+ * The `tenantToken` option: a string, a function called before every request, an object implementing
625
+ * {@link TenantCredentialsContract}, a class implementing it (built once through Nest DI), or a lazy
626
+ * import of a module whose default export is such a class or object (imported once).
627
+ */
628
+ type TenantTokenOption = TenantTokenSource | TenantCredentialsContract | ContractClass<TenantCredentialsContract> | LazyContract<TenantCredentialsContract>;
629
+
578
630
  /**
579
631
  * Retention config for the {@link RetentionPoller}. One or more {@link RetentionPolicy policies}
580
632
  * (status sets must be disjoint per scope — validated at boot), swept together on a shared interval.
@@ -607,28 +659,24 @@ interface DurableRetentionOptions {
607
659
  batchSize?: number;
608
660
  }
609
661
  /**
610
- * Options for `DurableModule.forRoot`/`forRootAsync`. The **role is inferred** from which of `store`/
611
- * `connection` are set:
662
+ * The options every {@link DurableModuleOptions} variant shares. With no `topology` (or
663
+ * `topology: 'standalone'`) the **role is inferred** from which of `store`/`connection` are set:
612
664
  *
613
- * - `{ store, transport }` — **operator**: a real `WorkflowEngine` + `StoreRunGateway` + drivers/
665
+ * - `{ store, transport }`: **operator**, a real `WorkflowEngine` + `StoreRunGateway` + drivers/
614
666
  * timer/retention/registrars, executing registered bodies INLINE. Driven by {@link drive} (default
615
667
  * `true`).
616
- * - `{ connection }` (no `store`) — **thin worker**: `WorkflowEngine` resolves to a store-less
668
+ * - `{ connection }` (no `store`): **thin worker**, `WorkflowEngine` resolves to a store-less
617
669
  * `DurableStartClient`; `RUN_GATEWAY` is a `ProxyRunGateway` when `transport` is also given, else
618
- * every method rejects with a clear error. No store/timer/retention/entity — just discovered
670
+ * every method rejects with a clear error. No store/timer/retention/entity, just discovered
619
671
  * `@Workflow`/`@Step` handlers served over ONE `runRedisWorker` consumer.
620
- * - `{ store, transport, connection }` — an **operator that also runs a co-located worker**: every
672
+ * - `{ store, transport, connection }`: an **operator that also runs a co-located worker**: every
621
673
  * `@Workflow` is registered GROUP-SERVED (dispatched over the transport, PER WORKFLOW NAME, instead
622
674
  * of inline) and a co-located consumer (one `runRedisWorker` call) replays the same bodies.
623
675
  *
624
676
  * `forRoot` throws when neither `store` nor `connection` is set, and when `store` is set without a
625
677
  * `transport`.
626
- *
627
- * Set {@link DurableModuleOptions.topology} to name the role explicitly instead of relying on this
628
- * inference — it additionally VALIDATES the axes above (`namespace` vs `partition`) that this prose
629
- * is otherwise the only source of truth for. Omitting it changes nothing.
630
678
  */
631
- interface DurableModuleOptions {
679
+ interface DurableModuleSharedOptions {
632
680
  /** State store — set this to play the **operator** role (see the interface doc for the full role
633
681
  * matrix). Omit for a store-less **thin worker** (`connection` only). */
634
682
  store?: StateStore;
@@ -752,6 +800,12 @@ interface DurableModuleOptions {
752
800
  * `WorkflowEngineDeps.blockedPollMs`. Operator only.
753
801
  */
754
802
  blockedPollMs?: number;
803
+ /**
804
+ * How long (ms) the routing guard reuses the worker descriptors it read for a queue token. On
805
+ * BullMQ each read scans the Redis keyspace. Default 2000; `0` reads on every dispatch. See
806
+ * `WorkflowEngineDeps.workerDescriptorCacheMs`. Operator only.
807
+ */
808
+ workerDescriptorCacheMs?: number;
755
809
  /**
756
810
  * Persist a `running` checkpoint when a local step's body begins, so an in-flight step survives a
757
811
  * dashboard reload. Defaults to `true`; set `false` on hot paths with many short local steps to
@@ -931,73 +985,96 @@ interface DurableModuleOptions {
931
985
  * **Operator.** Verifies the signed tenant token a store-less tenant worker presents in the wire
932
986
  * `tenant` field of every run request and start-run message, and DERIVES the tenant from it,
933
987
  * discarding the wire claim. An invalid, tampered or absent token is rejected: a run request gets
934
- * an `unauthorized` error reply, a start-run creates nothing. Use `hmacTenantVerifier(secret)`
935
- * (tokens minted by `signTenantToken`, wire-compatible with Agora) or supply your own.
988
+ * an `unauthorized` error reply, a start-run creates nothing; a verifier that throws fails the
989
+ * request with its error. Use `hmacTenantVerifier(secret)` (tokens minted by `signTenantToken`,
990
+ * wire-compatible with Agora) or supply your own: a function, an object or class implementing
991
+ * `TenantVerifierContract` (a class is built once through Nest DI), or a lazy import of one
992
+ * (`() => import('./tenant-verifier.js')`, imported once).
936
993
  *
937
994
  * Optional. Absent: the wire `tenant` is trusted verbatim (prefix/network isolation only), exactly
938
- * as before. An explicit `topology: { role: 'control-plane' }` without a verifier logs a warning
939
- * at boot; a plain operator (`store` + `transport`, no `topology`) boots silently.
995
+ * as before. `topology: 'control-plane'` without a verifier logs a warning at boot; a standalone
996
+ * operator boots silently.
940
997
  */
941
- verifyTenant?: TenantVerifier;
998
+ verifyTenant?: TenantVerifierOption;
942
999
  /**
943
1000
  * **Tenant worker.** The signed token (see `signTenantToken`) this worker presents, verbatim, in
944
1001
  * the `tenant` field of every run request (`ProxyRunGateway`) and start-run (`engine.start`), so
945
- * an operator with {@link verifyTenant} can authenticate it. A string, or a function called before
946
- * every request (rotation, short-lived tokens). Optional: absent, the raw {@link partition} is
947
- * sent, as before. Live-tail stays keyed by the partition, never the token.
1002
+ * an operator with {@link verifyTenant} can authenticate it. A string, a function called before
1003
+ * every request (rotation, short-lived tokens), an object or class implementing
1004
+ * `TenantCredentialsContract` (a class is built once through Nest DI), or a lazy import of one.
1005
+ * Every form but the string is called per request and owns its caching. Optional: absent, the raw
1006
+ * {@link partition} is sent, as before. Live-tail stays keyed by the partition, never the token.
948
1007
  */
949
- tenantToken?: TenantTokenSource;
1008
+ tenantToken?: TenantTokenOption;
1009
+ }
1010
+ /** The process roles a {@link DurableModuleOptions.topology} names. Same vocabulary as Agora. */
1011
+ type DurableTopologyName = 'standalone' | 'control-plane' | 'tenant';
1012
+ /**
1013
+ * The default topology: today's role inference from `store`/`connection` (see
1014
+ * {@link DurableModuleSharedOptions}). `partition` is the queue suffix a worker role serves.
1015
+ */
1016
+ interface StandaloneDurableOptions extends DurableModuleSharedOptions {
1017
+ topology?: 'standalone';
1018
+ }
1019
+ /**
1020
+ * A coordinator: owns the store, dispatches over the transport, recovers, fires timers, prunes
1021
+ * retention and answers tenant requests. Requires `store` and `transport` (or `transports`).
1022
+ */
1023
+ interface ControlPlaneDurableOptions extends Omit<DurableModuleSharedOptions, 'store' | 'tenantToken'> {
1024
+ topology: 'control-plane';
1025
+ store: StateStore;
950
1026
  /**
951
- * An explicit preset that NAMES the deployment role instead of leaving it to `store`/`connection`
952
- * inference, and VALIDATES the axes that are otherwise only prose (see the interface doc's role
953
- * matrix, and {@link namespace} vs {@link partition}). Omit to keep the existing inference —
954
- * `topology` is entirely additive and changes nothing when unset.
955
- *
956
- * **`namespace` vs `partition` — the two axes this preset locks down:**
957
- * - `namespace` is the OPERATOR's poll-scoping axis: which runs a control-plane instance
958
- * drives/recovers/resumes (`runPending`/`recoverIncomplete`/`resumeDueTimers`/`sweepTimeouts`).
959
- * Unset makes the instance see (drive) EVERY namespace.
960
- * `{ role: 'control-plane' }` is the only preset that allows it.
961
- * - `partition` is the WORKER's queue-routing suffix: which queue a thin/co-located worker's
962
- * consumer subscribes to (`<name>@<partition>`), matching the queue an operator's convention
963
- * dispatch routes a run's `namespace` to. `{ role: 'tenant' }` sets this FOR you from `tenant` —
964
- * you never set `partition` directly under `topology`.
965
- *
966
- * **One `tenant` word, two axes — the preset maps it to the right one per role:** on a
967
- * `control-plane` an optional `tenant` scopes the OPERATOR to its own runs (maps to `namespace` —
968
- * a self-contained local stack sharing a broker with a deployed cluster names itself so neither
969
- * drives the other's runs; leave it unset on a deployed operator to drive every tenant). On a
970
- * `tenant` role it is required and maps to `partition` (the worker's queue suffix).
971
- *
972
- * ```ts
973
- * // Control plane: owns the store, dispatches over the transport, prunes old runs. The optional
974
- * // `tenant` (e.g. from an env var) scopes this operator to its own runs — undefined on a
975
- * // deployed operator (drives everything), set on a local stack sharing the broker.
976
- * DurableModule.forRoot({
977
- * topology: { role: 'control-plane', tenant: process.env.DURABLE_TENANT },
978
- * store,
979
- * transport,
980
- * retention: { policies: [{ statuses: ['completed', 'cancelled'], maxAge: '14d' }] },
981
- * });
982
- *
983
- * // Tenant: store-less worker scoped to its own partition — `tenant` maps to `partition` for you.
984
- * DurableModule.forRoot({
985
- * topology: { role: 'tenant', tenant: 'acme-corp' },
986
- * connection: process.env.REDIS_URL,
987
- * });
988
- * ```
989
- *
990
- * Validated at `forRoot`/`forRootAsync` resolution time — see {@link DurableModule} for the exact
991
- * error messages, which double as the axis primer above.
992
- */
993
- topology?: {
994
- role: 'control-plane';
995
- tenant?: string;
996
- } | {
997
- role: 'tenant';
998
- tenant: string;
999
- };
1027
+ * The namespace this control plane serves. Omit it on a deployed control plane, which then drives
1028
+ * every tenant's runs. Set it to scope a self-contained stack (a developer's machine sharing a
1029
+ * broker with a deployed cluster) to its own runs: it becomes this node's `namespace` and the
1030
+ * `<name>@<partition>` queues its co-located consumers subscribe to.
1031
+ */
1032
+ partition?: string;
1033
+ /** A control plane verifies tenant tokens; it does not present one. */
1034
+ tenantToken?: never;
1000
1035
  }
1036
+ /**
1037
+ * A store-less worker for one partition: it pulls `<name>@<partition>` tasks from the broker over
1038
+ * `connection` and, with a `transport`, proxies reads and control actions to the control plane.
1039
+ */
1040
+ interface TenantDurableOptions extends Omit<DurableModuleSharedOptions, 'store' | 'namespace' | 'partition' | 'connection' | 'verifyTenant'> {
1041
+ topology: 'tenant';
1042
+ /** A tenant is store-less: everything goes over the wire to the control plane. */
1043
+ store?: never;
1044
+ /** `namespace` scopes an operator's poll loop; a tenant has none. Use `partition`. */
1045
+ namespace?: never;
1046
+ /** The partition this process serves and acts as. Required. */
1047
+ partition: string;
1048
+ /** The broker connection the tenant's consumer pulls its partition's tasks from. Required. */
1049
+ connection: string | Record<string, unknown>;
1050
+ /** A tenant presents a token (`tenantToken`); the control plane verifies it. */
1051
+ verifyTenant?: never;
1052
+ }
1053
+ /**
1054
+ * Options for `DurableModule.forRoot`/`forRootAsync`, discriminated on `topology`:
1055
+ *
1056
+ * ```ts
1057
+ * // Control plane: owns the store, dispatches over the transport, prunes old runs.
1058
+ * DurableModule.forRoot({
1059
+ * topology: 'control-plane',
1060
+ * store,
1061
+ * transport,
1062
+ * retention: { policies: [{ statuses: ['completed', 'cancelled'], maxAge: '14d' }] },
1063
+ * });
1064
+ *
1065
+ * // Tenant: a store-less worker serving its own partition.
1066
+ * DurableModule.forRoot({
1067
+ * topology: 'tenant',
1068
+ * partition: 'acme-corp',
1069
+ * connection: process.env.REDIS_URL,
1070
+ * });
1071
+ * ```
1072
+ *
1073
+ * Omit `topology` (or pass `'standalone'`) to keep the role inference described on
1074
+ * {@link DurableModuleSharedOptions}. TypeScript rejects a `store` on a tenant; the rest is
1075
+ * validated at `forRoot`/`forRootAsync` resolution time.
1076
+ */
1077
+ type DurableModuleOptions = StandaloneDurableOptions | ControlPlaneDurableOptions | TenantDurableOptions;
1001
1078
  interface DurableModuleAsyncOptions {
1002
1079
  useFactory: (...args: never[]) => DurableModuleOptions | Promise<DurableModuleOptions>;
1003
1080
  inject?: InjectionToken[];
@@ -1005,13 +1082,7 @@ interface DurableModuleAsyncOptions {
1005
1082
  declare class DurableModule {
1006
1083
  static forRoot(options: DurableModuleOptions): DynamicModule;
1007
1084
  static forRootAsync(options: DurableModuleAsyncOptions): DynamicModule;
1008
- /**
1009
- * Validates role/axis constraints, in resolution order. When {@link DurableModuleOptions.topology}
1010
- * is set, it OWNS validation — {@link assertValidTopology}'s own store/transport/connection checks
1011
- * are strictly stronger than {@link assertValidRole}'s, so the topology-specific, axis-teaching
1012
- * message is what a `topology`-opted-in consumer sees (not the older generic one). Falls back to
1013
- * {@link assertValidRole} unchanged when `topology` is absent — zero behavior change.
1014
- */
1085
+ /** Validates the topology and its role/axis constraints; see {@link assertValidTopology}. */
1015
1086
  private static assertValid;
1016
1087
  private static build;
1017
1088
  }
@@ -1032,6 +1103,7 @@ declare class DurableStartClient {
1032
1103
  private readonly options;
1033
1104
  private readonly deps?;
1034
1105
  private readonly tenant;
1106
+ private readonly tenantToken;
1035
1107
  constructor(options: DurableModuleOptions, deps?: StartRunDeps | undefined);
1036
1108
  start<C extends WorkflowClass>(workflow: C, input: WorkflowInputOf<C>, runId?: string, opts?: StartOptions): Promise<RunResult>;
1037
1109
  start(workflow: string, input: unknown, runId?: string, opts?: StartOptions): Promise<RunResult>;
@@ -1264,7 +1336,7 @@ interface RunRequestResponderOptions {
1264
1336
  verifyTenant?: TenantVerifier | undefined;
1265
1337
  /**
1266
1338
  * Warn at construction when no {@link verifyTenant} is set. Default `true`. `DurableModule` passes
1267
- * `true` only for an explicit `topology: { role: 'control-plane' }`, so a plain operator app that
1339
+ * `true` only for `topology: 'control-plane'`, so a standalone operator app that
1268
1340
  * never serves tenants boots silently.
1269
1341
  */
1270
1342
  warnWithoutVerifier?: boolean | undefined;
@@ -1638,4 +1710,4 @@ declare class WorkflowService {
1638
1710
  republishLifecycle(target: RepublishLifecycleTarget): Promise<RepublishLifecycleResult>;
1639
1711
  }
1640
1712
 
1641
- export { BAD_RUN_REQUEST, CONTEXT_ACCESSOR, type ContextAccessor, type ContextStore, DEAD_LETTER_METADATA, DURABLE_STEP_METADATA, DURABLE_WORKER_RUNNERS, DURABLE_WORKER_RUNTIME, DeadLetter, type DtoClass, DurableModule, type DurableModuleAsyncOptions, type DurableModuleOptions, type DurableRetentionOptions, DurableStartClient, DurableStep, type DurableStepInterceptor, type DurableStepMeta, ENTITY_METADATA, ENTITY_ON_METADATA, Entity, EntityService, type ErrorClassWithCode, IN_APP_RUN_REDIS_WORKER, IN_APP_WORKER_BINDING, IN_APP_WORKER_RUNNERS, IN_APP_WORKER_RUNTIME, type InAppWorkerBinding, InAppWorkerBootstrap, type IoSchema, ON_ERROR_METADATA, ON_EVENT_BATCH_METADATA, ON_EVENT_METADATA, On, OnDurableEvent, OnError, type OnErrorMethod, OnEvent, OnWorkflowCompleted, OnWorkflowFailed, type OnWorkflowFailedOptions, type OnWorkflowSettledOptions, ProxyRunGateway, RUN_GATEWAY, RUN_REDIS_WORKER, RunGatewayError, type RunGatewayErrorCode, type RunLookupStore, type RunRedisWorkerFn, RunRequestResponder, type RunRequestResponderOptions, type RunRequestTransport, STEP_INTERCEPTOR_METADATA, Step, StepInterceptor, type StepOptions, StoreRunGateway, type SubscriberBatch, type SubscriberDebounce, type SubscriberDecorator, TENANT_REPUBLISH_MAX_LIMIT, TenantEventRepublisher, ThinStepRegistrar, ThinWorkerBootstrap, ThinWorkflowRegistrar, UNSUPPORTED_RUN_REQUEST, type UserRef, WORKFLOW_METADATA, Workflow, type WorkflowAttributesOf, type WorkflowMeta, type WorkflowOptions, WorkflowService, attributesOf, entityConfigFor, eventBatchOf, getDurableStepMeta, getEntityMeta, getOnEvents, getWorkflowMeta, inAppWorkerProviders, isDeadLetterHandler, isDrivingOperator, isOperatorRole, isStepInterceptor, onErrorCodesOf, thinWorkerProviders, unavailableRunGateway };
1713
+ export { BAD_RUN_REQUEST, CONTEXT_ACCESSOR, type ContextAccessor, type ContextStore, type ContractClass, type ControlPlaneDurableOptions, DEAD_LETTER_METADATA, DURABLE_STEP_METADATA, DURABLE_WORKER_RUNNERS, DURABLE_WORKER_RUNTIME, DeadLetter, type DtoClass, DurableModule, type DurableModuleAsyncOptions, type DurableModuleOptions, type DurableModuleSharedOptions, type DurableRetentionOptions, DurableStartClient, DurableStep, type DurableStepInterceptor, type DurableStepMeta, type DurableTopologyName, ENTITY_METADATA, ENTITY_ON_METADATA, Entity, EntityService, type ErrorClassWithCode, IN_APP_RUN_REDIS_WORKER, IN_APP_WORKER_BINDING, IN_APP_WORKER_RUNNERS, IN_APP_WORKER_RUNTIME, type InAppWorkerBinding, InAppWorkerBootstrap, type IoSchema, type LazyContract, ON_ERROR_METADATA, ON_EVENT_BATCH_METADATA, ON_EVENT_METADATA, On, OnDurableEvent, OnError, type OnErrorMethod, OnEvent, OnWorkflowCompleted, OnWorkflowFailed, type OnWorkflowFailedOptions, type OnWorkflowSettledOptions, ProxyRunGateway, RUN_GATEWAY, RUN_REDIS_WORKER, RunGatewayError, type RunGatewayErrorCode, type RunLookupStore, type RunRedisWorkerFn, RunRequestResponder, type RunRequestResponderOptions, type RunRequestTransport, STEP_INTERCEPTOR_METADATA, type StandaloneDurableOptions, Step, StepInterceptor, type StepOptions, StoreRunGateway, type SubscriberBatch, type SubscriberDebounce, type SubscriberDecorator, TENANT_REPUBLISH_MAX_LIMIT, type TenantCredentialsContract, type TenantDurableOptions, TenantEventRepublisher, type TenantTokenOption, type TenantVerifierContract, type TenantVerifierInput, type TenantVerifierOption, ThinStepRegistrar, ThinWorkerBootstrap, ThinWorkflowRegistrar, UNSUPPORTED_RUN_REQUEST, type UserRef, WORKFLOW_METADATA, Workflow, type WorkflowAttributesOf, type WorkflowMeta, type WorkflowOptions, WorkflowService, attributesOf, entityConfigFor, eventBatchOf, getDurableStepMeta, getEntityMeta, getOnEvents, getWorkflowMeta, inAppWorkerProviders, isDeadLetterHandler, isDrivingOperator, isOperatorRole, isStepInterceptor, onErrorCodesOf, thinWorkerProviders, unavailableRunGateway };
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, SignalOptions } from '@dudousxd/nestjs-durable-core';
1
+ import { WorkflowCtx, SearchAttributes, WorkflowClass, StandardSchemaV1, StepError, OnEventEntry, OnErrorInput, LifecycleEventOf, WorkflowLifecycleEvent, WorkflowRef, SingletonConfig, ConcurrencyConfig, SearchAttributesSchema, EventBatchConfig, TenantVerifier, VerifiedTenant, TenantTokenSource, StateStore, Transport, NamedTransport, ControlPlane, StalledRunInfo, ScheduledWorkflow, RetentionPolicy, QueueConfig, AdmissionBackend, 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';
@@ -575,6 +575,58 @@ declare const OnEvent: typeof OnDurableEvent;
575
575
  */
576
576
  declare function getOnEvents(meta: WorkflowMeta, target: object): OnEventEntry[];
577
577
 
578
+ /** What a tenant verifier receives for each request a tenant process sends. */
579
+ interface TenantVerifierInput {
580
+ /** The token presented on the request (the wire `tenant` field). */
581
+ token?: string | undefined;
582
+ /** The tenant the request *claims* to be. Advisory only: derive the real one from the token. */
583
+ tenant?: string | undefined;
584
+ }
585
+ /**
586
+ * The object/class form of `verifyTenant`. Runs on the control plane for every request a tenant
587
+ * process sends.
588
+ */
589
+ interface TenantVerifierContract {
590
+ /**
591
+ * Turn the wire token into the tenant it authenticates as. Return `null` to reject: the request is
592
+ * answered `unauthorized` and never touches a run. Throw when you cannot decide (the identity
593
+ * provider is down): the request fails with the error and the next one calls `verify` again. The
594
+ * returned `tenant` is trusted as-is, so derive it from the verified token, never from
595
+ * `input.tenant`.
596
+ */
597
+ verify(input: TenantVerifierInput): VerifiedTenant | null | Promise<VerifiedTenant | null>;
598
+ }
599
+ /**
600
+ * The object/class form of `tenantToken`. Runs on the tenant process before every request it sends.
601
+ */
602
+ interface TenantCredentialsContract {
603
+ /**
604
+ * The token to present on the next request, sent as-is in the wire `tenant` field. Called once per
605
+ * request, so cache the token and fetch a new one before it expires. A throw (or an empty string)
606
+ * fails that request; the next request calls `token()` again.
607
+ */
608
+ token(): string | Promise<string>;
609
+ }
610
+ /** A class implementing a contract; its constructor parameters are resolved by Nest DI. */
611
+ type ContractClass<T> = new (...args: any[]) => T;
612
+ /** A lazy import of a module whose default export is a contract class or object. */
613
+ type LazyContract<T> = () => Promise<{
614
+ default: ContractClass<T> | T;
615
+ }>;
616
+ /**
617
+ * The `verifyTenant` option: a function (e.g. `hmacTenantVerifier(secret)`), an object implementing
618
+ * {@link TenantVerifierContract}, a class implementing it (built once through Nest DI: the registered
619
+ * provider when there is one, else `ModuleRef.create`), or a lazy import of a module whose default
620
+ * export is such a class or object (imported once).
621
+ */
622
+ type TenantVerifierOption = TenantVerifier | TenantVerifierContract | ContractClass<TenantVerifierContract> | LazyContract<TenantVerifierContract>;
623
+ /**
624
+ * The `tenantToken` option: a string, a function called before every request, an object implementing
625
+ * {@link TenantCredentialsContract}, a class implementing it (built once through Nest DI), or a lazy
626
+ * import of a module whose default export is such a class or object (imported once).
627
+ */
628
+ type TenantTokenOption = TenantTokenSource | TenantCredentialsContract | ContractClass<TenantCredentialsContract> | LazyContract<TenantCredentialsContract>;
629
+
578
630
  /**
579
631
  * Retention config for the {@link RetentionPoller}. One or more {@link RetentionPolicy policies}
580
632
  * (status sets must be disjoint per scope — validated at boot), swept together on a shared interval.
@@ -607,28 +659,24 @@ interface DurableRetentionOptions {
607
659
  batchSize?: number;
608
660
  }
609
661
  /**
610
- * Options for `DurableModule.forRoot`/`forRootAsync`. The **role is inferred** from which of `store`/
611
- * `connection` are set:
662
+ * The options every {@link DurableModuleOptions} variant shares. With no `topology` (or
663
+ * `topology: 'standalone'`) the **role is inferred** from which of `store`/`connection` are set:
612
664
  *
613
- * - `{ store, transport }` — **operator**: a real `WorkflowEngine` + `StoreRunGateway` + drivers/
665
+ * - `{ store, transport }`: **operator**, a real `WorkflowEngine` + `StoreRunGateway` + drivers/
614
666
  * timer/retention/registrars, executing registered bodies INLINE. Driven by {@link drive} (default
615
667
  * `true`).
616
- * - `{ connection }` (no `store`) — **thin worker**: `WorkflowEngine` resolves to a store-less
668
+ * - `{ connection }` (no `store`): **thin worker**, `WorkflowEngine` resolves to a store-less
617
669
  * `DurableStartClient`; `RUN_GATEWAY` is a `ProxyRunGateway` when `transport` is also given, else
618
- * every method rejects with a clear error. No store/timer/retention/entity — just discovered
670
+ * every method rejects with a clear error. No store/timer/retention/entity, just discovered
619
671
  * `@Workflow`/`@Step` handlers served over ONE `runRedisWorker` consumer.
620
- * - `{ store, transport, connection }` — an **operator that also runs a co-located worker**: every
672
+ * - `{ store, transport, connection }`: an **operator that also runs a co-located worker**: every
621
673
  * `@Workflow` is registered GROUP-SERVED (dispatched over the transport, PER WORKFLOW NAME, instead
622
674
  * of inline) and a co-located consumer (one `runRedisWorker` call) replays the same bodies.
623
675
  *
624
676
  * `forRoot` throws when neither `store` nor `connection` is set, and when `store` is set without a
625
677
  * `transport`.
626
- *
627
- * Set {@link DurableModuleOptions.topology} to name the role explicitly instead of relying on this
628
- * inference — it additionally VALIDATES the axes above (`namespace` vs `partition`) that this prose
629
- * is otherwise the only source of truth for. Omitting it changes nothing.
630
678
  */
631
- interface DurableModuleOptions {
679
+ interface DurableModuleSharedOptions {
632
680
  /** State store — set this to play the **operator** role (see the interface doc for the full role
633
681
  * matrix). Omit for a store-less **thin worker** (`connection` only). */
634
682
  store?: StateStore;
@@ -752,6 +800,12 @@ interface DurableModuleOptions {
752
800
  * `WorkflowEngineDeps.blockedPollMs`. Operator only.
753
801
  */
754
802
  blockedPollMs?: number;
803
+ /**
804
+ * How long (ms) the routing guard reuses the worker descriptors it read for a queue token. On
805
+ * BullMQ each read scans the Redis keyspace. Default 2000; `0` reads on every dispatch. See
806
+ * `WorkflowEngineDeps.workerDescriptorCacheMs`. Operator only.
807
+ */
808
+ workerDescriptorCacheMs?: number;
755
809
  /**
756
810
  * Persist a `running` checkpoint when a local step's body begins, so an in-flight step survives a
757
811
  * dashboard reload. Defaults to `true`; set `false` on hot paths with many short local steps to
@@ -931,73 +985,96 @@ interface DurableModuleOptions {
931
985
  * **Operator.** Verifies the signed tenant token a store-less tenant worker presents in the wire
932
986
  * `tenant` field of every run request and start-run message, and DERIVES the tenant from it,
933
987
  * discarding the wire claim. An invalid, tampered or absent token is rejected: a run request gets
934
- * an `unauthorized` error reply, a start-run creates nothing. Use `hmacTenantVerifier(secret)`
935
- * (tokens minted by `signTenantToken`, wire-compatible with Agora) or supply your own.
988
+ * an `unauthorized` error reply, a start-run creates nothing; a verifier that throws fails the
989
+ * request with its error. Use `hmacTenantVerifier(secret)` (tokens minted by `signTenantToken`,
990
+ * wire-compatible with Agora) or supply your own: a function, an object or class implementing
991
+ * `TenantVerifierContract` (a class is built once through Nest DI), or a lazy import of one
992
+ * (`() => import('./tenant-verifier.js')`, imported once).
936
993
  *
937
994
  * Optional. Absent: the wire `tenant` is trusted verbatim (prefix/network isolation only), exactly
938
- * as before. An explicit `topology: { role: 'control-plane' }` without a verifier logs a warning
939
- * at boot; a plain operator (`store` + `transport`, no `topology`) boots silently.
995
+ * as before. `topology: 'control-plane'` without a verifier logs a warning at boot; a standalone
996
+ * operator boots silently.
940
997
  */
941
- verifyTenant?: TenantVerifier;
998
+ verifyTenant?: TenantVerifierOption;
942
999
  /**
943
1000
  * **Tenant worker.** The signed token (see `signTenantToken`) this worker presents, verbatim, in
944
1001
  * the `tenant` field of every run request (`ProxyRunGateway`) and start-run (`engine.start`), so
945
- * an operator with {@link verifyTenant} can authenticate it. A string, or a function called before
946
- * every request (rotation, short-lived tokens). Optional: absent, the raw {@link partition} is
947
- * sent, as before. Live-tail stays keyed by the partition, never the token.
1002
+ * an operator with {@link verifyTenant} can authenticate it. A string, a function called before
1003
+ * every request (rotation, short-lived tokens), an object or class implementing
1004
+ * `TenantCredentialsContract` (a class is built once through Nest DI), or a lazy import of one.
1005
+ * Every form but the string is called per request and owns its caching. Optional: absent, the raw
1006
+ * {@link partition} is sent, as before. Live-tail stays keyed by the partition, never the token.
948
1007
  */
949
- tenantToken?: TenantTokenSource;
1008
+ tenantToken?: TenantTokenOption;
1009
+ }
1010
+ /** The process roles a {@link DurableModuleOptions.topology} names. Same vocabulary as Agora. */
1011
+ type DurableTopologyName = 'standalone' | 'control-plane' | 'tenant';
1012
+ /**
1013
+ * The default topology: today's role inference from `store`/`connection` (see
1014
+ * {@link DurableModuleSharedOptions}). `partition` is the queue suffix a worker role serves.
1015
+ */
1016
+ interface StandaloneDurableOptions extends DurableModuleSharedOptions {
1017
+ topology?: 'standalone';
1018
+ }
1019
+ /**
1020
+ * A coordinator: owns the store, dispatches over the transport, recovers, fires timers, prunes
1021
+ * retention and answers tenant requests. Requires `store` and `transport` (or `transports`).
1022
+ */
1023
+ interface ControlPlaneDurableOptions extends Omit<DurableModuleSharedOptions, 'store' | 'tenantToken'> {
1024
+ topology: 'control-plane';
1025
+ store: StateStore;
950
1026
  /**
951
- * An explicit preset that NAMES the deployment role instead of leaving it to `store`/`connection`
952
- * inference, and VALIDATES the axes that are otherwise only prose (see the interface doc's role
953
- * matrix, and {@link namespace} vs {@link partition}). Omit to keep the existing inference —
954
- * `topology` is entirely additive and changes nothing when unset.
955
- *
956
- * **`namespace` vs `partition` — the two axes this preset locks down:**
957
- * - `namespace` is the OPERATOR's poll-scoping axis: which runs a control-plane instance
958
- * drives/recovers/resumes (`runPending`/`recoverIncomplete`/`resumeDueTimers`/`sweepTimeouts`).
959
- * Unset makes the instance see (drive) EVERY namespace.
960
- * `{ role: 'control-plane' }` is the only preset that allows it.
961
- * - `partition` is the WORKER's queue-routing suffix: which queue a thin/co-located worker's
962
- * consumer subscribes to (`<name>@<partition>`), matching the queue an operator's convention
963
- * dispatch routes a run's `namespace` to. `{ role: 'tenant' }` sets this FOR you from `tenant` —
964
- * you never set `partition` directly under `topology`.
965
- *
966
- * **One `tenant` word, two axes — the preset maps it to the right one per role:** on a
967
- * `control-plane` an optional `tenant` scopes the OPERATOR to its own runs (maps to `namespace` —
968
- * a self-contained local stack sharing a broker with a deployed cluster names itself so neither
969
- * drives the other's runs; leave it unset on a deployed operator to drive every tenant). On a
970
- * `tenant` role it is required and maps to `partition` (the worker's queue suffix).
971
- *
972
- * ```ts
973
- * // Control plane: owns the store, dispatches over the transport, prunes old runs. The optional
974
- * // `tenant` (e.g. from an env var) scopes this operator to its own runs — undefined on a
975
- * // deployed operator (drives everything), set on a local stack sharing the broker.
976
- * DurableModule.forRoot({
977
- * topology: { role: 'control-plane', tenant: process.env.DURABLE_TENANT },
978
- * store,
979
- * transport,
980
- * retention: { policies: [{ statuses: ['completed', 'cancelled'], maxAge: '14d' }] },
981
- * });
982
- *
983
- * // Tenant: store-less worker scoped to its own partition — `tenant` maps to `partition` for you.
984
- * DurableModule.forRoot({
985
- * topology: { role: 'tenant', tenant: 'acme-corp' },
986
- * connection: process.env.REDIS_URL,
987
- * });
988
- * ```
989
- *
990
- * Validated at `forRoot`/`forRootAsync` resolution time — see {@link DurableModule} for the exact
991
- * error messages, which double as the axis primer above.
992
- */
993
- topology?: {
994
- role: 'control-plane';
995
- tenant?: string;
996
- } | {
997
- role: 'tenant';
998
- tenant: string;
999
- };
1027
+ * The namespace this control plane serves. Omit it on a deployed control plane, which then drives
1028
+ * every tenant's runs. Set it to scope a self-contained stack (a developer's machine sharing a
1029
+ * broker with a deployed cluster) to its own runs: it becomes this node's `namespace` and the
1030
+ * `<name>@<partition>` queues its co-located consumers subscribe to.
1031
+ */
1032
+ partition?: string;
1033
+ /** A control plane verifies tenant tokens; it does not present one. */
1034
+ tenantToken?: never;
1000
1035
  }
1036
+ /**
1037
+ * A store-less worker for one partition: it pulls `<name>@<partition>` tasks from the broker over
1038
+ * `connection` and, with a `transport`, proxies reads and control actions to the control plane.
1039
+ */
1040
+ interface TenantDurableOptions extends Omit<DurableModuleSharedOptions, 'store' | 'namespace' | 'partition' | 'connection' | 'verifyTenant'> {
1041
+ topology: 'tenant';
1042
+ /** A tenant is store-less: everything goes over the wire to the control plane. */
1043
+ store?: never;
1044
+ /** `namespace` scopes an operator's poll loop; a tenant has none. Use `partition`. */
1045
+ namespace?: never;
1046
+ /** The partition this process serves and acts as. Required. */
1047
+ partition: string;
1048
+ /** The broker connection the tenant's consumer pulls its partition's tasks from. Required. */
1049
+ connection: string | Record<string, unknown>;
1050
+ /** A tenant presents a token (`tenantToken`); the control plane verifies it. */
1051
+ verifyTenant?: never;
1052
+ }
1053
+ /**
1054
+ * Options for `DurableModule.forRoot`/`forRootAsync`, discriminated on `topology`:
1055
+ *
1056
+ * ```ts
1057
+ * // Control plane: owns the store, dispatches over the transport, prunes old runs.
1058
+ * DurableModule.forRoot({
1059
+ * topology: 'control-plane',
1060
+ * store,
1061
+ * transport,
1062
+ * retention: { policies: [{ statuses: ['completed', 'cancelled'], maxAge: '14d' }] },
1063
+ * });
1064
+ *
1065
+ * // Tenant: a store-less worker serving its own partition.
1066
+ * DurableModule.forRoot({
1067
+ * topology: 'tenant',
1068
+ * partition: 'acme-corp',
1069
+ * connection: process.env.REDIS_URL,
1070
+ * });
1071
+ * ```
1072
+ *
1073
+ * Omit `topology` (or pass `'standalone'`) to keep the role inference described on
1074
+ * {@link DurableModuleSharedOptions}. TypeScript rejects a `store` on a tenant; the rest is
1075
+ * validated at `forRoot`/`forRootAsync` resolution time.
1076
+ */
1077
+ type DurableModuleOptions = StandaloneDurableOptions | ControlPlaneDurableOptions | TenantDurableOptions;
1001
1078
  interface DurableModuleAsyncOptions {
1002
1079
  useFactory: (...args: never[]) => DurableModuleOptions | Promise<DurableModuleOptions>;
1003
1080
  inject?: InjectionToken[];
@@ -1005,13 +1082,7 @@ interface DurableModuleAsyncOptions {
1005
1082
  declare class DurableModule {
1006
1083
  static forRoot(options: DurableModuleOptions): DynamicModule;
1007
1084
  static forRootAsync(options: DurableModuleAsyncOptions): DynamicModule;
1008
- /**
1009
- * Validates role/axis constraints, in resolution order. When {@link DurableModuleOptions.topology}
1010
- * is set, it OWNS validation — {@link assertValidTopology}'s own store/transport/connection checks
1011
- * are strictly stronger than {@link assertValidRole}'s, so the topology-specific, axis-teaching
1012
- * message is what a `topology`-opted-in consumer sees (not the older generic one). Falls back to
1013
- * {@link assertValidRole} unchanged when `topology` is absent — zero behavior change.
1014
- */
1085
+ /** Validates the topology and its role/axis constraints; see {@link assertValidTopology}. */
1015
1086
  private static assertValid;
1016
1087
  private static build;
1017
1088
  }
@@ -1032,6 +1103,7 @@ declare class DurableStartClient {
1032
1103
  private readonly options;
1033
1104
  private readonly deps?;
1034
1105
  private readonly tenant;
1106
+ private readonly tenantToken;
1035
1107
  constructor(options: DurableModuleOptions, deps?: StartRunDeps | undefined);
1036
1108
  start<C extends WorkflowClass>(workflow: C, input: WorkflowInputOf<C>, runId?: string, opts?: StartOptions): Promise<RunResult>;
1037
1109
  start(workflow: string, input: unknown, runId?: string, opts?: StartOptions): Promise<RunResult>;
@@ -1264,7 +1336,7 @@ interface RunRequestResponderOptions {
1264
1336
  verifyTenant?: TenantVerifier | undefined;
1265
1337
  /**
1266
1338
  * Warn at construction when no {@link verifyTenant} is set. Default `true`. `DurableModule` passes
1267
- * `true` only for an explicit `topology: { role: 'control-plane' }`, so a plain operator app that
1339
+ * `true` only for `topology: 'control-plane'`, so a standalone operator app that
1268
1340
  * never serves tenants boots silently.
1269
1341
  */
1270
1342
  warnWithoutVerifier?: boolean | undefined;
@@ -1638,4 +1710,4 @@ declare class WorkflowService {
1638
1710
  republishLifecycle(target: RepublishLifecycleTarget): Promise<RepublishLifecycleResult>;
1639
1711
  }
1640
1712
 
1641
- export { BAD_RUN_REQUEST, CONTEXT_ACCESSOR, type ContextAccessor, type ContextStore, DEAD_LETTER_METADATA, DURABLE_STEP_METADATA, DURABLE_WORKER_RUNNERS, DURABLE_WORKER_RUNTIME, DeadLetter, type DtoClass, DurableModule, type DurableModuleAsyncOptions, type DurableModuleOptions, type DurableRetentionOptions, DurableStartClient, DurableStep, type DurableStepInterceptor, type DurableStepMeta, ENTITY_METADATA, ENTITY_ON_METADATA, Entity, EntityService, type ErrorClassWithCode, IN_APP_RUN_REDIS_WORKER, IN_APP_WORKER_BINDING, IN_APP_WORKER_RUNNERS, IN_APP_WORKER_RUNTIME, type InAppWorkerBinding, InAppWorkerBootstrap, type IoSchema, ON_ERROR_METADATA, ON_EVENT_BATCH_METADATA, ON_EVENT_METADATA, On, OnDurableEvent, OnError, type OnErrorMethod, OnEvent, OnWorkflowCompleted, OnWorkflowFailed, type OnWorkflowFailedOptions, type OnWorkflowSettledOptions, ProxyRunGateway, RUN_GATEWAY, RUN_REDIS_WORKER, RunGatewayError, type RunGatewayErrorCode, type RunLookupStore, type RunRedisWorkerFn, RunRequestResponder, type RunRequestResponderOptions, type RunRequestTransport, STEP_INTERCEPTOR_METADATA, Step, StepInterceptor, type StepOptions, StoreRunGateway, type SubscriberBatch, type SubscriberDebounce, type SubscriberDecorator, TENANT_REPUBLISH_MAX_LIMIT, TenantEventRepublisher, ThinStepRegistrar, ThinWorkerBootstrap, ThinWorkflowRegistrar, UNSUPPORTED_RUN_REQUEST, type UserRef, WORKFLOW_METADATA, Workflow, type WorkflowAttributesOf, type WorkflowMeta, type WorkflowOptions, WorkflowService, attributesOf, entityConfigFor, eventBatchOf, getDurableStepMeta, getEntityMeta, getOnEvents, getWorkflowMeta, inAppWorkerProviders, isDeadLetterHandler, isDrivingOperator, isOperatorRole, isStepInterceptor, onErrorCodesOf, thinWorkerProviders, unavailableRunGateway };
1713
+ export { BAD_RUN_REQUEST, CONTEXT_ACCESSOR, type ContextAccessor, type ContextStore, type ContractClass, type ControlPlaneDurableOptions, DEAD_LETTER_METADATA, DURABLE_STEP_METADATA, DURABLE_WORKER_RUNNERS, DURABLE_WORKER_RUNTIME, DeadLetter, type DtoClass, DurableModule, type DurableModuleAsyncOptions, type DurableModuleOptions, type DurableModuleSharedOptions, type DurableRetentionOptions, DurableStartClient, DurableStep, type DurableStepInterceptor, type DurableStepMeta, type DurableTopologyName, ENTITY_METADATA, ENTITY_ON_METADATA, Entity, EntityService, type ErrorClassWithCode, IN_APP_RUN_REDIS_WORKER, IN_APP_WORKER_BINDING, IN_APP_WORKER_RUNNERS, IN_APP_WORKER_RUNTIME, type InAppWorkerBinding, InAppWorkerBootstrap, type IoSchema, type LazyContract, ON_ERROR_METADATA, ON_EVENT_BATCH_METADATA, ON_EVENT_METADATA, On, OnDurableEvent, OnError, type OnErrorMethod, OnEvent, OnWorkflowCompleted, OnWorkflowFailed, type OnWorkflowFailedOptions, type OnWorkflowSettledOptions, ProxyRunGateway, RUN_GATEWAY, RUN_REDIS_WORKER, RunGatewayError, type RunGatewayErrorCode, type RunLookupStore, type RunRedisWorkerFn, RunRequestResponder, type RunRequestResponderOptions, type RunRequestTransport, STEP_INTERCEPTOR_METADATA, type StandaloneDurableOptions, Step, StepInterceptor, type StepOptions, StoreRunGateway, type SubscriberBatch, type SubscriberDebounce, type SubscriberDecorator, TENANT_REPUBLISH_MAX_LIMIT, type TenantCredentialsContract, type TenantDurableOptions, TenantEventRepublisher, type TenantTokenOption, type TenantVerifierContract, type TenantVerifierInput, type TenantVerifierOption, ThinStepRegistrar, ThinWorkerBootstrap, ThinWorkflowRegistrar, UNSUPPORTED_RUN_REQUEST, type UserRef, WORKFLOW_METADATA, Workflow, type WorkflowAttributesOf, type WorkflowMeta, type WorkflowOptions, WorkflowService, attributesOf, entityConfigFor, eventBatchOf, getDurableStepMeta, getEntityMeta, getOnEvents, getWorkflowMeta, inAppWorkerProviders, isDeadLetterHandler, isDrivingOperator, isOperatorRole, isStepInterceptor, onErrorCodesOf, thinWorkerProviders, unavailableRunGateway };