Introducing JavaScript SDK 2.0
Blog post from SurrealDB
SurrealDB has launched the JavaScript SDK v2, marking a significant update aimed at enhancing developer ergonomics, flexibility, and experience. This update includes full compatibility with SurrealDB 3.0, multi-session support, automatic token refreshing, and a redesigned live query API. Additionally, a new query builder pattern simplifies data interactions, while the WebAssembly and Node.js SDKs have been integrated into the JavaScript SDK repository to ensure consistent updates. Notable features include support for running the WASM SDK inside a Web Worker, type-safe event listeners through surreal.subscribe(), and a diagnostics API for inspecting communication at the protocol level. The SDK overhaul introduces improvements such as explicit parameter handling, enhanced query methods, an Expressions API for dynamic expression building, and a value encode/decode visitor API for advanced data processing. The release also aligns the major and minor versions of the WASM and Node.js SDKs with SurrealDB, providing clear version identification and ensuring embedded SurrealDB instances remain current. Comprehensive documentation and a Quickstart guide are available to assist users in navigating the new features and capabilities of the updated SDK.