import type { BatchOperation } from '../../storage/interface.ts'; import type { ListFilter, PurgeResult, WorkflowState } from '../types.ts'; import type { EngineInternals } from './internals.ts'; export declare const TERMINAL_CLEANUP_DELAY_MS = 60000; export type PurgeParameters = { expiredOnly: boolean; now: number; limit?: number; }; export type CleanupWaiters = (workflowId: string) => void; export declare function purgeInternal(internals: EngineInternals, filter: ListFilter | undefined, parameters: PurgeParameters, cleanupWaiters: CleanupWaiters): Promise; export declare function purgeWorkflow(internals: EngineInternals, state: WorkflowState, cleanupWaiters: CleanupWaiters): Promise; /** * Collect every storage delete operation that removing a workflow id entails — * index deletes (search attributes + tags), the explicit key set (state, * checkpoint, headers, services marker, update requests/responses, and the * `wf:`/`ev:`/`sig:`/... prefix sweeps), and the visibility-index transition to * `null`. Pure: it reads storage to discover keys but writes nothing, so a caller * can fold the returned ops into a larger atomic batch instead of committing them * standalone. {@link purgeWorkflow} commits them on their own; the * `onTerminalConflict: 'start-new'` restart path prepends them to the create batch * so purge-and-recreate land as one atomic unit (no window where the prior run is * gone but the new one has not committed). Keep this the single source of truth * for "what a purge deletes" — do not fork the delete-set. (`wf-gen:` is deliberately excluded; WFT-153, see {@link buildBaseWorkflowDeleteKeys}.) */ export declare function collectWorkflowPurgeDeleteOperations(internals: EngineInternals, state: WorkflowState): Promise; /** * Drop every in-memory cache entry a purged workflow id owns (checkpoints, * heartbeat details, event-log heads, version tuples, handle cache, result * resolvers, headers, nesting depths, type map, pending async activities) and run * `cleanupWaiters` to settle any pending signal/update/sleep waiters. Split from * the storage batch in {@link collectWorkflowPurgeDeleteOperations} so the restart * path can clear the OLD run's in-memory state up front — before the new run's * caches are written under the reused id — while the durable delete still commits * atomically with the create. */ export declare function clearPurgedWorkflowInMemoryState(internals: EngineInternals, workflowId: string, cleanupWaiters: CleanupWaiters): void;