Skip to content

Commit 769b46f

Browse files
committed
chore: revert previous changes
1 parent 78d21c0 commit 769b46f

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

packages/common/src/client/AbstractPowerSyncDatabase.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { CrudEntry, CrudEntryJSON } from './sync/bucket/CrudEntry.js';
2424
import { CrudTransaction } from './sync/bucket/CrudTransaction.js';
2525
import {
2626
DEFAULT_CRUD_UPLOAD_THROTTLE_MS,
27-
type PowerSyncConnectionOptionalOptions,
27+
type AdditionalConnectionOptions,
2828
type PowerSyncConnectionOptions,
2929
StreamingSyncImplementation,
3030
StreamingSyncImplementationListener
@@ -36,7 +36,7 @@ export interface DisconnectAndClearOptions {
3636
clearLocal?: boolean;
3737
}
3838

39-
export interface BasePowerSyncDatabaseOptions extends PowerSyncConnectionOptionalOptions {
39+
export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions {
4040
/** Schema used for the local database. */
4141
schema: Schema;
4242
logger?: ILogger;
@@ -233,7 +233,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
233233

234234
protected abstract generateSyncStreamImplementation(
235235
connector: PowerSyncBackendConnector,
236-
options?: PowerSyncConnectionOptionalOptions
236+
options?: AdditionalConnectionOptions
237237
): StreamingSyncImplementation;
238238

239239
protected abstract generateBucketStorageAdapter(): BucketStorageAdapter;

packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,16 @@ export interface LockOptions<T> {
3737
signal?: AbortSignal;
3838
}
3939

40-
export interface AbstractStreamingSyncImplementationOptions {
40+
export interface AbstractStreamingSyncImplementationOptions extends AdditionalConnectionOptions {
4141
adapter: BucketStorageAdapter;
4242
uploadCrud: () => Promise<void>;
43-
crudUploadThrottleMs?: number;
4443
/**
4544
* An identifier for which PowerSync DB this sync implementation is
4645
* linked to. Most commonly DB name, but not restricted to DB name.
4746
*/
4847
identifier?: string;
4948
logger?: ILogger;
5049
remote: AbstractRemote;
51-
retryDelayMs?: number;
5250
}
5351

5452
export interface StreamingSyncImplementationListener extends BaseListener {
@@ -67,34 +65,36 @@ export interface StreamingSyncImplementationListener extends BaseListener {
6765
* Configurable options to be used when connecting to the PowerSync
6866
* backend instance.
6967
*/
70-
export interface PowerSyncConnectionOptions extends PowerSyncConnectionOptionalOptions, PowerSyncConnectionRequiredOptions {}
68+
export interface PowerSyncConnectionOptions extends DefaultConnectionOptions, AdditionalConnectionOptions {}
7169

72-
export interface PowerSyncConnectionRequiredOptions {
70+
/** @internal */
71+
export interface DefaultConnectionOptions {
7372
/**
7473
* The connection method to use when streaming updates from
7574
* the PowerSync backend instance.
7675
* Defaults to a HTTP streaming connection.
7776
*/
78-
connectionMethod: SyncStreamConnectionMethod;
77+
connectionMethod?: SyncStreamConnectionMethod;
7978

8079
/**
8180
* These parameters are passed to the sync rules, and will be available under the`user_parameters` object.
8281
*/
83-
params: Record<string, StreamingSyncRequestParameterType>;
82+
params?: Record<string, StreamingSyncRequestParameterType>;
8483
}
8584

86-
export interface PowerSyncConnectionOptionalOptions {
87-
/**
85+
/** @internal */
86+
export interface AdditionalConnectionOptions {
87+
/**
8888
* Delay for retrying sync streaming operations
8989
* from the PowerSync backend after an error occurs.
9090
*/
91-
retryDelayMs?: number;
92-
/**
93-
* Backend Connector CRUD operations are throttled
94-
* to occur at most every `crudUploadThrottleMs`
95-
* milliseconds.
96-
*/
97-
crudUploadThrottleMs?: number;
91+
retryDelayMs?: number;
92+
/**
93+
* Backend Connector CRUD operations are throttled
94+
* to occur at most every `crudUploadThrottleMs`
95+
* milliseconds.
96+
*/
97+
crudUploadThrottleMs?: number;
9898
}
9999

100100
export interface StreamingSyncImplementation extends BaseObserver<StreamingSyncImplementationListener>, Disposable {
@@ -126,7 +126,9 @@ export const DEFAULT_STREAMING_SYNC_OPTIONS = {
126126
crudUploadThrottleMs: DEFAULT_CRUD_UPLOAD_THROTTLE_MS
127127
};
128128

129-
export const DEFAULT_STREAM_CONNECTION_OPTIONS: PowerSyncConnectionRequiredOptions = {
129+
export type RequiredPowerSyncConnectionOptions = Required<DefaultConnectionOptions>;
130+
131+
export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions = {
130132
connectionMethod: SyncStreamConnectionMethod.WEB_SOCKET,
131133
params: {}
132134
};
@@ -444,7 +446,7 @@ The next upload iteration will be delayed.`);
444446
type: LockType.SYNC,
445447
signal,
446448
callback: async () => {
447-
const resolvedOptions: PowerSyncConnectionRequiredOptions = {
449+
const resolvedOptions: RequiredPowerSyncConnectionOptions = {
448450
...DEFAULT_STREAM_CONNECTION_OPTIONS,
449451
...(options ?? {})
450452
};

packages/web/src/db/PowerSyncDatabase.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
type PowerSyncBackendConnector,
44
type PowerSyncCloseOptions,
55
type PowerSyncConnectionOptions,
6-
type PowerSyncConnectionOptionalOptions,
6+
type AdditionalConnectionOptions,
77
AbstractPowerSyncDatabase,
88
DBAdapter,
99
DEFAULT_POWERSYNC_CLOSE_OPTIONS,
@@ -168,7 +168,7 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
168168
protected generateSyncStreamImplementation(
169169
connector: PowerSyncBackendConnector,
170170
// This is used to pass in options on connection instead of only during db creation
171-
options?: PowerSyncConnectionOptionalOptions
171+
options?: AdditionalConnectionOptions
172172
): StreamingSyncImplementation {
173173
const remote = new WebRemote(connector);
174174
// Use the options passed in during connect, or fallback to the options set during database creation

0 commit comments

Comments
 (0)