WebRemote
Extends
Constructors
new WebRemote()
new WebRemote(
connector,
logger,
options?): WebRemote
Parameters
| Parameter | Type | Default value |
|---|---|---|
connector | RemoteConnector | undefined |
logger | ILogger | DEFAULT_REMOTE_LOGGER |
options? | Partial<AbstractRemoteOptions> | undefined |
Returns
Overrides
Accessors
fetch
Get Signature
get fetch(): (input, init?) => Promise<Response>(input, init?) => Promise<Response>(input, init?) => Promise<Response>
Returns
Function
a fetch implementation (function) which can be called to perform fetch requests
Parameters
| Parameter | Type |
|---|---|
input | URL | RequestInfo |
init? | RequestInit |
Returns
Promise<Response>
Parameters
| Parameter | Type |
|---|---|
input | URL | RequestInfo |
init? | RequestInit |
Returns
Promise<Response>
Parameters
| Parameter | Type |
|---|---|
input | string | URL | Request |
init? | RequestInit |
Returns
Promise<Response>
Inherited from
Methods
fetchCredentials()
fetchCredentials(): Promise<null | PowerSyncCredentials>
Get credentials for PowerSync.
This should always fetch a fresh set of credentials - don't use cached values.
Returns
Promise<null | PowerSyncCredentials>
Inherited from
AbstractRemote.fetchCredentials
get()
get(path, headers?): Promise<any>
Parameters
| Parameter | Type |
|---|---|
path | string |
headers? | Record<string, string> |
Returns
Promise<any>
Inherited from
getBSON()
getBSON(): Promise<typeof BSON>
Provides a BSON implementation. The import nature of this varies depending on the platform
Returns
Promise<typeof BSON>
Overrides
getCredentials()
getCredentials(): Promise<null | PowerSyncCredentials>
Get credentials currently cached, or fetch new credentials if none are available.
These credentials may have expired already.
Returns
Promise<null | PowerSyncCredentials>
Inherited from
getUserAgent()
getUserAgent(): string
Returns
string
Overrides
invalidateCredentials()
invalidateCredentials(): void
Immediately invalidate credentials.
This may be called when the current credentials have expired.
Returns
void
Inherited from
AbstractRemote.invalidateCredentials
post()
post(
path,
data,
headers?): Promise<any>
Parameters
| Parameter | Type |
|---|---|
path | string |
data | any |
headers? | Record<string, string> |
Returns
Promise<any>
Inherited from
postStreamRaw()
postStreamRaw<T>(options, mapLine): Promise<DataStream<T, any>>
Connects to the sync/stream http endpoint, mapping and emitting each received string line.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
options | SyncStreamOptions |
mapLine | (line) => T |
Returns
Promise<DataStream<T, any>>
Inherited from
prefetchCredentials()
prefetchCredentials(): Promise<null | PowerSyncCredentials>
Fetch a new set of credentials and cache it.
Until this call succeeds, getCredentials will still return the
old credentials.
This may be called before the current credentials have expired.
Returns
Promise<null | PowerSyncCredentials>
Inherited from
AbstractRemote.prefetchCredentials
socketStreamRaw()
socketStreamRaw<T>(
options,
map,
bson?): Promise<DataStream<T, any>>
Returns a data stream of sync line data.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
options | SocketSyncStreamOptions | - |
map | (buffer) => T | Maps received payload frames to the typed event value. |
bson? | typeof BSON | A BSON encoder and decoder. When set, the data stream will be requested with a BSON payload (required for compatibility with older sync services). |
Returns
Promise<DataStream<T, any>>