-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathPowerSyncBackendConnector.ts
More file actions
25 lines (23 loc) · 1.04 KB
/
PowerSyncBackendConnector.ts
File metadata and controls
25 lines (23 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { PowerSyncCredentials } from './PowerSyncCredentials.js';
import type { AbstractPowerSyncDatabase } from '../AbstractPowerSyncDatabase.js';
export interface PowerSyncBackendConnector {
/** 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.
*/
fetchCredentials: () => Promise<PowerSyncCredentials | null>;
/** Upload local changes to the app backend.
*
* Use {@link 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).
*/
uploadData: (database: AbstractPowerSyncDatabase) => Promise<void>;
}