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,79 @@
|
|
|
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.USyncBotProfileProtocol = void 0;
|
|
30
|
+
const WABinary_1 = require("../../WABinary");
|
|
31
|
+
class USyncBotProfileProtocol {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.name = 'bot';
|
|
34
|
+
}
|
|
35
|
+
getQueryElement() {
|
|
36
|
+
return {
|
|
37
|
+
tag: 'bot',
|
|
38
|
+
attrs: {},
|
|
39
|
+
content: [{ tag: 'profile', attrs: { v: '1' } }]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
getUserElement(user) {
|
|
43
|
+
return {
|
|
44
|
+
tag: 'bot',
|
|
45
|
+
attrs: {},
|
|
46
|
+
content: [{ tag: 'profile', attrs: { 'persona_id': user.personaId } }]
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
parser(node) {
|
|
50
|
+
const botNode = (0, WABinary_1.getBinaryNodeChild)(node, 'bot');
|
|
51
|
+
const profile = (0, WABinary_1.getBinaryNodeChild)(botNode, 'profile');
|
|
52
|
+
const commandsNode = (0, WABinary_1.getBinaryNodeChild)(profile, 'commands');
|
|
53
|
+
const promptsNode = (0, WABinary_1.getBinaryNodeChild)(profile, 'prompts');
|
|
54
|
+
const commands = [];
|
|
55
|
+
const prompts = [];
|
|
56
|
+
for (const command of (0, WABinary_1.getBinaryNodeChildren)(commandsNode, 'command')) {
|
|
57
|
+
commands.push({
|
|
58
|
+
name: (0, WABinary_1.getBinaryNodeChildString)(command, 'name'),
|
|
59
|
+
description: (0, WABinary_1.getBinaryNodeChildString)(command, 'description')
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
for (const prompt of (0, WABinary_1.getBinaryNodeChildren)(promptsNode, 'prompt')) {
|
|
63
|
+
prompts.push(`${(0, WABinary_1.getBinaryNodeChildString)(prompt, 'emoji')} ${(0, WABinary_1.getBinaryNodeChildString)(prompt, 'text')}`);
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
isDefault: !!(0, WABinary_1.getBinaryNodeChild)(profile, 'default'),
|
|
67
|
+
jid: node.attrs.jid,
|
|
68
|
+
name: (0, WABinary_1.getBinaryNodeChildString)(profile, 'name'),
|
|
69
|
+
attributes: (0, WABinary_1.getBinaryNodeChildString)(profile, 'attributes'),
|
|
70
|
+
description: (0, WABinary_1.getBinaryNodeChildString)(profile, 'description'),
|
|
71
|
+
category: (0, WABinary_1.getBinaryNodeChildString)(profile, 'category'),
|
|
72
|
+
personaId: profile.attrs['persona_id'],
|
|
73
|
+
commandsDescription: (0, WABinary_1.getBinaryNodeChildString)(commandsNode, 'description'),
|
|
74
|
+
commands,
|
|
75
|
+
prompts
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.USyncBotProfileProtocol = USyncBotProfileProtocol;
|
|
@@ -0,0 +1,50 @@
|
|
|
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.USyncLIDProtocol = void 0;
|
|
30
|
+
class USyncLIDProtocol {
|
|
31
|
+
constructor() {
|
|
32
|
+
this.name = 'lid';
|
|
33
|
+
}
|
|
34
|
+
getQueryElement() {
|
|
35
|
+
return {
|
|
36
|
+
tag: 'lid',
|
|
37
|
+
attrs: {},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
getUserElement() {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
parser(node) {
|
|
44
|
+
if (node.tag === 'lid') {
|
|
45
|
+
return node.attrs.val;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.USyncLIDProtocol = USyncLIDProtocol;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
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("./USyncDeviceProtocol"), exports);
|
|
44
|
+
__exportStar(require("./USyncContactProtocol"), exports);
|
|
45
|
+
__exportStar(require("./USyncStatusProtocol"), exports);
|
|
46
|
+
__exportStar(require("./USyncDisappearingModeProtocol"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
2
|
+
export class USyncQuery {
|
|
3
|
+
protocols: any[];
|
|
4
|
+
users: any[];
|
|
5
|
+
context: string;
|
|
6
|
+
mode: string;
|
|
7
|
+
withMode(mode: any): this;
|
|
8
|
+
withContext(context: any): this;
|
|
9
|
+
withUser(user: any): this;
|
|
10
|
+
parseUSyncQueryResult(result: any): {
|
|
11
|
+
list: any[];
|
|
12
|
+
sideList: any[];
|
|
13
|
+
};
|
|
14
|
+
withDeviceProtocol(): this;
|
|
15
|
+
withContactProtocol(): this;
|
|
16
|
+
withStatusProtocol(): this;
|
|
17
|
+
withDisappearingModeProtocol(): this;
|
|
18
|
+
withBotProfileProtocol(): this;
|
|
19
|
+
withLIDProtocol(): this;
|
|
20
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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.USyncQuery = void 0;
|
|
30
|
+
const WABinary_1 = require("../WABinary");
|
|
31
|
+
const UsyncBotProfileProtocol_1 = require("./Protocols/UsyncBotProfileProtocol");
|
|
32
|
+
const UsyncLIDProtocol_1 = require("./Protocols/UsyncLIDProtocol");
|
|
33
|
+
const Protocols_1 = require("./Protocols");
|
|
34
|
+
class USyncQuery {
|
|
35
|
+
constructor() {
|
|
36
|
+
this.protocols = [];
|
|
37
|
+
this.users = [];
|
|
38
|
+
this.context = 'interactive';
|
|
39
|
+
this.mode = 'query';
|
|
40
|
+
}
|
|
41
|
+
withMode(mode) {
|
|
42
|
+
this.mode = mode;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
withContext(context) {
|
|
46
|
+
this.context = context;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
withUser(user) {
|
|
50
|
+
this.users.push(user);
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
parseUSyncQueryResult(result) {
|
|
54
|
+
if (result.attrs.type !== 'result') {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const protocolMap = Object.fromEntries(this.protocols.map((protocol) => {
|
|
58
|
+
return [protocol.name, protocol.parser];
|
|
59
|
+
}));
|
|
60
|
+
const queryResult = {
|
|
61
|
+
|
|
62
|
+
list: [],
|
|
63
|
+
sideList: [],
|
|
64
|
+
};
|
|
65
|
+
const usyncNode = (0, WABinary_1.getBinaryNodeChild)(result, 'usync');
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const listNode = (0, WABinary_1.getBinaryNodeChild)(usyncNode, 'list');
|
|
70
|
+
if (Array.isArray(listNode === null || listNode === void 0 ? void 0 : listNode.content) && typeof listNode !== 'undefined') {
|
|
71
|
+
queryResult.list = listNode.content.map((node) => {
|
|
72
|
+
const id = node === null || node === void 0 ? void 0 : node.attrs.jid;
|
|
73
|
+
const data = Array.isArray(node === null || node === void 0 ? void 0 : node.content) ? Object.fromEntries(node.content.map((content) => {
|
|
74
|
+
const protocol = content.tag;
|
|
75
|
+
const parser = protocolMap[protocol];
|
|
76
|
+
if (parser) {
|
|
77
|
+
return [protocol, parser(content)];
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
return [protocol, null];
|
|
81
|
+
}
|
|
82
|
+
}).filter(([, b]) => b !== null)) : {};
|
|
83
|
+
return { ...data, id };
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
return queryResult;
|
|
89
|
+
}
|
|
90
|
+
withDeviceProtocol() {
|
|
91
|
+
this.protocols.push(new Protocols_1.USyncDeviceProtocol());
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
withContactProtocol() {
|
|
95
|
+
this.protocols.push(new Protocols_1.USyncContactProtocol());
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
withStatusProtocol() {
|
|
99
|
+
this.protocols.push(new Protocols_1.USyncStatusProtocol());
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
withDisappearingModeProtocol() {
|
|
103
|
+
this.protocols.push(new Protocols_1.USyncDisappearingModeProtocol());
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
withBotProfileProtocol() {
|
|
107
|
+
this.protocols.push(new UsyncBotProfileProtocol_1.USyncBotProfileProtocol());
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
withLIDProtocol() {
|
|
111
|
+
this.protocols.push(new UsyncLIDProtocol_1.USyncLIDProtocol());
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.USyncQuery = USyncQuery;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
2
|
+
export class USyncUser {
|
|
3
|
+
withId(id: any): this;
|
|
4
|
+
id: any;
|
|
5
|
+
withLid(lid: any): this;
|
|
6
|
+
lid: any;
|
|
7
|
+
withPhone(phone: any): this;
|
|
8
|
+
phone: any;
|
|
9
|
+
withType(type: any): this;
|
|
10
|
+
type: any;
|
|
11
|
+
withPersonaId(personaId: any): this;
|
|
12
|
+
personaId: any;
|
|
13
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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.USyncUser = void 0;
|
|
30
|
+
class USyncUser {
|
|
31
|
+
withId(id) {
|
|
32
|
+
this.id = id;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
withLid(lid) {
|
|
36
|
+
this.lid = lid;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
withPhone(phone) {
|
|
40
|
+
this.phone = phone;
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
withType(type) {
|
|
44
|
+
this.type = type;
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
withPersonaId(personaId) {
|
|
48
|
+
this.personaId = personaId;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.USyncUser = USyncUser;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
@@ -0,0 +1,45 @@
|
|
|
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("./Protocols"), exports);
|
|
44
|
+
__exportStar(require("./USyncQuery"), exports);
|
|
45
|
+
__exportStar(require("./USyncUser"), exports);
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
|
|
29
|
+
const chalk = require("chalk");
|
|
30
|
+
const gradient = require("gradient-string");
|
|
31
|
+
const Generics = require("./Utils/generics");
|
|
32
|
+
|
|
33
|
+
console.log();
|
|
34
|
+
|
|
35
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
36
|
+
if (k2 === undefined) k2 = k;
|
|
37
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
38
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
39
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
40
|
+
}
|
|
41
|
+
Object.defineProperty(o, k2, desc);
|
|
42
|
+
}) : (function(o, m, k, k2) {
|
|
43
|
+
if (k2 === undefined) k2 = k;
|
|
44
|
+
o[k2] = m[k];
|
|
45
|
+
}));
|
|
46
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
47
|
+
for (var p in m)
|
|
48
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
|
|
49
|
+
__createBinding(exports, m, p);
|
|
50
|
+
};
|
|
51
|
+
var __importDefault = (this && this.__importDefault) || function(mod) {
|
|
52
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
+
exports.proto = exports.makeWASocket = exports.fetchLatestBaileysVersion = void 0;
|
|
57
|
+
|
|
58
|
+
const WAProto_1 = require("../WAProto");
|
|
59
|
+
Object.defineProperty(exports, "proto", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function() {
|
|
62
|
+
return WAProto_1.proto;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const Socket_1 = __importDefault(require("./Socket"));
|
|
67
|
+
exports.makeWASocket = Socket_1.default;
|
|
68
|
+
|
|
69
|
+
const fetchLatestBaileysVersion = Generics.fetchLatestYeBailVersion;
|
|
70
|
+
exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion;
|
|
71
|
+
|
|
72
|
+
__exportStar(require("../WAProto"), exports);
|
|
73
|
+
__exportStar(require("./Utils"), exports);
|
|
74
|
+
__exportStar(require("./Types"), exports);
|
|
75
|
+
__exportStar(require("./Store"), exports);
|
|
76
|
+
__exportStar(require("./Defaults"), exports);
|
|
77
|
+
__exportStar(require("./WABinary"), exports);
|
|
78
|
+
__exportStar(require("./WAM"), exports);
|
|
79
|
+
__exportStar(require("./WAUSync"), exports);
|
|
80
|
+
|
|
81
|
+
exports.default = Socket_1.default;
|
package/package.json
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nrx-bails",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "WhatsApp Web API Library",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"homepage": "https://whatsapp.com/channel/0029VbBr4ta6WaKegzP7M220",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://whatsapp.com/channel/0029VbBr4ta6WaKegzP7M220"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "nerox",
|
|
12
|
+
"main": "lib/index.js",
|
|
13
|
+
"types": "lib/index.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"lib/*",
|
|
16
|
+
"WAProto/*",
|
|
17
|
+
"requirements.js"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build:all": "find lib -name '*.d.ts' -type f -delete && tsc && typedoc",
|
|
21
|
+
"build:docs": "typedoc",
|
|
22
|
+
"build:tsc": "find lib -name '*.d.ts' -type f -delete && tsc",
|
|
23
|
+
"changelog:last": "conventional-changelog -p angular -r 2",
|
|
24
|
+
"changelog:preview": "conventional-changelog -p angular -u",
|
|
25
|
+
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
26
|
+
"example": "node --inspect -r ts-node/register Example/example.ts",
|
|
27
|
+
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
|
28
|
+
"lint": "eslint lib --ext .js,.ts,.jsx,.tsx",
|
|
29
|
+
"lint:fix": "eslint lib --fix --ext .js,.ts,.jsx,.tsx",
|
|
30
|
+
"prepack": "echo 'ye-bail WhatsApp Library'",
|
|
31
|
+
"prepare": "echo 'ye-bail WhatsApp Library'",
|
|
32
|
+
"preinstall": "node ./requirements.js",
|
|
33
|
+
"release": "release-it",
|
|
34
|
+
"release:patch": "release-it patch",
|
|
35
|
+
"release:minor": "release-it minor",
|
|
36
|
+
"release:major": "release-it major",
|
|
37
|
+
"version": "npm run changelog:update && git add CHANGELOG.md",
|
|
38
|
+
"test": "jest --passWithNoTests"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@adiwajshing/keyed-db": "^0.2.4",
|
|
42
|
+
"@cacheable/node-cache": "^1.4.0",
|
|
43
|
+
"@hapi/boom": "^9.1.3",
|
|
44
|
+
"@release-it/conventional-changelog": "^10.0.3",
|
|
45
|
+
"audio-decode": "^2.2.3",
|
|
46
|
+
"async-mutex": "^0.5.0",
|
|
47
|
+
"axios": "^1.6.0",
|
|
48
|
+
"cache-manager": "^5.7.6",
|
|
49
|
+
"chalk": "^4.1.2",
|
|
50
|
+
"cheerio": "^1.0.0-rc.10",
|
|
51
|
+
"fflate": "^0.8.1",
|
|
52
|
+
"gradient-string": "^2.0.2",
|
|
53
|
+
"libphonenumber-js": "^1.10.20",
|
|
54
|
+
"libsignal": "github:neroxkira/libsignal-node",
|
|
55
|
+
"lodash": "^4.17.21",
|
|
56
|
+
"music-metadata": "^7.12.3",
|
|
57
|
+
"p-queue": "^9.0.0",
|
|
58
|
+
"pino": "^9.6",
|
|
59
|
+
"protobufjs": "^6.11.3",
|
|
60
|
+
"uuid": "^10.0.0",
|
|
61
|
+
"ws": "^8.13.0"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@adiwajshing/eslint-config": "github:adiwajshing/eslint-config",
|
|
65
|
+
"@types/got": "^9.6.11",
|
|
66
|
+
"@types/jest": "^27.5.1",
|
|
67
|
+
"@types/node": "^16.18.126",
|
|
68
|
+
"@types/sharp": "^0.29.4",
|
|
69
|
+
"@types/ws": "^8.0.0",
|
|
70
|
+
"conventional-changelog-cli": "^2.2.2",
|
|
71
|
+
"eslint": "^8.0.0",
|
|
72
|
+
"jest": "^27.0.6",
|
|
73
|
+
"jimp": "^0.16.1",
|
|
74
|
+
"json": "^11.0.0",
|
|
75
|
+
"link-preview-js": "^3.0.0",
|
|
76
|
+
"open": "^8.4.2",
|
|
77
|
+
"qrcode-terminal": "^0.12.0",
|
|
78
|
+
"release-it": "^15.10.3",
|
|
79
|
+
"sharp": "^0.34.1",
|
|
80
|
+
"ts-jest": "^27.0.3",
|
|
81
|
+
"ts-node": "^10.8.1",
|
|
82
|
+
"typedoc": "^0.27.9",
|
|
83
|
+
"typescript": "^5.8.2"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"audio-decode": "^2.1.3",
|
|
87
|
+
"jimp": "^0.16.1",
|
|
88
|
+
"link-preview-js": "^3.0.0",
|
|
89
|
+
"qrcode-terminal": "^0.12.0",
|
|
90
|
+
"sharp": "^0.34.1"
|
|
91
|
+
},
|
|
92
|
+
"peerDependenciesMeta": {
|
|
93
|
+
"audio-decode": {
|
|
94
|
+
"optional": true
|
|
95
|
+
},
|
|
96
|
+
"jimp": {
|
|
97
|
+
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"link-preview-js": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"qrcode-terminal": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"sharp": {
|
|
106
|
+
"optional": true
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"packageManager": "yarn@1.22.19",
|
|
110
|
+
"engines": {
|
|
111
|
+
"node": ">=20.0.0"
|
|
112
|
+
}
|
|
113
|
+
}
|
package/requirements.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const major = parseInt(process.versions.node.split('.')[0], 10);
|
|
2
|
+
const minor = parseInt(process.versions.node.split('.')[1], 10);
|
|
3
|
+
const version = process.versions.node;
|
|
4
|
+
|
|
5
|
+
const REQUIRED_NODE_VERSION = 20;
|
|
6
|
+
const ASCII_BANNER = `
|
|
7
|
+
╔═══════════════════════════════════════════════════════════╗
|
|
8
|
+
║ ⚠️ COMPATIBILITY ERROR ⚠️ ║
|
|
9
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
10
|
+
║ Package: NEROX WhatsApp API ║
|
|
11
|
+
║ Required: Node.js v${REQUIRED_NODE_VERSION}+ ║
|
|
12
|
+
║ Current: Node.js v${version.padEnd(36)} ║
|
|
13
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
14
|
+
║ 💡 Action Required: ║
|
|
15
|
+
║ → Upgrade Node.js to v${REQUIRED_NODE_VERSION} or higher ║
|
|
16
|
+
║ → Visit: https://nodejs.org/ ║
|
|
17
|
+
╚═══════════════════════════════════════════════════════════╝
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
if (major < REQUIRED_NODE_VERSION) {
|
|
21
|
+
console.error('\x1b[31m%s\x1b[0m', ASCII_BANNER);
|
|
22
|
+
console.error(
|
|
23
|
+
'\x1b[33m%s\x1b[0m',
|
|
24
|
+
`\n🚫 Initialization aborted due to incompatible runtime environment.\n` +
|
|
25
|
+
` Current: v${version} | Required: v${REQUIRED_NODE_VERSION}.0.0+\n` +
|
|
26
|
+
` Please update your Node.js installation to continue.\n`
|
|
27
|
+
);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
console.log('\x1b[32m%s\x1b[0m', '✓ Node.js version check passed');
|
|
32
|
+
|