interface ApiMessage { payload: unknown; } export interface ApiRequestMessage extends ApiMessage { domain: string; method: string; } export interface ApiResponseMessage extends ApiMessage { stats: unknown; } export interface ApiNotificationMessage extends ApiMessage { recipient: { topic: string }; domain?: string; } export interface NotifyApi { domain: "_phnq-api"; handlers: { notify: (msg: ApiNotificationMessage) => Promise; subscribe: (subscription: { connectionId: string; topic: string; options?: { filter?(payload: unknown): boolean }; }) => Promise; unsubscribe: (subscription: { connectionId: string; topic: string }) => Promise; destroyTopic: (info: { topic: string }) => Promise; }; }