@zervonexx/baileys 5.0.0 → 5.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.
- package/LICENSE +22 -22
- package/README.md +4112 -4112
- package/WAProto/WAProtoCompile.js +322 -322
- package/WAProto/fetcher.js +67 -67
- package/WAProto/index.js +95 -95
- package/WAProto/parser.js +333 -333
- package/lib/Builders/AIRich.js +673 -673
- package/lib/Builders/auto.js +49 -49
- package/lib/Builders/base.js +144 -144
- package/lib/Builders/builders.js +588 -588
- package/lib/Builders/index.js +3 -3
- package/lib/Defaults/index.js +248 -248
- package/lib/Signal/index.js +2 -2
- package/lib/Signal/libsignal.js +526 -526
- package/lib/Signal/lid-mapping.js +282 -282
- package/lib/Socket/Client/index.js +1 -1
- package/lib/Socket/Client/types.js +9 -9
- package/lib/Socket/Client/websocket.js +83 -83
- package/lib/Socket/business.js +151 -151
- package/lib/Socket/chats.js +854 -854
- package/lib/Socket/communities.js +146 -146
- package/lib/Socket/groups.js +293 -293
- package/lib/Socket/index.js +14 -14
- package/lib/Socket/messages-recv.js +993 -993
- package/lib/Socket/messages-send.js +722 -722
- package/lib/Socket/mex.js +33 -33
- package/lib/Socket/newsletter.js +783 -783
- package/lib/Socket/registration.js +154 -154
- package/lib/Socket/socket.js +797 -797
- package/lib/Socket/spam-report.js +143 -143
- package/lib/Socket/username.js +81 -81
- package/lib/Socket/zervonex-handler.js +57 -57
- package/lib/Store/index.js +6 -6
- package/lib/Store/make-cache-manager-store.js +80 -80
- package/lib/Store/make-in-memory-store.js +426 -426
- package/lib/Store/make-ordered-dictionary.js +81 -81
- package/lib/Store/object-repository.js +30 -30
- package/lib/Store/reporting-info-store.js +37 -37
- package/lib/Types/Auth.js +1 -1
- package/lib/Types/Bussines.js +1 -1
- package/lib/Types/Call.js +1 -1
- package/lib/Types/Chat.js +7 -7
- package/lib/Types/Contact.js +1 -1
- package/lib/Types/Events.js +1 -1
- package/lib/Types/GroupMetadata.js +1 -1
- package/lib/Types/Label.js +24 -24
- package/lib/Types/LabelAssociation.js +6 -6
- package/lib/Types/Message.js +14 -14
- package/lib/Types/Newsletter.js +99 -99
- package/lib/Types/Product.js +1 -1
- package/lib/Types/Signal.js +1 -1
- package/lib/Types/Socket.js +14 -14
- package/lib/Types/State.js +26 -26
- package/lib/Types/USync.js +1 -1
- package/lib/Types/index.js +30 -30
- package/lib/Utils/auth-utils.js +159 -159
- package/lib/Utils/baileys-event-stream.js +32 -32
- package/lib/Utils/bot-capabilities.js +40 -40
- package/lib/Utils/bot-planning-replay.js +43 -43
- package/lib/Utils/browser-utils.js +29 -29
- package/lib/Utils/business.js +74 -74
- package/lib/Utils/chat-utils.js +316 -316
- package/lib/Utils/companion-reg-client-utils.js +19 -19
- package/lib/Utils/consumer-application.js +37 -37
- package/lib/Utils/crypto.js +52 -52
- package/lib/Utils/cstoken.js +14 -14
- package/lib/Utils/decode-wa-message.js +199 -199
- package/lib/Utils/event-buffer.js +272 -272
- package/lib/Utils/extras.js +186 -186
- package/lib/Utils/generics.js +194 -194
- package/lib/Utils/history.js +50 -50
- package/lib/Utils/identity-change-handler.js +18 -18
- package/lib/Utils/index.js +40 -40
- package/lib/Utils/link-preview.js +50 -50
- package/lib/Utils/logger.js +2 -2
- package/lib/Utils/lt-hash.js +3 -3
- package/lib/Utils/make-mutex.js +15 -15
- package/lib/Utils/message-composer.js +61 -61
- package/lib/Utils/message-retry-manager.js +47 -47
- package/lib/Utils/messages-media.js +501 -501
- package/lib/Utils/messages.js +942 -942
- package/lib/Utils/meta-ai-msmsg.js +121 -121
- package/lib/Utils/meta-compositing.js +74 -74
- package/lib/Utils/modern-messages.js +234 -234
- package/lib/Utils/native-flow.js +80 -80
- package/lib/Utils/noise-handler.js +160 -160
- package/lib/Utils/pre-key-manager.js +75 -75
- package/lib/Utils/process-message.js +400 -400
- package/lib/Utils/reporting-utils.js +170 -170
- package/lib/Utils/signal.js +166 -166
- package/lib/Utils/spam-report-utils.js +165 -165
- package/lib/Utils/sync-action-utils.js +33 -33
- package/lib/Utils/tc-token-utils.js +153 -153
- package/lib/Utils/use-keyv-auth-state.js +199 -199
- package/lib/Utils/use-multi-file-auth-state.js +83 -83
- package/lib/Utils/validate-connection.js +171 -171
- package/lib/WABinary/constants.js +1320 -1320
- package/lib/WABinary/decode.js +151 -151
- package/lib/WABinary/encode.js +139 -139
- package/lib/WABinary/generic-utils.js +202 -202
- package/lib/WABinary/index.js +6 -6
- package/lib/WABinary/jid-utils.js +235 -235
- package/lib/WABinary/types.js +4 -4
- package/lib/WAM/BinaryInfo.js +9 -9
- package/lib/WAM/constants.js +22852 -22852
- package/lib/WAM/encode.js +149 -149
- package/lib/WAM/index.js +3 -3
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +30 -30
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +48 -48
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +23 -23
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +28 -28
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +15 -15
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +24 -24
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +9 -9
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +21 -21
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +19 -19
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +19 -19
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +22 -22
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +16 -16
- package/lib/WAUSync/Protocols/index.js +12 -12
- package/lib/WAUSync/USyncQuery.js +88 -88
- package/lib/WAUSync/USyncUser.js +20 -20
- package/lib/WAUSync/index.js +3 -3
- package/lib/index.js +66 -66
- package/package.json +191 -192
package/lib/Socket/mex.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { Boom } from '@hapi/boom'
|
|
2
|
-
import { getBinaryNodeChild, S_WHATSAPP_NET } from '../WABinary/index.js'
|
|
3
|
-
|
|
4
|
-
const wMexQuery = (variables, queryId, query, generateMessageTag) => query({
|
|
5
|
-
tag: 'iq',
|
|
6
|
-
attrs: { id: generateMessageTag(), type: 'get', to: S_WHATSAPP_NET, xmlns: 'w:mex' },
|
|
7
|
-
content: [{
|
|
8
|
-
tag: 'query',
|
|
9
|
-
attrs: { query_id: queryId },
|
|
10
|
-
content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
|
|
11
|
-
}]
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
export const executeWMexQuery = async (variables, queryId, dataPath, query, generateMessageTag) => {
|
|
15
|
-
const result = await wMexQuery(variables, queryId, query, generateMessageTag)
|
|
16
|
-
const child = getBinaryNodeChild(result, 'result')
|
|
17
|
-
if (child?.content) {
|
|
18
|
-
const data = JSON.parse(child.content.toString())
|
|
19
|
-
if (data.errors?.length > 0) {
|
|
20
|
-
const errorMessages = data.errors.map(e => e.message || 'Unknown error').join(', ')
|
|
21
|
-
const firstError = data.errors[0]
|
|
22
|
-
throw new Boom(`GraphQL server error: ${errorMessages} (${dataPath || queryId})`, {
|
|
23
|
-
statusCode: firstError.extensions?.error_code || 400,
|
|
24
|
-
data: { ...firstError, queryId, sent: variables }
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
const response = dataPath ? data?.data?.[dataPath] : data?.data
|
|
28
|
-
if (typeof response !== 'undefined') return response
|
|
29
|
-
}
|
|
30
|
-
const action = (dataPath || '').startsWith('xwa2_')
|
|
31
|
-
? dataPath.substring(5).replace(/_/g, ' ')
|
|
32
|
-
: dataPath?.replace(/_/g, ' ')
|
|
33
|
-
throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result })
|
|
1
|
+
import { Boom } from '@hapi/boom'
|
|
2
|
+
import { getBinaryNodeChild, S_WHATSAPP_NET } from '../WABinary/index.js'
|
|
3
|
+
|
|
4
|
+
const wMexQuery = (variables, queryId, query, generateMessageTag) => query({
|
|
5
|
+
tag: 'iq',
|
|
6
|
+
attrs: { id: generateMessageTag(), type: 'get', to: S_WHATSAPP_NET, xmlns: 'w:mex' },
|
|
7
|
+
content: [{
|
|
8
|
+
tag: 'query',
|
|
9
|
+
attrs: { query_id: queryId },
|
|
10
|
+
content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
|
|
11
|
+
}]
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const executeWMexQuery = async (variables, queryId, dataPath, query, generateMessageTag) => {
|
|
15
|
+
const result = await wMexQuery(variables, queryId, query, generateMessageTag)
|
|
16
|
+
const child = getBinaryNodeChild(result, 'result')
|
|
17
|
+
if (child?.content) {
|
|
18
|
+
const data = JSON.parse(child.content.toString())
|
|
19
|
+
if (data.errors?.length > 0) {
|
|
20
|
+
const errorMessages = data.errors.map(e => e.message || 'Unknown error').join(', ')
|
|
21
|
+
const firstError = data.errors[0]
|
|
22
|
+
throw new Boom(`GraphQL server error: ${errorMessages} (${dataPath || queryId})`, {
|
|
23
|
+
statusCode: firstError.extensions?.error_code || 400,
|
|
24
|
+
data: { ...firstError, queryId, sent: variables }
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
const response = dataPath ? data?.data?.[dataPath] : data?.data
|
|
28
|
+
if (typeof response !== 'undefined') return response
|
|
29
|
+
}
|
|
30
|
+
const action = (dataPath || '').startsWith('xwa2_')
|
|
31
|
+
? dataPath.substring(5).replace(/_/g, ' ')
|
|
32
|
+
: dataPath?.replace(/_/g, ' ')
|
|
33
|
+
throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result })
|
|
34
34
|
}
|