/** * Schema-driven bridge → canonical adapter table. * * The single source of truth for "every bridge event variant we accept and * how it maps to a CanonicalEvent". Each entry receives the bridge's typed * data slot (`Extract['data']`) and returns * either a CanonicalEvent or `null` (drop on unrecoverable shape). * * Type safety properties: * 1. The table is `satisfies AdapterMap` where `AdapterMap` is keyed by * every `WhatsAppEvent['type']`. Adding a new variant to the bridge * `.d.ts` and forgetting an entry here is a compile error. * 2. Each entry's `data` parameter is the bridge's narrow type — fields * come back as the right TS type without manual `unknown` checks. * 3. Each entry's return type is `CanonicalEvent | null`. Returning the * wrong canonical shape is a compile error. * * Where the bridge `.d.ts` references a sub-type that isn't separately * exported (PinAction, MuteAction, ArchiveChatAction, etc. — the action * field of every sync-action event), TS resolves the type to `any`. We * apply narrowing parsers from `./primitives` (`isObject`, `asBoolOr`, * `asNumber`, `asString`) at those leak points only — not boilerplate * everywhere. */ import type { WhatsAppEvent } from 'whatsapp-rust-bridge'; import type { ILogger } from '../Utils/logger.js'; import type { CanonicalEvent } from './types.js'; export type BridgeEventType = WhatsAppEvent['type']; /** Set of bridge event types we explicitly handle — derived from the table. */ export declare const KNOWN_BRIDGE_EVENT_TYPES: ReadonlySet; /** * Public entry point — looks up the adapter by event type and runs it. * Mirrors the previous `adaptBridgeEvent` API exactly. */ export declare const adaptBridgeEventViaSchema: (event: WhatsAppEvent, logger?: ILogger) => CanonicalEvent | null; //# sourceMappingURL=schema.d.ts.map