diff --git a/examples/react/todo/src/App.tsx b/examples/react/todo/src/App.tsx index 93fabb9866..03a321e0ae 100644 --- a/examples/react/todo/src/App.tsx +++ b/examples/react/todo/src/App.tsx @@ -139,7 +139,7 @@ const createTodoCollection = (type: CollectionType) => { if (type === CollectionType.Electric) { newCollection = createElectricCollection({ id: `todos`, - streamOptions: { + shapeOptions: { url: `http://localhost:3003/v1/shape`, params: { table: `todos`, @@ -186,7 +186,7 @@ const createConfigCollection = (type: CollectionType) => { if (type === CollectionType.Electric) { newCollection = createElectricCollection({ id: `config`, - streamOptions: { + shapeOptions: { url: `http://localhost:3003/v1/shape`, params: { table: `config`, diff --git a/packages/db-collections/src/electric.ts b/packages/db-collections/src/electric.ts index f352cad545..dea17239c6 100644 --- a/packages/db-collections/src/electric.ts +++ b/packages/db-collections/src/electric.ts @@ -21,7 +21,7 @@ export interface ElectricCollectionConfig> /** * Configuration options for the ElectricSQL ShapeStream */ - streamOptions: ShapeStreamOptions + shapeOptions: ShapeStreamOptions } /** @@ -34,7 +34,7 @@ export class ElectricCollection< constructor(config: ElectricCollectionConfig) { const seenTxids = new Store>(new Set([Math.random()])) - const sync = createElectricSync(config.streamOptions, { + const sync = createElectricSync(config.shapeOptions, { seenTxids, }) @@ -90,7 +90,7 @@ function hasTxids = Row>( /** * Creates an ElectricSQL sync configuration * - * @param streamOptions - Configuration options for the ShapeStream + * @param shapeOptions - Configuration options for the ShapeStream * @param options - Options for the ElectricSync configuration * @returns ElectricSync configuration */ @@ -107,7 +107,7 @@ export function createElectricCollection>( * Internal function to create ElectricSQL sync configuration */ function createElectricSync>( - streamOptions: ShapeStreamOptions, + shapeOptions: ShapeStreamOptions, options: { seenTxids: Store> } @@ -126,8 +126,8 @@ function createElectricSync>( const schema = relationSchema.state || `public` return { - relation: streamOptions.params?.table - ? [schema, streamOptions.params.table] + relation: shapeOptions.params?.table + ? [schema, shapeOptions.params.table] : undefined, } } @@ -135,7 +135,7 @@ function createElectricSync>( return { sync: (params: Parameters[`sync`]>[0]) => { const { begin, write, commit } = params - const stream = new ShapeStream(streamOptions) + const stream = new ShapeStream(shapeOptions) let transactionStarted = false let newTxids = new Set() diff --git a/packages/db-collections/tests/electric.test.ts b/packages/db-collections/tests/electric.test.ts index c5dfc6229d..d744528054 100644 --- a/packages/db-collections/tests/electric.test.ts +++ b/packages/db-collections/tests/electric.test.ts @@ -35,7 +35,7 @@ describe(`Electric Integration`, () => { // Create collection with Electric configuration collection = createElectricCollection({ id: `test`, - streamOptions: { + shapeOptions: { url: `http://test-url`, params: { table: `test_table`,