v0.9.0
A single options object for every model verb, and a disposable claim handle.
Breaking Changes
-
One options object per verb.
create,update,delete, and the async serverretrieveeach take a single options object instead of positional arguments, so the id, the data, and every modifier live as named siblings:create({ data, id? }),update({ id, data, ...options }),delete({ id, ...options }),retrieve({ id, ...options }). Reactive local reads stay onget(id)(synchronous) —useAblo((ablo) => ablo.tasks.get(id)).- await ablo.tasks.update(id, { status: 'done' }, { wait: 'confirmed' }) + await ablo.tasks.update({ id, data: { status: 'done' }, wait: 'confirmed' }) - await ablo.tasks.retrieve(id) + await ablo.tasks.retrieve({ id }) - useAblo((ablo) => ablo.tasks.retrieve(id)) ?? serverTask + useAblo((ablo) => ablo.tasks.get(id)) ?? serverTask -
claimreturns a disposable handle instead of taking a callback. The handle exposes the fresh row on.dataand is released on scope exit (await using) or explicitly via.release().claim.state,claim.queue,claim.release, andclaim.reorderalso take the options object.- await ablo.tasks.claim(id, async (task) => { - await ablo.tasks.update(task.id, { status: 'in_review' }) - }) + await using claim = await ablo.tasks.claim({ id }) + const task = claim.data + await ablo.tasks.update({ id: task.id, data: { status: 'in_review' } })