//#region src/core/db/session.d.ts /** A D1 binding *or* a Sessions-API session (`env.DB.withSession(...)`). Drizzle's * D1 driver only ever calls `prepare`/`batch`, both of which a session * implements, so either flows through {@link db} unchanged. */ type D1Client = D1Database | D1DatabaseSession; /** The cookie the editor persists its latest D1 bookmark in. HttpOnly—only the * server-side resume read consumes it; no client script needs it. */ declare const D1_BOOKMARK_COOKIE = "louise_d1_bookmark"; /** How long the bookmark cookie lives, in seconds: 8 hours—an editing * session. Past that, a resume read simply starts unconstrained. */ declare const D1_BOOKMARK_MAX_AGE: number; /** * Open a D1 Sessions-API session for read-your-writes across read replicas, * degrading to the raw binding when the runtime predates the Sessions API (or a * test double lacks `withSession`)—behaviour is then identical to a single, * un-replicated D1. Pass: * - `"first-primary"` on a write path (the first query hits the primary, so the * bookmark it returns reflects the write), then persist {@link d1Bookmark}; * - a persisted bookmark on a resume read, to anchor reads at that write; * - `"first-unconstrained"` (the default) to start a read session with no * bookmark yet—the first query may hit any replica. */ declare function openD1Session(DB: D1Database, constraintOrBookmark?: D1SessionConstraint | (D1SessionBookmark & {})): D1Client; /** The latest bookmark from a client opened by {@link openD1Session}, or `null` * when it's a raw binding (no session) or no query has run yet. Persist it (see * {@link serializeD1BookmarkCookie}) and feed it back to {@link openD1Session} * on the next request to keep reads consistent with prior writes. */ declare function d1Bookmark(client: D1Client): D1SessionBookmark | null; /** Read the persisted D1 bookmark from a request's `Cookie` header (the value a * resume read anchors at), or `null` when absent. Framework-agnostic; a page * can equivalently read the cookie through its own framework's API. */ declare function readD1Bookmark(request: Request): D1SessionBookmark | null; /** * Serialize a `Set-Cookie` value that persists `bookmark` for the editor session * so the next resume read anchors at it. HttpOnly (only the server read path * needs it), SameSite=Lax (sent on the top-level edit-mode navigation), Secure, * and session-length by default. Returns `undefined` for a falsy bookmark so * callers can spread it without a branch. */ declare function serializeD1BookmarkCookie(bookmark: D1SessionBookmark | null, maxAgeSeconds?: number): string | undefined; //#endregion export { openD1Session as a, d1Bookmark as i, D1_BOOKMARK_COOKIE as n, readD1Bookmark as o, D1_BOOKMARK_MAX_AGE as r, serializeD1BookmarkCookie as s, D1Client as t };