import type { Hono, Context } from "hono"; import type { ZodTypeAny } from "zod"; import type { FilterAllowlist, SortAllowlist } from "../drizzle-fastify/filter-allowlist.js"; export type { FilterAllowlist, SortAllowlist, } from "../drizzle-fastify/filter-allowlist.js"; export { parseId } from "../drizzle-fastify/util.js"; type AnyDrizzle = any; type AnyTable = any; type AnyHono = Hono; export type CrudVerb = "list" | "get" | "create" | "update" | "delete"; export interface CrudRoutesOptions { /** Hono app instance. Bindings type is the consumer's — kept generic here. */ app: AnyHono; /** REST resource path, e.g. "/subscribers". */ path: string; /** User's Drizzle instance. */ db: AnyDrizzle; /** Drizzle table const. Must expose an `id` column. WRITES always target this. */ table: AnyTable; /** * Replica read view for a write-through entity (#214). When set, every READ — * list, get-by-id, and the row echoed back from create/update — comes from here * instead of `table`, so derived `origin.*` columns are actually present. * * Without it the Hono adapter silently returned rows missing every derived field * the generated type and Zod schema promise, and a filter or sort on such a field * — both of which the generated allowlists ALLOW — hit a column that does not * exist on the table, producing a 500. Fastify had this from the start; the Hono * adapter simply never got it, the same way it never got the `.all()`/`.get()` * fix (#286). */ readView?: AnyTable; /** Zod schema for create payloads (typically `InsertSchema`). */ insertSchema: ZodTypeAny; /** Zod schema for update payloads (typically `UpdateSchema`). */ updateSchema: ZodTypeAny; /** Limit which verbs are mounted. Defaults to all five. */ expose?: readonly CrudVerb[]; /** * HTTP method for the update verb. Defaults to "patch". Set to "put" to * preserve a legacy API contract that already uses PUT for updates. */ updateMethod?: "patch" | "put"; filterAllowlist?: FilterAllowlist; sortAllowlist?: SortAllowlist; /** Dialect — required if filterAllowlist or sortAllowlist is set (for dialect-specific `like` lowering: SQLite lowers to GLOB to stay case-sensitive; ADR-0049). */ dialect?: "sqlite" | "postgres"; } export declare function mountCrudRoutes(opts: CrudRoutesOptions): void; type VerbOptions = Omit; export declare function parseHonoFilterParams(c: Context): Record; export declare function mountListRoute(opts: VerbOptions): void; export declare function mountGetRoute(opts: VerbOptions): void; export declare function mountCreateRoute(opts: VerbOptions): void; export declare function mountUpdateRoute(opts: VerbOptions): void; export declare function mountDeleteRoute(opts: VerbOptions): void; export { mountReadOnlyCrudRoutes, type MountReadOnlyOptions } from "./mount-read-only.js"; //# sourceMappingURL=index.d.ts.map