@vinzsocket/baileys 2.8.30 → 3.0.0
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/WAProto/fix-imports.js +7 -16
- package/WAProto/index.js +1 -37306
- package/lib/Defaults/index.js +37 -33
- package/lib/Signal/Group/ciphertext-message.js +6 -2
- package/lib/Signal/Group/group-session-builder.js +12 -7
- package/lib/Signal/Group/group_cipher.js +18 -13
- package/lib/Signal/Group/index.js +77 -12
- package/lib/Signal/Group/keyhelper.js +15 -8
- package/lib/Signal/Group/queue-job.js +7 -2
- package/lib/Signal/Group/sender-chain-key.js +11 -6
- package/lib/Signal/Group/sender-key-distribution-message.js +10 -6
- package/lib/Signal/Group/sender-key-message.js +14 -9
- package/lib/Signal/Group/sender-key-name.js +6 -2
- package/lib/Signal/Group/sender-key-record.js +13 -9
- package/lib/Signal/Group/sender-key-state.js +10 -6
- package/lib/Signal/Group/sender-message-key.js +9 -4
- package/lib/Signal/libsignal.js +34 -28
- package/lib/Signal/lid-mapping.js +24 -19
- package/lib/Socket/Client/index.js +25 -3
- package/lib/Socket/Client/types.js +8 -4
- package/lib/Socket/Client/websocket.js +16 -11
- package/lib/Socket/business.js +38 -34
- package/lib/Socket/chats.js +100 -95
- package/lib/Socket/communities.js +55 -49
- package/lib/Socket/groups.js +56 -51
- package/lib/Socket/index.js +9 -6
- package/lib/Socket/messages-recv.js +150 -145
- package/lib/Socket/messages-send.js +109 -104
- package/lib/Socket/mex.js +12 -8
- package/lib/Socket/newsletter.js +27 -23
- package/lib/Socket/socket.js +111 -107
- package/lib/Store/index.js +47 -4
- package/lib/Store/make-cache-manager-store.js +17 -11
- package/lib/Store/make-in-memory-store.js +31 -29
- package/lib/Store/make-ordered-dictionary.js +7 -2
- package/lib/Store/object-repository.js +7 -2
- package/lib/Types/Auth.js +3 -2
- package/lib/Types/Bussines.js +3 -2
- package/lib/Types/Call.js +3 -2
- package/lib/Types/Chat.js +5 -2
- package/lib/Types/Contact.js +3 -2
- package/lib/Types/Events.js +1 -2
- package/lib/Types/GroupMetadata.js +3 -2
- package/lib/Types/Label.js +6 -3
- package/lib/Types/LabelAssociation.js +6 -3
- package/lib/Types/Message.js +16 -7
- package/lib/Types/Newsletter.js +8 -5
- package/lib/Types/Product.js +3 -2
- package/lib/Types/Signal.js +1 -2
- package/lib/Types/Socket.js +2 -3
- package/lib/Types/State.js +7 -4
- package/lib/Types/USync.js +1 -2
- package/lib/Types/index.js +153 -15
- package/lib/Utils/auth-utils.js +32 -25
- package/lib/Utils/baileys-event-stream.js +21 -15
- package/lib/Utils/business.js +71 -61
- package/lib/Utils/chat-utils.js +91 -77
- package/lib/Utils/crypto.js +54 -32
- package/lib/Utils/decode-wa-message.js +46 -39
- package/lib/Utils/event-buffer.js +24 -19
- package/lib/Utils/extended-messages.js +14 -9
- package/lib/Utils/generics.js +100 -64
- package/lib/Utils/history.js +30 -23
- package/lib/Utils/index.js +234 -22
- package/lib/Utils/lid-resolver.js +12 -5
- package/lib/Utils/link-preview.js +11 -7
- package/lib/Utils/logger.js +8 -4
- package/lib/Utils/lt-hash.js +8 -5
- package/lib/Utils/make-mutex.js +8 -3
- package/lib/Utils/mention.js +12 -4
- package/lib/Utils/message-retry-manager.js +10 -6
- package/lib/Utils/messages-media.js +127 -95
- package/lib/Utils/messages.js +122 -98
- package/lib/Utils/noise-handler.js +25 -21
- package/lib/Utils/process-message.js +72 -63
- package/lib/Utils/signal.js +45 -33
- package/lib/Utils/use-multi-file-auth-state.js +24 -20
- package/lib/Utils/validate-connection.js +54 -47
- package/lib/WABinary/constants.js +9 -6
- package/lib/WABinary/decode.js +17 -10
- package/lib/WABinary/encode.js +11 -6
- package/lib/WABinary/generic-utils.js +31 -17
- package/lib/WABinary/index.js +58 -6
- package/lib/WABinary/jid-utils.js +36 -20
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.js +6 -2
- package/lib/WAM/constants.js +1 -1
- package/lib/WAM/encode.js +16 -12
- package/lib/WAM/index.js +36 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +9 -5
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +10 -6
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +8 -4
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +8 -4
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +9 -4
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +23 -19
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +6 -2
- package/lib/WAUSync/Protocols/index.js +58 -6
- package/lib/WAUSync/USyncQuery.js +21 -17
- package/lib/WAUSync/USyncUser.js +6 -2
- package/lib/WAUSync/index.js +36 -4
- package/lib/index.js +112 -12
- package/package.json +8 -6
package/lib/WAM/encode.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.encodeWAM = void 0;
|
|
5
|
+
var _BinaryInfo = require("./BinaryInfo.js");
|
|
6
|
+
var _constants = require("./constants.js");
|
|
3
7
|
const getHeaderBitLength = key => key < 256 ? 2 : 3;
|
|
4
|
-
|
|
8
|
+
const encodeWAM = binaryInfo => {
|
|
5
9
|
binaryInfo.buffer = [];
|
|
6
10
|
encodeWAMHeader(binaryInfo);
|
|
7
11
|
encodeEvents(binaryInfo);
|
|
@@ -14,6 +18,7 @@ export const encodeWAM = binaryInfo => {
|
|
|
14
18
|
}
|
|
15
19
|
return buffer;
|
|
16
20
|
};
|
|
21
|
+
exports.encodeWAM = encodeWAM;
|
|
17
22
|
function encodeWAMHeader(binaryInfo) {
|
|
18
23
|
const headerBuffer = Buffer.alloc(8); // starting buffer
|
|
19
24
|
headerBuffer.write('WAM', 0, 'utf8');
|
|
@@ -25,12 +30,12 @@ function encodeWAMHeader(binaryInfo) {
|
|
|
25
30
|
}
|
|
26
31
|
function encodeGlobalAttributes(binaryInfo, globals) {
|
|
27
32
|
for (const [key, _value] of Object.entries(globals)) {
|
|
28
|
-
const id = WEB_GLOBALS.find(a => a?.name === key).id;
|
|
33
|
+
const id = _constants.WEB_GLOBALS.find(a => a?.name === key).id;
|
|
29
34
|
let value = _value;
|
|
30
35
|
if (typeof value === 'boolean') {
|
|
31
36
|
value = value ? 1 : 0;
|
|
32
37
|
}
|
|
33
|
-
binaryInfo.buffer.push(serializeData(id, value, FLAG_GLOBAL));
|
|
38
|
+
binaryInfo.buffer.push(serializeData(id, value, _constants.FLAG_GLOBAL));
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
function encodeEvents(binaryInfo) {
|
|
@@ -39,13 +44,13 @@ function encodeEvents(binaryInfo) {
|
|
|
39
44
|
globals
|
|
40
45
|
}] of binaryInfo.events.map(a => Object.entries(a)[0])) {
|
|
41
46
|
encodeGlobalAttributes(binaryInfo, globals);
|
|
42
|
-
const event = WEB_EVENTS.find(a => a.name === name);
|
|
47
|
+
const event = _constants.WEB_EVENTS.find(a => a.name === name);
|
|
43
48
|
const props_ = Object.entries(props);
|
|
44
49
|
let extended = false;
|
|
45
50
|
for (const [, value] of props_) {
|
|
46
51
|
extended || (extended = value !== null);
|
|
47
52
|
}
|
|
48
|
-
const eventFlag = extended ? FLAG_EVENT : FLAG_EVENT | FLAG_EXTENDED;
|
|
53
|
+
const eventFlag = extended ? _constants.FLAG_EVENT : _constants.FLAG_EVENT | _constants.FLAG_EXTENDED;
|
|
49
54
|
binaryInfo.buffer.push(serializeData(event.id, -event.weight, eventFlag));
|
|
50
55
|
for (let i = 0; i < props_.length; i++) {
|
|
51
56
|
const [key, _value] = props_[i];
|
|
@@ -55,7 +60,7 @@ function encodeEvents(binaryInfo) {
|
|
|
55
60
|
if (typeof value === 'boolean') {
|
|
56
61
|
value = value ? 1 : 0;
|
|
57
62
|
}
|
|
58
|
-
const fieldFlag = extended ? FLAG_EVENT : FLAG_FIELD | FLAG_EXTENDED;
|
|
63
|
+
const fieldFlag = extended ? _constants.FLAG_EVENT : _constants.FLAG_FIELD | _constants.FLAG_EXTENDED;
|
|
59
64
|
binaryInfo.buffer.push(serializeData(id, value, fieldFlag));
|
|
60
65
|
}
|
|
61
66
|
}
|
|
@@ -65,7 +70,7 @@ function serializeData(key, value, flag) {
|
|
|
65
70
|
let buffer;
|
|
66
71
|
let offset = 0;
|
|
67
72
|
if (value === null) {
|
|
68
|
-
if (flag === FLAG_GLOBAL) {
|
|
73
|
+
if (flag === _constants.FLAG_GLOBAL) {
|
|
69
74
|
buffer = Buffer.alloc(bufferLength);
|
|
70
75
|
offset = serializeHeader(buffer, offset, key, flag);
|
|
71
76
|
return buffer;
|
|
@@ -133,11 +138,10 @@ function serializeHeader(buffer, offset, key, flag) {
|
|
|
133
138
|
buffer.writeUInt8(key, offset);
|
|
134
139
|
offset += 1;
|
|
135
140
|
} else {
|
|
136
|
-
buffer.writeUInt8(flag | FLAG_BYTE, offset);
|
|
141
|
+
buffer.writeUInt8(flag | _constants.FLAG_BYTE, offset);
|
|
137
142
|
offset += 1;
|
|
138
143
|
buffer.writeUInt16LE(key, offset);
|
|
139
144
|
offset += 2;
|
|
140
145
|
}
|
|
141
146
|
return offset;
|
|
142
|
-
}
|
|
143
|
-
//# sourceMappingURL=encode.js.map
|
|
147
|
+
}
|
package/lib/WAM/index.js
CHANGED
|
@@ -1,4 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
var _constants = require("./constants.js");
|
|
5
|
+
Object.keys(_constants).forEach(function (key) {
|
|
6
|
+
if (key === "default" || key === "__esModule") return;
|
|
7
|
+
if (key in exports && exports[key] === _constants[key]) return;
|
|
8
|
+
Object.defineProperty(exports, key, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return _constants[key];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
var _encode = require("./encode.js");
|
|
16
|
+
Object.keys(_encode).forEach(function (key) {
|
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (key in exports && exports[key] === _encode[key]) return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _encode[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
var _BinaryInfo = require("./BinaryInfo.js");
|
|
27
|
+
Object.keys(_BinaryInfo).forEach(function (key) {
|
|
28
|
+
if (key === "default" || key === "__esModule") return;
|
|
29
|
+
if (key in exports && exports[key] === _BinaryInfo[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _BinaryInfo[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.USyncContactProtocol = void 0;
|
|
5
|
+
var _index = require("../../WABinary/index.js");
|
|
6
|
+
var _USyncUser = require("../USyncUser.js");
|
|
7
|
+
class USyncContactProtocol {
|
|
4
8
|
constructor() {
|
|
5
9
|
this.name = 'contact';
|
|
6
10
|
}
|
|
@@ -20,10 +24,10 @@ export class USyncContactProtocol {
|
|
|
20
24
|
}
|
|
21
25
|
parser(node) {
|
|
22
26
|
if (node.tag === 'contact') {
|
|
23
|
-
assertNodeErrorFree(node);
|
|
27
|
+
(0, _index.assertNodeErrorFree)(node);
|
|
24
28
|
return node?.attrs?.type === 'in';
|
|
25
29
|
}
|
|
26
30
|
return false;
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
|
-
|
|
33
|
+
exports.USyncContactProtocol = USyncContactProtocol;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.USyncDeviceProtocol = void 0;
|
|
5
|
+
var _index = require("../../WABinary/index.js");
|
|
6
|
+
class USyncDeviceProtocol {
|
|
3
7
|
constructor() {
|
|
4
8
|
this.name = 'devices';
|
|
5
9
|
}
|
|
@@ -22,9 +26,9 @@ export class USyncDeviceProtocol {
|
|
|
22
26
|
const deviceList = [];
|
|
23
27
|
let keyIndex = undefined;
|
|
24
28
|
if (node.tag === 'devices') {
|
|
25
|
-
assertNodeErrorFree(node);
|
|
26
|
-
const deviceListNode = getBinaryNodeChild(node, 'device-list');
|
|
27
|
-
const keyIndexNode = getBinaryNodeChild(node, 'key-index-list');
|
|
29
|
+
(0, _index.assertNodeErrorFree)(node);
|
|
30
|
+
const deviceListNode = (0, _index.getBinaryNodeChild)(node, 'device-list');
|
|
31
|
+
const keyIndexNode = (0, _index.getBinaryNodeChild)(node, 'key-index-list');
|
|
28
32
|
if (Array.isArray(deviceListNode?.content)) {
|
|
29
33
|
for (const {
|
|
30
34
|
tag,
|
|
@@ -55,4 +59,4 @@ export class USyncDeviceProtocol {
|
|
|
55
59
|
};
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
|
-
|
|
62
|
+
exports.USyncDeviceProtocol = USyncDeviceProtocol;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.USyncDisappearingModeProtocol = void 0;
|
|
5
|
+
var _index = require("../../WABinary/index.js");
|
|
6
|
+
class USyncDisappearingModeProtocol {
|
|
3
7
|
constructor() {
|
|
4
8
|
this.name = 'disappearing_mode';
|
|
5
9
|
}
|
|
@@ -14,7 +18,7 @@ export class USyncDisappearingModeProtocol {
|
|
|
14
18
|
}
|
|
15
19
|
parser(node) {
|
|
16
20
|
if (node.tag === 'disappearing_mode') {
|
|
17
|
-
assertNodeErrorFree(node);
|
|
21
|
+
(0, _index.assertNodeErrorFree)(node);
|
|
18
22
|
const duration = +node?.attrs.duration;
|
|
19
23
|
const setAt = new Date(+(node?.attrs.t || 0) * 1000);
|
|
20
24
|
return {
|
|
@@ -24,4 +28,4 @@ export class USyncDisappearingModeProtocol {
|
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
|
-
|
|
31
|
+
exports.USyncDisappearingModeProtocol = USyncDisappearingModeProtocol;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.USyncStatusProtocol = void 0;
|
|
5
|
+
var _index = require("../../WABinary/index.js");
|
|
6
|
+
class USyncStatusProtocol {
|
|
3
7
|
constructor() {
|
|
4
8
|
this.name = 'status';
|
|
5
9
|
}
|
|
@@ -14,7 +18,7 @@ export class USyncStatusProtocol {
|
|
|
14
18
|
}
|
|
15
19
|
parser(node) {
|
|
16
20
|
if (node.tag === 'status') {
|
|
17
|
-
assertNodeErrorFree(node);
|
|
21
|
+
(0, _index.assertNodeErrorFree)(node);
|
|
18
22
|
let status = node?.content?.toString() ?? null;
|
|
19
23
|
const setAt = new Date(+(node?.attrs.t || 0) * 1000);
|
|
20
24
|
if (!status) {
|
|
@@ -33,4 +37,4 @@ export class USyncStatusProtocol {
|
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
|
-
|
|
40
|
+
exports.USyncStatusProtocol = USyncStatusProtocol;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.USyncUsernameProtocol = void 0;
|
|
5
|
+
var _index = require("../../WABinary/index.js");
|
|
2
6
|
// Look up a user's WhatsApp username via a USync query.
|
|
3
7
|
// Mirrors the existing protocol files (UsyncLIDProtocol.js etc) in this folder.
|
|
4
|
-
|
|
8
|
+
class USyncUsernameProtocol {
|
|
5
9
|
constructor() {
|
|
6
10
|
this.name = 'username';
|
|
7
11
|
}
|
|
@@ -16,9 +20,10 @@ export class USyncUsernameProtocol {
|
|
|
16
20
|
}
|
|
17
21
|
parser(node) {
|
|
18
22
|
if (node.tag === 'username') {
|
|
19
|
-
assertNodeErrorFree(node);
|
|
23
|
+
(0, _index.assertNodeErrorFree)(node);
|
|
20
24
|
return typeof node.content === 'string' ? node.content : null;
|
|
21
25
|
}
|
|
22
26
|
return null;
|
|
23
27
|
}
|
|
24
|
-
}
|
|
28
|
+
}
|
|
29
|
+
exports.USyncUsernameProtocol = USyncUsernameProtocol;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.USyncBotProfileProtocol = void 0;
|
|
5
|
+
var _index = require("../../WABinary/index.js");
|
|
6
|
+
var _USyncUser = require("../USyncUser.js");
|
|
7
|
+
class USyncBotProfileProtocol {
|
|
4
8
|
constructor() {
|
|
5
9
|
this.name = 'bot';
|
|
6
10
|
}
|
|
@@ -29,33 +33,33 @@ export class USyncBotProfileProtocol {
|
|
|
29
33
|
};
|
|
30
34
|
}
|
|
31
35
|
parser(node) {
|
|
32
|
-
const botNode = getBinaryNodeChild(node, 'bot');
|
|
33
|
-
const profile = getBinaryNodeChild(botNode, 'profile');
|
|
34
|
-
const commandsNode = getBinaryNodeChild(profile, 'commands');
|
|
35
|
-
const promptsNode = getBinaryNodeChild(profile, 'prompts');
|
|
36
|
+
const botNode = (0, _index.getBinaryNodeChild)(node, 'bot');
|
|
37
|
+
const profile = (0, _index.getBinaryNodeChild)(botNode, 'profile');
|
|
38
|
+
const commandsNode = (0, _index.getBinaryNodeChild)(profile, 'commands');
|
|
39
|
+
const promptsNode = (0, _index.getBinaryNodeChild)(profile, 'prompts');
|
|
36
40
|
const commands = [];
|
|
37
41
|
const prompts = [];
|
|
38
|
-
for (const command of getBinaryNodeChildren(commandsNode, 'command')) {
|
|
42
|
+
for (const command of (0, _index.getBinaryNodeChildren)(commandsNode, 'command')) {
|
|
39
43
|
commands.push({
|
|
40
|
-
name: getBinaryNodeChildString(command, 'name'),
|
|
41
|
-
description: getBinaryNodeChildString(command, 'description')
|
|
44
|
+
name: (0, _index.getBinaryNodeChildString)(command, 'name'),
|
|
45
|
+
description: (0, _index.getBinaryNodeChildString)(command, 'description')
|
|
42
46
|
});
|
|
43
47
|
}
|
|
44
|
-
for (const prompt of getBinaryNodeChildren(promptsNode, 'prompt')) {
|
|
45
|
-
prompts.push(`${getBinaryNodeChildString(prompt, 'emoji')} ${getBinaryNodeChildString(prompt, 'text')}`);
|
|
48
|
+
for (const prompt of (0, _index.getBinaryNodeChildren)(promptsNode, 'prompt')) {
|
|
49
|
+
prompts.push(`${(0, _index.getBinaryNodeChildString)(prompt, 'emoji')} ${(0, _index.getBinaryNodeChildString)(prompt, 'text')}`);
|
|
46
50
|
}
|
|
47
51
|
return {
|
|
48
|
-
isDefault: !!getBinaryNodeChild(profile, 'default'),
|
|
52
|
+
isDefault: !!(0, _index.getBinaryNodeChild)(profile, 'default'),
|
|
49
53
|
jid: node.attrs.jid,
|
|
50
|
-
name: getBinaryNodeChildString(profile, 'name'),
|
|
51
|
-
attributes: getBinaryNodeChildString(profile, 'attributes'),
|
|
52
|
-
description: getBinaryNodeChildString(profile, 'description'),
|
|
53
|
-
category: getBinaryNodeChildString(profile, 'category'),
|
|
54
|
+
name: (0, _index.getBinaryNodeChildString)(profile, 'name'),
|
|
55
|
+
attributes: (0, _index.getBinaryNodeChildString)(profile, 'attributes'),
|
|
56
|
+
description: (0, _index.getBinaryNodeChildString)(profile, 'description'),
|
|
57
|
+
category: (0, _index.getBinaryNodeChildString)(profile, 'category'),
|
|
54
58
|
personaId: profile.attrs['persona_id'],
|
|
55
|
-
commandsDescription: getBinaryNodeChildString(commandsNode, 'description'),
|
|
59
|
+
commandsDescription: (0, _index.getBinaryNodeChildString)(commandsNode, 'description'),
|
|
56
60
|
commands,
|
|
57
61
|
prompts
|
|
58
62
|
};
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
|
-
|
|
65
|
+
exports.USyncBotProfileProtocol = USyncBotProfileProtocol;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.USyncLIDProtocol = void 0;
|
|
5
|
+
class USyncLIDProtocol {
|
|
2
6
|
constructor() {
|
|
3
7
|
this.name = 'lid';
|
|
4
8
|
}
|
|
@@ -18,4 +22,4 @@ export class USyncLIDProtocol {
|
|
|
18
22
|
return null;
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
|
-
|
|
25
|
+
exports.USyncLIDProtocol = USyncLIDProtocol;
|
|
@@ -1,6 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
var _USyncDeviceProtocol = require("./USyncDeviceProtocol.js");
|
|
5
|
+
Object.keys(_USyncDeviceProtocol).forEach(function (key) {
|
|
6
|
+
if (key === "default" || key === "__esModule") return;
|
|
7
|
+
if (key in exports && exports[key] === _USyncDeviceProtocol[key]) return;
|
|
8
|
+
Object.defineProperty(exports, key, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return _USyncDeviceProtocol[key];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
var _USyncContactProtocol = require("./USyncContactProtocol.js");
|
|
16
|
+
Object.keys(_USyncContactProtocol).forEach(function (key) {
|
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (key in exports && exports[key] === _USyncContactProtocol[key]) return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _USyncContactProtocol[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
var _USyncStatusProtocol = require("./USyncStatusProtocol.js");
|
|
27
|
+
Object.keys(_USyncStatusProtocol).forEach(function (key) {
|
|
28
|
+
if (key === "default" || key === "__esModule") return;
|
|
29
|
+
if (key in exports && exports[key] === _USyncStatusProtocol[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _USyncStatusProtocol[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
var _USyncDisappearingModeProtocol = require("./USyncDisappearingModeProtocol.js");
|
|
38
|
+
Object.keys(_USyncDisappearingModeProtocol).forEach(function (key) {
|
|
39
|
+
if (key === "default" || key === "__esModule") return;
|
|
40
|
+
if (key in exports && exports[key] === _USyncDisappearingModeProtocol[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return _USyncDisappearingModeProtocol[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var _USyncUsernameProtocol = require("./USyncUsernameProtocol.js");
|
|
49
|
+
Object.keys(_USyncUsernameProtocol).forEach(function (key) {
|
|
50
|
+
if (key === "default" || key === "__esModule") return;
|
|
51
|
+
if (key in exports && exports[key] === _USyncUsernameProtocol[key]) return;
|
|
52
|
+
Object.defineProperty(exports, key, {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () {
|
|
55
|
+
return _USyncUsernameProtocol[key];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.USyncQuery = void 0;
|
|
5
|
+
var _index = require("../WABinary/index.js");
|
|
6
|
+
var _UsyncBotProfileProtocol = require("./Protocols/UsyncBotProfileProtocol.js");
|
|
7
|
+
var _UsyncLIDProtocol = require("./Protocols/UsyncLIDProtocol.js");
|
|
8
|
+
var _USyncUsernameProtocol = require("./Protocols/USyncUsernameProtocol.js");
|
|
9
|
+
var _index2 = require("./Protocols/index.js");
|
|
10
|
+
var _USyncUser = require("./USyncUser.js");
|
|
11
|
+
class USyncQuery {
|
|
8
12
|
constructor() {
|
|
9
13
|
this.protocols = [];
|
|
10
14
|
this.users = [];
|
|
@@ -35,11 +39,11 @@ export class USyncQuery {
|
|
|
35
39
|
list: [],
|
|
36
40
|
sideList: []
|
|
37
41
|
};
|
|
38
|
-
const usyncNode = getBinaryNodeChild(result, 'usync');
|
|
42
|
+
const usyncNode = (0, _index.getBinaryNodeChild)(result, 'usync');
|
|
39
43
|
//TODO: implement error backoff, refresh etc.
|
|
40
44
|
//TODO: see if there are any errors in the result node
|
|
41
45
|
//const resultNode = getBinaryNodeChild(usyncNode, 'result')
|
|
42
|
-
const listNode = getBinaryNodeChild(usyncNode, 'list');
|
|
46
|
+
const listNode = (0, _index.getBinaryNodeChild)(usyncNode, 'list');
|
|
43
47
|
if (Array.isArray(listNode?.content) && typeof listNode !== 'undefined') {
|
|
44
48
|
queryResult.list = listNode.content.map(node => {
|
|
45
49
|
const id = node?.attrs.jid;
|
|
@@ -63,32 +67,32 @@ export class USyncQuery {
|
|
|
63
67
|
return queryResult;
|
|
64
68
|
}
|
|
65
69
|
withDeviceProtocol() {
|
|
66
|
-
this.protocols.push(new USyncDeviceProtocol());
|
|
70
|
+
this.protocols.push(new _index2.USyncDeviceProtocol());
|
|
67
71
|
return this;
|
|
68
72
|
}
|
|
69
73
|
withContactProtocol() {
|
|
70
|
-
this.protocols.push(new USyncContactProtocol());
|
|
74
|
+
this.protocols.push(new _index2.USyncContactProtocol());
|
|
71
75
|
return this;
|
|
72
76
|
}
|
|
73
77
|
withStatusProtocol() {
|
|
74
|
-
this.protocols.push(new USyncStatusProtocol());
|
|
78
|
+
this.protocols.push(new _index2.USyncStatusProtocol());
|
|
75
79
|
return this;
|
|
76
80
|
}
|
|
77
81
|
withDisappearingModeProtocol() {
|
|
78
|
-
this.protocols.push(new USyncDisappearingModeProtocol());
|
|
82
|
+
this.protocols.push(new _index2.USyncDisappearingModeProtocol());
|
|
79
83
|
return this;
|
|
80
84
|
}
|
|
81
85
|
withBotProfileProtocol() {
|
|
82
|
-
this.protocols.push(new USyncBotProfileProtocol());
|
|
86
|
+
this.protocols.push(new _UsyncBotProfileProtocol.USyncBotProfileProtocol());
|
|
83
87
|
return this;
|
|
84
88
|
}
|
|
85
89
|
withLIDProtocol() {
|
|
86
|
-
this.protocols.push(new USyncLIDProtocol());
|
|
90
|
+
this.protocols.push(new _UsyncLIDProtocol.USyncLIDProtocol());
|
|
87
91
|
return this;
|
|
88
92
|
}
|
|
89
93
|
withUsernameProtocol() {
|
|
90
|
-
this.protocols.push(new USyncUsernameProtocol());
|
|
94
|
+
this.protocols.push(new _USyncUsernameProtocol.USyncUsernameProtocol());
|
|
91
95
|
return this;
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
|
-
|
|
98
|
+
exports.USyncQuery = USyncQuery;
|
package/lib/WAUSync/USyncUser.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.USyncUser = void 0;
|
|
5
|
+
class USyncUser {
|
|
2
6
|
withId(id) {
|
|
3
7
|
this.id = id;
|
|
4
8
|
return this;
|
|
@@ -20,4 +24,4 @@ export class USyncUser {
|
|
|
20
24
|
return this;
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
|
-
|
|
27
|
+
exports.USyncUser = USyncUser;
|
package/lib/WAUSync/index.js
CHANGED
|
@@ -1,4 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
var _index = require("./Protocols/index.js");
|
|
5
|
+
Object.keys(_index).forEach(function (key) {
|
|
6
|
+
if (key === "default" || key === "__esModule") return;
|
|
7
|
+
if (key in exports && exports[key] === _index[key]) return;
|
|
8
|
+
Object.defineProperty(exports, key, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return _index[key];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
var _USyncQuery = require("./USyncQuery.js");
|
|
16
|
+
Object.keys(_USyncQuery).forEach(function (key) {
|
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (key in exports && exports[key] === _USyncQuery[key]) return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _USyncQuery[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
var _USyncUser = require("./USyncUser.js");
|
|
27
|
+
Object.keys(_USyncUser).forEach(function (key) {
|
|
28
|
+
if (key === "default" || key === "__esModule") return;
|
|
29
|
+
if (key in exports && exports[key] === _USyncUser[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _USyncUser[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|