auth/cell_item_action_specs.ts

Cell-item RPC specs — declarative contract for the four ordered-child verbs (insert / move / delete / list).

(parent_id, position) → child_id rows. position is opaque text (fractional-indexing key); the wire validates the alphabet (^[0-9A-Za-z]+$) and length, the lex-ordering invariant is the client's contract.

view source

Declarations
#

17 declarations

all_cell_item_action_specs
#

auth/cell_item_action_specs.ts view source

readonly [{ method: string; kind: "request_response"; initiator: "frontend"; auth: { account: "required"; actor: "required"; }; side_effects: true; input: Schema<{ parent_id: Branded<string, "Uuid">; position: Branded<...>; child_id: Branded<...>; acting?: Branded<...> | undefined; }, { ...; }, "object", { ...; }>; ... import {all_cell_item_action_specs} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

All cell_item action specs — composed into all_cell_action_specs.

cell_item_delete_action_spec
#

auth/cell_item_action_specs.ts view source

also exported from auth/cell_action_specs.ts

{ method: string; kind: "request_response"; initiator: "frontend"; auth: { account: "required"; actor: "required"; }; side_effects: true; input: Schema<{ parent_id: Branded<string, "Uuid">; position: Branded<...>; acting?: Branded<...> | undefined; }, { ...; }, "object", { ...; }>; output: Schema<...>; async: true; ... import {cell_item_delete_action_spec} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

cell_item_insert_action_spec
#

auth/cell_item_action_specs.ts view source

also exported from auth/cell_action_specs.ts

{ method: string; kind: "request_response"; initiator: "frontend"; auth: { account: "required"; actor: "required"; }; side_effects: true; input: Schema<{ parent_id: Branded<string, "Uuid">; position: Branded<...>; child_id: Branded<...>; acting?: Branded<...> | undefined; }, { ...; }, "object", { ...; }>; output: Sc... import {cell_item_insert_action_spec} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

cell_item_list_action_spec
#

auth/cell_item_action_specs.ts view source

also exported from auth/cell_action_specs.ts

{ method: string; kind: "request_response"; initiator: "frontend"; auth: { account: "optional"; actor: "optional"; }; side_effects: false; input: Schema<{ limit?: number | undefined; acting?: Branded<string, "Uuid"> | undefined; parent_id?: Branded<...> | undefined; child_id?: Branded<...> | undefined; position_afte... import {cell_item_list_action_spec} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

cell_item_move_action_spec
#

auth/cell_item_action_specs.ts view source

also exported from auth/cell_action_specs.ts

{ method: string; kind: "request_response"; initiator: "frontend"; auth: { account: "required"; actor: "required"; }; side_effects: true; input: Schema<{ parent_id: Branded<string, "Uuid">; position: Branded<...>; new_position: Branded<...>; acting?: Branded<...> | undefined; }, { ...; }, "object", { ...; }>; output... import {cell_item_move_action_spec} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

CellItemDeleteInput
#

auth/cell_item_action_specs.ts view source

value + type

{ parent_id: Branded<string, "Uuid">; position: Branded<string, "CellItemPosition">; acting?: Branded<string, "Uuid"> | undefined; } import {CellItemDeleteInput} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

Input for cell_item_delete. Idempotent on the slot key.

parent_id

type Branded

position

type Branded

acting?

type Branded

CellItemDeleteOutput
#

auth/cell_item_action_specs.ts view source

value + type

{ ok: true; deleted: boolean; } import {CellItemDeleteOutput} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

ok

type true

deleted

type boolean

CellItemInsertInput
#

auth/cell_item_action_specs.ts view source

value + type

{ parent_id: Branded<string, "Uuid">; position: Branded<string, "CellItemPosition">; child_id: Branded<string, "Uuid">; acting?: Branded<string, "Uuid"> | undefined; } import {CellItemInsertInput} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

Input for cell_item_insert. Caller computes position via fractional_index_between(prev, next) (@fuzdev/fuz_util/fractional_index.ts) client-side. Returns cell_item_position_taken on `(parent_id, position)` unique violation; client refreshes bracket and retries.

parent_id

type Branded

position

type Branded

child_id

type Branded

acting?

type Branded

CellItemInsertOutput
#

auth/cell_item_action_specs.ts view source

value + type

{ item: { created_at: string; parent_id: Branded<string, "Uuid">; position: Branded<string, "CellItemPosition">; child_id: Branded<string, "Uuid">; }; } import {CellItemInsertOutput} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

item

type ItemJson

CellItemListInput
#

auth/cell_item_action_specs.ts view source

value + type

{ limit?: number | undefined; acting?: Branded<string, "Uuid"> | undefined; parent_id?: Branded<string, "Uuid"> | undefined; child_id?: Branded<string, "Uuid"> | undefined; position_after?: Branded<...> | undefined; } import {CellItemListInput} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

Input for cell_item_list. Pass parent_id for forward items or child_id for reverse lists — exactly one; both or neither is invalid_params with ERROR_CELL_ITEM_LIST_REQUIRES_PARENT_OR_CHILD, from the handler (the schema leaves both optional). Reverse listing has 2-layer authz (child view-check gates the call; per-parent view-check filters the rows).

Either direction returns a page of up to limit items (default CELL_RELATION_LIST_LIMIT_DEFAULT) whose other end the caller can view — the view check runs before the limit. Forward listing pages on via position_after (return rows with position > position_after); the reverse listing has no cursor, oldest item first.

limit?

type number

acting?

type Branded

parent_id?

type Branded

child_id?

type Branded

position_after?

type Branded

CellItemListOutput
#

auth/cell_item_action_specs.ts view source

value + type

{ items: { created_at: string; parent_id: Branded<string, "Uuid">; position: Branded<string, "CellItemPosition">; child_id: Branded<string, "Uuid">; }[]; } import {CellItemListOutput} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

items

type ItemJson[]

CellItemMoveInput
#

auth/cell_item_action_specs.ts view source

value + type

{ parent_id: Branded<string, "Uuid">; position: Branded<string, "CellItemPosition">; new_position: Branded<string, "CellItemPosition">; acting?: Branded<...> | undefined; } import {CellItemMoveInput} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

Input for cell_item_move. Move within the same parent (cross-parent moves are a future extension).

parent_id

type Branded

position

type Branded

new_position

type Branded

acting?

type Branded

CellItemMoveOutput
#

auth/cell_item_action_specs.ts view source

value + type

{ item: { created_at: string; parent_id: Branded<string, "Uuid">; position: Branded<string, "CellItemPosition">; child_id: Branded<string, "Uuid">; }; } import {CellItemMoveOutput} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

item

type ItemJson

CellItemPosition
#

auth/cell_item_action_specs.ts view source

value + type

Branded<string, "CellItemPosition">

type Branded

import {CellItemPosition} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

Position grammar — base62 fractional-indexing key. Wire enforces non-empty, alphabet only, and the helper's FRACTIONAL_INDEX_LENGTH_MAX cap (well above realistic lengths even for hundreds of consecutive front-inserts; set high to avoid arbitrary cliffs). Lex ordering is the contract; the no-trailing-'0' invariant lives in the helper, not the wire.

external types

Infer<typeof CellItemPosition>

ERROR_CELL_ITEM_LIST_REQUIRES_PARENT_OR_CHILD
#

auth/cell_item_action_specs.ts view source

"cell_item_list_requires_parent_or_child" import {ERROR_CELL_ITEM_LIST_REQUIRES_PARENT_OR_CHILD} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

Error reason — cell_item_list got neither or both of parent_id and child_id.

ERROR_CELL_ITEM_POSITION_TAKEN
#

auth/cell_item_action_specs.ts view source

"cell_item_position_taken" import {ERROR_CELL_ITEM_POSITION_TAKEN} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

Error reason — (parent_id, position) collision on cell_item_insert or cell_item_move. Surfaces when two clients computed the same fractional-indexing key (rare given helper-side jitter, which is on by default; the safety net for the residual race). A client that opts out with {jitter: false} gets bare deterministic mids, so two of them racing the same bracket collide every time and this stops being rare — that mode is for reproducible callers (seeders, fixtures), not concurrent ones. Client refreshes its bracket and retries.

ItemJson
#

auth/cell_item_action_specs.ts view source

value + type

{ created_at: string; parent_id: Branded<string, "Uuid">; position: Branded<string, "CellItemPosition">; child_id: Branded<string, "Uuid">; } import {ItemJson} from '@fuzdev/fuz_app/auth/cell_item_action_specs.js';

Wire-format for a cell_item row.

position is branded CellItemPosition so consumers that round-trip the value back into a position_after / position input field don't need a cast at every call site. Wire ingress is validated by the CellItemPosition schema (alphabet + length); wire egress trusts the DB CHECK constraint that backs cell_item.position, so the server-side to_item_json casts a raw string from CellItemRow.

created_at

type string

parent_id

type Branded

position

type Branded

child_id

type Branded

Depends on
#

Imported by
#