import { LiveCopyError, type LiveCopyBinding } from "../collab/live-copy.js"; import { type DbExec } from "../db/client.js"; type NitroPluginDef = (nitroApp: any) => void | Promise; export type CollabResourceIdResolver = (docId: string) => string | null | Promise; export type CollabAccess = { mode: "resource"; resourceType: string; resolveResourceId?: CollabResourceIdResolver; } | { mode: "all-authenticated"; }; type NormalizedCollabAccess = { mode: "resource"; resourceType: string; resolveResourceId?: CollabResourceIdResolver; } | { mode: "all-authenticated"; explicit: boolean; }; export interface CollabPluginOptions { table?: string; contentColumn?: string; idColumn?: string; autoSeed?: boolean; resolveSourceIdFromCollabDocumentId?: (docId: string) => string; /** * Documents this binding covers are live copies: each update commits with * its derived text, and the text, JSON and search-replace routes refuse * them. Requires `autoSeed: false`; seed with `seedLiveCopy`. Passing the * binding here also imports it at server start, so the refusal holds from * the first request rather than from whenever an action first loads it. */ liveCopy?: LiveCopyBinding; contentType?: "text" | "json"; jsonColumn?: string; access?: CollabAccess; /** * The shareable resource type registered via `registerShareableResource`. * Used to enforce access checks on collab routes. * @deprecated Use `access: { mode: "resource", resourceType }`. */ resourceType?: string; /** * Map the collab document id to the shareable resource id. Many templates * use route-specific collab ids (for example, one doc per slide inside a * deck) while sharing is enforced at the parent resource level. * @deprecated Use `access: { mode: "resource", resourceType, resolveResourceId }`. */ resolveResourceId?: CollabResourceIdResolver; maxPayloadBytes?: number; } export declare function normalizeCollabAccess(options: Pick): NormalizedCollabAccess; export declare function createCollabSourceSeeder(options: { hasState: (docId: string) => Promise; loadSource: (docId: string) => Promise; seed: (docId: string, source: string, client?: DbExec) => Promise; withLock?: (docId: string, run: (client?: DbExec) => Promise) => Promise; }): (docId: string) => Promise; export declare function liveCopyErrorStatus(error: LiveCopyError): number; export declare function createCollabPlugin(options?: CollabPluginOptions): NitroPluginDef; export {};