xhyphersockets 1.4.3 → 2.4.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.
Files changed (125) hide show
  1. package/LICENSE +1 -1
  2. package/README.MD +1295 -0
  3. package/WAProto/p.html +1 -0
  4. package/lib/Defaults/index.js +47 -35
  5. package/lib/Defaults/wileys-version.json +3 -0
  6. package/lib/Socket/chats.js +132 -125
  7. package/lib/Socket/messages-recv.js +1 -1
  8. package/lib/Socket/messages-send.js +1 -32
  9. package/lib/Socket/newsletter.js +71 -124
  10. package/lib/Socket/socket.js +1 -1
  11. package/lib/Store/make-in-memory-store.js +1 -1
  12. package/lib/Types/Newsletter.js +18 -38
  13. package/lib/Utils/browser-utils.js +35 -0
  14. package/lib/Utils/event-buffer.js +2 -2
  15. package/lib/Utils/generics.js +47 -8
  16. package/lib/Utils/index.js +3 -4
  17. package/lib/Utils/message-retry-manager.js +128 -0
  18. package/lib/Utils/messages-media.js +37 -45
  19. package/lib/Utils/messages.js +19 -0
  20. package/lib/Utils/process-message.js +19 -0
  21. package/lib/Utils/use-multi-file-auth-state.js +1 -1
  22. package/lib/Utils/validate-connection.js +77 -21
  23. package/lib/Utils/{baileys-event-stream.js → wileys-event-stream.js} +1 -1
  24. package/lib/WABinary/jid-utils.js +3 -1
  25. package/lib/index.js +12 -18
  26. package/package.json +28 -22
  27. package/README.md +0 -252
  28. package/WAProto/index.d.ts +0 -55057
  29. package/WAProto/index.ts.ts +0 -53473
  30. package/lib/Defaults/baileys-version.json +0 -3
  31. package/lib/Defaults/index.d.ts +0 -51
  32. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  33. package/lib/Signal/Group/group-session-builder.d.ts +0 -14
  34. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  35. package/lib/Signal/Group/index.d.ts +0 -11
  36. package/lib/Signal/Group/keyhelper.d.ts +0 -10
  37. package/lib/Signal/Group/queue-job.d.ts +0 -1
  38. package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
  39. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
  40. package/lib/Signal/Group/sender-key-message.d.ts +0 -18
  41. package/lib/Signal/Group/sender-key-name.d.ts +0 -17
  42. package/lib/Signal/Group/sender-key-record.d.ts +0 -30
  43. package/lib/Signal/Group/sender-key-state.d.ts +0 -38
  44. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  45. package/lib/Signal/libsignal.d.ts +0 -3
  46. package/lib/Socket/Client/index.d.ts +0 -2
  47. package/lib/Socket/Client/types.d.ts +0 -16
  48. package/lib/Socket/Client/websocket.d.ts +0 -13
  49. package/lib/Socket/RHandler.d.ts +0 -416
  50. package/lib/Socket/RHandler.js +0 -530
  51. package/lib/Socket/business.d.ts +0 -172
  52. package/lib/Socket/chats.d.ts +0 -94
  53. package/lib/Socket/groups.d.ts +0 -124
  54. package/lib/Socket/index.d.ts +0 -172
  55. package/lib/Socket/messages-recv.d.ts +0 -161
  56. package/lib/Socket/messages-send.d.ts +0 -152
  57. package/lib/Socket/newsletter.d.ts +0 -136
  58. package/lib/Socket/socket.d.ts +0 -43
  59. package/lib/Socket/usync.d.ts +0 -36
  60. package/lib/Store/index.d.ts +0 -2
  61. package/lib/Store/make-in-memory-store.d.ts +0 -118
  62. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  63. package/lib/Store/object-repository.d.ts +0 -10
  64. package/lib/Types/Auth.d.ts +0 -103
  65. package/lib/Types/Call.d.ts +0 -13
  66. package/lib/Types/Chat.d.ts +0 -109
  67. package/lib/Types/Contact.d.ts +0 -23
  68. package/lib/Types/Events.d.ts +0 -199
  69. package/lib/Types/GroupMetadata.d.ts +0 -64
  70. package/lib/Types/Label.d.ts +0 -35
  71. package/lib/Types/LabelAssociation.d.ts +0 -29
  72. package/lib/Types/Message.d.ts +0 -402
  73. package/lib/Types/Newsletter.d.ts +0 -103
  74. package/lib/Types/Product.d.ts +0 -78
  75. package/lib/Types/Signal.d.ts +0 -57
  76. package/lib/Types/Socket.d.ts +0 -119
  77. package/lib/Types/State.d.ts +0 -27
  78. package/lib/Types/USync.d.ts +0 -25
  79. package/lib/Types/index.d.ts +0 -64
  80. package/lib/Utils/audioToBuffer.js +0 -29
  81. package/lib/Utils/auth-utils.d.ts +0 -18
  82. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  83. package/lib/Utils/business.d.ts +0 -22
  84. package/lib/Utils/chat-utils.d.ts +0 -70
  85. package/lib/Utils/crypto.d.ts +0 -40
  86. package/lib/Utils/decode-wa-message.d.ts +0 -35
  87. package/lib/Utils/event-buffer.d.ts +0 -35
  88. package/lib/Utils/generics.d.ts +0 -89
  89. package/lib/Utils/history.d.ts +0 -19
  90. package/lib/Utils/index.d.ts +0 -19
  91. package/lib/Utils/link-preview.d.ts +0 -21
  92. package/lib/Utils/logger.d.ts +0 -11
  93. package/lib/Utils/lt-hash.d.ts +0 -12
  94. package/lib/Utils/make-mutex.d.ts +0 -7
  95. package/lib/Utils/messages-media.d.ts +0 -124
  96. package/lib/Utils/messages.d.ts +0 -75
  97. package/lib/Utils/noise-handler.d.ts +0 -19
  98. package/lib/Utils/process-message.d.ts +0 -42
  99. package/lib/Utils/signal.d.ts +0 -33
  100. package/lib/Utils/streamToBuffer.js +0 -15
  101. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -12
  102. package/lib/Utils/validate-connection.d.ts +0 -10
  103. package/lib/WABinary/constants.d.ts +0 -27
  104. package/lib/WABinary/decode.d.ts +0 -6
  105. package/lib/WABinary/encode.d.ts +0 -2
  106. package/lib/WABinary/generic-utils.d.ts +0 -14
  107. package/lib/WABinary/index.d.ts +0 -5
  108. package/lib/WABinary/jid-utils.d.ts +0 -36
  109. package/lib/WABinary/jid-utils.js.bak +0 -83
  110. package/lib/WABinary/types.d.ts +0 -18
  111. package/lib/WAM/BinaryInfo.d.ts +0 -8
  112. package/lib/WAM/constants.d.ts +0 -38
  113. package/lib/WAM/encode.d.ts +0 -2
  114. package/lib/WAM/index.d.ts +0 -3
  115. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
  116. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
  117. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
  118. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
  119. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
  120. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
  121. package/lib/WAUSync/Protocols/index.d.ts +0 -4
  122. package/lib/WAUSync/USyncQuery.d.ts +0 -28
  123. package/lib/WAUSync/USyncUser.d.ts +0 -12
  124. package/lib/WAUSync/index.d.ts +0 -3
  125. package/lib/index.d.ts +0 -16
@@ -1,416 +0,0 @@
1
- import { proto } from '../../WAProto';
2
-
3
- declare namespace RexxHayanasi {
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
- header?: string;
73
- title: string;
74
- footer?: string;
75
- thumbnail?: string;
76
- image?: string | Buffer | { url: string };
77
- video?: string | Buffer | { url: string };
78
- document?: string | Buffer | { url: string };
79
- mimetype?: string;
80
- fileName?: string;
81
- jpegThumbnail?: string | Buffer | { url: string };
82
- contextInfo?: {
83
- mentionedJid?: string[];
84
- forwardingScore?: number;
85
- isForwarded?: boolean;
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?: string | Buffer | { url: string; caption?: string };
120
- video?: string | Buffer | { 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
- }
149
-
150
- interface GroupStatusMessage {
151
- message?: any;
152
- image?: string | Buffer | { url: string };
153
- video?: string | Buffer | { url: string };
154
- text?: string;
155
- caption?: string;
156
- document?: string | Buffer | { url: string };
157
- [key: string]: any;
158
- }
159
-
160
- interface MessageContent {
161
- requestPaymentMessage?: PaymentMessage;
162
- productMessage?: ProductMessage;
163
- interactiveMessage?: InteractiveMessage;
164
- import { proto } from '../../WAProto';
165
-
166
- declare namespace RexxHayanasi {
167
- interface MediaUploadOptions {
168
- fileEncSha256?: Buffer;
169
- mediaType?: string;
170
- newsletter?: boolean;
171
- }
172
-
173
- type WAMediaUploadFunction = (
174
- stream: Buffer | NodeJS.ReadableStream,
175
- options?: MediaUploadOptions
176
- ) => Promise<{ url: string; directPath: string }>;
177
-
178
- interface WAMessageContentGenerationOptions {
179
- upload?: WAMediaUploadFunction;
180
- mediaCache?: any;
181
- options?: any;
182
- logger?: any;
183
- }
184
-
185
- interface StickerMessage {
186
- url: string;
187
- fileSha256: Buffer | string;
188
- fileEncSha256: Buffer | string;
189
- mediaKey: Buffer | string;
190
- mimetype: string;
191
- directPath: string;
192
- fileLength: number | string;
193
- mediaKeyTimestamp: number | string;
194
- isAnimated?: boolean;
195
- stickerSentTs?: number | string;
196
- isAvatar?: boolean;
197
- isAiSticker?: boolean;
198
- isLottie?: boolean;
199
- }
200
-
201
- interface PaymentMessage {
202
- amount: number;
203
- currency?: string;
204
- from?: string;
205
- expiry?: number;
206
- sticker?: { stickerMessage: StickerMessage };
207
- note?: string;
208
- background?: {
209
- id?: string;
210
- fileLength?: string;
211
- width?: number;
212
- height?: number;
213
- mimetype?: string;
214
- placeholderArgb?: number;
215
- textArgb?: number;
216
- subtextArgb?: number;
217
- };
218
- }
219
-
220
- interface ProductMessage {
221
- title: string;
222
- description: string;
223
- thumbnail: Buffer | { url: string };
224
- productId: string;
225
- retailerId: string;
226
- url: string;
227
- body?: string;
228
- footer?: string;
229
- buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
230
- priceAmount1000?: number | null;
231
- currencyCode?: string;
232
- }
233
-
234
- interface InteractiveMessage {
235
- header?: string;
236
- title: string;
237
- footer?: string;
238
- thumbnail?: string;
239
- image?: string | Buffer | { url: string };
240
- video?: string | Buffer | { url: string };
241
- document?: string | Buffer | { url: string };
242
- mimetype?: string;
243
- fileName?: string;
244
- jpegThumbnail?: string | Buffer | { url: string };
245
- contextInfo?: {
246
- mentionedJid?: string[];
247
- forwardingScore?: number;
248
- isForwarded?: boolean;
249
- externalAdReply?: {
250
- title?: string;
251
- body?: string;
252
- mediaType?: number;
253
- thumbnailUrl?: string;
254
- mediaUrl?: string;
255
- sourceUrl?: string;
256
- showAdAttribution?: boolean;
257
- renderLargerThumbnail?: boolean;
258
- [key: string]: any;
259
- };
260
- [key: string]: any;
261
- };
262
- externalAdReply?: {
263
- title?: string;
264
- body?: string;
265
- mediaType?: number;
266
- thumbnailUrl?: string;
267
- mediaUrl?: string;
268
- sourceUrl?: string;
269
- showAdAttribution?: boolean;
270
- renderLargerThumbnail?: boolean;
271
- [key: string]: any;
272
- };
273
- buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
274
- nativeFlowMessage?: {
275
- messageParamsJson?: string;
276
- buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
277
- [key: string]: any;
278
- };
279
- }
280
-
281
- interface AlbumItem {
282
- image?: string | Buffer | { url: string; caption?: string };
283
- video?: string | Buffer | { url: string; caption?: string };
284
- }
285
-
286
- interface EventMessageLocation {
287
- degreesLatitude: number;
288
- degreesLongitude: number;
289
- name: string;
290
- }
291
-
292
- interface EventMessage {
293
- isCanceled?: boolean;
294
- name: string;
295
- description: string;
296
- location?: EventMessageLocation;
297
- joinLink?: string;
298
- startTime?: string | number;
299
- endTime?: string | number;
300
- extraGuestsAllowed?: boolean;
301
- }
302
-
303
- interface PollVote {
304
- optionName: string;
305
- optionVoteCount: string | number;
306
- }
307
-
308
- interface PollResultMessage {
309
- name: string;
310
- pollVotes: PollVote[];
311
- }
312
-
313
- interface GroupStatusMessage {
314
- message?: any;
315
- image?: string | Buffer | { url: string };
316
- video?: string | Buffer | { url: string };
317
- text?: string;
318
- caption?: string;
319
- document?: string | Buffer | { url: string };
320
- [key: string]: any;
321
- }
322
-
323
- interface MessageContent {
324
- requestPaymentMessage?: PaymentMessage;
325
- productMessage?: ProductMessage;
326
- interactiveMessage?: InteractiveMessage;
327
- albumMessage?: AlbumItem[];
328
- eventMessage?: EventMessage;
329
- pollResultMessage?: PollResultMessage;
330
- groupStatusMessage?: GroupStatusMessage;
331
- sender?: string;
332
- }
333
-
334
- interface MessageOptions {
335
- quoted?: proto.IWebMessageInfo;
336
- filter?: boolean;
337
- }
338
-
339
- interface Utils {
340
- prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
341
- generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
342
- generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
343
- generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
344
- generateMessageID: () => string;
345
- prepareMessageContent?: (content: any, options?: any) => Promise<any>;
346
- }
347
-
348
- interface BailUtils {
349
- generateWAMessageContent?: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
350
- generateMessageID: () => string;
351
- getContentType: (msg: any) => string;
352
- }
353
- }
354
-
355
- declare class RexxHayanasi {
356
- constructor(
357
- utils: RexxHayanasi.Utils,
358
- waUploadToServer: RexxHayanasi.WAMediaUploadFunction,
359
- relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
360
- );
361
-
362
- detectType(content: RexxHayanasi.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STORY' | null;
363
-
364
- handlePayment(
365
- content: { requestPaymentMessage: RexxHayanasi.PaymentMessage },
366
- quoted?: proto.IWebMessageInfo
367
- ): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
368
-
369
- handleProduct(
370
- content: { productMessage: RexxHayanasi.ProductMessage },
371
- jid: string,
372
- quoted?: proto.IWebMessageInfo
373
- ): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
374
-
375
- handleInteractive(
376
- content: { interactiveMessage: RexxHayanasi.InteractiveMessage },
377
- jid: string,
378
- quoted?: proto.IWebMessageInfo
379
- ): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
380
-
381
- handleAlbum(
382
- content: { albumMessage: RexxHayanasi.AlbumItem[] },
383
- jid: string,
384
- quoted?: proto.IWebMessageInfo
385
- ): Promise<any>;
386
-
387
- handleEvent(
388
- content: { eventMessage: RexxHayanasi.EventMessage },
389
- jid: string,
390
- quoted?: proto.IWebMessageInfo
391
- ): Promise<any>;
392
-
393
- handlePollResult(
394
- content: { pollResultMessage: RexxHayanasi.PollResultMessage },
395
- jid: string,
396
- quoted?: proto.IWebMessageInfo
397
- ): Promise<any>;
398
-
399
- handleGroupStory(
400
- content: { groupStatusMessage: RexxHayanasi.GroupStatusMessage },
401
- jid: string,
402
- quoted?: proto.IWebMessageInfo
403
- ): Promise<any>;
404
-
405
- buildMessageContent(
406
- content: any,
407
- opts?: RexxHayanasi.WAMessageContentGenerationOptions
408
- ): Promise<any>;
409
-
410
- utils: RexxHayanasi.Utils;
411
- relayMessage: (jid: string, content: any, options?: any) => Promise<any>;
412
- waUploadToServer: RexxHayanasi.WAMediaUploadFunction;
413
- bail: RexxHayanasi.BailUtils;
414
- }
415
-
416
- export = RexxHayanasi;