next-sanity
Version:
Sanity.io toolkit for Next.js
25 lines (21 loc) • 757 B
TypeScript
import type {NextRequest} from 'next/server'
import type {SanityDocument} from '@sanity/types'
/**
* 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
}
export {}