alipclutch-baileys 8.3.0 → 8.4.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 +3 -1
- package/README.md +10 -9
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +4775 -0
- package/WAProto/index.d.ts +55057 -0
- package/WAProto/index.js +56887 -17535
- package/WAProto/index.ts.ts +53473 -0
- package/lib/Defaults/baileys-version.json +2 -2
- package/lib/Defaults/index.d.ts +16 -7
- package/lib/Defaults/index.js +90 -119
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/types.d.ts +0 -1
- package/lib/Socket/Client/types.js +0 -1
- package/lib/Socket/Client/websocket.d.ts +0 -1
- package/lib/Socket/Client/websocket.js +0 -1
- package/lib/Socket/business.d.ts +59 -58
- package/lib/Socket/chats.d.ts +45 -230
- package/lib/Socket/chats.js +139 -238
- package/lib/Socket/groups.d.ts +41 -32
- package/lib/Socket/groups.js +38 -23
- package/lib/Socket/index.d.ts +63 -64
- package/lib/Socket/index.js +2 -3
- package/lib/Socket/messages-recv.js +9 -65
- package/lib/Socket/messages-send.d.ts +49 -47
- package/lib/Socket/messages-send.js +584 -395
- package/lib/Socket/newsletter.d.ts +39 -37
- package/lib/Socket/newsletter.js +88 -123
- package/lib/Socket/setup.js +433 -0
- package/lib/Socket/{dugong.d.ts → setup.ts} +17 -52
- package/lib/Socket/socket.d.ts +10 -10
- package/lib/Socket/socket.js +62 -38
- package/lib/Socket/usync.d.ts +3 -4
- package/lib/Socket/usync.js +0 -1
- package/lib/Store/index.d.ts +1 -2
- package/lib/Store/index.js +1 -3
- package/lib/Store/make-in-memory-store.d.ts +24 -24
- package/lib/Store/make-in-memory-store.js +26 -14
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Auth.d.ts +0 -7
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +14 -7
- package/lib/Types/Contact.d.ts +5 -1
- package/lib/Types/Events.d.ts +44 -2
- package/lib/Types/GroupMetadata.d.ts +11 -2
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +148 -21
- package/lib/Types/Message.js +0 -2
- package/lib/Types/Newsletter.d.ts +73 -97
- package/lib/Types/Newsletter.js +18 -38
- package/lib/Types/Socket.d.ts +17 -9
- package/lib/Types/index.d.ts +8 -1
- package/lib/Types/index.js +2 -2
- package/lib/Utils/auth-utils.d.ts +3 -3
- package/lib/Utils/auth-utils.js +6 -13
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +15 -16
- package/lib/Utils/chat-utils.js +36 -35
- package/lib/Utils/crypto.d.ts +15 -16
- package/lib/Utils/crypto.js +71 -29
- package/lib/Utils/decode-wa-message.d.ts +22 -6
- package/lib/Utils/decode-wa-message.js +65 -56
- package/lib/Utils/event-buffer.d.ts +2 -2
- package/lib/Utils/event-buffer.js +11 -7
- package/lib/Utils/generics.d.ts +17 -20
- package/lib/Utils/generics.js +95 -75
- package/lib/Utils/history.d.ts +4 -0
- package/lib/Utils/history.js +4 -6
- package/lib/Utils/link-preview.d.ts +2 -2
- package/lib/Utils/link-preview.js +34 -1
- package/lib/Utils/logger.d.ts +10 -3
- package/lib/Utils/lt-hash.d.ts +2 -2
- package/lib/Utils/lt-hash.js +6 -6
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +28 -24
- package/lib/Utils/messages-media.js +272 -111
- package/lib/Utils/messages.d.ts +13 -10
- package/lib/Utils/messages.js +323 -50
- package/lib/Utils/noise-handler.d.ts +10 -12
- package/lib/Utils/noise-handler.js +18 -23
- package/lib/Utils/process-message.d.ts +5 -4
- package/lib/Utils/process-message.js +108 -25
- package/lib/Utils/signal.d.ts +2 -1
- package/lib/Utils/signal.js +26 -26
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -1
- package/lib/Utils/use-multi-file-auth-state.js +51 -6
- package/lib/Utils/validate-connection.d.ts +3 -4
- package/lib/Utils/validate-connection.js +90 -66
- package/lib/WABinary/constants.d.ts +24 -27
- package/lib/WABinary/constants.js +1276 -13
- package/lib/WABinary/decode.d.ts +3 -4
- package/lib/WABinary/decode.js +26 -13
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +137 -152
- package/lib/WABinary/generic-utils.d.ts +1 -4
- package/lib/WABinary/generic-utils.js +37 -125
- package/lib/WABinary/jid-utils.d.ts +11 -5
- package/lib/WABinary/jid-utils.js +28 -5
- package/lib/WABinary/jid-utils.js.bak +83 -0
- package/lib/WAM/BinaryInfo.d.ts +2 -11
- package/lib/WAM/encode.d.ts +1 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +27 -15
- package/package.json +18 -31
- package/engine-requirements.js +0 -10
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/web-socket-client.d.ts +0 -12
- package/lib/Socket/Client/web-socket-client.js +0 -62
- package/lib/Socket/dugong.js +0 -483
- package/lib/Socket/registration.d.ts +0 -267
- package/lib/Socket/registration.js +0 -166
- package/lib/Store/make-cache-manager-store.d.ts +0 -13
- package/lib/Store/make-cache-manager-store.js +0 -83
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
"version": [2, 3000, 1027934701]
|
|
3
|
+
}
|
package/lib/Defaults/index.d.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { proto } from '../../WAProto';
|
|
4
|
-
import type { MediaType, SocketConfig } from '../Types';
|
|
2
|
+
import type { MediaType, SocketConfig, WAVersion } from '../Types';
|
|
3
|
+
|
|
5
4
|
export declare const UNAUTHORIZED_CODES: number[];
|
|
6
5
|
export declare const DEFAULT_ORIGIN = "https://web.whatsapp.com";
|
|
6
|
+
export declare const CALL_VIDEO_PREFIX = "https://call.whatsapp.com/video/";
|
|
7
|
+
export declare const CALL_AUDIO_PREFIX = "https://call.whatsapp.com/voice/";
|
|
7
8
|
export declare const DEF_CALLBACK_PREFIX = "CB:";
|
|
8
9
|
export declare const DEF_TAG_PREFIX = "TAG:";
|
|
9
10
|
export declare const PHONE_CONNECTION_CB = "CB:Pong";
|
|
11
|
+
|
|
12
|
+
export declare const WA_ADV_ACCOUNT_SIG_PREFIX: Buffer;
|
|
13
|
+
export declare const WA_ADV_DEVICE_SIG_PREFIX: Buffer;
|
|
14
|
+
export declare const WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX: Buffer;
|
|
15
|
+
export declare const WA_ADV_HOSTED_DEVICE_SIG_PREFIX: Buffer;
|
|
16
|
+
|
|
10
17
|
export declare const WA_DEFAULT_EPHEMERAL: number;
|
|
11
18
|
export declare const NOISE_MODE = "Noise_XX_25519_AESGCM_SHA256\0\0\0\0";
|
|
12
|
-
export declare const DICT_VERSION =
|
|
19
|
+
export declare const DICT_VERSION = 3;
|
|
13
20
|
export declare const KEY_BUNDLE_TYPE: Buffer;
|
|
14
21
|
export declare const NOISE_WA_HEADER: Buffer;
|
|
15
|
-
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
|
16
22
|
export declare const URL_REGEX: RegExp;
|
|
17
23
|
export declare const WA_CERT_DETAILS: {
|
|
18
24
|
SERIAL: number;
|
|
@@ -41,10 +47,13 @@ export declare const MEDIA_HKDF_KEY_MAPPING: {
|
|
|
41
47
|
'product-catalog-image': string;
|
|
42
48
|
'payment-bg-image': string;
|
|
43
49
|
ptv: string;
|
|
50
|
+
'biz-cover-photo': string;
|
|
44
51
|
};
|
|
45
|
-
export declare const MEDIA_KEYS:
|
|
52
|
+
export declare const MEDIA_KEYS: MediaType[];
|
|
46
53
|
export declare const MIN_PREKEY_COUNT = 5;
|
|
47
|
-
export declare const INITIAL_PREKEY_COUNT =
|
|
54
|
+
export declare const INITIAL_PREKEY_COUNT = 812;
|
|
55
|
+
export declare const UPLOAD_TIMEOUT = 30000;
|
|
56
|
+
export declare const MIN_UPLOAD_INTERVAL = 5000;
|
|
48
57
|
export declare const DEFAULT_CACHE_TTLS: {
|
|
49
58
|
SIGNAL_STORE: number;
|
|
50
59
|
MSG_RETRY: number;
|
package/lib/Defaults/index.js
CHANGED
|
@@ -1,146 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
4
|
};
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.MEDIA_HKDF_KEY_MAPPING =
|
|
12
|
-
exports.MEDIA_PATH_MAP =
|
|
13
|
-
exports.DEFAULT_CONNECTION_CONFIG =
|
|
14
|
-
exports.PROCESSABLE_HISTORY_TYPES =
|
|
15
|
-
exports.WA_CERT_DETAILS =
|
|
16
|
-
exports.URL_REGEX =
|
|
17
|
-
exports.NOISE_WA_HEADER =
|
|
18
|
-
exports.KEY_BUNDLE_TYPE =
|
|
19
|
-
exports.DICT_VERSION =
|
|
20
|
-
exports.NOISE_MODE =
|
|
21
|
-
exports.WA_DEFAULT_EPHEMERAL =
|
|
22
|
-
exports.PHONE_CONNECTION_CB =
|
|
23
|
-
exports.DEF_TAG_PREFIX =
|
|
24
|
-
exports.DEF_CALLBACK_PREFIX =
|
|
25
|
-
exports.DEFAULT_ORIGIN =
|
|
26
|
-
exports.UNAUTHORIZED_CODES =
|
|
27
|
-
void 0;
|
|
28
|
-
|
|
29
|
-
const crypto_1 = require("crypto");
|
|
30
|
-
const WAProto_1 = require("../../WAProto"),
|
|
31
|
-
libsignal_1 = require("../Signal/libsignal"),
|
|
32
|
-
Utils_1 = require("../Utils"),
|
|
33
|
-
logger_1 = __importDefault(require("../Utils/logger")),
|
|
34
|
-
baileys_version_json_1 = require("./baileys-version.json");
|
|
35
|
-
phonenumber_mcc_json_1 = __importDefault(require("./phonenumber-mcc.json"));
|
|
36
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DEFAULT_CACHE_TTLS = exports.MIN_UPLOAD_INTERVAL = exports.UPLOAD_TIMEOUT = exports.INITIAL_PREKEY_COUNT = exports.MIN_PREKEY_COUNT = exports.MEDIA_KEYS = exports.MEDIA_HKDF_KEY_MAPPING = exports.MEDIA_PATH_MAP = exports.DEFAULT_CONNECTION_CONFIG = exports.PROCESSABLE_HISTORY_TYPES = exports.WA_CERT_DETAILS = exports.URL_REGEX = exports.NOISE_WA_HEADER = exports.KEY_BUNDLE_TYPE = exports.DICT_VERSION = exports.NOISE_MODE = exports.WA_DEFAULT_EPHEMERAL = exports.PHONE_CONNECTION_CB = exports.DEF_TAG_PREFIX = exports.DEF_CALLBACK_PREFIX = exports.CALL_AUDIO_PREFIX = exports.CALL_VIDEO_PREFIX = exports.DEFAULT_ORIGIN = exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX = exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = exports.WA_ADV_DEVICE_SIG_PREFIX = exports.WA_ADV_ACCOUNT_SIG_PREFIX = exports.UNAUTHORIZED_CODES = void 0;
|
|
7
|
+
const WAProto_1 = require("../../WAProto");
|
|
8
|
+
const libsignal_1 = require("../Signal/libsignal");
|
|
9
|
+
const Utils_1 = require("../Utils");
|
|
10
|
+
const logger_1 = __importDefault(require("../Utils/logger"));
|
|
11
|
+
const version = [2, 3000, 1027934701];
|
|
37
12
|
exports.UNAUTHORIZED_CODES = [401, 403, 419];
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
exports.
|
|
49
|
-
exports.
|
|
50
|
-
exports.
|
|
51
|
-
exports.REGISTRATION_PUBLIC_KEY = Buffer.from([
|
|
52
|
-
5, 142, 140, 15, 116, 195, 235, 197, 215, 166, 134, 92, 108, 60, 132, 56, 86, 176, 97, 33, 204, 232, 234, 119, 77,
|
|
53
|
-
34, 251, 111, 18, 37, 18, 48, 45,
|
|
54
|
-
]);
|
|
55
|
-
exports.NOISE_MODE = "Noise_XX_25519_AESGCM_SHA256\x00\x00\x00\x00";
|
|
56
|
-
exports.DICT_VERSION = 2;
|
|
13
|
+
exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
|
14
|
+
exports.CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
|
|
15
|
+
exports.CALL_AUDIO_PREFIX = 'https://call.whatsapp.com/voice/';
|
|
16
|
+
exports.DEF_CALLBACK_PREFIX = 'CB:';
|
|
17
|
+
exports.DEF_TAG_PREFIX = 'TAG:';
|
|
18
|
+
exports.PHONE_CONNECTION_CB = 'CB:Pong';
|
|
19
|
+
exports.WA_ADV_ACCOUNT_SIG_PREFIX = Buffer.from([6, 0]);
|
|
20
|
+
exports.WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1]);
|
|
21
|
+
exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5]);
|
|
22
|
+
exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6]);
|
|
23
|
+
exports.WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60;
|
|
24
|
+
exports.NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0';
|
|
25
|
+
exports.DICT_VERSION = 3;
|
|
57
26
|
exports.KEY_BUNDLE_TYPE = Buffer.from([5]);
|
|
58
27
|
exports.NOISE_WA_HEADER = Buffer.from([87, 65, 6, exports.DICT_VERSION]);
|
|
59
|
-
exports.PROTOCOL_VERSION = [5, 2];
|
|
60
|
-
exports.MOBILE_NOISE_HEADER = Buffer.concat([Buffer.from('WA'), Buffer.from(exports.PROTOCOL_VERSION)]);
|
|
61
|
-
|
|
62
28
|
exports.URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
|
|
63
|
-
exports.WA_CERT_DETAILS = {
|
|
64
|
-
|
|
29
|
+
exports.WA_CERT_DETAILS = {
|
|
30
|
+
SERIAL: 0,
|
|
31
|
+
};
|
|
65
32
|
exports.PROCESSABLE_HISTORY_TYPES = [
|
|
66
33
|
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_BOOTSTRAP,
|
|
67
34
|
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.PUSH_NAME,
|
|
68
35
|
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.RECENT,
|
|
69
36
|
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.FULL,
|
|
70
|
-
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.ON_DEMAND
|
|
37
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.ON_DEMAND,
|
|
71
38
|
];
|
|
72
|
-
|
|
73
39
|
exports.DEFAULT_CONNECTION_CONFIG = {
|
|
74
|
-
version:
|
|
75
|
-
browser: Utils_1.Browsers.ubuntu(
|
|
76
|
-
waWebSocketUrl:
|
|
77
|
-
connectTimeoutMs:
|
|
78
|
-
keepAliveIntervalMs:
|
|
79
|
-
logger: logger_1.default.child({ class:
|
|
80
|
-
printQRInTerminal:
|
|
81
|
-
emitOwnEvents:
|
|
82
|
-
defaultQueryTimeoutMs:
|
|
40
|
+
version: version,
|
|
41
|
+
browser: Utils_1.Browsers.ubuntu('Chrome'),
|
|
42
|
+
waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
|
|
43
|
+
connectTimeoutMs: 20000,
|
|
44
|
+
keepAliveIntervalMs: 30000,
|
|
45
|
+
logger: logger_1.default.child({ class: 'baileys' }),
|
|
46
|
+
printQRInTerminal: false,
|
|
47
|
+
emitOwnEvents: true,
|
|
48
|
+
defaultQueryTimeoutMs: 60000,
|
|
83
49
|
customUploadHosts: [],
|
|
84
50
|
retryRequestDelayMs: 250,
|
|
85
51
|
maxMsgRetryCount: 5,
|
|
86
|
-
fireInitQueries:
|
|
87
|
-
auth:
|
|
88
|
-
markOnlineOnConnect:
|
|
89
|
-
syncFullHistory:
|
|
90
|
-
patchMessageBeforeSending:
|
|
91
|
-
shouldSyncHistoryMessage: () =>
|
|
92
|
-
shouldIgnoreJid: () =>
|
|
52
|
+
fireInitQueries: true,
|
|
53
|
+
auth: undefined,
|
|
54
|
+
markOnlineOnConnect: true,
|
|
55
|
+
syncFullHistory: true,
|
|
56
|
+
patchMessageBeforeSending: msg => msg,
|
|
57
|
+
shouldSyncHistoryMessage: () => true,
|
|
58
|
+
shouldIgnoreJid: () => false,
|
|
93
59
|
linkPreviewImageThumbnailWidth: 192,
|
|
94
|
-
transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs:
|
|
95
|
-
generateHighQualityLinkPreview:
|
|
60
|
+
transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
|
|
61
|
+
generateHighQualityLinkPreview: false,
|
|
62
|
+
enableAutoSessionRecreation: true,
|
|
63
|
+
enableRecentMessageCache: true,
|
|
96
64
|
options: {},
|
|
97
|
-
appStateMacVerification: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
65
|
+
appStateMacVerification: {
|
|
66
|
+
patch: false,
|
|
67
|
+
snapshot: false,
|
|
68
|
+
},
|
|
69
|
+
countryCode: 'US',
|
|
70
|
+
getMessage: async () => undefined,
|
|
71
|
+
cachedGroupMetadata: async () => undefined,
|
|
101
72
|
makeSignalRepository: libsignal_1.makeLibSignalRepository
|
|
102
73
|
};
|
|
103
|
-
|
|
104
74
|
exports.MEDIA_PATH_MAP = {
|
|
105
|
-
image:
|
|
106
|
-
video:
|
|
107
|
-
document:
|
|
108
|
-
audio:
|
|
109
|
-
sticker:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
75
|
+
image: '/mms/image',
|
|
76
|
+
video: '/mms/video',
|
|
77
|
+
document: '/mms/document',
|
|
78
|
+
audio: '/mms/audio',
|
|
79
|
+
sticker: '/mms/image',
|
|
80
|
+
'thumbnail-link': '/mms/image',
|
|
81
|
+
'product-catalog-image': '/product/image',
|
|
82
|
+
'md-app-state': '',
|
|
83
|
+
'md-msg-hist': '/mms/md-app-state',
|
|
84
|
+
'biz-cover-photo': '/pps/biz-cover-photo'
|
|
114
85
|
};
|
|
115
|
-
|
|
116
86
|
exports.MEDIA_HKDF_KEY_MAPPING = {
|
|
117
|
-
audio:
|
|
118
|
-
document:
|
|
119
|
-
gif:
|
|
120
|
-
image:
|
|
121
|
-
ppic:
|
|
122
|
-
product:
|
|
123
|
-
ptt:
|
|
124
|
-
sticker:
|
|
125
|
-
video:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
ptv:
|
|
87
|
+
'audio': 'Audio',
|
|
88
|
+
'document': 'Document',
|
|
89
|
+
'gif': 'Video',
|
|
90
|
+
'image': 'Image',
|
|
91
|
+
'ppic': '',
|
|
92
|
+
'product': 'Image',
|
|
93
|
+
'ptt': 'Audio',
|
|
94
|
+
'sticker': 'Image',
|
|
95
|
+
'video': 'Video',
|
|
96
|
+
'thumbnail-document': 'Document Thumbnail',
|
|
97
|
+
'thumbnail-image': 'Image Thumbnail',
|
|
98
|
+
'thumbnail-video': 'Video Thumbnail',
|
|
99
|
+
'thumbnail-link': 'Link Thumbnail',
|
|
100
|
+
'md-msg-hist': 'History',
|
|
101
|
+
'md-app-state': 'App State',
|
|
102
|
+
'product-catalog-image': '',
|
|
103
|
+
'payment-bg-image': 'Payment Background',
|
|
104
|
+
'ptv': 'Video',
|
|
105
|
+
'biz-cover-photo': 'Image'
|
|
135
106
|
};
|
|
136
|
-
|
|
137
107
|
exports.MEDIA_KEYS = Object.keys(exports.MEDIA_PATH_MAP);
|
|
138
108
|
exports.MIN_PREKEY_COUNT = 5;
|
|
139
|
-
exports.INITIAL_PREKEY_COUNT =
|
|
140
|
-
|
|
109
|
+
exports.INITIAL_PREKEY_COUNT = 812;
|
|
110
|
+
exports.UPLOAD_TIMEOUT = 30000;
|
|
111
|
+
exports.MIN_UPLOAD_INTERVAL = 5000;
|
|
141
112
|
exports.DEFAULT_CACHE_TTLS = {
|
|
142
|
-
SIGNAL_STORE:
|
|
143
|
-
MSG_RETRY:
|
|
144
|
-
CALL_OFFER:
|
|
145
|
-
USER_DEVICES:
|
|
113
|
+
SIGNAL_STORE: 5 * 60,
|
|
114
|
+
MSG_RETRY: 60 * 60,
|
|
115
|
+
CALL_OFFER: 5 * 60,
|
|
116
|
+
USER_DEVICES: 5 * 60,
|
|
146
117
|
};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './web-socket-client';
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './websocket';
|
|
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./web-socket-client"), exports);
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./websocket"), exports);
|
package/lib/Socket/business.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { GetCatalogOptions, ProductCreate, ProductUpdate, SocketConfig } from '../Types';
|
|
3
2
|
import { BinaryNode } from '../WABinary';
|
|
4
3
|
export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
5
|
-
logger: import("
|
|
4
|
+
logger: import("../Utils/logger").ILogger;
|
|
6
5
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
7
6
|
getCatalog: ({ jid, limit, cursor }: GetCatalogOptions) => Promise<{
|
|
8
7
|
products: import("../Types").Product[];
|
|
@@ -16,41 +15,40 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
16
15
|
deleted: number;
|
|
17
16
|
}>;
|
|
18
17
|
productUpdate: (productId: string, update: ProductUpdate) => Promise<import("../Types").Product>;
|
|
19
|
-
sendMessageAck: ({ tag, attrs, content }: BinaryNode) => Promise<void>;
|
|
18
|
+
sendMessageAck: ({ tag, attrs, content }: BinaryNode, errorCode?: number) => Promise<void>;
|
|
20
19
|
sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
20
|
+
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
21
21
|
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
callId: string;
|
|
23
|
+
toJid: string;
|
|
24
|
+
isVideo: boolean;
|
|
24
25
|
}>;
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
|
|
27
|
+
requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
|
|
28
|
+
getPrivacyTokens: (jids: string[]) => Promise<any>;
|
|
27
29
|
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
28
|
-
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache,
|
|
30
|
+
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
29
31
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
30
|
-
sendReceipts: (keys: import("../Types").
|
|
31
|
-
|
|
32
|
-
[key: string]: string;
|
|
33
|
-
};
|
|
34
|
-
readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
|
|
32
|
+
sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
33
|
+
readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
|
|
35
34
|
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
36
|
-
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
|
|
37
|
-
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
|
|
38
|
-
[key: string]: string;
|
|
39
|
-
} | undefined) => Promise<{
|
|
40
|
-
nodes: BinaryNode[];
|
|
41
|
-
shouldIncludeDeviceIdentity: boolean;
|
|
42
|
-
}>;
|
|
43
35
|
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
44
36
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
45
37
|
[_: string]: string;
|
|
46
38
|
}>;
|
|
39
|
+
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
|
|
40
|
+
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: BinaryNode["attrs"]) => Promise<{
|
|
41
|
+
nodes: BinaryNode[];
|
|
42
|
+
shouldIncludeDeviceIdentity: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
47
45
|
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
48
|
-
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo
|
|
46
|
+
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
49
47
|
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
50
48
|
duration: string;
|
|
51
49
|
}>;
|
|
52
50
|
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
|
|
53
|
-
newsletterUpdateDescription: (jid: string, description?: string
|
|
51
|
+
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
54
52
|
newsletterUpdateName: (jid: string, name: string) => Promise<void>;
|
|
55
53
|
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
56
54
|
newsletterRemovePicture: (jid: string) => Promise<void>;
|
|
@@ -58,16 +56,16 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
58
56
|
newsletterFollow: (jid: string) => Promise<void>;
|
|
59
57
|
newsletterUnmute: (jid: string) => Promise<void>;
|
|
60
58
|
newsletterMute: (jid: string) => Promise<void>;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
|
|
59
|
+
newsletterCreate: (name: string, description?: string, picture?: import("../Types").WAMediaUpload) => Promise<import("../Types").NewsletterMetadata>;
|
|
60
|
+
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
|
64
61
|
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
65
62
|
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
|
66
63
|
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
|
67
64
|
newsletterDelete: (jid: string) => Promise<void>;
|
|
68
|
-
newsletterReactMessage: (jid: string,
|
|
69
|
-
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number
|
|
70
|
-
newsletterFetchUpdates: (jid: string, count: number, after?: number
|
|
65
|
+
newsletterReactMessage: (jid: string, server_id: string, code?: string) => Promise<void>;
|
|
66
|
+
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
67
|
+
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
68
|
+
groupQuery: (jid: string, type: "get" | "set", content: BinaryNode[]) => Promise<any>;
|
|
71
69
|
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
72
70
|
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
73
71
|
groupLeave: (id: string) => Promise<void>;
|
|
@@ -75,7 +73,7 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
75
73
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
76
74
|
[key: string]: string;
|
|
77
75
|
}[]>;
|
|
78
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "
|
|
76
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
79
77
|
status: string;
|
|
80
78
|
jid: string;
|
|
81
79
|
}[]>;
|
|
@@ -84,68 +82,71 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
84
82
|
jid: string;
|
|
85
83
|
content: BinaryNode;
|
|
86
84
|
}[]>;
|
|
87
|
-
groupUpdateDescription: (jid: string, description?: string
|
|
85
|
+
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
88
86
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
89
87
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
90
88
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
91
|
-
|
|
89
|
+
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
|
|
90
|
+
groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<any>;
|
|
92
91
|
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
93
92
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
94
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "
|
|
95
|
-
groupMemberAddMode: (jid: string, mode: "
|
|
93
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
94
|
+
groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
96
95
|
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
97
96
|
groupFetchAllParticipating: () => Promise<{
|
|
98
97
|
[_: string]: import("../Types").GroupMetadata;
|
|
99
98
|
}>;
|
|
99
|
+
getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
|
|
100
100
|
processingMutex: {
|
|
101
|
-
mutex<T>(code: () => T |
|
|
101
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
102
102
|
};
|
|
103
|
-
upsertMessage: (msg: import("../Types").
|
|
103
|
+
upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
104
104
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
105
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string
|
|
106
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer
|
|
107
|
-
profilePictureUrl: (jid: string, type?: "
|
|
105
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
106
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
107
|
+
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
108
108
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
109
109
|
jid: string;
|
|
110
110
|
exists: unknown;
|
|
111
111
|
lid: unknown;
|
|
112
112
|
}[] | undefined>;
|
|
113
113
|
fetchBlocklist: () => Promise<string[]>;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
setAt: Date;
|
|
117
|
-
} | undefined>;
|
|
114
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
115
|
+
fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
118
116
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
119
117
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
120
118
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
121
119
|
updateProfileName: (name: string) => Promise<void>;
|
|
122
120
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
121
|
+
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
122
|
+
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
123
123
|
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
124
124
|
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
125
125
|
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
126
126
|
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
127
127
|
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
128
|
-
updateGroupsAddPrivacy: (value: import("../Types").
|
|
128
|
+
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
|
|
129
129
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
130
|
-
getBusinessProfile: (jid: string) => Promise<
|
|
131
|
-
resyncAppState: (collections: readonly ("
|
|
130
|
+
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
131
|
+
resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
132
132
|
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
133
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?:
|
|
133
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
134
134
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
135
135
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
136
136
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
137
137
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
138
138
|
star: (jid: string, messages: {
|
|
139
139
|
id: string;
|
|
140
|
-
fromMe?: boolean
|
|
140
|
+
fromMe?: boolean;
|
|
141
141
|
}[], star: boolean) => Promise<void>;
|
|
142
|
+
executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
|
|
142
143
|
type: "md";
|
|
143
|
-
ws:
|
|
144
|
+
ws: import("./Client").WebSocketClient;
|
|
144
145
|
ev: import("../Types").BaileysEventEmitter & {
|
|
145
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
146
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
|
146
147
|
buffer(): void;
|
|
147
|
-
createBufferedFunction<A extends any[],
|
|
148
|
-
flush(force?: boolean
|
|
148
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
|
149
|
+
flush(force?: boolean): boolean;
|
|
149
150
|
isBuffering(): boolean;
|
|
150
151
|
};
|
|
151
152
|
authState: {
|
|
@@ -155,17 +156,17 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
155
156
|
signalRepository: import("../Types").SignalRepository;
|
|
156
157
|
user: import("../Types").Contact | undefined;
|
|
157
158
|
generateMessageTag: () => string;
|
|
158
|
-
query: (node: BinaryNode, timeoutMs?: number
|
|
159
|
-
waitForMessage: <
|
|
159
|
+
query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
|
|
160
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
|
|
160
161
|
waitForSocketOpen: () => Promise<void>;
|
|
161
162
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
162
163
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
163
|
-
logout: (msg?: string
|
|
164
|
+
logout: (msg?: string) => Promise<void>;
|
|
164
165
|
end: (error: Error | undefined) => void;
|
|
165
|
-
onUnexpectedError: (err: Error | import("@hapi/boom").Boom
|
|
166
|
+
onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
|
|
166
167
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
167
168
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
168
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
169
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined
|
|
170
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<
|
|
169
|
+
requestPairingCode: (phoneNumber: any, pairKey?: string) => Promise<string>;
|
|
170
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
171
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
171
172
|
};
|