@akson/chatsuite-sdk
Version:
Production-ready TypeScript SDK for ChatSuite - WhatsApp automation with built-in session management, message queuing, webhook server, and database sync
168 lines (134 loc) • 6.26 kB
Markdown
# Changelog
All notable changes to the ChatSuite SDK will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.0] - 2024-07-07
### 🚀 Major Release - Enhanced Production Features
This major release transforms the ChatSuite SDK from a basic API client into a production-ready automation platform with built-in infrastructure components. **Reduces implementation complexity from ~2000 lines to ~50 lines!**
### ✨ Added
#### 🗄️ Session Management Layer
- **SessionManager** class with pluggable storage backends
- **InMemorySessionStore** for development and testing
- **MongoSessionStore** for production persistence with MongoDB
- Auto-reconnection logic with configurable retry attempts
- QR code lifecycle management with automatic expiry
- Real-time session health monitoring and status tracking
- Comprehensive event emission for session state changes
#### 📬 Message Queue & Rate Limiting
- **MessageQueue** class with concurrent processing (configurable limits)
- Advanced retry logic (exponential, linear, fixed backoff)
- **RateLimiter** with memory and custom storage backends
- Priority-based message queuing system
- Bulk message operations with automatic scheduling
- Real-time queue statistics and throughput monitoring
- Per-session or global rate limiting strategies
#### 🔗 Webhook Server Integration
- **WebhookServer** with built-in Express server
- HMAC-SHA256 signature verification for security
- Automatic event routing to registered handlers
- Built-in CORS support and rate limiting
- Health check endpoints for load balancers
- Express middleware for existing applications
- Custom middleware support and extensibility
#### 💾 Database Sync Adapter
- **BaseDatabaseAdapter** abstract class for extensibility
- **MongoDBAdapter** with full MongoDB integration
- Flexible field mapping and data transformation
- Conflict resolution strategies (overwrite, merge, skip)
- Bulk operations with configurable batch sizes
- Automatic index creation for optimal performance
- Event-driven sync progress tracking
#### 🚀 Enhanced Client
- **EnhancedWhatsAppClient** integrating all new features
- Auto-initialization of all components
- Event propagation between components
- Graceful shutdown and cleanup procedures
- Component access methods for advanced usage
#### 🛠️ Helper Functions
- `createEnhancedClient()` - Quick setup with all features
- `createClient()` - Basic client instantiation
- `createMongoSessionStore()` - MongoDB session storage
- `createMongoDatabaseAdapter()` - Database synchronization
- `createRateLimiter()` - Custom rate limiting
### 🔧 Enhanced
#### TypeScript Support
- Complete type definitions for all new features
- Generic types for better type safety
- JSDoc documentation for all public APIs
- Strict TypeScript configuration
#### Error Handling
- **WhatsAppError** base class with error codes
- Specialized error classes (SessionError, AuthenticationError, etc.)
- **RateLimitError** with retry-after information
- Comprehensive error code constants
#### Testing
- **SessionManager.test.ts** - Session lifecycle testing
- **MessageQueue.test.ts** - Queue operations and retry logic
- **WebhookServer.test.ts** - Server functionality and events
- **EnhancedWhatsAppClient.test.ts** - Integration testing
- Mock implementations for isolated testing
### 📦 Dependencies
#### New Peer Dependencies (Optional)
- `mongodb@^6.0.0` - For MongoDB session storage and database sync
- `express@^4.18.0` - For webhook server functionality
### 📖 Documentation
- **README-ENHANCED.md** - Comprehensive guide to v2.0 features
- Complete migration guide from basic to enhanced client
- Production deployment guidelines and Docker examples
- Performance optimization tips and best practices
### 🎯 Performance Improvements
- **95% less boilerplate code** needed for production features
- **Built-in retry logic** with exponential backoff
- **Automatic reconnection** handling for sessions
- **Rate limiting** prevents API throttling
- **Concurrent processing** with configurable limits
- **Memory-efficient** queue management
### 🔄 Migration Notes
- **Fully backward compatible** - no breaking changes
- All v1.x code continues to work unchanged
- New features are opt-in through enhanced client
- Optional dependencies only needed for enhanced features
---
## [1.0.0] - 2024-06-01
### Added
- Initial release of WhatsApp Baileys SDK
- Session management (create, list, activate, deactivate, delete)
- Message sending (text, media, interactive, polls)
- Contact management (list, check registration, block/unblock)
- Group management (create, update, add/remove participants)
- Status/Story updates (post text/image/video, view, delete)
- Advanced features (reactions, edit, pin, star messages)
- Webhook support for real-time events
- Full TypeScript support with comprehensive type definitions
- Retry mechanism for failed requests
- Examples for basic and advanced usage
- Comprehensive test suite
---
## Version Comparison
| Feature | v1.0.0 | v2.0.0 |
|---------|--------|--------|
| Basic API Client | ✅ | ✅ |
| Session Management | Manual | 🚀 **Automatic + Persistence** |
| Message Queuing | ❌ | 🚀 **Built-in + Rate Limiting** |
| Webhook Server | External | 🚀 **Built-in Express Server** |
| Database Sync | Manual | 🚀 **Automatic MongoDB Sync** |
| Error Handling | Basic | 🚀 **Comprehensive + Retries** |
| Code Required | ~2000 lines | 🚀 **~50 lines** |
---
## Upgrade Guide
### From v1.x to v2.0
#### ✅ No Breaking Changes
All existing v1.x code continues to work unchanged in v2.0.
#### 🚀 Enhanced Features (Optional)
```typescript
// v1.x approach (still works)
import { WhatsAppClient } from '@akson/chatsuite-sdk';
const client = new WhatsAppClient({ apiToken: 'token' });
// v2.0 enhanced approach (recommended)
import { createEnhancedClient } from '@akson/chatsuite-sdk';
const client = createEnhancedClient({
apiToken: 'token',
mongoUri: 'mongodb://localhost:27017/whatsapp'
});
```
For detailed examples, see [README-ENHANCED.md](./README-ENHANCED.md).