Skip to main content

Type Alias: RemoteResolver

type RemoteResolver =
| string
| PouchDB.Database
| (stack) => string | PouchDB.Database | Promise<string | PouchDB.Database>;

Defined in: client/lib/core/sync/index.d.ts:42

How a stack finds its remote.

A function is the useful form for transports that need per-stack configuration or a credential that expires - DocStack calls it again on every StackSyncHandle.restart, so a refreshed token reaches the new replication without the caller reaching into DocStack. DocStack never learns anything about the transport itself.

Example

// Google Drive, one folder per stack, token owned by the application.
const remote = (stack) => new PouchDB(stack.getDbName(), {
adapter: "googledrive",
accessToken: async () => auth.getAccessToken(),
folderName: `tokido/${stack.name}`,
});