@idpass/data-collect-core / EventStorageAdapter
Interface: EventStorageAdapter
Defined in: interfaces/types.ts:354
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:356
Initialize the storage adapter (create tables, indexes, etc.)
Returns
Promise<void>
saveEvents()
saveEvents(
forms):Promise<string[]>
Defined in: interfaces/types.ts:358
Save multiple events and return their IDs
Parameters
forms
Returns
Promise<string[]>
getEvents()
getEvents():
Promise<FormSubmission[]>
Defined in: interfaces/types.ts:360
Get all events from storage
Returns
Promise<FormSubmission[]>
saveAuditLog()
saveAuditLog(
entries):Promise<void>
Defined in: interfaces/types.ts:362
Save multiple audit log entries
Parameters
entries
Returns
Promise<void>
getAuditLog()
getAuditLog():
Promise<AuditLogEntry[]>
Defined in: interfaces/types.ts:364
Get all audit log entries
Returns
Promise<AuditLogEntry[]>
updateEventSyncLevel()
updateEventSyncLevel(
id,syncLevel):Promise<void>
Defined in: interfaces/types.ts:366
Update the sync level of an event
Parameters
id
string
syncLevel
Returns
Promise<void>
updateAuditLogSyncLevel()
updateAuditLogSyncLevel(
id,syncLevel):Promise<void>
Defined in: interfaces/types.ts:368
Update the sync level of an audit log entry
Parameters
id
string
syncLevel
Returns
Promise<void>
getEventsSince()
getEventsSince(
timestamp):Promise<FormSubmission[]>
Defined in: interfaces/types.ts:370
Get events created since a specific timestamp
Parameters
timestamp
string | Date
Returns
Promise<FormSubmission[]>
getAuditLogsSince()
getAuditLogsSince(
timestamp):Promise<AuditLogEntry[]>
Defined in: interfaces/types.ts:372
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:374
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:382
Update sync levels for multiple events
Parameters
events
Returns
Promise<void>
getLastRemoteSyncTimestamp()
getLastRemoteSyncTimestamp():
Promise<string>
Defined in: interfaces/types.ts:384
Get the timestamp of the last remote sync
Returns
Promise<string>
setLastRemoteSyncTimestamp()
setLastRemoteSyncTimestamp(
timestamp):Promise<void>
Defined in: interfaces/types.ts:386
Set the timestamp of the last remote sync
Parameters
timestamp
string
Returns
Promise<void>
getLastLocalSyncTimestamp()
getLastLocalSyncTimestamp():
Promise<string>
Defined in: interfaces/types.ts:388
Get the timestamp of the last local sync
Returns
Promise<string>
setLastLocalSyncTimestamp()
setLastLocalSyncTimestamp(
timestamp):Promise<void>
Defined in: interfaces/types.ts:390
Set the timestamp of the last local sync
Parameters
timestamp
string
Returns
Promise<void>
getLastPullExternalSyncTimestamp()
getLastPullExternalSyncTimestamp():
Promise<string>
Defined in: interfaces/types.ts:392
Get the timestamp of the last external sync pull
Returns
Promise<string>
setLastPullExternalSyncTimestamp()
setLastPullExternalSyncTimestamp(
timestamp):Promise<void>
Defined in: interfaces/types.ts:394
Set the timestamp of the last external sync pull
Parameters
timestamp
string
Returns
Promise<void>
getLastPushExternalSyncTimestamp()
getLastPushExternalSyncTimestamp():
Promise<string>
Defined in: interfaces/types.ts:396
Get the timestamp of the last external sync push
Returns
Promise<string>
setLastPushExternalSyncTimestamp()
setLastPushExternalSyncTimestamp(
timestamp):Promise<void>
Defined in: interfaces/types.ts:398
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:400
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:402
Get complete audit trail for a specific entity
Parameters
entityGuid
string
Returns
Promise<AuditLogEntry[]>
clearStore()
clearStore():
Promise<void>
Defined in: interfaces/types.ts:404
Clear all data from the store (for testing)
Returns
Promise<void>
closeConnection()
closeConnection():
Promise<void>
Defined in: interfaces/types.ts:406
Close database connections and cleanup resources
Returns
Promise<void>
persistHashAnchor()
persistHashAnchor(
hash):Promise<void>
Defined in: interfaces/types.ts:408
Persist the latest hash anchor for tamper detection on restart
Parameters
hash
string
Returns
Promise<void>
getPersistedHashAnchor()
getPersistedHashAnchor():
Promise<string|null>
Defined in: interfaces/types.ts:410
Retrieve the previously persisted hash anchor, or null if none exists
Returns
Promise<string | null>