@sqlrooms/cells / CellRegistryItem
Type Alias: CellRegistryItem<TCell>
CellRegistryItem<
TCell> =object
Type Parameters
| Type Parameter | Default type |
|---|---|
TCell extends Cell | Cell |
Properties
type
type:
string
title
title:
string
createCell()
createCell: (
args) =>TCell
Parameters
| Parameter | Type |
|---|---|
args | CreateCellArgs |
Returns
TCell
renderCell()
renderCell: (
props) =>React.ReactElement
Parameters
| Parameter | Type |
|---|---|
props | { id: string; cell: TCell; renderContainer: (props) => React.ReactElement; } |
props.id | string |
props.cell | TCell |
props.renderContainer | (props) => React.ReactElement |
Returns
React.ReactElement
findDependencies()
findDependencies: (
args) =>Promise<string[] |CellDependencies>
Find dependencies for DAG using AST-enabled async resolution.
Parameters
| Parameter | Type |
|---|---|
args | { cell: TCell; cells: Record<string, Cell>; artifactId: string; sqlSelectToJson: SqlSelectToJsonFn; } |
args.cell | TCell |
args.cells | Record<string, Cell> |
args.artifactId | string |
args.sqlSelectToJson | SqlSelectToJsonFn |
Returns
Promise<string[] | CellDependencies>
runCell()?
optionalrunCell: (args) =>Promise<void>
Optional: custom execution logic (defaults to SQL execution for sql type)
Parameters
| Parameter | Type |
|---|---|
args | { id: string; opts?: { cascade?: boolean; schemaName?: string; }; get: () => CellsRootState; set: (updater) => void; } |
args.id | string |
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()?
optionalrenameResult: (args) =>Promise<void>
Optional: rename the result view when resultName changes
Parameters
| Parameter | Type |
|---|---|
args | { id: string; oldResultView: string; get: () => CellsRootState; set: (updater) => void; } |
args.id | string |
args.oldResultView | string |
args.get | () => CellsRootState |
args.set | (updater) => void |
Returns
Promise<void>
createStatus()?
optionalcreateStatus: (id) =>CellStatus
Return initial CellStatus when a cell is first added. Default: {type:'other'}
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
onInitialize()?
optionalonInitialize: (args) =>void
Called once during cells.initialize() for each cell of this type. Reset ephemeral runtime state after hydration.
Parameters
| Parameter | Type |
|---|---|
args | { id: string; status: CellStatus | undefined; get: () => CellsRootState; set: (updater) => void; } |
args.id | string |
args.status | CellStatus | undefined |
args.get | () => CellsRootState |
args.set | (updater) => void |
Returns
void
onRemove()?
optionalonRemove: (args) =>Promise<void> |void
Called when cell is removed. Clean up DuckDB relations, caches, etc.
Parameters
| Parameter | Type |
|---|---|
args | { id: string; status: CellStatus | undefined; get: () => CellsRootState; set: (updater) => void; } |
args.id | string |
args.status | CellStatus | undefined |
args.get | () => CellsRootState |
args.set | (updater) => void |
Returns
Promise<void> | void
hasSemanticChange()?
optionalhasSemanticChange: (oldCell,newCell) =>boolean
Detect whether an updateCell change is semantically significant for this cell type.
Parameters
| Parameter | Type |
|---|---|
oldCell | TCell |
newCell | TCell |
Returns
boolean
invalidateStatus()?
optionalinvalidateStatus: (currentStatus) =>CellStatus
Reset status to idle/stale. Called by invalidateCellStatus. If not provided, status is set to {type:'other'}.
Parameters
| Parameter | Type |
|---|---|
currentStatus | CellStatus |
Returns
getRelationsToDrop()?
optionalgetRelationsToDrop: (status) =>string[]
Collect DuckDB relation names that should be dropped when this cell is removed.
Parameters
| Parameter | Type |
|---|---|
status | CellStatus |
Returns
string[]
recordError()?
optionalrecordError: (currentStatus,message) =>CellStatus
Record an error on the cell status during cascade execution.
Parameters
| Parameter | Type |
|---|---|
currentStatus | CellStatus |
message | string |
Returns
getResultRelation()?
optionalgetResultRelation: (status) =>string|undefined
Return the query relation name for paged fetches, if applicable.
Parameters
| Parameter | Type |
|---|---|
status | CellStatus |
Returns
string | undefined
