nrx-bails 0.0.1

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 (199) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1541 -0
  3. package/WAProto/GenerateStatics.sh +4 -0
  4. package/WAProto/WAProto.proto +4775 -0
  5. package/WAProto/index.d.ts +2 -0
  6. package/WAProto/index.js +169661 -0
  7. package/lib/Defaults/index.d.ts +113 -0
  8. package/lib/Defaults/index.js +156 -0
  9. package/lib/Defaults/phonenumber-mcc.json +223 -0
  10. package/lib/Defaults/ye-bail-version.json +3 -0
  11. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  12. package/lib/Signal/Group/ciphertext-message.js +41 -0
  13. package/lib/Signal/Group/group-session-builder.d.ts +8 -0
  14. package/lib/Signal/Group/group-session-builder.js +90 -0
  15. package/lib/Signal/Group/group_cipher.d.ts +12 -0
  16. package/lib/Signal/Group/group_cipher.js +122 -0
  17. package/lib/Signal/Group/index.d.ts +22 -0
  18. package/lib/Signal/Group/index.js +83 -0
  19. package/lib/Signal/Group/keyhelper.d.ts +7 -0
  20. package/lib/Signal/Group/keyhelper.js +81 -0
  21. package/lib/Signal/Group/queue-job.d.ts +3 -0
  22. package/lib/Signal/Group/queue-job.js +83 -0
  23. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  24. package/lib/Signal/Group/sender-chain-key.js +60 -0
  25. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  26. package/lib/Signal/Group/sender-key-distribution-message.js +92 -0
  27. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  28. package/lib/Signal/Group/sender-key-message.js +95 -0
  29. package/lib/Signal/Group/sender-key-name.d.ts +12 -0
  30. package/lib/Signal/Group/sender-key-name.js +77 -0
  31. package/lib/Signal/Group/sender-key-record.d.ts +13 -0
  32. package/lib/Signal/Group/sender-key-record.js +79 -0
  33. package/lib/Signal/Group/sender-key-state.d.ts +17 -0
  34. package/lib/Signal/Group/sender-key-state.js +125 -0
  35. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  36. package/lib/Signal/Group/sender-message-key.js +55 -0
  37. package/lib/Signal/libsignal.d.ts +37 -0
  38. package/lib/Signal/libsignal.js +200 -0
  39. package/lib/Socket/Client/index.d.ts +1 -0
  40. package/lib/Socket/Client/index.js +44 -0
  41. package/lib/Socket/Client/types.d.ts +7 -0
  42. package/lib/Socket/Client/types.js +39 -0
  43. package/lib/Socket/Client/websocket.d.ts +19 -0
  44. package/lib/Socket/Client/websocket.js +137 -0
  45. package/lib/Socket/business.d.ts +329 -0
  46. package/lib/Socket/business.js +286 -0
  47. package/lib/Socket/chats.d.ts +84 -0
  48. package/lib/Socket/chats.js +1022 -0
  49. package/lib/Socket/groups.d.ts +216 -0
  50. package/lib/Socket/groups.js +358 -0
  51. package/lib/Socket/index.d.ts +330 -0
  52. package/lib/Socket/index.js +36 -0
  53. package/lib/Socket/messages-recv.d.ts +271 -0
  54. package/lib/Socket/messages-recv.js +1079 -0
  55. package/lib/Socket/messages-send.d.ts +258 -0
  56. package/lib/Socket/messages-send.js +1190 -0
  57. package/lib/Socket/newsletter.d.ts +253 -0
  58. package/lib/Socket/newsletter.js +362 -0
  59. package/lib/Socket/registration.d.ts +361 -0
  60. package/lib/Socket/registration.js +179 -0
  61. package/lib/Socket/socket.d.ts +33 -0
  62. package/lib/Socket/socket.js +699 -0
  63. package/lib/Socket/usync.d.ts +27 -0
  64. package/lib/Socket/usync.js +96 -0
  65. package/lib/Store/index.d.ts +3 -0
  66. package/lib/Store/index.js +36 -0
  67. package/lib/Store/make-cache-manager-auth-state.d.ts +16 -0
  68. package/lib/Store/make-cache-manager-auth-state.js +118 -0
  69. package/lib/Store/make-in-memory-store.d.ts +64 -0
  70. package/lib/Store/make-in-memory-store.js +465 -0
  71. package/lib/Store/make-ordered-dictionary.d.ts +14 -0
  72. package/lib/Store/make-ordered-dictionary.js +107 -0
  73. package/lib/Store/object-repository.d.ts +11 -0
  74. package/lib/Store/object-repository.js +53 -0
  75. package/lib/Types/Auth.d.ts +1 -0
  76. package/lib/Types/Auth.js +28 -0
  77. package/lib/Types/Call.d.ts +1 -0
  78. package/lib/Types/Call.js +28 -0
  79. package/lib/Types/Chat.d.ts +2 -0
  80. package/lib/Types/Chat.js +30 -0
  81. package/lib/Types/Contact.d.ts +1 -0
  82. package/lib/Types/Contact.js +28 -0
  83. package/lib/Types/Events.d.ts +1 -0
  84. package/lib/Types/Events.js +28 -0
  85. package/lib/Types/GroupMetadata.d.ts +1 -0
  86. package/lib/Types/GroupMetadata.js +28 -0
  87. package/lib/Types/Label.d.ts +2 -0
  88. package/lib/Types/Label.js +53 -0
  89. package/lib/Types/LabelAssociation.d.ts +2 -0
  90. package/lib/Types/LabelAssociation.js +35 -0
  91. package/lib/Types/Message.d.ts +2 -0
  92. package/lib/Types/Message.js +33 -0
  93. package/lib/Types/Newsletter.d.ts +4 -0
  94. package/lib/Types/Newsletter.js +62 -0
  95. package/lib/Types/Product.d.ts +1 -0
  96. package/lib/Types/Product.js +28 -0
  97. package/lib/Types/Signal.d.ts +1 -0
  98. package/lib/Types/Signal.js +28 -0
  99. package/lib/Types/Socket.d.ts +1 -0
  100. package/lib/Types/Socket.js +28 -0
  101. package/lib/Types/State.d.ts +1 -0
  102. package/lib/Types/State.js +28 -0
  103. package/lib/Types/USync.d.ts +1 -0
  104. package/lib/Types/USync.js +28 -0
  105. package/lib/Types/index.d.ts +2 -0
  106. package/lib/Types/index.js +68 -0
  107. package/lib/Utils/auth-utils.d.ts +63 -0
  108. package/lib/Utils/auth-utils.js +248 -0
  109. package/lib/Utils/browser-utils.d.ts +3 -0
  110. package/lib/Utils/browser-utils.js +61 -0
  111. package/lib/Utils/business.d.ts +53 -0
  112. package/lib/Utils/business.js +260 -0
  113. package/lib/Utils/chat-utils.d.ts +253 -0
  114. package/lib/Utils/chat-utils.js +756 -0
  115. package/lib/Utils/crypto.d.ts +43 -0
  116. package/lib/Utils/crypto.js +219 -0
  117. package/lib/Utils/decode-wa-message.d.ts +61 -0
  118. package/lib/Utils/decode-wa-message.js +233 -0
  119. package/lib/Utils/event-buffer.d.ts +17 -0
  120. package/lib/Utils/event-buffer.js +544 -0
  121. package/lib/Utils/generics.d.ts +89 -0
  122. package/lib/Utils/generics.js +471 -0
  123. package/lib/Utils/history.d.ts +59 -0
  124. package/lib/Utils/history.js +120 -0
  125. package/lib/Utils/index.d.ts +1 -0
  126. package/lib/Utils/index.js +61 -0
  127. package/lib/Utils/link-preview.d.ts +19 -0
  128. package/lib/Utils/link-preview.js +152 -0
  129. package/lib/Utils/logger.d.ts +3 -0
  130. package/lib/Utils/logger.js +33 -0
  131. package/lib/Utils/lt-hash.d.ts +13 -0
  132. package/lib/Utils/lt-hash.js +77 -0
  133. package/lib/Utils/make-mutex.d.ts +7 -0
  134. package/lib/Utils/make-mutex.js +69 -0
  135. package/lib/Utils/message-retry-manager.d.ts +34 -0
  136. package/lib/Utils/message-retry-manager.js +154 -0
  137. package/lib/Utils/messages-media.d.ts +137 -0
  138. package/lib/Utils/messages-media.js +1024 -0
  139. package/lib/Utils/messages.d.ts +66 -0
  140. package/lib/Utils/messages.js +1407 -0
  141. package/lib/Utils/noise-handler.d.ts +21 -0
  142. package/lib/Utils/noise-handler.js +176 -0
  143. package/lib/Utils/pre-key-manager.d.ts +13 -0
  144. package/lib/Utils/pre-key-manager.js +93 -0
  145. package/lib/Utils/process-message.d.ts +40 -0
  146. package/lib/Utils/process-message.js +430 -0
  147. package/lib/Utils/signal.d.ts +72 -0
  148. package/lib/Utils/signal.js +179 -0
  149. package/lib/Utils/use-multi-file-auth-state.d.ts +18 -0
  150. package/lib/Utils/use-multi-file-auth-state.js +151 -0
  151. package/lib/Utils/validate-connection.d.ts +43 -0
  152. package/lib/Utils/validate-connection.js +255 -0
  153. package/lib/Utils/ye-bail-event-stream.d.ts +16 -0
  154. package/lib/Utils/ye-bail-event-stream.js +89 -0
  155. package/lib/WABinary/constants.d.ts +23 -0
  156. package/lib/WABinary/constants.js +1328 -0
  157. package/lib/WABinary/decode.d.ts +10 -0
  158. package/lib/WABinary/decode.js +291 -0
  159. package/lib/WABinary/encode.d.ts +2 -0
  160. package/lib/WABinary/encode.js +276 -0
  161. package/lib/WABinary/generic-utils.d.ts +16 -0
  162. package/lib/WABinary/generic-utils.js +155 -0
  163. package/lib/WABinary/index.d.ts +1 -0
  164. package/lib/WABinary/index.js +47 -0
  165. package/lib/WABinary/jid-utils.d.ts +34 -0
  166. package/lib/WABinary/jid-utils.js +111 -0
  167. package/lib/WABinary/types.d.ts +1 -0
  168. package/lib/WABinary/types.js +28 -0
  169. package/lib/WAM/BinaryInfo.d.ts +8 -0
  170. package/lib/WAM/BinaryInfo.js +39 -0
  171. package/lib/WAM/constants.d.ts +35374 -0
  172. package/lib/WAM/constants.js +15376 -0
  173. package/lib/WAM/encode.d.ts +2 -0
  174. package/lib/WAM/encode.js +181 -0
  175. package/lib/WAM/index.d.ts +1 -0
  176. package/lib/WAM/index.js +45 -0
  177. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +14 -0
  178. package/lib/WAUSync/Protocols/USyncContactProtocol.js +58 -0
  179. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  180. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +83 -0
  181. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  182. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +56 -0
  183. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  184. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +68 -0
  185. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
  186. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +79 -0
  187. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
  188. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +50 -0
  189. package/lib/WAUSync/Protocols/index.d.ts +1 -0
  190. package/lib/WAUSync/Protocols/index.js +46 -0
  191. package/lib/WAUSync/USyncQuery.d.ts +20 -0
  192. package/lib/WAUSync/USyncQuery.js +115 -0
  193. package/lib/WAUSync/USyncUser.d.ts +13 -0
  194. package/lib/WAUSync/USyncUser.js +52 -0
  195. package/lib/WAUSync/index.d.ts +1 -0
  196. package/lib/WAUSync/index.js +45 -0
  197. package/lib/index.js +81 -0
  198. package/package.json +113 -0
  199. package/requirements.js +32 -0
@@ -0,0 +1,329 @@
1
+ export const __esModule: boolean;
2
+ export function makeBusinessSocket(config: any): {
3
+ logger: any;
4
+ getOrderDetails: (orderId: any, tokenBase64: any) => Promise<{
5
+ price: {
6
+ total: number;
7
+ currency: any;
8
+ };
9
+ products: any;
10
+ }>;
11
+ getCatalog: ({ jid, limit, cursor }: {
12
+ jid: any;
13
+ limit: any;
14
+ cursor: any;
15
+ }) => Promise<{
16
+ products: any;
17
+ nextPageCursor: any;
18
+ }>;
19
+ getCollections: (jid: any, limit?: number) => Promise<{
20
+ collections: any;
21
+ }>;
22
+ productCreate: (create: any) => Promise<{
23
+ id: any;
24
+ imageUrls: {
25
+ requested: any;
26
+ original: any;
27
+ };
28
+ reviewStatus: {
29
+ whatsapp: any;
30
+ };
31
+ availability: string;
32
+ name: any;
33
+ retailerId: any;
34
+ url: any;
35
+ description: any;
36
+ price: number;
37
+ currency: any;
38
+ isHidden: boolean;
39
+ }>;
40
+ productDelete: (productIds: any) => Promise<{
41
+ deleted: number;
42
+ }>;
43
+ productUpdate: (productId: any, update: any) => Promise<{
44
+ id: any;
45
+ imageUrls: {
46
+ requested: any;
47
+ original: any;
48
+ };
49
+ reviewStatus: {
50
+ whatsapp: any;
51
+ };
52
+ availability: string;
53
+ name: any;
54
+ retailerId: any;
55
+ url: any;
56
+ description: any;
57
+ price: number;
58
+ currency: any;
59
+ isHidden: boolean;
60
+ }>;
61
+ sendMessageAck: ({ tag, attrs, content }: {
62
+ tag: any;
63
+ attrs: any;
64
+ content: any;
65
+ }, errorCode: any) => Promise<void>;
66
+ sendRetryRequest: (node: any, forceIncludeKeys?: boolean) => Promise<void>;
67
+ rejectCall: (callId: any, callFrom: any) => Promise<void>;
68
+ offerCall: (toJid: any, isVideo?: boolean) => Promise<{
69
+ callId: string;
70
+ toJid: any;
71
+ isVideo: boolean;
72
+ }>;
73
+ fetchMessageHistory: (count: any, oldestMsgKey: any, oldestMsgTimestamp: any) => Promise<any>;
74
+ requestPlaceholderResend: (messageKey: any) => Promise<any>;
75
+ getPrivacyTokens: (jids: any) => Promise<any>;
76
+ assertSessions: (jids: any, force: any) => Promise<boolean>;
77
+ relayMessage: (jid: any, message: any, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: {
78
+ messageId: any;
79
+ participant: any;
80
+ additionalAttributes: any;
81
+ additionalNodes: any;
82
+ useUserDevicesCache: any;
83
+ useCachedGroupMetadata: any;
84
+ statusJidList: any;
85
+ }) => Promise<any>;
86
+ sendReceipt: (jid: any, participant: any, messageIds: any, type: any) => Promise<void>;
87
+ sendReceipts: (keys: any, type: any) => Promise<void>;
88
+ readMessages: (keys: any) => Promise<void>;
89
+ refreshMediaConn: (forceGet?: boolean) => Promise<any>;
90
+ waUploadToServer: any;
91
+ fetchPrivacySettings: (force?: boolean) => Promise<any>;
92
+ getUSyncDevices: (jids: any, useCache: any, ignoreZeroDevices: any) => Promise<any[]>;
93
+ createParticipantNodes: (jids: any, message: any, extraAttrs: any) => Promise<{
94
+ nodes: any[];
95
+ shouldIncludeDeviceIdentity: boolean;
96
+ }>;
97
+ sendPeerDataOperationMessage: (pdoMessage: any) => Promise<any>;
98
+ updateMediaMessage: (message: any) => Promise<any>;
99
+ sendMessage: (jid: any, content: any, options?: {}) => Promise<any>;
100
+ newsletterFetchAllSubscribe: () => Promise<any>;
101
+ subscribeNewsletterUpdates: (jid: any) => Promise<any>;
102
+ newsletterReactionMode: (jid: any, mode: any) => Promise<void>;
103
+ newsletterUpdateDescription: (jid: any, description: any) => Promise<void>;
104
+ newsletterId: (url: any) => Promise<string>;
105
+ newsletterUpdateName: (jid: any, name: any) => Promise<void>;
106
+ newsletterUpdatePicture: (jid: any, content: any) => Promise<void>;
107
+ newsletterRemovePicture: (jid: any) => Promise<void>;
108
+ newsletterUnfollow: (jid: any) => Promise<void>;
109
+ newsletterFollow: (jid: any) => Promise<void>;
110
+ newsletterUnmute: (jid: any) => Promise<void>;
111
+ newsletterMute: (jid: any) => Promise<void>;
112
+ newsletterAction: (jid: any, type: any) => Promise<void>;
113
+ newsletterCreate: (name: any, description: any, reaction_codes: any) => Promise<{
114
+ id: any;
115
+ state: any;
116
+ creation_time: number;
117
+ name: any;
118
+ nameTime: number;
119
+ description: any;
120
+ descriptionTime: number;
121
+ invite: any;
122
+ picture: any;
123
+ preview: any;
124
+ reaction_codes: any;
125
+ subscribers: number;
126
+ verification: any;
127
+ viewer_metadata: any;
128
+ }>;
129
+ newsletterMetadata: (type: any, key: any, role: any) => Promise<{
130
+ id: any;
131
+ state: any;
132
+ creation_time: number;
133
+ name: any;
134
+ nameTime: number;
135
+ description: any;
136
+ descriptionTime: number;
137
+ invite: any;
138
+ picture: any;
139
+ preview: any;
140
+ reaction_codes: any;
141
+ subscribers: number;
142
+ verification: any;
143
+ viewer_metadata: any;
144
+ }>;
145
+ newsletterAdminCount: (jid: any) => Promise<any>;
146
+ newsletterChangeOwner: (jid: any, user: any) => Promise<void>;
147
+ newsletterPromote: (jid: any, user: any) => Promise<void>;
148
+ newsletterDemote: (jid: any, user: any) => Promise<void>;
149
+ newsletterDelete: (jid: any) => Promise<void>;
150
+ newsletterReactMessage: (jid: any, serverId: any, code: any) => Promise<void>;
151
+ newsletterFetchMessages: (type: any, key: any, count: any, after: any, since: any) => Promise<any>;
152
+ newsletterFetchUpdates: (jid: any, count: any, after: any, since: any) => Promise<any>;
153
+ newsletterSubscribers: (jid: any) => Promise<any>;
154
+ groupQuery: (jid: any, type: any, content: any) => Promise<any>;
155
+ groupMetadata: (jid: any) => Promise<{
156
+ desc: any;
157
+ descId: any;
158
+ descOwner: any;
159
+ descOwnerLid: any;
160
+ descTime: number;
161
+ linkedParent: any;
162
+ restrict: boolean;
163
+ announce: boolean;
164
+ isCommunity: boolean;
165
+ isCommunityAnnounce: boolean;
166
+ joinApprovalMode: boolean;
167
+ memberAddMode: boolean;
168
+ participants: any;
169
+ ephemeralDuration: number;
170
+ ownerLid?: any;
171
+ subjectTime: number;
172
+ size: any;
173
+ creation: number;
174
+ owner: any;
175
+ subjectOwnerLid?: any;
176
+ id: any;
177
+ addressingMode: any;
178
+ subject: any;
179
+ subjectOwner: any;
180
+ }>;
181
+ groupCreate: (subject: any, participants: any) => Promise<{
182
+ desc: any;
183
+ descId: any;
184
+ descOwner: any;
185
+ descOwnerLid: any;
186
+ descTime: number;
187
+ linkedParent: any;
188
+ restrict: boolean;
189
+ announce: boolean;
190
+ isCommunity: boolean;
191
+ isCommunityAnnounce: boolean;
192
+ joinApprovalMode: boolean;
193
+ memberAddMode: boolean;
194
+ participants: any;
195
+ ephemeralDuration: number;
196
+ ownerLid?: any;
197
+ subjectTime: number;
198
+ size: any;
199
+ creation: number;
200
+ owner: any;
201
+ subjectOwnerLid?: any;
202
+ id: any;
203
+ addressingMode: any;
204
+ subject: any;
205
+ subjectOwner: any;
206
+ }>;
207
+ groupLeave: (id: any) => Promise<void>;
208
+ groupUpdateSubject: (jid: any, subject: any) => Promise<void>;
209
+ groupRequestParticipantsList: (jid: any) => Promise<any>;
210
+ groupRequestParticipantsUpdate: (jid: any, participants: any, action: any) => Promise<any>;
211
+ groupParticipantsUpdate: (jid: any, participants: any, action: any) => Promise<any>;
212
+ groupUpdateDescription: (jid: any, description: any) => Promise<void>;
213
+ groupInviteCode: (jid: any) => Promise<any>;
214
+ groupRevokeInvite: (jid: any) => Promise<any>;
215
+ groupAcceptInvite: (code: any) => Promise<any>;
216
+ groupRevokeInviteV4: (groupJid: any, invitedJid: any) => Promise<boolean>;
217
+ groupAcceptInviteV4: any;
218
+ groupGetInviteInfo: (code: any) => Promise<{
219
+ desc: any;
220
+ descId: any;
221
+ descOwner: any;
222
+ descOwnerLid: any;
223
+ descTime: number;
224
+ linkedParent: any;
225
+ restrict: boolean;
226
+ announce: boolean;
227
+ isCommunity: boolean;
228
+ isCommunityAnnounce: boolean;
229
+ joinApprovalMode: boolean;
230
+ memberAddMode: boolean;
231
+ participants: any;
232
+ ephemeralDuration: number;
233
+ ownerLid?: any;
234
+ subjectTime: number;
235
+ size: any;
236
+ creation: number;
237
+ owner: any;
238
+ subjectOwnerLid?: any;
239
+ id: any;
240
+ addressingMode: any;
241
+ subject: any;
242
+ subjectOwner: any;
243
+ }>;
244
+ groupToggleEphemeral: (jid: any, ephemeralExpiration: any) => Promise<void>;
245
+ groupSettingUpdate: (jid: any, setting: any) => Promise<void>;
246
+ groupMemberAddMode: (jid: any, mode: any) => Promise<void>;
247
+ groupJoinApprovalMode: (jid: any, mode: any) => Promise<void>;
248
+ groupFetchAllParticipating: () => Promise<{}>;
249
+ createCallLink: (type: any, event: any, timeoutMs: any) => Promise<any>;
250
+ getBotListV2: () => Promise<{
251
+ jid: any;
252
+ personaId: any;
253
+ }[]>;
254
+ processingMutex: {
255
+ mutex(code: any): Promise<void>;
256
+ };
257
+ upsertMessage: any;
258
+ appPatch: (patchCreate: any) => Promise<void>;
259
+ sendPresenceUpdate: (type: any, toJid: any) => Promise<void>;
260
+ presenceSubscribe: (toJid: any, tcToken: any) => Promise<void>;
261
+ profilePictureUrl: (jid: any, type: string, timeoutMs: any) => Promise<any>;
262
+ onWhatsApp: (...jids: any[]) => Promise<any>;
263
+ fetchBlocklist: () => Promise<any>;
264
+ fetchDisappearingDuration: (...jids: any[]) => Promise<any>;
265
+ fetchStatus: (...jids: any[]) => Promise<any>;
266
+ updateProfilePicture: (jid: any, content: any, dimensions: any) => Promise<void>;
267
+ removeProfilePicture: (jid: any) => Promise<void>;
268
+ updateProfileStatus: (status: any) => Promise<void>;
269
+ updateProfileName: (name: any) => Promise<void>;
270
+ updateBlockStatus: (jid: any, action: any) => Promise<void>;
271
+ updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: any) => Promise<void>;
272
+ updateCallPrivacy: (value: any) => Promise<void>;
273
+ updateMessagesPrivacy: (value: any) => Promise<void>;
274
+ updateLastSeenPrivacy: (value: any) => Promise<void>;
275
+ updateOnlinePrivacy: (value: any) => Promise<void>;
276
+ updateProfilePicturePrivacy: (value: any) => Promise<void>;
277
+ updateStatusPrivacy: (value: any) => Promise<void>;
278
+ updateReadReceiptsPrivacy: (value: any) => Promise<void>;
279
+ updateGroupsAddPrivacy: (value: any) => Promise<void>;
280
+ updateDefaultDisappearingMode: (duration: any) => Promise<void>;
281
+ getBusinessProfile: (jid: any) => Promise<{
282
+ wid: any;
283
+ address: any;
284
+ description: any;
285
+ website: any[];
286
+ email: any;
287
+ category: any;
288
+ business_hours: {
289
+ timezone: any;
290
+ business_config: any;
291
+ };
292
+ }>;
293
+ resyncAppState: any;
294
+ chatModify: (mod: any, jid: any) => Promise<void>;
295
+ cleanDirtyBits: (type: any, fromTimestamp: any) => Promise<void>;
296
+ addOrEditContact: (jid: any, contact: any) => Promise<void>;
297
+ removeContact: (jid: any) => Promise<void>;
298
+ addLabel: (jid: any, labels: any) => Promise<void>;
299
+ addChatLabel: (jid: any, labelId: any) => Promise<void>;
300
+ removeChatLabel: (jid: any, labelId: any) => Promise<void>;
301
+ addMessageLabel: (jid: any, messageId: any, labelId: any) => Promise<void>;
302
+ removeMessageLabel: (jid: any, messageId: any, labelId: any) => Promise<void>;
303
+ star: (jid: any, messages: any, star: any) => Promise<void>;
304
+ checkWhatsApp: (jid: any) => Promise<string>;
305
+ executeUSyncQuery: (usyncQuery: any) => Promise<any>;
306
+ type: string;
307
+ ws: any;
308
+ ev: any;
309
+ authState: {
310
+ creds: any;
311
+ keys: any;
312
+ };
313
+ signalRepository: any;
314
+ user: any;
315
+ generateMessageTag: () => string;
316
+ query: (node: any, timeoutMs: any) => Promise<any>;
317
+ waitForMessage: (msgId: any, timeoutMs?: any) => Promise<any>;
318
+ waitForSocketOpen: () => Promise<void>;
319
+ sendRawMessage: (data: any) => Promise<void>;
320
+ sendNode: (frame: any) => Promise<void>;
321
+ logout: (msg: any) => Promise<void>;
322
+ end: (error: any) => void;
323
+ onUnexpectedError: (err: any, msg: any) => void;
324
+ uploadPreKeys: (count?: 812) => Promise<void>;
325
+ uploadPreKeysToServerIfRequired: () => Promise<void>;
326
+ requestPairingCode: (phoneNumber: any, pairCode?: string) => Promise<any>;
327
+ waitForConnectionUpdate: any;
328
+ sendWAMBuffer: (wamBuffer: any) => Promise<any>;
329
+ };
@@ -0,0 +1,286 @@
1
+ /**
2
+ * ╔═══════════════════════════════════════════════════════════╗
3
+ * ║ NEROX - WhatsApp API Library ║
4
+ * ║ Premium Edition ║
5
+ * ╚═══════════════════════════════════════════════════════════╝
6
+ *
7
+ * @package nerox-bails
8
+ * @version 0.1.0
9
+ * @author NEROX Development Team
10
+ * @copyright Copyright (c) 2025 NEROX. All rights reserved.
11
+ * @license MIT License
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining
14
+ * a copy of this software and associated documentation files (the "Software"),
15
+ * to deal in the Software without restriction, including without limitation
16
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17
+ * and/or sell copies of the Software, and to permit persons to whom the
18
+ * Software is furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included
21
+ * in all copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26
+ */
27
+ "use strict";
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.makeBusinessSocket = void 0;
30
+ const business_1 = require("../Utils/business");
31
+ const WABinary_1 = require("../WABinary");
32
+ const generic_utils_1 = require("../WABinary/generic-utils");
33
+ const messages_recv_1 = require("./messages-recv");
34
+ const makeBusinessSocket = (config) => {
35
+ const sock = (0, messages_recv_1.makeMessagesRecvSocket)(config);
36
+ const { authState, query, waUploadToServer } = sock;
37
+ const getCatalog = async ({ jid, limit, cursor }) => {
38
+ var _a;
39
+ jid = jid || ((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.id);
40
+ jid = (0, WABinary_1.jidNormalizedUser)(jid);
41
+ const queryParamNodes = [
42
+ {
43
+ tag: 'limit',
44
+ attrs: {},
45
+ content: Buffer.from((limit || 10).toString())
46
+ },
47
+ {
48
+ tag: 'width',
49
+ attrs: {},
50
+ content: Buffer.from('100')
51
+ },
52
+ {
53
+ tag: 'height',
54
+ attrs: {},
55
+ content: Buffer.from('100')
56
+ },
57
+ ];
58
+ if (cursor) {
59
+ queryParamNodes.push({
60
+ tag: 'after',
61
+ attrs: {},
62
+ content: cursor
63
+ });
64
+ }
65
+ const result = await query({
66
+ tag: 'iq',
67
+ attrs: {
68
+ to: WABinary_1.S_WHATSAPP_NET,
69
+ type: 'get',
70
+ xmlns: 'w:biz:catalog'
71
+ },
72
+ content: [
73
+ {
74
+ tag: 'product_catalog',
75
+ attrs: {
76
+ jid,
77
+ 'allow_shop_source': 'true'
78
+ },
79
+ content: queryParamNodes
80
+ }
81
+ ]
82
+ });
83
+ return (0, business_1.parseCatalogNode)(result);
84
+ };
85
+ const getCollections = async (jid, limit = 51) => {
86
+ var _a;
87
+ jid = jid || ((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.id);
88
+ jid = (0, WABinary_1.jidNormalizedUser)(jid);
89
+ const result = await query({
90
+ tag: 'iq',
91
+ attrs: {
92
+ to: WABinary_1.S_WHATSAPP_NET,
93
+ type: 'get',
94
+ xmlns: 'w:biz:catalog',
95
+ 'smax_id': '35'
96
+ },
97
+ content: [
98
+ {
99
+ tag: 'collections',
100
+ attrs: {
101
+ 'biz_jid': jid,
102
+ },
103
+ content: [
104
+ {
105
+ tag: 'collection_limit',
106
+ attrs: {},
107
+ content: Buffer.from(limit.toString())
108
+ },
109
+ {
110
+ tag: 'item_limit',
111
+ attrs: {},
112
+ content: Buffer.from(limit.toString())
113
+ },
114
+ {
115
+ tag: 'width',
116
+ attrs: {},
117
+ content: Buffer.from('100')
118
+ },
119
+ {
120
+ tag: 'height',
121
+ attrs: {},
122
+ content: Buffer.from('100')
123
+ }
124
+ ]
125
+ }
126
+ ]
127
+ });
128
+ return (0, business_1.parseCollectionsNode)(result);
129
+ };
130
+ const getOrderDetails = async (orderId, tokenBase64) => {
131
+ const result = await query({
132
+ tag: 'iq',
133
+ attrs: {
134
+ to: WABinary_1.S_WHATSAPP_NET,
135
+ type: 'get',
136
+ xmlns: 'fb:thrift_iq',
137
+ 'smax_id': '5'
138
+ },
139
+ content: [
140
+ {
141
+ tag: 'order',
142
+ attrs: {
143
+ op: 'get',
144
+ id: orderId
145
+ },
146
+ content: [
147
+ {
148
+ tag: 'image_dimensions',
149
+ attrs: {},
150
+ content: [
151
+ {
152
+ tag: 'width',
153
+ attrs: {},
154
+ content: Buffer.from('100')
155
+ },
156
+ {
157
+ tag: 'height',
158
+ attrs: {},
159
+ content: Buffer.from('100')
160
+ }
161
+ ]
162
+ },
163
+ {
164
+ tag: 'token',
165
+ attrs: {},
166
+ content: Buffer.from(tokenBase64)
167
+ }
168
+ ]
169
+ }
170
+ ]
171
+ });
172
+ return (0, business_1.parseOrderDetailsNode)(result);
173
+ };
174
+ const productUpdate = async (productId, update) => {
175
+ update = await (0, business_1.uploadingNecessaryImagesOfProduct)(update, waUploadToServer);
176
+ const editNode = (0, business_1.toProductNode)(productId, update);
177
+ const result = await query({
178
+ tag: 'iq',
179
+ attrs: {
180
+ to: WABinary_1.S_WHATSAPP_NET,
181
+ type: 'set',
182
+ xmlns: 'w:biz:catalog'
183
+ },
184
+ content: [
185
+ {
186
+ tag: 'product_catalog_edit',
187
+ attrs: { v: '1' },
188
+ content: [
189
+ editNode,
190
+ {
191
+ tag: 'width',
192
+ attrs: {},
193
+ content: '100'
194
+ },
195
+ {
196
+ tag: 'height',
197
+ attrs: {},
198
+ content: '100'
199
+ }
200
+ ]
201
+ }
202
+ ]
203
+ });
204
+ const productCatalogEditNode = (0, generic_utils_1.getBinaryNodeChild)(result, 'product_catalog_edit');
205
+ const productNode = (0, generic_utils_1.getBinaryNodeChild)(productCatalogEditNode, 'product');
206
+ return (0, business_1.parseProductNode)(productNode);
207
+ };
208
+ const productCreate = async (create) => {
209
+
210
+ create.isHidden = !!create.isHidden;
211
+ create = await (0, business_1.uploadingNecessaryImagesOfProduct)(create, waUploadToServer);
212
+ const createNode = (0, business_1.toProductNode)(undefined, create);
213
+ const result = await query({
214
+ tag: 'iq',
215
+ attrs: {
216
+ to: WABinary_1.S_WHATSAPP_NET,
217
+ type: 'set',
218
+ xmlns: 'w:biz:catalog'
219
+ },
220
+ content: [
221
+ {
222
+ tag: 'product_catalog_add',
223
+ attrs: { v: '1' },
224
+ content: [
225
+ createNode,
226
+ {
227
+ tag: 'width',
228
+ attrs: {},
229
+ content: '100'
230
+ },
231
+ {
232
+ tag: 'height',
233
+ attrs: {},
234
+ content: '100'
235
+ }
236
+ ]
237
+ }
238
+ ]
239
+ });
240
+ const productCatalogAddNode = (0, generic_utils_1.getBinaryNodeChild)(result, 'product_catalog_add');
241
+ const productNode = (0, generic_utils_1.getBinaryNodeChild)(productCatalogAddNode, 'product');
242
+ return (0, business_1.parseProductNode)(productNode);
243
+ };
244
+ const productDelete = async (productIds) => {
245
+ const result = await query({
246
+ tag: 'iq',
247
+ attrs: {
248
+ to: WABinary_1.S_WHATSAPP_NET,
249
+ type: 'set',
250
+ xmlns: 'w:biz:catalog'
251
+ },
252
+ content: [
253
+ {
254
+ tag: 'product_catalog_delete',
255
+ attrs: { v: '1' },
256
+ content: productIds.map(id => ({
257
+ tag: 'product',
258
+ attrs: {},
259
+ content: [
260
+ {
261
+ tag: 'id',
262
+ attrs: {},
263
+ content: Buffer.from(id)
264
+ }
265
+ ]
266
+ }))
267
+ }
268
+ ]
269
+ });
270
+ const productCatalogDelNode = (0, generic_utils_1.getBinaryNodeChild)(result, 'product_catalog_delete');
271
+ return {
272
+ deleted: +((productCatalogDelNode === null || productCatalogDelNode === void 0 ? void 0 : productCatalogDelNode.attrs.deleted_count) || 0)
273
+ };
274
+ };
275
+ return {
276
+ ...sock,
277
+ logger: config.logger,
278
+ getOrderDetails,
279
+ getCatalog,
280
+ getCollections,
281
+ productCreate,
282
+ productDelete,
283
+ productUpdate
284
+ };
285
+ };
286
+ exports.makeBusinessSocket = makeBusinessSocket;
@@ -0,0 +1,84 @@
1
+ export const __esModule: boolean;
2
+ export function makeChatsSocket(config: any): {
3
+ createCallLink: (type: any, event: any, timeoutMs: any) => Promise<any>;
4
+ getBotListV2: () => Promise<{
5
+ jid: any;
6
+ personaId: any;
7
+ }[]>;
8
+ processingMutex: {
9
+ mutex(code: any): Promise<void>;
10
+ };
11
+ fetchPrivacySettings: (force?: boolean) => Promise<any>;
12
+ upsertMessage: any;
13
+ appPatch: (patchCreate: any) => Promise<void>;
14
+ sendPresenceUpdate: (type: any, toJid: any) => Promise<void>;
15
+ presenceSubscribe: (toJid: any, tcToken: any) => Promise<void>;
16
+ profilePictureUrl: (jid: any, type: string, timeoutMs: any) => Promise<any>;
17
+ onWhatsApp: (...jids: any[]) => Promise<any>;
18
+ fetchBlocklist: () => Promise<any>;
19
+ fetchDisappearingDuration: (...jids: any[]) => Promise<any>;
20
+ fetchStatus: (...jids: any[]) => Promise<any>;
21
+ updateProfilePicture: (jid: any, content: any, dimensions: any) => Promise<void>;
22
+ removeProfilePicture: (jid: any) => Promise<void>;
23
+ updateProfileStatus: (status: any) => Promise<void>;
24
+ updateProfileName: (name: any) => Promise<void>;
25
+ updateBlockStatus: (jid: any, action: any) => Promise<void>;
26
+ updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: any) => Promise<void>;
27
+ updateCallPrivacy: (value: any) => Promise<void>;
28
+ updateMessagesPrivacy: (value: any) => Promise<void>;
29
+ updateLastSeenPrivacy: (value: any) => Promise<void>;
30
+ updateOnlinePrivacy: (value: any) => Promise<void>;
31
+ updateProfilePicturePrivacy: (value: any) => Promise<void>;
32
+ updateStatusPrivacy: (value: any) => Promise<void>;
33
+ updateReadReceiptsPrivacy: (value: any) => Promise<void>;
34
+ updateGroupsAddPrivacy: (value: any) => Promise<void>;
35
+ updateDefaultDisappearingMode: (duration: any) => Promise<void>;
36
+ getBusinessProfile: (jid: any) => Promise<{
37
+ wid: any;
38
+ address: any;
39
+ description: any;
40
+ website: any[];
41
+ email: any;
42
+ category: any;
43
+ business_hours: {
44
+ timezone: any;
45
+ business_config: any;
46
+ };
47
+ }>;
48
+ resyncAppState: any;
49
+ chatModify: (mod: any, jid: any) => Promise<void>;
50
+ cleanDirtyBits: (type: any, fromTimestamp: any) => Promise<void>;
51
+ addOrEditContact: (jid: any, contact: any) => Promise<void>;
52
+ removeContact: (jid: any) => Promise<void>;
53
+ addLabel: (jid: any, labels: any) => Promise<void>;
54
+ addChatLabel: (jid: any, labelId: any) => Promise<void>;
55
+ removeChatLabel: (jid: any, labelId: any) => Promise<void>;
56
+ addMessageLabel: (jid: any, messageId: any, labelId: any) => Promise<void>;
57
+ removeMessageLabel: (jid: any, messageId: any, labelId: any) => Promise<void>;
58
+ star: (jid: any, messages: any, star: any) => Promise<void>;
59
+ checkWhatsApp: (jid: any) => Promise<string>;
60
+ executeUSyncQuery: (usyncQuery: any) => Promise<any>;
61
+ type: string;
62
+ ws: any;
63
+ ev: any;
64
+ authState: {
65
+ creds: any;
66
+ keys: any;
67
+ };
68
+ signalRepository: any;
69
+ user: any;
70
+ generateMessageTag: () => string;
71
+ query: (node: any, timeoutMs: any) => Promise<any>;
72
+ waitForMessage: (msgId: any, timeoutMs?: any) => Promise<any>;
73
+ waitForSocketOpen: () => Promise<void>;
74
+ sendRawMessage: (data: any) => Promise<void>;
75
+ sendNode: (frame: any) => Promise<void>;
76
+ logout: (msg: any) => Promise<void>;
77
+ end: (error: any) => void;
78
+ onUnexpectedError: (err: any, msg: any) => void;
79
+ uploadPreKeys: (count?: 812) => Promise<void>;
80
+ uploadPreKeysToServerIfRequired: () => Promise<void>;
81
+ requestPairingCode: (phoneNumber: any, pairCode?: string) => Promise<any>;
82
+ waitForConnectionUpdate: any;
83
+ sendWAMBuffer: (wamBuffer: any) => Promise<any>;
84
+ };