Skip to content

Releases: r-el/json-file-crud

v1.3.0 - Promise/Async API Support

11 Sep 09:23
1bc9080

Choose a tag to compare

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-crud

Breaking Changes

None - this release is fully backward compatible.

v1.2.0 - TypeScript Support & npm Publishing

08 Jul 14:58
83d7cdd

Choose a tag to compare

🎉 New Features

Added

  • TypeScript Definitions - Full TypeScript support with bundled lib/json-file-crud.d.ts for IDE support
  • npm Publishing - Now published to npm public registry instead of GitHub Packages

Changed

  • Package name changed from @r-el/json-file-crud to json-file-crud for public npm access
  • Removed GitHub Packages registry configuration

Installation

npm install json-file-crud

TypeScript 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

07 Jul 13:38
fbc5747

Choose a tag to compare

🚀 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 autoId option
  • 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-crud

From 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

07 Jul 12:36
99e1494

Choose a tag to compare

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

  • @r-el made their first contribution in #1

Full Changelog: https://github.com/r-el/json-file-crud/commits/v1.0.0