feat(reliability): WhatsApp Web version caching (#1847)

* feat: use specific whatsapp web version

* add constants to version updater

* configurable caches

* rename

* typings

* rm extraneous export

* missing from the rename

* rm version resolver

* match readme version

* use try-catch

* only persist if cache miss
This commit is contained in:
Pedro S. Lopez 2023-05-29 02:31:03 -04:00 • committed by GitHub
commit 8ae0c0d484
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 197 additions and 9 deletions

22
index.d.ts vendored
View file

@ -365,6 +365,10 @@ declare namespace WAWebJS {
puppeteer?: puppeteer.PuppeteerNodeLaunchOptions & puppeteer.ConnectOptions
/** Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used. */
authStrategy?: AuthStrategy,
/** The version of WhatsApp Web to use. Use options.webVersionCache to configure how the version is retrieved. */
webVersion?: string,
/** Determines how to retrieve the WhatsApp Web version specified in options.webVersion. */
webVersionCache?: WebCacheOptions,
/** How many times should the qrcode be refreshed before giving up
* @default 0 (disabled) */
qrMaxRetries?: number,
@ -392,6 +396,24 @@ declare namespace WAWebJS {
proxyAuthentication?: {username: string, password: string} | undefined
}
export interface LocalWebCacheOptions {
type: 'local',
path?: string,
strict?: boolean
}
export interface RemoteWebCacheOptions {
type: 'remote',
remotePath: string,
strict?: boolean
}
export interface NoWebCacheOptions {
type: 'none'
}
export type WebCacheOptions = NoWebCacheOptions | LocalWebCacheOptions | RemoteWebCacheOptions;
/**
* Base class which all authentication strategies extend
*/