Skip to main content

AttachmentService

Internal

Service for querying and watching attachment records in the database.

Constructors

new AttachmentService()

new AttachmentService(
db,
logger,
tableName?,
archivedCacheLimit?): AttachmentService

Parameters

ParameterType
dbAbstractPowerSyncDatabase
loggerILogger
tableName?string
archivedCacheLimit?number

Returns

AttachmentService

Methods

watchActiveAttachments()

watchActiveAttachments(__namedParameters?): DifferentialWatchedQuery<AttachmentRecord>

Creates a differential watch query for active attachments requiring synchronization.

Parameters

ParameterType
__namedParameters?{ throttleMs: number; }
__namedParameters.throttleMs?number

Returns

DifferentialWatchedQuery<AttachmentRecord>

Watch query that emits changes for queued uploads, downloads, and deletes


withContext()

withContext<T>(callback): Promise<T>

Executes a callback with exclusive access to the attachment context.

Type Parameters

Type Parameter
T

Parameters

ParameterType
callback(context) => Promise<T>

Returns

Promise<T>