1 | import { createEventHandler } from "./event-handler/index.js";
|
2 | import type { EmitterWebhookEvent, EmitterWebhookEventName, HandlerFunction, RemoveHandlerFunction, Options, WebhookError, WebhookEventHandlerError, EmitterWebhookEventWithStringPayloadAndSignature } from "./types.js";
|
3 | export { createNodeMiddleware } from "./middleware/node/index.js";
|
4 | export { emitterEventNames } from "./generated/webhook-names.js";
|
5 | declare class Webhooks<TTransformed = unknown> {
|
6 | sign: (payload: string) => Promise<string>;
|
7 | verify: (eventPayload: string, signature: string) => Promise<boolean>;
|
8 | on: <E extends EmitterWebhookEventName>(event: E | E[], callback: HandlerFunction<E, TTransformed>) => void;
|
9 | onAny: (callback: (event: TTransformed extends unknown ? EmitterWebhookEvent : EmitterWebhookEvent & TTransformed) => any) => void;
|
10 | onError: (callback: (event: WebhookEventHandlerError<TTransformed>) => any) => void;
|
11 | removeListener: <E extends EmitterWebhookEventName | "*">(event: E | E[], callback: RemoveHandlerFunction<E, TTransformed>) => void;
|
12 | receive: (event: EmitterWebhookEvent) => Promise<void>;
|
13 | verifyAndReceive: (options: EmitterWebhookEventWithStringPayloadAndSignature) => Promise<void>;
|
14 | constructor(options: Options<TTransformed> & {
|
15 | secret: string;
|
16 | });
|
17 | }
|
18 | export { createEventHandler, Webhooks, type EmitterWebhookEvent, type EmitterWebhookEventName, type WebhookError, };
|