@@ -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
5452export 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
100100export 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 } ;
0 commit comments