/** * Seed Executor * * Main execution logic for the Momentum CMS seeding system. * Handles processing seed entities, idempotency, and change detection. */ import type { DatabaseAdapter, SeedingConfig, SeededDocument } from '@momentumcms/core'; /** * Minimal auth interface for seed executor. * Avoids depending on the full auth package. */ export interface MomentumAuthLike { api: { signUpEmail: (options: { body: { name: string; email: string; password: string; }; }) => Promise<{ user?: { id: string; } | null; } | null>; }; } /** * Result of a seeding run. */ export interface SeedingResult { /** * Total number of seed entities processed. */ total: number; /** * Number of new documents created. */ created: number; /** * Number of documents updated (data changed). */ updated: number; /** * Number of seeds skipped (already exist, no changes). */ skipped: number; /** * All seeded documents (for reference). */ seeds: SeededDocument[]; } /** * Options for running the seeding process. */ export interface SeedingRunOptions { /** * Optional auth instance for auth-aware user seeding. * When provided, seeds with `syncAuth: true` will create Better Auth users * with hashed passwords before creating the Momentum collection document. */ auth?: MomentumAuthLike; } /** * Calculate SHA-256 checksum of seed data for change detection. * Normalizes the JSON to ensure consistent checksums. * * @param data - The data to hash * @returns SHA-256 hex string */ export declare function calculateChecksum(data: Record): string; /** * Check if seeding should run based on configuration. * * @param runOnStart - The runOnStart option value * @returns True if seeding should run */ export declare function shouldRunSeeding(runOnStart: boolean | 'development' | 'always'): boolean; /** * Run the seeding process. * * @param config - The seeding configuration * @param adapter - The database adapter * @param runOptions - Optional run options (e.g., auth instance for user sync) * @returns Seeding result summary * * @example * ```typescript * const result = await runSeeding(config.seeding, config.db.adapter, { auth }); * console.log(`Seeded ${result.created} new documents`); * ``` */ export declare function runSeeding(config: SeedingConfig, adapter: DatabaseAdapter, runOptions?: SeedingRunOptions): Promise;