Skip to content

Documentation / @super-line/server / CrdtCollectionPolicy

Interface: CrdtCollectionPolicy<Ctx, Doc>

Defined in: collections/types.ts:148

Access policy for a CRDT document collection (ADR-0007, Q7). Guard-shaped — not the RLS filter shape of CollectionPolicy, because CRDT collections are opened by id (no subset to filter). Deny-by-default. Server co-writes via srv.collection(n) bypass both.

Type Parameters

Ctx

Ctx = unknown

Doc

Doc = unknown

Properties

read?

optional read?: (principal, id, snapshot, ctx) => Awaitable<boolean>

Defined in: collections/types.ts:150

May this principal open id? Gets the post-merge plaintext snapshot (content-based auth like RLS reading a row).

Parameters

principal

string

id

string

snapshot

Doc | undefined

ctx

Ctx

Returns

Awaitable<boolean>


write?

optional write?: (principal, id, ctx) => Awaitable<boolean>

Defined in: collections/types.ts:152

May this principal write to id? (Creation is server-authoritative — Q10 — so there is no create op here.)

Parameters

principal

string

id

string

ctx

Ctx

Returns

Awaitable<boolean>

Released under the MIT License.