Skip to content

Commit

Permalink
add comments and make AttachmentTable options optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Manrich121 committed Oct 31, 2023
1 parent 025088a commit 6e874c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions packages/powersync-attachments/src/AbstractAttachmentQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ import {
export interface AttachmentQueueOptions {
powersync: AbstractPowerSyncDatabase;
storage: StorageAdapter;
/**
* How often to check for new attachments to sync, in milliseconds. Set to 0 or undefined to disable.
*/
syncInterval?: number;
/**
* How many attachments to keep in the cache
*/
cacheLimit?: number;
attachmentDirectoryName?: string;
/**
* Whether to mark the initial watched attachment IDs to be synced
*/
performInitialSync?: boolean;
}

Expand Down
5 changes: 3 additions & 2 deletions packages/powersync-attachments/src/definitions/Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ export enum AttachmentState {
ARCHIVED = 4, // Attachment has been orphaned, i.e. the associated record has been deleted
}

export interface AttachmentTableOptions extends Omit<TableOptions, "name"> {
export interface AttachmentTableOptions
extends Omit<TableOptions, "name" | "columns"> {
name?: string;
additionalColumns?: Column[];
}

export class AttachmentTable extends Table {
constructor(options: AttachmentTableOptions) {
constructor(options?: AttachmentTableOptions) {
super({
...options,
name: options.name ?? ATTACHMENT_TABLE,
Expand Down

0 comments on commit 6e874c1

Please sign in to comment.