import postgres from "postgres"; /** * One-time, operator-invoked backfill of product lifecycle facts captured * before the first `lifecycle_fact` consumer registered (migration 0565). * * Each source is drained through * `opengeni_private.backfill_product_lifecycle_facts`: the first call reads * the source tables once (ACCESS SHARE only) into a private queue, and every * call then enqueues one primary-key page of it in its own short * transaction. Backfilled facts reuse the live trigger's deterministic fact * ids and keep their original timestamps, so an overlap with live capture or * a repeated run never adds a second fact. A completed source is a durable * no-op. Run as the migration owner only after a lifecycle consumer is * registered, and not while a deploy or migration is running: * * OPENGENI_MIGRATIONS_DATABASE_URL=... bun run db:backfill-lifecycle-facts * * Each call runs under a statement timeout (default 15min, override with * `--statement-timeout=30min`). */ export declare const LIFECYCLE_BACKFILL_SOURCES: readonly ["auth.sign_up", "auth.email_verified", "auth.sign_in", "organization.setup", "model.connected", "credits.purchased", "credits.granted", "connection.created", "connection.revoked", "scheduled_task.created", "skill.installed", "slack.user_linked", "machine.enrolled", "member.joined", "user.active"]; export type LifecycleBackfillSource = (typeof LIFECYCLE_BACKFILL_SOURCES)[number]; export type LifecycleBackfillResult = { source: LifecycleBackfillSource; enqueued: number; scanned: number; batches: number; }; export declare function backfillProductLifecycleFacts(sql: postgres.Sql, options?: { sources?: readonly LifecycleBackfillSource[]; batchSize?: number; onBatch?: (batch: LifecycleBackfillResult) => void; }): Promise; /** Command-line entry. Bundled release images call this explicitly; see * scripts/assemble-server-runtime.ts. */ export declare function runLifecycleFactBackfillCli(): Promise;