Releases: r-el/json-file-crud
Releases · r-el/json-file-crud
v1.3.0 - Promise/Async API Support
New Features
Promise/Async API Support
- Full async/await support - All CRUD methods now have Promise-based counterparts
- Backward compatible - Original callback API remains unchanged
- TypeScript integration - Updated type definitions for all async methods
New Methods
createAsync(),readAllAsync(),findByIdAsync()findByAsync(),countAsync(),updateAsync()deleteAsync(),deleteAllAsync(),writeAllAsync()
Examples
// New async API
const user = await db.createAsync({ name: 'John', age: 30 });
const users = await db.readAllAsync();
await db.updateAsync(user.id, { age: 31 });
await db.deleteAsync(user.id);
// Original callback API still works
db.create({ name: 'Jane' }, (err, user) => {
console.log('Created:', user);
});Installation
npm install json-file-crudBreaking Changes
None - this release is fully backward compatible.
v1.2.0 - TypeScript Support & npm Publishing
🎉 New Features
Added
- TypeScript Definitions - Full TypeScript support with bundled
lib/json-file-crud.d.tsfor IDE support - npm Publishing - Now published to npm public registry instead of GitHub Packages
Changed
- Package name changed from
@r-el/json-file-crudtojson-file-crudfor public npm access - Removed GitHub Packages registry configuration
Installation
npm install json-file-crudTypeScript Usage
import JsonFileCRUD from 'json-file-crud';
const db = new JsonFileCRUD<User>('./users.json');Thanks to @InonGuetta for contributing the TypeScript definitions! ��
Version 1.1.0 - Advanced Feature
🚀 What's New in v1.1.0
✨ New Features
- Unique Fields Support - Prevent duplicate values in specified fields
- Auto-ID Toggle - Control automatic ID assignment with
autoIdoption - deleteAll Method - Remove all items with a single command
- createCrud Convenience Function - Quick CRUD instance creation
- Automatic Directory Creation - Creates parent directories automatically
🔧 Enhanced Features
- Test Suite Reorganization - Split tests into logical files (37 tests total)
- GitHub Packages Support - Now published to both npm and GitHub Packages
- Improved Configuration - Enhanced constructor options with backward compatibility
📦 Installation
From npm:
npm install json-file-crudFrom GitHub Packages:
npm install @r-el/json-file-crud --registry=https://npm.pkg.github.com🔄 Upgrade Notes
- All changes are backward compatible
- No breaking changes to existing API
- New features are opt-in via configuration
See CHANGELOG.md for detailed changes.
Full Changelog: v1.0.0...v1.1.0
v1.0.0
Changelog
[1.0.0] - 2025-07-07
Added
- Initial release of JsonFileCRUD
- Complete CRUD operations (Create, Read, Update, Delete)
- Auto-ID assignment with duplicate prevention
- Configurable ID fields (default: 'id')
- Thread-safe operations with automatic queuing
- Comprehensive error handling and validation
- Zero external dependencies
- Full ESM (ES modules) support
- Comprehensive test suite with 35 tests
- Practical usage examples:
- Basic CRUD operations
- Advanced features with concurrent operations
- User management system example
- Complete API documentation
- Contributing guidelines with improvement ideas
Features
- create(item, callback) - Create new items with auto-ID
- readAll(callback) - Read all items from file
- findById(id, callback) - Find item by ID
- findBy(filterFn, callback) - Find items by custom filter
- update(id, data, callback) - Update existing items
- delete(id, callback) - Delete items by ID
- count(callback) - Get total item count
- writeAll(items, callback) - Replace all data
Performance
- Optimized for small to medium datasets (up to ~10,000 items)
- Sequential operations prevent race conditions
- Automatic file creation on first write
- Memory-efficient data handling
Documentation
- Complete README with API reference
- Multiple practical examples
- Error handling guide
- Performance considerations
- Contributing guidelines
[Unreleased]
Future Improvements
- TypeScript support with .d.ts files
- Promise-based API (async/await)
- Batch operations (createMany, updateMany, deleteMany)
- File locking for multi-process safety
- Enhanced documentation and examples
What's Changed
- feature/read functionality by @r-el in #1
- feature/create functionality by @r-el in #2
- feature/update functionality by @r-el in #3
- feature/delete functionality by @r-el in #4
- refactor/improve code by @r-el in #5
- feature/advanced create by @r-el in #6
- feature/examples and docs by @r-el in #7
- feature/prepare for npm by @r-el in #8
New Contributors
Full Changelog: https://github.com/r-el/json-file-crud/commits/v1.0.0