@developers-joyride/shortify
Version:
High performance URL shortener library with multi-database support (MongoDB, SQLite, PostgreSQL, MySQL)
116 lines (79 loc) • 5.98 kB
Markdown
# Changelog
All notable changes to this project 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.1.0] - 2025-01-27
### Fixed
- **Collection/table name case preservation**: Fixed issue where collection and table names were being converted to lowercase instead of preserving the exact case specified.
- **MongoDB**: Fixed Mongoose model creation to preserve collection name case using explicit collection name parameter
- **SQLite**: Added proper quoting of table names in all SQL queries to preserve case
- **PostgreSQL**: Added proper quoting of table names in all SQL queries to preserve case
- **MySQL**: Added proper backtick quoting of table names in all SQL queries to preserve case
- **URL ID uniqueness logic**: Fixed issue where the system was checking for existing original URLs and returning the same URL ID. Now only checks for URL ID uniqueness and generates new IDs for each request.
- Each `shorten()` call now generates a unique URL ID, even for the same original URL
- Multiple shortened URLs can exist for the same original URL
- Custom URL ID conflicts are handled gracefully by generating new IDs
### Added
- **Comprehensive testing**: Added new test suites to verify collection name preservation and URL ID uniqueness across all database engines
- **Documentation updates**: Updated README to reflect the new behavior and document the fixes
- **Examples**: Added examples demonstrating both fixes in action
### Changed
- **URL ID generation behavior**: Changed from returning existing URL IDs for duplicate original URLs to always generating unique URL IDs
- **Collection/table name handling**: All database engines now preserve the exact case and formatting of collection/table names as specified
## [2.0.4] - 2025-07-01
### Added
- **Custom collection/table name support**: Added `collectionName` parameter for MongoDB and `tableName` parameter for SQLite, PostgreSQL, and MySQL to allow users to specify custom collection/table names instead of using the default "urls" collection/table.
- **Backward compatibility**: Both parameters are optional and default to "urls" when not specified.
- **Documentation**: Updated README with custom collection/table name examples and API documentation for all database types.
- **Custom collection example**: Added comprehensive `custom-collection-example.ts` demonstrating how to use different collection names for MongoDB.
- **Custom table names example**: Added comprehensive `custom-table-names-example.ts` demonstrating how to use different table names for SQLite, PostgreSQL, and MySQL.
### Changed
- **Default collection/table name**: Changed default collection/table name from "Url" to "urls" for better naming consistency across all database types.
- **MongoDB adapter**: Updated to support dynamic collection names through the `createUrlModel` function.
- **SQLite adapter**: Updated to support dynamic table names in all SQL queries and index creation.
- **PostgreSQL adapter**: Updated to support dynamic table names in all SQL queries and index creation.
- **MySQL adapter**: Updated to support dynamic table names in all SQL queries and index creation.
## [2.0.2] - 2025-07-01
### Added
- **PostgreSQL adapter**: Added full PostgreSQL support via the `pg` package, including connection pooling, table creation, and indexing.
- **Documentation**: Updated README with PostgreSQL usage example and configuration instructions.
- **PostgreSQL example**: Added comprehensive `postgresql-example.ts` demonstrating all features with PostgreSQL.
## [2.0.1] - 2025-07-01
### Added
- **MySQL adapter**: Added full MySQL support via the `mysql2` package, including connection pooling, table creation, and indexing.
- **Documentation**: Updated README with MySQL usage example and configuration instructions.
- **Click tracking example**: Added comprehensive `click-tracking-example.ts` demonstrating analytics, statistics, and performance comparison features.
### Fixed
- Minor documentation clarifications for multi-database usage.
## [2.0.0] - 2025-07-01
### Added
- **Multi-database support**: Added support for SQLite, PostgreSQL, and MySQL databases
- **Database abstraction layer**: New `IDatabaseAdapter` interface for database operations
- **Database factory**: `DatabaseFactory` class to create database adapters based on configuration
- **SQLite adapter**: Full implementation with automatic table creation and indexing
- **MongoDB adapter**: Refactored existing MongoDB functionality into adapter pattern
- **Backward compatibility**: `Shortify.createWithMongo()` static method for existing MongoDB users
- **New configuration format**: `DatabaseConfig` interface for flexible database configuration
- **Enhanced error handling**: Better error messages for database configuration issues
### Changed
- **Breaking change**: Constructor now requires `DatabaseConfig` instead of MongoDB URI
- **Refactored architecture**: Separated database logic from business logic
- **Updated API**: All database operations now go through the adapter interface
- **Improved documentation**: Added comprehensive examples for all database types
### Deprecated
- **Old constructor**: Direct constructor with MongoDB URI is deprecated in favor of `createWithMongo()`
### Removed
- **Direct MongoDB coupling**: Removed tight coupling to Mongoose in the main service
### Fixed
- **Type safety**: Improved TypeScript types throughout the codebase
- **Error handling**: Better error messages and handling for database operations
## [1.0.0] - 2025-06-28
### Added
- Initial release with MongoDB support
- URL shortening and resolution functionality
- Click tracking and analytics
- URL expiration support
- Custom URL ID support
- Automatic retry with exponential backoff
- TypeScript support
- Comprehensive test suite