import type { DurableExecutionOptions } from "@duraflows/core"; import { type DynamicModule, type Type, type InjectionToken, type OptionalFactoryDependency } from "@nestjs/common"; import type { WorkflowDefinition, WorkflowClock, WorkflowPersistenceProvider, WorkflowObserver, ObserverErrorHandler, WorkflowGuard, WorkflowGuardRegistry, WorkflowTimeoutRetryOptions } from "@duraflows/core"; import { type WorkflowCommandRegistration } from "./providers/nest-command-registry.js"; export interface WorkflowModuleOptions { durableExecution?: DurableExecutionOptions; workflows: WorkflowDefinition[]; commands?: WorkflowCommandRegistration[]; guards?: WorkflowGuard[]; guardRegistry?: WorkflowGuardRegistry; observers?: WorkflowObserver[]; onObserverError?: ObserverErrorHandler; persistence: WorkflowPersistenceProvider; clock?: WorkflowClock; /** * How `processExpiredWorkflows` retries an instance whose timeout processing * fails: exponential backoff, then parking. Defaults apply when omitted. */ timeoutRetry?: WorkflowTimeoutRetryOptions; /** * What module init does when a stored definition version that still has * active instances references an unregistered command or guard, or is * structurally invalid: `"fail"` (default) fails application startup, * `"warn"` logs and continues. */ onUnresolvable?: "fail" | "warn"; enableControllers?: boolean; } export interface WorkflowModuleFactoryConfig { durableExecution?: DurableExecutionOptions; workflows: WorkflowDefinition[]; persistence: WorkflowPersistenceProvider; clock?: WorkflowClock; guards?: WorkflowGuard[]; guardRegistry?: WorkflowGuardRegistry; observers?: WorkflowObserver[]; onObserverError?: ObserverErrorHandler; /** See {@link WorkflowModuleOptions.timeoutRetry}. */ timeoutRetry?: WorkflowTimeoutRetryOptions; /** See {@link WorkflowModuleOptions.onUnresolvable}. */ onUnresolvable?: "fail" | "warn"; } export interface WorkflowModuleAsyncOptions { imports?: Type[]; commands?: WorkflowCommandRegistration[]; enableControllers?: boolean; useFactory: (...args: TArgs) => Promise | WorkflowModuleFactoryConfig; /** * DI tokens resolved and passed to `useFactory`, positionally. The tuple * length is type-checked against the factory's parameter list when `TArgs` * is supplied (e.g. `forRootAsync<[Pool, AuditObserver]>({ ... })`). */ inject?: { [K in keyof TArgs]: InjectionToken | OptionalFactoryDependency; }; } export declare class WorkflowModule { static forRoot(options: WorkflowModuleOptions): DynamicModule; static forRootAsync(options: WorkflowModuleAsyncOptions): DynamicModule; } //# sourceMappingURL=workflow.module.d.ts.map