Skip to main content

@idpass/data-collect-core / EventStorageAdapter

Interface: EventStorageAdapter

Defined in: interfaces/types.ts:336

Storage adapter interface for event persistence.

Provides the low-level storage operations for events and audit logs. Implementations include IndexedDbEventStorageAdapter and PostgresEventStorageAdapter.

Methods

initialize()

initialize(): Promise<void>

Defined in: interfaces/types.ts:338

Initialize the storage adapter (create tables, indexes, etc.)

Returns

Promise<void>


saveEvents()

saveEvents(forms): Promise<string[]>

Defined in: interfaces/types.ts:340

Save multiple events and return their IDs

Parameters

forms

FormSubmission[]

Returns

Promise<string[]>


getEvents()

getEvents(): Promise<FormSubmission[]>

Defined in: interfaces/types.ts:342

Get all events from storage

Returns

Promise<FormSubmission[]>


saveAuditLog()

saveAuditLog(entries): Promise<void>

Defined in: interfaces/types.ts:344

Save multiple audit log entries

Parameters

entries

AuditLogEntry[]

Returns

Promise<void>


getAuditLog()

getAuditLog(): Promise<AuditLogEntry[]>

Defined in: interfaces/types.ts:346

Get all audit log entries

Returns

Promise<AuditLogEntry[]>


saveMerkleRoot()

saveMerkleRoot(root): Promise<void>

Defined in: interfaces/types.ts:348

Save Merkle tree root hash

Parameters

root

string

Returns

Promise<void>


getMerkleRoot()

getMerkleRoot(): Promise<string>

Defined in: interfaces/types.ts:350

Get current Merkle tree root hash

Returns

Promise<string>


updateEventSyncLevel()

updateEventSyncLevel(id, syncLevel): Promise<void>

Defined in: interfaces/types.ts:352

Update the sync level of an event

Parameters

id

string

syncLevel

SyncLevel

Returns

Promise<void>


updateAuditLogSyncLevel()

updateAuditLogSyncLevel(id, syncLevel): Promise<void>

Defined in: interfaces/types.ts:354

Update the sync level of an audit log entry

Parameters

id

string

syncLevel

SyncLevel

Returns

Promise<void>


getEventsSince()

getEventsSince(timestamp): Promise<FormSubmission[]>

Defined in: interfaces/types.ts:356

Get events created since a specific timestamp

Parameters

timestamp

string | Date

Returns

Promise<FormSubmission[]>


getAuditLogsSince()

getAuditLogsSince(timestamp): Promise<AuditLogEntry[]>

Defined in: interfaces/types.ts:358

Get audit logs created since a specific timestamp

Parameters

timestamp

string

Returns

Promise<AuditLogEntry[]>


getEventsSincePagination()

getEventsSincePagination(timestamp, limit): Promise<{ events: FormSubmission[]; nextCursor: string | Date | null; }>

Defined in: interfaces/types.ts:360

Get events since timestamp with pagination support (10 events/page default)

Parameters

timestamp

string | Date

limit

number

Returns

Promise<{ events: FormSubmission[]; nextCursor: string | Date | null; }>


updateSyncLevelFromEvents()

updateSyncLevelFromEvents(events): Promise<void>

Defined in: interfaces/types.ts:368

Update sync levels for multiple events

Parameters

events

FormSubmission[]

Returns

Promise<void>


getLastRemoteSyncTimestamp()

getLastRemoteSyncTimestamp(): Promise<string>

Defined in: interfaces/types.ts:370

Get the timestamp of the last remote sync

Returns

Promise<string>


setLastRemoteSyncTimestamp()

setLastRemoteSyncTimestamp(timestamp): Promise<void>

Defined in: interfaces/types.ts:372

Set the timestamp of the last remote sync

Parameters

timestamp

string

Returns

Promise<void>


getLastLocalSyncTimestamp()

getLastLocalSyncTimestamp(): Promise<string>

Defined in: interfaces/types.ts:374

Get the timestamp of the last local sync

Returns

Promise<string>


setLastLocalSyncTimestamp()

setLastLocalSyncTimestamp(timestamp): Promise<void>

Defined in: interfaces/types.ts:376

Set the timestamp of the last local sync

Parameters

timestamp

string

Returns

Promise<void>


getLastPullExternalSyncTimestamp()

getLastPullExternalSyncTimestamp(): Promise<string>

Defined in: interfaces/types.ts:378

Get the timestamp of the last external sync pull

Returns

Promise<string>


setLastPullExternalSyncTimestamp()

setLastPullExternalSyncTimestamp(timestamp): Promise<void>

Defined in: interfaces/types.ts:380

Set the timestamp of the last external sync pull

Parameters

timestamp

string

Returns

Promise<void>


getLastPushExternalSyncTimestamp()

getLastPushExternalSyncTimestamp(): Promise<string>

Defined in: interfaces/types.ts:382

Get the timestamp of the last external sync push

Returns

Promise<string>


setLastPushExternalSyncTimestamp()

setLastPushExternalSyncTimestamp(timestamp): Promise<void>

Defined in: interfaces/types.ts:384

Set the timestamp of the last external sync push

Parameters

timestamp

string

Returns

Promise<void>


isEventExisted()

isEventExisted(guid): Promise<boolean>

Defined in: interfaces/types.ts:386

Check if an event with the given GUID exists

Parameters

guid

string

Returns

Promise<boolean>


getAuditTrailByEntityGuid()

getAuditTrailByEntityGuid(entityGuid): Promise<AuditLogEntry[]>

Defined in: interfaces/types.ts:388

Get complete audit trail for a specific entity

Parameters

entityGuid

string

Returns

Promise<AuditLogEntry[]>


clearStore()

clearStore(): Promise<void>

Defined in: interfaces/types.ts:390

Clear all data from the store (for testing)

Returns

Promise<void>


closeConnection()

closeConnection(): Promise<void>

Defined in: interfaces/types.ts:392

Close database connections and cleanup resources

Returns

Promise<void>