v0.6.0
This release enhances the query builder with comprehensive SurrealDB clause support, improves query syntax ordering, and adds extensive test coverage for advanced query features.
✨ Features
Section titled “✨ Features”Query Builder Enhancements
Section titled “Query Builder Enhancements”-
Complete SurrealDB clause support: Added support for all modern SurrealDB query clauses:
WITH INDEXandWITH NOINDEXfor index controlSPLITclause for field splitting operationsTIMEOUTclause for query timeout specificationPARALLELclause for parallel query executionTEMPFILESclause for temporary file usageEXPLAINclause for query plan analysis
-
Query syntax ordering: Reordered
SelectQueryOptionsinterface properties to match SurrealDB’s official syntax order, improving developer experience and consistency. -
Enhanced ORDER BY support: Added support for
COLLATEandNUMERICoptions in ORDER BY clauses with correct syntax positioning.
🛠️ Fixes
Section titled “🛠️ Fixes”Query Builder
Section titled “Query Builder”-
Fixed ‘only’ clause positioning: Corrected a bug where the
ONLYclause was incorrectly positioned in the FROM clause and incorrectly parsed, ensuring proper single record query behavior. -
Fixed SurrealQL clause ordering: Corrected the order of
COLLATEandNUMERICmodifiers in ORDER BY clauses to appear before the sort direction (ASC/DESC), matching SurrealDB syntax requirements. -
Improved type safety: Enhanced type assertions and boolean coercion in query result processing to prevent type-related issues.
-
Query builder refactoring: Extracted query building logic into focused helper functions for better maintainability while preserving all functionality:
buildSelectFromClause()for SELECT/FROM logic and RecordId bindingbuildOrderByClause()for ORDER BY with collation/numeric optionsbuildQuery()for complete query assembly in correct SQL orderexecuteAndProcessQuery()for query execution and result processing
🧪 Tests
Section titled “🧪 Tests”-
Comprehensive test coverage: Added extensive test coverage for all new query options including WITH, SPLIT, TIMEOUT, PARALLEL, TEMPFILES, and EXPLAIN clauses.
-
Query debugging tests: Added isolated test cases to identify and document query execution issues, particularly with the PARALLEL clause.
-
Enhanced query validation: Improved test assertions and error handling for complex query combinations.
📚 Documentation
Section titled “📚 Documentation”-
Enhanced JSDoc: Updated function documentation to reflect new query capabilities and correct clause ordering.
-
Query examples: Added comprehensive examples demonstrating all supported SurrealDB query clauses and their proper usage.