import type { OrgXClient } from "../api.js"; import type { OutboxEvent } from "../outbox.js"; import type { ReportingPhase, ReportingSourceClient } from "../types.js"; export type ReplayStatus = "idle" | "running" | "success" | "error"; export type OutboxReplayState = { status: ReplayStatus; lastReplayAttemptAt: string | null; lastReplaySuccessAt: string | null; lastReplayFailureAt: string | null; lastReplayError: string | null; }; interface ReportingContextInput { initiative_id?: unknown; run_id?: unknown; correlation_id?: unknown; source_client?: unknown; initiativeId?: unknown; runId?: unknown; correlationId?: unknown; sourceClient?: unknown; } type ReplayContext = { initiativeId: string; runId?: string; correlationId?: string; sourceClient?: ReportingSourceClient; }; export interface CreateOutboxReplayerDeps { client: OrgXClient; logger: { info?: (msg: string, meta?: Record) => void; warn?: (msg: string, meta?: Record) => void; }; toErrorMessage: (err: unknown) => string; stableHash: (value: string) => string; resolveReportingContext: (input: ReportingContextInput) => { ok: true; value: ReplayContext; } | { ok: false; error: string; }; pickStringField: (input: Record, ...keys: string[]) => string | null; pickStringArrayField: (input: Record, ...keys: string[]) => string[] | undefined; toReportingPhase: (phase: string, progressPct?: number) => ReportingPhase; parseRetroEntityType: (value: string | null) => "initiative" | "task" | "milestone" | "workstream" | null | undefined; isUuid: (value: string | undefined) => value is string; readOutboxReplayState: () => OutboxReplayState; writeOutboxReplayState: (next: OutboxReplayState) => void; } export declare function createOutboxReplayer(deps: CreateOutboxReplayerDeps): { replayOutboxEvent: (event: OutboxEvent) => Promise; flushOutboxQueues: () => Promise; }; export {};