@@ -10,44 +10,22 @@ import { PowerSyncTransactor } from './PowerSyncTransactor'
1010import type {
1111 AbstractPowerSyncDatabase ,
1212 AttachmentData ,
13- AttachmentErrorHandler ,
14- ILogger ,
15- LocalStorageAdapter ,
16- RemoteStorageAdapter ,
17- WatchedAttachmentItem ,
13+ AttachmentQueueOptions ,
1814} from '@powersync/common'
1915import type { Collection } from '@tanstack/db'
2016
21- type AttachmentQueueRow = ( typeof _tmpSchema ) [ 'types' ] [ 'attachments' ]
17+ export type AttachmentQueueRow = ( typeof _tmpSchema ) [ 'types' ] [ 'attachments' ]
2218
23- /**
24- * This extends the default AttachmentQueue constructor params
25- * FIXME(powersync) we should export this type from the common SDK.
26- */
27- type TanStackDBAttachmentQueueOptions = {
28- db : AbstractPowerSyncDatabase
19+ export type TanStackDBAttachmentQueueOptions = AttachmentQueueOptions & {
2920 /**
3021 * For TanStack, we want access to the synced TanStackDB collection.
3122 * In order to have the same relational data be set in a single transaction.
3223 * This also allows for joining both TanStackDB collections.
3324 */
34- attachmentsCollection : Collection < AttachmentQueueRow >
35- remoteStorage : RemoteStorageAdapter
36- localStorage : LocalStorageAdapter
37- watchAttachments : (
38- onUpdate : ( attachment : Array < WatchedAttachmentItem > ) => Promise < void > ,
39- signal : AbortSignal ,
40- ) => void
41- tableName ?: string
42- logger ?: ILogger
43- syncIntervalMs ?: number
44- syncThrottleDuration ?: number
45- downloadAttachments ?: boolean
46- archivedCacheLimit ?: number
47- errorHandler ?: AttachmentErrorHandler
25+ attachmentsCollection : Collection < AttachmentQueueRow , string >
4826}
4927
50- interface SaveFileTanStackOptions {
28+ export interface SaveFileTanStackOptions {
5129 data : AttachmentData
5230 fileExtension : string
5331 mediaType ?: string
@@ -60,7 +38,7 @@ interface SaveFileTanStackOptions {
6038 updateHook ?: ( attachment : AttachmentQueueRow ) => Promise < void >
6139}
6240
63- interface DeleteFileTanStackOptions {
41+ export interface DeleteFileTanStackOptions {
6442 id : string
6543 updateHook ?: ( attachment : AttachmentQueueRow ) => Promise < void >
6644}
@@ -74,7 +52,7 @@ const _tmpSchema = new Schema({
7452 */
7553export class TanStackDBAttachmentQueue extends AttachmentQueue {
7654 readonly powersync : AbstractPowerSyncDatabase
77- readonly collection : Collection < AttachmentQueueRow >
55+ readonly collection : Collection < AttachmentQueueRow , string >
7856
7957 constructor ( params : TanStackDBAttachmentQueueOptions ) {
8058 super ( params )
0 commit comments