riftcore 1.4.5 → 1.4.6

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.
Files changed (117) hide show
  1. package/README.md +421 -0
  2. package/WAProto/fix-import.js +29 -0
  3. package/WAProto/index.js +65432 -137443
  4. package/engine-requirements.js +10 -0
  5. package/lib/Defaults/baileys-version.json +2 -2
  6. package/lib/Defaults/index.d.ts +7 -16
  7. package/lib/Defaults/index.js +124 -94
  8. package/lib/Defaults/phonenumber-mcc.json +223 -0
  9. package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +2 -1
  10. package/lib/Socket/Client/index.d.ts +3 -2
  11. package/lib/Socket/Client/index.js +3 -2
  12. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  13. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  14. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -2
  15. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +5 -54
  16. package/lib/Socket/business.d.ts +58 -59
  17. package/lib/Socket/chats.d.ts +230 -45
  18. package/lib/Socket/chats.js +238 -139
  19. package/lib/Socket/groups.d.ts +32 -41
  20. package/lib/Socket/groups.js +87 -38
  21. package/lib/Socket/index.d.ts +64 -63
  22. package/lib/Socket/index.js +3 -2
  23. package/lib/Socket/luxu.d.ts +287 -0
  24. package/lib/Socket/luxu.js +607 -0
  25. package/lib/Socket/messages-recv.js +65 -9
  26. package/lib/Socket/messages-send.d.ts +47 -49
  27. package/lib/Socket/messages-send.js +475 -543
  28. package/lib/Socket/newsletter.d.ts +37 -39
  29. package/lib/Socket/newsletter.js +134 -88
  30. package/lib/Socket/registration.d.ts +267 -0
  31. package/lib/Socket/registration.js +166 -0
  32. package/lib/Socket/socket.d.ts +44 -270
  33. package/lib/Socket/socket.js +90 -8
  34. package/lib/Socket/usync.d.ts +3 -3
  35. package/lib/Store/index.d.ts +2 -1
  36. package/lib/Store/index.js +3 -1
  37. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  38. package/lib/Store/make-cache-manager-store.js +83 -0
  39. package/lib/Store/make-in-memory-store.d.ts +24 -24
  40. package/lib/Store/make-in-memory-store.js +14 -26
  41. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  42. package/lib/Store/make-ordered-dictionary.js +2 -2
  43. package/lib/Types/Auth.d.ts +7 -0
  44. package/lib/Types/Call.d.ts +1 -1
  45. package/lib/Types/Chat.d.ts +7 -14
  46. package/lib/Types/Contact.d.ts +1 -5
  47. package/lib/Types/Events.d.ts +2 -44
  48. package/lib/Types/GroupMetadata.d.ts +2 -11
  49. package/lib/Types/Label.js +1 -1
  50. package/lib/Types/LabelAssociation.js +1 -1
  51. package/lib/Types/Message.d.ts +21 -148
  52. package/lib/Types/Message.js +2 -0
  53. package/lib/Types/Newsletter.d.ts +97 -73
  54. package/lib/Types/Newsletter.js +38 -18
  55. package/lib/Types/Socket.d.ts +9 -17
  56. package/lib/Types/index.d.ts +1 -8
  57. package/lib/Types/index.js +2 -2
  58. package/lib/Utils/auth-utils.d.ts +3 -3
  59. package/lib/Utils/auth-utils.js +13 -6
  60. package/lib/Utils/business.js +2 -2
  61. package/lib/Utils/chat-utils.d.ts +16 -15
  62. package/lib/Utils/chat-utils.js +35 -36
  63. package/lib/Utils/crypto.d.ts +16 -15
  64. package/lib/Utils/crypto.js +29 -71
  65. package/lib/Utils/decode-wa-message.d.ts +6 -22
  66. package/lib/Utils/decode-wa-message.js +56 -65
  67. package/lib/Utils/event-buffer.d.ts +2 -2
  68. package/lib/Utils/event-buffer.js +7 -11
  69. package/lib/Utils/generics.d.ts +20 -17
  70. package/lib/Utils/generics.js +84 -102
  71. package/lib/Utils/history.d.ts +0 -4
  72. package/lib/Utils/history.js +6 -4
  73. package/lib/Utils/link-preview.d.ts +2 -2
  74. package/lib/Utils/link-preview.js +1 -34
  75. package/lib/Utils/logger.d.ts +3 -10
  76. package/lib/Utils/lt-hash.d.ts +2 -2
  77. package/lib/Utils/lt-hash.js +6 -6
  78. package/lib/Utils/make-mutex.d.ts +2 -2
  79. package/lib/Utils/messages-media.d.ts +24 -28
  80. package/lib/Utils/messages-media.js +111 -272
  81. package/lib/Utils/messages.d.ts +10 -13
  82. package/lib/Utils/messages.js +53 -338
  83. package/lib/Utils/noise-handler.d.ts +12 -10
  84. package/lib/Utils/noise-handler.js +23 -18
  85. package/lib/Utils/process-message.d.ts +4 -5
  86. package/lib/Utils/process-message.js +25 -108
  87. package/lib/Utils/signal.d.ts +1 -2
  88. package/lib/Utils/signal.js +26 -26
  89. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
  90. package/lib/Utils/use-multi-file-auth-state.js +0 -6
  91. package/lib/Utils/validate-connection.d.ts +4 -3
  92. package/lib/Utils/validate-connection.js +3 -3
  93. package/lib/WABinary/constants.d.ts +27 -24
  94. package/lib/WABinary/constants.js +13 -1276
  95. package/lib/WABinary/decode.d.ts +4 -3
  96. package/lib/WABinary/decode.js +13 -26
  97. package/lib/WABinary/encode.d.ts +2 -1
  98. package/lib/WABinary/encode.js +152 -137
  99. package/lib/WABinary/generic-utils.d.ts +4 -1
  100. package/lib/WABinary/generic-utils.js +125 -37
  101. package/lib/WABinary/jid-utils.d.ts +5 -11
  102. package/lib/WABinary/jid-utils.js +5 -28
  103. package/lib/WAM/BinaryInfo.d.ts +11 -2
  104. package/lib/WAM/encode.d.ts +2 -1
  105. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
  106. package/lib/index.d.ts +2 -6
  107. package/lib/index.js +15 -31
  108. package/package.json +101 -95
  109. package/WAProto/GenerateStatics.sh +0 -4
  110. package/WAProto/WAProto.proto +0 -4775
  111. package/WAProto/index.d.ts +0 -55057
  112. package/WAProto/index.ts.ts +0 -53473
  113. package/lib/Socket/setup.js +0 -481
  114. package/lib/Socket/setup.ts +0 -623
  115. package/lib/WABinary/jid-utils.js.bak +0 -83
  116. package/lib/WAUSync/index.d.ts +0 -3
  117. /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
@@ -0,0 +1,287 @@
1
+ import { proto } from '../../WAProto';
2
+
3
+ declare namespace imup {
4
+ interface MediaUploadOptions {
5
+ fileEncSha256?: Buffer;
6
+ mediaType?: string;
7
+ newsletter?: boolean;
8
+ }
9
+
10
+ type WAMediaUploadFunction = (
11
+ stream: Buffer | NodeJS.ReadableStream,
12
+ options?: MediaUploadOptions
13
+ ) => Promise<{ url: string; directPath: string }>;
14
+
15
+ interface WAMessageContentGenerationOptions {
16
+ upload?: WAMediaUploadFunction;
17
+ mediaCache?: any;
18
+ options?: any;
19
+ logger?: any;
20
+ }
21
+
22
+ interface StickerMessage {
23
+ url: string;
24
+ fileSha256: Buffer | string;
25
+ fileEncSha256: Buffer | string;
26
+ mediaKey: Buffer | string;
27
+ mimetype: string;
28
+ directPath: string;
29
+ fileLength: number | string;
30
+ mediaKeyTimestamp: number | string;
31
+ isAnimated?: boolean;
32
+ stickerSentTs?: number | string;
33
+ isAvatar?: boolean;
34
+ isAiSticker?: boolean;
35
+ isLottie?: boolean;
36
+ }
37
+
38
+ interface PaymentMessage {
39
+ amount: number;
40
+ currency?: string;
41
+ from?: string;
42
+ expiry?: number;
43
+ sticker?: { stickerMessage: StickerMessage };
44
+ note?: string;
45
+ background?: {
46
+ id?: string;
47
+ fileLength?: string;
48
+ width?: number;
49
+ height?: number;
50
+ mimetype?: string;
51
+ placeholderArgb?: number;
52
+ textArgb?: number;
53
+ subtextArgb?: number;
54
+ };
55
+ }
56
+
57
+ interface ProductMessage {
58
+ title: string;
59
+ description: string;
60
+ thumbnail: Buffer | { url: string };
61
+ productId: string;
62
+ retailerId: string;
63
+ url: string;
64
+ body?: string;
65
+ footer?: string;
66
+ buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
67
+ priceAmount1000?: number | null;
68
+ currencyCode?: string;
69
+ }
70
+
71
+ interface InteractiveMessage {
72
+ title: string;
73
+ footer?: string;
74
+ thumbnail?: string;
75
+ image?: string | Buffer | { url: string };
76
+ video?: string | Buffer | { url: string };
77
+ document?: Buffer;
78
+ mimetype?: string;
79
+ fileName?: string;
80
+ jpegThumbnail?: Buffer;
81
+ contextInfo?: {
82
+ mentionedJid?: string[];
83
+ forwardingScore?: number;
84
+ isForwarded?: boolean;
85
+ forwardedNewsletterMessageInfo?: proto.Message.ContextInfo.ForwardedNewsletterMessageInfo;
86
+ externalAdReply?: {
87
+ title?: string;
88
+ body?: string;
89
+ mediaType?: number;
90
+ thumbnailUrl?: string;
91
+ mediaUrl?: string;
92
+ sourceUrl?: string;
93
+ showAdAttribution?: boolean;
94
+ renderLargerThumbnail?: boolean;
95
+ [key: string]: any;
96
+ };
97
+ [key: string]: any;
98
+ };
99
+ externalAdReply?: {
100
+ title?: string;
101
+ body?: string;
102
+ mediaType?: number;
103
+ thumbnailUrl?: string;
104
+ mediaUrl?: string;
105
+ sourceUrl?: string;
106
+ showAdAttribution?: boolean;
107
+ renderLargerThumbnail?: boolean;
108
+ [key: string]: any;
109
+ };
110
+ buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
111
+ nativeFlowMessage?: {
112
+ messageParamsJson?: string;
113
+ buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
114
+ [key: string]: any;
115
+ };
116
+ }
117
+
118
+ interface AlbumItem {
119
+ image?: { url: string; caption?: string };
120
+ video?: { url: string; caption?: string };
121
+ }
122
+
123
+ interface EventMessageLocation {
124
+ degreesLatitude: number;
125
+ degreesLongitude: number;
126
+ name: string;
127
+ }
128
+
129
+ interface EventMessage {
130
+ isCanceled?: boolean;
131
+ name: string;
132
+ description: string;
133
+ location?: EventMessageLocation;
134
+ joinLink?: string;
135
+ startTime?: string | number;
136
+ endTime?: string | number;
137
+ extraGuestsAllowed?: boolean;
138
+ }
139
+
140
+ interface PollVote {
141
+ optionName: string;
142
+ optionVoteCount: string | number;
143
+ }
144
+
145
+ interface PollResultMessage {
146
+ name: string;
147
+ pollVotes: PollVote[];
148
+ newsletter?: {
149
+ newsletterName: string;
150
+ newsletterJid: string;
151
+ };
152
+ }
153
+
154
+ interface StatusMention {
155
+ message?: any;
156
+ image?: string | Buffer | { url: string };
157
+ video?: string | Buffer | { url: string };
158
+ text?: string;
159
+ caption?: string;
160
+ document?: string | Buffer | { url: string };
161
+ mentions: string[];
162
+ }
163
+
164
+ interface OrderMessage {
165
+ thumbnail?: Buffer | string,
166
+ itemCount?: string | number,
167
+ message: string,
168
+ orderTitle: string,
169
+ totalAmount1000?: string | number,
170
+ totalCurrencyCode?: string
171
+ }
172
+
173
+ interface GroupStatus {
174
+ message?: any;
175
+ image?: string | Buffer | { url: string };
176
+ video?: string | Buffer | { url: string };
177
+ text?: string;
178
+ caption?: string;
179
+ document?: string | Buffer | { url: string };
180
+ [key: string]: any;
181
+ }
182
+
183
+ interface GroupLabel {
184
+ labelText: string;
185
+ }
186
+
187
+ interface MessageContent {
188
+ requestPaymentMessage?: PaymentMessage;
189
+ productMessage?: ProductMessage;
190
+ interactiveMessage?: InteractiveMessage;
191
+ albumMessage?: AlbumItem[];
192
+ eventMessage?: EventMessage;
193
+ pollResultMessage?: PollResultMessage;
194
+ groupStatus?: GroupStatus;
195
+ orderMessage?: OrderMessage;
196
+ groupLabel?: GroupLabel;
197
+ sender?: string;
198
+ }
199
+
200
+ interface MessageOptions {
201
+ quoted?: proto.IWebMessageInfo;
202
+ filter?: boolean;
203
+ }
204
+
205
+ interface Utils {
206
+ prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
207
+ generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
208
+ generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
209
+ generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
210
+ generateMessageID: () => string;
211
+ }
212
+ }
213
+
214
+ declare class imup {
215
+ constructor(
216
+ utils: imup.Utils,
217
+ waUploadToServer: imup.WAMediaUploadFunction,
218
+ relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
219
+ );
220
+
221
+ detectType(content: imup.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STATUS' | 'ORDER' | 'GROUP_LABEL' |null;
222
+
223
+ handlePayment(
224
+ content: { requestPaymentMessage: imup.PaymentMessage },
225
+ quoted?: proto.IWebMessageInfo
226
+ ): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
227
+
228
+ handleProduct(
229
+ content: { productMessage: imup.ProductMessage },
230
+ jid: string,
231
+ quoted?: proto.IWebMessageInfo
232
+ ): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
233
+
234
+ handleInteractive(
235
+ content: { interactiveMessage: imup.InteractiveMessage },
236
+ jid: string,
237
+ quoted?: proto.IWebMessageInfo
238
+ ): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
239
+
240
+ handleAlbum(
241
+ content: { albumMessage: imup.AlbumItem[] },
242
+ jid: string,
243
+ quoted?: proto.IWebMessageInfo
244
+ ): Promise<any>;
245
+
246
+ handleEvent(
247
+ content: { eventMessage: imup.EventMessage },
248
+ jid: string,
249
+ quoted?: proto.IWebMessageInfo
250
+ ): Promise<any>;
251
+
252
+ handlePollResult(
253
+ content: { pollResultMessage: imup.PollResultMessage },
254
+ jid: string,
255
+ quoted?: proto.IWebMessageInfo
256
+ ): Promise<any>;
257
+
258
+ handleStMention(
259
+ content: { statusMentionMessage: imup.StatusMentionMessage },
260
+ jid: string,
261
+ quoted?: proto.IWebMessageInfo
262
+ ): Promise<any>;
263
+
264
+ handleOrderMessage(
265
+ content: { orderMessage: imup.OrderMessage },
266
+ jid: string,
267
+ quoted?: proto.IWebMessageInfo
268
+ ): Promise<any>;
269
+
270
+ handleGroupStory(
271
+ content: { groupStatus: imup.GroupStatus },
272
+ jid: string,
273
+ quoted?: proto.IWebMessageInfo
274
+ ): Promise<any>;
275
+
276
+ handleGbLabel(
277
+ content: { groupLabel: imup.GroupLabel },
278
+ jid: string,
279
+ ): Promise<any>;
280
+
281
+ handleStatusMention(
282
+ content: { statusMention: imup.StatusMention },
283
+ jid: string,
284
+ ): Promise<any>;
285
+ }
286
+
287
+ export = imup;