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.
- package/LICENSE +21 -0
- package/README.md +1541 -0
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +4775 -0
- package/WAProto/index.d.ts +2 -0
- package/WAProto/index.js +169661 -0
- package/lib/Defaults/index.d.ts +113 -0
- package/lib/Defaults/index.js +156 -0
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Defaults/ye-bail-version.json +3 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.js +41 -0
- package/lib/Signal/Group/group-session-builder.d.ts +8 -0
- package/lib/Signal/Group/group-session-builder.js +90 -0
- package/lib/Signal/Group/group_cipher.d.ts +12 -0
- package/lib/Signal/Group/group_cipher.js +122 -0
- package/lib/Signal/Group/index.d.ts +22 -0
- package/lib/Signal/Group/index.js +83 -0
- package/lib/Signal/Group/keyhelper.d.ts +7 -0
- package/lib/Signal/Group/keyhelper.js +81 -0
- package/lib/Signal/Group/queue-job.d.ts +3 -0
- package/lib/Signal/Group/queue-job.js +83 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.js +60 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +92 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.js +95 -0
- package/lib/Signal/Group/sender-key-name.d.ts +12 -0
- package/lib/Signal/Group/sender-key-name.js +77 -0
- package/lib/Signal/Group/sender-key-record.d.ts +13 -0
- package/lib/Signal/Group/sender-key-record.js +79 -0
- package/lib/Signal/Group/sender-key-state.d.ts +17 -0
- package/lib/Signal/Group/sender-key-state.js +125 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.js +55 -0
- package/lib/Signal/libsignal.d.ts +37 -0
- package/lib/Signal/libsignal.js +200 -0
- package/lib/Socket/Client/index.d.ts +1 -0
- package/lib/Socket/Client/index.js +44 -0
- package/lib/Socket/Client/types.d.ts +7 -0
- package/lib/Socket/Client/types.js +39 -0
- package/lib/Socket/Client/websocket.d.ts +19 -0
- package/lib/Socket/Client/websocket.js +137 -0
- package/lib/Socket/business.d.ts +329 -0
- package/lib/Socket/business.js +286 -0
- package/lib/Socket/chats.d.ts +84 -0
- package/lib/Socket/chats.js +1022 -0
- package/lib/Socket/groups.d.ts +216 -0
- package/lib/Socket/groups.js +358 -0
- package/lib/Socket/index.d.ts +330 -0
- package/lib/Socket/index.js +36 -0
- package/lib/Socket/messages-recv.d.ts +271 -0
- package/lib/Socket/messages-recv.js +1079 -0
- package/lib/Socket/messages-send.d.ts +258 -0
- package/lib/Socket/messages-send.js +1190 -0
- package/lib/Socket/newsletter.d.ts +253 -0
- package/lib/Socket/newsletter.js +362 -0
- package/lib/Socket/registration.d.ts +361 -0
- package/lib/Socket/registration.js +179 -0
- package/lib/Socket/socket.d.ts +33 -0
- package/lib/Socket/socket.js +699 -0
- package/lib/Socket/usync.d.ts +27 -0
- package/lib/Socket/usync.js +96 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +36 -0
- package/lib/Store/make-cache-manager-auth-state.d.ts +16 -0
- package/lib/Store/make-cache-manager-auth-state.js +118 -0
- package/lib/Store/make-in-memory-store.d.ts +64 -0
- package/lib/Store/make-in-memory-store.js +465 -0
- package/lib/Store/make-ordered-dictionary.d.ts +14 -0
- package/lib/Store/make-ordered-dictionary.js +107 -0
- package/lib/Store/object-repository.d.ts +11 -0
- package/lib/Store/object-repository.js +53 -0
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Auth.js +28 -0
- package/lib/Types/Call.d.ts +1 -0
- package/lib/Types/Call.js +28 -0
- package/lib/Types/Chat.d.ts +2 -0
- package/lib/Types/Chat.js +30 -0
- package/lib/Types/Contact.d.ts +1 -0
- package/lib/Types/Contact.js +28 -0
- package/lib/Types/Events.d.ts +1 -0
- package/lib/Types/Events.js +28 -0
- package/lib/Types/GroupMetadata.d.ts +1 -0
- package/lib/Types/GroupMetadata.js +28 -0
- package/lib/Types/Label.d.ts +2 -0
- package/lib/Types/Label.js +53 -0
- package/lib/Types/LabelAssociation.d.ts +2 -0
- package/lib/Types/LabelAssociation.js +35 -0
- package/lib/Types/Message.d.ts +2 -0
- package/lib/Types/Message.js +33 -0
- package/lib/Types/Newsletter.d.ts +4 -0
- package/lib/Types/Newsletter.js +62 -0
- package/lib/Types/Product.d.ts +1 -0
- package/lib/Types/Product.js +28 -0
- package/lib/Types/Signal.d.ts +1 -0
- package/lib/Types/Signal.js +28 -0
- package/lib/Types/Socket.d.ts +1 -0
- package/lib/Types/Socket.js +28 -0
- package/lib/Types/State.d.ts +1 -0
- package/lib/Types/State.js +28 -0
- package/lib/Types/USync.d.ts +1 -0
- package/lib/Types/USync.js +28 -0
- package/lib/Types/index.d.ts +2 -0
- package/lib/Types/index.js +68 -0
- package/lib/Utils/auth-utils.d.ts +63 -0
- package/lib/Utils/auth-utils.js +248 -0
- package/lib/Utils/browser-utils.d.ts +3 -0
- package/lib/Utils/browser-utils.js +61 -0
- package/lib/Utils/business.d.ts +53 -0
- package/lib/Utils/business.js +260 -0
- package/lib/Utils/chat-utils.d.ts +253 -0
- package/lib/Utils/chat-utils.js +756 -0
- package/lib/Utils/crypto.d.ts +43 -0
- package/lib/Utils/crypto.js +219 -0
- package/lib/Utils/decode-wa-message.d.ts +61 -0
- package/lib/Utils/decode-wa-message.js +233 -0
- package/lib/Utils/event-buffer.d.ts +17 -0
- package/lib/Utils/event-buffer.js +544 -0
- package/lib/Utils/generics.d.ts +89 -0
- package/lib/Utils/generics.js +471 -0
- package/lib/Utils/history.d.ts +59 -0
- package/lib/Utils/history.js +120 -0
- package/lib/Utils/index.d.ts +1 -0
- package/lib/Utils/index.js +61 -0
- package/lib/Utils/link-preview.d.ts +19 -0
- package/lib/Utils/link-preview.js +152 -0
- package/lib/Utils/logger.d.ts +3 -0
- package/lib/Utils/logger.js +33 -0
- package/lib/Utils/lt-hash.d.ts +13 -0
- package/lib/Utils/lt-hash.js +77 -0
- package/lib/Utils/make-mutex.d.ts +7 -0
- package/lib/Utils/make-mutex.js +69 -0
- package/lib/Utils/message-retry-manager.d.ts +34 -0
- package/lib/Utils/message-retry-manager.js +154 -0
- package/lib/Utils/messages-media.d.ts +137 -0
- package/lib/Utils/messages-media.js +1024 -0
- package/lib/Utils/messages.d.ts +66 -0
- package/lib/Utils/messages.js +1407 -0
- package/lib/Utils/noise-handler.d.ts +21 -0
- package/lib/Utils/noise-handler.js +176 -0
- package/lib/Utils/pre-key-manager.d.ts +13 -0
- package/lib/Utils/pre-key-manager.js +93 -0
- package/lib/Utils/process-message.d.ts +40 -0
- package/lib/Utils/process-message.js +430 -0
- package/lib/Utils/signal.d.ts +72 -0
- package/lib/Utils/signal.js +179 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +18 -0
- package/lib/Utils/use-multi-file-auth-state.js +151 -0
- package/lib/Utils/validate-connection.d.ts +43 -0
- package/lib/Utils/validate-connection.js +255 -0
- package/lib/Utils/ye-bail-event-stream.d.ts +16 -0
- package/lib/Utils/ye-bail-event-stream.js +89 -0
- package/lib/WABinary/constants.d.ts +23 -0
- package/lib/WABinary/constants.js +1328 -0
- package/lib/WABinary/decode.d.ts +10 -0
- package/lib/WABinary/decode.js +291 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/encode.js +276 -0
- package/lib/WABinary/generic-utils.d.ts +16 -0
- package/lib/WABinary/generic-utils.js +155 -0
- package/lib/WABinary/index.d.ts +1 -0
- package/lib/WABinary/index.js +47 -0
- package/lib/WABinary/jid-utils.d.ts +34 -0
- package/lib/WABinary/jid-utils.js +111 -0
- package/lib/WABinary/types.d.ts +1 -0
- package/lib/WABinary/types.js +28 -0
- package/lib/WAM/BinaryInfo.d.ts +8 -0
- package/lib/WAM/BinaryInfo.js +39 -0
- package/lib/WAM/constants.d.ts +35374 -0
- package/lib/WAM/constants.js +15376 -0
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/encode.js +181 -0
- package/lib/WAM/index.d.ts +1 -0
- package/lib/WAM/index.js +45 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +14 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +58 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +83 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +56 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +68 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +79 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +50 -0
- package/lib/WAUSync/Protocols/index.d.ts +1 -0
- package/lib/WAUSync/Protocols/index.js +46 -0
- package/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/lib/WAUSync/USyncQuery.js +115 -0
- package/lib/WAUSync/USyncUser.d.ts +13 -0
- package/lib/WAUSync/USyncUser.js +52 -0
- package/lib/WAUSync/index.d.ts +1 -0
- package/lib/WAUSync/index.js +45 -0
- package/lib/index.js +81 -0
- package/package.json +113 -0
- package/requirements.js +32 -0
|
@@ -0,0 +1,155 @@
|
|
|
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.getBinaryFilteredButtons = exports.getBinaryNodeMessages = exports.reduceBinaryNodeToDictionary = exports.assertNodeErrorFree = exports.getBinaryNodeChildUInt = exports.getBinaryNodeChildString = exports.getBinaryNodeChildBuffer = exports.getBinaryNodeChild = exports.getAllBinaryNodeChildren = exports.getBinaryNodeChildren = void 0;
|
|
30
|
+
exports.binaryNodeToString = binaryNodeToString;
|
|
31
|
+
const boom_1 = require("@hapi/boom");
|
|
32
|
+
const WAProto_1 = require("../../WAProto");
|
|
33
|
+
|
|
34
|
+
const getBinaryNodeChildren = (node, childTag) => {
|
|
35
|
+
if (Array.isArray(node === null || node === void 0 ? void 0 : node.content)) {
|
|
36
|
+
return node.content.filter(item => item.tag === childTag);
|
|
37
|
+
}
|
|
38
|
+
return [];
|
|
39
|
+
};
|
|
40
|
+
exports.getBinaryNodeChildren = getBinaryNodeChildren;
|
|
41
|
+
const getAllBinaryNodeChildren = ({ content }) => {
|
|
42
|
+
if (Array.isArray(content)) {
|
|
43
|
+
return content;
|
|
44
|
+
}
|
|
45
|
+
return [];
|
|
46
|
+
};
|
|
47
|
+
exports.getAllBinaryNodeChildren = getAllBinaryNodeChildren;
|
|
48
|
+
const getBinaryNodeChild = (node, childTag) => {
|
|
49
|
+
if (Array.isArray(node === null || node === void 0 ? void 0 : node.content)) {
|
|
50
|
+
return node === null || node === void 0 ? void 0 : node.content.find(item => item.tag === childTag);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
exports.getBinaryNodeChild = getBinaryNodeChild;
|
|
54
|
+
const getBinaryNodeChildBuffer = (node, childTag) => {
|
|
55
|
+
var _a;
|
|
56
|
+
const child = (_a = (0, exports.getBinaryNodeChild)(node, childTag)) === null || _a === void 0 ? void 0 : _a.content;
|
|
57
|
+
if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
|
|
58
|
+
return child;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.getBinaryNodeChildBuffer = getBinaryNodeChildBuffer;
|
|
62
|
+
const getBinaryNodeChildString = (node, childTag) => {
|
|
63
|
+
var _a;
|
|
64
|
+
const child = (_a = (0, exports.getBinaryNodeChild)(node, childTag)) === null || _a === void 0 ? void 0 : _a.content;
|
|
65
|
+
if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
|
|
66
|
+
return Buffer.from(child).toString('utf-8');
|
|
67
|
+
}
|
|
68
|
+
else if (typeof child === 'string') {
|
|
69
|
+
return child;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
exports.getBinaryNodeChildString = getBinaryNodeChildString;
|
|
73
|
+
const getBinaryNodeChildUInt = (node, childTag, length) => {
|
|
74
|
+
const buff = (0, exports.getBinaryNodeChildBuffer)(node, childTag);
|
|
75
|
+
if (buff) {
|
|
76
|
+
return bufferToUInt(buff, length);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.getBinaryNodeChildUInt = getBinaryNodeChildUInt;
|
|
80
|
+
const assertNodeErrorFree = (node) => {
|
|
81
|
+
const errNode = (0, exports.getBinaryNodeChild)(node, 'error');
|
|
82
|
+
if (errNode) {
|
|
83
|
+
throw new boom_1.Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code });
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.assertNodeErrorFree = assertNodeErrorFree;
|
|
87
|
+
const reduceBinaryNodeToDictionary = (node, tag) => {
|
|
88
|
+
const nodes = (0, exports.getBinaryNodeChildren)(node, tag);
|
|
89
|
+
const dict = nodes.reduce((dict, { attrs }) => {
|
|
90
|
+
dict[attrs.name || attrs.config_code] = attrs.value || attrs.config_value;
|
|
91
|
+
return dict;
|
|
92
|
+
}, {});
|
|
93
|
+
return dict;
|
|
94
|
+
};
|
|
95
|
+
exports.reduceBinaryNodeToDictionary = reduceBinaryNodeToDictionary;
|
|
96
|
+
const getBinaryNodeMessages = ({ content }) => {
|
|
97
|
+
const msgs = [];
|
|
98
|
+
if (Array.isArray(content)) {
|
|
99
|
+
for (const item of content) {
|
|
100
|
+
if (item.tag === 'message') {
|
|
101
|
+
msgs.push(WAProto_1.proto.WebMessageInfo.decode(item.content));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return msgs;
|
|
106
|
+
};
|
|
107
|
+
exports.getBinaryNodeMessages = getBinaryNodeMessages;
|
|
108
|
+
const getBinaryFilteredButtons = (nodeContent) => {
|
|
109
|
+
if (!Array.isArray(nodeContent)) {
|
|
110
|
+
nodeContent = [nodeContent];
|
|
111
|
+
}
|
|
112
|
+
const filter = nodeContent.filter((item) =>
|
|
113
|
+
!(item.tag === 'biz' && item.content &&
|
|
114
|
+
item.content.some((tag) =>
|
|
115
|
+
(tag.tag === 'interactive' && tag.attrs.type === 'native_flow' && tag.attrs.v === '1') ||
|
|
116
|
+
(tag.tag === 'list' && tag.attrs.type === 'product_list' && tag.attrs.v === '2')
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
);
|
|
120
|
+
if (filter.length > 0) {
|
|
121
|
+
return true;
|
|
122
|
+
} else {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
exports.getBinaryFilteredButtons = getBinaryFilteredButtons;
|
|
127
|
+
function bufferToUInt(e, t) {
|
|
128
|
+
let a = 0;
|
|
129
|
+
for (let i = 0; i < t; i++) {
|
|
130
|
+
a = 256 * a + e[i];
|
|
131
|
+
}
|
|
132
|
+
return a;
|
|
133
|
+
}
|
|
134
|
+
const tabs = (n) => '\t'.repeat(n);
|
|
135
|
+
function binaryNodeToString(node, i = 0) {
|
|
136
|
+
if (!node) {
|
|
137
|
+
return node;
|
|
138
|
+
}
|
|
139
|
+
if (typeof node === 'string') {
|
|
140
|
+
return tabs(i) + node;
|
|
141
|
+
}
|
|
142
|
+
if (node instanceof Uint8Array) {
|
|
143
|
+
return tabs(i) + Buffer.from(node).toString('hex');
|
|
144
|
+
}
|
|
145
|
+
if (Array.isArray(node)) {
|
|
146
|
+
return node.map((x) => tabs(i + 1) + binaryNodeToString(x, i + 1)).join('\n');
|
|
147
|
+
}
|
|
148
|
+
const children = binaryNodeToString(node.content, i + 1);
|
|
149
|
+
const tag = `<${node.tag} ${Object.entries(node.attrs || {})
|
|
150
|
+
.filter(([, v]) => v !== undefined)
|
|
151
|
+
.map(([k, v]) => `${k}='${v}'`)
|
|
152
|
+
.join(' ')}`;
|
|
153
|
+
const content = children ? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>';
|
|
154
|
+
return tag + content;
|
|
155
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(o, k2, desc);
|
|
35
|
+
}) : (function(o, m, k, k2) {
|
|
36
|
+
if (k2 === undefined) k2 = k;
|
|
37
|
+
o[k2] = m[k];
|
|
38
|
+
}));
|
|
39
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
40
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
41
|
+
};
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
__exportStar(require("./encode"), exports);
|
|
44
|
+
__exportStar(require("./decode"), exports);
|
|
45
|
+
__exportStar(require("./generic-utils"), exports);
|
|
46
|
+
__exportStar(require("./jid-utils"), exports);
|
|
47
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
2
|
+
export const S_WHATSAPP_NET: "@s.whatsapp.net";
|
|
3
|
+
export const OFFICIAL_BIZ_JID: "16505361212@c.us";
|
|
4
|
+
export const SERVER_JID: "server@c.us";
|
|
5
|
+
export const PSA_WID: "0@c.us";
|
|
6
|
+
export const STORIES_JID: "status@broadcast";
|
|
7
|
+
export const META_AI_JID: "13135550002@c.us";
|
|
8
|
+
export function jidEncode(user: any, server: any, device: any, agent: any): string;
|
|
9
|
+
export function jidDecode(jid: any): {
|
|
10
|
+
server: any;
|
|
11
|
+
user: any;
|
|
12
|
+
domainType: number;
|
|
13
|
+
device: number;
|
|
14
|
+
};
|
|
15
|
+
/** is the jid a user */
|
|
16
|
+
export function areJidsSameUser(jid1: any, jid2: any): boolean;
|
|
17
|
+
/** is the jid Meta IA */
|
|
18
|
+
export function isJidMetaAi(jid: any): any;
|
|
19
|
+
/** is the jid a user */
|
|
20
|
+
export function isJidUser(jid: any): any;
|
|
21
|
+
/** is the jid a group */
|
|
22
|
+
export function isLidUser(jid: any): any;
|
|
23
|
+
/** is the jid a broadcast */
|
|
24
|
+
export function isJidBroadcast(jid: any): any;
|
|
25
|
+
/** is the jid a newsletter */
|
|
26
|
+
export function isJidNewsletter(jid: any): any;
|
|
27
|
+
/** is the jid a group */
|
|
28
|
+
export function isJidGroup(jid: any): any;
|
|
29
|
+
/** is the jid the status broadcast */
|
|
30
|
+
export function isJidStatusBroadcast(jid: any): boolean;
|
|
31
|
+
export function isJidBot(jid: any): any;
|
|
32
|
+
export function jidNormalizedUser(jid: any): string;
|
|
33
|
+
export function lidToJid(jid: any): any;
|
|
34
|
+
export function getBotJid(jid: any): any;
|
|
@@ -0,0 +1,111 @@
|
|
|
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.lidToJid = exports.getBotJid = exports.jidNormalizedUser = exports.isJidBot = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidNewsletter = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.isJidMetaAi = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.META_AI_JID = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
|
|
30
|
+
exports.S_WHATSAPP_NET = '@s.whatsapp.net';
|
|
31
|
+
exports.OFFICIAL_BIZ_JID = '16505361212@c.us';
|
|
32
|
+
exports.SERVER_JID = 'server@c.us';
|
|
33
|
+
exports.PSA_WID = '0@c.us';
|
|
34
|
+
exports.STORIES_JID = 'status@broadcast';
|
|
35
|
+
exports.META_AI_JID = '13135550002@c.us';
|
|
36
|
+
const jidEncode = (user, server, device, agent) => {
|
|
37
|
+
return `${user || ''}${!!agent ? `_${agent}` : ''}${!!device ? `:${device}` : ''}@${server}`;
|
|
38
|
+
};
|
|
39
|
+
exports.jidEncode = jidEncode;
|
|
40
|
+
const jidDecode = (jid) => {
|
|
41
|
+
const sepIdx = typeof jid === 'string' ? jid.indexOf('@') : -1;
|
|
42
|
+
if (sepIdx < 0) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const server = jid.slice(sepIdx + 1);
|
|
46
|
+
const userCombined = jid.slice(0, sepIdx);
|
|
47
|
+
const [userAgent, device] = userCombined.split(':');
|
|
48
|
+
const user = userAgent.split('_')[0];
|
|
49
|
+
return {
|
|
50
|
+
server: server,
|
|
51
|
+
user,
|
|
52
|
+
domainType: server === 'lid' ? 1 : 0,
|
|
53
|
+
device: device ? +device : undefined
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
exports.jidDecode = jidDecode;
|
|
57
|
+
/** is the jid a user */
|
|
58
|
+
const areJidsSameUser = (jid1, jid2) => {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
return (((_a = (0, exports.jidDecode)(jid1)) === null || _a === void 0 ? void 0 : _a.user) === ((_b = (0, exports.jidDecode)(jid2)) === null || _b === void 0 ? void 0 : _b.user));
|
|
61
|
+
};
|
|
62
|
+
exports.areJidsSameUser = areJidsSameUser;
|
|
63
|
+
/** is the jid Meta IA */
|
|
64
|
+
const isJidMetaAi = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@bot'));
|
|
65
|
+
exports.isJidMetaAi = isJidMetaAi;
|
|
66
|
+
/** is the jid a user */
|
|
67
|
+
const isJidUser = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@s.whatsapp.net'));
|
|
68
|
+
exports.isJidUser = isJidUser;
|
|
69
|
+
/** is the jid a group */
|
|
70
|
+
const isLidUser = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@lid'));
|
|
71
|
+
exports.isLidUser = isLidUser;
|
|
72
|
+
/** is the jid a broadcast */
|
|
73
|
+
const isJidBroadcast = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@broadcast'));
|
|
74
|
+
exports.isJidBroadcast = isJidBroadcast;
|
|
75
|
+
/** is the jid a newsletter */
|
|
76
|
+
const isJidNewsletter = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@newsletter'));
|
|
77
|
+
exports.isJidNewsletter = isJidNewsletter;
|
|
78
|
+
/** is the jid a group */
|
|
79
|
+
const isJidGroup = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@g.us'));
|
|
80
|
+
exports.isJidGroup = isJidGroup;
|
|
81
|
+
/** is the jid the status broadcast */
|
|
82
|
+
const isJidStatusBroadcast = (jid) => jid === 'status@broadcast';
|
|
83
|
+
exports.isJidStatusBroadcast = isJidStatusBroadcast;
|
|
84
|
+
const botRegexp = /^1313555\d{4}$|^131655500\d{2}$/;
|
|
85
|
+
const isJidBot = (jid) => (jid && botRegexp.test(jid.split('@')[0]) && jid.endsWith('@c.us'));
|
|
86
|
+
exports.isJidBot = isJidBot;
|
|
87
|
+
const jidNormalizedUser = (jid) => {
|
|
88
|
+
const result = (0, exports.jidDecode)(jid);
|
|
89
|
+
if (!result) {
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
const { user, server } = result;
|
|
93
|
+
return (0, exports.jidEncode)(user, server === 'c.us' ? 's.whatsapp.net' : server);
|
|
94
|
+
};
|
|
95
|
+
exports.jidNormalizedUser = jidNormalizedUser;
|
|
96
|
+
const lidToJid = jid => jid && jid.endsWith('@lid') ? jid.replace('@lid','@s.whatsapp.net') : jid;
|
|
97
|
+
exports.lidToJid = lidToJid;
|
|
98
|
+
const getBotJid = (jid) => {
|
|
99
|
+
const BOT_MAP = new Map([["867051314767696", "13135550002"], ["1061492271844689", "13135550005"], ["245886058483988", "13135550009"], ["3509905702656130", "13135550012"], ["1059680132034576", "13135550013"], ["715681030623646", "13135550014"], ["1644971366323052", "13135550015"], ["582497970646566", "13135550019"], ["645459357769306", "13135550022"], ["294997126699143", "13135550023"], ["1522631578502677", "13135550027"], ["719421926276396", "13135550030"], ["1788488635002167", "13135550031"], ["24232338603080193", "13135550033"], ["689289903143209", "13135550035"], ["871626054177096", "13135550039"], ["362351902849370", "13135550042"], ["1744617646041527", "13135550043"], ["893887762270570", "13135550046"], ["1155032702135830", "13135550047"], ["333931965993883", "13135550048"], ["853748013058752", "13135550049"], ["1559068611564819", "13135550053"], ["890487432705716", "13135550054"], ["240254602395494", "13135550055"], ["1578420349663261", "13135550062"], ["322908887140421", "13135550065"], ["3713961535514771", "13135550067"], ["997884654811738", "13135550070"], ["403157239387035", "13135550081"], ["535242369074963", "13135550082"], ["946293427247659", "13135550083"], ["3664707673802291", "13135550084"], ["1821827464894892", "13135550085"], ["1760312477828757", "13135550086"], ["439480398712216", "13135550087"], ["1876735582800984", "13135550088"], ["984025089825661", "13135550089"], ["1001336351558186", "13135550090"], ["3739346336347061", "13135550091"], ["3632749426974980", "13135550092"], ["427864203481615", "13135550093"], ["1434734570493055", "13135550094"], ["992873449225921", "13135550095"], ["813087747426445", "13135550096"], ["806369104931434", "13135550098"], ["1220982902403148", "13135550099"], ["1365893374104393", "13135550100"], ["686482033622048", "13135550200"], ["1454999838411253", "13135550201"], ["718584497008509", "13135550202"], ["743520384213443", "13135550301"], ["1147715789823789", "13135550302"], ["1173034540372201", "13135550303"], ["974785541030953", "13135550304"], ["1122200255531507", "13135550305"], ["899669714813162", "13135550306"], ["631880108970650", "13135550307"], ["435816149330026", "13135550308"], ["1368717161184556", "13135550309"], ["7849963461784891", "13135550310"], ["3609617065968984", "13135550312"], ["356273980574602", "13135550313"], ["1043447920539760", "13135550314"], ["1052764336525346", "13135550315"], ["2631118843732685", "13135550316"], ["510505411332176", "13135550317"], ["1945664239227513", "13135550318"], ["1518594378764656", "13135550319"], ["1378821579456138", "13135550320"], ["490214716896013", "13135550321"], ["1028577858870699", "13135550322"], ["308915665545959", "13135550323"], ["845884253678900", "13135550324"], ["995031308616442", "13135550325"], ["2787365464763437", "13135550326"], ["1532790990671645", "13135550327"], ["302617036180485", "13135550328"], ["723376723197227", "13135550329"], ["8393570407377966", "13135550330"], ["1931159970680725", "13135550331"], ["401073885688605", "13135550332"], ["2234478453565422", "13135550334"], ["814748673882312", "13135550335"], ["26133635056281592", "13135550336"], ["1439804456676119", "13135550337"], ["889851503172161", "13135550338"], ["1018283232836879", "13135550339"], ["1012781386779537", "13135559000"], ["823280953239532", "13135559001"], ["1597090934573334", "13135559002"], ["485965054020343", "13135559003"], ["1033381648363446", "13135559004"], ["491802010206446", "13135559005"], ["1017139033184870", "13135559006"], ["499638325922174", "13135559008"], ["468946335863664", "13135559009"], ["1570389776875816", "13135559010"], ["1004342694328995", "13135559011"], ["1012240323971229", "13135559012"], ["392171787222419", "13135559013"], ["952081212945019", "13135559016"], ["444507875070178", "13135559017"], ["1274819440594668", "13135559018"], ["1397041101147050", "13135559019"], ["425657699872640", "13135559020"], ["532292852562549", "13135559021"], ["705863241720292", "13135559022"], ["476449815183959", "13135559023"], ["488071553854222", "13135559024"], ["468693832665397", "13135559025"], ["517422564037340", "13135559026"], ["819805466613825", "13135559027"], ["1847708235641382", "13135559028"], ["716282970644228", "13135559029"], ["521655380527741", "13135559030"], ["476193631941905", "13135559031"], ["485600497445562", "13135559032"], ["440217235683910", "13135559033"], ["523342446758478", "13135559034"], ["514784864360240", "13135559035"], ["505790121814530", "13135559036"], ["420008964419580", "13135559037"], ["492141680204555", "13135559038"], ["388462787271952", "13135559039"], ["423473920752072", "13135559040"], ["489574180468229", "13135559041"], ["432360635854105", "13135559042"], ["477878201669248", "13135559043"], ["351656951234045", "13135559044"], ["430178036732582", "13135559045"], ["434537312944552", "13135559046"], ["1240614300631808", "13135559047"], ["473135945605128", "13135559048"], ["423669800729310", "13135559049"], ["3685666705015792", "13135559050"], ["504196509016638", "13135559051"], ["346844785189449", "13135559052"], ["504823088911074", "13135559053"], ["402669415797083", "13135559054"], ["490939640234431", "13135559055"], ["875124128063715", "13135559056"], ["468788962654605", "13135559057"], ["562386196354570", "13135559058"], ["372159285928791", "13135559059"], ["531017479591050", "13135559060"], ["1328873881401826", "13135559061"], ["1608363646390484", "13135559062"], ["1229628561554232", "13135559063"], ["348802211530364", "13135559064"], ["3708535859420184", "13135559065"], ["415517767742187", "13135559066"], ["479330341612638", "13135559067"], ["480785414723083", "13135559068"], ["387299107507991", "13135559069"], ["333389813188944", "13135559070"], ["391794130316996", "13135559071"], ["457893470576314", "13135559072"], ["435550496166469", "13135559073"], ["1620162702100689", "13135559074"], ["867491058616043", "13135559075"], ["816224117357759", "13135559076"], ["334065176362830", "13135559077"], ["489973170554709", "13135559078"], ["473060669049665", "13135559079"], ["1221505815643060", "13135559080"], ["889000703096359", "13135559081"], ["475235961979883", "13135559082"], ["3434445653519934", "13135559084"], ["524503026827421", "13135559085"], ["1179639046403856", "13135559086"], ["471563305859144", "13135559087"], ["533896609192881", "13135559088"], ["365443583168041", "13135559089"], ["836082305329393", "13135559090"], ["1056787705969916", "13135559091"], ["503312598958357", "13135559092"], ["3718606738453460", "13135559093"], ["826066052850902", "13135559094"], ["1033611345091888", "13135559095"], ["3868390816783240", "13135559096"], ["7462677740498860", "13135559097"], ["436288576108573", "13135559098"], ["1047559746718900", "13135559099"], ["1099299455255491", "13135559100"], ["1202037301040633", "13135559101"], ["1720619402074074", "13135559102"], ["1030422235101467", "13135559103"], ["827238979523502", "13135559104"], ["1516443722284921", "13135559105"], ["1174442747196709", "13135559106"], ["1653165225503842", "13135559107"], ["1037648777635013", "13135559108"], ["551617757299900", "13135559109"], ["1158813558718726", "13135559110"], ["2463236450542262", "13135559111"], ["1550393252501466", "13135559112"], ["2057065188042796", "13135559113"], ["506163028760735", "13135559114"], ["2065249100538481", "13135559115"], ["1041382867195858", "13135559116"], ["886500209499603", "13135559117"], ["1491615624892655", "13135559118"], ["486563697299617", "13135559119"], ["1175736513679463", "13135559120"], ["491811473512352", "13165550064"]]);
|
|
100
|
+
const sepIdx = typeof jid === 'string' ? jid.indexOf('@') : -1;
|
|
101
|
+
if (sepIdx < 0) {
|
|
102
|
+
return jid;
|
|
103
|
+
}
|
|
104
|
+
const server = jid.slice(sepIdx + 1);
|
|
105
|
+
if (server !== 'bot')
|
|
106
|
+
return jid;
|
|
107
|
+
const user = jid.slice(0, sepIdx);
|
|
108
|
+
const mappedNumber = BOT_MAP.get(user);
|
|
109
|
+
return mappedNumber ? `${mappedNumber}@s.whatsapp.net` : jid;
|
|
110
|
+
};
|
|
111
|
+
exports.getBotJid = getBotJid;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 });
|
|
@@ -0,0 +1,39 @@
|
|
|
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.BinaryInfo = void 0;
|
|
30
|
+
class BinaryInfo {
|
|
31
|
+
constructor(options = {}) {
|
|
32
|
+
this.protocolVersion = 5;
|
|
33
|
+
this.sequence = 0;
|
|
34
|
+
this.events = [];
|
|
35
|
+
this.buffer = [];
|
|
36
|
+
Object.assign(this, options);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.BinaryInfo = BinaryInfo;
|