Hook Contract
Input payload
Hook input includes:
event: lifecycle event stringcollection: collection name for collection-scoped eventsrecord: current record payloadprevious_record: previous row state when applicableauth: auth context (user_id,roles)meta: request metadata (request_id,timestamp,resource)
Output payload
Hook result shape:
ok: booleanrecord?: object(used mainly bybefore_*hooks to mutate payload)errors?: [{ code, message, hint? }]warnings?: [{ code, message }]meta_patch?: object
Behavioral semantics
before_*+ok: false: request is rejected.after_*+ok: false: request succeeds; warning is collected inmeta.hook_warnings.before_*+recordset: Zeptoz continues with mutated record.
Capability APIs (JS/TS runtime)
Available in ctx:
ctx.auth.hasRole(role)ctx.db.findOne/create/update/delete(...)ctx.log.info/warn/error(...)
Use only these capability APIs from hook code.