/** * Serializes leaf flow-command dispatches around a lazily resolved handle. * Command callbacks must not enqueue another command on the same controller. */ export type FlowCommandHandleController = { runCommand(buildPayload: (handleId: THandleId | undefined) => TPayload, dispatchAndWait: (payload: TPayload) => Promise): Promise; /** At its FIFO turn, dispatches with the current handle or no-ops if absent. */ runResolvedHandleCommand(buildPayload: (handleId: THandleId) => TPayload, dispatchAndWait: (payload: TPayload) => Promise): Promise; getHandleId(): THandleId | undefined; hasHandleId(handleId: string): boolean; /** * Records an authoritative invalidation without cancelling active * stale-handle recovery. * * The return value reports only whether a matching resolved handle was * cleared. A pending command may still record the invalidation when this * returns `false`. */ invalidateResolvedHandle(handleId: string): boolean; hasPendingCommands(): boolean; subscribeHandle(subscriber: (handleId: THandleId) => void): () => void; clearResolvedHandle(): THandleId | undefined; reset(): void; }; export type CreateFlowCommandHandleControllerOptions = { getHandleIdFromSettlement: (settlement: TSettlement) => THandleId | undefined; isStaleHandleError: (error: unknown) => boolean; /** Best-effort notification after the resolved handle has been cleared. */ onClearResolvedHandle?: (handleId: THandleId) => void; }; export declare function createFlowCommandHandleController({ getHandleIdFromSettlement, isStaleHandleError, onClearResolvedHandle, }: CreateFlowCommandHandleControllerOptions): FlowCommandHandleController; //# sourceMappingURL=flow-command-handle-controller.d.ts.map