Skip to content

Documentation / @super-line/client / CollectionHandle

Interface: CollectionHandle<Row>

Defined in: index.ts:184

Client-side handle for one contract collection, reached via client.collection(name). Typed by the contract.

Type Parameters

Row

Row = unknown

Methods

batch()

batch(ops): Promise<void>

Defined in: index.ts:200

Apply several ops as ONE atomic batch (all-or-nothing on the server).

Parameters

ops

({ row: Row; type: "insert" | "update"; } | { id: string; type: "delete"; })[]

Returns

Promise<void>


delete()

delete(id): Promise<void>

Defined in: index.ts:198

Delete a row by id.

Parameters

id

string

Returns

Promise<void>


insert()

insert(row): Promise<void>

Defined in: index.ts:194

Insert a row (its key field becomes the id). Resolves on the server ack; rejects on conflict/denial.

Parameters

row

Row

Returns

Promise<void>


query()

query(query?): Promise<Row[]>

Defined in: index.ts:192

One-shot read: the subscription's initial snapshot (ordered + limited per the query) as a detached copy, with the subscription closed before the promise settles. Rejects on denial exactly like subscribe().ready. For anything that should stay live, use subscribe.

Parameters

query?

CollectionQuery

Returns

Promise<Row[]>


subscribe()

subscribe(query?): LiveRowSet<Row>

Defined in: index.ts:186

Open a live subset subscription (omit the query for the whole collection, subject to server policy).

Parameters

query?

CollectionQuery

Returns

LiveRowSet<Row>


update()

update(row): Promise<void>

Defined in: index.ts:196

Replace a row by its key (LWW).

Parameters

row

Row

Returns

Promise<void>

Released under the MIT License.