Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/common/src/client/AbstractPowerSyncDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
* Current connection status.
*/
currentStatus: SyncStatus;
connectionOptions: PowerSyncConnectionOptions;

sdkVersion: string;

Expand Down Expand Up @@ -514,6 +515,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
*/
async connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions) {
const resolvedOptions: InternalConnectionOptions = options ?? {};
this.connectionOptions = resolvedOptions;
resolvedOptions.serializedSchema = this.schema.toJSON();

return this.connectionManager.connect(connector, resolvedOptions);
Expand Down Expand Up @@ -592,6 +594,15 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
await this.iterateAsyncListeners(async (cb) => cb.closed?.());
}

/**
* Get the connection options used to connect to the PowerSync backend instance.
*
* @returns The connection options used to connect to the PowerSync backend instance.
*/
getConnectionOptions(): PowerSyncConnectionOptions | null {
return this.connectionOptions ?? null;
}

/**
* Get upload queue size estimate and count.
*/
Expand Down