Skip to content

Documentation / @super-line/server / ServerCollectionHandle

Interface: ServerCollectionHandle<Row>

Defined in: collections/types.ts:128

Server-authoritative handle for a collection (srv.collection('messages')). Writes bypass row policy (server is authoritative) but are still schema-validated, fan out, and — under relay — replicate across nodes exactly like a client batch. The door for business-logic mutations that a contract request handler owns.

Type Parameters

Row

Row = unknown

Methods

delete()

delete(id): Promise<void>

Defined in: collections/types.ts:134

Delete a row by id (idempotent).

Parameters

id

string

Returns

Promise<void>


insert()

insert(row): Promise<void>

Defined in: collections/types.ts:130

Insert a row (its key field becomes the id). Throws CONFLICT if the id already exists.

Parameters

row

Row

Returns

Promise<void>


read()

read(id): Promise<Row | undefined>

Defined in: collections/types.ts:136

Read one row by id, or undefined.

Parameters

id

string

Returns

Promise<Row | undefined>


rowMeta()?

optional rowMeta(ids): Promise<Record<string, RowTimestamps>>

Defined in: collections/types.ts:140

Inspector-only: per-row created/updated timestamps keyed by id. Absent unless the backend tracks them.

Parameters

ids

string[]

Returns

Promise<Record<string, RowTimestamps>>


snapshot()

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

Defined in: collections/types.ts:138

Materialize a snapshot (filter/sort/limit); omit the query for the whole collection. Server-side, policy-free.

Parameters

query?

CollectionQuery

Returns

Promise<Row[]>


update()

update(row): Promise<void>

Defined in: collections/types.ts:132

Replace a row by its key (LWW). Throws NOT_FOUND if absent.

Parameters

row

Row

Returns

Promise<void>

Released under the MIT License.