Array support, modularized client, migration to typescript, Undici transport
Release overview
Major upgrade of the library with new features, such as ingesting arrays into the database, support for Undici, and bringing a new modularized codebase to enable users to build their own client.
Typescript migration and Undici
The entire codebase have been migrated to Typescript, and tools replaced/updated to pnpm, vitest, bunchee, eslint.
Starting with this release the client switches to Undici as its default HTTP transport.
The above changes were all implemented by @semoal, many thanks again for his huge contribution to the project!
Breaking change: The Undici dependency requires Node.js v20+. This is the minimum version required for this version of the client.
Arrays and protocol extension for binary encoding of 64-bit floating point values
This release also delivers support for the new QuestDB array type, and adds support for sending 64-bit floating point values in binary form. Arrays use the binary protocol extension too.
Example usage:
const sender = await Sender.fromConfig('http::addr=localhost:9000');
await sender
.table('order_book_l2')
.symbol('symbol', 'BTC-USD')
.symbol('exchange', 'Coinbase')
.arrayColumn('bid_prices', [50100.25, 50100.20, 50100.15, 50100.10, 50100.05])
.arrayColumn('bid_sizes', [0.5, 1.2, 2.1, 0.8, 3.5])
.arrayColumn('ask_prices', [50100.30, 50100.35, 50100.40, 50100.45, 50100.50])
.arrayColumn('ask_sizes', [0.6, 1.5, 1.8, 2.2, 4.0])
.atNow();
await sender.flush();
await sender.close();
Modularized client
We have also extracted the buffer and transport interfaces from the client, and introduced different implementations.
The different buffers and transports are selected based on the provided configuration string.
This allows us to use the above mentioned new features by default, but at the same time also provide the option for backwards compatibility.
This change also enables us to build a custom client by pooling a number of buffer and transport objects, and owning the flushing strategy, potentially reaching better performance than just using Sender instances.
Backwards compatibility options:
- protocol_version: set it to
1to remove support for arrays and binary encoding of floating point values.
const sender = await Sender.fromConfig('http::addr=localhost:9000;protocol_version=1');
- stdlib_http: set it to
onto switch back to the standard http/https modules instead of using Undici.
const sender = await Sender.fromConfig('http::addr=localhost:9000;stdlib_http=on');