Skip to content

createWebhookProjectionHandler

API reference for createWebhookProjectionHandler

@delta-base/toolkit


Function: createWebhookProjectionHandler()

Section titled “Function: createWebhookProjectionHandler()”

createWebhookProjectionHandler<TEvent>(projection): (request) => Promise<Response>

Create a projection handler with webhook support This is platform-agnostic and works with any Request/Response implementation

TEvent extends Readonly<{ data: EventData; metadata?: PlatformEventMetadata; type: string; }>

The event type(s) the projection can handle

Projection<TEvent>

The projection instance to handle events

A webhook handler function that processes HTTP requests

(request): Promise<Response>

Request

Promise<Response>

const projection = new UserProjection(store);
const webhookHandler = createWebhookProjectionHandler(projection);
// Use in Cloudflare Worker, Vercel Edge Function, etc.
export default { fetch: webhookHandler };