@neelegirl/baileys 2.1.5 → 2.1.6
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 +434 -113
- package/lib/Signal/libsignal.d.ts +8 -3
- package/lib/Signal/libsignal.js +287 -79
- package/lib/Signal/lid-mapping.d.ts +23 -0
- package/lib/Signal/lid-mapping.js +277 -0
- package/lib/Socket/chats.js +3 -2
- package/lib/Types/Auth.d.ts +15 -2
- package/lib/Types/Contact.d.ts +2 -1
- package/lib/Types/Events.d.ts +4 -1
- package/lib/Types/Signal.d.ts +16 -1
- package/lib/Types/Socket.d.ts +10 -4
- package/lib/Utils/browser-utils.d.ts +1 -0
- package/lib/Utils/browser-utils.js +10 -0
- package/lib/Utils/history.d.ts +11 -4
- package/lib/Utils/history.js +77 -38
- package/lib/Utils/index.d.ts +4 -1
- package/lib/Utils/index.js +2 -1
- package/lib/Utils/process-message.d.ts +3 -2
- package/lib/Utils/process-message.js +28 -2
- package/lib/WABinary/jid-utils.d.ts +21 -4
- package/lib/WABinary/jid-utils.js +50 -8
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,215 +1,536 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
3
|
# @neelegirl/baileys
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### CommonJS WhatsApp Web runtime for Neelegirl projects
|
|
6
|
+
### Conservative merge strategy based on WhiskeySockets/Baileys
|
|
6
7
|
|
|
7
|
-
[](https://www.npmjs.com/package/@neelegirl/baileys)
|
|
9
|
+
[](https://nodejs.org)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://www.npmjs.com/package/@neelegirl/baileys)
|
|
12
|
+
[](https://github.com/WhiskeySockets/Baileys)
|
|
13
|
+
|
|
14
|
+
---
|
|
11
15
|
|
|
12
16
|
<p align="center">
|
|
13
|
-
<img src="https://files.catbox.moe/phppor.JPG" width="760" alt="
|
|
17
|
+
<img src="https://files.catbox.moe/phppor.JPG" width="760" alt="@neelegirl/baileys" />
|
|
14
18
|
</p>
|
|
15
19
|
|
|
16
|
-
|
|
|
20
|
+
| Package | Version | Main goal |
|
|
17
21
|
|---|---:|---|
|
|
18
|
-
| `@neelegirl/baileys` | `2.1.
|
|
22
|
+
| `@neelegirl/baileys` | `2.1.6` | Stable Neelegirl fork with preserved project-specific runtime behavior |
|
|
19
23
|
|
|
20
|
-
[Installation](#installation) · [Quickstart](#quickstart) · [
|
|
24
|
+
[Installation](#installation) · [Quickstart](#quickstart) · [Protected logic](#protected-logic) · [Device and LID notes](#device-and-lid-notes) · [Verified exports](#verified-exports) · [Release notes](#release-notes)
|
|
21
25
|
|
|
22
26
|
</div>
|
|
23
27
|
|
|
24
28
|
---
|
|
25
29
|
|
|
26
|
-
##
|
|
30
|
+
## Table of Contents
|
|
27
31
|
|
|
28
|
-
- [
|
|
32
|
+
- [Overview](#overview)
|
|
33
|
+
- [Why this fork exists](#why-this-fork-exists)
|
|
34
|
+
- [Protected logic](#protected-logic)
|
|
35
|
+
- [What was updated in 2.1.6](#what-was-updated-in-216)
|
|
29
36
|
- [Installation](#installation)
|
|
37
|
+
- [Imports](#imports)
|
|
30
38
|
- [Quickstart](#quickstart)
|
|
31
|
-
- [
|
|
32
|
-
- [
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
35
|
-
- [
|
|
36
|
-
- [
|
|
37
|
-
- [
|
|
39
|
+
- [Session storage](#session-storage)
|
|
40
|
+
- [Socket configuration notes](#socket-configuration-notes)
|
|
41
|
+
- [Messages and media](#messages-and-media)
|
|
42
|
+
- [Device and LID notes](#device-and-lid-notes)
|
|
43
|
+
- [Event notes](#event-notes)
|
|
44
|
+
- [Verified exports](#verified-exports)
|
|
45
|
+
- [Known limits](#known-limits)
|
|
46
|
+
- [Release notes](#release-notes)
|
|
47
|
+
- [Disclaimer](#disclaimer)
|
|
38
48
|
|
|
39
|
-
|
|
49
|
+
## Overview
|
|
40
50
|
|
|
41
|
-
|
|
51
|
+
`@neelegirl/baileys` is the local CommonJS-oriented Neelegirl fork of Baileys used in this stack. It is meant to keep existing Neelegirl-specific behavior stable while still absorbing compatible fixes from the public WhiskeySockets/Baileys project where that improves correctness.
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
This package was rechecked against the public WhiskeySockets/Baileys repository on `2026-03-19`. The merge strategy is conservative by design:
|
|
44
54
|
|
|
45
|
-
|
|
55
|
+
- keep working Neelegirl runtime behavior
|
|
56
|
+
- adopt compatible fixes
|
|
57
|
+
- avoid blind upstream replacement
|
|
58
|
+
- avoid destructive refactors in project-critical paths
|
|
46
59
|
|
|
47
|
-
|
|
48
|
-
- Message-ID-Signatur mit `NEELE` bleibt erhalten.
|
|
49
|
-
- LID/JID-bezogene Verarbeitung ist in den Socket/Signal-Pfaden aktiv.
|
|
50
|
-
- npm-Update-Check ist enthalten (bei QR-Flow, nur einmal pro Prozess).
|
|
51
|
-
- Aktuelle lokale WA-Web-Version: `[2, 3000, 1035194821]`.
|
|
60
|
+
## Why this fork exists
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
The local package differs from upstream for practical reasons:
|
|
63
|
+
|
|
64
|
+
| Area | Intent |
|
|
65
|
+
|---|---|
|
|
66
|
+
| Module format | Keep CommonJS entrypoints and local consumer compatibility |
|
|
67
|
+
| QR flow | Preserve the existing project-specific QR behavior |
|
|
68
|
+
| Message IDs | Preserve `NEELE`-specific message-ID behavior |
|
|
69
|
+
| Device mapping | Keep project-specific platform and device labeling logic |
|
|
70
|
+
| Logging and watch behavior | Avoid breaking existing Neelegirl operational workflows |
|
|
71
|
+
| LID and JID handling | Extend carefully where current Baileys behavior improves compatibility |
|
|
72
|
+
|
|
73
|
+
## Protected logic
|
|
74
|
+
|
|
75
|
+
The following logic was explicitly treated as protected during maintenance:
|
|
76
|
+
|
|
77
|
+
- QR-code generation and QR lifecycle
|
|
78
|
+
- `NEELE` message-ID generation and related custom handling
|
|
79
|
+
- existing Neelegirl branding and log output
|
|
80
|
+
- existing device, watch, and platform-specific behavior
|
|
81
|
+
- existing custom community and message-stub handling
|
|
82
|
+
- existing message-type behavior for conversation, extended text, media, and context handling
|
|
83
|
+
|
|
84
|
+
Nothing in those areas was blindly replaced with upstream code.
|
|
85
|
+
|
|
86
|
+
## What was updated in 2.1.6
|
|
87
|
+
|
|
88
|
+
### Runtime compatibility
|
|
89
|
+
|
|
90
|
+
- fixed the mismatch between `socket.js` expectations and the local Signal repository implementation
|
|
91
|
+
- added the missing runtime LID mapping store
|
|
92
|
+
- aligned session helpers required by the current local socket logic:
|
|
93
|
+
- `lidMapping`
|
|
94
|
+
- `validateSession`
|
|
95
|
+
- `deleteSession`
|
|
96
|
+
- `migrateSession`
|
|
97
|
+
|
|
98
|
+
### History and identity handling
|
|
99
|
+
|
|
100
|
+
- history sync processing now collects `phoneNumberToLidMappings`
|
|
101
|
+
- inline bootstrap payloads are handled
|
|
102
|
+
- LID migration sync messages are processed conservatively
|
|
103
|
+
- session migration can now follow PN to LID transitions more cleanly
|
|
104
|
+
|
|
105
|
+
### JID and device helpers
|
|
106
|
+
|
|
107
|
+
- restored and exposed helpers needed by newer Baileys compatibility work:
|
|
108
|
+
- `WAJIDDomains`
|
|
109
|
+
- `getServerFromDomainType`
|
|
110
|
+
- `isPnUser`
|
|
111
|
+
- `isJidMetaAI`
|
|
112
|
+
- `transferDevice`
|
|
113
|
+
- added a compatibility `browser-utils` re-export for `Browsers` and `getPlatformId`
|
|
114
|
+
|
|
115
|
+
### Typings and docs
|
|
116
|
+
|
|
117
|
+
- refreshed multiple `.d.ts` files to match the actual current runtime more closely
|
|
118
|
+
- removed false README claims from older documentation
|
|
119
|
+
- replaced stale README imagery with the requested current project image
|
|
54
120
|
|
|
55
121
|
## Installation
|
|
56
122
|
|
|
123
|
+
Use npm:
|
|
124
|
+
|
|
57
125
|
```bash
|
|
58
126
|
npm install @neelegirl/baileys
|
|
59
127
|
```
|
|
60
128
|
|
|
61
|
-
|
|
129
|
+
Use yarn:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
yarn add @neelegirl/baileys
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Runtime requirement:
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
Node.js >= 20
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Imports
|
|
142
|
+
|
|
143
|
+
CommonJS:
|
|
62
144
|
|
|
63
145
|
```js
|
|
64
|
-
|
|
146
|
+
const makeWASocket = require('@neelegirl/baileys').default
|
|
65
147
|
const {
|
|
66
|
-
default: makeWASocket,
|
|
67
|
-
useMultiFileAuthState,
|
|
68
|
-
fetchLatestBaileysVersion,
|
|
69
|
-
DisconnectReason,
|
|
70
148
|
Browsers,
|
|
149
|
+
DisconnectReason,
|
|
150
|
+
fetchLatestBaileysVersion,
|
|
151
|
+
useMultiFileAuthState
|
|
71
152
|
} = require('@neelegirl/baileys')
|
|
72
|
-
|
|
73
|
-
// ESM (namespace import auf CJS-Export)
|
|
74
|
-
import * as baileys from '@neelegirl/baileys'
|
|
75
153
|
```
|
|
76
154
|
|
|
77
|
-
|
|
155
|
+
ESM:
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
import makeWASocket, {
|
|
159
|
+
Browsers,
|
|
160
|
+
DisconnectReason,
|
|
161
|
+
fetchLatestBaileysVersion,
|
|
162
|
+
useMultiFileAuthState
|
|
163
|
+
} from '@neelegirl/baileys'
|
|
164
|
+
```
|
|
78
165
|
|
|
79
166
|
## Quickstart
|
|
80
167
|
|
|
168
|
+
### Start with QR
|
|
169
|
+
|
|
81
170
|
```js
|
|
171
|
+
const makeWASocket = require('@neelegirl/baileys').default
|
|
82
172
|
const {
|
|
83
|
-
default: makeWASocket,
|
|
84
|
-
useMultiFileAuthState,
|
|
85
|
-
fetchLatestBaileysVersion,
|
|
86
|
-
DisconnectReason,
|
|
87
173
|
Browsers,
|
|
174
|
+
DisconnectReason,
|
|
175
|
+
fetchLatestBaileysVersion,
|
|
176
|
+
useMultiFileAuthState
|
|
88
177
|
} = require('@neelegirl/baileys')
|
|
89
178
|
|
|
90
|
-
async function
|
|
179
|
+
async function start() {
|
|
91
180
|
const { state, saveCreds } = await useMultiFileAuthState('./auth_info')
|
|
92
181
|
const { version } = await fetchLatestBaileysVersion()
|
|
93
182
|
|
|
94
183
|
const sock = makeWASocket({
|
|
95
|
-
auth: state,
|
|
96
184
|
version,
|
|
97
|
-
|
|
98
|
-
browser: Browsers.ubuntu('
|
|
185
|
+
auth: state,
|
|
186
|
+
browser: Browsers.ubuntu('Neelegirl'),
|
|
187
|
+
printQRInTerminal: true
|
|
99
188
|
})
|
|
100
189
|
|
|
101
190
|
sock.ev.on('creds.update', saveCreds)
|
|
102
191
|
|
|
103
192
|
sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
|
|
193
|
+
if (connection === 'open') {
|
|
194
|
+
console.log('connected')
|
|
195
|
+
}
|
|
196
|
+
|
|
104
197
|
if (connection === 'close') {
|
|
105
198
|
const code = lastDisconnect?.error?.output?.statusCode
|
|
106
|
-
|
|
107
|
-
|
|
199
|
+
const shouldReconnect = code !== DisconnectReason.loggedOut
|
|
200
|
+
if (shouldReconnect) {
|
|
201
|
+
start()
|
|
108
202
|
}
|
|
109
|
-
return
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (connection === 'open') {
|
|
113
|
-
console.log('Connected to WhatsApp')
|
|
114
203
|
}
|
|
115
204
|
})
|
|
116
205
|
|
|
117
206
|
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
118
|
-
const msg = messages
|
|
119
|
-
const text =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
207
|
+
const msg = messages[0]
|
|
208
|
+
const text =
|
|
209
|
+
msg?.message?.conversation ||
|
|
210
|
+
msg?.message?.extendedTextMessage?.text ||
|
|
211
|
+
''
|
|
212
|
+
|
|
213
|
+
if (text.toLowerCase() === 'ping') {
|
|
214
|
+
await sock.sendMessage(msg.key.remoteJid, { text: 'pong' })
|
|
123
215
|
}
|
|
124
216
|
})
|
|
125
217
|
}
|
|
126
218
|
|
|
127
|
-
|
|
219
|
+
start().catch(console.error)
|
|
128
220
|
```
|
|
129
221
|
|
|
130
|
-
|
|
222
|
+
### Start with pairing code
|
|
131
223
|
|
|
132
|
-
|
|
224
|
+
```js
|
|
225
|
+
const makeWASocket = require('@neelegirl/baileys').default
|
|
226
|
+
const {
|
|
227
|
+
Browsers,
|
|
228
|
+
fetchLatestBaileysVersion,
|
|
229
|
+
useMultiFileAuthState
|
|
230
|
+
} = require('@neelegirl/baileys')
|
|
133
231
|
|
|
134
|
-
|
|
232
|
+
async function startPairing() {
|
|
233
|
+
const { state, saveCreds } = await useMultiFileAuthState('./auth_pairing')
|
|
234
|
+
const { version } = await fetchLatestBaileysVersion()
|
|
135
235
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
236
|
+
const sock = makeWASocket({
|
|
237
|
+
version,
|
|
238
|
+
auth: state,
|
|
239
|
+
browser: Browsers.windows('Neelegirl'),
|
|
240
|
+
printQRInTerminal: false
|
|
241
|
+
})
|
|
140
242
|
|
|
141
|
-
|
|
243
|
+
sock.ev.on('creds.update', saveCreds)
|
|
244
|
+
|
|
245
|
+
if (!sock.authState.creds.registered) {
|
|
246
|
+
const code = await sock.requestPairingCode('491234567890')
|
|
247
|
+
console.log('pairing code:', code)
|
|
248
|
+
}
|
|
249
|
+
}
|
|
142
250
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
- Reconnect-Steuerung erfolgt ueber Disconnect-Grund (`DisconnectReason`)
|
|
251
|
+
startPairing().catch(console.error)
|
|
252
|
+
```
|
|
146
253
|
|
|
147
|
-
|
|
254
|
+
## Session storage
|
|
148
255
|
|
|
149
|
-
|
|
150
|
-
- Signale/Keys laufen ueber die integrierten Signal-Utilities
|
|
256
|
+
For development, `useMultiFileAuthState(...)` is the easiest storage helper:
|
|
151
257
|
|
|
152
|
-
|
|
258
|
+
```js
|
|
259
|
+
const { state, saveCreds } = await useMultiFileAuthState('./auth_info')
|
|
260
|
+
```
|
|
153
261
|
|
|
154
|
-
|
|
155
|
-
- Gruppen-, Community-, Newsletter- und Store-Utilities sind enthalten
|
|
156
|
-
- LID/JID-Helfer (`jidDecode`, `jidEncode`, `isLidUser`) stehen ueber die Utility-Exports zur Verfuegung
|
|
262
|
+
The package also exports:
|
|
157
263
|
|
|
158
|
-
|
|
264
|
+
- `useSingleFileAuthState`
|
|
265
|
+
- `useMongoFileAuthState`
|
|
266
|
+
- `makeInMemoryStore`
|
|
159
267
|
|
|
160
|
-
|
|
268
|
+
If you build a custom store, the critical rule is simple:
|
|
161
269
|
|
|
162
|
-
|
|
270
|
+
- credential updates must be persisted
|
|
271
|
+
- key updates must be persisted
|
|
272
|
+
- ignoring key-store updates will eventually break message delivery
|
|
163
273
|
|
|
164
|
-
|
|
165
|
-
- Historische Hinweise wurden bereinigt, wenn sie veraltete Versionen nannten.
|
|
166
|
-
- Keine nicht nachweisbaren Features aufgenommen.
|
|
274
|
+
## Socket configuration notes
|
|
167
275
|
|
|
168
|
-
|
|
276
|
+
Useful socket options that remain especially relevant in this fork:
|
|
169
277
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
278
|
+
| Option | Why it matters |
|
|
279
|
+
|---|---|
|
|
280
|
+
| `auth` | required session state |
|
|
281
|
+
| `version` | WA Web version selection |
|
|
282
|
+
| `browser` | affects platform/device presentation |
|
|
283
|
+
| `printQRInTerminal` | keeps the existing QR path active |
|
|
284
|
+
| `markOnlineOnConnect` | controls online presence behavior |
|
|
285
|
+
| `syncFullHistory` | enables broader history sync requests |
|
|
286
|
+
| `getMessage` | improves retry and message recovery scenarios |
|
|
287
|
+
| `cachedGroupMetadata` | avoids repeated group fetches |
|
|
174
288
|
|
|
175
|
-
|
|
289
|
+
Example:
|
|
176
290
|
|
|
177
|
-
|
|
291
|
+
```js
|
|
292
|
+
const sock = makeWASocket({
|
|
293
|
+
version,
|
|
294
|
+
auth: state,
|
|
295
|
+
browser: Browsers.macOS('Desktop'),
|
|
296
|
+
printQRInTerminal: true,
|
|
297
|
+
markOnlineOnConnect: false,
|
|
298
|
+
syncFullHistory: true,
|
|
299
|
+
getMessage: async (key) => {
|
|
300
|
+
return store.loadMessage(key.remoteJid, key.id)
|
|
301
|
+
},
|
|
302
|
+
cachedGroupMetadata: async (jid) => groupCache.get(jid)
|
|
303
|
+
})
|
|
304
|
+
```
|
|
178
305
|
|
|
179
|
-
|
|
306
|
+
## Messages and media
|
|
180
307
|
|
|
181
|
-
|
|
308
|
+
### Send a text message
|
|
182
309
|
|
|
183
|
-
|
|
310
|
+
```js
|
|
311
|
+
await sock.sendMessage(jid, { text: 'hello' })
|
|
312
|
+
```
|
|
184
313
|
|
|
185
|
-
|
|
314
|
+
### Reply to a message
|
|
186
315
|
|
|
187
|
-
|
|
316
|
+
```js
|
|
317
|
+
await sock.sendMessage(
|
|
318
|
+
jid,
|
|
319
|
+
{ text: 'this is a reply' },
|
|
320
|
+
{ quoted: originalMessage }
|
|
321
|
+
)
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Send an image
|
|
188
325
|
|
|
189
|
-
|
|
326
|
+
```js
|
|
327
|
+
await sock.sendMessage(jid, {
|
|
328
|
+
image: { url: './image.jpg' },
|
|
329
|
+
caption: 'sample'
|
|
330
|
+
})
|
|
331
|
+
```
|
|
190
332
|
|
|
191
|
-
|
|
192
|
-
- CJS-fokussiert, nicht als 1:1-ESM-Upstream-Ersatz dokumentiert
|
|
193
|
-
- Die API ist auf bestehende Neelegirl-Consumer ausgerichtet
|
|
333
|
+
### Send a document
|
|
194
334
|
|
|
195
|
-
|
|
335
|
+
```js
|
|
336
|
+
await sock.sendMessage(jid, {
|
|
337
|
+
document: { url: './report.pdf' },
|
|
338
|
+
mimetype: 'application/pdf',
|
|
339
|
+
fileName: 'report.pdf'
|
|
340
|
+
})
|
|
341
|
+
```
|
|
196
342
|
|
|
197
|
-
|
|
343
|
+
### Send a reaction
|
|
198
344
|
|
|
199
|
-
|
|
345
|
+
```js
|
|
346
|
+
await sock.sendMessage(jid, {
|
|
347
|
+
react: {
|
|
348
|
+
text: '❤',
|
|
349
|
+
key: message.key
|
|
350
|
+
}
|
|
351
|
+
})
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Download received media
|
|
200
355
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
356
|
+
```js
|
|
357
|
+
const { downloadMediaMessage } = require('@neelegirl/baileys')
|
|
358
|
+
|
|
359
|
+
const buffer = await downloadMediaMessage(
|
|
360
|
+
message,
|
|
361
|
+
'buffer',
|
|
362
|
+
{},
|
|
363
|
+
{ logger: sock.logger, reuploadRequest: sock.updateMediaMessage }
|
|
364
|
+
)
|
|
365
|
+
```
|
|
205
366
|
|
|
206
|
-
|
|
367
|
+
## Device and LID notes
|
|
207
368
|
|
|
208
|
-
|
|
209
|
-
- Publish-Metadaten und CJS-Kompatibilitaet nachgezogen
|
|
369
|
+
This fork intentionally does more than just plain PN handling.
|
|
210
370
|
|
|
211
|
-
|
|
371
|
+
### Relevant helper exports
|
|
372
|
+
|
|
373
|
+
- `jidDecode`
|
|
374
|
+
- `jidEncode`
|
|
375
|
+
- `jidNormalizedUser`
|
|
376
|
+
- `isPnUser`
|
|
377
|
+
- `isLidUser`
|
|
378
|
+
- `isHostedPnUser`
|
|
379
|
+
- `isHostedLidUser`
|
|
380
|
+
- `transferDevice`
|
|
381
|
+
- `WAJIDDomains`
|
|
382
|
+
|
|
383
|
+
### Example: inspect a JID
|
|
384
|
+
|
|
385
|
+
```js
|
|
386
|
+
const { jidDecode } = require('@neelegirl/baileys')
|
|
387
|
+
|
|
388
|
+
const decoded = jidDecode('491234567890@s.whatsapp.net')
|
|
389
|
+
console.log(decoded)
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Example: preserve device while switching identity space
|
|
393
|
+
|
|
394
|
+
```js
|
|
395
|
+
const { transferDevice } = require('@neelegirl/baileys')
|
|
396
|
+
|
|
397
|
+
const result = transferDevice(
|
|
398
|
+
'491234567890:5@s.whatsapp.net',
|
|
399
|
+
'1234567890@lid'
|
|
400
|
+
)
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Why this matters here
|
|
404
|
+
|
|
405
|
+
Neelegirl-specific code in this package already relies on richer identity handling around:
|
|
406
|
+
|
|
407
|
+
- `remoteJid`
|
|
408
|
+
- `remoteJidAlt`
|
|
409
|
+
- `participant`
|
|
410
|
+
- `participantAlt`
|
|
411
|
+
- sender normalization
|
|
412
|
+
- PN and LID mapping
|
|
413
|
+
- device labeling output
|
|
414
|
+
|
|
415
|
+
That is why the maintenance work kept those paths intact and only extended compatibility where necessary.
|
|
416
|
+
|
|
417
|
+
## Event notes
|
|
418
|
+
|
|
419
|
+
Useful events in the current runtime:
|
|
420
|
+
|
|
421
|
+
### Connection lifecycle
|
|
422
|
+
|
|
423
|
+
- `connection.update`
|
|
424
|
+
- `creds.update`
|
|
425
|
+
|
|
426
|
+
### Message flow
|
|
427
|
+
|
|
428
|
+
- `messages.upsert`
|
|
429
|
+
- `messages.update`
|
|
430
|
+
- `messages.reaction`
|
|
431
|
+
- `message-receipt.update`
|
|
432
|
+
|
|
433
|
+
### History and metadata
|
|
434
|
+
|
|
435
|
+
- `messaging-history.set`
|
|
436
|
+
- `contacts.upsert`
|
|
437
|
+
- `contacts.update`
|
|
438
|
+
- `chats.update`
|
|
439
|
+
|
|
440
|
+
### Group and community related
|
|
441
|
+
|
|
442
|
+
- `groups.update`
|
|
443
|
+
- `group-participants.update`
|
|
444
|
+
- `group.join-request`
|
|
445
|
+
- `group.member-tag.update`
|
|
446
|
+
- `communities.update`
|
|
447
|
+
|
|
448
|
+
### Example
|
|
449
|
+
|
|
450
|
+
```js
|
|
451
|
+
sock.ev.on('messaging-history.set', ({ chats, contacts, messages, lidPnMappings }) => {
|
|
452
|
+
console.log({
|
|
453
|
+
chats: chats.length,
|
|
454
|
+
contacts: contacts.length,
|
|
455
|
+
messages: messages.length,
|
|
456
|
+
lidPnMappings: lidPnMappings?.length || 0
|
|
457
|
+
})
|
|
458
|
+
})
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## Verified exports
|
|
462
|
+
|
|
463
|
+
The following items were verified in the currently prepared package before publish.
|
|
464
|
+
|
|
465
|
+
### Socket and auth
|
|
466
|
+
|
|
467
|
+
- `makeWASocket`
|
|
468
|
+
- `useMultiFileAuthState`
|
|
469
|
+
- `useSingleFileAuthState`
|
|
470
|
+
- `useMongoFileAuthState`
|
|
471
|
+
- `makeInMemoryStore`
|
|
472
|
+
|
|
473
|
+
### Version and browser helpers
|
|
474
|
+
|
|
475
|
+
- `fetchLatestBaileysVersion`
|
|
476
|
+
- `fetchLatestWaWebVersion`
|
|
477
|
+
- `Browsers`
|
|
478
|
+
- `getPlatformId`
|
|
479
|
+
|
|
480
|
+
### JID and identity helpers
|
|
481
|
+
|
|
482
|
+
- `jidDecode`
|
|
483
|
+
- `jidEncode`
|
|
484
|
+
- `jidNormalizedUser`
|
|
485
|
+
- `isPnUser`
|
|
486
|
+
- `isLidUser`
|
|
487
|
+
- `isHostedPnUser`
|
|
488
|
+
- `isHostedLidUser`
|
|
489
|
+
- `isJidMetaAI`
|
|
490
|
+
- `transferDevice`
|
|
491
|
+
- `WAJIDDomains`
|
|
492
|
+
|
|
493
|
+
### Message and media helpers
|
|
494
|
+
|
|
495
|
+
- `downloadMediaMessage`
|
|
496
|
+
- `downloadAndProcessHistorySyncNotification`
|
|
497
|
+
- `processHistoryMessage`
|
|
498
|
+
- `getHistoryMsg`
|
|
499
|
+
- `getContentType`
|
|
500
|
+
- `normalizeMessageContent`
|
|
501
|
+
- `generateWAMessage`
|
|
502
|
+
- `generateWAMessageContent`
|
|
503
|
+
- `generateWAMessageFromContent`
|
|
504
|
+
|
|
505
|
+
### USync helpers
|
|
506
|
+
|
|
507
|
+
- `USyncQuery`
|
|
508
|
+
- `USyncUser`
|
|
509
|
+
- `USyncContactProtocol`
|
|
510
|
+
- `USyncLIDProtocol`
|
|
511
|
+
- `USyncDeviceProtocol`
|
|
512
|
+
- `USyncStatusProtocol`
|
|
513
|
+
|
|
514
|
+
## Known limits
|
|
515
|
+
|
|
516
|
+
- this package is not a direct one-to-one mirror of every newest upstream internal API
|
|
517
|
+
- no restrictive `exports` map was added because that would risk breaking existing CommonJS consumers
|
|
518
|
+
- some upstream files remain intentionally absent because the local Neelegirl fork structure differs by design
|
|
519
|
+
|
|
520
|
+
## Release notes
|
|
521
|
+
|
|
522
|
+
### 2.1.6
|
|
523
|
+
|
|
524
|
+
- restored runtime consistency between socket logic and Signal repository behavior
|
|
525
|
+
- added local LID mapping store support
|
|
526
|
+
- improved history sync processing for LID and PN mapping capture
|
|
527
|
+
- added current JID helper compatibility exports
|
|
528
|
+
- refreshed typings and README without touching protected QR and `NEELE` logic
|
|
529
|
+
|
|
530
|
+
### 2.1.5
|
|
531
|
+
|
|
532
|
+
- previous local package baseline before the current conservative maintenance pass
|
|
212
533
|
|
|
213
|
-
##
|
|
534
|
+
## Disclaimer
|
|
214
535
|
|
|
215
|
-
|
|
536
|
+
This project is not affiliated with WhatsApp. Use it responsibly. Do not use it for spam, stalking, or abusive automation.
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { SignalAuthState } from '../Types'
|
|
2
|
-
import {
|
|
1
|
+
import { LIDMapping, SignalAuthState } from '../Types'
|
|
2
|
+
import { SignalRepositoryWithLIDStore } from '../Types/Signal'
|
|
3
|
+
import type { ILogger } from '../Utils/logger'
|
|
3
4
|
|
|
4
|
-
export declare function makeLibSignalRepository(
|
|
5
|
+
export declare function makeLibSignalRepository(
|
|
6
|
+
auth: SignalAuthState,
|
|
7
|
+
logger: ILogger,
|
|
8
|
+
pnToLIDFunc?: (jids: string[]) => Promise<LIDMapping[] | undefined>
|
|
9
|
+
): SignalRepositoryWithLIDStore
|