@pontalabs/baileys 1.2.10 → 1.2.12
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 +221 -137
- package/WAProto/CHANGES-2.26.47.10.md +8 -0
- package/lib/Types/Message.d.ts +2 -0
- package/lib/Utils/beta-messages.js +25 -5
- package/lib/Utils/messages.js +2 -1
- package/lib/Utils/proto-extension-data.js +1 -0
- package/lib/Utils/proto-extensions-core.d.ts +5 -0
- package/lib/Utils/proto-extensions-core.js +300 -0
- package/lib/Utils/proto-extensions.d.ts +5 -0
- package/lib/Utils/proto-extensions.js +5 -0
- package/lib/Utils/rich-message-utils.d.ts +1 -0
- package/lib/Utils/rich-message-utils.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,87 +1,126 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
<img src="https://raw.githubusercontent.com/PontaSja/image/408b34d9d8521dd22688a24d6b28db3f8ab1825a/IMG-20260710-WA0070.jpg" alt="PontaSockets Banner" width="720" style="border-radius: 12px;" />
|
|
3
|
+
<a id="top"></a>
|
|
5
4
|
|
|
6
|
-
<
|
|
5
|
+
<img src="https://raw.githubusercontent.com/PontaSja/image/408b34d9d8521dd22688a24d6b28db3f8ab1825a/IMG-20260710-WA0070.jpg" alt="PontaLabs Baileys Banner" width="760" />
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</h2>
|
|
7
|
+
<h1>
|
|
8
|
+
<img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Hand%20gestures/Waving%20Hand.png" alt="Waving Hand" width="36" />
|
|
9
|
+
Baileys PontaLabs
|
|
10
|
+
</h1>
|
|
13
11
|
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<img src="https://img.shields.io/npm/v/@pontalabs/baileys?style=flat-square&color=cb3837&label=npm&logo=npm" alt="NPM Version" />
|
|
19
|
-
</a>
|
|
20
|
-
<a href="https://nodejs.org">
|
|
21
|
-
<img src="https://img.shields.io/badge/node-%3E%3D18.x-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node.js" />
|
|
22
|
-
</a>
|
|
23
|
-
<a href="./LICENSE">
|
|
24
|
-
<img src="https://img.shields.io/badge/license-Non--Commercial-orange?style=flat-square" alt="License" />
|
|
25
|
-
</a>
|
|
26
|
-
<a href="https://github.com/WhiskeySockets/Baileys">
|
|
27
|
-
<img src="https://img.shields.io/badge/fork-whiskeysockets%2Fbaileys-blue?style=flat-square&logo=github" alt="Fork" />
|
|
28
|
-
</a>
|
|
12
|
+
<p>
|
|
13
|
+
<b>WhatsApp Web API untuk Node.js</b> — fork dari <code>@whiskeysockets/baileys</code><br>
|
|
14
|
+
dengan patch eksklusif, AI rich messages, dan fitur WhatsApp tingkat lanjut.
|
|
15
|
+
</p>
|
|
29
16
|
|
|
30
|
-
<
|
|
17
|
+
<p>
|
|
18
|
+
<a href="https://www.npmjs.com/package/@pontalabs/baileys"><img src="https://img.shields.io/npm/v/@pontalabs/baileys?style=for-the-badge&color=cb3837&label=npm&logo=npm" alt="NPM Version" /></a>
|
|
19
|
+
<a href="https://www.npmjs.com/package/@pontalabs/baileys"><img src="https://img.shields.io/npm/dm/@pontalabs/baileys?style=for-the-badge&color=0ea5e9&label=downloads" alt="NPM Downloads" /></a>
|
|
20
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20.x-339933?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js" /></a>
|
|
21
|
+
<br>
|
|
22
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-Non--Commercial-orange?style=for-the-badge" alt="License" /></a>
|
|
23
|
+
<a href="https://github.com/WhiskeySockets/Baileys"><img src="https://img.shields.io/badge/fork_of-WhiskeySockets%2FBaileys-1f6feb?style=for-the-badge&logo=github" alt="Fork" /></a>
|
|
24
|
+
<a href="https://whatsapp.com/channel/0029VaAAkwOIN9ii1Tc6Mz1X"><img src="https://img.shields.io/badge/WhatsApp-Channel-25D366?style=for-the-badge&logo=whatsapp&logoColor=white" alt="WhatsApp Channel" /></a>
|
|
25
|
+
</p>
|
|
31
26
|
|
|
32
|
-
<p
|
|
27
|
+
<p>
|
|
28
|
+
<a href="#-installation"><b>Installation</b></a> •
|
|
29
|
+
<a href="#-quick-start"><b>Quick Start</b></a> •
|
|
30
|
+
<a href="#-documentation"><b>Documentation</b></a> •
|
|
31
|
+
<a href="#-rich-messages"><b>Rich Messages</b></a> •
|
|
32
|
+
<a href="https://app.pontalabs.zone.id"><b>REST API</b></a> •
|
|
33
|
+
<a href="#-contact"><b>Contact</b></a>
|
|
34
|
+
</p>
|
|
33
35
|
|
|
34
36
|
</div>
|
|
35
37
|
|
|
38
|
+
<br>
|
|
39
|
+
|
|
40
|
+
> [!TIP]
|
|
41
|
+
> **⚡ PontaLabs REST API** — Tidak mau repot setup socket sendiri? Pakai REST API PontaLabs dan nikmati semua fiturnya langsung lewat HTTP.
|
|
42
|
+
>
|
|
43
|
+
> <a href="https://app.pontalabs.zone.id"><img src="https://img.shields.io/badge/REST_API-Explore_Now-8B5CF6?style=for-the-badge&logo=fastapi&logoColor=white" alt="Explore REST API" /></a> 🔗 **[app.pontalabs.zone.id](https://app.pontalabs.zone.id)**
|
|
44
|
+
|
|
36
45
|
---
|
|
37
46
|
|
|
38
|
-
|
|
47
|
+
## ✨ Features
|
|
39
48
|
|
|
40
|
-
<
|
|
49
|
+
<table>
|
|
50
|
+
<tr>
|
|
51
|
+
<td width="50%" valign="top">
|
|
41
52
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</a>
|
|
46
|
-
</p>
|
|
53
|
+
**🔌 Koneksi**
|
|
54
|
+
- Login via QR Code atau Pairing Code
|
|
55
|
+
- Custom pairing code 8 digit
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
**📨 Pesan Standar**
|
|
58
|
+
- Text, Image, Video, Audio/PTT, Music
|
|
59
|
+
- Instant media, Spoiler, View Once
|
|
60
|
+
- Audio Sticker, Album, Contact, Location
|
|
61
|
+
- Poll & Quiz, Event & Event Invite
|
|
62
|
+
- After-read timer, Pin & Keep
|
|
49
63
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<b>https://app.pontalabs.zone.id</b>
|
|
53
|
-
</a>
|
|
54
|
-
</p>
|
|
64
|
+
</td>
|
|
65
|
+
<td width="50%" valign="top">
|
|
55
66
|
|
|
56
|
-
|
|
67
|
+
**🤖 AI Rich Messages**
|
|
68
|
+
- Rich Text, HTML, Code Block, Table
|
|
69
|
+
- Images, Video, LaTeX, Suggestions
|
|
70
|
+
- Product, Post, Reels, Sources
|
|
71
|
+
- Mixed `items` & `richResponse` + citation
|
|
57
72
|
|
|
58
|
-
|
|
73
|
+
**🧩 Interaktif & Lainnya**
|
|
74
|
+
- Native Flow, Carousel, List, Buttons
|
|
75
|
+
- Location + Buttons, Order Status
|
|
76
|
+
- Newsletter, Groups, Group Status, Privacy
|
|
77
|
+
|
|
78
|
+
</td>
|
|
79
|
+
</tr>
|
|
80
|
+
</table>
|
|
59
81
|
|
|
60
82
|
---
|
|
61
83
|
|
|
62
84
|
## 📑 Table of Contents
|
|
63
85
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- [
|
|
68
|
-
- [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- [
|
|
73
|
-
- [
|
|
74
|
-
- [
|
|
75
|
-
- [
|
|
76
|
-
- [
|
|
77
|
-
- [
|
|
78
|
-
- [
|
|
79
|
-
- [
|
|
86
|
+
<details open>
|
|
87
|
+
<summary><b>Klik untuk buka / tutup</b></summary>
|
|
88
|
+
|
|
89
|
+
- [✨ Features](#-features)
|
|
90
|
+
- [📋 Requirements](#-requirements)
|
|
91
|
+
- [📥 Installation](#-installation)
|
|
92
|
+
- [🚀 Quick Start](#-quick-start)
|
|
93
|
+
- [📖 Documentation](#-documentation)
|
|
94
|
+
- [🔌 Connecting](#-connecting)
|
|
95
|
+
- [📡 Events](#-events)
|
|
96
|
+
- [📨 Sending Messages](#-sending-messages)
|
|
97
|
+
- [📍 Location + Buttons](#-location--buttons)
|
|
98
|
+
- [📦 Order Status](#-order-status)
|
|
99
|
+
- [🤖 Rich Messages](#-rich-messages)
|
|
100
|
+
- [📣 Newsletter](#-newsletter)
|
|
101
|
+
- [👥 Groups](#-groups)
|
|
102
|
+
- [🔒 Privacy](#-privacy)
|
|
103
|
+
- [⚙️ Advanced](#️-advanced)
|
|
104
|
+
- [💬 Contact](#-contact)
|
|
105
|
+
- [🤝 Contributing](#-contributing)
|
|
106
|
+
- [📜 License](#-license)
|
|
107
|
+
- [⚠️ Disclaimer](#️-disclaimer)
|
|
108
|
+
|
|
109
|
+
</details>
|
|
80
110
|
|
|
81
111
|
---
|
|
82
112
|
|
|
83
|
-
|
|
84
|
-
|
|
113
|
+
## 📋 Requirements
|
|
114
|
+
|
|
115
|
+
| Kebutuhan | Versi |
|
|
116
|
+
|:---|:---|
|
|
117
|
+
| Node.js | `>= 20.x` |
|
|
118
|
+
| Package manager | npm / yarn / pnpm / bun |
|
|
119
|
+
| Akun WhatsApp | Aktif, untuk scan QR atau pairing code |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 📥 Installation
|
|
85
124
|
|
|
86
125
|
```bash
|
|
87
126
|
# npm
|
|
@@ -89,14 +128,17 @@ npm install @pontalabs/baileys
|
|
|
89
128
|
|
|
90
129
|
# yarn
|
|
91
130
|
yarn add @pontalabs/baileys
|
|
92
|
-
```
|
|
93
131
|
|
|
94
|
-
|
|
132
|
+
# pnpm
|
|
133
|
+
pnpm add @pontalabs/baileys
|
|
134
|
+
|
|
135
|
+
# bun
|
|
136
|
+
bun add @pontalabs/baileys
|
|
137
|
+
```
|
|
95
138
|
|
|
96
139
|
---
|
|
97
140
|
|
|
98
|
-
|
|
99
|
-
<summary><h2>🚀 Quick Start</h2></summary>
|
|
141
|
+
## 🚀 Quick Start
|
|
100
142
|
|
|
101
143
|
```js
|
|
102
144
|
import makeWASocket, { useMultiFileAuthState } from '@pontalabs/baileys'
|
|
@@ -119,7 +161,10 @@ async function start() {
|
|
|
119
161
|
start()
|
|
120
162
|
```
|
|
121
163
|
|
|
122
|
-
|
|
164
|
+
> [!NOTE]
|
|
165
|
+
> Sesi login disimpan di folder `./sessions`. Jalankan ulang script tanpa perlu scan QR lagi selama sesi masih valid.
|
|
166
|
+
|
|
167
|
+
<div align="right"><a href="#top">⬆️ Back to top</a></div>
|
|
123
168
|
|
|
124
169
|
---
|
|
125
170
|
|
|
@@ -189,13 +234,16 @@ sock.ev.on('messages.update', (m) => {
|
|
|
189
234
|
|
|
190
235
|
### 📨 Sending Messages
|
|
191
236
|
|
|
192
|
-
```
|
|
237
|
+
```ts
|
|
193
238
|
sock.sendMessage(jid, content, options?)
|
|
194
|
-
// jid — Recipient JID (user or group)
|
|
195
|
-
// content — Message payload object
|
|
196
|
-
// options — Optional: { quoted, ephemeral, ... }
|
|
197
239
|
```
|
|
198
240
|
|
|
241
|
+
| Parameter | Keterangan |
|
|
242
|
+
|:---|:---|
|
|
243
|
+
| `jid` | Recipient JID (user atau group) |
|
|
244
|
+
| `content` | Message payload object |
|
|
245
|
+
| `options` | Opsional: `{ quoted, ephemeral, ... }` |
|
|
246
|
+
|
|
199
247
|
#### Standard Messages
|
|
200
248
|
|
|
201
249
|
<details>
|
|
@@ -257,8 +305,8 @@ await sock.sendMessage(jid, {
|
|
|
257
305
|
<summary><b>⚡ Instant Image / Video</b></summary>
|
|
258
306
|
|
|
259
307
|
```js
|
|
260
|
-
await sock.sendMessage(jid, { instantImage: { url: '
|
|
261
|
-
await sock.sendMessage(jid, { instantVideo: { url: '
|
|
308
|
+
await sock.sendMessage(jid, { instantImage: { url: 'https://example.com/foto.jpg' }, caption: 'Instan' })
|
|
309
|
+
await sock.sendMessage(jid, { instantVideo: { url: 'https://example.com/klip.mp4' }, caption: 'Instan' })
|
|
262
310
|
```
|
|
263
311
|
|
|
264
312
|
</details>
|
|
@@ -268,7 +316,7 @@ await sock.sendMessage(jid, { instantVideo: { url: './klip.mp4' }, caption: 'Ins
|
|
|
268
316
|
|
|
269
317
|
```js
|
|
270
318
|
await sock.sendMessage(jid, {
|
|
271
|
-
image: { url: '
|
|
319
|
+
image: { url: 'https://example.com/foto.jpg' },
|
|
272
320
|
caption: 'Awas spoiler',
|
|
273
321
|
spoiler: true
|
|
274
322
|
})
|
|
@@ -298,12 +346,15 @@ await sock.sendMessage(jid, {
|
|
|
298
346
|
```js
|
|
299
347
|
await sock.sendMessage(jid, {
|
|
300
348
|
audioSticker: {
|
|
301
|
-
sticker: { url: '
|
|
302
|
-
audio: { url: '
|
|
349
|
+
sticker: { url: 'https://example.com/stiker.webp' },
|
|
350
|
+
audio: { url: 'https://example.com/suara.ogg' },
|
|
351
|
+
animated: false,
|
|
352
|
+
seconds: 5
|
|
303
353
|
}
|
|
304
354
|
})
|
|
305
355
|
```
|
|
306
356
|
|
|
357
|
+
> `sticker` harus WebP 512x512 dan `audio` harus OGG Opus (voice note). Keduanya bisa berupa `{ url }` atau Buffer, misalnya `fs.readFileSync('./suara.ogg')` untuk file lokal. `animated` dan `seconds` opsional.
|
|
307
358
|
</details>
|
|
308
359
|
|
|
309
360
|
<details>
|
|
@@ -635,6 +686,9 @@ await sock.sendMessage(jid, {
|
|
|
635
686
|
|
|
636
687
|
</details>
|
|
637
688
|
|
|
689
|
+
|
|
690
|
+
<div align="right"><a href="#top">⬆️ Back to top</a></div>
|
|
691
|
+
|
|
638
692
|
---
|
|
639
693
|
|
|
640
694
|
### 📍 Location + Buttons
|
|
@@ -721,20 +775,25 @@ await sock.sendMessage(jid, {
|
|
|
721
775
|
<details>
|
|
722
776
|
<summary><b>📋 Fields Reference</b></summary>
|
|
723
777
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
778
|
+
| Field | Type | Keterangan | Default |
|
|
779
|
+
|:---|:---|:---|:---|
|
|
780
|
+
| `latitude` | `number` | Latitude coordinate | `0` |
|
|
781
|
+
| `longitude` | `number` | Longitude coordinate | `0` |
|
|
782
|
+
| `name` | `string` | Place name | `'Location'` |
|
|
783
|
+
| `address` | `string` | Text address | `''` |
|
|
784
|
+
| `text` | `string` | Message body text | `''` |
|
|
785
|
+
| `footer` | `string` | Footer text | `''` |
|
|
786
|
+
| `thumbnail` | `Buffer / URL / path` | Map preview image | ✅ required |
|
|
787
|
+
| `listButtonText` | `string` | List button label | `'Pilih Menu'` |
|
|
788
|
+
| `listSectionTitle` | `string` | List section title | `'Pilihan'` |
|
|
789
|
+
| `listMenu` | `array` | Menu rows | — |
|
|
790
|
+
| `extraButtons` | `array` | Extra buttons | — |
|
|
735
791
|
|
|
736
792
|
</details>
|
|
737
793
|
|
|
794
|
+
|
|
795
|
+
<div align="right"><a href="#top">⬆️ Back to top</a></div>
|
|
796
|
+
|
|
738
797
|
---
|
|
739
798
|
|
|
740
799
|
### 📦 Order Status
|
|
@@ -801,28 +860,39 @@ await sock.sendMessage(jid, {
|
|
|
801
860
|
<details>
|
|
802
861
|
<summary><b>📋 Fields Reference</b></summary>
|
|
803
862
|
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
863
|
+
| Field | Type | Keterangan | Default |
|
|
864
|
+
|:---|:---|:---|:---|
|
|
865
|
+
| `image` | `Buffer / URL / path` | Header card image | ✅ required |
|
|
866
|
+
| `title` | `string` | Header title | `'Order Status'` |
|
|
867
|
+
| `text` | `string` | Body text | `'Silakan cek status pesanan Anda.'` |
|
|
868
|
+
| `footer` | `string` | Footer text | `'Powered by PontaCT'` |
|
|
869
|
+
| `referenceId` | `string` | Order reference ID | `'PT-001'` |
|
|
870
|
+
| `status` | `string` | Order status | `'PROCESSING'` |
|
|
871
|
+
| `subtotalValue` | `number` | Subtotal value (in offset units) | `0` |
|
|
872
|
+
| `subtotalOffset` | `number` | Value divider | `100` |
|
|
873
|
+
| `taxValue` | `number` | Tax value | `0` |
|
|
874
|
+
| `taxOffset` | `number` | Tax divider | `100` |
|
|
875
|
+
| `currency` | `string` | Currency code | `'IDR'` |
|
|
876
|
+
|
|
815
877
|
> **Status values:** `PROCESSING` · `SHIPPED` · `DELIVERED` · `CANCELLED` · `REFUNDED`
|
|
816
878
|
|
|
817
879
|
</details>
|
|
818
880
|
|
|
881
|
+
|
|
882
|
+
<div align="right"><a href="#top">⬆️ Back to top</a></div>
|
|
883
|
+
|
|
819
884
|
---
|
|
820
885
|
|
|
821
886
|
### 🤖 Rich Messages
|
|
822
887
|
|
|
823
888
|
> All rich messages are sent via standard `sendMessage` and rendered as AI bot messages in WhatsApp. Use the appropriate key instead of `text`, `image`, `video`, etc.
|
|
824
889
|
|
|
825
|
-
|
|
890
|
+
<table>
|
|
891
|
+
<tr><td><b>🧭 Quick jump</b></td><td>
|
|
892
|
+
<a href="#-rich-text">Text</a> · <a href="#-rich-html">HTML</a> · <a href="#-rich-code-block">Code</a> · <a href="#-rich-table">Table</a> · <a href="#️-rich-images">Images</a> · <a href="#-rich-video">Video</a> · <a href="#-rich-suggestions">Suggestions</a> · <a href="#-rich-latex">LaTeX</a><br>
|
|
893
|
+
<a href="#️-rich-product">Product</a> · <a href="#-rich-post">Post</a> · <a href="#-rich-reels">Reels</a> · <a href="#-rich-sources">Sources</a> · <a href="#-rich-tip--footer">Tip & Footer</a> · <a href="#-rich-mixed--items">Mixed</a> · <a href="#-rich-response--richresponse">Response</a> · <a href="#️-rich-options">Options</a>
|
|
894
|
+
</td></tr>
|
|
895
|
+
</table>
|
|
826
896
|
|
|
827
897
|
---
|
|
828
898
|
|
|
@@ -940,7 +1010,7 @@ await sock.sendMessage(jid, {
|
|
|
940
1010
|
|
|
941
1011
|
> Structured table with `title`, `headers`, and `rows`.
|
|
942
1012
|
>
|
|
943
|
-
>
|
|
1013
|
+
> **⚠️ Catatan:** Shorthand `{ title?, headers?, rows }` ini hanya berlaku untuk key `table` top-level dan di dalam `items`. Kalau dipakai di dalam `richResponse`, isi `table` harus sudah berupa array baris jadi — lihat [Rich Response](#-rich-response--richresponse).
|
|
944
1014
|
|
|
945
1015
|
<details>
|
|
946
1016
|
<summary><b>Simple Table</b></summary>
|
|
@@ -1349,16 +1419,18 @@ await sock.sendMessage(jid, {
|
|
|
1349
1419
|
<details>
|
|
1350
1420
|
<summary><b>📋 Fields Reference</b></summary>
|
|
1351
1421
|
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1422
|
+
| Field | Type | Keterangan | Default |
|
|
1423
|
+
|:---|:---|:---|:---|
|
|
1424
|
+
| `title` | `string` | Username / creator name | — |
|
|
1425
|
+
| `profileIconUrl` | `string` | Avatar URL | — |
|
|
1426
|
+
| `thumbnailUrl` | `string` | Thumbnail cover URL | — |
|
|
1427
|
+
| `videoUrl` | `string` | Video source URL | — |
|
|
1428
|
+
| `reels_title` | `string` | Reel title | `''` |
|
|
1429
|
+
| `likes_count` | `number` | Like count | `0` |
|
|
1430
|
+
| `shares_count` | `number` | Share count | `0` |
|
|
1431
|
+
| `view_count` | `number` | View count | `0` |
|
|
1432
|
+
| `reel_source` | `string` | Source platform | `'IG'` |
|
|
1433
|
+
| `is_verified` | `boolean` | Verified badge | `false` |
|
|
1362
1434
|
|
|
1363
1435
|
</details>
|
|
1364
1436
|
|
|
@@ -1491,8 +1563,8 @@ await sock.sendMessage(jid, {
|
|
|
1491
1563
|
}, { quoted: message })
|
|
1492
1564
|
```
|
|
1493
1565
|
|
|
1494
|
-
```
|
|
1495
|
-
|
|
1566
|
+
```js
|
|
1567
|
+
// build delay (muncul satu per satu)
|
|
1496
1568
|
await sock.sendMessage(jid, {
|
|
1497
1569
|
items: [
|
|
1498
1570
|
{ text: 'Query yang dijalankan:' },
|
|
@@ -1649,28 +1721,23 @@ await sock.sendMessage(jid, {
|
|
|
1649
1721
|
<details>
|
|
1650
1722
|
<summary><b><code>bypassDownload</code> — re-send otomatis rich message</b></summary>
|
|
1651
1723
|
|
|
1652
|
-
> Default `true`. Setiap rich message dikirim ulang sekali sebagai self-edit tepat setelah relay pertama
|
|
1724
|
+
> Default `true`. Setiap rich message dikirim ulang sekali sebagai self-edit tepat setelah relay pertama, dan isi unified response otomatis dikirim ter-gzip lewat `gzipData`. Matikan per pesan dengan `false` (bypass dan gzip ikut mati). Untuk mematikan gzip saja, pakai `unifiedGzip: false`.
|
|
1653
1725
|
|
|
1654
1726
|
```js
|
|
1727
|
+
await sock.sendMessage(jid, { richText: 'Bypass aktif secara default' })
|
|
1728
|
+
|
|
1655
1729
|
await sock.sendMessage(jid, { richText: 'tanpa bypass' }, { bypassDownload: false })
|
|
1730
|
+
|
|
1731
|
+
await sock.sendMessage(jid, { richText: 'bypass tanpa gzip', unifiedGzip: false })
|
|
1656
1732
|
```
|
|
1657
1733
|
</details>
|
|
1658
1734
|
|
|
1659
|
-
<details>
|
|
1660
|
-
<summary><b><code>unifiedGzip</code> — kirim isi rich message ter-gzip</b></summary>
|
|
1661
|
-
|
|
1662
|
-
> Default `false`. Isi rich message dikompres gzip dan dikirim lewat `gzipData`. Pesan jadi lebih kecil, tapi klien yang belum mengenal `gzipData` bisa menampilkan rich message kosong. Aktifkan hanya kalau sudah dites di perangkat tujuan.
|
|
1663
1735
|
|
|
1664
|
-
|
|
1665
|
-
await sock.sendMessage(jid, { richText: 'Isi ter-gzip', unifiedGzip: true })
|
|
1666
|
-
```
|
|
1667
|
-
|
|
1668
|
-
Helper: `packUnifiedResponse(unified, gzip)`. Pembacaan `data` maupun `gzipData` otomatis.
|
|
1669
|
-
</details>
|
|
1736
|
+
<div align="right"><a href="#top">⬆️ Back to top</a></div>
|
|
1670
1737
|
|
|
1671
1738
|
---
|
|
1672
1739
|
|
|
1673
|
-
|
|
1740
|
+
### 📣 Newsletter
|
|
1674
1741
|
|
|
1675
1742
|
<details>
|
|
1676
1743
|
<summary><b>📋 Get Newsletter Metadata</b></summary>
|
|
@@ -1721,9 +1788,12 @@ await sock.newsletterReactMessage(
|
|
|
1721
1788
|
```
|
|
1722
1789
|
</details>
|
|
1723
1790
|
|
|
1791
|
+
|
|
1792
|
+
<div align="right"><a href="#top">⬆️ Back to top</a></div>
|
|
1793
|
+
|
|
1724
1794
|
---
|
|
1725
1795
|
|
|
1726
|
-
|
|
1796
|
+
### 👥 Groups
|
|
1727
1797
|
|
|
1728
1798
|
<details>
|
|
1729
1799
|
<summary><b>🔄 Create Group</b></summary>
|
|
@@ -1825,19 +1895,24 @@ await sock.sendMessage(jid, {
|
|
|
1825
1895
|
<details>
|
|
1826
1896
|
<summary><b>📋 Fields Reference</b></summary>
|
|
1827
1897
|
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1898
|
+
| Field | Type | Keterangan | Default |
|
|
1899
|
+
|:---|:---|:---|:---|
|
|
1900
|
+
| `message` | `string / object` | Status content (string or WAMessage) | ✅ required |
|
|
1901
|
+
| `audienceType` | `number` | Target audience (0 = all) | `0` |
|
|
1902
|
+
| `backgroundArgb` | `number` | Background ARGB color (text only) | — |
|
|
1903
|
+
| `textArgb` | `number` | Text ARGB color (text only) | — |
|
|
1904
|
+
| `font` | `number` | Font style 0–9 (text only) | — |
|
|
1833
1905
|
|
|
1834
1906
|
</details>
|
|
1835
1907
|
|
|
1836
1908
|
</details>
|
|
1837
1909
|
|
|
1910
|
+
|
|
1911
|
+
<div align="right"><a href="#top">⬆️ Back to top</a></div>
|
|
1912
|
+
|
|
1838
1913
|
---
|
|
1839
1914
|
|
|
1840
|
-
|
|
1915
|
+
### 🔒 Privacy
|
|
1841
1916
|
|
|
1842
1917
|
<details>
|
|
1843
1918
|
<summary><b>🖼️ Profile Picture</b></summary>
|
|
@@ -1870,9 +1945,12 @@ await sock.updateDefaultDisappearingMode(86400) // 0 = disable
|
|
|
1870
1945
|
```
|
|
1871
1946
|
</details>
|
|
1872
1947
|
|
|
1948
|
+
|
|
1949
|
+
<div align="right"><a href="#top">⬆️ Back to top</a></div>
|
|
1950
|
+
|
|
1873
1951
|
---
|
|
1874
1952
|
|
|
1875
|
-
|
|
1953
|
+
### ⚙️ Advanced
|
|
1876
1954
|
|
|
1877
1955
|
<details>
|
|
1878
1956
|
<summary><b>🔧 Debug Logging</b></summary>
|
|
@@ -1918,15 +1996,20 @@ const summary = getAggregateResponsesInEventMessage(eventMsg, sock.user.lid)
|
|
|
1918
1996
|
```
|
|
1919
1997
|
</details>
|
|
1920
1998
|
|
|
1999
|
+
|
|
2000
|
+
<div align="right"><a href="#top">⬆️ Back to top</a></div>
|
|
2001
|
+
|
|
1921
2002
|
---
|
|
1922
2003
|
|
|
1923
|
-
##
|
|
2004
|
+
## 💬 Contact
|
|
1924
2005
|
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
2006
|
+
<div align="center">
|
|
2007
|
+
|
|
2008
|
+
<a href="https://tiktok.com/@ponta.gt"><img src="https://img.shields.io/badge/TikTok-@ponta.gt-000000?style=for-the-badge&logo=tiktok&logoColor=white" alt="TikTok" /></a>
|
|
2009
|
+
<a href="https://whatsapp.com/channel/0029VaAAkwOIN9ii1Tc6Mz1X"><img src="https://img.shields.io/badge/WhatsApp-Channel-25D366?style=for-the-badge&logo=whatsapp&logoColor=white" alt="WhatsApp Channel" /></a>
|
|
2010
|
+
<a href="https://app.pontalabs.zone.id"><img src="https://img.shields.io/badge/REST_API-app.pontalabs.zone.id-8B5CF6?style=for-the-badge&logo=fastapi&logoColor=white" alt="REST API" /></a>
|
|
2011
|
+
|
|
2012
|
+
</div>
|
|
1930
2013
|
|
|
1931
2014
|
---
|
|
1932
2015
|
|
|
@@ -1944,7 +2027,7 @@ const summary = getAggregateResponsesInEventMessage(eventMsg, sock.user.lid)
|
|
|
1944
2027
|
|
|
1945
2028
|
This project is licensed for **personal and non-commercial use only**.
|
|
1946
2029
|
|
|
1947
|
-
| | |
|
|
2030
|
+
| Status | Ketentuan |
|
|
1948
2031
|
|:---:|:---|
|
|
1949
2032
|
| ✅ | Personal use and modification allowed |
|
|
1950
2033
|
| ✅ | Redistribution with attribution allowed |
|
|
@@ -1955,6 +2038,7 @@ This project is licensed for **personal and non-commercial use only**.
|
|
|
1955
2038
|
|
|
1956
2039
|
## ⚠️ Disclaimer
|
|
1957
2040
|
|
|
2041
|
+
> [!WARNING]
|
|
1958
2042
|
> This project is **not affiliated with WhatsApp or Meta** in any way.
|
|
1959
2043
|
> Use at your own risk and refer to WhatsApp's [Terms of Service](https://www.whatsapp.com/legal/terms-of-service) for compliance.
|
|
1960
2044
|
|
|
@@ -1962,10 +2046,10 @@ This project is licensed for **personal and non-commercial use only**.
|
|
|
1962
2046
|
|
|
1963
2047
|
<div align="center">
|
|
1964
2048
|
|
|
1965
|
-
[📦 NPM](https://www.npmjs.com/package/@pontalabs/baileys) · [📖 Baileys Wiki](https://github.com/WhiskeySockets/Baileys/wiki) · [⭐
|
|
2049
|
+
[📦 NPM](https://www.npmjs.com/package/@pontalabs/baileys) · [📖 Baileys Wiki](https://github.com/WhiskeySockets/Baileys/wiki) · [⭐ Back to top](#top)
|
|
1966
2050
|
|
|
1967
2051
|
<br>
|
|
1968
2052
|
|
|
1969
|
-
Made with ♥ by
|
|
2053
|
+
<sub>Made with ♥ by <b>PontaCT</b> · Jika project ini membantu, jangan lupa kasih ⭐</sub>
|
|
1970
2054
|
|
|
1971
2055
|
</div>
|
|
@@ -420,3 +420,11 @@ Ringkasan: 262 field baru di 71 message, 143 message baru, 27 enum baru, 70 enum
|
|
|
420
420
|
|
|
421
421
|
## Wrapper sendMessage (lib/Utils/beta-messages.js)
|
|
422
422
|
music, eventInvite, requestLocation, requestLocationUpdate, instantImage, instantVideo, audioSticker, beta (passthrough), afterReadDuration. Dokumentasi di README bagian "Beta Features". Perlu `npm run gen:protobuf` dulu.
|
|
423
|
+
|
|
424
|
+
## Runtime proto extension (tanpa regenerate)
|
|
425
|
+
- lib/Utils/proto-extensions.js, proto-extensions-core.js, proto-extension-data.js
|
|
426
|
+
- Menambal encode / decode / fromObject kelas proto lama saat runtime supaya 260 field baru (69 tipe) ikut terkirim dan terbaca tanpa menjalankan gen:protobuf.
|
|
427
|
+
- Diverifikasi dengan oracle Python protobuf: 260 field round-trip dua arah (encode JS dibaca Python, encode Python dibaca decoder JS).
|
|
428
|
+
- AIRichResponseUnifiedResponse.gzipData ikut ter-encode. Sengaja tidak ditambal: AIRichResponseMessage.originalRecipientMetadata.
|
|
429
|
+
- unifiedGzip sekarang mengikuti bypassDownload (default aktif); override eksplisit unifiedGzip: false masih bisa.
|
|
430
|
+
- Gzip default mengikuti bypassDownload untuk semua rich; unifiedGzip: false mematikan gzip saja.
|
package/lib/Types/Message.d.ts
CHANGED
|
@@ -96,13 +96,33 @@ const buildInstant = async (kind, message, options, helpers) => {
|
|
|
96
96
|
return { [`instant${kind === 'image' ? 'Image' : 'Video'}Message`]: inner };
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
+
const makeWaveform = (seed, length = 64) => {
|
|
100
|
+
const waveform = Buffer.alloc(length);
|
|
101
|
+
const source = Buffer.isBuffer(seed) && seed.length ? seed : null;
|
|
102
|
+
for (let i = 0; i < length; i++) {
|
|
103
|
+
const byte = source ? source[(i * 19 + 7) % source.length] : i * 11;
|
|
104
|
+
waveform[i] = 18 + (byte % 76);
|
|
105
|
+
}
|
|
106
|
+
return waveform;
|
|
107
|
+
};
|
|
108
|
+
|
|
99
109
|
const buildAudioSticker = async (message, options, helpers) => {
|
|
100
|
-
const { sticker, audio } = message.audioSticker;
|
|
110
|
+
const { sticker, audio, animated, seconds } = message.audioSticker;
|
|
101
111
|
if (!sticker || !audio) throw new Boom('audioSticker butuh { sticker, audio }', { statusCode: 400 });
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
const isAnimated = animated === true;
|
|
113
|
+
const prepared = await helpers.prepareWAMessageMedia({ sticker, isAnimated }, options);
|
|
114
|
+
const { audioMessage } = await helpers.prepareWAMessageMedia({
|
|
115
|
+
audio,
|
|
116
|
+
mimetype: 'audio/ogg; codecs=opus',
|
|
117
|
+
ptt: true
|
|
118
|
+
}, options);
|
|
119
|
+
audioMessage.seconds = Math.max(1, Math.round(seconds || audioMessage.seconds || 5));
|
|
120
|
+
audioMessage.ptt = true;
|
|
121
|
+
audioMessage.mimetype = 'audio/ogg; codecs=opus';
|
|
122
|
+
if (!audioMessage.waveform?.length) audioMessage.waveform = makeWaveform(audio);
|
|
123
|
+
prepared.stickerMessage.isAnimated = isAnimated;
|
|
124
|
+
prepared.stickerMessage.audioMessage = audioMessage;
|
|
125
|
+
return { audioStickerMessage: { message: prepared } };
|
|
106
126
|
};
|
|
107
127
|
|
|
108
128
|
const buildPassthrough = (beta) => {
|
package/lib/Utils/messages.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Boom } from '@hapi/boom';
|
|
2
|
+
import './proto-extensions.js';
|
|
2
3
|
import { buildBetaMessage, detectBetaKey } from './beta-messages.js';
|
|
3
4
|
import { randomBytes } from 'crypto';
|
|
4
5
|
import { zip } from 'fflate';
|
|
@@ -598,7 +599,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
598
599
|
hasNonNullishProperty(message, 'foaText') ||
|
|
599
600
|
hasNonNullishProperty(message, 'richHtml') ||
|
|
600
601
|
hasNonNullishProperty(message, 'contentText')) {
|
|
601
|
-
m = prepareRichResponseMessage(message);
|
|
602
|
+
m = prepareRichResponseMessage(message, { gzip: options?.bypassDownload !== false });
|
|
602
603
|
}
|
|
603
604
|
else if (detectBetaKey(message)) {
|
|
604
605
|
m = await buildBetaMessage(message, options, { prepareWAMessageMedia });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {"ext":{"AIRichResponseUnifiedResponse":[["gzipData",2,"bytes",0]],"AIThreadInfo.AIThreadClientInfo":[["sourceChatJid",2,"string",0]],"Account":[["pnLearnState",6,"e:Account.PnLearnState",0]],"BotMessageOrigin":[["proactiveMessageCampaignId",2,"string",0]],"BotMetadata":[["botDocumentMessageMetadata",34,"m:BotMetadata.BotDocumentMessageMetadata",0],["botGroupMetadata",35,"m:BotMetadata.BotGroupMetadata",0],["botRenderingConfigMetadata",36,"m:BotMetadata.BotRenderingConfigMetadata",0],["botInfrastructureDiagnostics",37,"m:BotMetadata.BotInfrastructureDiagnostics",0],["aiMediaCollectionMetadata",38,"m:BotMetadata.AiMediaCollectionMetadata",0],["commandMetadata",39,"m:BotMetadata.CommandMetadata",0],["resolvedToolCallMetadata",40,"m:BotMetadata.ResolvedToolCallMetadata",0],["subscriptionUpsellMetadata",41,"m:BotMetadata.SubscriptionUpsellMetadata",0],["pttPromptMetadata",42,"m:BotMetadata.PttPromptMetadata",0],["botHistoryShareMetadata",43,"m:BotMetadata.BotHistoryShareMetadata",0],["responseStoppedByUser",44,"bool",0],["interjectionMetadata",45,"m:BotMetadata.InterjectionMetadata",0]],"BotModeSelectionMetadata":[["overrideMode",2,"uint32",1]],"BotPluginMetadata":[["pluginVersion",8,"uint32",0]],"BotProgressIndicatorMetadata":[["estimatedCompletionTime",3,"int64",0]],"CallLogRecord.ParticipantInfo":[["guestInfo",3,"m:CallLogRecord.ParticipantInfo.GuestInfo",0]],"ClientPayload":[["pairedPeripherals",47,"string",1],["testIsolationId",48,"bytes",0],["messageSts",49,"int64",0],["integrationAttestation",50,"m:ClientPayload.IntegrationAttestation",0]],"ClientPayload.UserAgent":[["distributionChannel",17,"e:ClientPayload.UserAgent.DistributionChannel",0]],"ClientPayload.WebInfo":[["browser",5,"string",0],["browserVersion",6,"string",0]],"ContextInfo":[["isSpoiler",73,"bool",0],["mediaDomainInfo",74,"m:ContextInfo.MediaDomainInfo",0],["partiallySelectedContent",75,"m:ContextInfo.PartiallySelectedContent",0],["afterReadDuration",76,"uint32",0],["crossAppSource",77,"e:ContextInfo.CrossAppSource",0],["businessInteractionPills",78,"m:ContextInfo.BusinessInteractionPills",0],["posterStatusId",79,"string",0],["instagramThreadLink",80,"m:ContextInfo.InstagramThreadLink",0],["aiProvenance",81,"m:ContextInfo.AiProvenance",0],["experienceIds",82,"uint32",1],["partnerDeepLinkToken",83,"string",0],["sourceExperienceId",84,"uint32",0],["sourceExperienceIds",85,"uint32",1],["foaMutualsSignature",86,"bytes",0],["forwardReachScore",87,"fixed32",0]],"ContextInfo.ExternalAdReplyInfo":[["containsCtwaFlowsAutoReply",28,"bool",0],["agmThumbnailStrategy",29,"int32",0],["agmTitleStrategy",30,"int32",0],["agmSubtitleStrategy",31,"int32",0],["agmHeaderInteractionStrategy",32,"int32",0],["containsCtwaFlowsAutoLabel",33,"bool",0],["productId",34,"string",0],["containsCtwaPromo",35,"bool",0],["ctwaPromoResponseId",36,"string",0],["ctwaPromoOfferId",37,"string",0],["ctwaPromoAdEntryId",38,"string",0],["ctwaPromoResponseExpiresAtSeconds",39,"uint64",0],["ctwaPromoSchemaVersion",40,"uint32",0],["ctwaPromoAdgroupId",41,"string",0]],"ContextInfo.ForwardedNewsletterMessageInfo":[["profileName",6,"string",0]],"ContextInfo.StatusAudienceMetadata":[["listName",2,"string",0],["listEmoji",3,"string",0],["orgId",4,"string",0]],"Conversation":[["isMarketingMessageThread",55,"bool",0],["afterReadDuration",57,"uint32",0],["appealUpdateTime",60,"uint64",0],["identityVerification",63,"m:Conversation.IdentityVerification",0],["acp2Setting",64,"m:Conversation.Acp2Setting",0],["isWorkGroup",67,"bool",0],["nonE2eeType",68,"int32",0],["draft",71,"m:Conversation.Draft",0]],"DeviceCapabilities":[["aiThread",6,"m:DeviceCapabilities.AiThread",0],["aiFbidMigration",7,"m:DeviceCapabilities.AiFbidMigration",0],["bizAiSettingsSync",8,"m:DeviceCapabilities.BizAiSettingsSync",0],["contactRefresh",9,"m:DeviceCapabilities.ContactRefresh",0],["reverseHistorySync",10,"m:DeviceCapabilities.ReverseHistorySync",0],["newsletterChatsMigration",11,"m:DeviceCapabilities.NewsletterChatsMigration",0],["hostWriteMutationSupport",12,"m:DeviceCapabilities.HostWriteMutationSupport",0],["bizAiWebOnboarding",13,"m:DeviceCapabilities.BizAiWebOnboarding",0],["phoneNumberSharing",14,"m:DeviceCapabilities.PhoneNumberSharing",0],["recentConversationsOnDemand",15,"m:DeviceCapabilities.RecentConversationsOnDemand",0],["aiMuseJarvisGzip",16,"m:DeviceCapabilities.AiMuseJarvisGzip",0],["draftSync",17,"m:DeviceCapabilities.DraftSync",0]],"DeviceCapabilities.BusinessBroadcast":[["companionSupportEnabled",2,"bool",0],["campaignSyncEnabled",3,"bool",0],["insightsSyncEnabled",4,"bool",0],["recipientLimit",5,"int32",0],["proCompanionSupportEnabled",6,"bool",0]],"DeviceProps":[["deviceName",6,"string",0]],"DeviceProps.HistorySyncConfig":[["initialSyncMaxMessagesPerChat",20,"uint32",0],["supportManusHistory",21,"bool",0],["supportHatchHistory",22,"bool",0],["supportedBotChannelFbids",23,"string",1],["supportInlineContacts",24,"bool",0],["supportNewsletter",25,"bool",0],["supportUniversalReachChat",26,"bool",0],["supportOmittedConversationMetadata",28,"bool",0],["supportDraftSync",29,"bool",0]],"HandshakeMessage.ClientFinish":[["paddedBytes",4,"bytes",0],["simulateXxkemFs",5,"bool",0]],"HandshakeMessage.ClientHello":[["paddedBytes",6,"bytes",0],["sendServerHelloPaddedBytes",7,"bool",0],["simulateXxkemFs",8,"bool",0],["pqMode",9,"e:HandshakeMessage.ClientHello.PqMode",0],["extendedEphemeral",10,"bytes",0]],"HandshakeMessage.ServerHello":[["paddingBytes",5,"bytes",0],["extendedCiphertext",6,"bytes",0]],"HistorySync":[["nctSalt",19,"bytes",0],["inlineContacts",20,"m:HistorySync.InlineContact",1],["inlineContactsProvided",21,"bool",0],["omittedConversationMetadata",25,"m:HistorySync.OmittedConversationMetadata",0],["omittedConversationMetadataSnapshotId",26,"string",0]],"HydratedTemplateButton.HydratedURLButton":[["webviewInteraction",5,"bool",0]],"InThreadSurveyMetadata":[["startQuestionIndex",18,"int32",0]],"InteractiveAnnotation":[["pixKey",9,"m:InteractiveAnnotation.PixKey",0]],"MemberLabel":[["showAdminBadge",3,"bool",0]],"Message":[["newsletterFollowerInviteMessage",108,"m:Message.NewsletterFollowerInviteMessage",0],["newsletterAdminProfileMessage",116,"m:Message.FutureProofMessage",0],["spoilerMessage",118,"m:Message.FutureProofMessage",0],["pollCreationMessageV6",119,"m:Message.PollCreationMessage",0],["conditionalRevealMessage",120,"m:Message.ConditionalRevealMessage",0],["pollAddOptionMessage",121,"m:Message.PollAddOptionMessage",0],["eventInviteMessage",122,"m:Message.EventInviteMessage",0],["groupRootKeyShare",123,"m:Message.GroupRootKeyShare",0],["paymentReminderMessage",124,"m:Message.PaymentReminderMessage",0],["splitPaymentMessage",125,"m:Message.SplitPaymentMessage",0],["newsletterAdminProfileStatusMessage",126,"m:Message.FutureProofMessage",0],["rootSecretDistributeMessage",127,"m:Message.RootSecretDistributeMessage",0],["splitPaymentUpdateMessage",128,"m:Message.SplitPaymentUpdateMessage",0],["musicMessage",129,"m:Message.MusicMessage",0],["statusLinkPreviewMetadata",130,"m:Message.StatusLinkPreviewMetadata",0],["botPlatformRegistrationSuccessMessage",131,"m:Message.FutureProofMessage",0],["newsletterScheduledMessage",132,"m:Message.FutureProofMessage",0],["acp2SettingMessage",133,"m:Message.FutureProofMessage",0],["audioStickerMessage",134,"m:Message.FutureProofMessage",0],["instantImageMessage",135,"m:Message.ImageMessage",0],["requestLocationMessage",136,"m:Message.RequestLocationMessage",0],["botGroupParticipantMessage",137,"m:Message.FutureProofMessage",0],["requestLocationUpdateMessage",138,"m:Message.RequestLocationUpdateMessage",0],["vpcRequestMessage",139,"m:Message.VpcRequestMessage",0],["instantVideoMessage",140,"m:Message.VideoMessage",0],["paymentDetailsMessage",141,"m:Message.PaymentDetailsMessage",0]],"Message.AlbumMessage":[["caption",1,"string",0]],"Message.Call":[["messageContextInfo",10,"m:MessageContextInfo",0],["callEntryPoint",11,"uint32",0],["callReason",12,"string",0]],"Message.ContactMessage":[["isSelfContact",18,"bool",0]],"Message.DocumentMessage":[["qrUrl",23,"string",0]],"Message.FullHistorySyncOnDemandRequestMetadata":[["businessProduct",2,"string",0],["opaqueClientData",3,"bytes",0],["connection",4,"m:Message.FullHistorySyncOnDemandRequestMetadata.Connection",0]],"Message.InitialSecurityNotificationSettingSync":[["initialAppTheme",2,"int32",0]],"Message.InteractiveMessage":[["bloksWidget",8,"m:Message.InteractiveMessage.BloksWidget",0]],"Message.InteractiveMessage.Header":[["bloksWidget",10,"m:Message.InteractiveMessage.BloksWidget",0]],"Message.LinkPreviewMetadata":[["videoId",10,"string",0]],"Message.MessageHistoryMetadata":[["nonHistoryReceivers",4,"string",1],["oldestMessageTimestampInBundle",5,"int64",0],["includesChatTheme",6,"bool",0]],"Message.MessageHistoryNotice":[["botHistoryShareSyncMetadata",3,"m:Message.MessageHistoryNotice.BotHistoryShareSyncMetadata",0]],"Message.PaymentInviteMessage":[["incentiveEligible",3,"bool",0],["referralId",4,"string",0],["inviteType",5,"e:Message.PaymentInviteMessage.InviteType",0]],"Message.PeerDataOperationRequestMessage":[["companionCanonicalUserNonceFetchRequest",10,"m:Message.PeerDataOperationRequestMessage.CompanionCanonicalUserNonceFetchRequest",0],["bizBroadcastInsightsContactListRequest",11,"m:Message.PeerDataOperationRequestMessage.BizBroadcastInsightsContactListRequest",0],["bizBroadcastInsightsRefreshRequest",12,"m:Message.PeerDataOperationRequestMessage.BizBroadcastInsightsRefreshRequest",0],["recentConversationsOnDemandRequest",13,"m:Message.PeerDataOperationRequestMessage.RecentConversationsOnDemandRequest",0]],"Message.PeerDataOperationRequestMessage.FullHistorySyncOnDemandRequest":[["fullHistorySyncOnDemandConfig",3,"m:Message.PeerDataOperationRequestMessage.FullHistorySyncOnDemandRequest.FullHistorySyncOnDemandConfig",0]],"Message.PeerDataOperationRequestMessage.GalaxyFlowAction":[["galaxyFlowDownloadRequestId",4,"string",0],["agmId",5,"string",0]],"Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest":[["supportInlineResponse",7,"bool",0]],"Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult":[["flowResponsesCsvBundle",11,"m:Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.FlowResponsesCsvBundle",0],["bizBroadcastInsightsContactListResponse",12,"m:Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactListResponse",0],["contactRefreshResponse",13,"m:Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ContactRefreshResponse",0]],"Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.PaymentLinkPreviewMetadata":[["amount",3,"string",0],["offset",4,"string",0],["currency",5,"string",0]],"Message.PollCreationMessage":[["endTime",9,"int64",0],["hideParticipantName",10,"bool",0],["allowAddOption",11,"bool",0]],"Message.PollUpdateMessageMetadata":[["pollNameHash",1,"bytes",0],["lastEditStanzaId",2,"string",0]],"Message.ProtocolMessage":[["aiMediaCollectionMessage",28,"m:Message.ProtocolMessage.AiMediaCollectionMessage",0],["afterReadDuration",29,"uint32",0],["chatThemeSetting",30,"m:Message.ProtocolMessage.ChatThemeSetting",0],["aiMetadataOperation",31,"m:Message.ProtocolMessage.AiMetadataOperation",0],["markAsVerifiedAction",32,"m:Message.ProtocolMessage.MarkAsVerifiedAction",0],["coexStateSync",33,"m:Message.ProtocolMessage.CoexStateSync",0],["syncRequestMutationRetry",34,"m:Message.ProtocolMessage.SyncRequestMutationRetry",0],["acp2Setting",35,"m:Conversation.Acp2Setting",0],["sharedDeviceContactHashKeyShare",36,"m:Message.ProtocolMessage.SharedDeviceContactHashKeyShare",0],["sharedDeviceContactHashKeyRequest",37,"m:Message.ProtocolMessage.SharedDeviceContactHashKeyRequest",0],["additionalPromptIds",38,"string",1],["groupRootKeyRequest",39,"m:Message.ProtocolMessage.GroupRootKeyRequest",0],["membershipFormKeyFingerprintVerification",40,"m:Message.ProtocolMessage.MembershipFormKeyFingerprintVerification",0],["groupRootKeyShare",41,"m:Message.GroupRootKeyShare",0],["messageEditDisplayType",42,"e:Message.ProtocolMessage.MessageEditDisplayType",0],["draftMessageSync",43,"m:Message.ProtocolMessage.DraftMessageSync",0]],"Message.RequestWelcomeMessageMetadata":[["botAgentMetadata",3,"m:Message.RequestWelcomeMessageMetadata.BotAgentMetadata",0]],"Message.StickerMessage":[["premium",24,"int32",0],["emojis",25,"string",0],["audioMessage",26,"m:Message.AudioMessage",0]],"Message.VideoMessage":[["dashManifestUrl",33,"string",0],["smartThumbnailTs",34,"int64",0]],"MessageContextInfo":[["teeBotMetadata",17,"bytes",0],["accountEncryptionAttestation",18,"m:MessageContextInfo.AccountEncryptionAttestation",0],["associatedPrimaryIdentityKey",19,"bytes",0],["teeContextAnchorMessageId",20,"string",0],["acp2Setting",21,"m:Conversation.Acp2Setting",0]],"PollAdditionalMetadata":[["pollNameHashHistory",2,"m:PollAdditionalMetadata.PollNameHashHistory",1],["originalOptions",3,"m:Message.PollCreationMessage.Option",1],["pollOptionReplayEntries",4,"m:PollAdditionalMetadata.PollOptionReplayEntry",1],["pollOptionReplayBase",5,"m:PollAdditionalMetadata.PollOptionReplayBase",0]],"PollUpdate":[["metadata",6,"m:Message.PollUpdateMessageMetadata",0]],"PreKeySignalMessage":[["kyberPreKeyId",7,"uint32",0],["kyberCiphertext",8,"bytes",0]],"ReportingTokenInfo":[["reportingTagTimestamp",2,"uint64",0]],"SessionStructure":[["pendingKyberPreKey",14,"m:SessionStructure.PendingKyberPreKey",0]],"StatusAttribution":[["statusTemplate",9,"m:StatusAttribution.StatusTemplate",0]],"SyncActionValue":[["settingsSyncAction",78,"m:SyncActionValue.SettingsSyncAction",0],["outContactAction",79,"m:SyncActionValue.LidContactAction",0],["nctSaltSyncAction",80,"m:SyncActionValue.NctSaltSyncAction",0],["businessBroadcastCampaignAction",81,"m:SyncActionValue.BusinessBroadcastCampaignAction",0],["businessBroadcastInsightsAction",82,"m:SyncActionValue.BusinessBroadcastInsightsAction",0],["customerDataAction",83,"m:SyncActionValue.CustomerDataAction",0],["subscriptionsSyncV2Action",84,"m:SyncActionValue.SubscriptionsSyncV2Action",0],["threadPinAction",85,"m:SyncActionValue.ThreadPinAction",0],["autoOrganizeBusinessChatSetting",86,"m:SyncActionValue.AutoOrganizeBusinessChatSetting",0],["bizAiSettingsNudgeAction",87,"m:SyncActionValue.BizAiSettingsNudgeAction",0],["coexV2VersionAction",88,"m:SyncActionValue.CoexV2VersionAction",0],["wasaRootSecretAction",89,"m:SyncActionValue.WasaRootSecretAction",0],["bubbleLockMessageAction",90,"m:SyncActionValue.BubbleLockMessageAction",0],["labelSublistAction",91,"m:SyncActionValue.LabelSublistAction",0],["deviceCapabilitiesV2",92,"m:DeviceCapabilities",0],["ctwaMessageReceivedAction",93,"m:SyncActionValue.CtwaMessageReceivedAction",0],["sharedDeviceAllowlistAction",94,"m:SyncActionValue.SharedDeviceAllowlistAction",0],["contactManagerMetadataAction",95,"m:SyncActionValue.ContactManagerMetadataAction",0],["businessFolderActivationAction",96,"m:SyncActionValue.BusinessFolderActivationAction",0],["groupHistoryToggleAction",97,"m:SyncActionValue.GroupHistoryToggleAction",0],["bbProPendingCustomerBaseAction",98,"m:SyncActionValue.BbProPendingCustomerBaseAction",0],["communityNestingStateAction",99,"m:SyncActionValue.CommunityNestingStateAction",0],["sharedDeviceSecretAction",100,"m:SyncActionValue.SharedDeviceSecretAction",0],["hatchCvmSecretAction",101,"m:SyncActionValue.HatchCvmSecretAction",0],["businessFolderChatPreferenceAction",102,"m:SyncActionValue.BusinessFolderChatPreferenceAction",0]],"SyncActionValue.BusinessBroadcastListAction":[["labelIds",4,"string",1],["audienceExpression",5,"string",0],["customAudienceFbid",6,"string",0]],"SyncActionValue.ContactAction":[["birthday",7,"string",0],["nonE2EeType",8,"int32",0]],"SyncActionValue.InteractiveMessageAction":[["agmId",2,"string",0]],"SyncActionValue.LabelAssociationAction":[["modelMetaData",2,"string",0]],"SyncActionValue.MuteAction":[["muteEveryoneMentionEndTimestamp",4,"int64",0]],"SyncActionValue.QuickReplyAction":[["associatedLabelIds",6,"string",1]],"SyncActionValue.StatusPrivacyAction":[["shareToFB",3,"bool",0],["shareToIG",4,"bool",0],["customLists",5,"m:SyncActionValue.StatusPrivacyAction.CustomList",1]],"WebMessageInfo":[["paymentTransactionInfo",53,"m:WebMessageInfo.PaymentTransactionInfo",0],["nonJidMentions",78,"uint32",0],["hsmTag",79,"string",0],["ephemeralExpirationTimestamp",80,"uint64",0],["scheduledMessageMetadata",81,"m:WebMessageInfo.ScheduledMessageMetadata",0],["decisionId",82,"string",0],["decisionSources",83,"string",0],["eventInviteAdditionalMetadata",84,"m:WebMessageInfo.EventInviteAdditionalMetadata",0],["groupHistoryLastCountedMessageTimestamp",85,"uint64",0]]},"types":{"BotMetadata.BotDocumentMessageMetadata":[],"BotMetadata.BotGroupMetadata":[["participantsMetadata",1,"m:BotMetadata.BotGroupMetadata.ParticipantsMetadata",1]],"BotMetadata.BotGroupMetadata.ParticipantsMetadata":[["botFbid",1,"string",0]],"BotMetadata.BotRenderingConfigMetadata":[["bloksVersioningId",1,"string",0],["pixelDensity",2,"double",0]],"BotMetadata.BotInfrastructureDiagnostics":[["toolsUsed",2,"string",1],["isThinking",3,"bool",0]],"BotMetadata.AiMediaCollectionMetadata":[["collectionId",1,"string",0],["uploadOrderIndex",2,"uint32",0]],"BotMetadata.CommandMetadata":[["commandName",1,"string",0],["commandDescription",2,"string",0],["commandPrompt",3,"string",0]],"BotMetadata.ResolvedToolCallMetadata":[["toolCallId",1,"string",0],["resolutionDataSerialized",2,"string",0]],"BotMetadata.SubscriptionUpsellMetadata":[],"BotMetadata.PttPromptMetadata":[["transcript",1,"string",0]],"BotMetadata.BotHistoryShareMetadata":[["participantsMetadata",1,"m:BotMetadata.BotGroupMetadata.ParticipantsMetadata",1]],"BotMetadata.InterjectionMetadata":[["targetPromptMessageId",1,"string",0],["foldedPromptMessageIds",2,"string",1]],"CallLogRecord.ParticipantInfo.GuestInfo":[["pushName",1,"string",0]],"ClientPayload.IntegrationAttestation":[["staticUnbound",1,"string",0],["onlineSigned",3,"string",0]],"ContextInfo.MediaDomainInfo":[["e2EeMediaKey",2,"bytes",0]],"ContextInfo.PartiallySelectedContent":[["text",1,"string",0]],"ContextInfo.BusinessInteractionPills":[["businessJid",1,"string",0],["pills",2,"m:ContextInfo.BusinessInteractionPills.Pill",1],["entryPoint",3,"e:ContextInfo.BusinessInteractionPills.EntryPoint",0],["signedPayload",4,"bytes",0],["signatureEnvelope",5,"m:BotSignatureVerificationMetadata",0],["unauthenticatedBusinessMetadata",6,"m:ContextInfo.BusinessInteractionPills.UnauthenticatedBusinessMetadata",0]],"ContextInfo.BusinessInteractionPills.Pill":[["pillType",1,"e:ContextInfo.BusinessInteractionPills.Pill.PillType",0],["actionUrl",2,"string",0]],"ContextInfo.BusinessInteractionPills.UnauthenticatedBusinessMetadata":[["businessName",1,"string",0],["businessCategory",2,"string",0],["businessIsOpen",3,"bool",0],["businessIsOpenSnapshotMs",4,"int64",0]],"ContextInfo.InstagramThreadLink":[["url",1,"string",0]],"ContextInfo.AiProvenance":[["c2PaMetadata",1,"m:ContextInfo.AiProvenance.C2PaMetadata",0],["iptcMetadata",2,"m:ContextInfo.AiProvenance.C2PaMetadata",0]],"ContextInfo.AiProvenance.C2PaMetadata":[["createdWithGenAi",1,"bool",0],["editedWithGenAi",2,"bool",0]],"Conversation.IdentityVerification":[["verified",1,"bool",0],["actionSeq",2,"uint64",0]],"Conversation.Acp2Setting":[["enabled",1,"bool",0],["settingTimestamp",3,"int64",0],["initiatedByMe",4,"bool",0]],"Conversation.Draft":[["content",1,"m:Message",0],["editTimestampMs",2,"int64",0],["editorDeviceId",3,"uint32",0]],"DeviceCapabilities.AiThread":[],"DeviceCapabilities.AiFbidMigration":[["chatDbMigrationTimestamp",1,"uint64",0],["supportVersion",2,"uint32",0]],"DeviceCapabilities.BizAiSettingsSync":[["handoffRemovalTimingEnabled",1,"bool",0]],"DeviceCapabilities.ContactRefresh":[["refreshSupported",1,"bool",0]],"DeviceCapabilities.ReverseHistorySync":[],"DeviceCapabilities.NewsletterChatsMigration":[["effectiveMigrated",1,"bool",0],["countdownEndsAt",2,"int64",0],["rolledBack",3,"bool",0]],"DeviceCapabilities.HostWriteMutationSupport":[["mutationNames",1,"string",1]],"DeviceCapabilities.BizAiWebOnboarding":[["version",1,"uint32",0]],"DeviceCapabilities.PhoneNumberSharing":[["phoneSharingSupported",1,"bool",0]],"DeviceCapabilities.RecentConversationsOnDemand":[["supported",1,"bool",0]],"DeviceCapabilities.AiMuseJarvisGzip":[["supportVersion",1,"uint32",0]],"DeviceCapabilities.DraftSync":[["version",1,"uint32",0]],"HistorySync.InlineContact":[["pnJid",1,"string",0],["lidJid",2,"string",0],["fullName",3,"string",0],["firstName",4,"string",0],["username",5,"string",0]],"HistorySync.OmittedConversationMetadata":[["snapshotId",1,"string",0],["snapshotTimestampMs",2,"uint64",0],["batchIndex",3,"uint32",0],["batchCount",4,"uint32",0],["complete",5,"bool",0],["conversations",6,"m:Conversation",1]],"InteractiveAnnotation.PixKey":[["key",1,"string",0],["keyType",2,"e:InteractiveAnnotation.PixKey.KeyType",0],["displayName",3,"string",0]],"Message.ConditionalRevealMessage":[["encPayload",1,"bytes",0],["encIv",2,"bytes",0],["revealKeyId",4,"string",0]],"Message.PollAddOptionMessage":[["pollCreationMessageKey",1,"m:MessageKey",0],["addOption",2,"m:Message.PollCreationMessage.Option",0],["metadata",3,"m:Message.PollUpdateMessageMetadata",0]],"Message.EventInviteMessage":[["contextInfo",1,"m:ContextInfo",0],["eventId",2,"string",0],["eventTitle",3,"string",0],["jpegThumbnail",4,"bytes",0],["startTime",5,"int64",0],["caption",6,"string",0],["isCanceled",7,"bool",0],["endTime",8,"int64",0],["callLink",9,"string",0],["coverImageHandle",10,"string",0],["locationName",11,"string",0],["lastUpdatedTsUsec",12,"int64",0],["status",13,"e:Message.EventInviteMessage.StatusV2",0]],"Message.GroupRootKeyShare":[["keys",1,"m:Message.GroupRootKeyShare.Key",1]],"Message.GroupRootKeyShare.Key":[["groupRootKey",1,"bytes",0],["keyId",2,"string",0],["expiryTimestampMs",3,"int64",0],["createdTimestampMs",4,"int64",0]],"Message.PaymentReminderMessage":[["reminderId",1,"string",0],["instanceId",2,"string",0],["description",3,"string",0],["frequency",4,"e:Message.PaymentReminderMessage.Frequency",0],["status",5,"e:Message.PaymentReminderMessage.StatusV3",0],["payeeVpa",6,"string",0],["payeeJid",7,"string",0],["payerJid",8,"string",0],["amount",9,"m:Money",0]],"Message.SplitPaymentMessage":[["splitId",1,"string",0],["totalAmount",2,"m:Money",0],["description",3,"string",0],["requesterJid",4,"string",0],["participants",5,"m:Message.SplitPaymentMessage.Participant",1],["createdAtMs",6,"int64",0],["contextInfo",17,"m:ContextInfo",0]],"Message.SplitPaymentMessage.Participant":[["jid",1,"string",0],["amount",2,"m:Money",0]],"Message.RootSecretDistributeMessage":[["chatJid",1,"string",0]],"Message.SplitPaymentUpdateMessage":[["splitId",1,"string",0],["participantJid",2,"string",0]],"Message.MusicMessage":[["embeddedMusic",1,"m:EmbeddedMusic",0],["songUri",2,"string",0],["artworkUri",3,"string",0],["style",4,"int32",0],["contextInfo",5,"m:ContextInfo",0],["lyrics",6,"m:Message.MusicMessage.Lyrics",0]],"Message.MusicMessage.Lyrics":[["lines",1,"m:Message.MusicMessage.Lyrics.Line",1]],"Message.MusicMessage.Lyrics.Line":[["startTimeInMs",1,"int64",0],["endTimeInMs",2,"int64",0],["text",3,"string",0],["wordOffsets",4,"m:Message.MusicMessage.Lyrics.Line.WordOffset",1]],"Message.MusicMessage.Lyrics.Line.WordOffset":[["startIndex",1,"int32",0],["endIndex",2,"int32",0],["startOffsetMs",3,"int64",0],["endOffsetMs",4,"int64",0]],"Message.StatusLinkPreviewMetadata":[],"Message.RequestLocationMessage":[["contextInfo",1,"m:ContextInfo",0]],"Message.RequestLocationUpdateMessage":[["key",1,"m:MessageKey",0],["senderTimestampMs",3,"int64",0]],"Message.VpcRequestMessage":[["payloadSchemaVersion",1,"uint32",0],["requestId",2,"string",0]],"Message.PaymentDetailsMessage":[["serviceType",1,"e:Message.PaymentDetailsMessage.ServiceTypeV2",0],["amount",2,"m:Money",0],["payeeName",3,"string",0],["payerName",4,"string",0],["transactionTimestampMs",5,"int64",0],["transactionId",6,"string",0],["status",7,"e:Message.PaymentDetailsMessage.StatusV4",0],["contextInfo",17,"m:ContextInfo",0]],"Message.FullHistorySyncOnDemandRequestMetadata.Connection":[["providerId",1,"int64",0],["product",2,"string",0]],"Message.InteractiveMessage.BloksWidget":[["uuid",1,"string",0],["data",2,"string",0],["type",3,"string",0],["fallback",4,"string",0]],"Message.MessageHistoryNotice.BotHistoryShareSyncMetadata":[["botJid",1,"string",0],["historyShareMessages",3,"m:Message.MessageHistoryNotice.BotHistoryShareSyncMetadata.HistoryShareMessage",1]],"Message.MessageHistoryNotice.BotHistoryShareSyncMetadata.HistoryShareMessage":[["stanzaId",1,"string",0],["messageSecretProof",2,"bytes",0]],"Message.PeerDataOperationRequestMessage.CompanionCanonicalUserNonceFetchRequest":[["registrationTraceId",1,"string",0]],"Message.PeerDataOperationRequestMessage.BizBroadcastInsightsContactListRequest":[["campaignId",1,"string",0]],"Message.PeerDataOperationRequestMessage.BizBroadcastInsightsRefreshRequest":[["campaignId",1,"string",0]],"Message.PeerDataOperationRequestMessage.RecentConversationsOnDemandRequest":[["conversationCount",1,"uint32",0],["messagesPerConversation",2,"uint32",0]],"Message.PeerDataOperationRequestMessage.FullHistorySyncOnDemandRequest.FullHistorySyncOnDemandConfig":[["historyFromTimestamp",1,"int64",0],["historyDurationDays",2,"int32",0]],"Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.FlowResponsesCsvBundle":[["flowId",1,"string",0],["galaxyFlowDownloadRequestId",2,"string",0],["fileName",3,"string",0],["mimetype",4,"string",0],["fileSha256",5,"bytes",0],["mediaKey",6,"bytes",0],["fileEncSha256",7,"bytes",0],["directPath",8,"string",0],["mediaKeyTimestamp",9,"int64",0],["fileLength",10,"uint64",0]],"Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactListResponse":[["campaignId",1,"string",0],["timestampMs",2,"int64",0],["contacts",3,"m:Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactListResponse.Contact",1]],"Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactListResponse.Contact":[["contactJid",1,"string",0],["state",2,"e:Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactListResponse.Contact.State",0]],"Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ContactRefreshResponse":[["coveredRequestIds",1,"string",1],["collectionVersion",2,"uint64",0],["primaryDurationMs",3,"int64",0],["uniqueContactCount",4,"uint32",0]],"Message.ProtocolMessage.AiMediaCollectionMessage":[["collectionId",1,"string",0],["expectedMediaCount",2,"uint32",0],["hasGlobalCaption",3,"bool",0]],"Message.ProtocolMessage.ChatThemeSetting":[["settingTimestampMs",1,"int64",0],["clearTheme",2,"bool",0],["colorSchemeId",3,"string",0],["defaultWallpaper",10,"m:Message.ProtocolMessage.ChatThemeSetting.DefaultWallpaper",0],["solidColor",11,"m:Message.ProtocolMessage.ChatThemeSetting.SolidColor",0],["stockImage",12,"m:Message.ProtocolMessage.ChatThemeSetting.StockImage",0],["customImage",13,"m:Message.ProtocolMessage.ChatThemeSetting.CustomImage",0],["animatedWallpaper",14,"m:Message.ProtocolMessage.ChatThemeSetting.AnimatedWallpaper",0]],"Message.ProtocolMessage.ChatThemeSetting.DefaultWallpaper":[["isDoodleEnabled",1,"bool",0]],"Message.ProtocolMessage.ChatThemeSetting.SolidColor":[["backgroundLightArgb",1,"fixed32",0],["backgroundDarkArgb",2,"fixed32",0],["isDoodleEnabled",3,"bool",0],["doodleLightArgb",4,"fixed32",0],["doodleDarkArgb",5,"fixed32",0]],"Message.ProtocolMessage.ChatThemeSetting.StockImage":[["stockImageId",1,"string",0],["dimLevel",2,"float",0]],"Message.ProtocolMessage.ChatThemeSetting.CustomImage":[["directPath",1,"string",0],["mediaKey",2,"bytes",0],["fileEncSha256",3,"bytes",0],["fileSha256",4,"bytes",0],["dimLevel",5,"float",0]],"Message.ProtocolMessage.ChatThemeSetting.AnimatedWallpaper":[["animatedWallpaperId",1,"string",0],["dimLevel",2,"float",0]],"Message.ProtocolMessage.AiMetadataOperation":[["hatchMetadataSync",1,"m:Message.ProtocolMessage.AiMetadataOperation.HatchMetadataSync",0],["bizAiMetadataSync",2,"m:Message.ProtocolMessage.AiMetadataOperation.BizAiMetadataSync",0]],"Message.ProtocolMessage.AiMetadataOperation.HatchMetadataSync":[["data",1,"bytes",0],["timestampMs",2,"int64",0],["requestId",3,"string",0]],"Message.ProtocolMessage.AiMetadataOperation.BizAiMetadataSync":[["serverEvent",1,"m:Message.ProtocolMessage.AiMetadataOperation.BizAiMetadataSync.ServerEvent",0]],"Message.ProtocolMessage.AiMetadataOperation.BizAiMetadataSync.ServerEvent":[["protocolEvent",1,"e:Message.ProtocolMessage.AiMetadataOperation.BizAiMetadataSync.ServerEvent.ProtocolEvent",0],["agentOnboardingStarted",2,"m:Message.ProtocolMessage.AiMetadataOperation.BizAiMetadataSync.ServerEvent.AgentOnboardingStarted",0]],"Message.ProtocolMessage.AiMetadataOperation.BizAiMetadataSync.ServerEvent.AgentOnboardingStarted":[["composerBlockDurationSecs",1,"int64",0]],"Message.ProtocolMessage.MarkAsVerifiedAction":[["userJidString",1,"string",0],["verified",2,"bool",0],["verifiedIdentityKey",3,"bytes",0],["actionSeq",4,"uint64",0]],"Message.ProtocolMessage.CoexStateSync":[["collectionMutations",1,"m:Message.ProtocolMessage.CoexStateSync.CollectionMutation",1]],"Message.ProtocolMessage.CoexStateSync.CollectionMutation":[["collection",1,"string",0],["mutations",2,"m:Message.ProtocolMessage.CoexStateSync.CollectionMutation.Mutation",1]],"Message.ProtocolMessage.CoexStateSync.CollectionMutation.Mutation":[["index",1,"m:SyncdIndex",0],["value",2,"m:SyncdValue",0],["dirtyVersion",3,"uint64",0]],"Message.ProtocolMessage.SyncRequestMutationRetry":[["collections",1,"m:Message.ProtocolMessage.SyncRequestMutationRetry.Collection",1],["count",2,"uint32",0]],"Message.ProtocolMessage.SyncRequestMutationRetry.Collection":[["name",1,"string",0],["storedSyncdVersion",2,"uint64",0]],"Message.ProtocolMessage.SharedDeviceContactHashKeyShare":[["keys",1,"m:Message.ProtocolMessage.SharedDeviceContactHashKeyShare.KeyV2",1]],"Message.ProtocolMessage.SharedDeviceContactHashKeyShare.KeyV2":[["epoch",1,"uint32",0],["keyData",3,"bytes",0]],"Message.ProtocolMessage.SharedDeviceContactHashKeyRequest":[["knownEpoch",1,"uint32",0]],"Message.ProtocolMessage.GroupRootKeyRequest":[["keyId",1,"string",0]],"Message.ProtocolMessage.MembershipFormKeyFingerprintVerification":[["requestId",1,"string",0],["keyId",2,"string",0],["keyFingerprint",3,"bytes",0]],"Message.ProtocolMessage.DraftMessageSync":[["chatJid",1,"string",0],["altChatJid",2,"string",0],["action",3,"e:Message.ProtocolMessage.DraftMessageSync.Action",0],["editTimestampMs",4,"int64",0],["draft",5,"m:Message",0],["clearReason",6,"e:Message.ProtocolMessage.DraftMessageSync.ClearReason",0]],"Message.RequestWelcomeMessageMetadata.BotAgentMetadata":[["deepLinkMetadata",1,"m:Message.RequestWelcomeMessageMetadata.BotAgentMetadata.DeepLinkMetadata",0]],"Message.RequestWelcomeMessageMetadata.BotAgentMetadata.DeepLinkMetadata":[["token",1,"string",0],["clientPublicKey",2,"bytes",0]],"MessageContextInfo.AccountEncryptionAttestation":[],"PollAdditionalMetadata.PollNameHashHistory":[["editStanzaId",1,"string",0],["pollNameHash",2,"bytes",0]],"PollAdditionalMetadata.PollOptionReplayEntry":[["type",1,"e:PollAdditionalMetadata.PollOptionReplayEntry.TypeV2",0],["messageKey",2,"m:MessageKey",0],["serverTimestampMs",3,"int64",0],["editTimestampMs",4,"int64",0],["optionHashes",5,"bytes",1],["revokedMessageKey",6,"m:MessageKey",0]],"PollAdditionalMetadata.PollOptionReplayBase":[["boundaryTimestampMs",1,"int64",0],["editTimestampMs",2,"int64",0],["options",3,"m:PollAdditionalMetadata.PollOptionReplayBase.OptionV2",1]],"PollAdditionalMetadata.PollOptionReplayBase.OptionV2":[["optionHash",1,"bytes",0],["enteredTimestampMs",2,"int64",0],["addMessageKey",3,"m:MessageKey",0]],"SessionStructure.PendingKyberPreKey":[["preKeyId",1,"uint32",0],["ciphertext",2,"bytes",0]],"StatusAttribution.StatusTemplate":[["templateId",1,"string",0],["templateName",2,"string",0],["thumbnailUrl",3,"string",0]],"SyncActionValue.SettingsSyncAction":[["startAtLogin",1,"bool",0],["minimizeToTray",2,"bool",0],["language",3,"string",0],["replaceTextWithEmoji",4,"bool",0],["bannerNotificationDisplayMode",5,"e:SyncActionValue.SettingsSyncAction.BannerNotificationDisplayMode",0],["isMessagesNotificationEnabled",7,"bool",0],["isCallsNotificationEnabled",8,"bool",0],["isReactionsNotificationEnabled",9,"bool",0],["isStatusReactionsNotificationEnabled",10,"bool",0],["isTextPreviewForNotificationEnabled",11,"bool",0],["defaultNotificationToneId",12,"int32",0],["groupDefaultNotificationToneId",13,"int32",0],["appTheme",14,"int32",0],["wallpaperId",15,"int32",0],["isDoodleWallpaperEnabled",16,"bool",0],["fontSize",17,"int32",0],["isPhotosAutodownloadEnabled",18,"bool",0],["isAudiosAutodownloadEnabled",19,"bool",0],["isVideosAutodownloadEnabled",20,"bool",0],["isDocumentsAutodownloadEnabled",21,"bool",0],["disableLinkPreviews",22,"bool",0],["notificationToneId",23,"int32",0],["mediaUploadQuality",24,"e:SyncActionValue.SettingsSyncAction.MediaUploadQuality",0],["isSpellCheckEnabled",25,"bool",0],["isEnterToSendEnabled",26,"bool",0],["isGroupMessageNotificationEnabled",27,"bool",0],["isGroupReactionsNotificationEnabled",28,"bool",0],["isStatusNotificationEnabled",29,"bool",0],["statusNotificationToneId",30,"int32",0],["shouldPlaySoundForCallNotification",31,"bool",0],["chatThemeId",32,"string",0],["colorSchemeId",33,"string",0],["stockWallpaperImageId",34,"string",0],["mediaAutoDownloadQuality",35,"e:SyncActionValue.SettingsSyncAction.MediaAutoDownloadQuality",0]],"SyncActionValue.NctSaltSyncAction":[["salt",1,"bytes",0]],"SyncActionValue.BusinessBroadcastCampaignAction":[["deviceId",1,"int32",0],["adId",2,"string",0],["name",3,"string",0],["msgId",4,"string",0],["broadcastJid",5,"string",0],["reservedQuota",6,"int32",0],["scheduledTimestamp",7,"int64",0],["createTimestamp",8,"int64",0],["status",9,"e:SyncActionValue.BusinessBroadcastCampaignAction.StatusV5",0],["bbProStatus",10,"e:SyncActionValue.BusinessBroadcastCampaignAction.BbProStatus",0],["customAudienceFbid",11,"string",0]],"SyncActionValue.BusinessBroadcastInsightsAction":[["recipientCount",1,"int32",0],["deliveredCount",2,"int32",0],["readCount",3,"int32",0],["repliedCount",4,"int32",0],["quickReplyCount",5,"int32",0]],"SyncActionValue.CustomerDataAction":[["chatJid",1,"string",0],["contactType",2,"int32",0],["email",3,"string",0],["altPhoneNumbers",4,"string",0],["birthday",5,"int64",0],["address",6,"string",0],["acquisitionSource",7,"int32",0],["leadStage",8,"int32",0],["lastOrder",9,"int64",0],["createdAt",10,"int64",0],["modifiedAt",11,"int64",0]],"SyncActionValue.SubscriptionsSyncV2Action":[["subscriptions",1,"m:SyncActionValue.SubscriptionsSyncV2Action.Subscription",1],["paidFeature",2,"m:SyncActionValue.SubscriptionsSyncV2Action.PaidFeature",1]],"SyncActionValue.SubscriptionsSyncV2Action.Subscription":[["id",1,"string",0],["tier",2,"int32",0],["status",3,"string",0],["startTime",4,"int64",0],["endTime",5,"int64",0],["isPlatformChanged",6,"bool",0],["source",7,"string",0],["creationTime",8,"int64",0]],"SyncActionValue.SubscriptionsSyncV2Action.PaidFeature":[["name",1,"string",0],["enabled",2,"bool",0],["limit",3,"int32",0],["expirationTime",4,"int64",0]],"SyncActionValue.ThreadPinAction":[["pinned",1,"bool",0]],"SyncActionValue.AutoOrganizeBusinessChatSetting":[["autoOrganize",1,"bool",0]],"SyncActionValue.BizAiSettingsNudgeAction":[["category",1,"e:SyncActionValue.BizAiSettingsNudgeAction.Category",0],["version",2,"int64",0],["updatedAtMs",3,"int64",0]],"SyncActionValue.CoexV2VersionAction":[["version",1,"uint64",0]],"SyncActionValue.WasaRootSecretAction":[["secrets",1,"m:SyncActionValue.WasaRootSecretAction.Secret",1]],"SyncActionValue.WasaRootSecretAction.Secret":[["id",1,"string",0],["rootSecret",2,"bytes",0],["epoch",3,"int64",0]],"SyncActionValue.BubbleLockMessageAction":[["locked",1,"bool",0]],"SyncActionValue.LabelSublistAction":[["subListId",1,"int32",0]],"SyncActionValue.CtwaMessageReceivedAction":[["isCtwaMessageReceived",1,"bool",0]],"SyncActionValue.SharedDeviceAllowlistAction":[["allowed",1,"bool",0]],"SyncActionValue.ContactManagerMetadataAction":[["isHidden",1,"bool",0]],"SyncActionValue.BusinessFolderActivationAction":[["activated",1,"bool",0]],"SyncActionValue.GroupHistoryToggleAction":[],"SyncActionValue.BbProPendingCustomerBaseAction":[["pending",1,"bool",0]],"SyncActionValue.CommunityNestingStateAction":[],"SyncActionValue.SharedDeviceSecretAction":[["secret",1,"bytes",0],["ttlMs",2,"int64",0]],"SyncActionValue.HatchCvmSecretAction":[["secret",1,"bytes",0],["generation",2,"int64",0]],"SyncActionValue.BusinessFolderChatPreferenceAction":[],"SyncActionValue.StatusPrivacyAction.CustomList":[["listId",1,"string",0],["name",2,"string",0],["emoji",3,"string",0],["isSelected",4,"bool",0],["userJid",5,"string",1]],"WebMessageInfo.PaymentTransactionInfo":[["amount1000",1,"int64",0],["bankTransactionId",2,"string",0],["credentialId",3,"string",0],["currency",4,"string",0],["errorCode",5,"string",0],["groupJid",6,"string",0],["messageStanzaId",7,"string",0],["recieverJid",8,"string",0],["senderJid",9,"string",0],["status",10,"uint64",0],["timestamp",11,"int64",0],["transactionId",12,"string",0],["type",13,"int32",0],["metadata",14,"m:WebMessageInfo.PaymentTransactionInfo.MetadataV2",0]],"WebMessageInfo.PaymentTransactionInfo.MetadataV2":[["amount",1,"m:Money",0],["collectRequestId",2,"string",0],["counter",3,"string",0],["expiryTimestamp",4,"int64",0],["lastStatusTimestamp",5,"int64",0],["localTransactionId",6,"string",0],["messageKey",7,"m:MessageKey",0],["previousStatus",8,"int64",0],["previousType",9,"int64",0],["referenceMessageId",11,"string",0],["service",13,"string",0],["version",14,"int32",0],["marketMetadata",15,"m:WebMessageInfo.PaymentTransactionInfo.MetadataV2.MarketMetadata",0],["order",17,"m:WebMessageInfo.PaymentTransactionInfo.MetadataV2.Order",0],["offerClaim",18,"m:WebMessageInfo.PaymentTransactionInfo.MetadataV2.OfferClaim",0],["messageContainsBackground",20,"bool",0],["senderAlias",21,"string",0]],"WebMessageInfo.PaymentTransactionInfo.MetadataV2.MarketMetadata":[["upiMetadata",1,"m:WebMessageInfo.PaymentTransactionInfo.MetadataV2.MarketMetadata.UpiMetadata",0],["brMetadata",2,"m:WebMessageInfo.PaymentTransactionInfo.MetadataV2.MarketMetadata.BrMetadata",0]],"WebMessageInfo.PaymentTransactionInfo.MetadataV2.MarketMetadata.UpiMetadata":[["startTimestamp",1,"int64",0],["receiverHandle",2,"string",0],["senderHandle",3,"string",0],["invoiceUrl",4,"string",0],["mandateDetails",5,"m:WebMessageInfo.PaymentTransactionInfo.MetadataV2.MarketMetadata.UpiMetadata.MandateDetails",0],["mandateUpdates",6,"m:WebMessageInfo.PaymentTransactionInfo.MetadataV2.MarketMetadata.UpiMetadata.MandateUpdates",0]],"WebMessageInfo.PaymentTransactionInfo.MetadataV2.MarketMetadata.UpiMetadata.MandateDetails":[["acceptEndTimestamp",1,"int64",0],["acceptStartTimestamp",2,"int64",0],["amountRule",3,"int32",0],["errorCode",4,"string",0],["frequencyRule",5,"string",0],["isRevocable",6,"bool",0],["mandateInfo",7,"string",0],["mandateNo",8,"string",0],["originalAmount",9,"m:Money",0]],"WebMessageInfo.PaymentTransactionInfo.MetadataV2.MarketMetadata.UpiMetadata.MandateUpdates":[["action",1,"int32",0],["amount",2,"m:Money",0],["acceptEndTimestamp",3,"int64",0],["amountRule",4,"int32",0],["errorCode",5,"string",0],["seqNo",6,"string",0],["mandateUpdateInfo",7,"string",0],["status",8,"int32",0]],"WebMessageInfo.PaymentTransactionInfo.MetadataV2.MarketMetadata.BrMetadata":[["paymentRails",1,"string",0]],"WebMessageInfo.PaymentTransactionInfo.MetadataV2.Order":[["id",1,"string",0],["messageKey",2,"m:MessageKey",0]],"WebMessageInfo.PaymentTransactionInfo.MetadataV2.OfferClaim":[["offerId",1,"int64",0],["id",2,"int64",0],["incentiveTransactionId",3,"string",0],["parentTransactionId",4,"string",0]],"WebMessageInfo.ScheduledMessageMetadata":[["revealKeyId",1,"string",0],["revealKey",2,"bytes",0],["scheduledTime",3,"uint64",0]],"WebMessageInfo.EventInviteAdditionalMetadata":[["isUpdated",1,"bool",0],["selfAccessStatus",2,"e:WebMessageInfo.EventInviteAdditionalMetadata.SelfAccessStatus",0],["selfRsvpStatus",3,"e:WebMessageInfo.EventInviteAdditionalMetadata.SelfRsvpStatus",0],["selfAdditionalGuestCount",4,"uint32",0],["selfInviteeLastUpdatedTsUsec",5,"int64",0]]},"enums":{"Account.PnLearnState":{"UNSET":0,"SHARED":1,"HIDDEN":2},"ClientPayload.UserAgent.DistributionChannel":{"APPSTORE":0,"WEBSITE":1,"TESTFLIGHT":2,"INTERNAL":3},"ContextInfo.CrossAppSource":{"CROSS_APP_SOURCE_UNKNOWN":0,"CROSS_APP_SOURCE_INSTAGRAM":1,"CROSS_APP_SOURCE_FACEBOOK":2},"ContextInfo.BusinessInteractionPills.Pill.PillType":{"UNKNOWN":0,"VIEW_BUSINESS":1,"CHAT":2,"CALL":3,"CATALOG":4,"CHANNEL":5,"BOOK_APPOINTMENT":6,"OFFERS":7,"BESTSELLERS":8,"MENU":9,"ABOUT":10,"SHOP":11,"ORDER":12},"ContextInfo.BusinessInteractionPills.EntryPoint":{"ENTRY_POINT_UNKNOWN":0,"P2P_LINK_SHARE":1,"CONTACT_CARD_SHARING":2,"PHONE_NUMBER":3,"STATUS":4,"IN_THREAD_CONTEXT_CARD":5},"HandshakeMessage.ClientHello.PqMode":{"HANDSHAKE_PQ_MODE_UNKNOWN":0,"XXKEM":1,"XXKEM_FS":2,"WA_CLASSICAL":3,"WA_PQ":4,"IKKEM":5,"IKKEM_FS":6,"XXKEM_2":7,"IKKEM_2":8,"XXKEM_EPH":9},"InteractiveAnnotation.PixKey.KeyType":{"UNKNOWN":0,"CPF":1,"CNPJ":2,"PHONE":3,"EMAIL":4,"EVP":5},"Message.EventInviteMessage.StatusV2":{"UNKNOWN":0,"ACTIVE":1,"CANCELED":2,"SUSPENDED":3,"DELETED":4,"LEFT_EVENT":5,"REMOVED_FROM_INVITE_LIST":6},"Message.PaymentReminderMessage.Frequency":{"REMINDER_FREQUENCY_UNKNOWN":0,"WEEKLY":1,"BI_WEEKLY":2,"MONTHLY":3,"QUARTERLY":4},"Message.PaymentReminderMessage.StatusV3":{"REMINDER_STATUS_UNKNOWN":0,"ACTIVE":1,"CANCELLED_BY_CREATOR":2,"STOPPED_BY_RECEIVER":3,"EXPIRED":4,"PAID":5},"Message.PaymentDetailsMessage.ServiceTypeV2":{"UNKNOWN":0,"UPI":1},"Message.PaymentDetailsMessage.StatusV4":{"STATUS_UNKNOWN":0,"SUCCESS":1},"Message.PaymentInviteMessage.InviteType":{"DEFAULT":0,"MAPPER":1},"Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactListResponse.Contact.State":{"SENT":0,"DELIVERED":1,"READ":2,"REPLIED":3,"QUICK_REPLIED":4},"Message.ProtocolMessage.AiMetadataOperation.BizAiMetadataSync.ServerEvent.ProtocolEvent":{"UNSPECIFIED":0,"AGENT_CHAT_READY":1},"Message.ProtocolMessage.MessageEditDisplayType":{"DEFAULT":0,"LINK_PREVIEW_ONLY":1},"Message.ProtocolMessage.DraftMessageSync.Action":{"ACTION_UNKNOWN":0,"SET":1,"CLEAR":2},"Message.ProtocolMessage.DraftMessageSync.ClearReason":{"CLEAR_REASON_UNKNOWN":0,"USER_CLEARED":1,"SENT":2,"CHAT_LOCKED":3,"REPLACED_BY_NON_TEXT":4},"PollAdditionalMetadata.PollOptionReplayEntry.TypeV2":{"UNKNOWN":0,"EDIT":1,"ADD":2,"REVOKE":3},"SyncActionValue.SettingsSyncAction.BannerNotificationDisplayMode":{"DISPLAY_MODE_UNKNOWN":0,"ALWAYS":1,"NEVER":2,"ONLY_WHEN_APP_IS_OPEN":3},"SyncActionValue.SettingsSyncAction.MediaUploadQuality":{"MEDIA_QUALITY_UNKNOWN":0,"STANDARD":1,"HD":2},"SyncActionValue.SettingsSyncAction.MediaAutoDownloadQuality":{"MEDIA_AUTO_DOWNLOAD_QUALITY_UNKNOWN":0,"MEDIA_AUTO_DOWNLOAD_QUALITY_STANDARD":1,"MEDIA_AUTO_DOWNLOAD_QUALITY_HD":2,"MEDIA_AUTO_DOWNLOAD_QUALITY_AUTO":3},"SyncActionValue.BusinessBroadcastCampaignAction.StatusV5":{"DRAFT":1,"SCHEDULED":2,"PROCESSING":3,"FAILED":4,"SENT":5},"SyncActionValue.BusinessBroadcastCampaignAction.BbProStatus":{"BB_PRO_ACTIVE":1,"BB_PRO_COMPLETED":2,"BB_PRO_IN_DRAFT":3,"BB_PRO_IN_REVIEW":4,"BB_PRO_NOT_SENDING":5,"BB_PRO_OFF":6,"BB_PRO_REJECTED":7,"BB_PRO_SCHEDULED":8,"BB_PRO_SENDING_LIMITED":9,"BB_PRO_PROCESSING":10},"SyncActionValue.BizAiSettingsNudgeAction.Category":{"UNKNOWN":0,"INSTRUCTIONS":1,"RESPONSE_SETTINGS":2,"EXAMPLE_RESPONSES":3,"KNOWLEDGE":4,"LEAD_GEN":5,"HANDOFF_REMOVAL_TIMING":6},"WebMessageInfo.EventInviteAdditionalMetadata.SelfAccessStatus":{"ACCESS_STATUS_UNKNOWN":0,"HAS_ACCESS":1,"LEFT_EVENT":2,"REMOVED_FROM_INVITE_LIST":3,"UNAVAILABLE":4},"WebMessageInfo.EventInviteAdditionalMetadata.SelfRsvpStatus":{"RSVP_STATUS_UNKNOWN":0,"GOING":1,"NOT_GOING":2,"MAYBE":3,"NO_RESPONSE":4}}};
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
const VARINT = new Set(['int32', 'uint32', 'int64', 'uint64', 'sint32', 'sint64', 'bool']);
|
|
2
|
+
const FIXED64 = new Set(['double', 'fixed64', 'sfixed64']);
|
|
3
|
+
const FIXED32 = new Set(['float', 'fixed32', 'sfixed32']);
|
|
4
|
+
|
|
5
|
+
const tagOf = (num, wt) => ((num << 3) | wt) >>> 0;
|
|
6
|
+
|
|
7
|
+
const wireOf = (type) => {
|
|
8
|
+
if (type.startsWith('e:') || VARINT.has(type)) return 0;
|
|
9
|
+
if (FIXED64.has(type)) return 1;
|
|
10
|
+
if (FIXED32.has(type)) return 5;
|
|
11
|
+
return 2;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const isPackable = (type) => !(type === 'string' || type === 'bytes' || type.startsWith('m:'));
|
|
15
|
+
|
|
16
|
+
const readVarint = (buf, pos) => {
|
|
17
|
+
let result = 0;
|
|
18
|
+
let mul = 1;
|
|
19
|
+
let count = 0;
|
|
20
|
+
let byte;
|
|
21
|
+
do {
|
|
22
|
+
if (pos >= buf.length || ++count > 10) throw new RangeError('bad varint');
|
|
23
|
+
byte = buf[pos++];
|
|
24
|
+
result += (byte & 0x7f) * mul;
|
|
25
|
+
mul *= 128;
|
|
26
|
+
} while (byte & 0x80);
|
|
27
|
+
return [result, pos];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const readVarintBig = (buf, pos) => {
|
|
31
|
+
let result = 0n;
|
|
32
|
+
let shift = 0n;
|
|
33
|
+
let count = 0;
|
|
34
|
+
let byte;
|
|
35
|
+
do {
|
|
36
|
+
if (pos >= buf.length || ++count > 10) throw new RangeError('bad varint');
|
|
37
|
+
byte = buf[pos++];
|
|
38
|
+
result |= BigInt(byte & 0x7f) << shift;
|
|
39
|
+
shift += 7n;
|
|
40
|
+
} while (byte & 0x80);
|
|
41
|
+
return [result, pos];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const zigzag = (v) => (v >> 1n) ^ -(v & 1n);
|
|
45
|
+
|
|
46
|
+
export const createExtensions = (ns, data) => {
|
|
47
|
+
const classCache = new Map();
|
|
48
|
+
|
|
49
|
+
const oldClass = (path) => {
|
|
50
|
+
if (classCache.has(path)) return classCache.get(path);
|
|
51
|
+
let node = ns;
|
|
52
|
+
for (const part of path.split('.')) {
|
|
53
|
+
node = node?.[part];
|
|
54
|
+
if (node === undefined || node === null) break;
|
|
55
|
+
}
|
|
56
|
+
const found = node && typeof node.encode === 'function' && typeof node.decode === 'function' ? node : null;
|
|
57
|
+
classCache.set(path, found);
|
|
58
|
+
return found;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const enumNumber = (path, value) => {
|
|
62
|
+
if (typeof value === 'string') return data.enums[path]?.[value] ?? 0;
|
|
63
|
+
return value;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const writeScalar = (w, type, value) => {
|
|
67
|
+
switch (type) {
|
|
68
|
+
case 'string': w.string(String(value)); break;
|
|
69
|
+
case 'bytes': w.bytes(value); break;
|
|
70
|
+
case 'bool': w.bool(!!value); break;
|
|
71
|
+
case 'int32': w.int32(value); break;
|
|
72
|
+
case 'uint32': w.uint32(value); break;
|
|
73
|
+
case 'sint32': w.sint32(value); break;
|
|
74
|
+
case 'int64': w.int64(typeof value === 'bigint' ? value.toString() : value); break;
|
|
75
|
+
case 'uint64': w.uint64(typeof value === 'bigint' ? value.toString() : value); break;
|
|
76
|
+
case 'sint64': w.sint64(typeof value === 'bigint' ? value.toString() : value); break;
|
|
77
|
+
case 'fixed32': w.fixed32(value); break;
|
|
78
|
+
case 'sfixed32': w.sfixed32(value); break;
|
|
79
|
+
case 'fixed64': w.fixed64(typeof value === 'bigint' ? value.toString() : value); break;
|
|
80
|
+
case 'sfixed64': w.sfixed64(typeof value === 'bigint' ? value.toString() : value); break;
|
|
81
|
+
case 'float': w.float(value); break;
|
|
82
|
+
case 'double': w.double(value); break;
|
|
83
|
+
default: break;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const writeRaw = (w, type, value) => {
|
|
88
|
+
if (type.startsWith('e:')) w.int32(enumNumber(type.slice(2), value));
|
|
89
|
+
else writeScalar(w, type, value);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const encodeMessage = (w, path, value) => {
|
|
93
|
+
const old = oldClass(path);
|
|
94
|
+
if (old) {
|
|
95
|
+
old.encode(value, w);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const fields = data.types[path];
|
|
99
|
+
if (!fields) return;
|
|
100
|
+
for (const field of fields) {
|
|
101
|
+
const v = value?.[field[0]];
|
|
102
|
+
if (v !== undefined && v !== null) writeField(w, field, v);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const writeOne = (w, num, type, value) => {
|
|
107
|
+
if (type.startsWith('m:')) {
|
|
108
|
+
w.uint32(tagOf(num, 2)).fork();
|
|
109
|
+
encodeMessage(w, type.slice(2), value);
|
|
110
|
+
w.ldelim();
|
|
111
|
+
} else {
|
|
112
|
+
w.uint32(tagOf(num, wireOf(type)));
|
|
113
|
+
writeRaw(w, type, value);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const writeField = (w, field, value) => {
|
|
118
|
+
const [, num, type, repeated] = field;
|
|
119
|
+
if (!repeated) {
|
|
120
|
+
writeOne(w, num, type, value);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const list = Array.isArray(value) ? value : [value];
|
|
124
|
+
if (!list.length) return;
|
|
125
|
+
if (isPackable(type)) {
|
|
126
|
+
w.uint32(tagOf(num, 2)).fork();
|
|
127
|
+
for (const item of list) writeRaw(w, type, item);
|
|
128
|
+
w.ldelim();
|
|
129
|
+
} else {
|
|
130
|
+
for (const item of list) writeOne(w, num, type, item);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const decodeScalar = (buf, type, raw) => {
|
|
135
|
+
switch (type) {
|
|
136
|
+
case 'bool': return raw !== 0n;
|
|
137
|
+
case 'int32': return Number(BigInt.asIntN(32, raw));
|
|
138
|
+
case 'uint32': return Number(BigInt.asUintN(32, raw));
|
|
139
|
+
case 'int64': return Number(BigInt.asIntN(64, raw));
|
|
140
|
+
case 'uint64': return Number(BigInt.asUintN(64, raw));
|
|
141
|
+
case 'sint32': return Number(BigInt.asIntN(32, zigzag(raw)));
|
|
142
|
+
case 'sint64': return Number(BigInt.asIntN(64, zigzag(raw)));
|
|
143
|
+
default: return Number(raw);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const readFixed = (buf, type, pos) => {
|
|
148
|
+
const view = new DataView(buf.buffer, buf.byteOffset + pos, FIXED64.has(type) ? 8 : 4);
|
|
149
|
+
switch (type) {
|
|
150
|
+
case 'float': return view.getFloat32(0, true);
|
|
151
|
+
case 'fixed32': return view.getUint32(0, true);
|
|
152
|
+
case 'sfixed32': return view.getInt32(0, true);
|
|
153
|
+
case 'double': return view.getFloat64(0, true);
|
|
154
|
+
case 'fixed64': return Number(view.getBigUint64(0, true));
|
|
155
|
+
default: return Number(view.getBigInt64(0, true));
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const decodeSlice = (buf, type, a, b) => {
|
|
160
|
+
if (type === 'string') return Buffer.from(buf.buffer, buf.byteOffset + a, b - a).toString('utf8');
|
|
161
|
+
if (type === 'bytes') return Buffer.from(buf.subarray(a, b));
|
|
162
|
+
const path = type.slice(2);
|
|
163
|
+
const old = oldClass(path);
|
|
164
|
+
if (old) return old.decode(buf.subarray(a, b));
|
|
165
|
+
return decodeInto(path, buf, a, b);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const readFieldValue = (buf, field, wt, pos) => {
|
|
169
|
+
const type = field[2];
|
|
170
|
+
if (wt === 0) {
|
|
171
|
+
const [raw, next] = readVarintBig(buf, pos);
|
|
172
|
+
if (type.startsWith('e:')) return [Number(BigInt.asIntN(32, raw)), next];
|
|
173
|
+
return [decodeScalar(buf, type, raw), next];
|
|
174
|
+
}
|
|
175
|
+
if (wt === 1) return [readFixed(buf, FIXED64.has(type) ? type : 'fixed64', pos), pos + 8];
|
|
176
|
+
if (wt === 5) return [readFixed(buf, FIXED32.has(type) ? type : 'fixed32', pos), pos + 4];
|
|
177
|
+
const [len, start] = readVarint(buf, pos);
|
|
178
|
+
return [decodeSlice(buf, type, start, start + len), start + len, start, start + len];
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const skip = (buf, wt, pos) => {
|
|
182
|
+
if (wt === 0) return readVarint(buf, pos)[1];
|
|
183
|
+
if (wt === 1) return pos + 8;
|
|
184
|
+
if (wt === 5) return pos + 4;
|
|
185
|
+
if (wt === 2) {
|
|
186
|
+
const [len, start] = readVarint(buf, pos);
|
|
187
|
+
return start + len;
|
|
188
|
+
}
|
|
189
|
+
throw new RangeError('bad wire type');
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const assign = (target, field, value) => {
|
|
193
|
+
const name = field[0];
|
|
194
|
+
if (!field[3]) {
|
|
195
|
+
target[name] = value;
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (!Array.isArray(target[name])) target[name] = [];
|
|
199
|
+
if (Array.isArray(value)) target[name].push(...value);
|
|
200
|
+
else target[name].push(value);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const scan = (buf, start, end, byNumber, target) => {
|
|
204
|
+
let pos = start;
|
|
205
|
+
while (pos < end) {
|
|
206
|
+
const [tag, afterTag] = readVarint(buf, pos);
|
|
207
|
+
const num = tag >>> 3;
|
|
208
|
+
const wt = tag & 7;
|
|
209
|
+
const field = byNumber.get(num);
|
|
210
|
+
if (!field) {
|
|
211
|
+
pos = skip(buf, wt, afterTag);
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const type = field[2];
|
|
215
|
+
if (field[3] && wt === 2 && isPackable(type)) {
|
|
216
|
+
const [len, s] = readVarint(buf, afterTag);
|
|
217
|
+
const packed = [];
|
|
218
|
+
let p = s;
|
|
219
|
+
const stop = s + len;
|
|
220
|
+
const elementWire = wireOf(type);
|
|
221
|
+
while (p < stop) {
|
|
222
|
+
const r = readFieldValue(buf, field, elementWire, p);
|
|
223
|
+
packed.push(r[0]);
|
|
224
|
+
p = r[1];
|
|
225
|
+
}
|
|
226
|
+
assign(target, field, packed);
|
|
227
|
+
pos = stop;
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
const result = readFieldValue(buf, field, wt, afterTag);
|
|
231
|
+
assign(target, field, result[0]);
|
|
232
|
+
pos = result[1];
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const decodeInto = (path, buf, start, end) => {
|
|
237
|
+
const fields = data.types[path] || [];
|
|
238
|
+
const byNumber = new Map(fields.map((f) => [f[1], f]));
|
|
239
|
+
const out = {};
|
|
240
|
+
scan(buf, start, end, byNumber, out);
|
|
241
|
+
return out;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const patched = [];
|
|
245
|
+
|
|
246
|
+
const patchClass = (Cls, fields) => {
|
|
247
|
+
const byNumber = new Map(fields.map((f) => [f[1], f]));
|
|
248
|
+
const origEncode = Cls.encode;
|
|
249
|
+
const origFromObject = Cls.fromObject;
|
|
250
|
+
const origDecode = Cls.decode;
|
|
251
|
+
|
|
252
|
+
Cls.encode = function (message, writer) {
|
|
253
|
+
const w = origEncode.call(this, message, writer);
|
|
254
|
+
if (message) {
|
|
255
|
+
for (const field of fields) {
|
|
256
|
+
const v = message[field[0]];
|
|
257
|
+
if (v !== undefined && v !== null) writeField(w, field, v);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return w;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
Cls.fromObject = function (object) {
|
|
264
|
+
const instance = origFromObject.call(this, object);
|
|
265
|
+
if (object && object !== instance) {
|
|
266
|
+
for (const field of fields) {
|
|
267
|
+
const v = object[field[0]];
|
|
268
|
+
if (v !== undefined && v !== null) instance[field[0]] = v;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return instance;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
Cls.decode = function (reader, length, ...rest) {
|
|
275
|
+
const isReader = !!reader && typeof reader.pos === 'number' && !!reader.buf;
|
|
276
|
+
const buf = isReader ? reader.buf : reader;
|
|
277
|
+
const start = isReader ? reader.pos : 0;
|
|
278
|
+
const message = origDecode.call(this, reader, length, ...rest);
|
|
279
|
+
try {
|
|
280
|
+
if (buf && typeof buf.length === 'number') {
|
|
281
|
+
const end = isReader ? reader.pos : (length === undefined ? buf.length : start + length);
|
|
282
|
+
scan(buf, start, end, byNumber, message);
|
|
283
|
+
}
|
|
284
|
+
} catch (_) { /* keep the natively decoded message */ }
|
|
285
|
+
return message;
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
for (const [path, list] of Object.entries(data.ext)) {
|
|
290
|
+
const Cls = oldClass(path);
|
|
291
|
+
if (!Cls || Cls.__protoExtended) continue;
|
|
292
|
+
const fields = list.filter((f) => !(f[0] in Cls.prototype));
|
|
293
|
+
if (!fields.length) continue;
|
|
294
|
+
patchClass(Cls, fields);
|
|
295
|
+
Cls.__protoExtended = true;
|
|
296
|
+
patched.push(path);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return { patched, encodeMessage, decodeInto };
|
|
300
|
+
};
|
|
@@ -875,7 +875,7 @@ const makeRichCardSection = (data) => {
|
|
|
875
875
|
MAIN BUILDER — prepareRichResponseMessage
|
|
876
876
|
───────────────────────────────────────────────────────────── */
|
|
877
877
|
|
|
878
|
-
export const prepareRichResponseMessage = (content) => {
|
|
878
|
+
export const prepareRichResponseMessage = (content, runtime = {}) => {
|
|
879
879
|
const {
|
|
880
880
|
code, contentText, disclaimerText, footerText, headerText,
|
|
881
881
|
language, links, noHeading, richResponse, table, title,
|
|
@@ -1054,7 +1054,7 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
1054
1054
|
const richResponseMessage = proto.AIRichResponseMessage.create({
|
|
1055
1055
|
submessages,
|
|
1056
1056
|
messageType: proto.AIRichResponseMessageType.AI_RICH_RESPONSE_TYPE_STANDARD,
|
|
1057
|
-
unifiedResponse: packUnifiedResponse(unified, unifiedGzip === true),
|
|
1057
|
+
unifiedResponse: packUnifiedResponse(unified, typeof unifiedGzip === 'boolean' ? unifiedGzip : runtime.gzip === true),
|
|
1058
1058
|
contextInfo: {
|
|
1059
1059
|
isForwarded: true,
|
|
1060
1060
|
forwardingScore: 1,
|
package/package.json
CHANGED