Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions .changeset/sharp-pans-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/common': minor
---

Exposed the connection and connection option used by `connect()`
18 changes: 18 additions & 0 deletions packages/common/src/client/AbstractPowerSyncDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
return this.connectionManager.syncStreamImplementation;
}

/**
* The connector used to connect to the PowerSync service.
*
* @returns The connector used to connect to the PowerSync service or null if `connect()` has not been called.
*/
get connector() {
return this.connectionManager.connector;
}

/**
* The resolved connection options used to connect to the PowerSync service.
*
* @returns The resolved connection options used to connect to the PowerSync service or null if `connect()` has not been called.
*/
get connectionOptions() {
return this.connectionManager.connectionOptions;
}

protected _schema: Schema;

private _database: DBAdapter;
Expand Down
8 changes: 8 additions & 0 deletions packages/common/src/client/ConnectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ export class ConnectionManager extends BaseObserver<ConnectionManagerListener> {
this.syncDisposer = null;
}

get connector() {
return this.pendingConnectionOptions?.connector ?? null;
}

get connectionOptions() {
return this.pendingConnectionOptions?.options ?? null;
}

get logger() {
return this.options.logger;
}
Expand Down