import type { BatchOperation } from '../../storage/interface.ts'; import type { PaginatedResult, ScheduleFilter, ScheduleOptions, ScheduleSpec, ScheduleState, ScheduleSummary, ScheduleUpdateOptions, WorkflowState } from '../types.ts'; import type { EngineInternals } from './internals.ts'; import { ScheduleHandle } from './schedule-handle.ts'; import type { ScheduledRunStartOptions } from './schedule-run.ts'; export { startScheduledRun } from './schedule-run.ts'; export { handleScheduleTimer } from './schedule-timer.ts'; export type RefreshedScheduleState = { state: ScheduleState; currentWorkflowState: WorkflowState | null; }; export type ScheduleCallbacks = { /** * `revisionOverride` (WFT-20) is the exact revision a `revisionPolicy: 'pinned'` * occurrence must resolve against; `undefined` for an `'active-at-fire'` schedule. * * `skipAdmissionIdCheck` (WFT-95, internal only) is threaded straight through to * `startWorkflow`'s parameter of the same name — see its doc comment. Set only when * replaying a schedule's already-persisted `queuedRuns[].workflowId` via * `drainQueuedScheduleRun()`; every other schedule-run start (a fresh cadence tick, * a `cancel-running` replacement) omits it and gets strict id admission. */ startWorkflow: (type: string, input: unknown, options: { id: string; }, additionalStartOperations?: BatchOperation[], revisionOverride?: string, skipAdmissionIdCheck?: boolean) => Promise; loadWorkflowState: (workflowId: string) => Promise; cancelWorkflow: (workflowId: string) => Promise; getWorkflowResult: (workflowId: string) => Promise; refreshScheduledWorkflowState: (state: ScheduleState) => Promise; startScheduledRun: (state: ScheduleState, options?: ScheduledRunStartOptions) => Promise; applyScheduleOccurrence: (state: ScheduleState, occurrence?: number) => Promise; settleBackfillScheduleState: (state: ScheduleState) => Promise; flushQueuedInlineWorkflowStartsDirectly: () => Promise; failWorkflow: (workflowId: string, error: Error) => Promise; handleCleanupError: (source: string, error: unknown, workflowId: string) => void; }; export declare function schedule(internals: EngineInternals, type: string, input: unknown, spec: string | ScheduleSpec, options?: ScheduleOptions): Promise; export declare function listSchedules(internals: EngineInternals, filter?: ScheduleFilter): Promise>; export declare function recoverOrphanedScheduleTimers(internals: EngineInternals): Promise; export declare function toScheduleSummary(state: ScheduleState): ScheduleSummary; export declare function pauseSchedule(internals: EngineInternals, scheduleId: string): Promise; export declare function resumeSchedule(internals: EngineInternals, scheduleId: string): Promise; export declare function cancelSchedule(internals: EngineInternals, scheduleId: string): Promise; export declare function updateSchedule(internals: EngineInternals, scheduleId: string, newSpec: string | ScheduleSpec, options?: ScheduleUpdateOptions): Promise; export declare function refreshScheduledWorkflowState(internals: EngineInternals, state: ScheduleState, callbacks: Pick): Promise; export declare function applyScheduleOccurrence(internals: EngineInternals, state: ScheduleState, callbacks: ScheduleCallbacks, occurrence?: number): Promise; export declare function settleBackfillScheduleState(internals: EngineInternals, state: ScheduleState, callbacks: Pick): Promise; export declare function handleScheduledWorkflowTerminal(internals: EngineInternals, workflowId: string, callbacks: ScheduleCallbacks): Promise;