@aunucore/baileys 1.0.74 โ 1.0.75
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 +1 -2
- package/lib/Socket/index.js +21 -1
- package/lib/Types/Auth.d.ts +2 -2
- package/lib/Utils/auth-utils.js +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -128,10 +128,9 @@ Everything else is the upstream core. The patch layer stays small and deliberate
|
|
|
128
128
|
|
|
129
129
|
### ๐ฐ Recent releases
|
|
130
130
|
|
|
131
|
+
- **1.0.75 โ Partial-config safety + watchdog cleanup.** A partial `transactionOpts` in the socket config can no longer kill every key-store transaction: the config is deep-merged over the defaults and the transaction layer falls back per-field (`maxCommitRetries` 10, `delayBetweenTriesMs` 3000, retries clamped to at least 1 so an explicit `0` means exactly one attempt) โ previously the shallow config spread replaced the whole default object, `maxCommitRetries` came out `undefined`, and every transaction threw `failed to commit transaction mutations` without a single commit attempt. The session watchdog's interval is now stopped when the socket ends (its `stop()` existed but was never called anywhere), closing a one-timer-and-socket-graph leak per reconnect cycle.
|
|
131
132
|
- **1.0.74 โ Fix-all batch.** The entire 1.0.74 heartbeat queue, closed in one version: `resyncAppState` can no longer spin forever holding the key-store transaction mutex (server-omitted collections finish with a warning, plus a 25-round cap), `startByte`-only media downloads no longer silently return an empty stream, an all-failed sticker pack throws Boom 400 instead of uploading empty, key-material guards now check TYPES (Buffer/string only) at six sites so wrong-typed creds fail descriptively instead of as raw TypeErrors, the noise handshake guards a missing `noiseKey` up front, the pre-login `creds.me` dereference family is closed (acks for `<unavailable>` stanzas survive fresh pairing), and two per-entity maps (`RateLimiter.hits`, bug-guard `recentBySender`) evict stale keys with a lazy sweep.
|
|
132
133
|
- **1.0.73 โ Heartbeat queue + a new README.** Three verified heartbeat fixes: a corrupt frame header can no longer wedge `decodeFrame` (zero-length headers are skipped, frames over 10 MiB fail loudly instead of buffering forever), `botRecentSecretsByChat` is capped at 1,000 chats FIFO, and bare key-store writes are serialized through the transaction mutex so a `migrateSession` commit can't overwrite a fresher session record. Plus a fully rewritten README and 46 curated npm keywords.
|
|
133
|
-
- **1.0.72 โ Send integrity.** Fixes a critical regression in 1.0.71 that made `sendMessage` relay an empty message, plus auditor-verified fixes: media-cache contamination, sent-message cache LID/PN resolution, newsletter media stanza typing, USync backoff wired with a 60s clamp, and a 30-item heartbeat sweep (HB-61โฆHB-90).
|
|
134
|
-
|
|
135
134
|
Full changelog for every version since 1.0.2: **[docs](https://docsjs.aunucore.eu.cc)** ยท **[GitHub Releases](https://github.com/AunuCore/AunuBaileys-lib/releases)**.
|
|
136
135
|
|
|
137
136
|
### ๐ Credits
|
package/lib/Socket/index.js
CHANGED
|
@@ -16,6 +16,15 @@ const makeWASocket = (config) => {
|
|
|
16
16
|
...DEFAULT_CONNECTION_CONFIG,
|
|
17
17
|
...config
|
|
18
18
|
};
|
|
19
|
+
// AunuBaileys (1.0.75, HB-104): transactionOpts is merged per-field โ
|
|
20
|
+
// the shallow spread above replaced the whole default object, so a
|
|
21
|
+
// host passing a PARTIAL transactionOpts silently lost the other
|
|
22
|
+
// field's default (and, before the auth-utils fallback, every
|
|
23
|
+
// key-store commit with it).
|
|
24
|
+
newConfig.transactionOpts = {
|
|
25
|
+
...DEFAULT_CONNECTION_CONFIG.transactionOpts,
|
|
26
|
+
...(config?.transactionOpts ?? {})
|
|
27
|
+
};
|
|
19
28
|
// If the user hasn't provided their own history sync function,
|
|
20
29
|
// let's create a default one that respects the syncFullHistory flag.
|
|
21
30
|
if (config.shouldSyncHistoryMessage === undefined) {
|
|
@@ -30,7 +39,18 @@ const makeWASocket = (config) => {
|
|
|
30
39
|
// config.sessionWatchdog (object = options, true = defaults).
|
|
31
40
|
// It only reports; it never reconnects.
|
|
32
41
|
if (newConfig.sessionWatchdog) {
|
|
33
|
-
|
|
42
|
+
const watchdog = attachSessionWatchdog(sock, newConfig.sessionWatchdog === true ? undefined : newConfig.sessionWatchdog);
|
|
43
|
+
sock.aunuSessionWatchdog = watchdog;
|
|
44
|
+
// AunuBaileys (1.0.75, HB-105): stop() existed but was never
|
|
45
|
+
// called anywhere in the lib โ the interval is unref'd yet its
|
|
46
|
+
// closure holds ev + sock, so every ended socket with the
|
|
47
|
+
// watchdog enabled leaked one 30s timer and its whole socket
|
|
48
|
+
// graph for the life of the process, one per reconnect cycle.
|
|
49
|
+
// Register stop() as a socket-end handler, the same pattern as
|
|
50
|
+
// stopOfflineDrain (HB-66). stop() is idempotent (safe on the
|
|
51
|
+
// double-end path), and sockets without a watchdog never reach
|
|
52
|
+
// this branch.
|
|
53
|
+
sock.registerSocketEndHandler?.(() => watchdog.stop());
|
|
34
54
|
}
|
|
35
55
|
sock.aunuHandler = new AunuHandler(sock);
|
|
36
56
|
attachAunuAutoJoin(sock, newConfig);
|
package/lib/Types/Auth.d.ts
CHANGED
|
@@ -89,8 +89,8 @@ export type SignalKeyStoreWithTransaction = SignalKeyStore & {
|
|
|
89
89
|
transaction<T>(exec: () => Promise<T>): Promise<T>;
|
|
90
90
|
};
|
|
91
91
|
export type TransactionCapabilityOptions = {
|
|
92
|
-
maxCommitRetries
|
|
93
|
-
delayBetweenTriesMs
|
|
92
|
+
maxCommitRetries?: number;
|
|
93
|
+
delayBetweenTriesMs?: number;
|
|
94
94
|
};
|
|
95
95
|
export type SignalAuthState = {
|
|
96
96
|
creds: SignalCreds;
|
package/lib/Utils/auth-utils.js
CHANGED
|
@@ -87,7 +87,17 @@ export function makeCacheableSignalKeyStore(store, logger, _cache) {
|
|
|
87
87
|
* @param logger logger to log events
|
|
88
88
|
* @returns SignalKeyStore with transaction capability
|
|
89
89
|
*/
|
|
90
|
-
export const addTransactionCapability = (state, logger, { maxCommitRetries, delayBetweenTriesMs }) => {
|
|
90
|
+
export const addTransactionCapability = (state, logger, { maxCommitRetries, delayBetweenTriesMs } = {}) => {
|
|
91
|
+
// AunuBaileys (1.0.75, HB-104): a partial transactionOpts from the
|
|
92
|
+
// host (makeWASocket's shallow spread used to replace the whole
|
|
93
|
+
// default object) left maxCommitRetries undefined, so the commit
|
|
94
|
+
// loop below never ran even once and EVERY mutating transaction
|
|
95
|
+
// threw 'failed to commit transaction mutations' without a single
|
|
96
|
+
// commit attempt. Fall back per-field to the Defaults values, and
|
|
97
|
+
// clamp retries to at least 1 so an explicit 0 means exactly one
|
|
98
|
+
// attempt, matching host intent.
|
|
99
|
+
const commitRetries = Math.max(1, maxCommitRetries ?? 10);
|
|
100
|
+
const commitDelayMs = delayBetweenTriesMs ?? 3000;
|
|
91
101
|
// number of queries made to the DB during the transaction
|
|
92
102
|
// only there for logging purposes
|
|
93
103
|
let dbQueriesInTransaction = 0;
|
|
@@ -116,7 +126,7 @@ export const addTransactionCapability = (state, logger, { maxCommitRetries, dela
|
|
|
116
126
|
logger.trace('committing transaction');
|
|
117
127
|
// retry mechanism to ensure we've some recovery
|
|
118
128
|
// in case a transaction fails in the first attempt
|
|
119
|
-
let tries =
|
|
129
|
+
let tries = commitRetries;
|
|
120
130
|
let committed = false;
|
|
121
131
|
let lastCommitError;
|
|
122
132
|
while (tries) {
|
|
@@ -131,7 +141,7 @@ export const addTransactionCapability = (state, logger, { maxCommitRetries, dela
|
|
|
131
141
|
catch (error) {
|
|
132
142
|
lastCommitError = error;
|
|
133
143
|
logger.warn(`failed to commit ${Object.keys(mutations).length} mutations, tries left=${tries}`);
|
|
134
|
-
await delay(
|
|
144
|
+
await delay(commitDelayMs);
|
|
135
145
|
}
|
|
136
146
|
}
|
|
137
147
|
if (!committed) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aunucore/baileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.75",
|
|
5
5
|
"description": "AunuBaileys โ the self-healing WhatsApp Web API for Node.js. Bad MAC and \"2000 messages into the future\" errors repair themselves, LID and phone-number identities stay in sync, anti-ban is built in, pairing codes are custom โ plus 29 experimental features no other Baileys fork ships: invisible watermarks, per-person tag-all cards, side-profile text, ghost mentions and more. ESM, CJS and full TypeScript types.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|