@violetix/baileys 0.5.1 → 0.5.3
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/WAProto/index.d.ts +14596 -14040
- package/WAProto/index.js +88874 -58426
- package/lib/Socket/socket.js +13 -1
- package/package.json +4 -2
package/lib/Socket/socket.js
CHANGED
|
@@ -384,6 +384,15 @@ export const makeSocket = (config) => {
|
|
|
384
384
|
};
|
|
385
385
|
const ev = makeEventBuffer(logger);
|
|
386
386
|
const { creds } = authState;
|
|
387
|
+
/**
|
|
388
|
+
* Last identity this socket has been logged in as. `sock.user` is a getter over
|
|
389
|
+
* `authState.creds.me`, and hosts read it as `sock.user.id` with no optional chaining (the
|
|
390
|
+
* @neoxr/wb engine does exactly that in serialize() and in its JID() helper). One stanza that
|
|
391
|
+
* arrives while `creds.me` is momentarily absent therefore throws inside the host's event
|
|
392
|
+
* listener instead of being processed. Keeping the identity we already know turns that into a
|
|
393
|
+
* correct answer: a socket that is receiving stanzas is logged in as this user.
|
|
394
|
+
*/
|
|
395
|
+
let lastMe = creds.me;
|
|
387
396
|
// add transaction capability
|
|
388
397
|
const keys = addTransactionCapability(authState.keys, logger, transactionOpts);
|
|
389
398
|
const signalRepository = makeSignalRepository({ creds, keys }, logger, pnFromLIDUSync);
|
|
@@ -1317,6 +1326,9 @@ export const makeSocket = (config) => {
|
|
|
1317
1326
|
});
|
|
1318
1327
|
}
|
|
1319
1328
|
Object.assign(creds, update);
|
|
1329
|
+
if (creds.me) {
|
|
1330
|
+
lastMe = creds.me;
|
|
1331
|
+
}
|
|
1320
1332
|
});
|
|
1321
1333
|
const updateServerTimeOffset = ({ attrs }) => {
|
|
1322
1334
|
const tValue = attrs?.t;
|
|
@@ -1396,7 +1408,7 @@ export const makeSocket = (config) => {
|
|
|
1396
1408
|
authState: { creds, keys },
|
|
1397
1409
|
signalRepository,
|
|
1398
1410
|
get user() {
|
|
1399
|
-
return authState.creds.me;
|
|
1411
|
+
return authState.creds.me ?? lastMe;
|
|
1400
1412
|
},
|
|
1401
1413
|
/**
|
|
1402
1414
|
* True while the transport is repairing itself. A host that reads this does not build a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@violetix/baileys",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Enhanced Baileys v7 with fixes for newsletter media uploads, plus support for interactive messages, albums, and additional message types.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"test": "node --experimental-vm-modules --test",
|
|
11
11
|
"test:types": "tsc -p tests/types/tsconfig.json",
|
|
12
12
|
"check": "node scripts/check.mjs && npm run test:types && npm test",
|
|
13
|
-
"prepublishOnly": "npm run check"
|
|
13
|
+
"prepublishOnly": "npm run check",
|
|
14
|
+
"proto": "node scripts/generate-waproto.mjs"
|
|
14
15
|
},
|
|
15
16
|
"engines": {
|
|
16
17
|
"node": ">=20.0.0"
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
"packageManager": "yarn@4.9.2",
|
|
119
120
|
"devDependencies": {
|
|
120
121
|
"@types/node": "^20.19.43",
|
|
122
|
+
"protobufjs-cli": "^1.3.3",
|
|
121
123
|
"typescript": "^7.0.2"
|
|
122
124
|
}
|
|
123
125
|
}
|