supunmd-bail 2.0.1
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/LICENSE +21 -0
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +5519 -0
- package/WAProto/fix-imports.js +29 -0
- package/WAProto/index.d.ts +11969 -0
- package/WAProto/index.js +84368 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +62 -0
- package/lib/Defaults/index.js +115 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/group-session-builder.d.ts +15 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/keyhelper.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/queue-job.d.ts +2 -0
- package/lib/Signal/Group/queue-job.js +54 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-name.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-record.d.ts +31 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-state.d.ts +39 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.js +26 -0
- package/lib/Signal/libsignal.d.ts +5 -0
- package/lib/Signal/libsignal.js +342 -0
- package/lib/Signal/lid-mapping.d.ts +23 -0
- package/lib/Signal/lid-mapping.js +171 -0
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.js +3 -0
- package/lib/Socket/Client/types.d.ts +16 -0
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/websocket.d.ts +13 -0
- package/lib/Socket/Client/websocket.js +50 -0
- package/lib/Socket/business.d.ts +188 -0
- package/lib/Socket/business.js +376 -0
- package/lib/Socket/chats.d.ts +98 -0
- package/lib/Socket/chats.js +962 -0
- package/lib/Socket/communities.d.ts +244 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/groups.d.ts +137 -0
- package/lib/Socket/groups.js +327 -0
- package/lib/Socket/index.d.ts +231 -0
- package/lib/Socket/index.js +18 -0
- package/lib/Socket/messages-recv.d.ts +173 -0
- package/lib/Socket/messages-recv.js +1228 -0
- package/lib/Socket/messages-send.d.ts +169 -0
- package/lib/Socket/messages-send.js +1070 -0
- package/lib/Socket/mex.d.ts +3 -0
- package/lib/Socket/mex.js +42 -0
- package/lib/Socket/newsletter.d.ts +147 -0
- package/lib/Socket/newsletter.js +181 -0
- package/lib/Socket/socket.d.ts +51 -0
- package/lib/Socket/socket.js +883 -0
- package/lib/Socket/usync.d.ts +37 -0
- package/lib/Socket/usync.js +63 -0
- package/lib/Types/Auth.d.ts +111 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Call.d.ts +14 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.d.ts +123 -0
- package/lib/Types/Chat.js +8 -0
- package/lib/Types/Contact.d.ts +24 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.d.ts +202 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.d.ts +67 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.d.ts +47 -0
- package/lib/Types/Label.js +25 -0
- package/lib/Types/LabelAssociation.d.ts +30 -0
- package/lib/Types/LabelAssociation.js +7 -0
- package/lib/Types/Message.d.ts +303 -0
- package/lib/Types/Message.js +11 -0
- package/lib/Types/Newsletter.d.ts +135 -0
- package/lib/Types/Newsletter.js +31 -0
- package/lib/Types/Product.d.ts +79 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.d.ts +76 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.d.ts +133 -0
- package/lib/Types/Socket.js +3 -0
- package/lib/Types/State.d.ts +39 -0
- package/lib/Types/State.js +13 -0
- package/lib/Types/USync.d.ts +26 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +65 -0
- package/lib/Types/index.js +26 -0
- package/lib/Utils/auth-utils.d.ts +19 -0
- package/lib/Utils/auth-utils.js +257 -0
- package/lib/Utils/baileys-event-stream.d.ts +17 -0
- package/lib/Utils/baileys-event-stream.js +56 -0
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/business.d.ts +23 -0
- package/lib/Utils/business.js +231 -0
- package/lib/Utils/chat-utils.d.ts +70 -0
- package/lib/Utils/chat-utils.js +763 -0
- package/lib/Utils/crypto.d.ts +41 -0
- package/lib/Utils/crypto.js +142 -0
- package/lib/Utils/decode-wa-message.d.ts +48 -0
- package/lib/Utils/decode-wa-message.js +279 -0
- package/lib/Utils/event-buffer.d.ts +34 -0
- package/lib/Utils/event-buffer.js +548 -0
- package/lib/Utils/generics.d.ts +90 -0
- package/lib/Utils/generics.js +381 -0
- package/lib/Utils/history.d.ts +19 -0
- package/lib/Utils/history.js +84 -0
- package/lib/Utils/index.d.ts +20 -0
- package/lib/Utils/index.js +20 -0
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/link-preview.js +85 -0
- package/lib/Utils/logger.d.ts +12 -0
- package/lib/Utils/logger.js +3 -0
- package/lib/Utils/lt-hash.d.ts +13 -0
- package/lib/Utils/lt-hash.js +48 -0
- package/lib/Utils/make-mutex.d.ts +8 -0
- package/lib/Utils/make-mutex.js +40 -0
- package/lib/Utils/message-retry-manager.d.ts +82 -0
- package/lib/Utils/message-retry-manager.js +149 -0
- package/lib/Utils/messages-media.d.ts +114 -0
- package/lib/Utils/messages-media.js +663 -0
- package/lib/Utils/messages.d.ts +76 -0
- package/lib/Utils/messages.js +908 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.js +147 -0
- package/lib/Utils/pre-key-manager.d.ts +28 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/process-message.d.ts +42 -0
- package/lib/Utils/process-message.js +413 -0
- package/lib/Utils/signal.d.ts +34 -0
- package/lib/Utils/signal.js +159 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
- package/lib/Utils/use-multi-file-auth-state.js +121 -0
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/lib/Utils/validate-connection.js +195 -0
- package/lib/WABinary/constants.d.ts +28 -0
- package/lib/WABinary/constants.js +1301 -0
- package/lib/WABinary/decode.d.ts +7 -0
- package/lib/WABinary/decode.js +238 -0
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.js +216 -0
- package/lib/WABinary/generic-utils.d.ts +15 -0
- package/lib/WABinary/generic-utils.js +191 -0
- package/lib/WABinary/index.d.ts +6 -0
- package/lib/WABinary/index.js +6 -0
- package/lib/WABinary/jid-utils.d.ts +48 -0
- package/lib/WABinary/jid-utils.js +96 -0
- package/lib/WABinary/types.d.ts +19 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.d.ts +9 -0
- package/lib/WAM/BinaryInfo.js +10 -0
- package/lib/WAM/constants.d.ts +40 -0
- package/lib/WAM/constants.js +22853 -0
- package/lib/WAM/encode.d.ts +3 -0
- package/lib/WAM/encode.js +150 -0
- package/lib/WAM/index.d.ts +4 -0
- package/lib/WAM/index.js +4 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +29 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/index.d.ts +5 -0
- package/lib/WAUSync/Protocols/index.js +5 -0
- package/lib/WAUSync/USyncQuery.d.ts +29 -0
- package/lib/WAUSync/USyncQuery.js +94 -0
- package/lib/WAUSync/USyncUser.d.ts +13 -0
- package/lib/WAUSync/USyncUser.js +23 -0
- package/lib/WAUSync/index.d.ts +4 -0
- package/lib/WAUSync/index.js +4 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.js +36 -0
- package/lib/supun +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Boom } from '@hapi/boom';
|
|
2
|
+
import type { SocketConfig } from '../Types/index.js';
|
|
3
|
+
import { type BinaryNode } from '../WABinary/index.js';
|
|
4
|
+
import { USyncQuery } from '../WAUSync/index.js';
|
|
5
|
+
export declare const makeUSyncSocket: (config: SocketConfig) => {
|
|
6
|
+
executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
|
|
7
|
+
type: "md";
|
|
8
|
+
ws: import("./Client/index.js").WebSocketClient;
|
|
9
|
+
ev: import("../index.js").BaileysEventEmitter & {
|
|
10
|
+
process(handler: (events: Partial<import("../index.js").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
11
|
+
buffer(): void;
|
|
12
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
|
|
13
|
+
flush(): boolean;
|
|
14
|
+
isBuffering(): boolean;
|
|
15
|
+
};
|
|
16
|
+
authState: {
|
|
17
|
+
creds: import("../index.js").AuthenticationCreds;
|
|
18
|
+
keys: import("../index.js").SignalKeyStoreWithTransaction;
|
|
19
|
+
};
|
|
20
|
+
signalRepository: import("../index.js").SignalRepository;
|
|
21
|
+
user: import("../index.js").Contact | undefined;
|
|
22
|
+
generateMessageTag: () => string;
|
|
23
|
+
query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
|
|
24
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
|
|
25
|
+
waitForSocketOpen: () => Promise<void>;
|
|
26
|
+
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
27
|
+
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
28
|
+
logout: (msg?: string) => Promise<void>;
|
|
29
|
+
end: (error: Error | undefined) => void;
|
|
30
|
+
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
|
31
|
+
uploadPreKeys: (count?: number) => Promise<void>;
|
|
32
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
33
|
+
requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
|
|
34
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
35
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=usync.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Boom } from '@hapi/boom';
|
|
2
|
+
import { S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
3
|
+
import { USyncQuery } from '../WAUSync/index.js';
|
|
4
|
+
import { makeSocket } from './socket.js';
|
|
5
|
+
export const makeUSyncSocket = (config) => {
|
|
6
|
+
const sock = makeSocket(config);
|
|
7
|
+
const { generateMessageTag, query } = sock;
|
|
8
|
+
const executeUSyncQuery = async (usyncQuery) => {
|
|
9
|
+
if (usyncQuery.protocols.length === 0) {
|
|
10
|
+
throw new Boom('USyncQuery must have at least one protocol');
|
|
11
|
+
}
|
|
12
|
+
// todo: validate users, throw WARNING on no valid users
|
|
13
|
+
// variable below has only validated users
|
|
14
|
+
const validUsers = usyncQuery.users;
|
|
15
|
+
const userNodes = validUsers.map(user => {
|
|
16
|
+
return {
|
|
17
|
+
tag: 'user',
|
|
18
|
+
attrs: {
|
|
19
|
+
jid: !user.phone ? user.id : undefined
|
|
20
|
+
},
|
|
21
|
+
content: usyncQuery.protocols.map(a => a.getUserElement(user)).filter(a => a !== null)
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
const listNode = {
|
|
25
|
+
tag: 'list',
|
|
26
|
+
attrs: {},
|
|
27
|
+
content: userNodes
|
|
28
|
+
};
|
|
29
|
+
const queryNode = {
|
|
30
|
+
tag: 'query',
|
|
31
|
+
attrs: {},
|
|
32
|
+
content: usyncQuery.protocols.map(a => a.getQueryElement())
|
|
33
|
+
};
|
|
34
|
+
const iq = {
|
|
35
|
+
tag: 'iq',
|
|
36
|
+
attrs: {
|
|
37
|
+
to: S_WHATSAPP_NET,
|
|
38
|
+
type: 'get',
|
|
39
|
+
xmlns: 'usync'
|
|
40
|
+
},
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
tag: 'usync',
|
|
44
|
+
attrs: {
|
|
45
|
+
context: usyncQuery.context,
|
|
46
|
+
mode: usyncQuery.mode,
|
|
47
|
+
sid: generateMessageTag(),
|
|
48
|
+
last: 'true',
|
|
49
|
+
index: '0'
|
|
50
|
+
},
|
|
51
|
+
content: [queryNode, listNode]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
const result = await query(iq);
|
|
56
|
+
return usyncQuery.parseUSyncQueryResult(result);
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
...sock,
|
|
60
|
+
executeUSyncQuery
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=usync.js.map
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { proto } from '../../WAProto/index.js';
|
|
2
|
+
import type { Contact } from './Contact.js';
|
|
3
|
+
import type { MinimalMessage } from './Message.js';
|
|
4
|
+
export type KeyPair = {
|
|
5
|
+
public: Uint8Array;
|
|
6
|
+
private: Uint8Array;
|
|
7
|
+
};
|
|
8
|
+
export type SignedKeyPair = {
|
|
9
|
+
keyPair: KeyPair;
|
|
10
|
+
signature: Uint8Array;
|
|
11
|
+
keyId: number;
|
|
12
|
+
timestampS?: number;
|
|
13
|
+
};
|
|
14
|
+
export type ProtocolAddress = {
|
|
15
|
+
name: string;
|
|
16
|
+
deviceId: number;
|
|
17
|
+
};
|
|
18
|
+
export type SignalIdentity = {
|
|
19
|
+
identifier: ProtocolAddress;
|
|
20
|
+
identifierKey: Uint8Array;
|
|
21
|
+
};
|
|
22
|
+
export type LIDMapping = {
|
|
23
|
+
pn: string;
|
|
24
|
+
lid: string;
|
|
25
|
+
};
|
|
26
|
+
export type LTHashState = {
|
|
27
|
+
version: number;
|
|
28
|
+
hash: Buffer;
|
|
29
|
+
indexValueMap: {
|
|
30
|
+
[indexMacBase64: string]: {
|
|
31
|
+
valueMac: Uint8Array | Buffer;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type SignalCreds = {
|
|
36
|
+
readonly signedIdentityKey: KeyPair;
|
|
37
|
+
readonly signedPreKey: SignedKeyPair;
|
|
38
|
+
readonly registrationId: number;
|
|
39
|
+
};
|
|
40
|
+
export type AccountSettings = {
|
|
41
|
+
/** unarchive chats when a new message is received */
|
|
42
|
+
unarchiveChats: boolean;
|
|
43
|
+
/** the default mode to start new conversations with */
|
|
44
|
+
defaultDisappearingMode?: Pick<proto.IConversation, 'ephemeralExpiration' | 'ephemeralSettingTimestamp'>;
|
|
45
|
+
};
|
|
46
|
+
export type AuthenticationCreds = SignalCreds & {
|
|
47
|
+
readonly noiseKey: KeyPair;
|
|
48
|
+
readonly pairingEphemeralKeyPair: KeyPair;
|
|
49
|
+
advSecretKey: string;
|
|
50
|
+
me?: Contact;
|
|
51
|
+
account?: proto.IADVSignedDeviceIdentity;
|
|
52
|
+
signalIdentities?: SignalIdentity[];
|
|
53
|
+
myAppStateKeyId?: string;
|
|
54
|
+
firstUnuploadedPreKeyId: number;
|
|
55
|
+
nextPreKeyId: number;
|
|
56
|
+
lastAccountSyncTimestamp?: number;
|
|
57
|
+
platform?: string;
|
|
58
|
+
processedHistoryMessages: MinimalMessage[];
|
|
59
|
+
/** number of times history & app state has been synced */
|
|
60
|
+
accountSyncCounter: number;
|
|
61
|
+
accountSettings: AccountSettings;
|
|
62
|
+
registered: boolean;
|
|
63
|
+
pairingCode: string | undefined;
|
|
64
|
+
lastPropHash: string | undefined;
|
|
65
|
+
routingInfo: Buffer | undefined;
|
|
66
|
+
additionalData?: any | undefined;
|
|
67
|
+
};
|
|
68
|
+
export type SignalDataTypeMap = {
|
|
69
|
+
'pre-key': KeyPair;
|
|
70
|
+
session: Uint8Array;
|
|
71
|
+
'sender-key': Uint8Array;
|
|
72
|
+
'sender-key-memory': {
|
|
73
|
+
[jid: string]: boolean;
|
|
74
|
+
};
|
|
75
|
+
'app-state-sync-key': proto.Message.IAppStateSyncKeyData;
|
|
76
|
+
'app-state-sync-version': LTHashState;
|
|
77
|
+
'lid-mapping': string;
|
|
78
|
+
'device-list': string[];
|
|
79
|
+
};
|
|
80
|
+
export type SignalDataSet = {
|
|
81
|
+
[T in keyof SignalDataTypeMap]?: {
|
|
82
|
+
[id: string]: SignalDataTypeMap[T] | null;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
type Awaitable<T> = T | Promise<T>;
|
|
86
|
+
export type SignalKeyStore = {
|
|
87
|
+
get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<{
|
|
88
|
+
[id: string]: SignalDataTypeMap[T];
|
|
89
|
+
}>;
|
|
90
|
+
set(data: SignalDataSet): Awaitable<void>;
|
|
91
|
+
/** clear all the data in the store */
|
|
92
|
+
clear?(): Awaitable<void>;
|
|
93
|
+
};
|
|
94
|
+
export type SignalKeyStoreWithTransaction = SignalKeyStore & {
|
|
95
|
+
isInTransaction: () => boolean;
|
|
96
|
+
transaction<T>(exec: () => Promise<T>, key: string): Promise<T>;
|
|
97
|
+
};
|
|
98
|
+
export type TransactionCapabilityOptions = {
|
|
99
|
+
maxCommitRetries: number;
|
|
100
|
+
delayBetweenTriesMs: number;
|
|
101
|
+
};
|
|
102
|
+
export type SignalAuthState = {
|
|
103
|
+
creds: SignalCreds;
|
|
104
|
+
keys: SignalKeyStore | SignalKeyStoreWithTransaction;
|
|
105
|
+
};
|
|
106
|
+
export type AuthenticationState = {
|
|
107
|
+
creds: AuthenticationCreds;
|
|
108
|
+
keys: SignalKeyStore;
|
|
109
|
+
};
|
|
110
|
+
export {};
|
|
111
|
+
//# sourceMappingURL=Auth.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { proto } from '../../WAProto';
|
|
2
|
+
export type DayOfWeekBussines = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
|
|
3
|
+
export type HoursDay = {
|
|
4
|
+
day: DayOfWeekBussines;
|
|
5
|
+
mode: 'specific_hours';
|
|
6
|
+
openTimeInMinutes: string;
|
|
7
|
+
closeTimeInMinutes: string;
|
|
8
|
+
} | {
|
|
9
|
+
day: DayOfWeekBussines;
|
|
10
|
+
mode: 'open_24h' | 'appointment_only';
|
|
11
|
+
};
|
|
12
|
+
export type UpdateBussinesProfileProps = {
|
|
13
|
+
address?: string;
|
|
14
|
+
websites?: string[];
|
|
15
|
+
email?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
hours?: {
|
|
18
|
+
timezone: string;
|
|
19
|
+
days: HoursDay[];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type QuickReplyAction = proto.SyncActionValue.IQuickReplyAction & {
|
|
23
|
+
timestamp?: string;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=Bussines.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept' | 'terminate';
|
|
2
|
+
export type WACallEvent = {
|
|
3
|
+
chatId: string;
|
|
4
|
+
from: string;
|
|
5
|
+
isGroup?: boolean;
|
|
6
|
+
groupJid?: string;
|
|
7
|
+
id: string;
|
|
8
|
+
date: Date;
|
|
9
|
+
isVideo?: boolean;
|
|
10
|
+
status: WACallUpdateType;
|
|
11
|
+
offline: boolean;
|
|
12
|
+
latencyMs?: number;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=Call.d.ts.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { proto } from '../../WAProto/index.js';
|
|
2
|
+
import type { AccountSettings } from './Auth.js';
|
|
3
|
+
import type { QuickReplyAction } from './Bussines.js';
|
|
4
|
+
import type { BufferedEventData } from './Events.js';
|
|
5
|
+
import type { LabelActionBody } from './Label.js';
|
|
6
|
+
import type { ChatLabelAssociationActionBody } from './LabelAssociation.js';
|
|
7
|
+
import type { MessageLabelAssociationActionBody } from './LabelAssociation.js';
|
|
8
|
+
import type { MinimalMessage, WAMessageKey } from './Message.js';
|
|
9
|
+
/** privacy settings in WhatsApp Web */
|
|
10
|
+
export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none';
|
|
11
|
+
export type WAPrivacyOnlineValue = 'all' | 'match_last_seen';
|
|
12
|
+
export type WAPrivacyGroupAddValue = 'all' | 'contacts' | 'contact_blacklist';
|
|
13
|
+
export type WAReadReceiptsValue = 'all' | 'none';
|
|
14
|
+
export type WAPrivacyCallValue = 'all' | 'known';
|
|
15
|
+
export type WAPrivacyMessagesValue = 'all' | 'contacts';
|
|
16
|
+
/** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
|
|
17
|
+
export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
|
|
18
|
+
export declare const ALL_WA_PATCH_NAMES: readonly ["critical_block", "critical_unblock_low", "regular_high", "regular_low", "regular"];
|
|
19
|
+
export type WAPatchName = (typeof ALL_WA_PATCH_NAMES)[number];
|
|
20
|
+
export interface PresenceData {
|
|
21
|
+
lastKnownPresence: WAPresence;
|
|
22
|
+
lastSeen?: number;
|
|
23
|
+
}
|
|
24
|
+
export type BotListInfo = {
|
|
25
|
+
jid: string;
|
|
26
|
+
personaId: string;
|
|
27
|
+
};
|
|
28
|
+
export type ChatMutation = {
|
|
29
|
+
syncAction: proto.ISyncActionData;
|
|
30
|
+
index: string[];
|
|
31
|
+
};
|
|
32
|
+
export type WAPatchCreate = {
|
|
33
|
+
syncAction: proto.ISyncActionValue;
|
|
34
|
+
index: string[];
|
|
35
|
+
type: WAPatchName;
|
|
36
|
+
apiVersion: number;
|
|
37
|
+
operation: proto.SyncdMutation.SyncdOperation;
|
|
38
|
+
};
|
|
39
|
+
export type Chat = proto.IConversation & {
|
|
40
|
+
/** unix timestamp of when the last message was received in the chat */
|
|
41
|
+
lastMessageRecvTimestamp?: number;
|
|
42
|
+
};
|
|
43
|
+
export type ChatUpdate = Partial<Chat & {
|
|
44
|
+
/**
|
|
45
|
+
* if specified in the update,
|
|
46
|
+
* the EV buffer will check if the condition gets fulfilled before applying the update
|
|
47
|
+
* Right now, used to determine when to release an app state sync event
|
|
48
|
+
*
|
|
49
|
+
* @returns true, if the update should be applied;
|
|
50
|
+
* false if it can be discarded;
|
|
51
|
+
* undefined if the condition is not yet fulfilled
|
|
52
|
+
* */
|
|
53
|
+
conditional: (bufferedData: BufferedEventData) => boolean | undefined;
|
|
54
|
+
/** last update time */
|
|
55
|
+
timestamp?: number;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat
|
|
59
|
+
* for MD modifications, the last message in the array (i.e. the earlist message) must be the last message recv in the chat
|
|
60
|
+
* */
|
|
61
|
+
export type LastMessageList = MinimalMessage[] | proto.SyncActionValue.ISyncActionMessageRange;
|
|
62
|
+
export type ChatModification = {
|
|
63
|
+
archive: boolean;
|
|
64
|
+
lastMessages: LastMessageList;
|
|
65
|
+
} | {
|
|
66
|
+
pushNameSetting: string;
|
|
67
|
+
} | {
|
|
68
|
+
pin: boolean;
|
|
69
|
+
} | {
|
|
70
|
+
/** mute for duration, or provide timestamp of mute to remove*/
|
|
71
|
+
mute: number | null;
|
|
72
|
+
} | {
|
|
73
|
+
clear: boolean;
|
|
74
|
+
lastMessages: LastMessageList;
|
|
75
|
+
} | {
|
|
76
|
+
deleteForMe: {
|
|
77
|
+
deleteMedia: boolean;
|
|
78
|
+
key: WAMessageKey;
|
|
79
|
+
timestamp: number;
|
|
80
|
+
};
|
|
81
|
+
} | {
|
|
82
|
+
star: {
|
|
83
|
+
messages: {
|
|
84
|
+
id: string;
|
|
85
|
+
fromMe?: boolean;
|
|
86
|
+
}[];
|
|
87
|
+
star: boolean;
|
|
88
|
+
};
|
|
89
|
+
} | {
|
|
90
|
+
markRead: boolean;
|
|
91
|
+
lastMessages: LastMessageList;
|
|
92
|
+
} | {
|
|
93
|
+
delete: true;
|
|
94
|
+
lastMessages: LastMessageList;
|
|
95
|
+
} | {
|
|
96
|
+
contact: proto.SyncActionValue.IContactAction | null;
|
|
97
|
+
} | {
|
|
98
|
+
disableLinkPreviews: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction;
|
|
99
|
+
} | {
|
|
100
|
+
addLabel: LabelActionBody;
|
|
101
|
+
} | {
|
|
102
|
+
addChatLabel: ChatLabelAssociationActionBody;
|
|
103
|
+
} | {
|
|
104
|
+
removeChatLabel: ChatLabelAssociationActionBody;
|
|
105
|
+
} | {
|
|
106
|
+
addMessageLabel: MessageLabelAssociationActionBody;
|
|
107
|
+
} | {
|
|
108
|
+
removeMessageLabel: MessageLabelAssociationActionBody;
|
|
109
|
+
} | {
|
|
110
|
+
quickReply: QuickReplyAction;
|
|
111
|
+
};
|
|
112
|
+
export type InitialReceivedChatsState = {
|
|
113
|
+
[jid: string]: {
|
|
114
|
+
/** the last message received from the other party */
|
|
115
|
+
lastMsgRecvTimestamp?: number;
|
|
116
|
+
/** the absolute last message in the chat */
|
|
117
|
+
lastMsgTimestamp: number;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
export type InitialAppStateSyncOptions = {
|
|
121
|
+
accountSettings: AccountSettings;
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=Chat.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface Contact {
|
|
2
|
+
/** ID either in lid or jid format (preferred) **/
|
|
3
|
+
id: string;
|
|
4
|
+
/** ID in LID format (@lid) **/
|
|
5
|
+
lid?: string;
|
|
6
|
+
/** ID in PN format (@s.whatsapp.net) **/
|
|
7
|
+
phoneNumber?: string;
|
|
8
|
+
/** name of the contact, you have saved on your WA */
|
|
9
|
+
name?: string;
|
|
10
|
+
/** name of the contact, the contact has set on their own on WA */
|
|
11
|
+
notify?: string;
|
|
12
|
+
/** I have no idea */
|
|
13
|
+
verifiedName?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Url of the profile picture of the contact
|
|
16
|
+
*
|
|
17
|
+
* 'changed' => if the profile picture has changed
|
|
18
|
+
* null => if the profile picture has not been set (default profile picture)
|
|
19
|
+
* any other string => url of the profile picture
|
|
20
|
+
*/
|
|
21
|
+
imgUrl?: string | null;
|
|
22
|
+
status?: string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Contact.d.ts.map
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { Boom } from '@hapi/boom';
|
|
2
|
+
import { proto } from '../../WAProto/index.js';
|
|
3
|
+
import type { AuthenticationCreds } from './Auth.js';
|
|
4
|
+
import type { WACallEvent } from './Call.js';
|
|
5
|
+
import type { Chat, ChatUpdate, PresenceData } from './Chat.js';
|
|
6
|
+
import type { Contact } from './Contact.js';
|
|
7
|
+
import type { GroupMetadata, GroupParticipant, ParticipantAction, RequestJoinAction, RequestJoinMethod } from './GroupMetadata.js';
|
|
8
|
+
import type { Label } from './Label.js';
|
|
9
|
+
import type { LabelAssociation } from './LabelAssociation.js';
|
|
10
|
+
import type { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message.js';
|
|
11
|
+
import type { ConnectionState } from './State.js';
|
|
12
|
+
export type BaileysEventMap = {
|
|
13
|
+
/** connection state has been updated -- WS closed, opened, connecting etc. */
|
|
14
|
+
'connection.update': Partial<ConnectionState>;
|
|
15
|
+
/** credentials updated -- some metadata, keys or something */
|
|
16
|
+
'creds.update': Partial<AuthenticationCreds>;
|
|
17
|
+
/** set chats (history sync), everything is reverse chronologically sorted */
|
|
18
|
+
'messaging-history.set': {
|
|
19
|
+
chats: Chat[];
|
|
20
|
+
contacts: Contact[];
|
|
21
|
+
messages: WAMessage[];
|
|
22
|
+
isLatest?: boolean;
|
|
23
|
+
progress?: number | null;
|
|
24
|
+
syncType?: proto.HistorySync.HistorySyncType | null;
|
|
25
|
+
peerDataRequestSessionId?: string | null;
|
|
26
|
+
};
|
|
27
|
+
/** upsert chats */
|
|
28
|
+
'chats.upsert': Chat[];
|
|
29
|
+
/** update the given chats */
|
|
30
|
+
'chats.update': ChatUpdate[];
|
|
31
|
+
'lid-mapping.update': {
|
|
32
|
+
lid: string;
|
|
33
|
+
pn: string;
|
|
34
|
+
};
|
|
35
|
+
/** delete chats with given ID */
|
|
36
|
+
'chats.delete': string[];
|
|
37
|
+
/** presence of contact in a chat updated */
|
|
38
|
+
'presence.update': {
|
|
39
|
+
id: string;
|
|
40
|
+
presences: {
|
|
41
|
+
[participant: string]: PresenceData;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
'contacts.upsert': Contact[];
|
|
45
|
+
'contacts.update': Partial<Contact>[];
|
|
46
|
+
'messages.delete': {
|
|
47
|
+
keys: WAMessageKey[];
|
|
48
|
+
} | {
|
|
49
|
+
jid: string;
|
|
50
|
+
all: true;
|
|
51
|
+
};
|
|
52
|
+
'messages.update': WAMessageUpdate[];
|
|
53
|
+
'messages.media-update': {
|
|
54
|
+
key: WAMessageKey;
|
|
55
|
+
media?: {
|
|
56
|
+
ciphertext: Uint8Array;
|
|
57
|
+
iv: Uint8Array;
|
|
58
|
+
};
|
|
59
|
+
error?: Boom;
|
|
60
|
+
}[];
|
|
61
|
+
/**
|
|
62
|
+
* add/update the given messages. If they were received while the connection was online,
|
|
63
|
+
* the update will have type: "notify"
|
|
64
|
+
* if requestId is provided, then the messages was received from the phone due to it being unavailable
|
|
65
|
+
* */
|
|
66
|
+
'messages.upsert': {
|
|
67
|
+
messages: WAMessage[];
|
|
68
|
+
type: MessageUpsertType;
|
|
69
|
+
requestId?: string;
|
|
70
|
+
};
|
|
71
|
+
/** message was reacted to. If reaction was removed -- then "reaction.text" will be falsey */
|
|
72
|
+
'messages.reaction': {
|
|
73
|
+
key: WAMessageKey;
|
|
74
|
+
reaction: proto.IReaction;
|
|
75
|
+
}[];
|
|
76
|
+
'message-receipt.update': MessageUserReceiptUpdate[];
|
|
77
|
+
'groups.upsert': GroupMetadata[];
|
|
78
|
+
'groups.update': Partial<GroupMetadata>[];
|
|
79
|
+
/** apply an action to participants in a group */
|
|
80
|
+
'group-participants.update': {
|
|
81
|
+
id: string;
|
|
82
|
+
author: string;
|
|
83
|
+
authorPn?: string;
|
|
84
|
+
participants: GroupParticipant[];
|
|
85
|
+
action: ParticipantAction;
|
|
86
|
+
};
|
|
87
|
+
'group.join-request': {
|
|
88
|
+
id: string;
|
|
89
|
+
author: string;
|
|
90
|
+
authorPn?: string;
|
|
91
|
+
participant: string;
|
|
92
|
+
participantPn?: string;
|
|
93
|
+
action: RequestJoinAction;
|
|
94
|
+
method: RequestJoinMethod;
|
|
95
|
+
};
|
|
96
|
+
'blocklist.set': {
|
|
97
|
+
blocklist: string[];
|
|
98
|
+
};
|
|
99
|
+
'blocklist.update': {
|
|
100
|
+
blocklist: string[];
|
|
101
|
+
type: 'add' | 'remove';
|
|
102
|
+
};
|
|
103
|
+
/** Receive an update on a call, including when the call was received, rejected, accepted */
|
|
104
|
+
call: WACallEvent[];
|
|
105
|
+
'labels.edit': Label;
|
|
106
|
+
'labels.association': {
|
|
107
|
+
association: LabelAssociation;
|
|
108
|
+
type: 'add' | 'remove';
|
|
109
|
+
};
|
|
110
|
+
/** Newsletter-related events */
|
|
111
|
+
'newsletter.reaction': {
|
|
112
|
+
id: string;
|
|
113
|
+
server_id: string;
|
|
114
|
+
reaction: {
|
|
115
|
+
code?: string;
|
|
116
|
+
count?: number;
|
|
117
|
+
removed?: boolean;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
'newsletter.view': {
|
|
121
|
+
id: string;
|
|
122
|
+
server_id: string;
|
|
123
|
+
count: number;
|
|
124
|
+
};
|
|
125
|
+
'newsletter-participants.update': {
|
|
126
|
+
id: string;
|
|
127
|
+
author: string;
|
|
128
|
+
user: string;
|
|
129
|
+
new_role: string;
|
|
130
|
+
action: string;
|
|
131
|
+
};
|
|
132
|
+
'newsletter-settings.update': {
|
|
133
|
+
id: string;
|
|
134
|
+
update: any;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export type BufferedEventData = {
|
|
138
|
+
historySets: {
|
|
139
|
+
chats: {
|
|
140
|
+
[jid: string]: Chat;
|
|
141
|
+
};
|
|
142
|
+
contacts: {
|
|
143
|
+
[jid: string]: Contact;
|
|
144
|
+
};
|
|
145
|
+
messages: {
|
|
146
|
+
[uqId: string]: WAMessage;
|
|
147
|
+
};
|
|
148
|
+
empty: boolean;
|
|
149
|
+
isLatest: boolean;
|
|
150
|
+
progress?: number | null;
|
|
151
|
+
syncType?: proto.HistorySync.HistorySyncType;
|
|
152
|
+
peerDataRequestSessionId?: string;
|
|
153
|
+
};
|
|
154
|
+
chatUpserts: {
|
|
155
|
+
[jid: string]: Chat;
|
|
156
|
+
};
|
|
157
|
+
chatUpdates: {
|
|
158
|
+
[jid: string]: ChatUpdate;
|
|
159
|
+
};
|
|
160
|
+
chatDeletes: Set<string>;
|
|
161
|
+
contactUpserts: {
|
|
162
|
+
[jid: string]: Contact;
|
|
163
|
+
};
|
|
164
|
+
contactUpdates: {
|
|
165
|
+
[jid: string]: Partial<Contact>;
|
|
166
|
+
};
|
|
167
|
+
messageUpserts: {
|
|
168
|
+
[key: string]: {
|
|
169
|
+
type: MessageUpsertType;
|
|
170
|
+
message: WAMessage;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
messageUpdates: {
|
|
174
|
+
[key: string]: WAMessageUpdate;
|
|
175
|
+
};
|
|
176
|
+
messageDeletes: {
|
|
177
|
+
[key: string]: WAMessageKey;
|
|
178
|
+
};
|
|
179
|
+
messageReactions: {
|
|
180
|
+
[key: string]: {
|
|
181
|
+
key: WAMessageKey;
|
|
182
|
+
reactions: proto.IReaction[];
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
messageReceipts: {
|
|
186
|
+
[key: string]: {
|
|
187
|
+
key: WAMessageKey;
|
|
188
|
+
userReceipt: proto.IUserReceipt[];
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
groupUpdates: {
|
|
192
|
+
[jid: string]: Partial<GroupMetadata>;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
export type BaileysEvent = keyof BaileysEventMap;
|
|
196
|
+
export interface BaileysEventEmitter {
|
|
197
|
+
on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
|
|
198
|
+
off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
|
|
199
|
+
removeAllListeners<T extends keyof BaileysEventMap>(event: T): void;
|
|
200
|
+
emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean;
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=Events.d.ts.map
|