## Summary
- Fixed TypeScript compilation errors that were preventing npm installation from git
## Changes
- **baileys-event-stream.ts**: Add null check for buffer item in priority insertion
- **baileys-logger.ts**: Handle 'silent' log level properly and fix JID sanitization with undefined checks
- **cache-utils.ts**: Fix type incompatibility in global cache by using `any` type for Map
- **logger-adapter.ts**: Add nullish coalescing for level mapping and fix console type casting
- **prometheus-metrics.ts**: Rename private `metrics` property to `metricsMap` to avoid conflict with `metrics()` method
- **trace-context.ts**: Store baggage header in variable before accessing to fix undefined check
## Test plan
- [x] `npm run build` completes successfully without TypeScript errors
- [x] Package can be installed via `npm i @whiskeysockets/baileys@git+https://github.com/rsalcara/InfiniteAPI.git#claude/fix-npm-dependency-kTdUe`
- baileys-event-stream.ts: Add null check for buffer item in priority insertion
- baileys-logger.ts: Handle 'silent' log level and fix JID sanitization
- cache-utils.ts: Fix type incompatibility in global cache with any type
- logger-adapter.ts: Add nullish coalescing for level mapping and fix console type cast
- prometheus-metrics.ts: Rename private 'metrics' property to 'metricsMap' to avoid conflict with method
- trace-context.ts: Store baggage header in variable before accessing to fix undefined check
- Translate all Portuguese comments to English in utility modules
- Enhance circuit-breaker.ts with sliding window failure tracking
- Add factory functions for WhatsApp-specific circuit breakers
(createPreKeyCircuitBreaker, createConnectionCircuitBreaker, createMessageCircuitBreaker)
- Improve volume threshold support for circuit breaker decisions
- Standardize documentation across all utility files
Files updated:
- structured-logger.ts: English comments
- baileys-logger.ts: English comments
- trace-context.ts: English comments
- prometheus-metrics.ts: English comments
- cache-utils.ts: English comments
- circuit-breaker.ts: Enhanced with sliding window + English comments
- retry-utils.ts: English comments
- baileys-event-stream.ts: English comments
- index.ts: English comments
* fix(proto-extract): regenerate corrupted yarn.lock to restore install process
* chore(proto-extract): update acorn parser to latest version for compatibility with new WhatsApp JS syntax
* Update baileys version to 2.3000.1029027441
* Update version number in Defaults index
* Revert WAProto.proto to resolve merge conflict and restore expected structure
---------
Co-authored-by: Vrypt <vryptt@gmail.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
* fix: ensure proper socket closure and await connection termination in tests
* feat(tests): enhance E2E tests for image and video message handling, including downloads and group interactions
* feat: add patch-tojson functionality for improved proto serialization
* Remove patch-tojson functionality and its import from the main index file to streamline the codebase.
* refactor: simplify longToString and longToNumber functions for better readability and performance
* fix: improve message resend logic by adding checks for message IDs
* Revert "fix: improve message resend logic by adding checks for message IDs"
This reverts commit c03f9d8e6fc6cbfbb9d1f8f67c169700e704213d.
* feat: add group member label update functionality and event emission
* feat: refactor updateMemberLabel function for improved readability
* feat: use optional chaining for label association message in processMessage
* feat: add updateMemberLabel to makeMessagesSocket for enhanced functionality
* fix: correct log message for group member tag update event
Co-authored-by: FgsiDev
* Memory leak in makeMutex - Promise never gets garbage collected
Hey, I've been debugging a memory leak in my application and traced it back to the makeMutex implementation.
The current implementation chains promises indefinitely without ever breaking the chain:
Every call to mutex() creates a new Promise that awaits the previous task, then becomes the new task. The problem is the old promises never get released because each one holds a reference to the previous through the closure.
What I found
Took a heap snapshot after running for a while and found hundreds of Promises from make-mutex.js holding ~15MB and growing. The retainer graph shows a long chain of Promises all pointing back to each other.
Since processingMutex handles every incoming message/notification, this chain grows constantly and never shrinks.
This keeps the same mutex behavior but lets the GC clean up old promises every 50 tasks instead of holding them forever.
* Refactor makeMutex to use AsyncMutex directly
* lint
* revert