@bimetal/table-data
v0.35.0
Published
Table-domain event-sourcing prototype: TableRow commands/events, tableAggregate, tableProjection, createTableStore. Architecture test for @bimetal/event-sourcing — proves the generic schicht carries non-calendar domains without leakage.
Maintainers
Readme
@bimetal/table-data
Table-domain event sourcing — the data layer (aggregate + projection + store) of the full @bimetal/table component family. This package has no UI; the UI lives in @bimetal/table-{react,vue,svelte,angular,vanilla}-components.
It mirrors what @bimetal/calendar-data does for the calendar domain, in a completely different shape (rows + cells instead of events + recurrence) — the lived proof that the generic event-sourcing layer is domain-agnostic: a second domain composes on it without forcing changes back into @bimetal/event-sourcing.
Installation
npm install @bimetal/table-dataWhat's Inside
Domain
TableRow—{ readonly id: string; readonly cells: Readonly<Record<string, CellValue>> }CellValue—string | number | boolean | nullTableReadModel—{ rows: readonly TableRow[]; version: number }
Domain Events
TableRowCreated/Updated/Deleted/Reverted- Union:
TableDomainEvent
Commands
CreateTableRow,UpdateTableRow,DeleteTableRow,UndoLastChange- Union:
TableCommand
Command Factories
createRow,updateRow,deleteRow,undoLastChange
Facade
TableStore— extendsDomainStore<AggregateState, TableCommand, TableDomainEvent, TableReadModel>withgetRows()createTableStore(config?)— main entry pointHydratableTableStore— addshydrate()andrebuild()
Table-flavored generics (with T = TableRow defaults)
AggregateState,AggregateSnapshot,TableSnapshotStore
Example
import { createTableStore, createRow, updateRow } from '@bimetal/table-data';
const store = createTableStore();
await store.dispatch(createRow({ id: 'r1', cells: { name: 'Alice', age: 30 } }));
await store.dispatch(updateRow('r1', { cells: { name: 'Bob', age: 30 } }));
await store.undo('r1'); // name reverts to 'Alice'Status
Shipped. Table is a full component family over all five stacks — @bimetal/table-headless (createTableController) drives @bimetal/table-{react,vue,svelte,angular,vanilla}-components with virtual scrolling, multi-sort, filtering, grouping, pin/reorder, inline batch-edit and undo. This package is its event-sourced data layer.
License
Apache License 2.0
