import type { Context } from 'hono'; import type { GitLabWebhookDispatchDependencies } from './webhook-dispatch.js'; export declare const SUPPORTED_GITLAB_WEBHOOK_EVENTS: Set; export interface ParsedGitLabWebhook { event: string; deliveryId: string; instanceHost?: string; payload: Record; } export interface GitLabWebhookMetadata { event: string; projectId?: number; projectPath?: string; issueIid?: number; mergeRequestIid?: number; noteableType?: string; sender?: string; } export type GitLabWebhookResult = { status: 202; body: { ok: true; ignored?: true; }; } | { status: 400; body: { error: 'bad_request'; message: string; }; } | { status: 401; body: { error: 'unauthorized'; message: string; }; }; /** * What processing an already-parsed delivery needs: the rules ingress and, * when a controller is mounted, the subscription dispatch. Shared by the * direct webhook route and the Platform event poller. */ export interface GitLabWebhookProcessOptions extends Partial> { ingestFactoryEvent?: (event: ParsedGitLabWebhook) => Promise; /** When present, merge-request activity is also delivered to subscribed sessions. */ controller?: GitLabWebhookDispatchDependencies['controller']; } export interface GitLabWebhookHandlerOptions extends GitLabWebhookProcessOptions { webhookSecret?: string; } export declare function verifyGitLabToken(receivedToken: string, secret: string): boolean; export declare function parseGitLabWebhook(c: Context, secret: string | undefined): Promise; export declare function normalizeGitLabWebhookMetadata(parsed: ParsedGitLabWebhook): GitLabWebhookMetadata; /** * Build the parsed form of a GitLab webhook from its raw body alone, for * deliveries that arrive without HTTP headers. The event name comes from * `object_kind`; the caller supplies a delivery id that is stable across * replays so rules replay handling and session dedupe keys behave as they do * for a direct delivery. Returns null when the body is not a webhook object or * its kind is one Factory does not handle, which callers treat exactly like an * unsupported event header: acknowledged and dropped. */ export declare function parseGitLabWebhookBody(body: unknown, deliveryId: string): ParsedGitLabWebhook | null; /** * Process a parsed delivery: rules ingress first, then session dispatch when a * controller is mounted. Ingestion failures propagate so the caller can retry * the delivery (GitLab redelivers on a non-2xx; the poller leaves its cursor * in place). */ export declare function processGitLabWebhook(parsed: ParsedGitLabWebhook, options: GitLabWebhookProcessOptions): Promise; export declare function handleGitLabWebhook(c: Context, options: GitLabWebhookHandlerOptions): Promise; //# sourceMappingURL=webhook.d.ts.map