/// import { AxiosRequestConfig } from 'axios'; import { Logger } from 'pino'; import { proto } from '../../WAProto'; import { BaileysEventEmitter, BaileysEventMap, WACallUpdateType, WAVersion } from '../Types'; import { BinaryNode } from '../WABinary'; export declare const Browsers: { ubuntu: (browser: any) => [string, string, string]; macOS: (browser: any) => [string, string, string]; baileys: (browser: any) => [string, string, string]; /** The appropriate browser based on your OS & release */ appropriate: (browser: any) => [string, string, string]; }; export declare const BufferJSON: { replacer: (k: any, value: any) => any; reviver: (_: any, value: any) => any; }; export declare const writeRandomPadMax16: (msg: Uint8Array) => Buffer; export declare const unpadRandomMax16: (e: Uint8Array | Buffer) => Uint8Array; export declare const encodeWAMessage: (message: proto.IMessage) => Buffer; export declare const generateRegistrationId: () => number; export declare const encodeBigEndian: (e: number, t?: number) => Uint8Array; export declare const toNumber: (t: Long | number | null | undefined) => number; /** unix timestamp of a date in seconds */ export declare const unixTimestampSeconds: (date?: Date) => number; export declare type DebouncedTimeout = ReturnType; export declare const debouncedTimeout: (intervalMs?: number, task?: (() => void) | undefined) => { start: (newIntervalMs?: number | undefined, newTask?: (() => void) | undefined) => void; cancel: () => void; setTask: (newTask: () => void) => () => void; setInterval: (newInterval: number) => number; }; export declare const delay: (ms: number) => Promise; export declare const delayCancellable: (ms: number) => { delay: Promise; cancel: () => void; }; export declare function promiseTimeout(ms: number | undefined, promise: (resolve: (v?: T) => void, reject: (error: any) => void) => void): Promise; export declare const generateMessageID: () => string; export declare function bindWaitForEvent(ev: BaileysEventEmitter, event: T): (check: (u: BaileysEventMap[T]) => boolean | undefined, timeoutMs?: number | undefined) => Promise; export declare const bindWaitForConnectionUpdate: (ev: BaileysEventEmitter) => (check: (u: Partial) => boolean | undefined, timeoutMs?: number | undefined) => Promise; export declare const printQRIfNecessaryListener: (ev: BaileysEventEmitter, logger: Logger) => void; /** * utility that fetches latest baileys version from the master branch. * Use to ensure your WA connection is always on the latest version */ export declare const fetchLatestBaileysVersion: (options?: AxiosRequestConfig) => Promise<{ version: WAVersion; isLatest: boolean; error?: undefined; } | { version: WAVersion; isLatest: boolean; error: any; }>; /** * A utility that fetches the latest web version of whatsapp. * Use to ensure your WA connection is always on the latest version */ export declare const fetchLatestWaWebVersion: (options: AxiosRequestConfig) => Promise<{ version: WAVersion; isLatest: boolean; error?: undefined; } | { version: WAVersion; isLatest: boolean; error: any; }>; /** unique message tag prefix for MD clients */ export declare const generateMdTagPrefix: () => string; /** * Given a type of receipt, returns what the new status of the message should be * @param type type from receipt */ export declare const getStatusFromReceiptType: (type: string | undefined) => proto.WebMessageInfo.Status; /** * Stream errors generally provide a reason, map that to a baileys DisconnectReason * @param reason the string reason given, eg. "conflict" */ export declare const getErrorCodeFromStreamError: (node: BinaryNode) => { reason: string; statusCode: number; }; export declare const getCallStatusFromNode: ({ tag, attrs }: BinaryNode) => WACallUpdateType; export declare const getCodeFromWSError: (error: Error) => number; /** * Is the given platform WA business * @param platform AuthenticationCreds.platform */ export declare const isWABusinessPlatform: (platform: string) => boolean; export declare function trimUndefineds(obj: any): any;