Skip to content

@sqlrooms/cells / CellRegistryItem

Type Alias: CellRegistryItem<TCell>

CellRegistryItem<TCell> = object

Type Parameters

Type ParameterDefault type
TCell extends CellCell

Properties

type

type: string


title

title: string


createCell()

createCell: (args) => TCell

Parameters

ParameterType
argsCreateCellArgs

Returns

TCell


renderCell()

renderCell: (props) => React.ReactElement

Parameters

ParameterType
props{ id: string; cell: TCell; renderContainer: (props) => React.ReactElement; }
props.idstring
props.cellTCell
props.renderContainer(props) => React.ReactElement

Returns

React.ReactElement


findDependencies()

findDependencies: (args) => Promise<string[] | CellDependencies>

Find dependencies for DAG using AST-enabled async resolution.

Parameters

ParameterType
args{ cell: TCell; cells: Record<string, Cell>; artifactId: string; sqlSelectToJson: SqlSelectToJsonFn; }
args.cellTCell
args.cellsRecord<string, Cell>
args.artifactIdstring
args.sqlSelectToJsonSqlSelectToJsonFn

Returns

Promise<string[] | CellDependencies>


runCell()?

optional runCell: (args) => Promise<void>

Optional: custom execution logic (defaults to SQL execution for sql type)

Parameters

ParameterType
args{ id: string; opts?: { cascade?: boolean; schemaName?: string; }; get: () => CellsRootState; set: (updater) => void; }
args.idstring
args.opts?{ cascade?: boolean; schemaName?: string; }
args.opts.cascade?boolean
args.opts.schemaName?string
args.get() => CellsRootState
args.set(updater) => void

Returns

Promise<void>


renameResult()?

optional renameResult: (args) => Promise<void>

Optional: rename the result view when resultName changes

Parameters

ParameterType
args{ id: string; oldResultView: string; get: () => CellsRootState; set: (updater) => void; }
args.idstring
args.oldResultViewstring
args.get() => CellsRootState
args.set(updater) => void

Returns

Promise<void>


createStatus()?

optional createStatus: (id) => CellStatus

Return initial CellStatus when a cell is first added. Default: {type:'other'}

Parameters

ParameterType
idstring

Returns

CellStatus


onInitialize()?

optional onInitialize: (args) => void

Called once during cells.initialize() for each cell of this type. Reset ephemeral runtime state after hydration.

Parameters

ParameterType
args{ id: string; status: CellStatus | undefined; get: () => CellsRootState; set: (updater) => void; }
args.idstring
args.statusCellStatus | undefined
args.get() => CellsRootState
args.set(updater) => void

Returns

void


onRemove()?

optional onRemove: (args) => Promise<void> | void

Called when cell is removed. Clean up DuckDB relations, caches, etc.

Parameters

ParameterType
args{ id: string; status: CellStatus | undefined; get: () => CellsRootState; set: (updater) => void; }
args.idstring
args.statusCellStatus | undefined
args.get() => CellsRootState
args.set(updater) => void

Returns

Promise<void> | void


hasSemanticChange()?

optional hasSemanticChange: (oldCell, newCell) => boolean

Detect whether an updateCell change is semantically significant for this cell type.

Parameters

ParameterType
oldCellTCell
newCellTCell

Returns

boolean


invalidateStatus()?

optional invalidateStatus: (currentStatus) => CellStatus

Reset status to idle/stale. Called by invalidateCellStatus. If not provided, status is set to {type:'other'}.

Parameters

ParameterType
currentStatusCellStatus

Returns

CellStatus


getRelationsToDrop()?

optional getRelationsToDrop: (status) => string[]

Collect DuckDB relation names that should be dropped when this cell is removed.

Parameters

ParameterType
statusCellStatus

Returns

string[]


recordError()?

optional recordError: (currentStatus, message) => CellStatus

Record an error on the cell status during cascade execution.

Parameters

ParameterType
currentStatusCellStatus
messagestring

Returns

CellStatus


getResultRelation()?

optional getResultRelation: (status) => string | undefined

Return the query relation name for paged fetches, if applicable.

Parameters

ParameterType
statusCellStatus

Returns

string | undefined