next-sanity
Version:
Sanity.io toolkit for Next.js
34 lines (29 loc) • 872 B
TypeScript
import type {NextRequest} from 'next/server'
/**
* 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
*/
export declare function parseBody<Body = SanityDocument>(
req: NextRequest,
secret?: string,
waitForContentLakeEventualConsistency?: boolean,
): Promise<ParsedBody<Body>>
/** @public */
export declare 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 */
declare interface SanityDocument {
_id: string
_type: string
_createdAt: string
_updatedAt: string
_rev: string
[key: string]: unknown
}
export {}