/** * P1 Next SDK handler — NextAuth-style catch-all for `/p1/api/[...p1]`. * * Usage in your Next.js app: * * // app/p1/api/[...p1]/route.ts * import { createP1Handler } from "@pantheon-systems/p1-next-sdk"; * import config from "../../../../puck.config"; * const handler = createP1Handler({ config }); * export const { GET, POST, DELETE } = handler; */ import type { Config } from "@puckeditor/core"; import { NextResponse } from "next/server"; import type { RemoteDatasourceFetcher, RemoteDatasourceDefinition } from "@pantheon-systems/puck-css/server"; import { type P1DataConfig } from "@pantheon-systems/puck-css/server"; export type P1HandlerConfig = P1DataConfig & { config: Config; builtinFetchers?: RemoteDatasourceFetcher[]; builtinDatasourceRegistry?: RemoteDatasourceDefinition[]; /** * Dynamic segment this app renders public pages from, as Next.js names it for * revalidatePath. Publishing a route template invalidates it so instance URLs * that resolve by template fall-through alone are refreshed too. Defaults to * both `/[...puckPath]` and `/[[...puckPath]]`; an app rendering pages from * another segment names it here. */ publicPageSegment?: string; }; export declare function createP1Handler(opts: P1HandlerConfig): { GET: (request: Request, { params }: { params: Promise<{ p1?: string[]; }>; }) => Promise>; POST: (request: Request, { params }: { params: Promise<{ p1?: string[]; }>; }) => Promise>; DELETE: (request: Request, { params }: { params: Promise<{ p1?: string[]; }>; }) => Promise>; };