From 1f08fc5674f95952347bcf04a700793943d40f70 Mon Sep 17 00:00:00 2001 From: Steven Ontong Date: Mon, 15 Jan 2024 09:27:30 +0200 Subject: [PATCH] neaten crud throttle options --- .../src/client/AbstractPowerSyncDatabase.ts | 9 +++++++++ .../src/client/AbstractPowerSyncOpenFactory.ts | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/powersync-sdk-common/src/client/AbstractPowerSyncDatabase.ts b/packages/powersync-sdk-common/src/client/AbstractPowerSyncDatabase.ts index aebc112b..35f9df11 100644 --- a/packages/powersync-sdk-common/src/client/AbstractPowerSyncDatabase.ts +++ b/packages/powersync-sdk-common/src/client/AbstractPowerSyncDatabase.ts @@ -22,7 +22,16 @@ import { EventIterator } from 'event-iterator'; export interface PowerSyncDatabaseOptions { schema: Schema; database: DBAdapter; + /** + * Delay for retrying sync streaming operations + * from the PowerSync backend after an error occurs. + */ retryDelay?: number; + /** + * Backend Connector CRUD operations are throttled + * to occur at most every `crudUploadThrottleMs` + * milliseconds. + */ crudUploadThrottleMs?: number; logger?: ILogger; } diff --git a/packages/powersync-sdk-common/src/client/AbstractPowerSyncOpenFactory.ts b/packages/powersync-sdk-common/src/client/AbstractPowerSyncOpenFactory.ts index a94a09ce..bcc7fe62 100644 --- a/packages/powersync-sdk-common/src/client/AbstractPowerSyncOpenFactory.ts +++ b/packages/powersync-sdk-common/src/client/AbstractPowerSyncOpenFactory.ts @@ -2,7 +2,7 @@ import { DBAdapter } from '../db/DBAdapter'; import { Schema } from '../db/schema/Schema'; import { AbstractPowerSyncDatabase, PowerSyncDatabaseOptions } from './AbstractPowerSyncDatabase'; -export interface PowerSyncOpenFactoryOptions { +export interface PowerSyncOpenFactoryOptions extends Partial { schema: Schema; /** * Filename for the database. @@ -26,7 +26,8 @@ export abstract class AbstractPowerSyncDatabaseOpenFactory { generateOptions(): PowerSyncDatabaseOptions { return { database: this.openDB(), - schema: this.schema + schema: this.schema, + ...this.options }; }