@neelegirl/baileys 1.5.3 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -195
- package/index.js +38 -0
- package/package.json +16 -96
- package/LICENSE +0 -21
- package/WAProto/WAProto.proto +0 -5308
- package/WAProto/index.d.ts +0 -61295
- package/WAProto/index.js +0 -189754
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Defaults/index.d.ts +0 -78
- package/lib/Defaults/index.js +0 -149
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/WASignalGroup/GroupProtocol.js +0 -1909
- package/lib/Signal/WASignalGroup/ciphertext-message.d.ts +0 -9
- package/lib/Signal/WASignalGroup/ciphertext-message.js +0 -19
- package/lib/Signal/WASignalGroup/ciphertext_message.js +0 -16
- package/lib/Signal/WASignalGroup/generate-proto.sh +0 -1
- package/lib/Signal/WASignalGroup/group-session-builder.d.ts +0 -17
- package/lib/Signal/WASignalGroup/group-session-builder.js +0 -72
- package/lib/Signal/WASignalGroup/group.proto +0 -42
- package/lib/Signal/WASignalGroup/group_cipher.d.ts +0 -19
- package/lib/Signal/WASignalGroup/group_cipher.js +0 -111
- package/lib/Signal/WASignalGroup/group_session_builder.js +0 -46
- package/lib/Signal/WASignalGroup/index.d.ts +0 -11
- package/lib/Signal/WASignalGroup/index.js +0 -61
- package/lib/Signal/WASignalGroup/keyhelper.d.ts +0 -16
- package/lib/Signal/WASignalGroup/keyhelper.js +0 -66
- package/lib/Signal/WASignalGroup/protobufs.js +0 -3
- package/lib/Signal/WASignalGroup/queue_job.js +0 -69
- package/lib/Signal/WASignalGroup/readme.md +0 -6
- package/lib/Signal/WASignalGroup/sender-chain-key.d.ts +0 -14
- package/lib/Signal/WASignalGroup/sender-chain-key.js +0 -47
- package/lib/Signal/WASignalGroup/sender-key-distribution-message.d.ts +0 -17
- package/lib/Signal/WASignalGroup/sender-key-distribution-message.js +0 -71
- package/lib/Signal/WASignalGroup/sender-key-message.d.ts +0 -19
- package/lib/Signal/WASignalGroup/sender-key-message.js +0 -73
- package/lib/Signal/WASignalGroup/sender-key-name.d.ts +0 -19
- package/lib/Signal/WASignalGroup/sender-key-name.js +0 -59
- package/lib/Signal/WASignalGroup/sender-key-record.d.ts +0 -32
- package/lib/Signal/WASignalGroup/sender-key-record.js +0 -58
- package/lib/Signal/WASignalGroup/sender-key-state.d.ts +0 -44
- package/lib/Signal/WASignalGroup/sender-key-state.js +0 -147
- package/lib/Signal/WASignalGroup/sender-message-key.d.ts +0 -11
- package/lib/Signal/WASignalGroup/sender-message-key.js +0 -33
- package/lib/Signal/WASignalGroup/sender_chain_key.js +0 -50
- package/lib/Signal/WASignalGroup/sender_key_distribution_message.js +0 -78
- package/lib/Signal/WASignalGroup/sender_key_message.js +0 -92
- package/lib/Signal/WASignalGroup/sender_key_name.js +0 -70
- package/lib/Signal/WASignalGroup/sender_key_record.js +0 -56
- package/lib/Signal/WASignalGroup/sender_key_state.js +0 -129
- package/lib/Signal/WASignalGroup/sender_message_key.js +0 -39
- package/lib/Signal/libsignal.d.ts +0 -8
- package/lib/Signal/libsignal.js +0 -391
- package/lib/Signal/lid-mapping.d.ts +0 -28
- package/lib/Signal/lid-mapping.js +0 -184
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -15
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/index.d.ts +0 -2
- package/lib/Socket/Client/index.js +0 -22
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -12
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/types.d.ts +0 -16
- package/lib/Socket/Client/types.js +0 -18
- package/lib/Socket/Client/websocket.d.ts +0 -13
- package/lib/Socket/Client/websocket.js +0 -62
- package/lib/Socket/business.d.ts +0 -187
- package/lib/Socket/business.js +0 -415
- package/lib/Socket/chats.d.ts +0 -97
- package/lib/Socket/chats.js +0 -1118
- package/lib/Socket/communities.d.ts +0 -223
- package/lib/Socket/communities.js +0 -433
- package/lib/Socket/groups.d.ts +0 -129
- package/lib/Socket/groups.js +0 -360
- package/lib/Socket/index.d.ts +0 -191
- package/lib/Socket/index.js +0 -24
- package/lib/Socket/messages-recv.d.ts +0 -174
- package/lib/Socket/messages-recv.js +0 -1506
- package/lib/Socket/messages-send.d.ts +0 -165
- package/lib/Socket/messages-send.js +0 -1785
- package/lib/Socket/mex.d.ts +0 -2
- package/lib/Socket/mex.js +0 -47
- package/lib/Socket/newsletter.d.ts +0 -145
- package/lib/Socket/newsletter.js +0 -295
- package/lib/Socket/socket.d.ts +0 -45
- package/lib/Socket/socket.js +0 -934
- package/lib/Socket/usync.d.ts +0 -37
- package/lib/Socket/usync.js +0 -83
- package/lib/Store/index.d.ts +0 -4
- package/lib/Store/index.js +0 -24
- package/lib/Store/make-cache-manager-store.d.ts +0 -14
- package/lib/Store/make-cache-manager-store.js +0 -90
- package/lib/Store/make-in-memory-store.d.ts +0 -123
- package/lib/Store/make-in-memory-store.js +0 -429
- package/lib/Store/make-ordered-dictionary.d.ts +0 -12
- package/lib/Store/make-ordered-dictionary.js +0 -86
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Store/object-repository.js +0 -31
- package/lib/Types/Auth.d.ts +0 -121
- package/lib/Types/Auth.js +0 -3
- package/lib/Types/Bussines.js +0 -3
- package/lib/Types/Bussiness.d.ts +0 -28
- package/lib/Types/Call.d.ts +0 -14
- package/lib/Types/Call.js +0 -3
- package/lib/Types/Chat.d.ts +0 -143
- package/lib/Types/Chat.js +0 -9
- package/lib/Types/Contact.d.ts +0 -23
- package/lib/Types/Contact.js +0 -3
- package/lib/Types/Events.d.ts +0 -226
- package/lib/Types/Events.js +0 -3
- package/lib/Types/GroupMetadata.d.ts +0 -66
- package/lib/Types/GroupMetadata.js +0 -3
- package/lib/Types/Label.d.ts +0 -48
- package/lib/Types/Label.js +0 -31
- package/lib/Types/LabelAssociation.d.ts +0 -35
- package/lib/Types/LabelAssociation.js +0 -13
- package/lib/Types/Message.d.ts +0 -484
- package/lib/Types/Message.js +0 -19
- package/lib/Types/MexUpdates.d.ts +0 -9
- package/lib/Types/MexUpdates.js +0 -18
- package/lib/Types/Newsletter.d.ts +0 -109
- package/lib/Types/Newsletter.js +0 -40
- package/lib/Types/Product.d.ts +0 -92
- package/lib/Types/Product.js +0 -3
- package/lib/Types/Signal.d.ts +0 -98
- package/lib/Types/Signal.js +0 -3
- package/lib/Types/Socket.d.ts +0 -141
- package/lib/Types/Socket.js +0 -3
- package/lib/Types/State.d.ts +0 -41
- package/lib/Types/State.js +0 -14
- package/lib/Types/USync.d.ts +0 -26
- package/lib/Types/USync.js +0 -3
- package/lib/Types/index.d.ts +0 -80
- package/lib/Types/index.js +0 -50
- package/lib/Utils/auth-utils.d.ts +0 -21
- package/lib/Utils/auth-utils.js +0 -528
- package/lib/Utils/baileys-event-stream.d.ts +0 -18
- package/lib/Utils/baileys-event-stream.js +0 -70
- package/lib/Utils/business.d.ts +0 -29
- package/lib/Utils/business.js +0 -255
- package/lib/Utils/chat-utils.d.ts +0 -82
- package/lib/Utils/chat-utils.js +0 -809
- package/lib/Utils/crypto.d.ts +0 -56
- package/lib/Utils/crypto.js +0 -189
- package/lib/Utils/decode-wa-message.d.ts +0 -53
- package/lib/Utils/decode-wa-message.js +0 -323
- package/lib/Utils/event-buffer.d.ts +0 -39
- package/lib/Utils/event-buffer.js +0 -595
- package/lib/Utils/generics.d.ts +0 -131
- package/lib/Utils/generics.js +0 -630
- package/lib/Utils/history.d.ts +0 -23
- package/lib/Utils/history.js +0 -104
- package/lib/Utils/index.d.ts +0 -20
- package/lib/Utils/index.js +0 -40
- package/lib/Utils/link-preview.d.ts +0 -23
- package/lib/Utils/link-preview.js +0 -120
- package/lib/Utils/logger.d.ts +0 -13
- package/lib/Utils/logger.js +0 -7
- package/lib/Utils/lt-hash.d.ts +0 -14
- package/lib/Utils/lt-hash.js +0 -58
- package/lib/Utils/make-mutex.d.ts +0 -9
- package/lib/Utils/make-mutex.js +0 -49
- package/lib/Utils/message-retry-manager.d.ts +0 -88
- package/lib/Utils/message-retry-manager.js +0 -160
- package/lib/Utils/messages-media.d.ts +0 -135
- package/lib/Utils/messages-media.js +0 -869
- package/lib/Utils/messages.d.ts +0 -105
- package/lib/Utils/messages.js +0 -1745
- package/lib/Utils/noise-handler.d.ts +0 -21
- package/lib/Utils/noise-handler.js +0 -165
- package/lib/Utils/process-message.d.ts +0 -49
- package/lib/Utils/process-message.js +0 -427
- package/lib/Utils/signal.d.ts +0 -42
- package/lib/Utils/signal.js +0 -166
- package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
- package/lib/Utils/use-mongo-file-auth-state.js +0 -84
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -18
- package/lib/Utils/use-multi-file-auth-state.js +0 -238
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-single-file-auth-state.js +0 -80
- package/lib/Utils/validate-connection.d.ts +0 -13
- package/lib/Utils/validate-connection.js +0 -220
- package/lib/WABinary/constants.d.ts +0 -30
- package/lib/WABinary/constants.js +0 -1316
- package/lib/WABinary/decode.d.ts +0 -9
- package/lib/WABinary/decode.js +0 -288
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/encode.js +0 -265
- package/lib/WABinary/generic-utils.d.ts +0 -28
- package/lib/WABinary/generic-utils.js +0 -142
- package/lib/WABinary/index.d.ts +0 -5
- package/lib/WABinary/index.js +0 -25
- package/lib/WABinary/jid-utils.d.ts +0 -58
- package/lib/WABinary/jid-utils.js +0 -104
- package/lib/WABinary/types.d.ts +0 -22
- package/lib/WABinary/types.js +0 -3
- package/lib/WAM/BinaryInfo.d.ts +0 -16
- package/lib/WAM/BinaryInfo.js +0 -17
- package/lib/WAM/constants.d.ts +0 -47
- package/lib/WAM/constants.js +0 -15371
- package/lib/WAM/encode.d.ts +0 -3
- package/lib/WAM/encode.js +0 -164
- package/lib/WAM/index.d.ts +0 -3
- package/lib/WAM/index.js +0 -23
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +0 -69
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -36
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -26
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -62
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -14
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -35
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -38
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -14
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -46
- package/lib/WAUSync/Protocols/index.d.ts +0 -6
- package/lib/WAUSync/Protocols/index.js +0 -26
- package/lib/WAUSync/USyncQuery.d.ts +0 -31
- package/lib/WAUSync/USyncQuery.js +0 -92
- package/lib/WAUSync/USyncUser.d.ts +0 -12
- package/lib/WAUSync/USyncUser.js +0 -30
- package/lib/WAUSync/index.d.ts +0 -3
- package/lib/WAUSync/index.js +0 -23
- package/lib/index.d.ts +0 -13
- package/lib/index.js +0 -33
package/lib/Socket/business.js
DELETED
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
|
-
|
|
5
|
-
const Utils_1 = require("../Utils")
|
|
6
|
-
const WABinary_1 = require("../WABinary")
|
|
7
|
-
const business_1 = require("../Utils/business")
|
|
8
|
-
const generic_utils_1 = require("../WABinary/generic-utils")
|
|
9
|
-
const messages_recv_1 = require("./messages-recv")
|
|
10
|
-
|
|
11
|
-
const makeBusinessSocket = (config) => {
|
|
12
|
-
const baron = messages_recv_1.makeMessagesRecvSocket(config)
|
|
13
|
-
const { authState, query, waUploadToServer } = baron
|
|
14
|
-
|
|
15
|
-
const updateBussinesProfile = async (args) => {
|
|
16
|
-
const node = []
|
|
17
|
-
const simpleFields = ['address', 'email', 'description']
|
|
18
|
-
|
|
19
|
-
node.push(...simpleFields
|
|
20
|
-
.filter(key => args[key])
|
|
21
|
-
.map(key => ({
|
|
22
|
-
tag: key,
|
|
23
|
-
attrs: {},
|
|
24
|
-
content: args[key]
|
|
25
|
-
})))
|
|
26
|
-
|
|
27
|
-
if (args.websites) {
|
|
28
|
-
|
|
29
|
-
node.push(...args.websites.map(website => ({
|
|
30
|
-
tag: 'website',
|
|
31
|
-
attrs: {},
|
|
32
|
-
content: website
|
|
33
|
-
})))
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (args.hours) {
|
|
37
|
-
|
|
38
|
-
node.push({
|
|
39
|
-
tag: 'business_hours',
|
|
40
|
-
attrs: { timezone: args.hours.timezone },
|
|
41
|
-
content: args.hours.days.map(config => {
|
|
42
|
-
const base = {
|
|
43
|
-
tag: 'business_hours_config',
|
|
44
|
-
attrs: { day_of_week: config.day, mode: config.mode }
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (config.mode === 'specific_hours') {
|
|
48
|
-
return {
|
|
49
|
-
...base,
|
|
50
|
-
attrs: {
|
|
51
|
-
...base.attrs,
|
|
52
|
-
open_time: config.openTimeInMinutes,
|
|
53
|
-
close_time: config.closeTimeInMinutes
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return base
|
|
59
|
-
})
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const result = await query({
|
|
64
|
-
tag: 'iq',
|
|
65
|
-
attrs: {
|
|
66
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
67
|
-
type: 'set',
|
|
68
|
-
xmlns: 'w:biz'
|
|
69
|
-
},
|
|
70
|
-
content: [
|
|
71
|
-
{
|
|
72
|
-
tag: 'business_profile',
|
|
73
|
-
attrs: {
|
|
74
|
-
v: '3',
|
|
75
|
-
mutation_type: 'delta'
|
|
76
|
-
},
|
|
77
|
-
content: node
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
return result
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const updateCoverPhoto = async (photo) => {
|
|
86
|
-
const { fileSha256, filePath } = await Utils_1.getRawMediaUploadData(photo, 'biz-cover-photo')
|
|
87
|
-
const fileSha256B64 = fileSha256.toString('base64')
|
|
88
|
-
|
|
89
|
-
const { meta_hmac, fbid, ts } = await waUploadToServer(filePath, {
|
|
90
|
-
fileEncSha256B64: fileSha256B64,
|
|
91
|
-
mediaType: 'biz-cover-photo'
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
await query({
|
|
95
|
-
tag: 'iq',
|
|
96
|
-
attrs: {
|
|
97
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
98
|
-
type: 'set',
|
|
99
|
-
xmlns: 'w:biz'
|
|
100
|
-
},
|
|
101
|
-
content: [
|
|
102
|
-
{
|
|
103
|
-
tag: 'business_profile',
|
|
104
|
-
attrs: {
|
|
105
|
-
v: '3',
|
|
106
|
-
mutation_type: 'delta'
|
|
107
|
-
},
|
|
108
|
-
content: [
|
|
109
|
-
{
|
|
110
|
-
tag: 'cover_photo',
|
|
111
|
-
attrs: { id: String(fbid), op: 'update', token: meta_hmac, ts: String(ts) }
|
|
112
|
-
}
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
return fbid
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const removeCoverPhoto = async (id) => {
|
|
122
|
-
return await query({
|
|
123
|
-
tag: 'iq',
|
|
124
|
-
attrs: {
|
|
125
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
126
|
-
type: 'set',
|
|
127
|
-
xmlns: 'w:biz'
|
|
128
|
-
},
|
|
129
|
-
content: [
|
|
130
|
-
{
|
|
131
|
-
tag: 'business_profile',
|
|
132
|
-
attrs: {
|
|
133
|
-
v: '3',
|
|
134
|
-
mutation_type: 'delta'
|
|
135
|
-
},
|
|
136
|
-
content: [
|
|
137
|
-
{
|
|
138
|
-
tag: 'cover_photo',
|
|
139
|
-
attrs: { op: 'delete', id }
|
|
140
|
-
}
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
]
|
|
144
|
-
})
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const getCatalog = async ({ jid, limit, cursor }) => {
|
|
148
|
-
jid = jid || authState.creds.me?.id
|
|
149
|
-
jid = WABinary_1.jidNormalizedUser(jid)
|
|
150
|
-
|
|
151
|
-
const queryParamNodes = [
|
|
152
|
-
{
|
|
153
|
-
tag: 'limit',
|
|
154
|
-
attrs: {},
|
|
155
|
-
content: Buffer.from((limit || 10).toString())
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
tag: 'width',
|
|
159
|
-
attrs: {},
|
|
160
|
-
content: Buffer.from('100')
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
tag: 'height',
|
|
164
|
-
attrs: {},
|
|
165
|
-
content: Buffer.from('100')
|
|
166
|
-
},
|
|
167
|
-
]
|
|
168
|
-
|
|
169
|
-
if (cursor) {
|
|
170
|
-
queryParamNodes.push({
|
|
171
|
-
tag: 'after',
|
|
172
|
-
attrs: {},
|
|
173
|
-
content: cursor
|
|
174
|
-
})
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const result = await query({
|
|
178
|
-
tag: 'iq',
|
|
179
|
-
attrs: {
|
|
180
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
181
|
-
type: 'get',
|
|
182
|
-
xmlns: 'w:biz:catalog'
|
|
183
|
-
},
|
|
184
|
-
content: [
|
|
185
|
-
{
|
|
186
|
-
tag: 'product_catalog',
|
|
187
|
-
attrs: {
|
|
188
|
-
jid,
|
|
189
|
-
'allow_shop_source': 'true'
|
|
190
|
-
},
|
|
191
|
-
content: queryParamNodes
|
|
192
|
-
}
|
|
193
|
-
]
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
return business_1.parseCatalogNode(result)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const getCollections = async (jid, limit = 51) => {
|
|
200
|
-
jid = jid || authState.creds.me?.id
|
|
201
|
-
jid = WABinary_1.jidNormalizedUser(jid)
|
|
202
|
-
|
|
203
|
-
const result = await query({
|
|
204
|
-
tag: 'iq',
|
|
205
|
-
attrs: {
|
|
206
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
207
|
-
type: 'get',
|
|
208
|
-
xmlns: 'w:biz:catalog',
|
|
209
|
-
'smax_id': '35'
|
|
210
|
-
},
|
|
211
|
-
content: [
|
|
212
|
-
{
|
|
213
|
-
tag: 'collections',
|
|
214
|
-
attrs: {
|
|
215
|
-
'biz_jid': jid,
|
|
216
|
-
},
|
|
217
|
-
content: [
|
|
218
|
-
{
|
|
219
|
-
tag: 'collection_limit',
|
|
220
|
-
attrs: {},
|
|
221
|
-
content: Buffer.from(limit.toString())
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
tag: 'item_limit',
|
|
225
|
-
attrs: {},
|
|
226
|
-
content: Buffer.from(limit.toString())
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
tag: 'width',
|
|
230
|
-
attrs: {},
|
|
231
|
-
content: Buffer.from('100')
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
tag: 'height',
|
|
235
|
-
attrs: {},
|
|
236
|
-
content: Buffer.from('100')
|
|
237
|
-
}
|
|
238
|
-
]
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
return business_1.parseCollectionsNode(result)
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const getOrderDetails = async (orderId, tokenBase64) => {
|
|
247
|
-
const result = await query({
|
|
248
|
-
tag: 'iq',
|
|
249
|
-
attrs: {
|
|
250
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
251
|
-
type: 'get',
|
|
252
|
-
xmlns: 'fb:thrift_iq',
|
|
253
|
-
'smax_id': '5'
|
|
254
|
-
},
|
|
255
|
-
content: [
|
|
256
|
-
{
|
|
257
|
-
tag: 'order',
|
|
258
|
-
attrs: {
|
|
259
|
-
op: 'get',
|
|
260
|
-
id: orderId
|
|
261
|
-
},
|
|
262
|
-
content: [
|
|
263
|
-
{
|
|
264
|
-
tag: 'image_dimensions',
|
|
265
|
-
attrs: {},
|
|
266
|
-
content: [
|
|
267
|
-
{
|
|
268
|
-
tag: 'width',
|
|
269
|
-
attrs: {},
|
|
270
|
-
content: Buffer.from('100')
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
tag: 'height',
|
|
274
|
-
attrs: {},
|
|
275
|
-
content: Buffer.from('100')
|
|
276
|
-
}
|
|
277
|
-
]
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
tag: 'token',
|
|
281
|
-
attrs: {},
|
|
282
|
-
content: Buffer.from(tokenBase64)
|
|
283
|
-
}
|
|
284
|
-
]
|
|
285
|
-
}
|
|
286
|
-
]
|
|
287
|
-
})
|
|
288
|
-
|
|
289
|
-
return business_1.parseOrderDetailsNode(result)
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
const productUpdate = async (productId, update) => {
|
|
293
|
-
update = await business_1.uploadingNecessaryImagesOfProduct(update, waUploadToServer)
|
|
294
|
-
const editNode = business_1.toProductNode(productId, update)
|
|
295
|
-
|
|
296
|
-
const result = await query({
|
|
297
|
-
tag: 'iq',
|
|
298
|
-
attrs: {
|
|
299
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
300
|
-
type: 'set',
|
|
301
|
-
xmlns: 'w:biz:catalog'
|
|
302
|
-
},
|
|
303
|
-
content: [
|
|
304
|
-
{
|
|
305
|
-
tag: 'product_catalog_edit',
|
|
306
|
-
attrs: { v: '1' },
|
|
307
|
-
content: [
|
|
308
|
-
editNode,
|
|
309
|
-
{
|
|
310
|
-
tag: 'width',
|
|
311
|
-
attrs: {},
|
|
312
|
-
content: '100'
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
tag: 'height',
|
|
316
|
-
attrs: {},
|
|
317
|
-
content: '100'
|
|
318
|
-
}
|
|
319
|
-
]
|
|
320
|
-
}
|
|
321
|
-
]
|
|
322
|
-
})
|
|
323
|
-
const productCatalogEditNode = generic_utils_1.getBinaryNodeChild(result, 'product_catalog_edit')
|
|
324
|
-
const productNode = generic_utils_1.getBinaryNodeChild(productCatalogEditNode, 'product')
|
|
325
|
-
return business_1.parseProductNode(productNode)
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const productCreate = async (create) => {
|
|
329
|
-
// ensure isHidden is defined
|
|
330
|
-
create.isHidden = !!create.isHidden
|
|
331
|
-
create = await business_1.uploadingNecessaryImagesOfProduct(create, waUploadToServer)
|
|
332
|
-
const createNode = business_1.toProductNode(undefined, create)
|
|
333
|
-
|
|
334
|
-
const result = await query({
|
|
335
|
-
tag: 'iq',
|
|
336
|
-
attrs: {
|
|
337
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
338
|
-
type: 'set',
|
|
339
|
-
xmlns: 'w:biz:catalog'
|
|
340
|
-
},
|
|
341
|
-
content: [
|
|
342
|
-
{
|
|
343
|
-
tag: 'product_catalog_add',
|
|
344
|
-
attrs: { v: '1' },
|
|
345
|
-
content: [
|
|
346
|
-
createNode,
|
|
347
|
-
{
|
|
348
|
-
tag: 'width',
|
|
349
|
-
attrs: {},
|
|
350
|
-
content: '100'
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
tag: 'height',
|
|
354
|
-
attrs: {},
|
|
355
|
-
content: '100'
|
|
356
|
-
}
|
|
357
|
-
]
|
|
358
|
-
}
|
|
359
|
-
]
|
|
360
|
-
})
|
|
361
|
-
const productCatalogAddNode = generic_utils_1.getBinaryNodeChild(result, 'product_catalog_add')
|
|
362
|
-
const productNode = generic_utils_1.getBinaryNodeChild(productCatalogAddNode, 'product')
|
|
363
|
-
|
|
364
|
-
return business_1.parseProductNode(productNode)
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
const productDelete = async (productIds) => {
|
|
368
|
-
const result = await query({
|
|
369
|
-
tag: 'iq',
|
|
370
|
-
attrs: {
|
|
371
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
372
|
-
type: 'set',
|
|
373
|
-
xmlns: 'w:biz:catalog'
|
|
374
|
-
},
|
|
375
|
-
content: [
|
|
376
|
-
{
|
|
377
|
-
tag: 'product_catalog_delete',
|
|
378
|
-
attrs: { v: '1' },
|
|
379
|
-
content: productIds.map(id => ({
|
|
380
|
-
tag: 'product',
|
|
381
|
-
attrs: {},
|
|
382
|
-
content: [
|
|
383
|
-
{
|
|
384
|
-
tag: 'id',
|
|
385
|
-
attrs: {},
|
|
386
|
-
content: Buffer.from(id)
|
|
387
|
-
}
|
|
388
|
-
]
|
|
389
|
-
}))
|
|
390
|
-
}
|
|
391
|
-
]
|
|
392
|
-
})
|
|
393
|
-
const productCatalogDelNode = generic_utils_1.getBinaryNodeChild(result, 'product_catalog_delete')
|
|
394
|
-
return {
|
|
395
|
-
deleted: +(productCatalogDelNode?.attrs?.deleted_count || 0)
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
return {
|
|
399
|
-
...baron,
|
|
400
|
-
logger: config.logger,
|
|
401
|
-
getOrderDetails,
|
|
402
|
-
getCatalog,
|
|
403
|
-
getCollections,
|
|
404
|
-
productCreate,
|
|
405
|
-
productDelete,
|
|
406
|
-
productUpdate,
|
|
407
|
-
updateBussinesProfile,
|
|
408
|
-
updateCoverPhoto,
|
|
409
|
-
removeCoverPhoto
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
module.exports = {
|
|
414
|
-
makeBusinessSocket
|
|
415
|
-
}
|
package/lib/Socket/chats.d.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { Boom } from '@hapi/boom'
|
|
2
|
-
import { proto } from '../../WAProto'
|
|
3
|
-
import { BotListInfo, ChatModification, ContactAction, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAPatchCreate, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyMessagesValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types'
|
|
4
|
-
import { LabelActionBody } from '../Types/Label'
|
|
5
|
-
import { QuickReplyAction } from '../Types/Bussines'
|
|
6
|
-
import { BinaryNode } from '../WABinary'
|
|
7
|
-
import { USyncQuery } from '../WAUSync'
|
|
8
|
-
|
|
9
|
-
export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
10
|
-
processingMutex: {
|
|
11
|
-
mutex<T>(code: () => T | Promise<T>): Promise<T>
|
|
12
|
-
}
|
|
13
|
-
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
14
|
-
[_: string]: string
|
|
15
|
-
}>
|
|
16
|
-
upsertMessage: (msg: proto.IWebMessageInfo, type: MessageUpsertType) => Promise<void>
|
|
17
|
-
appPatch: (patchCreate: WAPatchCreate) => Promise<void>
|
|
18
|
-
createCallLink: (type: 'audio' | 'video', event?: number, timeoutMs?: number) => Promise<void>
|
|
19
|
-
sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<void>
|
|
20
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>
|
|
21
|
-
getBotListV2: () => Promise<BotListInfo[]>
|
|
22
|
-
getLidUser: (jid: string) => Promise<{
|
|
23
|
-
lid: string
|
|
24
|
-
id: string
|
|
25
|
-
}[] | undefined>
|
|
26
|
-
fetchBlocklist: () => Promise<string[]>
|
|
27
|
-
fetchStatus: (...jids: string[]) => Promise<import("../WAUSync").USyncQueryResultList[] | undefined>
|
|
28
|
-
fetchDisappearingDuration: (...jids: string[]) => Promise<import("../WAUSync").USyncQueryResultList[] | undefined>
|
|
29
|
-
updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>
|
|
30
|
-
removeProfilePicture: (jid: string) => Promise<void>
|
|
31
|
-
updateProfileStatus: (status: string) => Promise<void>
|
|
32
|
-
updateProfileName: (name: string) => Promise<void>
|
|
33
|
-
updateBlockStatus: (jid: string, action: 'block' | 'unblock') => Promise<void>
|
|
34
|
-
updateCallPrivacy: (value: WAPrivacyCallValue) => Promise<void>
|
|
35
|
-
updateMessagesPrivacy: (value: WAPrivacyMessagesValue) => Promise<void>
|
|
36
|
-
updateLastSeenPrivacy: (value: WAPrivacyValue) => Promise<void>
|
|
37
|
-
updateOnlinePrivacy: (value: WAPrivacyOnlineValue) => Promise<void>
|
|
38
|
-
updateProfilePicturePrivacy: (value: WAPrivacyValue) => Promise<void>
|
|
39
|
-
updateStatusPrivacy: (value: WAPrivacyValue) => Promise<void>
|
|
40
|
-
updateReadReceiptsPrivacy: (value: WAReadReceiptsValue) => Promise<void>
|
|
41
|
-
updateGroupsAddPrivacy: (value: WAPrivacyGroupAddValue) => Promise<void>
|
|
42
|
-
updateDefaultDisappearingMode: (duration: number) => Promise<void>
|
|
43
|
-
updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>
|
|
44
|
-
getBusinessProfile: (jid: string) => Promise<WABusinessProfile | void>
|
|
45
|
-
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>
|
|
46
|
-
chatModify: (mod: ChatModification, jid: string) => Promise<void>
|
|
47
|
-
cleanDirtyBits: (type: 'account_sync' | 'groups', fromTimestamp?: number | string) => Promise<void>
|
|
48
|
-
addLabel: (jid: string, labels: LabelActionBody) => Promise<void>
|
|
49
|
-
addChatLabel: (jid: string, labelId: string) => Promise<void>
|
|
50
|
-
removeChatLabel: (jid: string, labelId: string) => Promise<void>
|
|
51
|
-
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
|
|
52
|
-
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
|
|
53
|
-
clearMessage: (jid: string, key: import("../Types").WAProto.IMessageKey, timeStamp: number | import("long").Long) => Promise<void>
|
|
54
|
-
star: (jid: string, messages: {
|
|
55
|
-
id: string
|
|
56
|
-
fromMe?: boolean
|
|
57
|
-
}[], star: boolean) => Promise<void>
|
|
58
|
-
addOrEditQuickReply: (quickReply: QuickReplyAction) => Promise<void>
|
|
59
|
-
removeQuickReply: (timestamp: string) => Promise<void>
|
|
60
|
-
addOrEditContact: (jid: string, contact: ContactAction) => Promise<void>
|
|
61
|
-
removeContact: (jid: string) => Promise<void>
|
|
62
|
-
executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>
|
|
63
|
-
type: "md"
|
|
64
|
-
ws: import("./Client").WebSocketClient
|
|
65
|
-
ev: import("../Types").BaileysEventEmitter & {
|
|
66
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
|
|
67
|
-
buffer(): void
|
|
68
|
-
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>
|
|
69
|
-
flush(force?: boolean | undefined): boolean
|
|
70
|
-
isBuffering(): boolean
|
|
71
|
-
}
|
|
72
|
-
authState: {
|
|
73
|
-
creds: import("../Types").AuthenticationCreds
|
|
74
|
-
keys: import("../Types").SignalKeyStoreWithTransaction
|
|
75
|
-
}
|
|
76
|
-
signalRepository: import("../Types").SignalRepository
|
|
77
|
-
user: import("../Types").Contact | undefined
|
|
78
|
-
generateMessageTag: () => string
|
|
79
|
-
query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>
|
|
80
|
-
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>
|
|
81
|
-
waitForSocketOpen: () => Promise<void>
|
|
82
|
-
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
|
|
83
|
-
sendNode: (frame: BinaryNode) => Promise<void>
|
|
84
|
-
logout: (msg?: string | undefined) => Promise<void>
|
|
85
|
-
end: (error: Error | undefined) => void
|
|
86
|
-
onUnexpectedError: (err: Error | Boom<any>, msg: string) => void
|
|
87
|
-
uploadPreKeys: (count?: number) => Promise<void>
|
|
88
|
-
uploadPreKeysToServerIfRequired: () => Promise<void>
|
|
89
|
-
requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
|
|
90
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
|
|
91
|
-
/**
|
|
92
|
-
* modify a chat -- mark unread, read etc.
|
|
93
|
-
* lastMessages must be sorted in reverse chronologically
|
|
94
|
-
* requires the last messages till the last message received required for archive & unread
|
|
95
|
-
*/
|
|
96
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
|
|
97
|
-
}
|