next-sanity
Version:
Sanity.io toolkit for Next.js
26 lines • 890 B
TypeScript
import { NextRequest } from "next/server";
/** @public */
type ParsedBody<T> = {
/**
* If a secret is given then it returns a boolean. If no secret is provided then no validation is done on the signature, and it'll return `null`
*/
isValidSignature: boolean | null;
body: T | null;
};
/** @public */
interface SanityDocument {
_id: string;
_type: string;
_createdAt: string;
_updatedAt: string;
_rev: string;
[key: string]: unknown;
}
/**
* Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries
* without worrying about getting stale data.
* @public
*/
declare function parseBody<Body = SanityDocument>(req: NextRequest, secret?: string, waitForContentLakeEventualConsistency?: boolean): Promise<ParsedBody<Body>>;
export { ParsedBody, parseBody };
//# sourceMappingURL=index.d.ts.map