naya-flore 4.7.1 → 4.7.3
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 +0 -104
- package/WAProto/WAProto.proto +89 -1195
- package/WAProto/index.d.ts +1256 -13195
- package/WAProto/index.js +11405 -32544
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +0 -231
- package/lib/Defaults/index.js +102 -92
- package/lib/Defaults/phonenumber-mcc.json +221 -221
- package/lib/Signal/libsignal.js +9 -18
- package/lib/Socket/Client/abstract-socket-client.d.ts +2 -0
- package/lib/Socket/Client/index.d.ts +3 -2
- package/lib/Socket/Client/index.js +3 -2
- package/lib/Socket/Client/mobile-socket-client.d.ts +1 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
- package/lib/Socket/Client/{websocket.js → web-socket-client.js} +2 -2
- package/lib/Socket/business.d.ts +43 -42
- package/lib/Socket/chats.d.ts +8 -9
- package/lib/Socket/chats.js +34 -41
- package/lib/Socket/groups.d.ts +7 -7
- package/lib/Socket/groups.js +4 -2
- package/lib/Socket/index.d.ts +52 -51
- package/lib/Socket/messages-recv.d.ts +42 -41
- package/lib/Socket/messages-recv.js +127 -190
- package/lib/Socket/messages-send.d.ts +9 -16
- package/lib/Socket/messages-send.js +316 -467
- package/lib/Socket/newsletter.d.ts +28 -26
- package/lib/Socket/newsletter.js +3 -3
- package/lib/Socket/registration.d.ts +52 -49
- package/lib/Socket/registration.js +7 -7
- package/lib/Socket/socket.d.ts +0 -1
- package/lib/Socket/socket.js +23 -49
- package/lib/Socket/usync.d.ts +10 -11
- package/lib/Store/index.d.ts +2 -2
- package/lib/Store/index.js +2 -2
- package/lib/Store/make-cache-manager-store.d.ts +0 -1
- package/lib/Store/make-in-memory-store.js +1 -5
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +7 -12
- package/lib/Types/Events.d.ts +2 -17
- package/lib/Types/GroupMetadata.d.ts +2 -3
- package/lib/Types/Label.d.ts +0 -11
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +10 -170
- package/lib/Types/Newsletter.js +3 -3
- package/lib/Types/Socket.d.ts +4 -7
- package/lib/Types/index.d.ts +0 -9
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.js +3 -3
- package/lib/Utils/business.d.ts +1 -1
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +12 -11
- package/lib/Utils/chat-utils.js +26 -42
- package/lib/Utils/crypto.d.ts +16 -15
- package/lib/Utils/crypto.js +23 -35
- package/lib/Utils/decode-wa-message.d.ts +0 -17
- package/lib/Utils/decode-wa-message.js +15 -43
- package/lib/Utils/generics.d.ts +17 -13
- package/lib/Utils/generics.js +15 -25
- package/lib/Utils/history.d.ts +2 -6
- package/lib/Utils/history.js +6 -4
- package/lib/Utils/logger.d.ts +3 -1
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +28 -25
- package/lib/Utils/messages-media.js +47 -38
- package/lib/Utils/messages.js +41 -454
- package/lib/Utils/noise-handler.d.ts +5 -4
- package/lib/Utils/process-message.js +2 -2
- package/lib/Utils/signal.d.ts +1 -2
- package/lib/Utils/signal.js +19 -11
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +3 -11
- package/lib/Utils/validate-connection.d.ts +1 -1
- package/lib/Utils/validate-connection.js +1 -1
- package/lib/WABinary/decode.d.ts +2 -1
- package/lib/WABinary/decode.js +7 -17
- package/lib/WABinary/encode.d.ts +2 -1
- package/lib/WABinary/encode.js +17 -33
- package/lib/WABinary/generic-utils.d.ts +3 -2
- package/lib/WABinary/generic-utils.js +2 -2
- package/lib/WABinary/jid-utils.d.ts +1 -1
- package/lib/WAM/BinaryInfo.d.ts +11 -2
- package/lib/WAM/encode.d.ts +2 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -3
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
- package/lib/WAUSync/USyncQuery.d.ts +2 -0
- package/lib/WAUSync/USyncQuery.js +10 -0
- package/lib/WAUSync/USyncUser.d.ts +2 -0
- package/lib/WAUSync/USyncUser.js +4 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/package.json +19 -32
- package/lib/Socket/Client/types.d.ts +0 -17
- package/lib/Socket/Client/types.js +0 -13
package/lib/Socket/usync.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/// <reference types="node" />
|
2
1
|
import { Boom } from '@hapi/boom';
|
3
2
|
import { SocketConfig } from '../Types';
|
4
3
|
import { BinaryNode } from '../WABinary';
|
@@ -6,12 +5,12 @@ import { USyncQuery } from '../WAUSync';
|
|
6
5
|
export declare const makeUSyncSocket: (config: SocketConfig) => {
|
7
6
|
executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
|
8
7
|
type: "md";
|
9
|
-
ws:
|
8
|
+
ws: import("./Client").WebSocketClient;
|
10
9
|
ev: import("../Types").BaileysEventEmitter & {
|
11
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
10
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
12
11
|
buffer(): void;
|
13
|
-
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T
|
14
|
-
flush(force?: boolean
|
12
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
13
|
+
flush(force?: boolean): boolean;
|
15
14
|
isBuffering(): boolean;
|
16
15
|
};
|
17
16
|
authState: {
|
@@ -21,17 +20,17 @@ export declare const makeUSyncSocket: (config: SocketConfig) => {
|
|
21
20
|
signalRepository: import("../Types").SignalRepository;
|
22
21
|
user: import("../Types").Contact | undefined;
|
23
22
|
generateMessageTag: () => string;
|
24
|
-
query: (node: BinaryNode, timeoutMs?: number
|
25
|
-
waitForMessage: <
|
23
|
+
query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
|
24
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
|
26
25
|
waitForSocketOpen: () => Promise<void>;
|
27
26
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
28
27
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
29
|
-
logout: (msg?: string
|
28
|
+
logout: (msg?: string) => Promise<void>;
|
30
29
|
end: (error: Error | undefined) => void;
|
31
|
-
onUnexpectedError: (err: Error | Boom
|
30
|
+
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
32
31
|
uploadPreKeys: (count?: number) => Promise<void>;
|
33
32
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
34
|
-
requestPairingCode: (phoneNumber: string,
|
35
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined
|
33
|
+
requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
|
34
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
36
35
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
37
36
|
};
|
package/lib/Store/index.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
import makeCacheManagerAuthState from './make-cache-manager-store';
|
2
|
-
import
|
3
|
-
export {
|
2
|
+
import makeInMemoryStore from './make-in-memory-store';
|
3
|
+
export { makeInMemoryStore, makeCacheManagerAuthState };
|
package/lib/Store/index.js
CHANGED
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.makeCacheManagerAuthState = exports.
|
6
|
+
exports.makeCacheManagerAuthState = exports.makeInMemoryStore = void 0;
|
7
7
|
const make_cache_manager_store_1 = __importDefault(require("./make-cache-manager-store"));
|
8
8
|
exports.makeCacheManagerAuthState = make_cache_manager_store_1.default;
|
9
9
|
const make_in_memory_store_1 = __importDefault(require("./make-in-memory-store"));
|
10
|
-
exports.
|
10
|
+
exports.makeInMemoryStore = make_in_memory_store_1.default;
|
@@ -74,11 +74,7 @@ exports.default = (config) => {
|
|
74
74
|
ev.on('connection.update', update => {
|
75
75
|
Object.assign(state, update);
|
76
76
|
});
|
77
|
-
ev.on('messaging-history.set', ({ chats: newChats, contacts: newContacts, messages: newMessages, isLatest
|
78
|
-
if (syncType === WAProto_1.proto.HistorySync.HistorySyncType.ON_DEMAND) {
|
79
|
-
return; // FOR NOW,
|
80
|
-
//TODO: HANDLE
|
81
|
-
}
|
77
|
+
ev.on('messaging-history.set', ({ chats: newChats, contacts: newContacts, messages: newMessages, isLatest }) => {
|
82
78
|
if (isLatest) {
|
83
79
|
chats.clear();
|
84
80
|
for (const id in messages) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
declare function makeOrderedDictionary<T>(idGetter: (item: T) => string): {
|
2
2
|
array: T[];
|
3
3
|
get: (id: string) => T | undefined;
|
4
|
-
upsert: (item: T, mode:
|
4
|
+
upsert: (item: T, mode: 'append' | 'prepend') => void;
|
5
5
|
update: (item: T) => boolean;
|
6
6
|
remove: (item: T) => boolean;
|
7
7
|
updateAssign: (id: string, update: Partial<T>) => boolean;
|
package/lib/Types/Auth.d.ts
CHANGED
package/lib/Types/Call.d.ts
CHANGED
package/lib/Types/Chat.d.ts
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
import type { proto } from '../../WAProto';
|
2
2
|
import type { AccountSettings } from './Auth';
|
3
3
|
import type { BufferedEventData } from './Events';
|
4
|
-
import type { LabelActionBody } from './Label';
|
5
4
|
import type { ChatLabelAssociationActionBody } from './LabelAssociation';
|
6
5
|
import type { MessageLabelAssociationActionBody } from './LabelAssociation';
|
7
|
-
import type { MinimalMessage
|
6
|
+
import type { MinimalMessage } from './Message';
|
8
7
|
/** privacy settings in WhatsApp Web */
|
9
8
|
export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none';
|
10
9
|
export type WAPrivacyOnlineValue = 'all' | 'match_last_seen';
|
11
|
-
export type WAPrivacyGroupAddValue = 'all' | 'contacts' | 'contact_blacklist';
|
12
10
|
export type WAReadReceiptsValue = 'all' | 'none';
|
13
|
-
export type WAPrivacyCallValue = 'all' | 'known';
|
14
11
|
/** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
|
15
12
|
export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
|
16
13
|
export declare const ALL_WA_PATCH_NAMES: readonly ["critical_block", "critical_unblock_low", "regular_high", "regular_low", "regular"];
|
@@ -62,12 +59,12 @@ export type ChatModification = {
|
|
62
59
|
/** mute for duration, or provide timestamp of mute to remove*/
|
63
60
|
mute: number | null;
|
64
61
|
} | {
|
65
|
-
clear:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
62
|
+
clear: 'all' | {
|
63
|
+
messages: {
|
64
|
+
id: string;
|
65
|
+
fromMe?: boolean;
|
66
|
+
timestamp: number;
|
67
|
+
}[];
|
71
68
|
};
|
72
69
|
} | {
|
73
70
|
star: {
|
@@ -83,8 +80,6 @@ export type ChatModification = {
|
|
83
80
|
} | {
|
84
81
|
delete: true;
|
85
82
|
lastMessages: LastMessageList;
|
86
|
-
} | {
|
87
|
-
addLabel: LabelActionBody;
|
88
83
|
} | {
|
89
84
|
addChatLabel: ChatLabelAssociationActionBody;
|
90
85
|
} | {
|
package/lib/Types/Events.d.ts
CHANGED
@@ -4,7 +4,7 @@ import { AuthenticationCreds } from './Auth';
|
|
4
4
|
import { WACallEvent } from './Call';
|
5
5
|
import { Chat, ChatUpdate, PresenceData } from './Chat';
|
6
6
|
import { Contact } from './Contact';
|
7
|
-
import { GroupMetadata, ParticipantAction
|
7
|
+
import { GroupMetadata, ParticipantAction } from './GroupMetadata';
|
8
8
|
import { Label } from './Label';
|
9
9
|
import { LabelAssociation } from './LabelAssociation';
|
10
10
|
import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message';
|
@@ -19,10 +19,7 @@ export type BaileysEventMap = {
|
|
19
19
|
chats: Chat[];
|
20
20
|
contacts: Contact[];
|
21
21
|
messages: WAMessage[];
|
22
|
-
isLatest
|
23
|
-
progress?: number | null;
|
24
|
-
syncType?: proto.HistorySync.HistorySyncType;
|
25
|
-
peerDataRequestSessionId?: string | null;
|
22
|
+
isLatest: boolean;
|
26
23
|
};
|
27
24
|
/** upsert chats */
|
28
25
|
'chats.upsert': Chat[];
|
@@ -61,12 +58,10 @@ export type BaileysEventMap = {
|
|
61
58
|
/**
|
62
59
|
* add/update the given messages. If they were received while the connection was online,
|
63
60
|
* 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
61
|
* */
|
66
62
|
'messages.upsert': {
|
67
63
|
messages: WAMessage[];
|
68
64
|
type: MessageUpsertType;
|
69
|
-
requestId?: string;
|
70
65
|
};
|
71
66
|
/** message was reacted to. If reaction was removed -- then "reaction.text" will be falsey */
|
72
67
|
'messages.reaction': {
|
@@ -83,13 +78,6 @@ export type BaileysEventMap = {
|
|
83
78
|
participants: string[];
|
84
79
|
action: ParticipantAction;
|
85
80
|
};
|
86
|
-
'group.join-request': {
|
87
|
-
id: string;
|
88
|
-
author: string;
|
89
|
-
participant: string;
|
90
|
-
action: RequestJoinAction;
|
91
|
-
method: RequestJoinMethod;
|
92
|
-
};
|
93
81
|
'blocklist.set': {
|
94
82
|
blocklist: string[];
|
95
83
|
};
|
@@ -118,9 +106,6 @@ export type BufferedEventData = {
|
|
118
106
|
};
|
119
107
|
empty: boolean;
|
120
108
|
isLatest: boolean;
|
121
|
-
progress?: number | null;
|
122
|
-
syncType?: proto.HistorySync.HistorySyncType;
|
123
|
-
peerDataRequestSessionId?: string;
|
124
109
|
};
|
125
110
|
chatUpserts: {
|
126
111
|
[jid: string]: Chat;
|
@@ -4,13 +4,12 @@ export type GroupParticipant = (Contact & {
|
|
4
4
|
isSuperAdmin?: boolean;
|
5
5
|
admin?: 'admin' | 'superadmin' | null;
|
6
6
|
});
|
7
|
-
export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote'
|
8
|
-
export type RequestJoinAction = 'created' | 'revoked' | 'rejected';
|
9
|
-
export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined;
|
7
|
+
export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote';
|
10
8
|
export interface GroupMetadata {
|
11
9
|
id: string;
|
12
10
|
owner: string | undefined;
|
13
11
|
subject: string;
|
12
|
+
addressingMode: "pn" | "lid";
|
14
13
|
/** group subject owner */
|
15
14
|
subjectOwner?: string;
|
16
15
|
/** group subject modification date */
|
package/lib/Types/Label.d.ts
CHANGED
@@ -10,17 +10,6 @@ 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
|
-
}
|
24
13
|
/** WhatsApp has 20 predefined colors */
|
25
14
|
export declare enum LabelColor {
|
26
15
|
Color1 = 0,
|
package/lib/Types/Label.js
CHANGED
@@ -24,4 +24,4 @@ var LabelColor;
|
|
24
24
|
LabelColor[LabelColor["Color18"] = 17] = "Color18";
|
25
25
|
LabelColor[LabelColor["Color19"] = 18] = "Color19";
|
26
26
|
LabelColor[LabelColor["Color20"] = 19] = "Color20";
|
27
|
-
})(LabelColor
|
27
|
+
})(LabelColor = exports.LabelColor || (exports.LabelColor = {}));
|
@@ -6,4 +6,4 @@ var LabelAssociationType;
|
|
6
6
|
(function (LabelAssociationType) {
|
7
7
|
LabelAssociationType["Chat"] = "label_jid";
|
8
8
|
LabelAssociationType["Message"] = "label_message";
|
9
|
-
})(LabelAssociationType
|
9
|
+
})(LabelAssociationType = exports.LabelAssociationType || (exports.LabelAssociationType = {}));
|
package/lib/Types/Message.d.ts
CHANGED
@@ -19,7 +19,6 @@ export type WAMessageKey = proto.IMessageKey;
|
|
19
19
|
export type WATextMessage = proto.Message.IExtendedTextMessage;
|
20
20
|
export type WAContextInfo = proto.IContextInfo;
|
21
21
|
export type WALocationMessage = proto.Message.ILocationMessage;
|
22
|
-
export type WALiveLocationMessage = proto.Message.ILiveLocationMessage;
|
23
22
|
export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
|
24
23
|
export import WAMessageStubType = proto.WebMessageInfo.StubType;
|
25
24
|
export import WAMessageStatus = proto.WebMessageInfo.Status;
|
@@ -28,7 +27,6 @@ export type WAMediaUpload = Buffer | {
|
|
28
27
|
} | {
|
29
28
|
stream: Readable;
|
30
29
|
};
|
31
|
-
export import Annotations = proto.IInteractiveAnnotation;
|
32
30
|
/** Set of message types that are supported by the library */
|
33
31
|
export type MessageType = keyof proto.Message;
|
34
32
|
export type DownloadableMessage = {
|
@@ -55,19 +53,6 @@ export interface WAUrlInfo {
|
|
55
53
|
highQualityThumbnail?: proto.Message.IImageMessage;
|
56
54
|
originalThumbnailUrl?: string;
|
57
55
|
}
|
58
|
-
export interface Media {
|
59
|
-
image?: WAMediaUpload;
|
60
|
-
video?: WAMediaUpload;
|
61
|
-
}
|
62
|
-
export interface Carousel {
|
63
|
-
image?: WAMediaUpload;
|
64
|
-
video?: WAMediaUpload;
|
65
|
-
product?: WASendableProduct;
|
66
|
-
title?: string;
|
67
|
-
caption?: string;
|
68
|
-
footer?: string;
|
69
|
-
buttons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[];
|
70
|
-
}
|
71
56
|
type Mentionable = {
|
72
57
|
/** list of jids that are mentioned in the accompanying text */
|
73
58
|
mentions?: string[];
|
@@ -88,35 +73,6 @@ type Templatable = {
|
|
88
73
|
templateButtons?: proto.IHydratedTemplateButton[];
|
89
74
|
footer?: string;
|
90
75
|
};
|
91
|
-
type Interactiveable = {
|
92
|
-
/** add buttons to the message (conflicts with normal buttons)*/
|
93
|
-
interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[];
|
94
|
-
title?: string;
|
95
|
-
subtitle?: string;
|
96
|
-
media?: boolean;
|
97
|
-
};
|
98
|
-
type Shopable = {
|
99
|
-
shop?: proto.Message.InteractiveMessage.ShopMessage.Surface;
|
100
|
-
id?: string;
|
101
|
-
title?: string;
|
102
|
-
subtitle?: string;
|
103
|
-
media?: boolean;
|
104
|
-
};
|
105
|
-
type Collectionable = {
|
106
|
-
collection?: {
|
107
|
-
bizJid?: string;
|
108
|
-
id?: string;
|
109
|
-
version?: number;
|
110
|
-
};
|
111
|
-
title?: string;
|
112
|
-
subtitle?: string;
|
113
|
-
media?: boolean;
|
114
|
-
};
|
115
|
-
type Cardsable = {
|
116
|
-
cards?: Carousel[];
|
117
|
-
title?: string;
|
118
|
-
subtitle?: string;
|
119
|
-
};
|
120
76
|
type Editable = {
|
121
77
|
edit?: WAMessageKey;
|
122
78
|
};
|
@@ -125,7 +81,7 @@ type Listable = {
|
|
125
81
|
sections?: proto.Message.ListMessage.ISection[];
|
126
82
|
/** Title of a List Message only */
|
127
83
|
title?: string;
|
128
|
-
/** Text of the
|
84
|
+
/** Text of the bnutton on the list (required) */
|
129
85
|
buttonText?: string;
|
130
86
|
};
|
131
87
|
type WithDimensions = {
|
@@ -138,12 +94,6 @@ export type PollMessageOptions = {
|
|
138
94
|
values: string[];
|
139
95
|
/** 32 byte message secret to encrypt poll selections */
|
140
96
|
messageSecret?: Uint8Array;
|
141
|
-
toAnnouncementGroup?: boolean;
|
142
|
-
};
|
143
|
-
export type PollResultMessage = {
|
144
|
-
name: string;
|
145
|
-
votes: proto.Message.PollResultSnapshotMessage.PollVote[];
|
146
|
-
messageSecret?: Uint8Array;
|
147
97
|
};
|
148
98
|
type SharePhoneNumber = {
|
149
99
|
sharePhoneNumber: boolean;
|
@@ -151,123 +101,48 @@ type SharePhoneNumber = {
|
|
151
101
|
type RequestPhoneNumber = {
|
152
102
|
requestPhoneNumber: boolean;
|
153
103
|
};
|
154
|
-
export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
|
155
|
-
productImage: WAMediaUpload;
|
156
|
-
};
|
157
104
|
export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING;
|
158
105
|
export type AnyMediaMessageContent = (({
|
159
106
|
image: WAMediaUpload;
|
160
107
|
caption?: string;
|
161
108
|
jpegThumbnail?: string;
|
162
|
-
|
163
|
-
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | ({
|
109
|
+
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | ({
|
164
110
|
video: WAMediaUpload;
|
165
111
|
caption?: string;
|
166
112
|
gifPlayback?: boolean;
|
167
113
|
jpegThumbnail?: string;
|
168
114
|
/** if set to true, will send as a `video note` */
|
169
115
|
ptv?: boolean;
|
170
|
-
|
171
|
-
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | {
|
116
|
+
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | {
|
172
117
|
audio: WAMediaUpload;
|
173
118
|
/** if set to true, will send as a `voice note` */
|
174
119
|
ptt?: boolean;
|
175
120
|
/** optionally tell the duration of the audio */
|
176
121
|
seconds?: number;
|
177
|
-
annotations?: Annotations;
|
178
122
|
} | ({
|
179
123
|
sticker: WAMediaUpload;
|
180
124
|
isAnimated?: boolean;
|
181
|
-
annotations?: Annotations;
|
182
125
|
} & WithDimensions) | ({
|
183
126
|
document: WAMediaUpload;
|
184
127
|
mimetype: string;
|
185
128
|
fileName?: string;
|
186
129
|
caption?: string;
|
187
|
-
|
188
|
-
} & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable)) & {
|
130
|
+
} & Contextable & Buttonable & Templatable)) & {
|
189
131
|
mimetype?: string;
|
190
132
|
} & Editable;
|
191
133
|
export type ButtonReplyInfo = {
|
192
134
|
displayText: string;
|
193
135
|
id: string;
|
194
136
|
index: number;
|
195
|
-
text: string;
|
196
|
-
nativeFlow: proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage;
|
197
|
-
};
|
198
|
-
export type GroupInviteInfo = {
|
199
|
-
inviteCode: string;
|
200
|
-
inviteExpiration: number;
|
201
|
-
text: string;
|
202
|
-
jid: string;
|
203
|
-
subject: string;
|
204
|
-
thumbnail: Buffer;
|
205
|
-
};
|
206
|
-
export type PinInChatInfo = {
|
207
|
-
key: WAMessageKey;
|
208
|
-
type?: number;
|
209
|
-
time?: number;
|
210
|
-
};
|
211
|
-
export type KeepInChatInfo = {
|
212
|
-
key: WAMessageKey;
|
213
|
-
type?: number;
|
214
|
-
time?: number;
|
215
|
-
};
|
216
|
-
export type CallCreationInfo = {
|
217
|
-
time?: number;
|
218
|
-
title?: string;
|
219
|
-
type?: number;
|
220
137
|
};
|
221
|
-
export type
|
222
|
-
|
223
|
-
expiry?: number;
|
224
|
-
};
|
225
|
-
export type RequestPaymentInfo = {
|
226
|
-
expiry: number;
|
227
|
-
amount: number;
|
228
|
-
currency: string;
|
229
|
-
from: string;
|
230
|
-
note?: string;
|
231
|
-
sticker?: WAMediaUpload;
|
232
|
-
background: string;
|
233
|
-
/** add contextInfo to the message */
|
234
|
-
contextInfo?: proto.IContextInfo;
|
235
|
-
};
|
236
|
-
export type EventsInfo = {
|
237
|
-
isCanceled?: boolean;
|
238
|
-
name: string;
|
239
|
-
description: string;
|
240
|
-
joinLink?: string;
|
241
|
-
startTime?: number;
|
242
|
-
messageSecret?: Uint8Array;
|
243
|
-
};
|
244
|
-
export type AdminInviteInfo = {
|
245
|
-
inviteExpiration: number;
|
246
|
-
text: string;
|
247
|
-
jid: string;
|
248
|
-
subject: string;
|
249
|
-
thumbnail: Buffer;
|
250
|
-
};
|
251
|
-
export type OrderInfo = {
|
252
|
-
id: number;
|
253
|
-
thumbnail: string;
|
254
|
-
itemCount: number;
|
255
|
-
status: number;
|
256
|
-
surface: number;
|
257
|
-
title: string;
|
258
|
-
text: string;
|
259
|
-
seller: string;
|
260
|
-
token: string;
|
261
|
-
amount: number;
|
262
|
-
currency: string;
|
138
|
+
export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
|
139
|
+
productImage: WAMediaUpload;
|
263
140
|
};
|
264
141
|
export type AnyRegularMessageContent = (({
|
265
142
|
text: string;
|
266
143
|
linkPreview?: WAUrlInfo | null;
|
267
|
-
} & Mentionable & Contextable & Buttonable & Templatable &
|
144
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Listable & Editable) | AnyMediaMessageContent | ({
|
268
145
|
poll: PollMessageOptions;
|
269
|
-
} | {
|
270
|
-
pollResult: PollResultMessage;
|
271
146
|
} & Mentionable & Contextable & Buttonable & Templatable & Editable) | {
|
272
147
|
contacts: {
|
273
148
|
displayName?: string;
|
@@ -275,49 +150,19 @@ export type AnyRegularMessageContent = (({
|
|
275
150
|
};
|
276
151
|
} | {
|
277
152
|
location: WALocationMessage;
|
278
|
-
} | {
|
279
|
-
liveLocation: WALiveLocationMessage;
|
280
153
|
} | {
|
281
154
|
react: proto.Message.IReactionMessage;
|
282
155
|
} | {
|
283
156
|
buttonReply: ButtonReplyInfo;
|
284
|
-
type: 'template' | 'plain'
|
285
|
-
} | {
|
286
|
-
groupInvite: GroupInviteInfo;
|
287
|
-
} | {
|
288
|
-
pin: WAMessageKey;
|
289
|
-
type: proto.PinInChat.Type;
|
290
|
-
/**
|
291
|
-
* 24 hours, 7 days, 30 days
|
292
|
-
*/
|
293
|
-
time?: 86400 | 604800 | 2592000;
|
294
|
-
} | {
|
295
|
-
keep: WAMessageKey;
|
296
|
-
type: number;
|
297
|
-
/**
|
298
|
-
* 24 hours, 7 days, 90 days
|
299
|
-
*/
|
300
|
-
time?: 86400 | 604800 | 7776000;
|
301
|
-
} | {
|
302
|
-
paymentInvite: PaymentInviteInfo;
|
303
|
-
} | {
|
304
|
-
requestPayment: RequestPaymentInfo;
|
305
|
-
} | {
|
306
|
-
event: EventsInfo;
|
307
|
-
} | {
|
308
|
-
order: OrderInfo;
|
309
|
-
} | {
|
310
|
-
call: CallCreationInfo;
|
311
|
-
} | {
|
312
|
-
inviteAdmin: AdminInviteInfo;
|
157
|
+
type: 'template' | 'plain';
|
313
158
|
} | {
|
314
159
|
listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
|
315
|
-
} |
|
160
|
+
} | {
|
316
161
|
product: WASendableProduct;
|
317
162
|
businessOwnerJid?: string;
|
318
163
|
body?: string;
|
319
164
|
footer?: string;
|
320
|
-
}
|
165
|
+
} | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
|
321
166
|
export type AnyMessageContent = AnyRegularMessageContent | {
|
322
167
|
forward: WAMessage;
|
323
168
|
force?: boolean;
|
@@ -368,8 +213,6 @@ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
|
368
213
|
font?: number;
|
369
214
|
/** if it is broadcast */
|
370
215
|
broadcast?: boolean;
|
371
|
-
/** delay of message time */
|
372
|
-
delay?: number;
|
373
216
|
};
|
374
217
|
export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
|
375
218
|
userJid: string;
|
@@ -393,8 +236,6 @@ export type MediaGenerationOptions = {
|
|
393
236
|
mediaCache?: CacheStore;
|
394
237
|
mediaUploadTimeoutMs?: number;
|
395
238
|
options?: AxiosRequestConfig;
|
396
|
-
/** the message you want to quote */
|
397
|
-
quoted?: WAMessage;
|
398
239
|
backgroundColor?: string;
|
399
240
|
font?: number;
|
400
241
|
/** The message is for newsletter? */
|
@@ -402,7 +243,6 @@ export type MediaGenerationOptions = {
|
|
402
243
|
};
|
403
244
|
export type MessageContentGenerationOptions = MediaGenerationOptions & {
|
404
245
|
getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
|
405
|
-
getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
|
406
246
|
};
|
407
247
|
export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
|
408
248
|
/**
|
package/lib/Types/Newsletter.js
CHANGED
@@ -6,7 +6,7 @@ var MexOperations;
|
|
6
6
|
MexOperations["PROMOTE"] = "NotificationNewsletterAdminPromote";
|
7
7
|
MexOperations["DEMOTE"] = "NotificationNewsletterAdminDemote";
|
8
8
|
MexOperations["UPDATE"] = "NotificationNewsletterUpdate";
|
9
|
-
})(MexOperations
|
9
|
+
})(MexOperations = exports.MexOperations || (exports.MexOperations = {}));
|
10
10
|
var XWAPaths;
|
11
11
|
(function (XWAPaths) {
|
12
12
|
XWAPaths["PROMOTE"] = "xwa2_notify_newsletter_admin_promote";
|
@@ -15,7 +15,7 @@ var XWAPaths;
|
|
15
15
|
XWAPaths["CREATE"] = "xwa2_newsletter_create";
|
16
16
|
XWAPaths["NEWSLETTER"] = "xwa2_newsletter";
|
17
17
|
XWAPaths["METADATA_UPDATE"] = "xwa2_notify_newsletter_on_metadata_update";
|
18
|
-
})(XWAPaths
|
18
|
+
})(XWAPaths = exports.XWAPaths || (exports.XWAPaths = {}));
|
19
19
|
var QueryIds;
|
20
20
|
(function (QueryIds) {
|
21
21
|
QueryIds["JOB_MUTATION"] = "7150902998257522";
|
@@ -29,4 +29,4 @@ var QueryIds;
|
|
29
29
|
QueryIds["CHANGE_OWNER"] = "7341777602580933";
|
30
30
|
QueryIds["DELETE"] = "8316537688363079";
|
31
31
|
QueryIds["DEMOTE"] = "6551828931592903";
|
32
|
-
})(QueryIds
|
32
|
+
})(QueryIds = exports.QueryIds || (exports.QueryIds = {}));
|
package/lib/Types/Socket.d.ts
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
1
3
|
import { AxiosRequestConfig } from 'axios';
|
2
4
|
import type { Agent } from 'https';
|
3
5
|
import type { Logger } from 'pino';
|
4
6
|
import type { URL } from 'url';
|
5
7
|
import { proto } from '../../WAProto';
|
6
8
|
import { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } from './Auth';
|
7
|
-
import { GroupMetadata } from './GroupMetadata';
|
8
9
|
import { MediaConnInfo } from './Message';
|
9
10
|
import { SignalRepository } from './Signal';
|
10
11
|
export type WAVersion = [number, number, number];
|
@@ -40,6 +41,8 @@ export type SocketConfig = {
|
|
40
41
|
browser: WABrowserDescription;
|
41
42
|
/** agent used for fetch requests -- uploading/downloading media */
|
42
43
|
fetchAgent?: Agent;
|
44
|
+
/** should the QR be printed in the terminal */
|
45
|
+
printQRInTerminal: boolean;
|
43
46
|
/** should events be emitted for actions done by this socket connection */
|
44
47
|
emitOwnEvents: boolean;
|
45
48
|
/** custom upload hosts to upload media to */
|
@@ -58,8 +61,6 @@ export type SocketConfig = {
|
|
58
61
|
transactionOpts: TransactionCapabilityOptions;
|
59
62
|
/** marks the client as online whenever the socket successfully connects */
|
60
63
|
markOnlineOnConnect: boolean;
|
61
|
-
/** alphanumeric country code (USA -> US) for the number used */
|
62
|
-
countryCode: string;
|
63
64
|
/** provide a cache to store media, so does not have to be re-uploaded */
|
64
65
|
mediaCache?: CacheStore;
|
65
66
|
/**
|
@@ -70,8 +71,6 @@ export type SocketConfig = {
|
|
70
71
|
userDevicesCache?: CacheStore;
|
71
72
|
/** cache to store call offers */
|
72
73
|
callOfferCache?: CacheStore;
|
73
|
-
/** cache to track placeholder resends */
|
74
|
-
placeholderResendCache?: CacheStore;
|
75
74
|
/** width for link preview images */
|
76
75
|
linkPreviewImageThumbnailWidth: number;
|
77
76
|
/** Should Baileys ask the phone for full history, will be received async */
|
@@ -106,8 +105,6 @@ export type SocketConfig = {
|
|
106
105
|
* (solves the "this message can take a while" issue) can be retried
|
107
106
|
* */
|
108
107
|
getMessage: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>;
|
109
|
-
/** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
|
110
|
-
cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>;
|
111
108
|
makeSignalRepository: (auth: SignalAuthState) => SignalRepository;
|
112
109
|
/** Socket passthrough */
|
113
110
|
socket?: any;
|
package/lib/Types/index.d.ts
CHANGED
@@ -15,15 +15,6 @@ import { SocketConfig } from './Socket';
|
|
15
15
|
export type UserFacingSocketConfig = Partial<SocketConfig> & {
|
16
16
|
auth: AuthenticationState;
|
17
17
|
};
|
18
|
-
export type BrowsersMap = {
|
19
|
-
ubuntu(browser: string): [string, string, string];
|
20
|
-
macOS(browser: string): [string, string, string];
|
21
|
-
baileys(browser: string): [string, string, string];
|
22
|
-
windows(browser: string): [string, string, string];
|
23
|
-
iOS(browser: string): [string, string, string];
|
24
|
-
linux(browser: string): [string, string, string];
|
25
|
-
appropriate(browser: string): [string, string, string];
|
26
|
-
};
|
27
18
|
export declare enum DisconnectReason {
|
28
19
|
connectionClosed = 428,
|
29
20
|
connectionLost = 408,
|
package/lib/Types/index.js
CHANGED
@@ -39,4 +39,4 @@ var DisconnectReason;
|
|
39
39
|
DisconnectReason[DisconnectReason["multideviceMismatch"] = 411] = "multideviceMismatch";
|
40
40
|
DisconnectReason[DisconnectReason["forbidden"] = 403] = "forbidden";
|
41
41
|
DisconnectReason[DisconnectReason["unavailableService"] = 503] = "unavailableService";
|
42
|
-
})(DisconnectReason
|
42
|
+
})(DisconnectReason = exports.DisconnectReason || (exports.DisconnectReason = {}));
|