import type { URL } from 'url'; import type { CacheConfig, DevicePropsInput } from 'whatsapp-rust-bridge'; import type { proto } from 'whatsapp-rust-bridge/proto-types'; export type { DeviceAppVersion, DeviceHistorySyncConfig, DevicePlatformType, DevicePropsInput } from 'whatsapp-rust-bridge'; import type { ILogger } from '../Utils/logger.js'; import type { AuthenticationState } from './Auth.js'; import type { GroupMetadata } from './GroupMetadata.js'; import type { WAMessageContent, WAMessageKey } from './Message.js'; export type WAVersion = [number, number, number]; export type WABrowserDescription = [string, string, string]; export type CacheStore = { /** get a cached key and change the stats */ get(key: string): Promise | T | undefined; /** set a key in the cache */ set(key: string, value: T): Promise | void | number | boolean; /** delete a key from the cache */ del(key: string): void | Promise | number | boolean; /** flush all data */ flushAll(): void | Promise; }; export type PatchedMessageWithRecipientJID = proto.IMessage & { recipientJid?: string; }; export type SocketConfig = { /** the WS url to connect to WA */ waWebSocketUrl: string | URL; /** Fails the connection if the socket times out in this interval */ connectTimeoutMs: number; /** Default timeout for queries, undefined for no timeout */ defaultQueryTimeoutMs: number | undefined; /** ping-pong interval for WS connection */ keepAliveIntervalMs: number; /** logger */ logger: ILogger; /** version to connect with */ version: WAVersion; /** override browser config */ browser: WABrowserDescription; /** should events be emitted for actions done by this socket connection */ emitOwnEvents: boolean; /** provide an auth state object to maintain the auth state */ auth: AuthenticationState; /** * Returns if a jid should be ignored, * no event for that jid will be triggered. * Messages from that jid will also not be decrypted * */ shouldIgnoreJid: (jid: string) => boolean | undefined; /** options for HTTP fetch requests */ options: RequestInit; /** * Cache configuration — tune TTL, capacity, or provide custom store backends. * Omitted fields keep defaults. See CacheConfig type for details. */ cache?: CacheConfig; /** * Override the `DeviceProps` advertised in the pairing registration node * (display name in "Linked Devices" + server-side feature gating, e.g. * view-once payload vs `absent` stub for non-Android companions). * * Orthogonal to `browser` — that controls the connection identity, this * controls the post-pairing display identity. When omitted, defaults are * derived from `browser`. Setting `platformType: 'ANDROID_PHONE'` does * NOT switch the underlying transport — baileyrs still speaks the web * protocol; real Android companion mode (CRSC/TEE) is not implemented. */ deviceProps?: DevicePropsInput; /** * Number of one-time pre-keys generated and uploaded per batch. Defaults to * WhatsApp Web's 812; clamped to the protocol-safe range at upload time. * Lower it to cut memory/CPU of the first pre-key upload (the whole batch is * generated and encoded in one shot). Must be set before connecting. */ wantedPreKeyCount?: number; /** @deprecated QR timeout is handled by the bridge connection state machine. */ qrTimeout?: number; /** @deprecated Message retries are managed by the bridge. */ maxMsgRetryCount?: number; /** @deprecated Retry backoff is handled by the bridge. */ retryRequestDelayMs?: number; /** @deprecated Link previews are not generated automatically; build via your own helper if needed. */ generateHighQualityLinkPreview?: boolean; /** @deprecated See `generateHighQualityLinkPreview`. */ linkPreviewImageThumbnailWidth?: number; /** @deprecated Session recreation is automatic via the bridge's signal layer. */ enableAutoSessionRecreation?: boolean; /** @deprecated The bridge keeps its own recent-message cache. */ enableRecentMessageCache?: boolean; /** @deprecated Use `sendPresenceUpdate('available')` after `connection: 'open'` instead. */ markOnlineOnConnect?: boolean; /** @deprecated Auth/key storage is owned by the bridge; transactions are an internal concern. */ transactionOpts?: { maxCommitRetries: number; delayBetweenTriesMs: number; }; /** @deprecated History sync is driven by the bridge; see `messaging-history.set` events. */ syncFullHistory?: boolean; /** @deprecated Init queries are issued by the bridge on connect. */ fireInitQueries?: boolean; /** @deprecated History download policy lives in the bridge. */ downloadHistory?: boolean; /** @deprecated See `syncFullHistory`. */ shouldSyncHistoryMessage?: (msg: proto.Message.IHistorySyncNotification) => boolean; /** @deprecated QR rendering is the caller's responsibility — listen on `connection.update` for the QR string. */ printQRInTerminal?: boolean; /** @deprecated Offline-message handling is built into the bridge event stream. */ ignoreOfflineMessages?: boolean; /** @deprecated Retry counters are kept inside the bridge. */ msgRetryCounterCache?: CacheStore; /** @deprecated The bridge maintains its own group-metadata cache (see `cache.group`). */ cachedGroupMetadata?: (jid: string) => Promise; /** @deprecated Decryption retries are handled by the bridge using its message store. */ getMessage?: (key: WAMessageKey) => Promise; }; //# sourceMappingURL=Socket.d.ts.map