/** * dispatch.ts * * Outbound webhook dispatch: pattern matching (glob/regex) + HMAC-SHA256 * signing + async fire-and-forget HTTP POST. * * Design: * - One POST per matching rule per write operation (not per page). * - Never blocks or fails the originating write. * - Patterns are tested as minimatch globs first, then as RegExp. */ import { type WebhookRule } from "./webhookRules.js"; export interface WebhookPayload { event: "page.created" | "page.updated" | "page.deleted"; name: string; title: string; tags: string[]; summary: string; at: string; /** Subject that performed the write (GH #498). Empty for api-key / connector-key writes. */ actor: string; } /** * Returns true if `pageName` matches the given glob or regex pattern. * * Glob matching rules (subset of minimatch): * * — any sequence of characters EXCEPT / * ** — any sequence including / * ? — single character except / * * If the pattern is enclosed in /…/ it is treated as a regex. */ export declare function matchesPattern(pageName: string, pattern: string): boolean; /** Returns true if the rule matches the event and at least one pattern matches pageName. */ export declare function ruleMatchesPage(rule: WebhookRule, event: "create" | "update" | "delete", pageName: string): boolean; /** * Fire webhooks for a single page write. Async fire-and-forget — never throws. */ export declare function dispatchPageWebhook(userId: string, event: "create" | "update" | "delete", payload: Omit): void; /** * Fire webhooks for a bundle push (coalesced per rule). * Accepts a list of (name, event) pairs and fires one POST per matching rule. */ export declare function dispatchBundleWebhooks(userId: string, pages: Array<{ name: string; event: "create" | "update"; title: string; tags: string[]; summary: string; }>, actor?: string): void; //# sourceMappingURL=dispatch.d.ts.map