next-sanity
Version:
Sanity.io toolkit for Next.js
32 lines (27 loc) • 936 B
TypeScript
import type {NextApiRequest} from 'next'
import type {PageConfig} from 'next/types'
import type {SanityDocument} from '@sanity/types'
/**
* Configurates the API function with the right runtime and body parsing to handle Sanity Webhook events.
* @public
*/
export declare const config: PageConfig
/** @public */
export declare type ParseBody = {
/**
* 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: SanityDocument
}
/**
* 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(
req: NextApiRequest,
secret?: string,
waitForContentLakeEventualConsistency?: boolean
): Promise<ParseBody>
export {}