Skip to main content

@idpass/data-collect-core / InternalSyncManager

Class: InternalSyncManager

Defined in: components/InternalSyncManager.ts:40

Manages bidirectional synchronization between local DataCollect instances and the remote sync server.

Thin wrapper around an XState actor that implements the sync statechart. The public API is preserved: sync(), isSyncing, setSelectiveSyncOptions(), hasUnsyncedEvents().

Constructors

Constructor

new InternalSyncManager(eventStore, entityStore, eventApplierService, syncServerUrl, authStorage, configId?, reauthenticate?): InternalSyncManager

Defined in: components/InternalSyncManager.ts:64

Parameters

eventStore

EventStore

entityStore

EntityStore

eventApplierService

EventApplierService

syncServerUrl

string

authStorage

AuthStorageAdapter

configId?

string = "default"

reauthenticate?

ReauthenticateCallback

Returns

InternalSyncManager

Accessors

isSyncing

Get Signature

get isSyncing(): boolean

Defined in: components/InternalSyncManager.ts:59

Whether a sync operation is currently running (read-only accessor).

Returns

boolean

Methods

setSelectiveSyncOptions()

setSelectiveSyncOptions(options): void

Defined in: components/InternalSyncManager.ts:118

Sets selective sync options for area-based and entity-based filtering.

Parameters

options

SelectiveSyncOptions

Returns

void


getSelectiveSyncOptions()

getSelectiveSyncOptions(): SelectiveSyncOptions

Defined in: components/InternalSyncManager.ts:125

Gets the current selective sync options.

Returns

SelectiveSyncOptions


getUnsyncedEventsCount()

getUnsyncedEventsCount(): Promise<number>

Defined in: components/InternalSyncManager.ts:132

Gets the count of events waiting to be synchronized with the server.

Returns

Promise<number>


hasUnsyncedEvents()

hasUnsyncedEvents(): Promise<boolean>

Defined in: components/InternalSyncManager.ts:141

Checks if there are any events waiting to be synchronized.

Returns

Promise<boolean>


checkIfDuplicatesExist()

checkIfDuplicatesExist(): Promise<boolean>

Defined in: components/InternalSyncManager.ts:151

Checks if there are any unresolved potential duplicates.

Returns

Promise<boolean>


sync()

sync(options?): Promise<void>

Defined in: components/InternalSyncManager.ts:159

Performs a complete bidirectional synchronization with the remote server.

Parameters

options?

SelectiveSyncOptions

Returns

Promise<void>