Releases: ducktors/valkeyrie
v0.8.4
v0.8.3
v0.8.2
v0.8.1
v0.8.0
Minor Changes
-
ef32a4b: feat: add
fromandfromAsyncfactory functions for database populationThis adds two new static factory methods to create and populate Valkeyrie databases from existing data sources:
Valkeyrie.from(iterable, options)- Create and populate a database from synchronous iterables (arrays, Sets, Maps, custom iterables)Valkeyrie.fromAsync(asyncIterable, options)- Create and populate a database from async iterables (async generators, streams, async iterators)
Key Features:
- Flexible key extraction via property names or custom functions
- Automatic batching (1000 items per atomic operation) for optimal performance
- Progress tracking with optional callbacks
- Configurable error handling (stop or continue on errors)
- Support for all database options (TTL, custom serializers, file paths, etc.)
- Memory efficient processing for large datasets
Example:
const users = [ { id: 1, name: "Alice" }, { id: 2, name: "Bob" }, ]; const db = await Valkeyrie.from(users, { prefix: ["users"], keyProperty: "id", onProgress: (processed, total) => console.log(`${processed}/${total}`), });
This is especially useful for data migrations, imports, seeding databases, and creating databases from API responses or streams.
Patch Changes
-
1893805: Complete documentation overhaul with new structure and missing feature documentation
New Documentation Structure:
- Split monolithic docs into focused guides and API reference
- Created beginner-friendly getting started guide
- Added comprehensive guides for schema validation, factory methods, serializers, and advanced patterns
- Complete API reference with all methods and types
Previously Missing Documentation:
- Watch API - Complete documentation for real-time key monitoring (added in v0.5.0)
- Type Inference - Automatic TypeScript type inference from schemas
- Multi-instance Concurrency - Database-level versionstamp generation improvements (v0.7.2)
- Symbol.asyncDispose - Automatic resource management support
New Guides:
docs/guides/getting-started.md- Complete beginner tutorialdocs/guides/schema-validation.md- Type-safe operations with Zod, Valibot, ArkTypedocs/guides/factory-methods.md- Create databases from arrays and streamsdocs/guides/serializers.md- Choose and configure serializersdocs/guides/advanced-patterns.md- Watch API, atomic operations, real-world patterns
API Reference:
docs/api/api-reference.md- Complete method referencedocs/api/types.md- TypeScript types and interfaces
Improvements:
- Clear navigation with
docs/README.mdindex - Real-world examples throughout
- Decision trees for choosing options
- Migration guides from Deno.kv
- Troubleshooting sections
The old
docs/documentation.mdhas been archived asdocs/documentation.md.old. -
065368c: Implement database-level versionstamp generation for multi-instance concurrency and fix watch stream cancel bug
Multi-Instance Concurrency (fixes #64):
- Implement database-level sequence table for atomic versionstamp generation across multiple instances
- Replace process-local versionstamp generation with SQLite sequence-based approach
- Add proper transaction nesting support with
inTransactionstate tracking - Implement retry logic for versionstamp generation with exponential backoff
- Use
BEGIN IMMEDIATE TRANSACTIONfor exclusive database locks to ensure cross-process atomicity - Maintain 20-character versionstamp format (timestamp + sequence) for API compatibility
Bug Fix:
- Fix watch stream
cancel()callback to correctly use closure-scoped controller - Remove incorrect
controller.close()call in cancel handler (stream infrastructure handles this)
Test Coverage:
- Add test for concurrent versionstamp generation with multiple driver instances
- Add test for watch controller close errors with unexpected error types
- Add test for rollback failures in transaction retry logic
- Update watch cancellation test to properly test the cancel path
This prevents race conditions and lost updates when multiple Valkeyrie instances share the same SQLite database file.