Skip to content

Store actions

All mutations live in src/lib/store.ts. They map roughly 1:1 to the API endpoints the backend will need.

Area Action Signature (simplified)
Types createType (input) → ObjectType
updateType (id, patch)
deleteType (id, reason?) → boolean. Fails if the type has items.
renameCategory (from, to)
Items createItems (input) → Item[]. Bulk; reserves consecutive codes.
setLabels (ids, labels) → boolean. Items of one type; null removes a label. POST /items/labels.
transferItems (ids, workspaceId) → TransferResult | null. Moves items and their installed components to another workspace. POST /items/transfer.
updateItem (id, { name?, labels?, location? })
setStatus (id, status)
assign (childId, parentId | null, slotId?) → boolean. Rejects cycles.
setCustodian (id, userId?). Admin direct assignment.
toggleWatch (id)
deleteItem (id, reason?)
reportProblem ({ itemId, status, note, photo? }). Report a problem dialog.
Custody offerHandover (itemId, toId, note?) → Handover | null
requestCustody (itemId, note?) → Handover | 'taken' | null
respondHandover (id, { accept, note?, checked?, missing?, condition? })
cancelHandover (id)
Documents addDoc / removeDoc
Comments addComment (target, body, { via?, replyTo? }) → Comment
deleteComment (id, reason?). Removes replies too.
Audit restore (auditId) → RestoreError | null
Members addMember, inviteLink, setMemberRole, removeMember Current workspace; workspace admins.
Accounts updateAccount, removeUser Name, status, instance admin flag, delete. Instance admins.
Workspaces createWorkspace, deleteWorkspace Instance admins. renameWorkspace renames the open one (workspace admins).
Settings updateSettings (patch)

RestoreError is one of gone, codeTaken, prefixTaken, typeMissing, targetMissing, emailTaken.