Skip to content

js-bao-wss-client


js-bao-wss-client / MutationOperation

Interface: MutationOperation ​

A single write inside a mutation definition's operations array.

Properties ​

condition? ​

optional condition?: Record<string, any>

A structured DocumentFilter object gating the write — the compare-and-swap precondition. Applies to EVERY op kind (save/patch/delete/increment/addToSet/removeFromSet); the server checks it atomically and returns 409 code:"CONDITION_NOT_MET" when it does not hold. Values may be $params.<name> references resolved at execution time (e.g. { version: "$params.expectedVersion" }).

BREAKING (was condition?: string, "save only"): the old CEL-string form is rejected at registration — it never worked (it returned HTTP 500 on every execute). Author conditions as filter objects.


data? ​

optional data?: ObjectOrParamsRef

Record data for save/patch (object or $params reference).


fields? ​

optional fields?: ObjectOrParamsRef

Field → increment amount for increment (object or $params reference).


id? ​

optional id?: string

Target record id (required for patch/delete/increment/addToSet/removeFromSet).


ifNotExists? ​

optional ifNotExists?: boolean

save only: skip when the record already exists.


op ​

op: "save" | "patch" | "delete" | "increment" | "addToSet" | "removeFromSet"


stringSets? ​

optional stringSets?: ObjectOrParamsRef

Field → string-set members for addToSet/removeFromSet (object or $params).


upsertOn? ​

optional upsertOn?: string

save only: field name (or $params reference) to upsert on.

Documentation validated against js-bao-wss-client 3.4.0 · js-bao 0.11.0 · primitive-admin 1.0.62 · primitive-app 3.1.0 — 2026-09-30