@alannxd/baileys 6.0.4 → 6.0.5
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/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +5479 -0
- package/WAProto/fix-imports.js +85 -0
- package/WAProto/index.d.ts +14017 -0
- package/WAProto/index.js +201 -160
- package/engine-requirements.js +1 -1
- package/lib/Defaults/index.d.ts +37 -15
- package/lib/Defaults/index.js +119 -136
- package/lib/Signal/Group/ciphertext-message.d.ts +1 -0
- package/lib/Signal/Group/ciphertext-message.js +2 -5
- package/lib/Signal/Group/group-session-builder.d.ts +4 -3
- package/lib/Signal/Group/group-session-builder.js +7 -41
- package/lib/Signal/Group/group_cipher.d.ts +4 -4
- package/lib/Signal/Group/group_cipher.js +37 -51
- package/lib/Signal/Group/index.d.ts +12 -11
- package/lib/Signal/Group/index.js +12 -57
- package/lib/Signal/Group/keyhelper.d.ts +2 -1
- package/lib/Signal/Group/keyhelper.js +7 -44
- package/lib/Signal/Group/sender-chain-key.d.ts +3 -2
- package/lib/Signal/Group/sender-chain-key.js +7 -15
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +2 -1
- package/lib/Signal/Group/sender-key-distribution-message.js +8 -11
- package/lib/Signal/Group/sender-key-message.d.ts +2 -1
- package/lib/Signal/Group/sender-key-message.js +9 -12
- package/lib/Signal/Group/sender-key-name.d.ts +1 -0
- package/lib/Signal/Group/sender-key-name.js +2 -5
- package/lib/Signal/Group/sender-key-record.d.ts +3 -2
- package/lib/Signal/Group/sender-key-record.js +9 -21
- package/lib/Signal/Group/sender-key-state.d.ts +7 -6
- package/lib/Signal/Group/sender-key-state.js +27 -42
- package/lib/Signal/Group/sender-message-key.d.ts +1 -0
- package/lib/Signal/Group/sender-message-key.js +4 -7
- package/lib/Signal/libsignal.d.ts +5 -3
- package/lib/Signal/libsignal.js +347 -90
- package/lib/Signal/lid-mapping.d.ts +23 -0
- package/lib/Signal/lid-mapping.js +277 -0
- package/lib/Socket/Client/index.d.ts +3 -3
- package/lib/Socket/Client/index.js +3 -19
- package/lib/Socket/Client/{abstract-socket-client.d.ts → types.d.ts} +4 -5
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +3 -2
- package/lib/Socket/Client/websocket.js +54 -0
- package/lib/Socket/business.d.ts +154 -108
- package/lib/Socket/business.js +162 -43
- package/lib/Socket/chats.d.ts +96 -239
- package/lib/Socket/chats.js +627 -427
- package/lib/Socket/communities.d.ts +239 -146
- package/lib/Socket/communities.js +90 -80
- package/lib/Socket/groups.d.ts +104 -57
- package/lib/Socket/groups.js +154 -161
- package/lib/Socket/index.d.ts +202 -115
- package/lib/Socket/index.js +11 -10
- package/lib/Socket/luxu.d.ts +22 -266
- package/lib/Socket/luxu.js +422 -465
- package/lib/Socket/messages-recv.d.ts +136 -84
- package/lib/Socket/messages-recv.js +1421 -615
- package/lib/Socket/messages-send.d.ts +142 -126
- package/lib/Socket/messages-send.js +878 -671
- package/lib/Socket/mex.d.ts +3 -0
- package/lib/Socket/mex.js +42 -0
- package/lib/Socket/newsletter.d.ts +121 -85
- package/lib/Socket/newsletter.js +147 -272
- package/lib/Socket/socket.d.ts +34 -19
- package/lib/Socket/socket.js +544 -313
- package/lib/Store/index.d.ts +10 -3
- package/lib/Store/index.js +10 -10
- package/lib/Store/keyed-db.d.ts +22 -0
- package/lib/Store/keyed-db.js +108 -0
- package/lib/Store/make-cache-manager-store.d.ts +17 -11
- package/lib/Store/make-cache-manager-store.js +43 -41
- package/lib/Store/make-in-memory-store.d.ts +39 -118
- package/lib/Store/make-in-memory-store.js +112 -341
- package/lib/Store/make-ordered-dictionary.d.ts +11 -10
- package/lib/Store/make-ordered-dictionary.js +14 -20
- package/lib/Store/object-repository.d.ts +10 -9
- package/lib/Store/object-repository.js +11 -6
- package/lib/Types/Auth.d.ts +19 -12
- package/lib/Types/Auth.js +2 -2
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Call.d.ts +3 -1
- package/lib/Types/Call.js +2 -2
- package/lib/Types/Chat.d.ts +35 -13
- package/lib/Types/Chat.js +8 -4
- package/lib/Types/Contact.d.ts +8 -1
- package/lib/Types/Contact.js +2 -2
- package/lib/Types/Events.d.ts +116 -17
- package/lib/Types/Events.js +2 -2
- package/lib/Types/GroupMetadata.d.ts +21 -5
- package/lib/Types/GroupMetadata.js +2 -2
- package/lib/Types/Label.d.ts +12 -0
- package/lib/Types/Label.js +3 -5
- package/lib/Types/LabelAssociation.d.ts +1 -0
- package/lib/Types/LabelAssociation.js +3 -5
- package/lib/Types/Message.d.ts +105 -58
- package/lib/Types/Message.js +11 -9
- package/lib/Types/Mex.d.ts +141 -0
- package/lib/Types/Mex.js +37 -0
- package/lib/Types/Product.d.ts +2 -1
- package/lib/Types/Product.js +2 -2
- package/lib/Types/Signal.d.ts +32 -2
- package/lib/Types/Signal.js +2 -2
- package/lib/Types/Socket.d.ts +50 -25
- package/lib/Types/Socket.js +3 -2
- package/lib/Types/State.d.ts +72 -2
- package/lib/Types/State.js +56 -2
- package/lib/Types/USync.d.ts +3 -2
- package/lib/Types/USync.js +2 -2
- package/lib/Types/index.d.ts +22 -14
- package/lib/Types/index.js +15 -31
- package/lib/Utils/auth-utils.d.ts +12 -6
- package/lib/Utils/auth-utils.js +239 -143
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/business.d.ts +3 -2
- package/lib/Utils/business.js +66 -69
- package/lib/Utils/chat-utils.d.ts +52 -23
- package/lib/Utils/chat-utils.js +396 -253
- package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
- package/lib/Utils/companion-reg-client-utils.js +35 -0
- package/lib/Utils/crypto.d.ts +18 -22
- package/lib/Utils/crypto.js +57 -90
- package/lib/Utils/decode-wa-message.d.ts +55 -8
- package/lib/Utils/decode-wa-message.js +203 -84
- package/lib/Utils/event-buffer.d.ts +9 -8
- package/lib/Utils/event-buffer.js +185 -77
- package/lib/Utils/generics.d.ts +28 -29
- package/lib/Utils/generics.js +180 -210
- package/lib/Utils/history.d.ts +18 -9
- package/lib/Utils/history.js +93 -55
- package/lib/Utils/identity-change-handler.d.ts +44 -0
- package/lib/Utils/identity-change-handler.js +50 -0
- package/lib/Utils/index.d.ts +22 -17
- package/lib/Utils/index.js +22 -33
- package/lib/Utils/link-preview.d.ts +5 -5
- package/lib/Utils/link-preview.js +16 -24
- package/lib/Utils/logger.d.ts +11 -3
- package/lib/Utils/logger.js +3 -7
- package/lib/Utils/lt-hash.d.ts +8 -12
- package/lib/Utils/lt-hash.js +3 -46
- package/lib/Utils/make-mutex.d.ts +4 -2
- package/lib/Utils/make-mutex.js +24 -34
- package/lib/Utils/message-retry-manager.d.ts +115 -0
- package/lib/Utils/message-retry-manager.js +265 -0
- package/lib/Utils/messages-media.d.ts +61 -44
- package/lib/Utils/messages-media.js +451 -482
- package/lib/Utils/messages.d.ts +32 -18
- package/lib/Utils/messages.js +458 -369
- package/lib/Utils/noise-handler.d.ts +13 -14
- package/lib/Utils/noise-handler.js +145 -99
- package/lib/Utils/offline-node-processor.d.ts +17 -0
- package/lib/Utils/offline-node-processor.js +40 -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 +31 -12
- package/lib/Utils/process-message.js +459 -150
- package/lib/Utils/reporting-utils.d.ts +11 -0
- package/lib/Utils/reporting-utils.js +258 -0
- package/lib/Utils/signal.d.ts +20 -5
- package/lib/Utils/signal.js +120 -72
- package/lib/Utils/stanza-ack.d.ts +11 -0
- package/lib/Utils/stanza-ack.js +38 -0
- package/lib/Utils/sync-action-utils.d.ts +19 -0
- package/lib/Utils/sync-action-utils.js +49 -0
- package/lib/Utils/tc-token-utils.d.ts +37 -0
- package/lib/Utils/tc-token-utils.js +163 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +2 -2
- package/lib/Utils/use-multi-file-auth-state.js +29 -27
- package/lib/Utils/validate-connection.d.ts +7 -7
- package/lib/Utils/validate-connection.js +73 -99
- package/lib/WABinary/constants.d.ts +25 -27
- package/lib/WABinary/constants.js +1281 -20
- package/lib/WABinary/decode.d.ts +5 -5
- package/lib/WABinary/decode.js +52 -42
- package/lib/WABinary/encode.d.ts +3 -3
- package/lib/WABinary/encode.js +110 -155
- package/lib/WABinary/generic-utils.d.ts +8 -7
- package/lib/WABinary/generic-utils.js +48 -49
- package/lib/WABinary/index.d.ts +6 -5
- package/lib/WABinary/index.js +6 -21
- package/lib/WABinary/jid-utils.d.ts +25 -8
- package/lib/WABinary/jid-utils.js +74 -40
- package/lib/WABinary/types.d.ts +2 -1
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.d.ts +3 -11
- package/lib/WAM/BinaryInfo.js +2 -5
- package/lib/WAM/constants.d.ts +5 -3
- package/lib/WAM/constants.js +19071 -11568
- package/lib/WAM/encode.d.ts +3 -3
- package/lib/WAM/encode.js +17 -22
- package/lib/WAM/index.d.ts +4 -3
- package/lib/WAM/index.js +4 -19
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +4 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +33 -13
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +3 -2
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +11 -14
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +3 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +9 -12
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +3 -2
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +9 -13
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +4 -3
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +20 -22
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +5 -3
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +13 -8
- package/lib/WAUSync/Protocols/index.d.ts +6 -4
- package/lib/WAUSync/Protocols/index.js +6 -20
- package/lib/WAUSync/USyncQuery.d.ts +6 -4
- package/lib/WAUSync/USyncQuery.js +44 -35
- package/lib/WAUSync/USyncUser.d.ts +10 -5
- package/lib/WAUSync/USyncUser.js +10 -5
- package/lib/WAUSync/index.d.ts +4 -0
- package/lib/WAUSync/index.js +4 -19
- package/lib/index.d.ts +10 -9
- package/lib/index.js +12 -34
- package/package.json +84 -51
- package/WAProto/fix-import.js +0 -29
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/queue-job.js +0 -57
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/web-socket-client.js +0 -62
- package/lib/Socket/registration.d.ts +0 -267
- package/lib/Socket/registration.js +0 -166
- package/lib/Socket/usync.d.ts +0 -36
- package/lib/Socket/usync.js +0 -70
- package/lib/Types/Newsletter.d.ts +0 -103
- package/lib/Types/Newsletter.js +0 -38
- package/lib/Utils/baileys-event-stream.d.ts +0 -16
- package/lib/Utils/baileys-event-stream.js +0 -63
|
@@ -1,27 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectRepository = void 0;
|
|
4
|
-
class ObjectRepository {
|
|
1
|
+
export class ObjectRepository {
|
|
5
2
|
constructor(entities = {}) {
|
|
6
3
|
this.entityMap = new Map(Object.entries(entities));
|
|
7
4
|
}
|
|
5
|
+
|
|
8
6
|
findById(id) {
|
|
9
7
|
return this.entityMap.get(id);
|
|
10
8
|
}
|
|
9
|
+
|
|
11
10
|
findAll() {
|
|
12
11
|
return Array.from(this.entityMap.values());
|
|
13
12
|
}
|
|
13
|
+
|
|
14
14
|
upsertById(id, entity) {
|
|
15
|
-
|
|
15
|
+
this.entityMap.set(id, { ...entity });
|
|
16
|
+
return this;
|
|
16
17
|
}
|
|
18
|
+
|
|
17
19
|
deleteById(id) {
|
|
18
20
|
return this.entityMap.delete(id);
|
|
19
21
|
}
|
|
22
|
+
|
|
20
23
|
count() {
|
|
21
24
|
return this.entityMap.size;
|
|
22
25
|
}
|
|
26
|
+
|
|
23
27
|
toJSON() {
|
|
24
28
|
return this.findAll();
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
|
-
|
|
31
|
+
|
|
32
|
+
export default ObjectRepository;
|
package/lib/Types/Auth.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import type { Contact } from './Contact';
|
|
5
|
-
import type { MinimalMessage } from './Message';
|
|
1
|
+
import type { proto } from '../../WAProto/index.js';
|
|
2
|
+
import type { Contact } from './Contact.js';
|
|
3
|
+
import type { MinimalMessage } from './Message.js';
|
|
6
4
|
export type KeyPair = {
|
|
7
5
|
public: Uint8Array;
|
|
8
6
|
private: Uint8Array;
|
|
@@ -21,6 +19,10 @@ export type SignalIdentity = {
|
|
|
21
19
|
identifier: ProtocolAddress;
|
|
22
20
|
identifierKey: Uint8Array;
|
|
23
21
|
};
|
|
22
|
+
export type LIDMapping = {
|
|
23
|
+
pn: string;
|
|
24
|
+
lid: string;
|
|
25
|
+
};
|
|
24
26
|
export type LTHashState = {
|
|
25
27
|
version: number;
|
|
26
28
|
hash: Buffer;
|
|
@@ -57,25 +59,29 @@ export type AuthenticationCreds = SignalCreds & {
|
|
|
57
59
|
/** number of times history & app state has been synced */
|
|
58
60
|
accountSyncCounter: number;
|
|
59
61
|
accountSettings: AccountSettings;
|
|
60
|
-
deviceId: string;
|
|
61
|
-
phoneId: string;
|
|
62
|
-
identityId: Buffer;
|
|
63
62
|
registered: boolean;
|
|
64
|
-
backupToken: Buffer;
|
|
65
|
-
registration: RegistrationOptions;
|
|
66
63
|
pairingCode: string | undefined;
|
|
67
64
|
lastPropHash: string | undefined;
|
|
68
65
|
routingInfo: Buffer | undefined;
|
|
66
|
+
additionalData?: any | undefined;
|
|
69
67
|
};
|
|
70
68
|
export type SignalDataTypeMap = {
|
|
71
69
|
'pre-key': KeyPair;
|
|
72
|
-
|
|
70
|
+
session: Uint8Array;
|
|
73
71
|
'sender-key': Uint8Array;
|
|
74
72
|
'sender-key-memory': {
|
|
75
73
|
[jid: string]: boolean;
|
|
76
74
|
};
|
|
77
75
|
'app-state-sync-key': proto.Message.IAppStateSyncKeyData;
|
|
78
76
|
'app-state-sync-version': LTHashState;
|
|
77
|
+
'lid-mapping': string;
|
|
78
|
+
'device-list': string[];
|
|
79
|
+
tctoken: {
|
|
80
|
+
token: Buffer;
|
|
81
|
+
timestamp?: string;
|
|
82
|
+
senderTimestamp?: number;
|
|
83
|
+
};
|
|
84
|
+
'identity-key': Uint8Array;
|
|
79
85
|
};
|
|
80
86
|
export type SignalDataSet = {
|
|
81
87
|
[T in keyof SignalDataTypeMap]?: {
|
|
@@ -93,7 +99,7 @@ export type SignalKeyStore = {
|
|
|
93
99
|
};
|
|
94
100
|
export type SignalKeyStoreWithTransaction = SignalKeyStore & {
|
|
95
101
|
isInTransaction: () => boolean;
|
|
96
|
-
transaction<T>(exec: () => Promise<T
|
|
102
|
+
transaction<T>(exec: () => Promise<T>, key: string): Promise<T>;
|
|
97
103
|
};
|
|
98
104
|
export type TransactionCapabilityOptions = {
|
|
99
105
|
maxCommitRetries: number;
|
|
@@ -108,3 +114,4 @@ export type AuthenticationState = {
|
|
|
108
114
|
keys: SignalKeyStore;
|
|
109
115
|
};
|
|
110
116
|
export {};
|
|
117
|
+
//# sourceMappingURL=Auth.d.ts.map
|
package/lib/Types/Auth.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=Auth.js.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
|
package/lib/Types/Call.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept';
|
|
1
|
+
export type WACallUpdateType = 'offer' | 'ringing' | 'preaccept' | 'transport' | 'relaylatency' | 'timeout' | 'reject' | 'accept' | 'terminate';
|
|
2
2
|
export type WACallEvent = {
|
|
3
3
|
chatId: string;
|
|
4
4
|
from: string;
|
|
5
|
+
callerPn?: string;
|
|
5
6
|
isGroup?: boolean;
|
|
6
7
|
groupJid?: string;
|
|
7
8
|
id: string;
|
|
@@ -11,3 +12,4 @@ export type WACallEvent = {
|
|
|
11
12
|
offline: boolean;
|
|
12
13
|
latencyMs?: number;
|
|
13
14
|
};
|
|
15
|
+
//# sourceMappingURL=Call.d.ts.map
|
package/lib/Types/Call.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=Call.js.map
|
package/lib/Types/Chat.d.ts
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
import type { proto } from '../../WAProto';
|
|
2
|
-
import type { AccountSettings } from './Auth';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
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';
|
|
7
9
|
/** privacy settings in WhatsApp Web */
|
|
8
10
|
export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none';
|
|
9
11
|
export type WAPrivacyOnlineValue = 'all' | 'match_last_seen';
|
|
12
|
+
export type WAPrivacyGroupAddValue = 'all' | 'contacts' | 'contact_blacklist';
|
|
10
13
|
export type WAReadReceiptsValue = 'all' | 'none';
|
|
14
|
+
export type WAPrivacyCallValue = 'all' | 'known';
|
|
15
|
+
export type WAPrivacyMessagesValue = 'all' | 'contacts';
|
|
11
16
|
/** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
|
|
12
17
|
export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
|
|
13
18
|
export declare const ALL_WA_PATCH_NAMES: readonly ["critical_block", "critical_unblock_low", "regular_high", "regular_low", "regular"];
|
|
14
|
-
export type WAPatchName = typeof ALL_WA_PATCH_NAMES[number];
|
|
19
|
+
export type WAPatchName = (typeof ALL_WA_PATCH_NAMES)[number];
|
|
15
20
|
export interface PresenceData {
|
|
16
21
|
lastKnownPresence: WAPresence;
|
|
17
22
|
lastSeen?: number;
|
|
23
|
+
groupOnlineCount?: number;
|
|
18
24
|
}
|
|
25
|
+
export type BotListInfo = {
|
|
26
|
+
jid: string;
|
|
27
|
+
personaId: string;
|
|
28
|
+
};
|
|
19
29
|
export type ChatMutation = {
|
|
20
30
|
syncAction: proto.ISyncActionData;
|
|
21
31
|
index: string[];
|
|
@@ -42,6 +52,8 @@ export type ChatUpdate = Partial<Chat & {
|
|
|
42
52
|
* undefined if the condition is not yet fulfilled
|
|
43
53
|
* */
|
|
44
54
|
conditional: (bufferedData: BufferedEventData) => boolean | undefined;
|
|
55
|
+
/** last update time */
|
|
56
|
+
timestamp?: number;
|
|
45
57
|
}>;
|
|
46
58
|
/**
|
|
47
59
|
* the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat
|
|
@@ -59,12 +71,13 @@ export type ChatModification = {
|
|
|
59
71
|
/** mute for duration, or provide timestamp of mute to remove*/
|
|
60
72
|
mute: number | null;
|
|
61
73
|
} | {
|
|
62
|
-
clear:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
clear: boolean;
|
|
75
|
+
lastMessages: LastMessageList;
|
|
76
|
+
} | {
|
|
77
|
+
deleteForMe: {
|
|
78
|
+
deleteMedia: boolean;
|
|
79
|
+
key: WAMessageKey;
|
|
80
|
+
timestamp: number;
|
|
68
81
|
};
|
|
69
82
|
} | {
|
|
70
83
|
star: {
|
|
@@ -80,6 +93,12 @@ export type ChatModification = {
|
|
|
80
93
|
} | {
|
|
81
94
|
delete: true;
|
|
82
95
|
lastMessages: LastMessageList;
|
|
96
|
+
} | {
|
|
97
|
+
contact: proto.SyncActionValue.IContactAction | null;
|
|
98
|
+
} | {
|
|
99
|
+
disableLinkPreviews: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction;
|
|
100
|
+
} | {
|
|
101
|
+
addLabel: LabelActionBody;
|
|
83
102
|
} | {
|
|
84
103
|
addChatLabel: ChatLabelAssociationActionBody;
|
|
85
104
|
} | {
|
|
@@ -88,6 +107,8 @@ export type ChatModification = {
|
|
|
88
107
|
addMessageLabel: MessageLabelAssociationActionBody;
|
|
89
108
|
} | {
|
|
90
109
|
removeMessageLabel: MessageLabelAssociationActionBody;
|
|
110
|
+
} | {
|
|
111
|
+
quickReply: QuickReplyAction;
|
|
91
112
|
};
|
|
92
113
|
export type InitialReceivedChatsState = {
|
|
93
114
|
[jid: string]: {
|
|
@@ -100,3 +121,4 @@ export type InitialReceivedChatsState = {
|
|
|
100
121
|
export type InitialAppStateSyncOptions = {
|
|
101
122
|
accountSettings: AccountSettings;
|
|
102
123
|
};
|
|
124
|
+
//# sourceMappingURL=Chat.d.ts.map
|
package/lib/Types/Chat.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export const ALL_WA_PATCH_NAMES = [
|
|
2
|
+
'critical_block',
|
|
3
|
+
'critical_unblock_low',
|
|
4
|
+
'regular_high',
|
|
5
|
+
'regular_low',
|
|
6
|
+
'regular'
|
|
7
|
+
];
|
|
8
|
+
//# sourceMappingURL=Chat.js.map
|
package/lib/Types/Contact.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
export interface Contact {
|
|
2
|
+
/** ID either in lid or jid format (preferred) **/
|
|
2
3
|
id: string;
|
|
4
|
+
/** ID in LID format (@lid) **/
|
|
3
5
|
lid?: string;
|
|
6
|
+
/** ID in PN format (@s.whatsapp.net) **/
|
|
7
|
+
phoneNumber?: string;
|
|
4
8
|
/** name of the contact, you have saved on your WA */
|
|
5
9
|
name?: string;
|
|
6
10
|
/** name of the contact, the contact has set on their own on WA */
|
|
7
11
|
notify?: string;
|
|
12
|
+
/** username associated with this contact, when provided by WA */
|
|
13
|
+
username?: string;
|
|
8
14
|
/** I have no idea */
|
|
9
15
|
verifiedName?: string;
|
|
10
16
|
/**
|
|
@@ -14,6 +20,7 @@ export interface Contact {
|
|
|
14
20
|
* null => if the profile picture has not been set (default profile picture)
|
|
15
21
|
* any other string => url of the profile picture
|
|
16
22
|
*/
|
|
17
|
-
imgUrl?: string | null
|
|
23
|
+
imgUrl?: string | null;
|
|
18
24
|
status?: string;
|
|
19
25
|
}
|
|
26
|
+
//# sourceMappingURL=Contact.d.ts.map
|
package/lib/Types/Contact.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=Contact.js.map
|
package/lib/Types/Events.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Boom } from '@hapi/boom';
|
|
2
|
-
import { proto } from '../../WAProto';
|
|
3
|
-
import { AuthenticationCreds } from './Auth';
|
|
4
|
-
import { WACallEvent } from './Call';
|
|
5
|
-
import { Chat, ChatUpdate, PresenceData } from './Chat';
|
|
6
|
-
import { Contact } from './Contact';
|
|
7
|
-
import { GroupMetadata, ParticipantAction } from './GroupMetadata';
|
|
8
|
-
import { Label } from './Label';
|
|
9
|
-
import { LabelAssociation } from './LabelAssociation';
|
|
10
|
-
import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message';
|
|
11
|
-
import { ConnectionState } from './State';
|
|
2
|
+
import { proto } from '../../WAProto/index.js';
|
|
3
|
+
import type { AuthenticationCreds, LIDMapping } 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, NewChatMessageCapInfo } from './State.js';
|
|
12
12
|
export type BaileysEventMap = {
|
|
13
13
|
/** connection state has been updated -- WS closed, opened, connecting etc. */
|
|
14
14
|
'connection.update': Partial<ConnectionState>;
|
|
@@ -19,16 +19,31 @@ export type BaileysEventMap = {
|
|
|
19
19
|
chats: Chat[];
|
|
20
20
|
contacts: Contact[];
|
|
21
21
|
messages: WAMessage[];
|
|
22
|
-
|
|
22
|
+
lidPnMappings?: LIDMapping[];
|
|
23
|
+
isLatest?: boolean;
|
|
24
|
+
progress?: number | null;
|
|
25
|
+
syncType?: proto.HistorySync.HistorySyncType | null;
|
|
26
|
+
pastParticipants?: proto.IPastParticipants[] | null;
|
|
27
|
+
chunkOrder?: number | null;
|
|
28
|
+
peerDataRequestSessionId?: string | null;
|
|
29
|
+
};
|
|
30
|
+
/** signals history sync milestones (completion or stall) per sync type */
|
|
31
|
+
'messaging-history.status': {
|
|
32
|
+
/** which sync phase this status refers to */
|
|
33
|
+
syncType: proto.HistorySync.HistorySyncType;
|
|
34
|
+
/** the status of this sync phase */
|
|
35
|
+
status: 'complete' | 'paused';
|
|
36
|
+
/**
|
|
37
|
+
* progress === 100 was received from the server.
|
|
38
|
+
* when false, completion was inferred via timeout (no more chunks arriving).
|
|
39
|
+
*/
|
|
40
|
+
explicit: boolean;
|
|
23
41
|
};
|
|
24
42
|
/** upsert chats */
|
|
25
43
|
'chats.upsert': Chat[];
|
|
26
44
|
/** update the given chats */
|
|
27
45
|
'chats.update': ChatUpdate[];
|
|
28
|
-
'
|
|
29
|
-
lid: string;
|
|
30
|
-
jid: string;
|
|
31
|
-
};
|
|
46
|
+
'lid-mapping.update': LIDMapping;
|
|
32
47
|
/** delete chats with given ID */
|
|
33
48
|
'chats.delete': string[];
|
|
34
49
|
/** presence of contact in a chat updated */
|
|
@@ -58,10 +73,12 @@ export type BaileysEventMap = {
|
|
|
58
73
|
/**
|
|
59
74
|
* add/update the given messages. If they were received while the connection was online,
|
|
60
75
|
* the update will have type: "notify"
|
|
76
|
+
* if requestId is provided, then the messages was received from the phone due to it being unavailable
|
|
61
77
|
* */
|
|
62
78
|
'messages.upsert': {
|
|
63
79
|
messages: WAMessage[];
|
|
64
80
|
type: MessageUpsertType;
|
|
81
|
+
requestId?: string;
|
|
65
82
|
};
|
|
66
83
|
/** message was reacted to. If reaction was removed -- then "reaction.text" will be falsey */
|
|
67
84
|
'messages.reaction': {
|
|
@@ -75,9 +92,28 @@ export type BaileysEventMap = {
|
|
|
75
92
|
'group-participants.update': {
|
|
76
93
|
id: string;
|
|
77
94
|
author: string;
|
|
78
|
-
|
|
95
|
+
authorPn?: string;
|
|
96
|
+
authorUsername?: string;
|
|
97
|
+
participants: GroupParticipant[];
|
|
79
98
|
action: ParticipantAction;
|
|
80
99
|
};
|
|
100
|
+
'group.join-request': {
|
|
101
|
+
id: string;
|
|
102
|
+
author: string;
|
|
103
|
+
authorPn?: string;
|
|
104
|
+
authorUsername?: string;
|
|
105
|
+
participant: string;
|
|
106
|
+
participantPn?: string;
|
|
107
|
+
action: RequestJoinAction;
|
|
108
|
+
method: RequestJoinMethod;
|
|
109
|
+
};
|
|
110
|
+
'group.member-tag.update': {
|
|
111
|
+
groupId: string;
|
|
112
|
+
participant: string;
|
|
113
|
+
participantAlt?: string;
|
|
114
|
+
label: string;
|
|
115
|
+
messageTimestamp?: number;
|
|
116
|
+
};
|
|
81
117
|
'blocklist.set': {
|
|
82
118
|
blocklist: string[];
|
|
83
119
|
};
|
|
@@ -86,12 +122,69 @@ export type BaileysEventMap = {
|
|
|
86
122
|
type: 'add' | 'remove';
|
|
87
123
|
};
|
|
88
124
|
/** Receive an update on a call, including when the call was received, rejected, accepted */
|
|
89
|
-
|
|
125
|
+
call: WACallEvent[];
|
|
90
126
|
'labels.edit': Label;
|
|
91
127
|
'labels.association': {
|
|
92
128
|
association: LabelAssociation;
|
|
93
129
|
type: 'add' | 'remove';
|
|
94
130
|
};
|
|
131
|
+
/** Newsletter-related events */
|
|
132
|
+
'newsletter.reaction': {
|
|
133
|
+
id: string;
|
|
134
|
+
server_id: string;
|
|
135
|
+
reaction: {
|
|
136
|
+
code?: string;
|
|
137
|
+
count?: number;
|
|
138
|
+
removed?: boolean;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
'newsletter.view': {
|
|
142
|
+
id: string;
|
|
143
|
+
server_id: string;
|
|
144
|
+
count: number;
|
|
145
|
+
};
|
|
146
|
+
'newsletter-participants.update': {
|
|
147
|
+
id: string;
|
|
148
|
+
author: string;
|
|
149
|
+
user: string;
|
|
150
|
+
new_role: string;
|
|
151
|
+
action: string;
|
|
152
|
+
};
|
|
153
|
+
'newsletter-settings.update': {
|
|
154
|
+
id: string;
|
|
155
|
+
update: any;
|
|
156
|
+
};
|
|
157
|
+
'message-capping.update': NewChatMessageCapInfo;
|
|
158
|
+
/** Settings and actions sync events */
|
|
159
|
+
'chats.lock': {
|
|
160
|
+
id: string;
|
|
161
|
+
locked: boolean;
|
|
162
|
+
};
|
|
163
|
+
'settings.update': {
|
|
164
|
+
setting: 'unarchiveChats';
|
|
165
|
+
value: boolean;
|
|
166
|
+
} | {
|
|
167
|
+
setting: 'locale';
|
|
168
|
+
value: string;
|
|
169
|
+
} | {
|
|
170
|
+
setting: 'disableLinkPreviews';
|
|
171
|
+
value: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction;
|
|
172
|
+
} | {
|
|
173
|
+
setting: 'timeFormat';
|
|
174
|
+
value: proto.SyncActionValue.ITimeFormatAction;
|
|
175
|
+
} | {
|
|
176
|
+
setting: 'privacySettingRelayAllCalls';
|
|
177
|
+
value: proto.SyncActionValue.IPrivacySettingRelayAllCalls;
|
|
178
|
+
} | {
|
|
179
|
+
setting: 'statusPrivacy';
|
|
180
|
+
value: proto.SyncActionValue.IStatusPrivacyAction;
|
|
181
|
+
} | {
|
|
182
|
+
setting: 'notificationActivitySetting';
|
|
183
|
+
value: proto.SyncActionValue.NotificationActivitySettingAction.NotificationActivitySetting;
|
|
184
|
+
} | {
|
|
185
|
+
setting: 'channelsPersonalisedRecommendation';
|
|
186
|
+
value: proto.SyncActionValue.IPrivacySettingChannelsPersonalisedRecommendationAction;
|
|
187
|
+
};
|
|
95
188
|
};
|
|
96
189
|
export type BufferedEventData = {
|
|
97
190
|
historySets: {
|
|
@@ -106,6 +199,11 @@ export type BufferedEventData = {
|
|
|
106
199
|
};
|
|
107
200
|
empty: boolean;
|
|
108
201
|
isLatest: boolean;
|
|
202
|
+
progress?: number | null;
|
|
203
|
+
syncType?: proto.HistorySync.HistorySyncType;
|
|
204
|
+
pastParticipants?: proto.IPastParticipants[];
|
|
205
|
+
chunkOrder?: number | null;
|
|
206
|
+
peerDataRequestSessionId?: string;
|
|
109
207
|
};
|
|
110
208
|
chatUpserts: {
|
|
111
209
|
[jid: string]: Chat;
|
|
@@ -155,3 +253,4 @@ export interface BaileysEventEmitter {
|
|
|
155
253
|
removeAllListeners<T extends keyof BaileysEventMap>(event: T): void;
|
|
156
254
|
emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean;
|
|
157
255
|
}
|
|
256
|
+
//# sourceMappingURL=Events.d.ts.map
|
package/lib/Types/Events.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { proto } from '../../WAProto/index.js';
|
|
2
|
+
//# sourceMappingURL=Events.js.map
|
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
import { Contact } from './Contact';
|
|
2
|
-
|
|
1
|
+
import type { Contact } from './Contact.js';
|
|
2
|
+
import type { WAMessageAddressingMode } from './Message.js';
|
|
3
|
+
export type GroupParticipant = Contact & {
|
|
3
4
|
isAdmin?: boolean;
|
|
4
5
|
isSuperAdmin?: boolean;
|
|
5
6
|
admin?: 'admin' | 'superadmin' | null;
|
|
6
|
-
}
|
|
7
|
-
export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote';
|
|
7
|
+
};
|
|
8
|
+
export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify';
|
|
9
|
+
export type RequestJoinAction = 'created' | 'revoked' | 'rejected';
|
|
10
|
+
export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined;
|
|
8
11
|
export interface GroupMetadata {
|
|
9
12
|
id: string;
|
|
13
|
+
notify?: string;
|
|
14
|
+
/** group uses 'lid' or 'pn' to send messages */
|
|
15
|
+
addressingMode?: WAMessageAddressingMode;
|
|
10
16
|
owner: string | undefined;
|
|
17
|
+
ownerPn?: string | undefined;
|
|
18
|
+
ownerUsername?: string | undefined;
|
|
19
|
+
owner_country_code?: string | undefined;
|
|
11
20
|
subject: string;
|
|
12
|
-
addressingMode: "pn" | "lid";
|
|
13
21
|
/** group subject owner */
|
|
14
22
|
subjectOwner?: string;
|
|
23
|
+
subjectOwnerPn?: string;
|
|
24
|
+
subjectOwnerUsername?: string;
|
|
15
25
|
/** group subject modification date */
|
|
16
26
|
subjectTime?: number;
|
|
17
27
|
creation?: number;
|
|
18
28
|
desc?: string;
|
|
19
29
|
descOwner?: string;
|
|
30
|
+
descOwnerPn?: string;
|
|
31
|
+
descOwnerUsername?: string;
|
|
20
32
|
descId?: string;
|
|
33
|
+
descTime?: number;
|
|
21
34
|
/** if this group is part of a community, it returns the jid of the community to which it belongs */
|
|
22
35
|
linkedParent?: string;
|
|
23
36
|
/** is set when the group only allows admins to change group settings */
|
|
@@ -39,6 +52,8 @@ export interface GroupMetadata {
|
|
|
39
52
|
inviteCode?: string;
|
|
40
53
|
/** the person who added you to group or changed some setting in group */
|
|
41
54
|
author?: string;
|
|
55
|
+
authorPn?: string;
|
|
56
|
+
authorUsername?: string;
|
|
42
57
|
}
|
|
43
58
|
export interface WAGroupCreateResponse {
|
|
44
59
|
status: number;
|
|
@@ -53,3 +68,4 @@ export interface GroupModificationResponse {
|
|
|
53
68
|
[key: string]: {};
|
|
54
69
|
};
|
|
55
70
|
}
|
|
71
|
+
//# sourceMappingURL=GroupMetadata.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=GroupMetadata.js.map
|
package/lib/Types/Label.d.ts
CHANGED
|
@@ -10,6 +10,17 @@ export interface Label {
|
|
|
10
10
|
/** WhatsApp has 5 predefined labels (New customer, New order & etc) */
|
|
11
11
|
predefinedId?: string;
|
|
12
12
|
}
|
|
13
|
+
export interface LabelActionBody {
|
|
14
|
+
id: string;
|
|
15
|
+
/** Label name */
|
|
16
|
+
name?: string;
|
|
17
|
+
/** Label color ID */
|
|
18
|
+
color?: number;
|
|
19
|
+
/** Is label has been deleted */
|
|
20
|
+
deleted?: boolean;
|
|
21
|
+
/** WhatsApp has 5 predefined labels (New customer, New order & etc) */
|
|
22
|
+
predefinedId?: number;
|
|
23
|
+
}
|
|
13
24
|
/** WhatsApp has 20 predefined colors */
|
|
14
25
|
export declare enum LabelColor {
|
|
15
26
|
Color1 = 0,
|
|
@@ -33,3 +44,4 @@ export declare enum LabelColor {
|
|
|
33
44
|
Color19 = 18,
|
|
34
45
|
Color20 = 19
|
|
35
46
|
}
|
|
47
|
+
//# sourceMappingURL=Label.d.ts.map
|
package/lib/Types/Label.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LabelColor = void 0;
|
|
4
1
|
/** WhatsApp has 20 predefined colors */
|
|
5
|
-
var LabelColor;
|
|
2
|
+
export var LabelColor;
|
|
6
3
|
(function (LabelColor) {
|
|
7
4
|
LabelColor[LabelColor["Color1"] = 0] = "Color1";
|
|
8
5
|
LabelColor[LabelColor["Color2"] = 1] = "Color2";
|
|
@@ -24,4 +21,5 @@ var LabelColor;
|
|
|
24
21
|
LabelColor[LabelColor["Color18"] = 17] = "Color18";
|
|
25
22
|
LabelColor[LabelColor["Color19"] = 18] = "Color19";
|
|
26
23
|
LabelColor[LabelColor["Color20"] = 19] = "Color20";
|
|
27
|
-
})(LabelColor
|
|
24
|
+
})(LabelColor || (LabelColor = {}));
|
|
25
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LabelAssociationType = void 0;
|
|
4
1
|
/** Association type */
|
|
5
|
-
var LabelAssociationType;
|
|
2
|
+
export var LabelAssociationType;
|
|
6
3
|
(function (LabelAssociationType) {
|
|
7
4
|
LabelAssociationType["Chat"] = "label_jid";
|
|
8
5
|
LabelAssociationType["Message"] = "label_message";
|
|
9
|
-
})(LabelAssociationType
|
|
6
|
+
})(LabelAssociationType || (LabelAssociationType = {}));
|
|
7
|
+
//# sourceMappingURL=LabelAssociation.js.map
|