@vanzxy/baileys 1.6.8 → 1.7.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.
Potentially problematic release.
This version of @vanzxy/baileys might be problematic. Click here for more details.
- package/NOTICE.md +111 -0
- package/README.md +138 -9
- package/lib/Framework/Bot.js +209 -0
- package/lib/Framework/Context.js +90 -0
- package/lib/Framework/MediaManager.js +152 -0
- package/lib/Framework/SessionManager.js +34 -0
- package/lib/Framework/StatsManager.js +120 -0
- package/lib/Framework/Store/SQLiteStore.js +74 -0
- package/lib/Framework/index.js +11 -0
- package/lib/Socket/index.js +4 -2
- package/lib/Socket/username.js +153 -0
- package/lib/Utils/MessageBuilder.js +67 -1
- package/lib/Utils/MessageBuilder_d.ts +133 -1
- package/lib/VoIP/worker-bootstrap.js +8 -8
- package/lib/index.js +3 -0
- package/package.json +39 -35
|
@@ -37,6 +37,138 @@ export interface TapTargetConfigurationParams {
|
|
|
37
37
|
buttonIndex?: number;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* A2UI/Bloks "basic" catalog node types — confirmed from captured traffic (see
|
|
42
|
+
* /areas/vanzxy-baileys.md), not a public spec, so treat this as best-effort autocomplete
|
|
43
|
+
* rather than an exhaustive guarantee. `ref` is a builder-only tag (stripped before send) so
|
|
44
|
+
* another node can reference this one via `BloksRef`.
|
|
45
|
+
*/
|
|
46
|
+
export interface BloksRef {
|
|
47
|
+
$ref: string;
|
|
48
|
+
}
|
|
49
|
+
export interface BloksNodeBase {
|
|
50
|
+
/** Builder-only tag so another node can reference this one via `{ $ref: ref }`. Stripped before send. */
|
|
51
|
+
ref?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface ColumnRowNode extends BloksNodeBase {
|
|
54
|
+
component: 'Column' | 'Row';
|
|
55
|
+
weight?: number;
|
|
56
|
+
justify?: string;
|
|
57
|
+
children?: BloksNode[];
|
|
58
|
+
}
|
|
59
|
+
export interface TextNode extends BloksNodeBase {
|
|
60
|
+
component: 'Text';
|
|
61
|
+
text: string;
|
|
62
|
+
variant?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface IconNode extends BloksNodeBase {
|
|
65
|
+
component: 'Icon';
|
|
66
|
+
name: string;
|
|
67
|
+
}
|
|
68
|
+
export interface DividerNode extends BloksNodeBase {
|
|
69
|
+
component: 'Divider';
|
|
70
|
+
}
|
|
71
|
+
export interface ImageNode extends BloksNodeBase {
|
|
72
|
+
component: 'Image';
|
|
73
|
+
url: string;
|
|
74
|
+
variant?: string;
|
|
75
|
+
fit?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface VideoNode extends BloksNodeBase {
|
|
78
|
+
component: 'Video';
|
|
79
|
+
url: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ListNode extends BloksNodeBase {
|
|
82
|
+
component: 'List';
|
|
83
|
+
children?: BloksNode[];
|
|
84
|
+
}
|
|
85
|
+
export interface TextFieldNode extends BloksNodeBase {
|
|
86
|
+
component: 'TextField';
|
|
87
|
+
label?: string;
|
|
88
|
+
value?: string;
|
|
89
|
+
variant?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface DateTimeInputNode extends BloksNodeBase {
|
|
92
|
+
component: 'DateTimeInput';
|
|
93
|
+
label?: string;
|
|
94
|
+
value?: string;
|
|
95
|
+
enableDate?: boolean;
|
|
96
|
+
enableTime?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface SliderNode extends BloksNodeBase {
|
|
99
|
+
component: 'Slider';
|
|
100
|
+
label?: string;
|
|
101
|
+
min?: number;
|
|
102
|
+
max?: number;
|
|
103
|
+
value?: number;
|
|
104
|
+
}
|
|
105
|
+
export interface CheckBoxNode extends BloksNodeBase {
|
|
106
|
+
component: 'CheckBox';
|
|
107
|
+
label?: string;
|
|
108
|
+
value?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface ChoicePickerNode extends BloksNodeBase {
|
|
111
|
+
component: 'ChoicePicker';
|
|
112
|
+
label?: string;
|
|
113
|
+
variant?: string;
|
|
114
|
+
displayStyle?: string;
|
|
115
|
+
options?: Array<{ label: string; value: string }>;
|
|
116
|
+
value?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Unlike the CTA/native-flow `Button` class elsewhere in this file, an A2UI Button node has no
|
|
120
|
+
* `label`/`type`+`name` — its label comes from a nested `child` (usually a `Text` node), and
|
|
121
|
+
* tapping it fires `action.call` (with `action.args`), not a native-flow button name.
|
|
122
|
+
*/
|
|
123
|
+
export interface BloksButtonNode extends BloksNodeBase {
|
|
124
|
+
component: 'Button';
|
|
125
|
+
child?: BloksNode;
|
|
126
|
+
variant?: string;
|
|
127
|
+
action?: { call: string; args?: Record<string, any> };
|
|
128
|
+
}
|
|
129
|
+
export interface ModalNode extends BloksNodeBase {
|
|
130
|
+
component: 'Modal';
|
|
131
|
+
trigger: string | BloksRef;
|
|
132
|
+
content: BloksNode | string | BloksRef;
|
|
133
|
+
}
|
|
134
|
+
export interface TabsNode extends BloksNodeBase {
|
|
135
|
+
component: 'Tabs';
|
|
136
|
+
tabs: Array<{ title: string; child: BloksNode }>;
|
|
137
|
+
}
|
|
138
|
+
export interface CardNode extends BloksNodeBase {
|
|
139
|
+
component: 'Card';
|
|
140
|
+
child?: BloksNode;
|
|
141
|
+
}
|
|
142
|
+
export interface AudioPlayerNode extends BloksNodeBase {
|
|
143
|
+
component: 'AudioPlayer';
|
|
144
|
+
url: string;
|
|
145
|
+
description?: string;
|
|
146
|
+
}
|
|
147
|
+
/** Fallback for components not yet confirmed on the wire — still works at runtime, just no prop-level autocomplete. */
|
|
148
|
+
export interface AnyBloksNode extends BloksNodeBase {
|
|
149
|
+
component: string;
|
|
150
|
+
[key: string]: any;
|
|
151
|
+
}
|
|
152
|
+
export type BloksNode =
|
|
153
|
+
| ColumnRowNode
|
|
154
|
+
| TextNode
|
|
155
|
+
| IconNode
|
|
156
|
+
| DividerNode
|
|
157
|
+
| ImageNode
|
|
158
|
+
| VideoNode
|
|
159
|
+
| ListNode
|
|
160
|
+
| TextFieldNode
|
|
161
|
+
| DateTimeInputNode
|
|
162
|
+
| SliderNode
|
|
163
|
+
| CheckBoxNode
|
|
164
|
+
| ChoicePickerNode
|
|
165
|
+
| BloksButtonNode
|
|
166
|
+
| ModalNode
|
|
167
|
+
| TabsNode
|
|
168
|
+
| CardNode
|
|
169
|
+
| AudioPlayerNode
|
|
170
|
+
| AnyBloksNode;
|
|
171
|
+
|
|
40
172
|
export class Button extends BaseBuilder {
|
|
41
173
|
constructor(client: any);
|
|
42
174
|
setVideo(path: string | Buffer, options?: Record<string, any>): this;
|
|
@@ -45,7 +177,7 @@ export class Button extends BaseBuilder {
|
|
|
45
177
|
setMedia(obj: Record<string, any>): this;
|
|
46
178
|
clearButtons(): this;
|
|
47
179
|
setParams(obj: Record<string, any>): this;
|
|
48
|
-
setBloksWidget(tree:
|
|
180
|
+
setBloksWidget(tree: BloksNode, options?: { uuid?: string; catalogId?: string; surfaceId?: string; version?: string }): this;
|
|
49
181
|
addButton(name: string, params: string | Record<string, any>): this;
|
|
50
182
|
makeRow(header?: string, title?: string, description?: string, id?: string): this;
|
|
51
183
|
makeSection(title?: string, highlight_label?: string): this;
|
|
@@ -346,7 +346,7 @@ global.importScripts = function (...urls) {
|
|
|
346
346
|
const code = fs.readFileSync(url, "utf8");
|
|
347
347
|
eval(code);
|
|
348
348
|
}
|
|
349
|
-
catch (e) { }
|
|
349
|
+
catch (e) { console.error(`[VoIP worker-bootstrap] importScripts failed for "${url}":`, e); }
|
|
350
350
|
}
|
|
351
351
|
};
|
|
352
352
|
if (typeof global.location === "undefined") {
|
|
@@ -550,7 +550,7 @@ const resolveLoaderModule = () => {
|
|
|
550
550
|
return resolved;
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
catch (e) { }
|
|
553
|
+
catch (e) { console.error(`[VoIP worker-bootstrap] resolveLoaderModule failed for "${moduleName}":`, e); }
|
|
554
554
|
}
|
|
555
555
|
return null;
|
|
556
556
|
};
|
|
@@ -621,7 +621,7 @@ global.self.WhatsAppVoipWasmWorkerCompatibleCallbacks = {
|
|
|
621
621
|
try {
|
|
622
622
|
e.postMessage(Object.assign({ type: "waWasmWorkerCompatibleCallback", __name: "loggingCallback" }, n));
|
|
623
623
|
}
|
|
624
|
-
catch (err) { }
|
|
624
|
+
catch (err) { console.error("[VoIP worker-bootstrap] loggingCallback postMessage failed:", err); }
|
|
625
625
|
},
|
|
626
626
|
initCaptureDriverJS: function (n) {
|
|
627
627
|
e.postMessage(Object.assign({ type: "waWasmWorkerCompatibleCallback", __name: "initCaptureDriverJS" }, n));
|
|
@@ -762,9 +762,9 @@ if (typedWorkerData && (typedWorkerData.loaderCode || typedWorkerData.workerModu
|
|
|
762
762
|
WAWebVoipJsWorkerMessageHandler = jsWorkerModule.default ?? jsWorkerModule;
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
|
-
catch (e) { }
|
|
765
|
+
catch (e) { console.error("[VoIP worker-bootstrap] WAWebVoipJsWorkerMessageHandler resolution failed:", e); }
|
|
766
766
|
}
|
|
767
|
-
catch (e) { }
|
|
767
|
+
catch (e) { console.error("[VoIP worker-bootstrap] loaderCode block failed:", e); }
|
|
768
768
|
}
|
|
769
769
|
if (!wasmLoader) {
|
|
770
770
|
const resourcesPath = typedWorkerData?.resourcesPath || path.join(__dirname, "wasm-resources");
|
|
@@ -780,7 +780,7 @@ if (!wasmLoader) {
|
|
|
780
780
|
}
|
|
781
781
|
wasmLoader = resolveLoaderModule();
|
|
782
782
|
}
|
|
783
|
-
catch (e) { }
|
|
783
|
+
catch (e) { console.error(`[VoIP worker-bootstrap] failed to run loader.js from "${rsrcPath}":`, e); }
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
786
|
let s = {};
|
|
@@ -936,7 +936,7 @@ function f(t) {
|
|
|
936
936
|
try {
|
|
937
937
|
yield WAWebVoipPersistentFS.initPersistentFS(_);
|
|
938
938
|
}
|
|
939
|
-
catch (err) { }
|
|
939
|
+
catch (err) { console.error("[VoIP worker-bootstrap] initPersistentFS failed:", err); }
|
|
940
940
|
}));
|
|
941
941
|
}
|
|
942
942
|
else {
|
|
@@ -1035,7 +1035,7 @@ e.addMessageListener("waWasmWorkerCompatibleCallback", function (msg) {
|
|
|
1035
1035
|
global.self.WhatsAppVoipWasmWorkerCompatibleCallbacks[callbackName](args);
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
|
-
catch (err) { }
|
|
1038
|
+
catch (err) { console.error("[VoIP worker-bootstrap] message handler failed:", err); }
|
|
1039
1039
|
});
|
|
1040
1040
|
if (parentPort) {
|
|
1041
1041
|
parentPort.postMessage({ type: "worker_ready" });
|
package/lib/index.js
CHANGED
|
@@ -8,6 +8,9 @@ export * from './WABinary/index.js';
|
|
|
8
8
|
export * from './WAM/index.js';
|
|
9
9
|
export * from './WAUSync/index.js';
|
|
10
10
|
export { Dugong } from './Socket/dugong.js';
|
|
11
|
+
// Vanz@Port --- Enterprise Bot Framework (Bot/Context/SessionManager/
|
|
12
|
+
// StatsManager/MediaManager/SQLiteStore). See lib/Framework/index.js.
|
|
13
|
+
export { Bot, Context, MediaManager, SessionManager, StatsManager, SQLiteStore } from './Framework/index.js';
|
|
11
14
|
// Vanz@Add --- ported from ourin-baileys 9.0.11. Audio-only WhatsApp voice-call
|
|
12
15
|
// handling (WASM call stack + WebRTC relay via optional `@roamhq/wrtc`). See
|
|
13
16
|
// lib/VoIP/index.js for usage — instantiate VoipClient(sock) after connection.open.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanzxy/baileys",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Enhanced Baileys fork by Vanzxy \u2014 based on @itsliaaa/baileys + @whiskeysockets/baileys with fixes for audio group status and clean media without newsletter button.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -34,39 +34,39 @@
|
|
|
34
34
|
"NOTICE.md"
|
|
35
35
|
],
|
|
36
36
|
"keywords": [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
37
|
+
"vanzxy",
|
|
38
|
+
"vanzxybaileys",
|
|
39
|
+
"vanzxy-baileys",
|
|
40
|
+
"vanzxy-whatsapp",
|
|
41
|
+
"vanzxy-baileys-md",
|
|
42
|
+
"baileys-fork-vanzxy",
|
|
43
|
+
"baileys",
|
|
44
|
+
"baileys-md",
|
|
45
|
+
"baileys-multi-device",
|
|
46
|
+
"baileys-multidevice",
|
|
47
|
+
"baileys-whatsapp",
|
|
48
|
+
"baileys-whatsapp-api",
|
|
49
|
+
"baileys-whatsapp-bot",
|
|
50
|
+
"baileys-bot",
|
|
51
|
+
"baileys-api",
|
|
52
|
+
"baileys-library",
|
|
53
|
+
"baileys-node",
|
|
54
|
+
"baileys-nodejs",
|
|
55
|
+
"baileys-javascript",
|
|
56
|
+
"baileys-js",
|
|
57
|
+
"baileys-esm",
|
|
58
|
+
"baileys-fork",
|
|
59
|
+
"whatsapp-baileys",
|
|
60
|
+
"whatsapp-bot-baileys",
|
|
61
|
+
"whatsapp-api-baileys",
|
|
62
|
+
"whatsapp-web-baileys",
|
|
63
|
+
"whatsapp-multi-device",
|
|
64
|
+
"whatsapp-automation",
|
|
65
|
+
"whatsapp-bot",
|
|
66
|
+
"whatsapp-api",
|
|
67
|
+
"whatsapp-web",
|
|
68
|
+
"multi-device",
|
|
69
|
+
"interactive-messages"
|
|
70
70
|
],
|
|
71
71
|
"homepage": "https://github.com/vanzxysenpai/vanzxybaileys#readme",
|
|
72
72
|
"author": "Vanzxy",
|
|
@@ -98,7 +98,8 @@
|
|
|
98
98
|
"mongodb": "^6.10.0",
|
|
99
99
|
"mysql2": "^3.11.0",
|
|
100
100
|
"pg": "^8.13.0",
|
|
101
|
-
"sharp": "*"
|
|
101
|
+
"sharp": "*",
|
|
102
|
+
"node-webpmux": "^3.2.0"
|
|
102
103
|
},
|
|
103
104
|
"peerDependenciesMeta": {
|
|
104
105
|
"@napi-rs/image": {
|
|
@@ -133,6 +134,9 @@
|
|
|
133
134
|
},
|
|
134
135
|
"pg": {
|
|
135
136
|
"optional": true
|
|
137
|
+
},
|
|
138
|
+
"node-webpmux": {
|
|
139
|
+
"optional": true
|
|
136
140
|
}
|
|
137
141
|
},
|
|
138
142
|
"resolutions": {
|