@electric-sql/react@0.6.0
·
1529 commits
to main
since this release
Minor Changes
-
e96928e: [BREAKING]: Move non-protocol options like table & where to the params sub-key
Context
Electric's TypeScript client is currently tightly coupled to PostgreSQL-specific options in its
ShapeStreamOptionsinterface. As Electric plans to support multiple data sources in the future, we need to separate protocol-level options from source-specific options.Changes
- Created a new
PostgresParamstype to define PostgreSQL-specific parameters:table: The root table for the shapewhere: Where clauses for the shapecolumns: Columns to include in the shapereplica: Whether to send full or partial row updates
- Moved PostgreSQL-specific options from the top-level
ShapeStreamOptionsinterface to theparamssub-key - Updated
ParamsRecordtype to include PostgreSQL parameters - Updated the
ShapeStreamclass to handle parameters from theparamsobject - Updated documentation to reflect the changes
Migration Example
Before:
const stream = new ShapeStream({ url: 'http://localhost:3000/v1/shape', table: 'users', where: 'id > 100', columns: ['id', 'name'], replica: 'full', })
After:
const stream = new ShapeStream({ url: 'http://localhost:3000/v1/shape', params: { table: 'users', where: 'id > 100', columns: ['id', 'name'], replica: 'full', }, })
- Created a new