v1.0.0-alpha.7
This release introduces the new insert() method with full SurrealDB INSERT statement support, and improves CLI reliability.
✨ Features
Section titled “✨ Features”INSERT Statement Support
Section titled “INSERT Statement Support”A new type-safe insert() method that provides full access to SurrealDB’s INSERT statement capabilities:
import { surql } from 'surrealdb';
// Single insert (explicit db)const user = await User.insert(db, { data: { name: 'John', email: 'john@example.com' },});
// Bulk insert (implicit db)const users = await User.insert({ data: [ { name: 'John', email: 'john@example.com' }, { name: 'Jane', email: 'jane@example.com' }, ],});
// With custom ID (must be RecordId type)const user = await User.insert(db, { data: { id: new RecordId('user', 'john'), name: 'John' },});
// INSERT IGNORE - silently skip duplicatesawait User.insert(db, { data: { id: existingId, name: 'John' }, ignore: true,});
// ON DUPLICATE KEY UPDATE with native SurrealQLawait User.insert(db, { data: { id: existingId, name: 'John', visits: 0 }, onDuplicate: surql`visits += 1, lastSeen = time::now()`,});
// Custom RETURN clause with native SurrealQLconst result = await User.insert(db, { data: { name: 'John', email: 'john@example.com' }, return: surql`id, name, email`,});
// Insert relation (auto-detected for relation tables)await Follows.insert(db, { data: { in: userId, out: targetId, createdAt: new Date() },});🔧 Improvements
Section titled “🔧 Improvements”CLI Improvements
Section titled “CLI Improvements”--no-countOption: Added--no-countflag to theviewcommand to skip fetching table record counts, improving performance for large databases.- Version Detection: Improved CLI version detection to work correctly when installed globally from npm.
- Version Check: Changed default npm dist-tag from
alphatolatestfor update checks.
🐛 Bug Fixes
Section titled “🐛 Bug Fixes”- Fixed CLI package.json not being included in published package, which caused version detection to fail.
📦 Package Updates
Section titled “📦 Package Updates”| Package | Version |
|---|---|
unreal-orm | 1.0.0-alpha.6 → 1.0.0-alpha.7 |
@unreal-orm/cli | 1.0.0-alpha.6 → 1.0.0-alpha.7 |