@ion-drive/client
v0.7.0
Published
Ion Drive client SDK — a zero-dependency, typed query builder and fetch client for the Ion Drive REST API. Works in Node and the browser.
Maintainers
Readme
@ion-drive/client
Typed, zero-dependency client SDK for the Ion Drive REST API — a chainable
query builder in the spirit of Supabase's postgrest-js. Works in Node 18+
and the browser (global fetch).
import { IonDriveClient } from '@ion-drive/client';
const ion = new IonDriveClient({ baseUrl: 'http://localhost:3000', apiKey: 'iond_…' });
const contacts = await ion
.from('contacts')
.select('id,name,email')
.eq('status', 'active')
.search('smith')
.order('created_at', 'desc')
.page(1)
.pageSize(25);
const created = await ion.from('contacts').insert({ name: 'Ada' });
// Atomic counters + upsert (issue #9):
await ion.from('player_stats').increment(id, { wins: 1 }); // SET wins = wins + 1
await ion.from('player_stats').update(id, { wins: { $inc: 1 } }); // operator form
const { data, created: isNew } = await ion
.from('devices')
.upsert({ device_id: 'abc' }, { onConflict: 'device_id' }); // INSERT … ON CONFLICTErrors throw a typed IonDriveError; get() returns null on 404.
Docs & source: https://github.com/jaredgrabill/ion-drive · License: Apache-2.0
