/**
 * File Loader
 *
 * Loads configuration and feature definitions from disk.
 * This is CLI-side only - reads files and prepares them for the API.
 *
 * Loads defineTable() definitions from *.ts feature files.
 */
export interface LoadedConfig {
    name: string;
    preset: string;
    template?: string;
    providers?: any;
    build?: {
        outputDir?: string;
    };
    features?: {
        organizations?: boolean;
    };
    schemaRegistry?: {
        generate?: boolean;
    };
    openapi?: {
        generate?: boolean;
        publish?: boolean;
    };
    [key: string]: unknown;
}
/**
 * A table definition from a single file using defineTable()
 */
export interface LoadedTableDefinition {
    /** Original filename, e.g., "claims.ts", "claim-versions.ts" */
    fileName: string;
    /** Export name (camelCase), e.g., "claims", "claimVersions" */
    tableName: string;
    /** Full file source code */
    source: string;
    /** Has defineTable default export (generates routes) */
    hasResourceConfig: boolean;
}
/**
 * A page definition from features/{feature}/pages/*.ts
 */
export interface LoadedPageDefinition {
    /** File name (e.g., "bank-reconciliation.ts") */
    fileName: string;
    /** Page slug (from definePage) */
    slug: string;
    /** Feature this page belongs to */
    feature: string;
    /** Page title */
    title: string;
    /** Full source code */
    source: string;
}
/**
 * A loaded feature containing one or more tables.
 *
 * Action authoring uses the one-file-per-action shape exclusively: every
 * action lives in `<feature>/actions/<name>.ts` (or
 * `<feature>/actions/<table>/<name>.ts` for multi-table features) and is
 * AST-parsed compiler-side via the feature-walker discovery + per-action
 * parser. The legacy `defineActions(...)` / `actions.ts` / `_feature.ts` /
 * `handlers/` shapes are retired; the loader rejects them at discovery
 * time with a migration error.
 */
export interface LoadedFeature {
    name: string;
    /** Primary schema (first table with defineTable) */
    schema: {
        tableName: string;
        columns: Record<string, any>;
        source: string;
    };
    /** All tables in this feature */
    tables?: LoadedTableDefinition[];
    resource?: any;
    resourceSource?: string;
    /**
     * One file per action, AST-parsed by the compiler. Keyed by relative path
     * from the feature root, e.g. `actions/advance.ts` or
     * `actions/profiles/publish.ts`. Each file is `export default defineAction(...)`.
     */
    actionFiles?: Record<string, string>;
    /**
     * Feature-local `<feature>/lib/` files keyed by relative path
     * (e.g. `lib/inputs.ts`). Copied verbatim into the generated output;
     * action files import them via `../lib/...`.
     */
    featureLibFiles?: Record<string, string>;
    /** Page definitions from pages/ subdirectory */
    pageFiles?: LoadedPageDefinition[];
}
/**
 * Queue handler definition from services/queues/*.ts
 */
export interface LoadedQueueHandler {
    /** File name (e.g., "ingest.ts") */
    fileName: string;
    /** Handler name (from defineQueue) */
    name: string;
    /** Message type to match */
    messageType: string;
    /** Full source code */
    source: string;
}
/**
 * Realtime definition from services/realtime/*.ts
 */
export interface LoadedRealtimeDefinition {
    /** File name (e.g., "extraction.ts") */
    fileName: string;
    /** Namespace name (from defineRealtime) */
    name: string;
    /** Event names */
    events: string[];
    /** Full source code */
    source: string;
}
/**
 * Embedding definition from services/embeddings/*.ts
 */
export interface LoadedEmbeddingDefinition {
    /** File name (e.g., "claim-similarity.ts") */
    fileName: string;
    /** Config name (from defineEmbedding) */
    name: string;
    /** Source table */
    source: string;
    /** Full source code */
    sourceCode: string;
}
/**
 * Services definitions
 */
export interface LoadedServices {
    queues?: LoadedQueueHandler[];
    realtime?: LoadedRealtimeDefinition[];
    embeddings?: LoadedEmbeddingDefinition[];
}
/**
 * Load quickback.config.ts from disk
 */
export declare function loadConfig(configPath: string): Promise<LoadedConfig>;
/**
 * Load all features from definitions/features/.
 *
 * After each feature loads, conflicts are batched and thrown as one error
 * block — keeps migration of an existing project to a single round-trip
 * instead of N. The loader emits no warnings; everything that needs the
 * user's attention is an actionable conflict pointing at the migration.
 */
export declare function loadFeatures(featuresDir: string): Promise<LoadedFeature[]>;
/**
 * Find the config file path
 */
export declare function findConfigPath(startDir?: string): Promise<string | null>;
/**
 * Find the features directory
 */
export declare function findFeaturesDir(startDir?: string): Promise<string | null>;
/**
 * Load project-level shared lib at `quickback/lib/`.
 *
 * Cross-feature TypeScript that any feature can import via the `~/lib/*`
 * alias. Returns relative paths keyed from `lib/` (e.g. `lib/inputs.ts`)
 * with their source contents. Empty object when the directory is missing.
 *
 * Discipline (enforced compiler-side, not here): files in `quickback/lib/`
 * must not import from `quickback/features/`. Keeps lib genuinely shared
 * and cycle-free.
 */
export declare function loadProjectLib(projectRoot: string): Promise<Record<string, string>>;
/**
 * Load project-level auth hooks from `quickback/hooks/`.
 *
 * Flat one-file-per-event convention matching `services/queues/`,
 * `services/realtime/`, `services/embeddings/`. Filename grammar:
 * `(before|after)-<subject>-<verb>.ts` where (subject, verb) is one of
 * the recognized Better Auth `databaseHooks` paths. Returns relative
 * paths keyed from `hooks/` (e.g. `hooks/after-user-create.ts`) with
 * their source contents. Empty object when the directory is missing.
 *
 * Throws on unknown filenames so projects fail compile-fast on typos.
 */
export declare function loadProjectHooks(projectRoot: string): Promise<Record<string, string>>;
/**
 * Load user-authored Better Auth plugin source files from `quickback/plugins/`.
 *
 * Each `.ts` file is uploaded to the compiler verbatim. Files only flow
 * through the build when referenced from a `customPlugins[].from` entry on
 * the auth config — unreferenced files are quietly ignored server-side.
 *
 * Returns relative paths keyed from `plugins/` (e.g. `plugins/long-session.ts`),
 * matching the path the BA provider rewrites imports against.
 */
export declare function loadProjectPlugins(projectRoot: string): Promise<Record<string, string>>;
/**
 * Load project-supplied email templates from `quickback/email-templates/`.
 *
 * Referenced from `defineAuth("better-auth", { plugins: { emailOtp: { templates: { 'forget-password': './email-templates/...' } } } })`.
 * Each `.ts` file is uploaded verbatim; the better-auth provider stages
 * referenced files into `src/email-templates/<name>.ts` and emits the
 * default import in `src/lib/auth.ts`. Files not referenced by any
 * template entry are ignored — the CLI uploads the directory, the
 * compiler picks only what's needed.
 *
 * Returns relative paths keyed from `email-templates/` (e.g.
 * `email-templates/welcome.ts`), matching the path the BA provider
 * rewrites imports against.
 */
export declare function loadProjectEmailTemplates(projectRoot: string): Promise<Record<string, string>>;
/**
 * Load project-level Hono middlewares from `quickback/middlewares/`.
 *
 * v0.19+: declarative cross-cutting slot for non-authz middleware (request
 * logging, debug headers, response transforms). Each `.ts` file is uploaded
 * verbatim; the compiler mounts them via `app.use('*', mw)` between
 * platform middleware (auth/db/services) and route registration.
 *
 * Returns relative paths keyed from `middlewares/` (e.g.
 * `middlewares/request-logger.ts`), matching the path the compiler emits
 * into the generated `src/middlewares/` directory.
 */
export declare function loadProjectMiddlewares(projectRoot: string): Promise<Record<string, string>>;
/**
 * Find the services directory
 */
export declare function findServicesDir(startDir?: string): Promise<string | null>;
/**
 * Load all services from definitions/services/
 */
export declare function loadServices(servicesDir: string): Promise<LoadedServices>;
/**
 * Load existing drizzle migration state (historical SQL + meta JSON) so the
 * compiler can generate incremental migrations (ALTER vs CREATE) and run
 * provider-specific safety passes against the *full* existing chain instead of
 * only whatever drizzle-kit happens to emit on this compile.
 *
 * Migration state lives in ONE place: `<project>/quickback/drizzle/...`.
 * Quickback owns this state — it's never mirrored to or read from a
 * project-root `drizzle/` folder.
 *
 * The keys returned include the `quickback/` prefix so the server stages
 * the files at the same on-disk path that drizzle.config.ts's `out:`
 * resolves to (`<temp>/output/quickback/drizzle/<db>/...`). Without that
 * alignment, drizzle-kit can't find existing journals on recompile and
 * provider hooks cannot sanitize historical migrations already checked into
 * the project tree.
 */
export declare function loadDrizzleMeta(projectRoot: string): Promise<Record<string, string> | undefined>;
//# sourceMappingURL=file-loader.d.ts.map