@queenanya/baileys 7.1.3 → 7.1.6
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 +13 -13
- package/lib/Defaults/index.js +4 -4
- package/lib/Socket/business.d.ts +29 -3
- package/lib/Socket/chats.d.ts +5 -0
- package/lib/Socket/chats.js +14 -0
- package/lib/Socket/groups.d.ts +7 -2
- package/lib/Socket/index.d.ts +29 -3
- package/lib/Socket/messages-recv.d.ts +30 -4
- package/lib/Socket/messages-recv.js +55 -2
- package/lib/Socket/messages-send.d.ts +27 -1
- package/lib/Socket/messages-send.js +54 -7
- package/lib/Socket/newsletter.d.ts +138 -0
- package/lib/Socket/newsletter.js +249 -0
- package/lib/Socket/registration.d.ts +29 -3
- package/lib/Socket/socket.js +2 -1
- package/lib/Types/Events.d.ts +27 -0
- package/lib/Types/Message.d.ts +15 -3
- package/lib/Types/Newsletter.d.ts +79 -0
- package/lib/Types/Newsletter.js +18 -0
- package/lib/Types/index.d.ts +2 -0
- package/lib/Types/index.js +1 -0
- package/lib/Utils/decode-wa-message.js +46 -18
- package/lib/Utils/generics.d.ts +11 -0
- package/lib/Utils/generics.js +17 -6
- package/lib/Utils/messages-media.d.ts +10 -1
- package/lib/Utils/messages-media.js +53 -4
- package/lib/Utils/messages.js +32 -11
- package/lib/Utils/signal.js +0 -5
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +3 -7
- package/lib/WABinary/jid-utils.d.ts +3 -1
- package/lib/WABinary/jid-utils.js +4 -1
- package/package.json +10 -8
package/lib/WABinary/encode.js
CHANGED
|
@@ -26,12 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.encodeBinaryNode = void 0;
|
|
27
27
|
const constants = __importStar(require("./constants"));
|
|
28
28
|
const jid_utils_1 = require("./jid-utils");
|
|
29
|
-
const encodeBinaryNode = (
|
|
30
|
-
const encoded = encodeBinaryNodeInner(node, opts, buffer);
|
|
31
|
-
return Buffer.from(encoded);
|
|
32
|
-
};
|
|
33
|
-
exports.encodeBinaryNode = encodeBinaryNode;
|
|
34
|
-
const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
29
|
+
const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0]) => {
|
|
35
30
|
const { TAGS, TOKEN_MAP } = opts;
|
|
36
31
|
const pushByte = (value) => buffer.push(value & 0xff);
|
|
37
32
|
const pushInt = (value, n, littleEndian = false) => {
|
|
@@ -219,7 +214,7 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
219
214
|
else if (Array.isArray(content)) {
|
|
220
215
|
writeListStart(content.length);
|
|
221
216
|
for (const item of content) {
|
|
222
|
-
|
|
217
|
+
(0, exports.encodeBinaryNode)(item, opts, buffer);
|
|
223
218
|
}
|
|
224
219
|
}
|
|
225
220
|
else if (typeof content === 'undefined') {
|
|
@@ -230,3 +225,4 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
230
225
|
}
|
|
231
226
|
return buffer;
|
|
232
227
|
};
|
|
228
|
+
exports.encodeBinaryNode = encodeBinaryNode;
|
|
@@ -3,7 +3,7 @@ export declare const OFFICIAL_BIZ_JID = "16505361212@c.us";
|
|
|
3
3
|
export declare const SERVER_JID = "server@c.us";
|
|
4
4
|
export declare const PSA_WID = "0@c.us";
|
|
5
5
|
export declare const STORIES_JID = "status@broadcast";
|
|
6
|
-
export type JidServer = 'c.us' | 'g.us' | 'broadcast' | 's.whatsapp.net' | 'call' | 'lid';
|
|
6
|
+
export type JidServer = 'c.us' | 'g.us' | 'broadcast' | 's.whatsapp.net' | 'call' | 'lid' | 'newsletter';
|
|
7
7
|
export type JidWithDevice = {
|
|
8
8
|
user: string;
|
|
9
9
|
device?: number;
|
|
@@ -24,6 +24,8 @@ export declare const isLidUser: (jid: string | undefined) => boolean | undefined
|
|
|
24
24
|
export declare const isJidBroadcast: (jid: string | undefined) => boolean | undefined;
|
|
25
25
|
/** is the jid a group */
|
|
26
26
|
export declare const isJidGroup: (jid: string | undefined) => boolean | undefined;
|
|
27
|
+
/** is the jid a newsletter */
|
|
28
|
+
export declare const isJidNewsletter: (jid: string | undefined) => boolean | undefined;
|
|
27
29
|
/** is the jid the status broadcast */
|
|
28
30
|
export declare const isJidStatusBroadcast: (jid: string) => boolean;
|
|
29
31
|
export declare const jidNormalizedUser: (jid: string | undefined) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jidNormalizedUser = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
|
|
3
|
+
exports.jidNormalizedUser = exports.isJidStatusBroadcast = exports.isJidNewsletter = exports.isJidGroup = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
|
|
4
4
|
exports.S_WHATSAPP_NET = '@s.whatsapp.net';
|
|
5
5
|
exports.OFFICIAL_BIZ_JID = '16505361212@c.us';
|
|
6
6
|
exports.SERVER_JID = 'server@c.us';
|
|
@@ -45,6 +45,9 @@ exports.isJidBroadcast = isJidBroadcast;
|
|
|
45
45
|
/** is the jid a group */
|
|
46
46
|
const isJidGroup = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@g.us'));
|
|
47
47
|
exports.isJidGroup = isJidGroup;
|
|
48
|
+
/** is the jid a newsletter */
|
|
49
|
+
const isJidNewsletter = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@newsletter'));
|
|
50
|
+
exports.isJidNewsletter = isJidNewsletter;
|
|
48
51
|
/** is the jid the status broadcast */
|
|
49
52
|
const isJidStatusBroadcast = (jid) => jid === 'status@broadcast';
|
|
50
53
|
exports.isJidStatusBroadcast = isJidStatusBroadcast;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@queenanya/baileys",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.6",
|
|
4
4
|
"description": "WhatsApp API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whatsapp",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"changelog:preview": "conventional-changelog -p angular -u",
|
|
34
34
|
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
35
35
|
"example": "node --inspect -r ts-node/register Example/example.ts",
|
|
36
|
-
"example:mobile": "node --inspect -r ts-node/register Example/example.ts --mobile",
|
|
37
36
|
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
|
38
37
|
"lint": "eslint src --ext .js,.ts,.jsx,.tsx",
|
|
39
38
|
"lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
|
|
@@ -50,13 +49,16 @@
|
|
|
50
49
|
"axios": "^1.7.2",
|
|
51
50
|
"cache-manager": "4.0.1",
|
|
52
51
|
"futoin-hkdf": "^1.5.3",
|
|
52
|
+
"json": "^11.0.0",
|
|
53
53
|
"libphonenumber-js": "^1.11.4",
|
|
54
|
-
"libsignal": "
|
|
54
|
+
"libsignal": "npm:@queenanya/libsignal@latest",
|
|
55
55
|
"lodash": "^4.17.21",
|
|
56
|
+
"megajs": "1.1.7",
|
|
56
57
|
"music-metadata": "^7.12.3",
|
|
57
58
|
"node-cache": "^5.1.2",
|
|
58
59
|
"pino": "^9.3.0",
|
|
59
60
|
"protobufjs": "^7.3.2",
|
|
61
|
+
"release-it": "^17.6.0",
|
|
60
62
|
"uuid": "^10.0.0",
|
|
61
63
|
"ws": "^8.18.0"
|
|
62
64
|
},
|
|
@@ -70,9 +72,10 @@
|
|
|
70
72
|
"conventional-changelog-cli": "^5.0.0",
|
|
71
73
|
"eslint": "^9.7.0",
|
|
72
74
|
"jest": "^29.7.0",
|
|
73
|
-
"jimp": "^0.22.
|
|
75
|
+
"jimp": "^0.22.12",
|
|
74
76
|
"json": "^11.0.0",
|
|
75
77
|
"link-preview-js": "^3.0.5",
|
|
78
|
+
"megajs": "1.1.7",
|
|
76
79
|
"open": "^10.1.0",
|
|
77
80
|
"qrcode-terminal": "^0.12.0",
|
|
78
81
|
"release-it": "^17.6.0",
|
|
@@ -83,10 +86,10 @@
|
|
|
83
86
|
"typescript": "^4.6.4"
|
|
84
87
|
},
|
|
85
88
|
"peerDependencies": {
|
|
86
|
-
"jimp": "^0.
|
|
89
|
+
"jimp": "^0.16.1",
|
|
87
90
|
"link-preview-js": "^3.0.0",
|
|
88
91
|
"qrcode-terminal": "^0.12.0",
|
|
89
|
-
"sharp": "^0.
|
|
92
|
+
"sharp": "^0.32.6"
|
|
90
93
|
},
|
|
91
94
|
"peerDependenciesMeta": {
|
|
92
95
|
"jimp": {
|
|
@@ -101,6 +104,5 @@
|
|
|
101
104
|
"sharp": {
|
|
102
105
|
"optional": true
|
|
103
106
|
}
|
|
104
|
-
}
|
|
105
|
-
"packageManager": "yarn@1.22.22"
|
|
107
|
+
}
|
|
106
108
|
}
|