@jkt48connect-corp/baileys 7.2.9 → 7.3.0
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/index.d.ts +48955 -0
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +284 -0
- package/lib/Defaults/index.js +5 -5
- package/lib/Signal/libsignal.d.ts +3 -0
- package/lib/Socket/Client/abstract-socket-client.d.ts +15 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/lib/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +12 -0
- package/lib/Socket/Client/types.d.ts +17 -0
- package/lib/Socket/Client/types.js +13 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/Client/{web-socket-client.js → websocket.js} +2 -2
- package/lib/Socket/business.d.ts +170 -0
- package/lib/Socket/chats.d.ts +81 -0
- package/lib/Socket/chats.js +51 -48
- package/lib/Socket/groups.d.ts +115 -0
- package/lib/Socket/groups.js +1 -0
- package/lib/Socket/index.d.ts +172 -0
- package/lib/Socket/messages-recv.d.ts +158 -0
- package/lib/Socket/messages-send.d.ts +155 -0
- package/lib/Socket/messages-send.js +105 -77
- package/lib/Socket/newsletter.d.ts +132 -0
- package/lib/Socket/registration.d.ts +264 -0
- package/lib/Socket/socket.d.ts +44 -0
- package/lib/Socket/socket.js +15 -8
- package/lib/Socket/usync.d.ts +37 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/make-cache-manager-store.d.ts +14 -0
- package/lib/Store/make-in-memory-store.d.ts +118 -0
- package/lib/Store/make-in-memory-store.js +24 -13
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Types/Auth.d.ts +109 -0
- package/lib/Types/Call.d.ts +13 -0
- package/lib/Types/Chat.d.ts +107 -0
- package/lib/Types/Contact.d.ts +19 -0
- package/lib/Types/Events.d.ts +172 -0
- package/lib/Types/GroupMetadata.d.ts +56 -0
- package/lib/Types/Label.d.ts +46 -0
- package/lib/Types/LabelAssociation.d.ts +29 -0
- package/lib/Types/Message.d.ts +433 -0
- package/lib/Types/Newsletter.d.ts +92 -0
- package/lib/Types/Product.d.ts +78 -0
- package/lib/Types/Signal.d.ts +57 -0
- package/lib/Types/Socket.d.ts +116 -0
- package/lib/Types/State.d.ts +27 -0
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +66 -0
- package/lib/Utils/auth-utils.d.ts +18 -0
- package/lib/Utils/baileys-event-stream.d.ts +16 -0
- package/lib/Utils/business.d.ts +22 -0
- package/lib/Utils/chat-utils.d.ts +70 -0
- package/lib/Utils/crypto.d.ts +40 -0
- package/lib/Utils/decode-wa-message.d.ts +36 -0
- package/lib/Utils/event-buffer.d.ts +35 -0
- package/lib/Utils/generics.d.ts +88 -0
- package/lib/Utils/generics.js +2 -2
- package/lib/Utils/history.d.ts +19 -0
- package/lib/Utils/index.d.ts +17 -0
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/logger.d.ts +2 -0
- package/lib/Utils/lt-hash.d.ts +12 -0
- package/lib/Utils/make-mutex.d.ts +7 -0
- package/lib/Utils/messages-media.d.ts +113 -0
- package/lib/Utils/messages.d.ts +77 -0
- package/lib/Utils/messages.js +73 -12
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/process-message.d.ts +41 -0
- package/lib/Utils/signal.d.ts +33 -0
- package/lib/Utils/signal.js +11 -19
- package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
- package/lib/Utils/use-multi-file-auth-state.js +1 -7
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/lib/Utils/validate-connection.js +23 -12
- package/lib/WABinary/constants.d.ts +27 -0
- package/lib/WABinary/decode.d.ts +6 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/generic-utils.d.ts +14 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/jid-utils.d.ts +31 -0
- package/lib/WABinary/types.d.ts +18 -0
- package/lib/WAM/BinaryInfo.d.ts +8 -0
- package/lib/WAM/constants.d.ts +38 -0
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/index.d.ts +4 -0
- package/lib/WAUSync/USyncQuery.d.ts +26 -0
- package/lib/WAUSync/USyncUser.d.ts +10 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/index.js +1 -3
- package/package.json +7 -4
- package/LICENSE +0 -21
@@ -0,0 +1,56 @@
|
|
1
|
+
import { Contact } from './Contact';
|
2
|
+
export type GroupParticipant = (Contact & {
|
3
|
+
isAdmin?: boolean;
|
4
|
+
isSuperAdmin?: boolean;
|
5
|
+
admin?: 'admin' | 'superadmin' | null;
|
6
|
+
});
|
7
|
+
export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify';
|
8
|
+
export type RequestJoinAction = 'created' | 'revoked' | 'rejected';
|
9
|
+
export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined;
|
10
|
+
export interface GroupMetadata {
|
11
|
+
id: string;
|
12
|
+
owner: string | undefined;
|
13
|
+
subject: string;
|
14
|
+
/** group subject owner */
|
15
|
+
subjectOwner?: string;
|
16
|
+
/** group subject modification date */
|
17
|
+
subjectTime?: number;
|
18
|
+
creation?: number;
|
19
|
+
desc?: string;
|
20
|
+
descOwner?: string;
|
21
|
+
descId?: string;
|
22
|
+
/** if this group is part of a community, it returns the jid of the community to which it belongs */
|
23
|
+
linkedParent?: string;
|
24
|
+
/** is set when the group only allows admins to change group settings */
|
25
|
+
restrict?: boolean;
|
26
|
+
/** is set when the group only allows admins to write messages */
|
27
|
+
announce?: boolean;
|
28
|
+
/** is set when the group also allows members to add participants */
|
29
|
+
memberAddMode?: boolean;
|
30
|
+
/** Request approval to join the group */
|
31
|
+
joinApprovalMode?: boolean;
|
32
|
+
/** is this a community */
|
33
|
+
isCommunity?: boolean;
|
34
|
+
/** is this the announce of a community */
|
35
|
+
isCommunityAnnounce?: boolean;
|
36
|
+
/** number of group participants */
|
37
|
+
size?: number;
|
38
|
+
participants: GroupParticipant[];
|
39
|
+
ephemeralDuration?: number;
|
40
|
+
inviteCode?: string;
|
41
|
+
/** the person who added you to group or changed some setting in group */
|
42
|
+
author?: string;
|
43
|
+
}
|
44
|
+
export interface WAGroupCreateResponse {
|
45
|
+
status: number;
|
46
|
+
gid?: string;
|
47
|
+
participants?: [{
|
48
|
+
[key: string]: {};
|
49
|
+
}];
|
50
|
+
}
|
51
|
+
export interface GroupModificationResponse {
|
52
|
+
status: number;
|
53
|
+
participants?: {
|
54
|
+
[key: string]: {};
|
55
|
+
};
|
56
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
export interface Label {
|
2
|
+
/** Label uniq ID */
|
3
|
+
id: string;
|
4
|
+
/** Label name */
|
5
|
+
name: string;
|
6
|
+
/** Label color ID */
|
7
|
+
color: number;
|
8
|
+
/** Is label has been deleted */
|
9
|
+
deleted: boolean;
|
10
|
+
/** WhatsApp has 5 predefined labels (New customer, New order & etc) */
|
11
|
+
predefinedId?: string;
|
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
|
+
/** WhatsApp has 20 predefined colors */
|
25
|
+
export declare enum LabelColor {
|
26
|
+
Color1 = 0,
|
27
|
+
Color2 = 1,
|
28
|
+
Color3 = 2,
|
29
|
+
Color4 = 3,
|
30
|
+
Color5 = 4,
|
31
|
+
Color6 = 5,
|
32
|
+
Color7 = 6,
|
33
|
+
Color8 = 7,
|
34
|
+
Color9 = 8,
|
35
|
+
Color10 = 9,
|
36
|
+
Color11 = 10,
|
37
|
+
Color12 = 11,
|
38
|
+
Color13 = 12,
|
39
|
+
Color14 = 13,
|
40
|
+
Color15 = 14,
|
41
|
+
Color16 = 15,
|
42
|
+
Color17 = 16,
|
43
|
+
Color18 = 17,
|
44
|
+
Color19 = 18,
|
45
|
+
Color20 = 19
|
46
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/** Association type */
|
2
|
+
export declare enum LabelAssociationType {
|
3
|
+
Chat = "label_jid",
|
4
|
+
Message = "label_message"
|
5
|
+
}
|
6
|
+
export type LabelAssociationTypes = `${LabelAssociationType}`;
|
7
|
+
/** Association for chat */
|
8
|
+
export interface ChatLabelAssociation {
|
9
|
+
type: LabelAssociationType.Chat;
|
10
|
+
chatId: string;
|
11
|
+
labelId: string;
|
12
|
+
}
|
13
|
+
/** Association for message */
|
14
|
+
export interface MessageLabelAssociation {
|
15
|
+
type: LabelAssociationType.Message;
|
16
|
+
chatId: string;
|
17
|
+
messageId: string;
|
18
|
+
labelId: string;
|
19
|
+
}
|
20
|
+
export type LabelAssociation = ChatLabelAssociation | MessageLabelAssociation;
|
21
|
+
/** Body for add/remove chat label association action */
|
22
|
+
export interface ChatLabelAssociationActionBody {
|
23
|
+
labelId: string;
|
24
|
+
}
|
25
|
+
/** body for add/remove message label association action */
|
26
|
+
export interface MessageLabelAssociationActionBody {
|
27
|
+
labelId: string;
|
28
|
+
messageId: string;
|
29
|
+
}
|
@@ -0,0 +1,433 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
/// <reference types="node" />
|
4
|
+
import { AxiosRequestConfig } from 'axios';
|
5
|
+
import type { Logger } from 'pino';
|
6
|
+
import type { Readable } from 'stream';
|
7
|
+
import type { URL } from 'url';
|
8
|
+
import { BinaryNode } from '../WABinary';
|
9
|
+
import { proto } from '../../WAProto';
|
10
|
+
import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults';
|
11
|
+
import type { GroupMetadata } from './GroupMetadata';
|
12
|
+
import { CacheStore } from './Socket';
|
13
|
+
export { proto as WAProto };
|
14
|
+
export type WAMessage = proto.IWebMessageInfo;
|
15
|
+
export type WAMessageContent = proto.IMessage;
|
16
|
+
export type WAContactMessage = proto.Message.IContactMessage;
|
17
|
+
export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
|
18
|
+
export type WAMessageKey = proto.IMessageKey;
|
19
|
+
export type WATextMessage = proto.Message.IExtendedTextMessage;
|
20
|
+
export type WAContextInfo = proto.IContextInfo;
|
21
|
+
export type WALocationMessage = proto.Message.ILocationMessage;
|
22
|
+
export type WALiveLocationMessage = proto.Message.ILiveLocationMessage;
|
23
|
+
export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
|
24
|
+
export import WAMessageStubType = proto.WebMessageInfo.StubType;
|
25
|
+
export import WAMessageStatus = proto.WebMessageInfo.Status;
|
26
|
+
export type WAMediaUpload = Buffer | {
|
27
|
+
url: URL | string;
|
28
|
+
} | {
|
29
|
+
stream: Readable;
|
30
|
+
};
|
31
|
+
export import Annotations = proto.IInteractiveAnnotation;
|
32
|
+
/** Set of message types that are supported by the library */
|
33
|
+
export type MessageType = keyof proto.Message;
|
34
|
+
export type DownloadableMessage = {
|
35
|
+
mediaKey?: Uint8Array | null;
|
36
|
+
directPath?: string | null;
|
37
|
+
url?: string | null;
|
38
|
+
};
|
39
|
+
export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined;
|
40
|
+
export type MediaConnInfo = {
|
41
|
+
auth: string;
|
42
|
+
ttl: number;
|
43
|
+
hosts: {
|
44
|
+
hostname: string;
|
45
|
+
maxContentLengthBytes: number;
|
46
|
+
}[];
|
47
|
+
fetchDate: Date;
|
48
|
+
};
|
49
|
+
export interface WAUrlInfo {
|
50
|
+
'canonical-url': string;
|
51
|
+
'matched-text': string;
|
52
|
+
title: string;
|
53
|
+
description?: string;
|
54
|
+
jpegThumbnail?: Buffer;
|
55
|
+
highQualityThumbnail?: proto.Message.IImageMessage;
|
56
|
+
originalThumbnailUrl?: string;
|
57
|
+
}
|
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
|
+
type Mentionable = {
|
72
|
+
/** list of jids that are mentioned in the accompanying text */
|
73
|
+
mentions?: string[];
|
74
|
+
};
|
75
|
+
type Contextable = {
|
76
|
+
/** add contextInfo to the message */
|
77
|
+
contextInfo?: proto.IContextInfo;
|
78
|
+
};
|
79
|
+
type ViewOnce = {
|
80
|
+
viewOnce?: boolean;
|
81
|
+
};
|
82
|
+
type Buttonable = {
|
83
|
+
/** add buttons to the message */
|
84
|
+
buttons?: proto.Message.ButtonsMessage.IButton[];
|
85
|
+
};
|
86
|
+
type Templatable = {
|
87
|
+
/** add buttons to the message (conflicts with normal buttons)*/
|
88
|
+
templateButtons?: proto.IHydratedTemplateButton[];
|
89
|
+
footer?: string;
|
90
|
+
};
|
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
|
+
type Editable = {
|
121
|
+
edit?: WAMessageKey;
|
122
|
+
};
|
123
|
+
type Listable = {
|
124
|
+
/** Sections of the List */
|
125
|
+
sections?: proto.Message.ListMessage.ISection[];
|
126
|
+
/** Title of a List Message only */
|
127
|
+
title?: string;
|
128
|
+
/** Text of the button on the list (required) */
|
129
|
+
buttonText?: string;
|
130
|
+
};
|
131
|
+
type WithDimensions = {
|
132
|
+
width?: number;
|
133
|
+
height?: number;
|
134
|
+
};
|
135
|
+
export type PollMessageOptions = {
|
136
|
+
name: string;
|
137
|
+
selectableCount?: number;
|
138
|
+
values: string[];
|
139
|
+
/** 32 byte message secret to encrypt poll selections */
|
140
|
+
messageSecret?: Uint8Array;
|
141
|
+
toAnnouncementGroup?: boolean;
|
142
|
+
};
|
143
|
+
export type PollResultMessage = {
|
144
|
+
name: string;
|
145
|
+
votes: proto.Message.PollResultSnapshotMessage.PollVote[];
|
146
|
+
messageSecret?: Uint8Array;
|
147
|
+
};
|
148
|
+
type SharePhoneNumber = {
|
149
|
+
sharePhoneNumber: boolean;
|
150
|
+
};
|
151
|
+
type RequestPhoneNumber = {
|
152
|
+
requestPhoneNumber: boolean;
|
153
|
+
};
|
154
|
+
export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
|
155
|
+
productImage: WAMediaUpload;
|
156
|
+
};
|
157
|
+
export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING;
|
158
|
+
export type AnyMediaMessageContent = (({
|
159
|
+
image: WAMediaUpload;
|
160
|
+
caption?: string;
|
161
|
+
jpegThumbnail?: string;
|
162
|
+
annotations?: Annotations;
|
163
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | ({
|
164
|
+
video: WAMediaUpload;
|
165
|
+
caption?: string;
|
166
|
+
gifPlayback?: boolean;
|
167
|
+
jpegThumbnail?: string;
|
168
|
+
/** if set to true, will send as a `video note` */
|
169
|
+
ptv?: boolean;
|
170
|
+
annotations?: Annotations;
|
171
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | {
|
172
|
+
audio: WAMediaUpload;
|
173
|
+
/** if set to true, will send as a `voice note` */
|
174
|
+
ptt?: boolean;
|
175
|
+
/** optionally tell the duration of the audio */
|
176
|
+
seconds?: number;
|
177
|
+
annotations?: Annotations;
|
178
|
+
} | ({
|
179
|
+
sticker: WAMediaUpload;
|
180
|
+
isAnimated?: boolean;
|
181
|
+
annotations?: Annotations;
|
182
|
+
} & WithDimensions) | ({
|
183
|
+
document: WAMediaUpload;
|
184
|
+
mimetype: string;
|
185
|
+
fileName?: string;
|
186
|
+
caption?: string;
|
187
|
+
annotations?: Annotations;
|
188
|
+
} & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable)) & {
|
189
|
+
mimetype?: string;
|
190
|
+
} & Editable;
|
191
|
+
export type ButtonReplyInfo = {
|
192
|
+
displayText: string;
|
193
|
+
id: string;
|
194
|
+
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
|
+
};
|
221
|
+
export type PaymentInviteInfo = {
|
222
|
+
type?: number;
|
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;
|
263
|
+
};
|
264
|
+
export type AnyRegularMessageContent = (({
|
265
|
+
text: string;
|
266
|
+
linkPreview?: WAUrlInfo | null;
|
267
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable) | AnyMediaMessageContent | ({
|
268
|
+
poll: PollMessageOptions;
|
269
|
+
} | {
|
270
|
+
pollResult: PollResultMessage;
|
271
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Editable) | {
|
272
|
+
contacts: {
|
273
|
+
displayName?: string;
|
274
|
+
contacts: proto.Message.IContactMessage[];
|
275
|
+
};
|
276
|
+
} | {
|
277
|
+
location: WALocationMessage;
|
278
|
+
} | {
|
279
|
+
liveLocation: WALiveLocationMessage;
|
280
|
+
} | {
|
281
|
+
react: proto.Message.IReactionMessage;
|
282
|
+
} | {
|
283
|
+
buttonReply: ButtonReplyInfo;
|
284
|
+
type: 'template' | 'plain' | 'interactive';
|
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;
|
313
|
+
} | {
|
314
|
+
listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
|
315
|
+
} | ({
|
316
|
+
product: WASendableProduct;
|
317
|
+
businessOwnerJid?: string;
|
318
|
+
body?: string;
|
319
|
+
footer?: string;
|
320
|
+
} & Mentionable & Contextable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
|
321
|
+
export type AnyMessageContent = AnyRegularMessageContent | {
|
322
|
+
forward: WAMessage;
|
323
|
+
force?: boolean;
|
324
|
+
} | {
|
325
|
+
/** Delete your message or anyone's message in a group (admin required) */
|
326
|
+
delete: WAMessageKey;
|
327
|
+
} | {
|
328
|
+
disappearingMessagesInChat: boolean | number;
|
329
|
+
};
|
330
|
+
export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
|
331
|
+
type MinimalRelayOptions = {
|
332
|
+
/** override the message ID with a custom provided string */
|
333
|
+
messageId?: string;
|
334
|
+
/** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
|
335
|
+
cachedGroupMetadata?: (jid: string) => Promise<GroupMetadataParticipants | undefined>;
|
336
|
+
};
|
337
|
+
export type MessageRelayOptions = MinimalRelayOptions & {
|
338
|
+
/** only send to a specific participant; used when a message decryption fails for a single user */
|
339
|
+
participant?: {
|
340
|
+
jid: string;
|
341
|
+
count: number;
|
342
|
+
};
|
343
|
+
/** additional attributes to add to the WA binary node */
|
344
|
+
additionalAttributes?: {
|
345
|
+
[_: string]: string;
|
346
|
+
};
|
347
|
+
additionalNodes?: BinaryNode[];
|
348
|
+
/** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
|
349
|
+
useUserDevicesCache?: boolean;
|
350
|
+
/** jid list of participants for status@broadcast */
|
351
|
+
statusJidList?: string[];
|
352
|
+
};
|
353
|
+
export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
354
|
+
/** optional, if you want to manually set the timestamp of the message */
|
355
|
+
timestamp?: Date;
|
356
|
+
/** the message you want to quote */
|
357
|
+
quoted?: WAMessage;
|
358
|
+
additionalNodes?: BinaryNode[];
|
359
|
+
/** disappearing messages settings */
|
360
|
+
ephemeralExpiration?: number | string;
|
361
|
+
/** timeout for media upload to WA server */
|
362
|
+
mediaUploadTimeoutMs?: number;
|
363
|
+
/** jid list of participants for status@broadcast */
|
364
|
+
statusJidList?: string[];
|
365
|
+
/** backgroundcolor for status */
|
366
|
+
backgroundColor?: string;
|
367
|
+
/** font type for status */
|
368
|
+
font?: number;
|
369
|
+
/** if it is broadcast */
|
370
|
+
broadcast?: boolean;
|
371
|
+
/** delay of message time */
|
372
|
+
delay?: number;
|
373
|
+
};
|
374
|
+
export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
|
375
|
+
userJid: string;
|
376
|
+
};
|
377
|
+
export type WAMediaUploadFunctionOpts = {
|
378
|
+
fileEncSha256B64: string;
|
379
|
+
mediaType: MediaType;
|
380
|
+
newsletter?: boolean;
|
381
|
+
timeoutMs?: number;
|
382
|
+
};
|
383
|
+
export type WAMediaUploadFunction = (readStream: Readable | Buffer, opts: WAMediaUploadFunctionOpts) => Promise<{
|
384
|
+
mediaUrl: string;
|
385
|
+
directPath: string;
|
386
|
+
handle?: string;
|
387
|
+
}>;
|
388
|
+
export type MediaGenerationOptions = {
|
389
|
+
logger?: Logger;
|
390
|
+
mediaTypeOverride?: MediaType;
|
391
|
+
upload: WAMediaUploadFunction;
|
392
|
+
/** cache media so it does not have to be uploaded again */
|
393
|
+
mediaCache?: CacheStore;
|
394
|
+
mediaUploadTimeoutMs?: number;
|
395
|
+
options?: AxiosRequestConfig;
|
396
|
+
/** the message you want to quote */
|
397
|
+
quoted?: WAMessage;
|
398
|
+
backgroundColor?: string;
|
399
|
+
font?: number;
|
400
|
+
/** The message is for newsletter? */
|
401
|
+
newsletter?: boolean;
|
402
|
+
};
|
403
|
+
export type MessageContentGenerationOptions = MediaGenerationOptions & {
|
404
|
+
getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
|
405
|
+
getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
|
406
|
+
};
|
407
|
+
export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
|
408
|
+
/**
|
409
|
+
* Type of message upsert
|
410
|
+
* 1. notify => notify the user, this message was just received
|
411
|
+
* 2. append => append the message to the chat history, no notification required
|
412
|
+
*/
|
413
|
+
export type MessageUpsertType = 'append' | 'notify';
|
414
|
+
export type MessageUserReceipt = proto.IUserReceipt;
|
415
|
+
export type WAMessageUpdate = {
|
416
|
+
update: Partial<WAMessage>;
|
417
|
+
key: proto.IMessageKey;
|
418
|
+
};
|
419
|
+
export type WAMessageCursor = {
|
420
|
+
before: WAMessageKey | undefined;
|
421
|
+
} | {
|
422
|
+
after: WAMessageKey | undefined;
|
423
|
+
};
|
424
|
+
export type MessageUserReceiptUpdate = {
|
425
|
+
key: proto.IMessageKey;
|
426
|
+
receipt: MessageUserReceipt;
|
427
|
+
};
|
428
|
+
export type MediaDecryptionKeyInfo = {
|
429
|
+
iv: Buffer;
|
430
|
+
cipherKey: Buffer;
|
431
|
+
macKey?: Buffer;
|
432
|
+
};
|
433
|
+
export type MinimalMessage = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>;
|
@@ -0,0 +1,92 @@
|
|
1
|
+
import { proto } from '../../WAProto';
|
2
|
+
export type NewsletterReactionMode = 'ALL' | 'BASIC' | 'NONE';
|
3
|
+
export type NewsletterState = 'ACTIVE' | 'GEOSUSPENDED' | 'SUSPENDED';
|
4
|
+
export type NewsletterVerification = 'VERIFIED' | 'UNVERIFIED';
|
5
|
+
export type NewsletterMute = 'ON' | 'OFF' | 'UNDEFINED';
|
6
|
+
export type NewsletterViewRole = 'ADMIN' | 'GUEST' | 'OWNER' | 'SUBSCRIBER';
|
7
|
+
export type NewsletterViewerMetadata = {
|
8
|
+
mute: NewsletterMute;
|
9
|
+
view_role: NewsletterViewRole;
|
10
|
+
};
|
11
|
+
export type NewsletterMetadata = {
|
12
|
+
/**jid of newsletter */
|
13
|
+
id: string;
|
14
|
+
/**state of newsletter */
|
15
|
+
state: NewsletterState;
|
16
|
+
/**creation timestamp of newsletter */
|
17
|
+
creation_time: number;
|
18
|
+
/**name of newsletter */
|
19
|
+
name: string;
|
20
|
+
/**timestamp of last name modification of newsletter */
|
21
|
+
nameTime: number;
|
22
|
+
/**description of newsletter */
|
23
|
+
description: string;
|
24
|
+
/**timestamp of last description modification of newsletter */
|
25
|
+
descriptionTime: number;
|
26
|
+
/**invite code of newsletter */
|
27
|
+
invite: string;
|
28
|
+
/**i dont know */
|
29
|
+
handle: null;
|
30
|
+
/**direct path of picture */
|
31
|
+
picture: string | null;
|
32
|
+
/**direct path of picture preview (lower quality) */
|
33
|
+
preview: string | null;
|
34
|
+
/**reaction mode of newsletter */
|
35
|
+
reaction_codes?: NewsletterReactionMode;
|
36
|
+
/**subscribers count of newsletter */
|
37
|
+
subscribers: number;
|
38
|
+
/**verification state of newsletter */
|
39
|
+
verification: NewsletterVerification;
|
40
|
+
/**viewer metadata */
|
41
|
+
viewer_metadata: NewsletterViewerMetadata;
|
42
|
+
};
|
43
|
+
export type SubscriberAction = 'promote' | 'demote';
|
44
|
+
export type ReactionModeUpdate = {
|
45
|
+
reaction_codes: {
|
46
|
+
blocked_codes: null;
|
47
|
+
enabled_ts_sec: null;
|
48
|
+
value: NewsletterReactionMode;
|
49
|
+
};
|
50
|
+
};
|
51
|
+
/**only exists reaction mode update */
|
52
|
+
export type NewsletterSettingsUpdate = ReactionModeUpdate;
|
53
|
+
export type NewsletterReaction = {
|
54
|
+
count: number;
|
55
|
+
code: string;
|
56
|
+
};
|
57
|
+
export type NewsletterFetchedUpdate = {
|
58
|
+
/**id of message in newsletter, starts from 100 */
|
59
|
+
server_id: string;
|
60
|
+
/**count of views in this message */
|
61
|
+
views?: number;
|
62
|
+
/**reactions in this message */
|
63
|
+
reactions: NewsletterReaction[];
|
64
|
+
/**the message, if you requested only updates, you will not receive message */
|
65
|
+
message?: proto.IWebMessageInfo;
|
66
|
+
};
|
67
|
+
export declare enum MexOperations {
|
68
|
+
PROMOTE = "NotificationNewsletterAdminPromote",
|
69
|
+
DEMOTE = "NotificationNewsletterAdminDemote",
|
70
|
+
UPDATE = "NotificationNewsletterUpdate"
|
71
|
+
}
|
72
|
+
export declare enum XWAPaths {
|
73
|
+
PROMOTE = "xwa2_notify_newsletter_admin_promote",
|
74
|
+
DEMOTE = "xwa2_notify_newsletter_admin_demote",
|
75
|
+
ADMIN_COUNT = "xwa2_newsletter_admin",
|
76
|
+
CREATE = "xwa2_newsletter_create",
|
77
|
+
NEWSLETTER = "xwa2_newsletter",
|
78
|
+
METADATA_UPDATE = "xwa2_notify_newsletter_on_metadata_update"
|
79
|
+
}
|
80
|
+
export declare enum QueryIds {
|
81
|
+
JOB_MUTATION = "7150902998257522",
|
82
|
+
METADATA = "6620195908089573",
|
83
|
+
UNFOLLOW = "7238632346214362",
|
84
|
+
FOLLOW = "7871414976211147",
|
85
|
+
UNMUTE = "7337137176362961",
|
86
|
+
MUTE = "25151904754424642",
|
87
|
+
CREATE = "6996806640408138",
|
88
|
+
ADMIN_COUNT = "7130823597031706",
|
89
|
+
CHANGE_OWNER = "7341777602580933",
|
90
|
+
DELETE = "8316537688363079",
|
91
|
+
DEMOTE = "6551828931592903"
|
92
|
+
}
|