Triplit Release Notes 2/15/2024

  • Added more detailed development server logs. Run triplit dev [--verbose | -v]. The verbose option will log the full payloads of messages, requests and responses.
Server logs
  • Expanded the query builder API to accept additive where and order clauses for simpler query construction
import { TriplitClient } from '@triplit/client';

const client = new TriplitClient();

const query = client
  .query('users')
  .where('created_at', '>', new Date('2024-01-01'))
  .where('first_name', 'like', 'John%')
  .order('last_name', 'ASC')
  .order('created_at', 'DESC');

// equivalent to
const query = client
  .query('users')
  .where([
    ['created_at', '>', new Date('2024-01-01')],
    ['first_name', 'like', 'John%'],
  ])
  .order([
    ['last_name', 'ASC'],
    ['created_at', 'DESC'],
  ]);
  • Added support for nullable sets in a schema
import { Schema as S } from '@triplit/db';

export const schema = {
  foo: {
    schema: S.Schema({
      bar: S.Set(S.String(), { nullable: true }),
    }),
  },
};

// acceptable inserts
client.insert('foo', { bar: null });
client.insert('foo', { bar: new Set() });
client.insert('foo', { bar: new Set(['a', 'b']) });
  • Added a query builder API for the http RemoteClient
import { RemoteClient } from '@triplit/client';

const client = new RemoteClient({{
      server: `http://localhost:6542`,
      token: process.env.TRIPLIT_TOKEN,
    }});

const query = client.query('users').
                     where('created_at', '>',
                            new Date('2024-01-01'));