/** * Webhook payload templating * * Lets actors control the exact shape of the body POSTed to their webhook URL * via a JSONata expression. Runs as the LAST step of the webhook pipeline, * after schema validation and extended-payload merging. * * The expression is evaluated against this context: * * { * items: MergedOutputItem[] // validated + extended items * runId: string | undefined * count: number // items.length * timestamp: string // ISO-8601, evaluation time * } * * Whatever the expression returns becomes the request body. Examples: * * items.content -> array of content only * { "runId": runId, "count": count, "records": items.content } * $ -> the full context object * * Leaving the expression empty preserves the default behavior (the items array * is sent unchanged). */ export interface WebhookTemplateContext { runId?: string; timestamp?: string; } /** * Thrown when a payload template fails to compile or evaluate. Callers should * skip the webhook and record this as the webhook error rather than sending a * fallback body, so misconfigurations surface instead of silently delivering * the wrong shape. */ export declare class WebhookTemplateError extends Error { constructor(message: string); } /** * Compile-check a JSONata expression without evaluating it. Returns an error * message if it does not parse, otherwise null. Useful for form/save-time * validation. */ export declare function validateWebhookPayloadTemplate(expression: string | undefined | null): string | null; /** * Apply a JSONata payload template to the (already validated + extended) items. * * - If `expression` is empty/whitespace, returns `items` unchanged. * - If the expression fails to compile or evaluate, throws WebhookTemplateError * (the caller must skip the webhook and record the error). */ export declare function applyWebhookPayloadTemplate(items: any[], expression: string | undefined | null, context?: WebhookTemplateContext): Promise; //# sourceMappingURL=webhook-payload.d.ts.map