@pontalabs/baileys 1.0.0 → 1.0.2

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 CHANGED
@@ -8,14 +8,14 @@
8
8
  <!-- Welcome Text -->
9
9
  <h2>
10
10
  <img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Hand%20gestures/Waving%20Hand.png" alt="Waving Hand" width="35" style="vertical-align: middle; margin-right: 8px;" />
11
- Selamat Datang di Baileys Ponta Socket
11
+ Selamat Datang di Baileys PontaLabs
12
12
  </h2>
13
13
 
14
14
  <br>
15
15
 
16
16
  <!-- Badges -->
17
- <a href="https://www.npmjs.com/package/@pontasockets/baileys">
18
- <img src="https://img.shields.io/npm/v/@pontasockets/baileys?style=flat-square&amp;color=cb3837&amp;label=npm&amp;logo=npm" alt="NPM Version" />
17
+ <a href="https://www.npmjs.com/package/@pontalabs/baileys">
18
+ <img src="https://img.shields.io/npm/v/@pontalabs/baileys?style=flat-square&amp;color=cb3837&amp;label=npm&amp;logo=npm" alt="NPM Version" />
19
19
  </a>
20
20
  <a href="https://nodejs.org">
21
21
  <img src="https://img.shields.io/badge/node-%3E%3D18.x-339933?style=flat-square&amp;logo=node.js&amp;logoColor=white" alt="Node.js" />
@@ -108,10 +108,10 @@ This fork builds on top of the original Baileys library with **targeted, product
108
108
 
109
109
  ```bash
110
110
  # npm
111
- npm install @pontasockets/baileys
111
+ npm install @pontalabs/baileys
112
112
 
113
113
  # yarn
114
- yarn add @pontasockets/baileys
114
+ yarn add @pontalabs/baileys
115
115
  ```
116
116
 
117
117
  ---
@@ -119,7 +119,7 @@ yarn add @pontasockets/baileys
119
119
  ## 🚀 Quick Start
120
120
 
121
121
  ```js
122
- import makeWASocket, { useMultiFileAuthState } from '@pontasockets/baileys'
122
+ import makeWASocket, { useMultiFileAuthState } from '@pontalabs/baileys'
123
123
 
124
124
  async function start() {
125
125
  const { state, saveCreds } = await useMultiFileAuthState('./sessions')
@@ -998,7 +998,7 @@ await sock.sendMessage(jid, {
998
998
  await sock.sendMessage(jid, {
999
999
  richPost: {
1000
1000
  title: 'Caption post ini',
1001
- author_display_name: '@pontasockets',
1001
+ author_display_name: '@pontalabs',
1002
1002
  author_profile_image: 'https://example.com/avatar.jpg',
1003
1003
  media_url: 'https://example.com/post.jpg',
1004
1004
  timestamp: Math.floor(Date.now() / 1000)
@@ -1155,7 +1155,7 @@ await sock.sendMessage(jid, {
1155
1155
 
1156
1156
  ```js
1157
1157
  await sock.sendMessage(jid, {
1158
- richTip: 'Dihasilkan oleh AI · pontasockets v0.3.4'
1158
+ richTip: 'Dihasilkan oleh AI · pontalabs v0.3.4'
1159
1159
  }, { quoted: message })
1160
1160
  ```
1161
1161
  </details>
@@ -1188,7 +1188,7 @@ await sock.sendMessage(jid, {
1188
1188
  await sock.sendMessage(jid, {
1189
1189
  richResponse: [
1190
1190
  { text: 'Summary di sini.' },
1191
- { footer: '© PontaCT · pontasockets' }
1191
+ { footer: '© PontaCT · pontalabs' }
1192
1192
  ]
1193
1193
  }, { quoted: message })
1194
1194
  ```
@@ -1364,7 +1364,7 @@ await sock.sendMessage(jid, {
1364
1364
  { table: { headers: ['Version', 'LTS', 'Release'], rows: [['22.x', 'Yes', '2024'], ['21.x', 'No', '2023']] } },
1365
1365
  { sources: [['https://nodejs.org/fav.ico', 'https://nodejs.org', 'Node.js']] },
1366
1366
  { suggestions: ['Lihat changelog', 'Download', 'Docs'] },
1367
- { footer: 'PontaCT · pontasockets' }
1367
+ { footer: 'PontaCT · pontalabs' }
1368
1368
  ]
1369
1369
  }, { quoted: message })
1370
1370
  ```
@@ -1680,7 +1680,7 @@ This project is licensed for **personal and non-commercial use only**.
1680
1680
 
1681
1681
  <div align="center">
1682
1682
 
1683
- [📦 NPM](https://www.npmjs.com/package/@pontasockets/baileys) · [📖 Baileys Wiki](https://github.com/WhiskeySockets/Baileys/wiki) · [⭐ Star this repo](#)
1683
+ [📦 NPM](https://www.npmjs.com/package/@pontalabs/baileys) · [📖 Baileys Wiki](https://github.com/WhiskeySockets/Baileys/wiki) · [⭐ Star this repo](#)
1684
1684
 
1685
1685
  <br>
1686
1686
 
@@ -43,7 +43,7 @@ const sender_key_record_1 = require("./Group/sender-key-record");
43
43
  const Group_1 = require("./Group");
44
44
  const LIDMappingStore_1 = require("./lid-mapping")
45
45
 
46
- // FIX: sebelumnya pontasockets gak punya deteksi perubahan identity key sama
46
+ // FIX: sebelumnya pontalabs gak punya deteksi perubahan identity key sama
47
47
  // sekali. Kalau identity kontak berubah (kontak install ulang WA, atau kena
48
48
  // resync multi-device pas ada linked device lain online), sesi lama tetap
49
49
  // dipakai terus dan selalu gagal decrypt "Bad MAC" berulang-ulang sampai
@@ -1,5 +1,5 @@
1
1
  "use strict"
2
- // 18 7 2026
2
+
3
3
  var __importDefault = (this && this.__importDefault) || function(mod) {
4
4
  return (mod && mod.__esModule) ? mod : {
5
5
  "default": mod
@@ -59,6 +59,7 @@ const makeMessagesSocket = (config) => {
59
59
 
60
60
  const messageRetryManager = enableRecentMessageCache ? new Utils_1.MessageRetryManager(logger, maxMsgRetryCount) : null
61
61
  const encryptionMutex = make_keyed_mutex_1.makeKeyedMutex()
62
+ const devicesMutex = make_keyed_mutex_1.makeMutex()
62
63
  let mediaConn
63
64
 
64
65
  const refreshMediaConn = async (forceGet = false) => {
@@ -295,6 +296,24 @@ const makeMessagesSocket = (config) => {
295
296
 
296
297
  const result = await executeUSyncQuery(query)
297
298
  if (result) {
299
+ // FIX: pontalabs sebelumnya gak pernah nyimpen mapping LID<->PN
300
+ // dari hasil USync device query ini (nuiisweety nyimpen + langsung
301
+ // force-refresh session buat LID yang baru ketemu). Tanpa ini,
302
+ // pengiriman ke kontak yang butuh LID addressing bisa tetep pakai
303
+ // address PN yang salah/basi -> penerima gak bisa decrypt balasan
304
+ // bot ("Menunggu pesan ini...").
305
+ const lidResults = (result.list || []).filter(item => !!item.lid)
306
+ if (lidResults.length > 0) {
307
+ try {
308
+ await signalRepository.lidMapping.storeLIDPNMappings(
309
+ lidResults.map(item => ({ lid: item.lid, pn: item.id }))
310
+ )
311
+ const lids = lidResults.map(item => item.lid)
312
+ await assertSessions(lids, true)
313
+ } catch (error) {
314
+ logger.warn({ error, count: lidResults.length }, 'failed to store/refresh LID mappings from device sync')
315
+ }
316
+ }
298
317
  const extracted = Utils_1.extractDeviceJids(result?.list, authState.creds.me.id, ignoreZeroDevices)
299
318
  const deviceMap = {}
300
319
  for (const item of extracted) {
@@ -318,16 +337,18 @@ const makeMessagesSocket = (config) => {
318
337
  }
319
338
  }
320
339
 
321
- if (userDevicesCache.mset) {
322
- await userDevicesCache.mset(Object.entries(deviceMap).map(([key, value]) => ({
323
- key,
324
- value
325
- })))
326
- } else {
327
- for (const key in deviceMap) {
328
- if (deviceMap[key]) await userDevicesCache.set(key, deviceMap[key])
340
+ await devicesMutex.mutex(async () => {
341
+ if (userDevicesCache.mset) {
342
+ await userDevicesCache.mset(Object.entries(deviceMap).map(([key, value]) => ({
343
+ key,
344
+ value
345
+ })))
346
+ } else {
347
+ for (const key in deviceMap) {
348
+ if (deviceMap[key]) await userDevicesCache.set(key, deviceMap[key])
349
+ }
329
350
  }
330
- }
351
+ })
331
352
  }
332
353
  return deviceResults
333
354
  }
@@ -1135,6 +1156,14 @@ const makeMessagesSocket = (config) => {
1135
1156
  return message
1136
1157
  },
1137
1158
  sendStatusMentions: async (content, jids = []) => {
1159
+ const MAX_STATUS_MENTIONS = 5
1160
+ if (jids.length > MAX_STATUS_MENTIONS) {
1161
+ logger.warn(
1162
+ { requested: jids.length, max: MAX_STATUS_MENTIONS },
1163
+ `sendStatusMentions: max ${MAX_STATUS_MENTIONS} mentions per status, truncating`
1164
+ )
1165
+ jids = jids.slice(0, MAX_STATUS_MENTIONS)
1166
+ }
1138
1167
  const userJid = WABinary_1.jidNormalizedUser(authState.creds.me.id)
1139
1168
  let allUsers = new Set()
1140
1169
  allUsers.add(userJid)
@@ -165,7 +165,7 @@ const getDecryptionJid = async (sender, repository) => {
165
165
  if (!mapped) {
166
166
  return sender
167
167
  }
168
- // FIX: pontasockets gak punya migrateSession (beda dari levvleys) yang
168
+ // FIX: pontalabs gak punya migrateSession (beda dari levvleys) yang
169
169
  // mindahin sesi Signal dari address PN ke address LID begitu mapping
170
170
  // disimpan. Jadi mapping doang gak jamin ada sesi beneran di address LID
171
171
  // itu -- kalau dipaksa pakai, decrypt gagal "No session record" walau
@@ -184,7 +184,7 @@ const getDecryptionJid = async (sender, repository) => {
184
184
  return sender
185
185
  }
186
186
 
187
- // FIX: pontasockets sebelumnya gak pernah menyimpan mapping LID<->PN saat pesan
187
+ // FIX: pontalabs sebelumnya gak pernah menyimpan mapping LID<->PN saat pesan
188
188
  // masuk (levvleys punya storeMappingFromEnvelope, di sini gak ada). Akibatnya
189
189
  // untuk kontak yang pakai addressing LID, getDecryptionJid bisa gagal nemuin
190
190
  // sesi yang benar secara intermiten (tergantung cache mapping ada atau belum),
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * rich-message-utils.js
5
- * @pontasockets-baileys
5
+ * @pontalabs-baileys
6
6
  * Tambahkan file ini ke: node_modules/@whiskeysockets/baileys/lib/Utils/rich-message-utils.js
7
7
  */
8
8
 
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  console.log([
3
3
  '',
4
- ' \x1b[36m»\x1b[0m \x1b[1m\x1b[97m@pontasockets/baileys\x1b[0m \x1b[36m«\x1b[0m',
4
+ ' \x1b[36m»\x1b[0m \x1b[1m\x1b[97m@pontalabs/baileys\x1b[0m \x1b[36m«\x1b[0m',
5
5
  ' \x1b[35m🔥\x1b[0m \x1b[33mTerimakasih sudah memakai baileys ini >.<\x1b[0m',
6
6
  '',
7
7
  ].join('\n'))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pontalabs/baileys",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "PontaLabs Baileys is a lightweight, modern, and customizable WhatsApp Web API library built on Baileys.",
5
5
  "keywords": [
6
6
  "facebook",
@@ -17,7 +17,7 @@
17
17
  "url": "git+ssh://git@github.com/pontalabs/baileys.git"
18
18
  },
19
19
  "license": "MIT",
20
- "author": "PontaLabs",
20
+ "author": "Pontalabs",
21
21
  "main": "lib/index.js",
22
22
  "types": "lib/index.d.ts",
23
23
  "files": [
@@ -25,12 +25,14 @@
25
25
  "WAProto/**/*"
26
26
  ],
27
27
  "scripts": {
28
- "test": "jest"
28
+ "test": "jest",
29
+ "format": "prettier --write \"src/**/*.{ts,js,json,md}\"",
30
+ "lint": "tsc && eslint src --ext .js,.ts",
31
+ "lint:fix": "npm run format && npm run lint -- --fix"
29
32
  },
30
33
  "dependencies": {
31
34
  "@adiwajshing/keyed-db": "^0.2.4",
32
35
  "@cacheable/node-cache": "1.5.3",
33
- "@pontasockets/eslint-config": "^1.0.0",
34
36
  "libsignal": "^6.0.0",
35
37
  "@hapi/boom": "^9.1.3",
36
38
  "async-mutex": "^0.5.0",
@@ -48,16 +50,24 @@
48
50
  "ws": "^8.13.0"
49
51
  },
50
52
  "devDependencies": {
53
+ "@eslint/eslintrc": "^3.3.1",
54
+ "@eslint/js": "^9.31.0",
51
55
  "@types/jest": "^29.5.14",
52
56
  "@types/node": "^16.0.0",
53
57
  "@types/ws": "^8.0.0",
58
+ "@typescript-eslint/eslint-plugin": "^8",
59
+ "@typescript-eslint/parser": "^8",
60
+ "@whiskeysockets/eslint-config": "^1.0.0",
54
61
  "conventional-changelog-cli": "^2.2.2",
55
- "eslint": "^8.0.0",
62
+ "eslint": "^9",
63
+ "eslint-config-prettier": "^10.1.2",
64
+ "eslint-plugin-prettier": "^5.4.0",
56
65
  "jest": "^30.1.1",
57
66
  "jimp": "^1.6.1",
58
67
  "json": "^11.0.0",
59
68
  "link-preview-js": "^3.0.5",
60
69
  "open": "^8.4.2",
70
+ "prettier": "^3.5.3",
61
71
  "release-it": "^15.10.3",
62
72
  "ts-jest": "^29.4.1",
63
73
  "ts-node": "^10.8.1",