c4da46321f
Cherry-pick from upstream PR #2264 (commit 5cbad317) with enhancements:
## Changes
### New Files
- `src/Utils/identity-change-handler.ts`: Centralized identity change handling
- Enterprise-grade JSDoc documentation
- Clear result types for all 9 possible outcomes
- Debouncing to prevent duplicate session refreshes
- Companion device filtering
- Offline notification handling
- `src/__tests__/Socket/identity-change-handling.test.ts`: Comprehensive tests
- Core functionality tests
- Debounce behavior tests
- Error handling tests
- Edge case coverage
### Modified Files
- `src/Socket/messages-recv.ts`: Updated error handling
- MISSING_KEYS_ERROR now returns NACK with ParsingError
- Maintains CTWA recovery logic intact
- Preserves all Prometheus metrics integration
- `src/Utils/generics.ts`: Added `isStringNullOrEmpty()` helper
- `src/Utils/index.ts`: Added identity-change-handler export
## Benefits
- Fixes "Online" status shown when actually disconnected (#2132)
- Better session management after contact identity changes
- Clear separation of concerns with dedicated handler module
Co-authored-by: João Lucas de Oliveira Lopes <55464917+jlucaso1@users.noreply.github.com>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
export * from './generics'
|
|
export * from './decode-wa-message'
|
|
export * from './messages'
|
|
export * from './messages-media'
|
|
export * from './validate-connection'
|
|
export * from './crypto'
|
|
export * from './signal'
|
|
export * from './noise-handler'
|
|
export * from './history'
|
|
export * from './chat-utils'
|
|
export * from './lt-hash'
|
|
export * from './auth-utils'
|
|
export * from './use-multi-file-auth-state'
|
|
export * from './link-preview'
|
|
export * from './event-buffer'
|
|
export * from './process-message'
|
|
export * from './message-retry-manager'
|
|
export * from './browser-utils'
|
|
|
|
// === Identity and Session Management ===
|
|
export * from './identity-change-handler'
|
|
|
|
// === Observability and Resilience Utilities ===
|
|
|
|
// Structured logging
|
|
export * from './structured-logger'
|
|
export * from './logger-adapter'
|
|
export * from './baileys-logger'
|
|
|
|
// Observability and tracing
|
|
export * from './trace-context'
|
|
export * from './prometheus-metrics'
|
|
|
|
// Resilience and performance
|
|
export * from './cache-utils'
|
|
export * from './circuit-breaker'
|
|
export * from './retry-utils'
|
|
|
|
// Version management
|
|
export * from './version-cache'
|
|
|
|
// Event streaming
|
|
export * from './baileys-event-stream'
|