@queenanya/baileys 7.4.14 → 7.5.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/README.md +26 -26
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +1 -231
- package/lib/Defaults/index.js +11 -23
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +1 -1
- package/lib/Socket/Client/{web-socket-client.js → websocket.js} +2 -2
- package/lib/Socket/business.d.ts +31 -28
- package/lib/Socket/chats.d.ts +17 -9
- package/lib/Socket/chats.js +115 -116
- package/lib/Socket/{registration.d.ts → communities.d.ts} +94 -145
- package/lib/Socket/communities.js +354 -0
- package/lib/Socket/groups.d.ts +23 -10
- package/lib/Socket/groups.js +12 -1
- package/lib/Socket/index.d.ts +69 -38
- package/lib/Socket/index.js +2 -2
- package/lib/Socket/messages-recv.d.ts +30 -28
- package/lib/Socket/messages-recv.js +291 -180
- package/lib/Socket/messages-send.d.ts +25 -19
- package/lib/Socket/messages-send.js +110 -76
- package/lib/Socket/newsletter.d.ts +19 -13
- package/lib/Socket/newsletter.js +67 -54
- package/lib/Socket/socket.d.ts +3 -1
- package/lib/Socket/socket.js +15 -17
- package/lib/Socket/usync.d.ts +38 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/make-cache-manager-store.d.ts +2 -1
- package/lib/Store/make-in-memory-store.js +13 -11
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Auth.d.ts +1 -6
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +15 -7
- package/lib/Types/Contact.d.ts +6 -1
- package/lib/Types/Events.d.ts +44 -2
- package/lib/Types/GroupMetadata.d.ts +3 -1
- package/lib/Types/Label.d.ts +11 -0
- package/lib/Types/Message.d.ts +37 -30
- package/lib/Types/Newsletter.d.ts +0 -13
- package/lib/Types/Newsletter.js +1 -15
- package/lib/Types/Socket.d.ts +10 -3
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +8 -0
- package/lib/Utils/auth-utils.js +1 -7
- package/lib/Utils/chat-utils.d.ts +5 -4
- package/lib/Utils/chat-utils.js +52 -20
- package/lib/Utils/crypto.d.ts +2 -1
- package/lib/Utils/crypto.js +4 -2
- package/lib/Utils/decode-wa-message.d.ts +1 -0
- package/lib/Utils/decode-wa-message.js +34 -14
- package/lib/Utils/event-buffer.js +14 -8
- package/lib/Utils/generics.d.ts +37 -13
- package/lib/Utils/generics.js +103 -18
- package/lib/Utils/history.d.ts +6 -2
- package/lib/Utils/history.js +3 -0
- package/lib/Utils/index.d.ts +1 -0
- package/lib/Utils/index.js +1 -0
- package/lib/Utils/link-preview.js +24 -1
- package/lib/Utils/logger.d.ts +1 -3
- package/lib/Utils/make-mutex.js +1 -0
- package/lib/Utils/messages-media.d.ts +3 -2
- package/lib/Utils/messages-media.js +17 -32
- package/lib/Utils/messages.d.ts +1 -0
- package/lib/Utils/messages.js +67 -72
- package/lib/Utils/noise-handler.d.ts +3 -3
- package/lib/Utils/noise-handler.js +7 -12
- package/lib/Utils/process-message.d.ts +3 -2
- package/lib/Utils/process-message.js +55 -21
- package/lib/Utils/signal.js +23 -16
- package/lib/Utils/use-multi-file-auth-state.js +17 -3
- package/lib/Utils/validate-connection.d.ts +0 -1
- package/lib/Utils/validate-connection.js +10 -44
- package/lib/WABinary/constants.js +5 -5
- package/lib/WABinary/decode.d.ts +3 -2
- package/lib/WABinary/decode.js +6 -4
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +8 -6
- package/lib/WABinary/generic-utils.d.ts +1 -0
- package/lib/WABinary/jid-utils.d.ts +3 -3
- package/lib/WABinary/jid-utils.js +5 -5
- package/lib/WAM/BinaryInfo.d.ts +3 -2
- package/lib/WAM/constants.d.ts +3 -2
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/encode.js +2 -2
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
- package/lib/WAUSync/Protocols/index.d.ts +4 -0
- package/lib/WAUSync/Protocols/index.js +20 -0
- package/lib/WAUSync/USyncQuery.d.ts +26 -0
- package/lib/WAUSync/USyncQuery.js +79 -0
- package/lib/WAUSync/USyncUser.d.ts +10 -0
- package/lib/WAUSync/USyncUser.js +22 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +36 -34
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/registration.js +0 -166
- /package/lib/Socket/Client/{abstract-socket-client.d.ts → types.d.ts} +0 -0
- /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USyncStatusProtocol = void 0;
|
|
4
|
+
const WABinary_1 = require("../../WABinary");
|
|
5
|
+
class USyncStatusProtocol {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.name = 'status';
|
|
8
|
+
}
|
|
9
|
+
getQueryElement() {
|
|
10
|
+
return {
|
|
11
|
+
tag: 'status',
|
|
12
|
+
attrs: {},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
getUserElement() {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
parser(node) {
|
|
19
|
+
var _a;
|
|
20
|
+
if (node.tag === 'status') {
|
|
21
|
+
(0, WABinary_1.assertNodeErrorFree)(node);
|
|
22
|
+
let status = node === null || node === void 0 ? void 0 : node.content.toString();
|
|
23
|
+
const setAt = new Date(+((node === null || node === void 0 ? void 0 : node.attrs.t) || 0) * 1000);
|
|
24
|
+
if (!status) {
|
|
25
|
+
if (+((_a = node.attrs) === null || _a === void 0 ? void 0 : _a.code) === 401) {
|
|
26
|
+
status = '';
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
status = null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (typeof status === 'string' && status.length === 0) {
|
|
33
|
+
status = null;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
status,
|
|
37
|
+
setAt,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.USyncStatusProtocol = USyncStatusProtocol;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./USyncDeviceProtocol"), exports);
|
|
18
|
+
__exportStar(require("./USyncContactProtocol"), exports);
|
|
19
|
+
__exportStar(require("./USyncStatusProtocol"), exports);
|
|
20
|
+
__exportStar(require("./USyncDisappearingModeProtocol"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { USyncQueryProtocol } from '../Types/USync';
|
|
2
|
+
import { BinaryNode } from '../WABinary';
|
|
3
|
+
import { USyncUser } from './USyncUser';
|
|
4
|
+
export type USyncQueryResultList = {
|
|
5
|
+
[protocol: string]: unknown;
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
export type USyncQueryResult = {
|
|
9
|
+
list: USyncQueryResultList[];
|
|
10
|
+
sideList: USyncQueryResultList[];
|
|
11
|
+
};
|
|
12
|
+
export declare class USyncQuery {
|
|
13
|
+
protocols: USyncQueryProtocol[];
|
|
14
|
+
users: USyncUser[];
|
|
15
|
+
context: string;
|
|
16
|
+
mode: string;
|
|
17
|
+
constructor();
|
|
18
|
+
withMode(mode: string): this;
|
|
19
|
+
withContext(context: string): this;
|
|
20
|
+
withUser(user: USyncUser): this;
|
|
21
|
+
parseUSyncQueryResult(result: BinaryNode): USyncQueryResult | undefined;
|
|
22
|
+
withDeviceProtocol(): this;
|
|
23
|
+
withContactProtocol(): this;
|
|
24
|
+
withStatusProtocol(): this;
|
|
25
|
+
withDisappearingModeProtocol(): this;
|
|
26
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USyncQuery = void 0;
|
|
4
|
+
const WABinary_1 = require("../WABinary");
|
|
5
|
+
const Protocols_1 = require("./Protocols");
|
|
6
|
+
class USyncQuery {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.protocols = [];
|
|
9
|
+
this.users = [];
|
|
10
|
+
this.context = 'interactive';
|
|
11
|
+
this.mode = 'query';
|
|
12
|
+
}
|
|
13
|
+
withMode(mode) {
|
|
14
|
+
this.mode = mode;
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
withContext(context) {
|
|
18
|
+
this.context = context;
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
withUser(user) {
|
|
22
|
+
this.users.push(user);
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
parseUSyncQueryResult(result) {
|
|
26
|
+
if (result.attrs.type !== 'result') {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const protocolMap = Object.fromEntries(this.protocols.map((protocol) => {
|
|
30
|
+
return [protocol.name, protocol.parser];
|
|
31
|
+
}));
|
|
32
|
+
const queryResult = {
|
|
33
|
+
// TODO: implement errors etc.
|
|
34
|
+
list: [],
|
|
35
|
+
sideList: [],
|
|
36
|
+
};
|
|
37
|
+
const usyncNode = (0, WABinary_1.getBinaryNodeChild)(result, 'usync');
|
|
38
|
+
//TODO: implement error backoff, refresh etc.
|
|
39
|
+
//TODO: see if there are any errors in the result node
|
|
40
|
+
//const resultNode = getBinaryNodeChild(usyncNode, 'result')
|
|
41
|
+
const listNode = (0, WABinary_1.getBinaryNodeChild)(usyncNode, 'list');
|
|
42
|
+
if (Array.isArray(listNode === null || listNode === void 0 ? void 0 : listNode.content) && typeof listNode !== 'undefined') {
|
|
43
|
+
queryResult.list = listNode.content.map((node) => {
|
|
44
|
+
const id = node === null || node === void 0 ? void 0 : node.attrs.jid;
|
|
45
|
+
const data = Array.isArray(node === null || node === void 0 ? void 0 : node.content) ? Object.fromEntries(node.content.map((content) => {
|
|
46
|
+
const protocol = content.tag;
|
|
47
|
+
const parser = protocolMap[protocol];
|
|
48
|
+
if (parser) {
|
|
49
|
+
return [protocol, parser(content)];
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return [protocol, null];
|
|
53
|
+
}
|
|
54
|
+
}).filter(([, b]) => b !== null)) : {};
|
|
55
|
+
return { ...data, id };
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//TODO: implement side list
|
|
59
|
+
//const sideListNode = getBinaryNodeChild(usyncNode, 'side_list')
|
|
60
|
+
return queryResult;
|
|
61
|
+
}
|
|
62
|
+
withDeviceProtocol() {
|
|
63
|
+
this.protocols.push(new Protocols_1.USyncDeviceProtocol());
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
withContactProtocol() {
|
|
67
|
+
this.protocols.push(new Protocols_1.USyncContactProtocol());
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
withStatusProtocol() {
|
|
71
|
+
this.protocols.push(new Protocols_1.USyncStatusProtocol());
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
withDisappearingModeProtocol() {
|
|
75
|
+
this.protocols.push(new Protocols_1.USyncDisappearingModeProtocol());
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.USyncQuery = USyncQuery;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USyncUser = void 0;
|
|
4
|
+
class USyncUser {
|
|
5
|
+
withId(id) {
|
|
6
|
+
this.id = id;
|
|
7
|
+
return this;
|
|
8
|
+
}
|
|
9
|
+
withLid(lid) {
|
|
10
|
+
this.lid = lid;
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
withPhone(phone) {
|
|
14
|
+
this.phone = phone;
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
withType(type) {
|
|
18
|
+
this.type = type;
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.USyncUser = USyncUser;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Protocols"), exports);
|
|
18
|
+
__exportStar(require("./USyncQuery"), exports);
|
|
19
|
+
__exportStar(require("./USyncUser"), exports);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -27,4 +27,5 @@ __exportStar(require("./Store"), exports);
|
|
|
27
27
|
__exportStar(require("./Defaults"), exports);
|
|
28
28
|
__exportStar(require("./WABinary"), exports);
|
|
29
29
|
__exportStar(require("./WAM"), exports);
|
|
30
|
+
__exportStar(require("./WAUSync"), exports);
|
|
30
31
|
exports.default = Socket_1.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@queenanya/baileys",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.1",
|
|
4
4
|
"description": "WhatsApp API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whatsapp",
|
|
@@ -27,48 +27,51 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
30
|
-
"@
|
|
30
|
+
"@queenanya/eslint-config": "github:whiskeysockets/eslint-config",
|
|
31
|
+
"@hapi/boom": "^10.0.1",
|
|
31
32
|
"async-lock": "^1.4.1",
|
|
32
|
-
"audio-decode": "^2.
|
|
33
|
-
"axios": "^1.
|
|
34
|
-
"cache-manager": "
|
|
35
|
-
"futoin-hkdf": "^1.5.
|
|
36
|
-
"
|
|
37
|
-
"
|
|
33
|
+
"audio-decode": "^2.2.0",
|
|
34
|
+
"axios": "^1.7.3",
|
|
35
|
+
"cache-manager": "^5.7.6",
|
|
36
|
+
"futoin-hkdf": "^1.5.3",
|
|
37
|
+
"jimp": "^0.22.12",
|
|
38
|
+
"json": "^11.0.0",
|
|
39
|
+
"libphonenumber-js": "^1.11.4",
|
|
40
|
+
"libsignal": "npm:@queenanya/libsignal@latest",
|
|
41
|
+
"lodash": "^4.17.21",
|
|
38
42
|
"music-metadata": "^7.12.3",
|
|
39
43
|
"node-cache": "^5.1.2",
|
|
40
|
-
"pino": "^
|
|
41
|
-
"protobufjs": "^7.2
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
+
"pino": "^9.3.0",
|
|
45
|
+
"protobufjs": "^7.3.2",
|
|
46
|
+
"release-it": "^17.6.0",
|
|
47
|
+
"uuid": "^10.0.0",
|
|
48
|
+
"ws": "^8.18.0"
|
|
44
49
|
},
|
|
45
50
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@types/
|
|
48
|
-
"@types/
|
|
49
|
-
"@types/
|
|
50
|
-
"@types/
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"open": "^8.4.2",
|
|
51
|
+
"@types/got": "^9.6.12",
|
|
52
|
+
"@types/jest": "^29.5.12",
|
|
53
|
+
"@types/node": "^20.14.10",
|
|
54
|
+
"@types/sharp": "^0.31.1",
|
|
55
|
+
"@types/ws": "^8.5.11",
|
|
56
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
57
|
+
"eslint": "^9.7.0",
|
|
58
|
+
"jest": "^29.7.0",
|
|
59
|
+
"json": "^11.0.0",
|
|
60
|
+
"link-preview-js": "^3.0.5",
|
|
61
|
+
"open": "^10.1.0",
|
|
58
62
|
"qrcode-terminal": "^0.12.0",
|
|
59
|
-
"release-it": "^
|
|
60
|
-
"sharp": "^0.
|
|
61
|
-
"ts-jest": "^
|
|
62
|
-
"ts-node": "^10.
|
|
63
|
+
"release-it": "^17.6.0",
|
|
64
|
+
"sharp": "^0.33.4",
|
|
65
|
+
"ts-jest": "^29.2.2",
|
|
66
|
+
"ts-node": "^10.9.2",
|
|
63
67
|
"typedoc": "^0.24.7",
|
|
64
|
-
"typescript": "^4.6.4"
|
|
65
|
-
"json": "^11.0.0"
|
|
68
|
+
"typescript": "^4.6.4"
|
|
66
69
|
},
|
|
67
70
|
"peerDependencies": {
|
|
68
71
|
"jimp": "^0.22.12",
|
|
69
72
|
"link-preview-js": "^3.0.0",
|
|
70
73
|
"qrcode-terminal": "^0.12.0",
|
|
71
|
-
"sharp": "^0.32.
|
|
74
|
+
"sharp": "^0.32.6"
|
|
72
75
|
},
|
|
73
76
|
"peerDependenciesMeta": {
|
|
74
77
|
"jimp": {
|
|
@@ -92,10 +95,9 @@
|
|
|
92
95
|
"changelog:preview": "conventional-changelog -p angular -u",
|
|
93
96
|
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
94
97
|
"example": "node --inspect -r ts-node/register Example/example.ts",
|
|
95
|
-
"example:mobile": "node --inspect -r ts-node/register Example/example.ts --mobile",
|
|
96
98
|
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
|
97
|
-
"lint": "eslint src --ext .js,.ts
|
|
98
|
-
"lint:fix": "
|
|
99
|
+
"lint": "eslint src --ext .js,.ts",
|
|
100
|
+
"lint:fix": "yarn lint --fix",
|
|
99
101
|
"release": "release-it",
|
|
100
102
|
"test": "jest"
|
|
101
103
|
}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"93": 412,
|
|
3
|
-
"355": 276,
|
|
4
|
-
"213": 603,
|
|
5
|
-
"1-684": 544,
|
|
6
|
-
"376": 213,
|
|
7
|
-
"244": 631,
|
|
8
|
-
"1-264": 365,
|
|
9
|
-
"1-268": 344,
|
|
10
|
-
"54": 722,
|
|
11
|
-
"374": 283,
|
|
12
|
-
"297": 363,
|
|
13
|
-
"61": 505,
|
|
14
|
-
"43": 232,
|
|
15
|
-
"994": 400,
|
|
16
|
-
"1-242": 364,
|
|
17
|
-
"973": 426,
|
|
18
|
-
"880": 470,
|
|
19
|
-
"1-246": 342,
|
|
20
|
-
"375": 257,
|
|
21
|
-
"32": 206,
|
|
22
|
-
"501": 702,
|
|
23
|
-
"229": 616,
|
|
24
|
-
"1-441": 350,
|
|
25
|
-
"975": 402,
|
|
26
|
-
"591": 736,
|
|
27
|
-
"387": 218,
|
|
28
|
-
"267": 652,
|
|
29
|
-
"55": 724,
|
|
30
|
-
"1-284": 348,
|
|
31
|
-
"673": 528,
|
|
32
|
-
"359": 284,
|
|
33
|
-
"226": 613,
|
|
34
|
-
"257": 642,
|
|
35
|
-
"855": 456,
|
|
36
|
-
"237": 624,
|
|
37
|
-
"238": 625,
|
|
38
|
-
"1-345": 346,
|
|
39
|
-
"236": 623,
|
|
40
|
-
"235": 622,
|
|
41
|
-
"56": 730,
|
|
42
|
-
"86": 454,
|
|
43
|
-
"57": 732,
|
|
44
|
-
"269": 654,
|
|
45
|
-
"682": 548,
|
|
46
|
-
"506": 712,
|
|
47
|
-
"385": 219,
|
|
48
|
-
"53": 368,
|
|
49
|
-
"357": 280,
|
|
50
|
-
"420": 230,
|
|
51
|
-
"243": 630,
|
|
52
|
-
"45": 238,
|
|
53
|
-
"253": 638,
|
|
54
|
-
"1-767": 366,
|
|
55
|
-
"1-809": 370,
|
|
56
|
-
"1-849": 370,
|
|
57
|
-
"1-829": 370,
|
|
58
|
-
"593": 740,
|
|
59
|
-
"20": 602,
|
|
60
|
-
"503": 706,
|
|
61
|
-
"240": 627,
|
|
62
|
-
"291": 657,
|
|
63
|
-
"372": 248,
|
|
64
|
-
"251": 636,
|
|
65
|
-
"500": 750,
|
|
66
|
-
"298": 288,
|
|
67
|
-
"679": 542,
|
|
68
|
-
"358": 244,
|
|
69
|
-
"33": 208,
|
|
70
|
-
"689": 547,
|
|
71
|
-
"241": 628,
|
|
72
|
-
"220": 607,
|
|
73
|
-
"995": 282,
|
|
74
|
-
"49": 262,
|
|
75
|
-
"233": 620,
|
|
76
|
-
"350": 266,
|
|
77
|
-
"30": 202,
|
|
78
|
-
"299": 290,
|
|
79
|
-
"1-473": 352,
|
|
80
|
-
"1-671": 535,
|
|
81
|
-
"502": 704,
|
|
82
|
-
"224": 537,
|
|
83
|
-
"592": 738,
|
|
84
|
-
"509": 372,
|
|
85
|
-
"504": 708,
|
|
86
|
-
"852": 454,
|
|
87
|
-
"36": 216,
|
|
88
|
-
"354": 274,
|
|
89
|
-
"91": 404,
|
|
90
|
-
"62": 510,
|
|
91
|
-
"98": 432,
|
|
92
|
-
"964": 418,
|
|
93
|
-
"353": 234,
|
|
94
|
-
"972": 425,
|
|
95
|
-
"39": 222,
|
|
96
|
-
"225": 612,
|
|
97
|
-
"1-876": 338,
|
|
98
|
-
"81": 440,
|
|
99
|
-
"962": 416,
|
|
100
|
-
"254": 639,
|
|
101
|
-
"686": 545,
|
|
102
|
-
"383": 221,
|
|
103
|
-
"965": 419,
|
|
104
|
-
"371": 247,
|
|
105
|
-
"961": 415,
|
|
106
|
-
"266": 651,
|
|
107
|
-
"231": 618,
|
|
108
|
-
"218": 606,
|
|
109
|
-
"423": 295,
|
|
110
|
-
"370": 246,
|
|
111
|
-
"352": 270,
|
|
112
|
-
"389": 294,
|
|
113
|
-
"261": 646,
|
|
114
|
-
"265": 650,
|
|
115
|
-
"60": 502,
|
|
116
|
-
"960": 472,
|
|
117
|
-
"223": 610,
|
|
118
|
-
"356": 278,
|
|
119
|
-
"692": 551,
|
|
120
|
-
"222": 609,
|
|
121
|
-
"230": 617,
|
|
122
|
-
"52": 334,
|
|
123
|
-
"691": 550,
|
|
124
|
-
"373": 259,
|
|
125
|
-
"377": 212,
|
|
126
|
-
"976": 428,
|
|
127
|
-
"382": 297,
|
|
128
|
-
"1-664": 354,
|
|
129
|
-
"212": 604,
|
|
130
|
-
"258": 643,
|
|
131
|
-
"95": 414,
|
|
132
|
-
"264": 649,
|
|
133
|
-
"674": 536,
|
|
134
|
-
"977": 429,
|
|
135
|
-
"31": 204,
|
|
136
|
-
"687": 546,
|
|
137
|
-
"64": 530,
|
|
138
|
-
"505": 710,
|
|
139
|
-
"227": 614,
|
|
140
|
-
"234": 621,
|
|
141
|
-
"683": 555,
|
|
142
|
-
"1-670": 534,
|
|
143
|
-
"47": 242,
|
|
144
|
-
"968": 226,
|
|
145
|
-
"92": 410,
|
|
146
|
-
"680": 552,
|
|
147
|
-
"970": 423,
|
|
148
|
-
"507": 714,
|
|
149
|
-
"675": 537,
|
|
150
|
-
"595": 744,
|
|
151
|
-
"51": 716,
|
|
152
|
-
"63": 515,
|
|
153
|
-
"48": 260,
|
|
154
|
-
"351": 268,
|
|
155
|
-
"1-787, 1-939": 330,
|
|
156
|
-
"974": 427,
|
|
157
|
-
"242": 630,
|
|
158
|
-
"40": 226,
|
|
159
|
-
"7": 250,
|
|
160
|
-
"250": 635,
|
|
161
|
-
"290": 658,
|
|
162
|
-
"1-869": 356,
|
|
163
|
-
"1-758": 358,
|
|
164
|
-
"508": 308,
|
|
165
|
-
"1-784": 360,
|
|
166
|
-
"685": 544,
|
|
167
|
-
"378": 292,
|
|
168
|
-
"239": 626,
|
|
169
|
-
"966": 420,
|
|
170
|
-
"221": 608,
|
|
171
|
-
"381": 220,
|
|
172
|
-
"248": 633,
|
|
173
|
-
"232": 619,
|
|
174
|
-
"65": 525,
|
|
175
|
-
"386": 293,
|
|
176
|
-
"677": 540,
|
|
177
|
-
"27": 655,
|
|
178
|
-
"211": 659,
|
|
179
|
-
"34": 214,
|
|
180
|
-
"94": 413,
|
|
181
|
-
"249": 634,
|
|
182
|
-
"597": 746,
|
|
183
|
-
"268": 653,
|
|
184
|
-
"46": 240,
|
|
185
|
-
"41": 228,
|
|
186
|
-
"963": 417,
|
|
187
|
-
"886": 466,
|
|
188
|
-
"992": 436,
|
|
189
|
-
"255": 640,
|
|
190
|
-
"66": 520,
|
|
191
|
-
"228": 615,
|
|
192
|
-
"690": 554,
|
|
193
|
-
"676": 539,
|
|
194
|
-
"1-868": 374,
|
|
195
|
-
"216": 605,
|
|
196
|
-
"90": 286,
|
|
197
|
-
"993": 438,
|
|
198
|
-
"1-649": 376,
|
|
199
|
-
"688": 553,
|
|
200
|
-
"1-340": 332,
|
|
201
|
-
"256": 641,
|
|
202
|
-
"380": 255,
|
|
203
|
-
"971": 424,
|
|
204
|
-
"44": 234,
|
|
205
|
-
"1": 310,
|
|
206
|
-
"598": 748,
|
|
207
|
-
"998": 434,
|
|
208
|
-
"678": 541,
|
|
209
|
-
"379": 225,
|
|
210
|
-
"58": 734,
|
|
211
|
-
"681": 543,
|
|
212
|
-
"967": 421,
|
|
213
|
-
"260": 645,
|
|
214
|
-
"263": 648,
|
|
215
|
-
"670": 514,
|
|
216
|
-
"245": 632,
|
|
217
|
-
"856": 457,
|
|
218
|
-
"599": 362,
|
|
219
|
-
"850": 467,
|
|
220
|
-
"262": 647,
|
|
221
|
-
"82": 450,
|
|
222
|
-
"84": 452
|
|
223
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Socket } from 'net';
|
|
3
|
-
import { AbstractSocketClient } from './abstract-socket-client';
|
|
4
|
-
export declare class MobileSocketClient extends AbstractSocketClient {
|
|
5
|
-
protected socket: Socket | null;
|
|
6
|
-
get isOpen(): boolean;
|
|
7
|
-
get isClosed(): boolean;
|
|
8
|
-
get isClosing(): boolean;
|
|
9
|
-
get isConnecting(): boolean;
|
|
10
|
-
connect(): Promise<void>;
|
|
11
|
-
close(): Promise<void>;
|
|
12
|
-
send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
|
|
13
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MobileSocketClient = void 0;
|
|
4
|
-
const net_1 = require("net");
|
|
5
|
-
const abstract_socket_client_1 = require("./abstract-socket-client");
|
|
6
|
-
class MobileSocketClient extends abstract_socket_client_1.AbstractSocketClient {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.socket = null;
|
|
10
|
-
}
|
|
11
|
-
get isOpen() {
|
|
12
|
-
var _a;
|
|
13
|
-
return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'open';
|
|
14
|
-
}
|
|
15
|
-
get isClosed() {
|
|
16
|
-
var _a;
|
|
17
|
-
return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
|
|
18
|
-
}
|
|
19
|
-
get isClosing() {
|
|
20
|
-
var _a;
|
|
21
|
-
return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
|
|
22
|
-
}
|
|
23
|
-
get isConnecting() {
|
|
24
|
-
var _a;
|
|
25
|
-
return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'opening';
|
|
26
|
-
}
|
|
27
|
-
async connect() {
|
|
28
|
-
var _a;
|
|
29
|
-
if (this.socket) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (this.config.agent) {
|
|
33
|
-
throw new Error('There are not support for proxy agent for mobile connection');
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.socket = (0, net_1.connect)({
|
|
37
|
-
host: this.url.hostname,
|
|
38
|
-
port: Number(this.url.port) || 443
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
this.socket.setMaxListeners(0);
|
|
42
|
-
const events = ['close', 'connect', 'data', 'drain', 'end', 'error', 'lookup', 'ready', 'timeout'];
|
|
43
|
-
for (const event of events) {
|
|
44
|
-
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.on(event, (...args) => this.emit(event, ...args));
|
|
45
|
-
}
|
|
46
|
-
this.socket.on('data', (...args) => this.emit('message', ...args));
|
|
47
|
-
this.socket.on('ready', (...args) => this.emit('open', ...args));
|
|
48
|
-
}
|
|
49
|
-
async close() {
|
|
50
|
-
if (!this.socket) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
return new Promise(resolve => {
|
|
54
|
-
this.socket.end(resolve);
|
|
55
|
-
this.socket = null;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
send(str, cb) {
|
|
59
|
-
if (this.socket === null) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
return this.socket.write(str, undefined, cb);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.MobileSocketClient = MobileSocketClient;
|