Skip to content

Abstract Class: BaseSupabaseConnector

Defined in: packages/db/src/BaseConnector.ts:33

  • PowerSyncBackendConnector
new BaseSupabaseConnector(): BaseSupabaseConnector;

Defined in: node_modules/.bun/@powersync+common@1.47.0/node_modules/@powersync/common/lib/utils/BaseObserver.d.ts:10

BaseSupabaseConnector

BaseObserver<SupabaseConnectorListener>.constructor
abstract readonly client: SupabaseClient;

Defined in: packages/db/src/BaseConnector.ts:37


abstract readonly config: SupabaseConfig;

Defined in: packages/db/src/BaseConnector.ts:38


currentSession: Session | null = null;

Defined in: packages/db/src/BaseConnector.ts:41


ready: boolean = false;

Defined in: packages/db/src/BaseConnector.ts:40

fetchCredentials(): Promise<{
endpoint: string;
token: string;
}>;

Defined in: packages/db/src/BaseConnector.ts:105

Allows the PowerSync client to retrieve an authentication token from your backend which is used to authenticate against the PowerSync service.

This should always fetch a fresh set of credentials - don’t use cached values.

Return null if the user is not signed in. Throw an error if credentials cannot be fetched due to a network error or other temporary error.

This token is kept for the duration of a sync connection.

Promise<{ endpoint: string; token: string; }>

PowerSyncBackendConnector.fetchCredentials

getCurrentSession(): Promise<Session | null>;

Defined in: packages/db/src/BaseConnector.ts:55

Promise<Session | null>


init(): Promise<void>;

Defined in: packages/db/src/BaseConnector.ts:43

Promise<void>


login(username, password): Promise<void>;

Defined in: packages/db/src/BaseConnector.ts:67

ParameterType
usernamestring
passwordstring

Promise<void>


logout(): Promise<void>;

Defined in: packages/db/src/BaseConnector.ts:83

Promise<void>


register(email, password): Promise<void>;

Defined in: packages/db/src/BaseConnector.ts:92

ParameterType
emailstring
passwordstring

Promise<void>


updateSession(session): void;

Defined in: packages/db/src/BaseConnector.ts:184

ParameterType
sessionSession | null

void


uploadData(database): Promise<void>;

Defined in: packages/db/src/BaseConnector.ts:126

Upload local changes to the app backend.

Use AbstractPowerSyncDatabase.getCrudBatch to get a batch of changes to upload.

Any thrown errors will result in a retry after the configured wait period (default: 5 seconds).

ParameterType
databaseAbstractPowerSyncDatabase

Promise<void>

PowerSyncBackendConnector.uploadData