Skip to content

Releases: questdb/nodejs-questdb-client

HTTP transport and configuration string

29 Apr 19:42
97a5f9e
Compare
Choose a tag to compare

Release overview

Major API improvements, including support for InfluxDB Line Protocol over HTTP.

Breaking change: With the introduction of the HTTP transport it is now mandatory to select the protocol to be used by the client.

What is new

Support for the ILP protocol over HTTP transport, as well as the new config string syntax

  • The new HTTP sender has better error reporting. In particular, it returns an error if the QuestDB server failed to write ILP messages for any reason.
  • HTTP sender handles network errors and retries writes automatically.
  • HTTP sender reuses connections to avoid open connection overhead for each flush() call.
  • The new fromConf() method provides a convenient way for constructing a Sender via a configuration string.

Migration

v2 code example:

const sender = new Sender();
await sender.connect({ port: 9009, host: 'localhost' });
sender.table('tablename').intColumn('id', 0).atNow();
await sender.flush();
await sender.close();

Migrated v3 code:

const sender = Sender.fromConfig('http::addr=localhost:9000');
await sender.table('tablename').intColumn('id', 0).atNow();
await sender.flush();
await sender.close();

Note, that the migrated code uses the HTTP sender instead of the TCP one.

Simpler authentication

28 Nov 21:30
45889a7
Compare
Choose a tag to compare

Previous versions of the client required the entire JWK for authentication.

const sender = new Sender({
    jwk: {
        kid: '<username>',
        d: '<private key>'
        x: '<public key x>',
        y: '<public key y>',
        kty: 'EC',
        crv: 'P-256'
    }
});

Starting with v2.1.0 the client supports a simpler way of authentication, where it is enough to specify only the username and the user's private key.

const sender = new Sender({
    auth: {
        keyId: '<username>',
        token: '<private key>'
    }
});

Safer timestamp API

09 Oct 15:40
828afd1
Compare
Choose a tag to compare

An optional time unit parameter can be passed to timestamp-accepting methods:

  const bday = Date.parse('1856-07-10');
  sender
    .table('inventors')
    .symbol('born', 'Austrian Empire')
    .timestampColumn('birthday', bday, 'ms') // notice 'ms' here
    .intColumn('id', 0)
    .stringColumn('name', 'Nicola Tesla')
    .at(Date.now(), 'ms'); // notice 'ms' here

The time unit defaults to 'us' (native QuestDB resolution) in both timestampColumn() and at().

Supported values are:

  • 'ns' - nanoseconds
  • 'us' - microseconds
  • 'ms' - milliseconds

Note: This release contains a breaking change.
at() does not accept string type anymore, and number/BigInt values are interpreted as microseconds instead of nanoseconds.

BigInt support for timestamp values

18 Sep 15:24
4ba7774
Compare
Choose a tag to compare

The client's API will accept BigInt types wherever a timestamp needs to be passed.
The API change is backwards compatible.

Sender option 'copyBuffer' defaults to 'true'

26 May 12:21
82ced72
Compare
Choose a tag to compare
  • sender option 'copyBuffer' defaults to 'true'
  • type checks for sender options
  • worker threads example

TCP keepalive

18 May 10:29
c88ddd1
Compare
Choose a tag to compare

TCP keepalive has been enabled for the QuestDB socket connection to avoid disconnects caused by client inactivity.
Should work in most cases; if the connection goes through a firewall this solution might not be good enough.
In that case users could add empty messages on application layer probably to keep the connection alive.
The long term solution is definitely to improve the client further and implement keepalive on ILP protocol level (or whatever will be replacing it in the future).

Custom logging

05 Jan 10:52
83c7b19
Compare
Choose a tag to compare

A new option to pass a custom logging function to the client.
If no logger specified the client will write log messages to console, default logging level is info.

Add 'copyBuffer' option

21 Sep 10:44
c71c8f9
Compare
Choose a tag to compare

This release introduces a new option called 'copyBuffer', the option is not set by default.
If the option is set the client will create a new buffer for each flush() call with the data belongs to the returned promise.
This prevents creating duplicate rows if await is missed when calling flush() or if the calls to flush() are not serialised.

Example:

const sender = new Sender({ copyBuffer: true });

First release

22 Aug 10:18
Compare
Choose a tag to compare

Node.js client for QuestDB.

Connect to QuestDB and ingest data via ILP.
Supports TLS encryption and ILP authentication.