Skip to main content

SyncStatus

Accessors

connected

Get Signature

get connected(): boolean;

Indicates if the client is currently connected to the PowerSync service.

Returns

boolean

True if connected, false otherwise. Defaults to false if not specified.


connecting

Get Signature

get connecting(): boolean;

Indicates if the client is in the process of establishing a connection to the PowerSync service.

Returns

boolean

True if connecting, false otherwise. Defaults to false if not specified.


dataFlowStatus

Get Signature

get dataFlowStatus(): SyncDataFlowStatus;
Deprecated

All fields on SyncDataFlowStatus are available on SyncStatus directly.

Returns

SyncDataFlowStatus


downloadError

Get Signature

get downloadError(): Error | undefined;

An error that occurred during downloads (including connection establishment errors).

A download error will be reported on all sync status entries until the next successful sync.

Returns

Error | undefined


downloading

Get Signature

get downloading(): boolean;

Whether the PowerSync SDK is currently downloading data from the connected PowerSync service.

Returns

boolean


downloadProgress

Get Signature

get downloadProgress(): SyncProgress | null;

A realtime progress report on how many operations have been downloaded and how many are necessary in total to complete the next sync iteration.

This field is only set when SyncStatus#downloading is also true.

Returns

SyncProgress | null


hasSynced

Get Signature

get hasSynced(): boolean | undefined;

Indicates whether there has been at least one full sync completed since initialization.

Returns

boolean | undefined

True if at least one sync has completed, false if no sync has completed, or undefined when the state is still being loaded from the database.


lastSyncedAt

Get Signature

get lastSyncedAt(): Date | undefined;

Time that a last sync has fully completed, if any. This timestamp is reset to null after a restart of the PowerSync service.

Returns

Date | undefined

The timestamp of the last successful sync, or undefined if no sync has completed.


priorityStatusEntries

Get Signature

get priorityStatusEntries(): SyncPriorityStatus[] | undefined;

Provides sync status information for all bucket priorities, sorted by priority (highest first).

Returns

SyncPriorityStatus[] | undefined

An array of status entries for different sync priority levels, sorted with highest priorities (lower numbers) first.


syncStreams

Get Signature

get syncStreams(): SyncStreamStatus[] | undefined;

All sync streams currently being tracked in the database.

This returns null when the database is currently being opened and we don't have reliable information about all included streams yet.

Returns

SyncStreamStatus[] | undefined


uploadError

Get Signature

get uploadError(): Error | undefined;

Error during uploading. Cleared on the next successful upload.

Returns

Error | undefined


uploading

Get Signature

get uploading(): boolean;

Whether the PowerSync SDK is currently uploading local mutations through the configured PowerSyncBackendConnector.

Returns

boolean

Methods

forStream()

forStream(stream): SyncStreamStatus | undefined;

If the stream appears in SyncStatus.syncStreams, returns the current status for that stream.

Parameters

ParameterType
streamSyncStreamDescription

Returns

SyncStreamStatus | undefined


getMessage()

getMessage(): string;

Creates a human-readable string representation of the current sync status. Includes information about connection state, sync completion, and data flow.

Returns

string

A string representation of the sync status


isEqual()

isEqual(status): boolean;

Compares this SyncStatus instance with another to determine if they are equal. Equality is determined by comparing the serialized JSON representation of both instances.

Parameters

ParameterTypeDescription
statusSyncStatusThe SyncStatus instance to compare against

Returns

boolean

True if the instances are considered equal, false otherwise


statusForPriority()

statusForPriority(priority): SyncPriorityStatus | undefined;

Reports the sync status (a pair of SyncStatus#hasSynced and SyncStatus#lastSyncedAt fields) for a specific bucket priority level.

When buckets with different priorities are declared, PowerSync may choose to synchronize higher-priority buckets first. When a consistent view over all buckets for all priorities up until the given priority is reached, PowerSync makes data from those buckets available before lower-priority buckets have finished syncing.

This method returns the status for the requested priority or the next higher priority level that has status information available. This is because when PowerSync makes data for a given priority available, all buckets in higher-priorities are guaranteed to be consistent with that checkpoint.

For example, if PowerSync just finished synchronizing buckets in priority level 3, calling this method with a priority of 1 may return information for priority level 3.

Parameters

ParameterTypeDescription
prioritynumberThe bucket priority for which the status should be reported

Returns

SyncPriorityStatus | undefined

Status information for the requested priority level or the next higher level with available status