@oxidezap/baileyrs 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -8
- package/lib/Bridge/history-sync-wire.d.ts +2 -2
- package/lib/Bridge/history-sync-wire.js +4 -4
- package/lib/Bridge/schema.js +7 -1
- package/lib/Bridge/types.d.ts +7 -1
- package/lib/Compatibility/auth-state.d.ts +30 -0
- package/lib/Compatibility/auth-state.js +96 -0
- package/lib/Compatibility/encode-proto-core.d.ts +31 -0
- package/lib/Compatibility/encode-proto-core.js +51 -0
- package/lib/Compatibility/encode-proto.d.ts +0 -29
- package/lib/Compatibility/encode-proto.js +3 -50
- package/lib/Compatibility/host-auth-state.d.ts +6 -0
- package/lib/Compatibility/host-auth-state.js +162 -0
- package/lib/Compatibility/internal/auth-state.d.ts +3 -7
- package/lib/Compatibility/internal/auth-state.js +34 -1
- package/lib/Compatibility/internal/host-auth-state.d.ts +4 -0
- package/lib/Compatibility/internal/host-auth-state.js +14 -0
- package/lib/Compatibility/legacy-store/device.js +5 -5
- package/lib/Compatibility/message-ids.d.ts +17 -0
- package/lib/Compatibility/message-ids.js +47 -0
- package/lib/Compatibility/message-relay.d.ts +2 -2
- package/lib/Compatibility/message-relay.js +4 -4
- package/lib/Compatibility/proto-runtime.js +33 -11
- package/lib/Compatibility/socket-results.d.ts +1 -1
- package/lib/Compatibility/tagged-message-waiter.d.ts +5 -2
- package/lib/Compatibility/tagged-message-waiter.js +5 -5
- package/lib/Compatibility/usync/adapter.d.ts +1 -1
- package/lib/Compatibility/websocket-client.d.ts +11 -3
- package/lib/Compatibility/websocket-client.js +84 -11
- package/lib/Defaults/index.d.ts +8 -8
- package/lib/Defaults/index.js +8 -8
- package/lib/Media/content.d.ts +28 -0
- package/lib/Media/content.js +129 -0
- package/lib/Media/core.d.ts +34 -0
- package/lib/Media/core.js +120 -0
- package/lib/Media/mutations.d.ts +24 -0
- package/lib/Media/mutations.js +38 -0
- package/lib/Runtime/aes-gcm.d.ts +4 -0
- package/lib/Runtime/aes-gcm.js +11 -0
- package/lib/Runtime/bridge.d.ts +44 -0
- package/lib/Runtime/bridge.js +76 -0
- package/lib/Runtime/buffer.d.ts +9 -0
- package/lib/Runtime/buffer.js +22 -0
- package/lib/Runtime/bytes.d.ts +61 -0
- package/lib/Runtime/bytes.js +270 -0
- package/lib/Runtime/host.d.ts +22 -0
- package/lib/Runtime/host.js +43 -0
- package/lib/Runtime/long.d.ts +33 -0
- package/lib/Runtime/long.js +64 -0
- package/lib/Runtime/node-media-processors.d.ts +4 -0
- package/lib/Runtime/node-media-processors.js +29 -0
- package/lib/Runtime/node-media.d.ts +28 -0
- package/lib/Runtime/node-media.js +115 -0
- package/lib/Runtime/node.d.ts +14 -0
- package/lib/Runtime/node.js +81 -0
- package/lib/Runtime/paths.d.ts +4 -0
- package/lib/Runtime/paths.js +7 -0
- package/lib/Runtime/stream.d.ts +11 -0
- package/lib/Runtime/stream.js +25 -0
- package/lib/Runtime/types.d.ts +98 -0
- package/lib/Runtime/types.js +13 -0
- package/lib/Socket/core.d.ts +312 -0
- package/lib/Socket/core.js +1122 -0
- package/lib/Socket/events-core.d.ts +75 -0
- package/lib/Socket/events-core.js +1058 -0
- package/lib/Socket/events.d.ts +1 -63
- package/lib/Socket/events.js +4 -1047
- package/lib/Socket/groups.js +4 -3
- package/lib/Socket/index.d.ts +521 -103
- package/lib/Socket/index.js +10 -1007
- package/lib/Socket/messages-core.d.ts +41 -0
- package/lib/Socket/messages-core.js +270 -0
- package/lib/Socket/messages.d.ts +9 -36
- package/lib/Socket/messages.js +3 -260
- package/lib/Socket/newsletter.js +3 -3
- package/lib/Socket/profile.js +1 -1
- package/lib/Socket/terminal-close-reporter.d.ts +2 -0
- package/lib/Socket/terminal-close-reporter.js +3 -3
- package/lib/Socket/transport.d.ts +2 -0
- package/lib/Socket/transport.js +16 -1
- package/lib/Socket/types.d.ts +2 -0
- package/lib/Types/Auth.d.ts +11 -0
- package/lib/Types/Message.d.ts +1 -1
- package/lib/Types/Socket.d.ts +2 -2
- package/lib/Types/index.d.ts +6 -1
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.js +53 -2
- package/lib/Utils/crypto.d.ts +1 -0
- package/lib/Utils/crypto.js +1 -0
- package/lib/Utils/event-buffer.d.ts +6 -1
- package/lib/Utils/event-buffer.js +28 -27
- package/lib/Utils/link-preview.d.ts +4 -3
- package/lib/Utils/logger.d.ts +3 -0
- package/lib/Utils/logger.js +35 -6
- package/lib/Utils/messages-core.d.ts +174 -0
- package/lib/Utils/messages-core.js +1042 -0
- package/lib/Utils/messages-media-core.d.ts +73 -0
- package/lib/Utils/messages-media-core.js +319 -0
- package/lib/Utils/messages-media.d.ts +1 -72
- package/lib/Utils/messages-media.js +9 -358
- package/lib/Utils/messages.d.ts +1 -166
- package/lib/Utils/messages.js +7 -1040
- package/lib/Utils/optional-peer.js +14 -5
- package/lib/Utils/process-history-message-core.d.ts +36 -0
- package/lib/Utils/process-history-message-core.js +187 -0
- package/lib/Utils/process-history-message.d.ts +5 -43
- package/lib/Utils/process-history-message.js +11 -197
- package/lib/Utils/process-message-core.d.ts +29 -0
- package/lib/Utils/process-message-core.js +112 -0
- package/lib/Utils/process-message.d.ts +4 -24
- package/lib/Utils/process-message.js +6 -111
- package/lib/WABinary/generic-utils.js +7 -5
- package/lib/host-shared.d.ts +74 -0
- package/lib/host-shared.js +15 -0
- package/lib/host-socket-operations.d.ts +3 -0
- package/lib/host-socket-operations.js +2 -0
- package/lib/host-surface.d.ts +21 -0
- package/lib/host-surface.js +35 -0
- package/lib/host-types.d.ts +356 -0
- package/lib/host-types.js +2 -0
- package/lib/host.d.ts +33 -0
- package/lib/host.js +31 -0
- package/lib/node-surface.d.ts +9 -0
- package/lib/node-surface.js +15 -0
- package/lib/surface.d.ts +5 -0
- package/lib/surface.js +6 -0
- package/lib/wasm.d.ts +27 -0
- package/lib/wasm.js +27 -0
- package/package.json +18 -6
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node runtime capabilities for `createWASocketFactory`.
|
|
3
|
+
*
|
|
4
|
+
* The Node runtime keeps current behavior exactly: bare bridge entrypoint
|
|
5
|
+
* (reads the wasm off disk), WebCrypto-backed randomness (measured at parity
|
|
6
|
+
* with `node:crypto`), `node:events` emitter, `platform()`/`release()`
|
|
7
|
+
* identity, OpenSSL native crypto fast path, and the stdout logger sink with
|
|
8
|
+
* `BAILEYRS_LOG_LEVEL`.
|
|
9
|
+
*/
|
|
10
|
+
import { randomBytes as nodeRandomBytesSource } from 'node:crypto';
|
|
11
|
+
import EventEmitter from 'events';
|
|
12
|
+
import { tmpdir } from 'node:os';
|
|
13
|
+
import { Buffer } from 'node:buffer';
|
|
14
|
+
import { Readable } from 'node:stream';
|
|
15
|
+
import { execFile } from 'node:child_process';
|
|
16
|
+
import { createReadStream, promises as fs } from 'node:fs';
|
|
17
|
+
import * as bridge from '@oxidezap/whatsapp-rust-bridge';
|
|
18
|
+
import Long from './long.js';
|
|
19
|
+
import { DEFAULT_CONNECTION_CONFIG } from '../Defaults/index.js';
|
|
20
|
+
import { makeNativeCryptoProvider } from '../Utils/native-crypto-provider.js';
|
|
21
|
+
import { wrapLegacyStore } from '../Utils/wrap-legacy-store.js';
|
|
22
|
+
import { setReadableRuntime } from './stream.js';
|
|
23
|
+
import { nodeMedia } from './node-media.js';
|
|
24
|
+
import { getAudioDuration, loadImageProcessingLibrary } from './node-media-processors.js';
|
|
25
|
+
import { setBufferRuntime } from './buffer.js';
|
|
26
|
+
setBufferRuntime(Buffer);
|
|
27
|
+
nodeMedia.getImageProcessingLibrary = loadImageProcessingLibrary;
|
|
28
|
+
nodeMedia.getAudioDuration = getAudioDuration;
|
|
29
|
+
nodeMedia.hkdf = bridge.hkdf;
|
|
30
|
+
nodeMedia.aesGcm256Encrypt = bridge.aesGcm256Encrypt;
|
|
31
|
+
nodeMedia.aesGcm256Decrypt = bridge.aesGcm256Decrypt;
|
|
32
|
+
nodeMedia.tempDir = tmpdir;
|
|
33
|
+
nodeMedia.execFile = execFile;
|
|
34
|
+
nodeMedia.createReadStream = createReadStream;
|
|
35
|
+
nodeMedia.fs = fs;
|
|
36
|
+
setReadableRuntime({
|
|
37
|
+
fromWeb: stream => Readable.fromWeb(stream),
|
|
38
|
+
isReadable: value => value instanceof Readable,
|
|
39
|
+
createReadable: () => new Readable({ read: () => { } })
|
|
40
|
+
});
|
|
41
|
+
import { makeLazyTransactionKeyStore } from '../Compatibility/internal/signal-key-store.js';
|
|
42
|
+
import { normalizeSocketAuthenticationState, refreshSocketAuthenticationState, waitForSocketAuthenticationState } from '../Compatibility/internal/auth-state.js';
|
|
43
|
+
export const nodeRandomBytes = (length) => {
|
|
44
|
+
const out = new Uint8Array(length);
|
|
45
|
+
if (length > 0) {
|
|
46
|
+
const native = nodeRandomBytesSource(length);
|
|
47
|
+
out.set(native);
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
};
|
|
51
|
+
export const nodeLoggerSink = (line, delivered) => {
|
|
52
|
+
try {
|
|
53
|
+
process.stdout.write(`${line}\n`, delivered);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
delivered();
|
|
57
|
+
/* logging must not crash the process it observes */
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export const nodeRuntime = {
|
|
61
|
+
bridge,
|
|
62
|
+
randomBytes: nodeRandomBytes,
|
|
63
|
+
setTimeout: (callback, ms) => setTimeout(callback, ms),
|
|
64
|
+
clearTimeout: handle => clearTimeout(handle),
|
|
65
|
+
setImmediate: callback => setImmediate(callback),
|
|
66
|
+
queueMicrotask: callback => queueMicrotask(callback),
|
|
67
|
+
events: {
|
|
68
|
+
createEmitter: () => new EventEmitter()
|
|
69
|
+
},
|
|
70
|
+
nativeCrypto: makeNativeCryptoProvider(),
|
|
71
|
+
defaultLogger: DEFAULT_CONNECTION_CONFIG.logger,
|
|
72
|
+
loggerSink: nodeLoggerSink,
|
|
73
|
+
logLevel: () => process.env.BAILEYRS_LOG_LEVEL,
|
|
74
|
+
Long,
|
|
75
|
+
wrapLegacyStore: wrapLegacyStore,
|
|
76
|
+
makeTransactionKeyStore: makeLazyTransactionKeyStore,
|
|
77
|
+
normalizeAuth: normalizeSocketAuthenticationState,
|
|
78
|
+
waitForAuthState: waitForSocketAuthenticationState,
|
|
79
|
+
refreshAuthState: refreshSocketAuthenticationState
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Small path capabilities used only by optional Node media processing. */
|
|
2
|
+
export const runtimeTempDir = () => '/tmp';
|
|
3
|
+
export const runtimeJoinPath = (...parts) => parts
|
|
4
|
+
.join('/')
|
|
5
|
+
.replace(/\/+/gu, '/')
|
|
6
|
+
.replace(/(^|[^/])\/\.\//gu, '$1/');
|
|
7
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Runtime-selected conversion for the root Node stream contract. */
|
|
2
|
+
export type WebStreamLike = unknown;
|
|
3
|
+
export declare const setReadableRuntime: (runtime: {
|
|
4
|
+
fromWeb: (stream: WebStreamLike) => unknown;
|
|
5
|
+
isReadable: (value: unknown) => boolean;
|
|
6
|
+
createReadable: () => unknown;
|
|
7
|
+
}) => void;
|
|
8
|
+
export declare const isReadable: (value: unknown) => boolean;
|
|
9
|
+
export declare const createReadable: () => unknown;
|
|
10
|
+
export declare const readableFromWeb: (stream: WebStreamLike) => unknown;
|
|
11
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
let fromWeb = stream => stream;
|
|
2
|
+
let readableCheck = () => false;
|
|
3
|
+
let createReadableImpl = () => ({});
|
|
4
|
+
export const setReadableRuntime = (runtime) => {
|
|
5
|
+
fromWeb = runtime.fromWeb;
|
|
6
|
+
readableCheck = runtime.isReadable;
|
|
7
|
+
createReadableImpl = runtime.createReadable;
|
|
8
|
+
};
|
|
9
|
+
export const isReadable = (value) => readableCheck(value);
|
|
10
|
+
export const createReadable = () => createReadableImpl();
|
|
11
|
+
// Deep Node imports of `Utils/messages-media` do not pass through the package
|
|
12
|
+
// root. Discover the builtin without a static Node import so this module stays
|
|
13
|
+
// in the host graph, while preserving the historical Node stream contract.
|
|
14
|
+
const builtinLoader = globalThis.process?.getBuiltinModule;
|
|
15
|
+
const nodeStream = builtinLoader?.('node:stream');
|
|
16
|
+
const NodeReadable = nodeStream?.Readable;
|
|
17
|
+
if (NodeReadable) {
|
|
18
|
+
setReadableRuntime({
|
|
19
|
+
fromWeb: stream => NodeReadable.fromWeb(stream),
|
|
20
|
+
isReadable: value => value instanceof NodeReadable,
|
|
21
|
+
createReadable: () => new NodeReadable({ read: () => { } })
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export const readableFromWeb = (stream) => fromWeb(stream);
|
|
25
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime capability interface for `makeWASocket`.
|
|
3
|
+
*
|
|
4
|
+
* A `BaileysRuntime` bundles every host operation the socket core needs that
|
|
5
|
+
* differs between runtimes: bridge entrypoint, randomness, timers, event
|
|
6
|
+
* emitter construction, platform identity, native crypto, media processing
|
|
7
|
+
* and logging. `Socket/core.ts` consumes only this interface, so the same
|
|
8
|
+
* factory builds the Node socket and the host-neutral socket from different
|
|
9
|
+
* capabilities. There is intentionally no global mutable runtime: callers
|
|
10
|
+
* pick `nodeRuntime` or `hostRuntime` (or a custom one) per socket.
|
|
11
|
+
*/
|
|
12
|
+
import type { AuthenticationState, NativeAuthenticationState } from '../Types/Auth.js';
|
|
13
|
+
import type { aesGcm256Decrypt as BridgeAesGcm256Decrypt, aesGcm256Encrypt as BridgeAesGcm256Encrypt, BinaryReader as BridgeBinaryReader, JsHttpClientConfig, JsTransportCallbacks, WasmWhatsAppClient, WhatsAppEventCallbacks, CacheConfig, ClientPolicies, JsStoreCallbacks, hkdf as bridgeHkdf, sha256 as bridgeSha256 } from '@oxidezap/whatsapp-rust-bridge/host';
|
|
14
|
+
import type Long from 'long';
|
|
15
|
+
import type { ILogger } from '../Utils/logger.js';
|
|
16
|
+
/** Subset of the bridge surface the socket core touches. */
|
|
17
|
+
export interface BridgeRuntime {
|
|
18
|
+
createWhatsAppClient(transport: JsTransportCallbacks, httpClient: JsHttpClientConfig, onEvent?: WhatsAppEventCallbacks | null, store?: JsStoreCallbacks | null, cache?: CacheConfig | null, version?: readonly [number, number, number] | null, wantedPreKeyCount?: number | null, dangerSkipCertChainVerify?: boolean | null, policies?: ClientPolicies | null): Promise<WasmWhatsAppClient>;
|
|
19
|
+
initWasmEngine(logger?: unknown, crypto?: unknown): void;
|
|
20
|
+
hkdf: typeof bridgeHkdf;
|
|
21
|
+
sha256: typeof bridgeSha256;
|
|
22
|
+
aesGcm256Encrypt: typeof BridgeAesGcm256Encrypt;
|
|
23
|
+
aesGcm256Decrypt: typeof BridgeAesGcm256Decrypt;
|
|
24
|
+
encodeProto(path: string, message: unknown): Uint8Array;
|
|
25
|
+
decodeProto(path: string, data: Uint8Array): unknown;
|
|
26
|
+
inflateZlib(data: Uint8Array, maxOutputBytes?: number | null): Uint8Array;
|
|
27
|
+
BinaryReader: typeof BridgeBinaryReader;
|
|
28
|
+
decodeMessageWireBatch(data: Uint8Array): unknown;
|
|
29
|
+
decodeReceiptWireBatch(data: Uint8Array): unknown;
|
|
30
|
+
decodeServerAckWireBatch(data: Uint8Array): unknown;
|
|
31
|
+
decryptPollVotePayload(encPayload: Uint8Array, encIv: Uint8Array, messageSecret: Uint8Array, stanzaId: string, pollCreatorJid: string, voterJid: string): Uint8Array;
|
|
32
|
+
decryptEventResponsePayload(encPayload: Uint8Array, encIv: Uint8Array, messageSecret: Uint8Array, stanzaId: string, eventCreatorJid: string, responderJid: string): Uint8Array;
|
|
33
|
+
}
|
|
34
|
+
/** Minimal emitter surface the socket core needs. */
|
|
35
|
+
export interface RuntimeEventEmitter {
|
|
36
|
+
on(event: string | symbol, listener: (...args: never[]) => void): unknown;
|
|
37
|
+
off(event: string | symbol, listener: (...args: never[]) => void): unknown;
|
|
38
|
+
once(event: string | symbol, listener: (...args: never[]) => void): unknown;
|
|
39
|
+
prependListener(event: string | symbol, listener: (...args: never[]) => void): unknown;
|
|
40
|
+
prependOnceListener(event: string | symbol, listener: (...args: never[]) => void): unknown;
|
|
41
|
+
removeListener(event: string | symbol, listener: (...args: never[]) => void): unknown;
|
|
42
|
+
removeAllListeners(event?: string | symbol): unknown;
|
|
43
|
+
eventNames(): (string | symbol)[];
|
|
44
|
+
rawListeners(event: string | symbol): Array<(...args: never[]) => void>;
|
|
45
|
+
listeners(event: string | symbol): Array<(...args: never[]) => void>;
|
|
46
|
+
listenerCount(event: string | symbol, listener?: (...args: never[]) => void): number;
|
|
47
|
+
setMaxListeners(count: number): unknown;
|
|
48
|
+
getMaxListeners(): number;
|
|
49
|
+
emit(event: string | symbol, ...args: never[]): boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface EmitterFactory {
|
|
52
|
+
createEmitter(): RuntimeEventEmitter;
|
|
53
|
+
}
|
|
54
|
+
/** Platform identity for `Browsers.appropriate()` and device props. */
|
|
55
|
+
export interface PlatformInfo {
|
|
56
|
+
os: string;
|
|
57
|
+
release: string;
|
|
58
|
+
}
|
|
59
|
+
export type MediaCryptoRuntime = Pick<BridgeRuntime, 'hkdf' | 'sha256' | 'aesGcm256Encrypt' | 'aesGcm256Decrypt'> & Pick<BaileysRuntime, 'randomBytes'>;
|
|
60
|
+
export interface BaileysRuntime {
|
|
61
|
+
/** Bridge entrypoint: Node imports the bare root, hosts import `/host`. */
|
|
62
|
+
bridge: BridgeRuntime;
|
|
63
|
+
/** Cryptographically strong random bytes (WebCrypto-backed everywhere). */
|
|
64
|
+
randomBytes(length: number): Uint8Array;
|
|
65
|
+
/** Timer handle with optional `unref` (Node) / plain (hosts). */
|
|
66
|
+
setTimeout(callback: () => void, ms: number): {
|
|
67
|
+
unref?: () => void;
|
|
68
|
+
ref?: () => void;
|
|
69
|
+
};
|
|
70
|
+
clearTimeout(handle: unknown): void;
|
|
71
|
+
setImmediate?(callback: () => void): unknown;
|
|
72
|
+
queueMicrotask(callback: () => void): void;
|
|
73
|
+
/** Portable event emitter constructor (the `events` package). */
|
|
74
|
+
events: EmitterFactory;
|
|
75
|
+
/** Platform identity; absent on hosts (stable fallback is used). */
|
|
76
|
+
platformInfo?(): PlatformInfo;
|
|
77
|
+
/** Native AES/HMAC fast path; absent on hosts (Rust/WASM fallback). */
|
|
78
|
+
nativeCrypto?: unknown;
|
|
79
|
+
/** Runtime-specific default logger. Node preserves the pino-backed connection logger; hosts omit it. */
|
|
80
|
+
defaultLogger?: ILogger;
|
|
81
|
+
/** Where core log lines go: Node writes stdout, hosts console. */
|
|
82
|
+
loggerSink(line: string, delivered?: () => void): void;
|
|
83
|
+
/** Log level: Node reads `BAILEYRS_LOG_LEVEL`, hosts use config/default. */
|
|
84
|
+
logLevel(): string | undefined;
|
|
85
|
+
/** Normalize auth while preserving the root Node projection or host native store. */
|
|
86
|
+
normalizeAuth?: (input: AuthenticationState | NativeAuthenticationState) => AuthenticationState;
|
|
87
|
+
/** Await asynchronous credential hydration required by a runtime's native store adapter. */
|
|
88
|
+
waitForAuthState?: (state: AuthenticationState) => Promise<void>;
|
|
89
|
+
/** Refresh the public credential mirror after the native engine persists pairing state. */
|
|
90
|
+
refreshAuthState?: (state: AuthenticationState) => Promise<void>;
|
|
91
|
+
/** Node-only legacy auth adapter; absent on host runtimes. */
|
|
92
|
+
wrapLegacyStore?: (state: unknown, onCredsUpdate: () => Promise<void>, logger: unknown) => Promise<JsStoreCallbacks>;
|
|
93
|
+
/** Node-only Baileys transaction facade; native host stores do not need it. */
|
|
94
|
+
makeTransactionKeyStore?: (state: unknown, logger: unknown, options: unknown) => () => unknown;
|
|
95
|
+
/** 64-bit integer constructor identity for this runtime's module graph. */
|
|
96
|
+
Long: typeof Long;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime capability interface for `makeWASocket`.
|
|
3
|
+
*
|
|
4
|
+
* A `BaileysRuntime` bundles every host operation the socket core needs that
|
|
5
|
+
* differs between runtimes: bridge entrypoint, randomness, timers, event
|
|
6
|
+
* emitter construction, platform identity, native crypto, media processing
|
|
7
|
+
* and logging. `Socket/core.ts` consumes only this interface, so the same
|
|
8
|
+
* factory builds the Node socket and the host-neutral socket from different
|
|
9
|
+
* capabilities. There is intentionally no global mutable runtime: callers
|
|
10
|
+
* pick `nodeRuntime` or `hostRuntime` (or a custom one) per socket.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import type { WasmWhatsAppClient, UploadMediaResult } from '@oxidezap/whatsapp-rust-bridge/host';
|
|
2
|
+
import type { BaileysRuntime } from '../Runtime/types.js';
|
|
3
|
+
import { WebSocketClient } from '../Compatibility/websocket-client.js';
|
|
4
|
+
import { type MediaType } from '../Defaults/index.js';
|
|
5
|
+
import type { BinaryNode, AuthenticationCreds, ConnectionState, Contact, ReachoutTimelockState, SignalKeyStoreWithTransaction, HostSocketConfig, UserFacingSocketConfig, WABusinessProfile, WAMessage, WAMessageKey, WAPresence } from '../Types/index.js';
|
|
6
|
+
import type Long from 'long';
|
|
7
|
+
import { type MediaDownloadType } from '../Utils/messages-core.js';
|
|
8
|
+
import type { MediaDownloadOptions } from '../Utils/messages-media-core.js';
|
|
9
|
+
import type { proto } from '../WAProto/runtime.js';
|
|
10
|
+
import { createRuntimeLogger } from '../Utils/logger.js';
|
|
11
|
+
/** Build the ws EventEmitter with auto-enable raw node forwarding */
|
|
12
|
+
export declare const createWASocketFactory: (runtime: BaileysRuntime) => (config: UserFacingSocketConfig | HostSocketConfig) => ReturnType<typeof createWASocketFactoryInner>;
|
|
13
|
+
declare const createWASocketFactoryInner: (runtime: BaileysRuntime, config: UserFacingSocketConfig | HostSocketConfig, claimEngineInitialization: () => boolean, resetEngineInitialization: () => void, runtimeLogger: ReturnType<typeof createRuntimeLogger>) => {
|
|
14
|
+
sendMessageAck: (node: BinaryNode, errorCode?: number) => Promise<void>;
|
|
15
|
+
sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
16
|
+
updateBlockStatus: (jid: string, action: import("./blocking.js").BlockAction) => Promise<void>;
|
|
17
|
+
fetchBlocklist: () => Promise<Array<string | undefined>>;
|
|
18
|
+
getCatalog: ({ jid, limit, cursor }: import("../index.js").GetCatalogOptions) => Promise<import("../index.js").CatalogPage>;
|
|
19
|
+
getCollections: (jid?: string, limit?: number) => Promise<import("../index.js").CollectionsPage>;
|
|
20
|
+
getOrderDetails: (orderId: string, tokenBase64: string, sellerJid?: string) => Promise<import("@oxidezap/whatsapp-rust-bridge").OrderResult>;
|
|
21
|
+
updateBussinesProfile: (args: import("../Types/Bussines.js").UpdateBussinesProfileProps) => Promise<void>;
|
|
22
|
+
updateCoverPhoto: (photo: import("../index.js").WAMediaUpload) => Promise<never>;
|
|
23
|
+
removeCoverPhoto: (id: string) => Promise<void>;
|
|
24
|
+
productCreate: (create: import("../index.js").ProductCreate) => Promise<never>;
|
|
25
|
+
productUpdate: (productId: string, update: import("../index.js").ProductUpdate) => Promise<never>;
|
|
26
|
+
productDelete: (productIds: string[]) => Promise<never>;
|
|
27
|
+
pinChat: (jid: string, pin: boolean) => Promise<void>;
|
|
28
|
+
muteChat: (jid: string, muteUntil?: number | null) => Promise<void>;
|
|
29
|
+
archiveChat: (jid: string, archive: boolean) => Promise<void>;
|
|
30
|
+
starMessage: (jid: string, messageId: string, star: boolean) => Promise<void>;
|
|
31
|
+
chatModify: (mod: import("../index.js").ChatModification, jid: string) => Promise<void>;
|
|
32
|
+
addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
|
|
33
|
+
removeContact: (jid: string) => Promise<void>;
|
|
34
|
+
addLabel: (jid: string, labels: import("../Types/Label.js").LabelActionBody) => Promise<void>;
|
|
35
|
+
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
36
|
+
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
37
|
+
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
38
|
+
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
39
|
+
star: (jid: string, messages: {
|
|
40
|
+
id: string;
|
|
41
|
+
fromMe?: boolean;
|
|
42
|
+
}[], star: boolean) => Promise<void>;
|
|
43
|
+
addOrEditQuickReply: (quickReply: import("../Types/Bussines.js").QuickReplyAction) => Promise<void>;
|
|
44
|
+
removeQuickReply: (timestamp: string) => Promise<void>;
|
|
45
|
+
onWhatsApp: (...phoneNumber: string[]) => Promise<import("./contacts.js").OnWhatsAppResult[] | undefined>;
|
|
46
|
+
profilePictureUrl: (jid: string, type?: import("./contacts.js").ProfilePictureType, timeoutMs?: number) => Promise<string | undefined>;
|
|
47
|
+
fetchUserInfo: (...jids: string[]) => Promise<Record<string, import("@oxidezap/whatsapp-rust-bridge").UserInfoResult>>;
|
|
48
|
+
groupMetadata: (jid: string) => Promise<import("../index.js").GroupMetadata>;
|
|
49
|
+
groupCreate: (subject: string, participants: string[]) => Promise<import("../index.js").GroupMetadata>;
|
|
50
|
+
groupLeave: (id: string) => Promise<void>;
|
|
51
|
+
groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
|
52
|
+
groupRequestParticipantsList: (jid: string) => Promise<Array<Record<string, string>>>;
|
|
53
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: import("./groups.js").GroupRequestAction) => Promise<import("../Compatibility/socket-results.js").MembershipRequestUpdateResult[]>;
|
|
54
|
+
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../index.js").ParticipantAction) => Promise<import("../Compatibility/socket-results.js").ParticipantUpdateResult[]>;
|
|
55
|
+
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
56
|
+
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
57
|
+
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
58
|
+
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
59
|
+
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
|
|
60
|
+
groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<any>;
|
|
61
|
+
groupGetInviteInfo: (code: string) => Promise<import("../index.js").GroupMetadata>;
|
|
62
|
+
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
63
|
+
groupSettingUpdate: (jid: string, setting: import("./groups.js").GroupSetting) => Promise<void>;
|
|
64
|
+
groupMemberAddMode: (jid: string, mode: import("./groups.js").MemberAddMode) => Promise<void>;
|
|
65
|
+
groupJoinApprovalMode: (jid: string, mode: import("./groups.js").JoinApprovalMode) => Promise<void>;
|
|
66
|
+
groupFetchAllParticipating: () => Promise<Record<string, import("../index.js").GroupMetadata>>;
|
|
67
|
+
updateMemberLabel: (jid: string, memberLabel: string) => Promise<string>;
|
|
68
|
+
communityMetadata: (jid: string) => Promise<import("../index.js").GroupMetadata>;
|
|
69
|
+
communityCreate: (subject: string, body: string) => Promise<import("../index.js").GroupMetadata | null>;
|
|
70
|
+
communityCreateGroup: (subject: string, participants: string[], parentCommunityJid: string) => Promise<import("../index.js").GroupMetadata | null>;
|
|
71
|
+
communityLeave: (id: string) => Promise<void>;
|
|
72
|
+
communityUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
|
73
|
+
communityLinkGroup: (groupJid: string, parentCommunityJid: string) => Promise<void>;
|
|
74
|
+
communityUnlinkGroup: (groupJid: string, parentCommunityJid: string) => Promise<void>;
|
|
75
|
+
communityFetchLinkedGroups: (jid: string) => Promise<{
|
|
76
|
+
communityJid: string;
|
|
77
|
+
isCommunity: boolean;
|
|
78
|
+
linkedGroups: {
|
|
79
|
+
id: string | undefined;
|
|
80
|
+
subject: string;
|
|
81
|
+
creation: number | undefined;
|
|
82
|
+
owner: string | undefined;
|
|
83
|
+
size: number | undefined;
|
|
84
|
+
}[];
|
|
85
|
+
}>;
|
|
86
|
+
communityRequestParticipantsList: (jid: string) => Promise<Array<Record<string, string>>>;
|
|
87
|
+
communityRequestParticipantsUpdate: (jid: string, participants: string[], action: import("./groups.js").GroupRequestAction) => Promise<import("../Compatibility/socket-results.js").MembershipRequestUpdateResult[]>;
|
|
88
|
+
communityParticipantsUpdate: (jid: string, participants: string[], action: import("../index.js").ParticipantAction) => Promise<import("../Compatibility/socket-results.js").ParticipantUpdateResult[]>;
|
|
89
|
+
communityUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
90
|
+
communityInviteCode: (jid: string) => Promise<string | undefined>;
|
|
91
|
+
communityRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
92
|
+
communityAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
93
|
+
communityRevokeInviteV4: (communityJid: string, invitedJid: string) => Promise<boolean>;
|
|
94
|
+
communityAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<any>;
|
|
95
|
+
communityGetInviteInfo: (code: string) => Promise<import("../index.js").GroupMetadata>;
|
|
96
|
+
communityToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
97
|
+
communitySettingUpdate: (jid: string, setting: import("./groups.js").GroupSetting) => Promise<void>;
|
|
98
|
+
communityMemberAddMode: (jid: string, mode: import("./groups.js").MemberAddMode) => Promise<void>;
|
|
99
|
+
communityJoinApprovalMode: (jid: string, mode: import("./groups.js").JoinApprovalMode) => Promise<void>;
|
|
100
|
+
communityFetchAllParticipating: () => Promise<Record<string, import("../index.js").GroupMetadata>>;
|
|
101
|
+
waitForSocketOpen: () => Promise<void>;
|
|
102
|
+
upsertMessage: (msg: WAMessage, type: import("../index.js").MessageUpsertType) => Promise<void>;
|
|
103
|
+
onUnexpectedError: (err: Error, msg: string) => void;
|
|
104
|
+
resyncAppState: (collections?: readonly ('critical_block' | 'critical_unblock_low' | 'regular_high' | 'regular_low' | 'regular')[], isInitialSync?: boolean) => Promise<void>;
|
|
105
|
+
updateServerTimeOffset: (node: BinaryNode) => never;
|
|
106
|
+
sendUnifiedSession: () => Promise<never>;
|
|
107
|
+
appPatch: (patchCreate: import("../index.js").WAPatchCreate) => Promise<never>;
|
|
108
|
+
messageRetryManager: null;
|
|
109
|
+
sendMessage: (jid: string, content: import("../index.js").AnyMessageContent, options?: Omit<import("../index.js").MessageGenerationOptions, 'waClient' | 'logger' | 'userJid' | 'mediaInNote'>) => Promise<WAMessage>;
|
|
110
|
+
updateMediaMessage: (message: WAMessage) => Promise<WAMessage>;
|
|
111
|
+
relayMessage: (jid: string, message: proto.IMessage, options: import("../index.js").MessageRelayOptions) => Promise<string>;
|
|
112
|
+
readMessages: (keys: WAMessageKey[]) => Promise<void>;
|
|
113
|
+
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../index.js").MessageReceiptType) => Promise<void>;
|
|
114
|
+
sendReceipts: (keys: WAMessageKey[], type: import("../index.js").MessageReceiptType) => Promise<void>;
|
|
115
|
+
requestPlaceholderResend: (messageKey: WAMessageKey, msgData?: Partial<WAMessage>) => Promise<string | undefined>;
|
|
116
|
+
newsletterCreate: (name: string, description?: string) => Promise<import("../index.js").NewsletterMetadata>;
|
|
117
|
+
newsletterMetadata: (type: import("./newsletter.js").NewsletterKeyType, key: string) => Promise<import("../index.js").NewsletterMetadata | null>;
|
|
118
|
+
newsletterUpdate: (jid: string, updates: import("../index.js").NewsletterUpdate) => Promise<import("../index.js").NewsletterMetadata>;
|
|
119
|
+
newsletterUpdateName: (jid: string, name: string) => Promise<import("../index.js").NewsletterMetadata>;
|
|
120
|
+
newsletterUpdateDescription: (jid: string, description: string) => Promise<import("../index.js").NewsletterMetadata>;
|
|
121
|
+
newsletterUpdatePicture: (jid: string, content: import("../index.js").WAMediaUpload) => Promise<import("../index.js").NewsletterMetadata>;
|
|
122
|
+
newsletterRemovePicture: (jid: string) => Promise<import("../index.js").NewsletterMetadata>;
|
|
123
|
+
newsletterFollow: (jid: string) => Promise<import("../index.js").NewsletterMetadata>;
|
|
124
|
+
newsletterUnfollow: (jid: string) => Promise<void>;
|
|
125
|
+
newsletterSubscribe: (jid: string) => Promise<import("@oxidezap/whatsapp-rust-bridge").NewsletterMetadataResult>;
|
|
126
|
+
newsletterUnsubscribe: (jid: string) => Promise<void>;
|
|
127
|
+
newsletterMute: (jid: string) => Promise<void>;
|
|
128
|
+
newsletterUnmute: (jid: string) => Promise<void>;
|
|
129
|
+
newsletterSubscribers: (jid: string) => Promise<{
|
|
130
|
+
subscribers: number;
|
|
131
|
+
}>;
|
|
132
|
+
newsletterReactMessage: (jid: string, serverId: string, reaction?: string) => Promise<void>;
|
|
133
|
+
newsletterFetchMessages: (jid: string, count: number, since?: number, after?: number) => Promise<import("@oxidezap/whatsapp-rust-bridge").NewsletterMessageResult[]>;
|
|
134
|
+
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
135
|
+
duration: string;
|
|
136
|
+
}>;
|
|
137
|
+
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
138
|
+
newsletterChangeOwner: (jid: string, newOwnerJid: string) => Promise<void>;
|
|
139
|
+
newsletterDemote: (jid: string, userJid: string) => Promise<void>;
|
|
140
|
+
newsletterDelete: (jid: string) => Promise<void>;
|
|
141
|
+
uploadPreKeys: (count?: number) => Promise<void>;
|
|
142
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
143
|
+
digestKeyBundle: () => Promise<void>;
|
|
144
|
+
rotateSignedPreKey: () => Promise<void>;
|
|
145
|
+
sendPresence: (status: import("../index.js").WAPresenceStatus) => Promise<void>;
|
|
146
|
+
presenceSubscribe: (toJid: string) => Promise<void>;
|
|
147
|
+
sendChatState: (jid: string, state: import("../index.js").WAChatState) => Promise<void>;
|
|
148
|
+
fetchPrivacySettings: (force?: boolean) => Promise<any>;
|
|
149
|
+
updatePrivacySetting: (category: string, value: string) => Promise<void>;
|
|
150
|
+
updateLastSeenPrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
|
|
151
|
+
updateOnlinePrivacy: (value: import("../index.js").WAPrivacyOnlineValue) => Promise<void>;
|
|
152
|
+
updateProfilePicturePrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
|
|
153
|
+
updateStatusPrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
|
|
154
|
+
updateReadReceiptsPrivacy: (value: import("../index.js").WAReadReceiptsValue) => Promise<void>;
|
|
155
|
+
updateGroupsAddPrivacy: (value: import("../index.js").WAPrivacyGroupAddValue) => Promise<void>;
|
|
156
|
+
updateCallPrivacy: (value: import("../index.js").WAPrivacyCallValue) => Promise<void>;
|
|
157
|
+
updateMessagesPrivacy: (value: import("../index.js").WAPrivacyMessagesValue) => Promise<void>;
|
|
158
|
+
issuePrivacyTokens: (jids: string[], timestamp?: number) => Promise<void>;
|
|
159
|
+
refreshMediaConn: (forceGet?: boolean) => Promise<Omit<import("../index.js").MediaConnInfo, 'hosts'> & {
|
|
160
|
+
hosts: {
|
|
161
|
+
hostname: string;
|
|
162
|
+
}[];
|
|
163
|
+
}>;
|
|
164
|
+
getMediaHost: () => string;
|
|
165
|
+
getBotListV2: () => Promise<import("../index.js").BotListInfo[]>;
|
|
166
|
+
fetchNewChatMessageCap: () => Promise<import("../index.js").NewChatMessageCapInfo & {
|
|
167
|
+
remaining_quota?: number;
|
|
168
|
+
}>;
|
|
169
|
+
cleanDirtyBits: (type: import("./server-queries.js").DirtyBitType, fromTimestamp?: number | string) => Promise<void>;
|
|
170
|
+
sendPeerDataOperationMessage: (_pdoMessage: unknown) => Promise<never>;
|
|
171
|
+
createCallLink: (_type: 'audio' | 'video', _event?: unknown, _timeoutMs?: number) => Promise<never>;
|
|
172
|
+
requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
|
|
173
|
+
setPushName: (name: string) => Promise<void>;
|
|
174
|
+
updateProfileName: (name: string) => Promise<void>;
|
|
175
|
+
getPushName: () => Promise<string>;
|
|
176
|
+
getJid: () => Promise<string | undefined>;
|
|
177
|
+
getLid: () => Promise<string | undefined>;
|
|
178
|
+
updateProfilePicture: (jid: string, content: import("../index.js").WAMediaUpload, dimensions?: {
|
|
179
|
+
width: number;
|
|
180
|
+
height: number;
|
|
181
|
+
}) => Promise<void>;
|
|
182
|
+
removeProfilePicture: (jid: string) => Promise<void>;
|
|
183
|
+
updateProfileStatus: (status: string) => Promise<void>;
|
|
184
|
+
executeUSyncQuery: (usyncQuery: import("../index.js").USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
|
|
185
|
+
fetchStatus: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
|
|
186
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
|
|
187
|
+
ev: import("../index.js").BaileysEventEmitter & {
|
|
188
|
+
process(handler: (events: Partial<import("../index.js").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
189
|
+
buffer(): void;
|
|
190
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
|
|
191
|
+
flush(): boolean;
|
|
192
|
+
isBuffering(): boolean;
|
|
193
|
+
destroy(): void;
|
|
194
|
+
};
|
|
195
|
+
logger: import("../Utils/logger.js").ILogger | import("../Utils/logger.js").Logger;
|
|
196
|
+
ws: WebSocketClient;
|
|
197
|
+
type: 'md';
|
|
198
|
+
/**
|
|
199
|
+
* `await using sock = makeWASocket(config)` — frees the wasm client on
|
|
200
|
+
* scope exit. Nothing else can: the bridge holds the JS event callbacks
|
|
201
|
+
* as wasm-bindgen externrefs and those callbacks reach back to this
|
|
202
|
+
* closure, so the reference cycle crosses the JS/wasm boundary and no
|
|
203
|
+
* `FinalizationRegistry` will ever fire for the client.
|
|
204
|
+
*
|
|
205
|
+
* Delegates to `end()`, so it flushes the auth store and is idempotent.
|
|
206
|
+
*
|
|
207
|
+
* Then awaits `initPromise`, because `end()` alone does not satisfy the
|
|
208
|
+
* async-disposal contract: called before `createWhatsAppClient()`
|
|
209
|
+
* settles, it sees `client === undefined`, frees nothing, and resolves
|
|
210
|
+
* while initialization is still running. What actually disposes that
|
|
211
|
+
* client is the `ended` guard inside `init()` — so code after the
|
|
212
|
+
* `await using` scope would otherwise overlap with bridge construction,
|
|
213
|
+
* event callbacks, and store access. `end()` runs first because it sets
|
|
214
|
+
* `ended` synchronously, which is what makes `init()` bail out early.
|
|
215
|
+
*
|
|
216
|
+
* The `finally` is load-bearing: `end()` rethrows the first auth-store
|
|
217
|
+
* flush failure, and letting that propagate directly would skip the wait
|
|
218
|
+
* and resolve the disposer with `init()` still in flight — losing the
|
|
219
|
+
* one guarantee it exists to provide, in exactly the situation where
|
|
220
|
+
* cleanup already went wrong. `initPromise` swallows its own failures,
|
|
221
|
+
* so awaiting it here cannot mask the flush error.
|
|
222
|
+
*/
|
|
223
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
224
|
+
user: Contact | undefined;
|
|
225
|
+
waClient: WasmWhatsAppClient | undefined;
|
|
226
|
+
isConnected: boolean;
|
|
227
|
+
isLoggedIn: boolean;
|
|
228
|
+
authState: {
|
|
229
|
+
creds: AuthenticationCreds;
|
|
230
|
+
keys: SignalKeyStoreWithTransaction;
|
|
231
|
+
};
|
|
232
|
+
devicesMutex: {
|
|
233
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
234
|
+
};
|
|
235
|
+
messageMutex: {
|
|
236
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
237
|
+
};
|
|
238
|
+
receiptMutex: {
|
|
239
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
240
|
+
};
|
|
241
|
+
appStatePatchMutex: {
|
|
242
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
243
|
+
};
|
|
244
|
+
notificationMutex: {
|
|
245
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
246
|
+
};
|
|
247
|
+
generateMessageTag: () => string;
|
|
248
|
+
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
249
|
+
assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
|
|
250
|
+
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<any>;
|
|
251
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
|
|
252
|
+
query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
|
|
253
|
+
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* `dsmMessage` is accepted so the signature matches upstream, and
|
|
256
|
+
* refused rather than ignored. Upstream uses it to encrypt a different
|
|
257
|
+
* plaintext for the caller's own other devices; the engine encrypts one
|
|
258
|
+
* payload for every recipient, so honouring it is not possible here and
|
|
259
|
+
* dropping it would send those devices the wrong message.
|
|
260
|
+
*/
|
|
261
|
+
createParticipantNodes: (jids: string[], message: proto.IMessage, extraAttrs?: BinaryNode['attrs'], dsmMessage?: proto.IMessage) => Promise<{
|
|
262
|
+
nodes: BinaryNode[];
|
|
263
|
+
shouldIncludeDeviceIdentity: boolean;
|
|
264
|
+
}>;
|
|
265
|
+
signalRepository: import("../index.js").SignalRepositoryWithLIDStore;
|
|
266
|
+
end: (error: Error | undefined) => Promise<void>;
|
|
267
|
+
logout: (msg?: string) => Promise<void>;
|
|
268
|
+
registerSocketEndHandler: (handler: (error: Error | undefined) => void | Promise<void>) => void;
|
|
269
|
+
waitForConnectionUpdate: (check: (u: Partial<ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
270
|
+
setAutoReconnect: (enabled: boolean) => void;
|
|
271
|
+
/**
|
|
272
|
+
* Update presence either globally (`available`/`unavailable`) or per-chat
|
|
273
|
+
* (`composing`/`recording`/`paused`), matching upstream Baileys' overload.
|
|
274
|
+
* Chat-state updates require `toJid`; omitting it raises `Boom(400)` so the
|
|
275
|
+
* caller hears about the protocol mistake instead of the bridge silently
|
|
276
|
+
* sending nothing.
|
|
277
|
+
*/
|
|
278
|
+
sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* Plaintext media upload helper, source-compatible with the upstream
|
|
281
|
+
* Baileys `sock.waUploadToServer(buf, { mediaType })` shape so existing
|
|
282
|
+
* callers (or `prepareWAMessageMedia(msg, { upload: sock.waUploadToServer })`)
|
|
283
|
+
* keep working. Delegates to the bridge's encrypt + CDN-failover upload.
|
|
284
|
+
*/
|
|
285
|
+
waUploadToServer: (data: Uint8Array | Buffer, opts: {
|
|
286
|
+
mediaType: MediaType;
|
|
287
|
+
}) => Promise<UploadMediaResult>;
|
|
288
|
+
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
289
|
+
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
290
|
+
/**
|
|
291
|
+
* Fetch the account's current reachout-timelock state from the server.
|
|
292
|
+
*
|
|
293
|
+
* The same state is also pushed proactively via the
|
|
294
|
+
* `NotificationUserReachoutTimelockUpdate` MEX notification, which is
|
|
295
|
+
* surfaced on `connection.update.reachoutTimeLock` automatically. Use
|
|
296
|
+
* this method to query on demand (e.g. on app start, or after a 463
|
|
297
|
+
* nack hints that the timelock just kicked in).
|
|
298
|
+
*
|
|
299
|
+
* Emits the result on `connection.update.reachoutTimeLock` as a side
|
|
300
|
+
* effect for parity with the push path. Returns the same state for
|
|
301
|
+
* callers that prefer awaiting.
|
|
302
|
+
*/
|
|
303
|
+
fetchReachoutTimelock: () => Promise<ReachoutTimelockState>;
|
|
304
|
+
/** Upstream Baileys-compatible name. */
|
|
305
|
+
fetchAccountReachoutTimelock: () => Promise<ReachoutTimelockState>;
|
|
306
|
+
getBusinessProfile: (jid: string) => Promise<WABusinessProfile | void>;
|
|
307
|
+
fetchMessageHistory: (count: number, oldestMsgKey: WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
|
|
308
|
+
sendStatusMessage: (message: Record<string, unknown>, recipients: string[]) => Promise<string>;
|
|
309
|
+
downloadMedia: <T extends MediaDownloadType>(message: WAMessage, type: T, options?: MediaDownloadOptions) => Promise<T extends "buffer" ? Buffer<ArrayBufferLike> : import("node:stream").Readable>;
|
|
310
|
+
};
|
|
311
|
+
export {};
|
|
312
|
+
//# sourceMappingURL=core.d.ts.map
|