auth/cell_actions.ts view source
CellActionDeps type ActionFactoryDeps & { validate_data?: ((kind: string | null, data: Readonly<{ label?: string | undefined; summary?: string | undefined; } & Record<string, unknown>>) => void) | undefined; authorize_create?: CellCreateAuthorize | undefined; }
import type {CellActionDeps} from '@fuzdev/fuz_app/auth/cell_actions.js'; Dependencies for create_cell_actions.
validate_data is the optional sub-API hook for per-kind shape
validation (e.g., a collection/entry registry), the TS twin of the Rust
CellDataValidator. It is called as (kind, data) — kind is the cell's
top-level kind column, so it dispatches on it: the input's on create, the
existing cell's on an update carrying data (kind is write-once), the
source's for every row a clone writes (on the merged data). It accepts or
throws, never rewrites: the handler stores the caller's data as sent, and
it must not mutate it. A thrown SchemaError
(parse_or_throw) becomes the standard invalid_params JSON-RPC error so
per-kind validation failures surface to clients with code -32602 (not
-32603 / internal); throw a JsonrpcError
(jsonrpc_errors.invalid_params with a reason) to choose the reason. When
omitted, payloads pass through as-is.
authorize_create is the optional creation-gate hook (see
CellCreateAuthorize). When omitted, create is open, and every non-null
root policy write is refused.
log
Structured logger instance.
type Logger
audit
Bound audit emitter for audit writes.
type AuditEmitter
validate_data?
type (kind: string | null, data: Readonly<{ label?: string | undefined; summary?: string | undefined; } & Record<string, unknown>>): void
kind
string | nulldata
Readonly<CellData>voidauthorize_create?
type CellCreateAuthorize