From 0c2a990ca73f4ff5dc11d229e27e3db1611d64c9 Mon Sep 17 00:00:00 2001 From: Christiaan Landman Date: Wed, 10 Jun 2026 14:12:23 +0200 Subject: [PATCH 1/5] Fix for `createDiffTrigger` when using `setupContext` in single connection environments. --- .changeset/plenty-goats-relax.md | 6 +++ .../src/client/triggers/TriggerManagerImpl.ts | 6 +-- packages/web/tests/triggers.test.ts | 44 +++++++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 .changeset/plenty-goats-relax.md diff --git a/.changeset/plenty-goats-relax.md b/.changeset/plenty-goats-relax.md new file mode 100644 index 000000000..e0a7c18c0 --- /dev/null +++ b/.changeset/plenty-goats-relax.md @@ -0,0 +1,6 @@ +--- +'@powersync/common': minor +--- + +Fix `createDiffTrigger` acquiring its own read lock before running setup, even when a `setupContext` was provided. +On platforms where read and write access share a single connection (e.g. web), this deadlocked when `createDiffTrigger` was called inside a write lock. diff --git a/packages/common/src/client/triggers/TriggerManagerImpl.ts b/packages/common/src/client/triggers/TriggerManagerImpl.ts index 66f6908a6..5445e07a8 100644 --- a/packages/common/src/client/triggers/TriggerManagerImpl.ts +++ b/packages/common/src/client/triggers/TriggerManagerImpl.ts @@ -97,8 +97,8 @@ export class TriggerManagerImpl implements TriggerManager { return this.options.db; } - protected async getUUID() { - const { id: uuid } = await this.db.get<{ id: string }>(/* sql */ ` + protected async getUUID(ctx?: LockContext) { + const { id: uuid } = await (ctx ?? this.db).get<{ id: string }>(/* sql */ ` SELECT uuid () as id `); @@ -237,7 +237,7 @@ export class TriggerManagerImpl implements TriggerManager { const internalSource = sourceDefinition.internalName; const triggerIds: string[] = []; - const id = await this.getUUID(); + const id = await this.getUUID(setupContext); const releaseStorageClaim = useStorage ? await this.options.claimManager.obtainClaim(id) : null; diff --git a/packages/web/tests/triggers.test.ts b/packages/web/tests/triggers.test.ts index 585879f5b..677b188e9 100644 --- a/packages/web/tests/triggers.test.ts +++ b/packages/web/tests/triggers.test.ts @@ -190,6 +190,50 @@ describe('Triggers', () => { ); }); + it('should create a trigger inside an already-held write lock via setupContext', async () => { + const db = generateTestDb(); + + const destination = 'temp_setup_context_diff'; + + // Mirrors the on-demand sync path: the caller holds the write lock and passes + // its context in as setupContext. createDiffTrigger must not acquire any + // additional locks, since read and write access share a single connection + // queue on web — a nested lock request deadlocks against the held write lock. + const triggerCreated = db.writeLock(async (tx) => + db.triggers.createDiffTrigger({ + source: TEST_SCHEMA.props.customers.name, + destination, + when: { + [DiffTriggerOperation.INSERT]: 'TRUE' + }, + setupContext: tx + }) + ); + + const dispose = await Promise.race([ + triggerCreated, + new Promise((_, reject) => + setTimeout( + () => + reject( + new Error('Deadlock: createDiffTrigger requested a new lock while the setupContext write lock was held') + ), + 5_000 + ) + ) + ]); + + onTestFinished(() => dispose()); + + // Sanity check that the trigger is functional + await db.execute("INSERT INTO customers (id, name) VALUES (uuid(), 'setup-context')"); + + await vi.waitFor(async () => { + const rows = await db.getAll(`SELECT * FROM ${destination}`); + expect(rows.length).toEqual(1); + }); + }); + it('should report diff operations across clients (insert from client B observed by client A)', async () => { const openDB = (filename: string) => generateTestDb({ From 00cfd3afb70acfec44b2efd8c9692f36b8339042 Mon Sep 17 00:00:00 2001 From: Christiaan Landman Date: Wed, 10 Jun 2026 14:39:29 +0200 Subject: [PATCH 2/5] Updated common.api.md --- packages/common/etc/common.api.md | 4882 ++++++++++++++--------------- 1 file changed, 2441 insertions(+), 2441 deletions(-) diff --git a/packages/common/etc/common.api.md b/packages/common/etc/common.api.md index e01008179..64bf23062 100644 --- a/packages/common/etc/common.api.md +++ b/packages/common/etc/common.api.md @@ -1,2441 +1,2441 @@ -## API Report File for "@powersync/common" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { fetch as fetch_2 } from 'cross-fetch'; -import { GlobalLogger } from 'js-logger'; -import { ILogger } from 'js-logger'; -import { ILoggerOpts } from 'js-logger'; -import { ILogHandler } from 'js-logger'; -import { ILogLevel } from 'js-logger'; -import Logger from 'js-logger'; - -// Warning: (ae-internal-missing-underscore) The name "AbortOperation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class AbortOperation extends Error { - constructor(reason: string); - // (undocumented) - protected reason: string; -} - -// Warning: (ae-incompatible-release-tags) The symbol "AbstractPowerSyncDatabase" is marked as @public, but its signature references "BaseObserver" which is marked as @internal -// -// @public (undocumented) -export abstract class AbstractPowerSyncDatabase extends BaseObserver { - constructor(options: PowerSyncDatabaseOptionsWithDBAdapter); - constructor(options: PowerSyncDatabaseOptionsWithOpenFactory); - constructor(options: PowerSyncDatabaseOptionsWithSettings); - constructor(options: PowerSyncDatabaseOptions); - // Warning: (ae-incompatible-release-tags) The symbol "bucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal - // - // (undocumented) - protected bucketStorageAdapter: BucketStorageAdapter; - close(options?: PowerSyncCloseOptions): Promise; - closed: boolean; - connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise; - get connected(): boolean; - // (undocumented) - get connecting(): boolean; - // Warning: (ae-incompatible-release-tags) The symbol "connectionManager" is marked as @public, but its signature references "ConnectionManager" which is marked as @internal - // - // (undocumented) - protected connectionManager: ConnectionManager; - // Warning: (ae-incompatible-release-tags) The symbol "connectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal - get connectionOptions(): InternalConnectionOptions | null; - get connector(): PowerSyncBackendConnector | null; - currentStatus: SyncStatus; - customQuery(query: WatchCompatibleQuery): Query; - get database(): DBAdapter; - disconnect(): Promise; - disconnectAndClear(options?: DisconnectAndClearOptions): Promise; - // @deprecated (undocumented) - dispose(): void; - execute(sql: string, parameters?: any[]): Promise; - executeBatch(sql: string, parameters?: any[][]): Promise; - executeRaw(sql: string, parameters?: any[]): Promise; - // Warning: (ae-incompatible-release-tags) The symbol "generateBucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal - // - // (undocumented) - protected abstract generateBucketStorageAdapter(): BucketStorageAdapter; - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal - // - // (undocumented) - protected abstract generateSyncStreamImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions): StreamingSyncImplementation; - // Warning: (ae-incompatible-release-tags) The symbol "generateTriggerManagerConfig" is marked as @public, but its signature references "TriggerManagerConfig" which is marked as @internal - protected generateTriggerManagerConfig(): TriggerManagerConfig; - get(sql: string, parameters?: any[]): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getClientId(): Promise; - getCrudBatch(limit?: number): Promise; - getCrudTransactions(): AsyncIterable; - getNextCrudTransaction(): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - getUploadQueueStats(includeSize?: boolean): Promise; - init(): Promise; - protected initialize(): Promise; - abstract _initialize(): Promise; - // (undocumented) - protected _isReadyPromise: Promise; - // (undocumented) - protected loadVersion(): Promise; - // (undocumented) - logger: ILogger; - onChange(options?: SQLOnChangeOptions): AsyncIterable; - onChange(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; - onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable; - onChangeWithCallback(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; - protected abstract openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter; - // (undocumented) - protected options: PowerSyncDatabaseOptions; - query(query: ArrayQueryDefinition): Query; - readLock(callback: (db: LockContext) => Promise): Promise; - readTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; - // (undocumented) - ready: boolean; - // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal - // - // (undocumented) - protected resolvedConnectionOptions(options: CreateSyncImplementationOptions): CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions; - // (undocumented) - protected resolveOfflineSyncStatus(): Promise; - resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise; - protected runExclusive(callback: () => Promise): Promise; - // Warning: (ae-incompatible-release-tags) The symbol "runExclusiveMutex" is marked as @public, but its signature references "Mutex" which is marked as @internal - // - // (undocumented) - protected runExclusiveMutex: Mutex; - get schema(): Schema<{ - [x: string]: Table; - }>; - // (undocumented) - protected _schema: Schema; - // (undocumented) - sdkVersion: string; - syncStream(name: string, params?: Record): SyncStream; - // Warning: (ae-incompatible-release-tags) The symbol "syncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal - // - // (undocumented) - get syncStreamImplementation(): StreamingSyncImplementation | null; - // Warning: (ae-incompatible-release-tags) The symbol "triggers" is marked as @public, but its signature references "TriggerManager" which is marked as @alpha - readonly triggers: TriggerManager; - // Warning: (ae-incompatible-release-tags) The symbol "triggersImpl" is marked as @public, but its signature references "TriggerManagerImpl" which is marked as @internal - // - // (undocumented) - protected triggersImpl: TriggerManagerImpl; - updateSchema(schema: Schema): Promise; - waitForFirstSync(request?: AbortSignal | { - signal?: AbortSignal; - priority?: number; - }): Promise; - // (undocumented) - waitForReady(): Promise; - waitForStatus(predicate: (status: SyncStatus) => any, signal?: AbortSignal): Promise; - watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; - watch(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; - watchWithAsyncGenerator(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; - watchWithCallback(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; - writeLock(callback: (db: LockContext) => Promise): Promise; - writeTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractPowerSyncDatabaseOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractPowerSyncDatabaseOpenFactory { - constructor(options: PowerSyncOpenFactoryOptions); - // (undocumented) - abstract generateInstance(options: PowerSyncDatabaseOptions): AbstractPowerSyncDatabase; - // (undocumented) - generateOptions(): PowerSyncDatabaseOptions; - // (undocumented) - getInstance(): AbstractPowerSyncDatabase; - // (undocumented) - protected abstract openDB(): DBAdapter; - // (undocumented) - protected options: PowerSyncOpenFactoryOptions; - get schema(): Schema<{ - [x: string]: Table; - }>; -} - -// Warning: (ae-forgotten-export) The symbol "MetaBaseObserver" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "WatchedQueryProcessorListener" needs to be exported by the entry point index.d.ts -// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export abstract class AbstractQueryProcessor extends MetaBaseObserver> implements WatchedQuery { - constructor(options: AbstractQueryProcessorOptions); - // (undocumented) - protected abortController: AbortController; - // (undocumented) - close(): Promise; - // (undocumented) - get closed(): boolean; - // (undocumented) - protected _closed: boolean; - // (undocumented) - protected constructInitialState(): WatchedQueryState; - // (undocumented) - protected disposeListeners: (() => void) | null; - protected init(signal: AbortSignal): Promise; - // (undocumented) - protected initialized: Promise; - protected iterateAsyncListenersWithError(callback: (listener: Partial>) => Promise | void): Promise; - protected abstract linkQuery(options: LinkQueryOptions): Promise; - // (undocumented) - protected options: AbstractQueryProcessorOptions; - // (undocumented) - protected get reportFetching(): boolean; - protected runWithReporting(callback: () => Promise): Promise; - // (undocumented) - readonly state: WatchedQueryState; - updateSettings(settings: Settings): Promise; - // (undocumented) - protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise; - // (undocumented) - protected updateState(update: Partial>): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AbstractQueryProcessorOptions { - // (undocumented) - db: AbstractPowerSyncDatabase; - // (undocumented) - placeholderData: Data; - // (undocumented) - watchOptions: Settings; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractRemote" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractRemote { - constructor(connector: RemoteConnector, logger?: ILogger, options?: Partial); - // (undocumented) - protected buildRequest(path: string): Promise<{ - url: string; - headers: { - 'content-type': string; - Authorization: string; - 'x-user-agent': string; - }; - }>; - // (undocumented) - protected connector: RemoteConnector; - // (undocumented) - protected createSocket(url: string): WebSocket; - // (undocumented) - createTextDecoder(): TextDecoder; - // (undocumented) - protected credentials: PowerSyncCredentials | null; - // (undocumented) - get fetch(): FetchImplementation; - fetchCredentials(): Promise; - fetchStream(options: SyncStreamOptions): Promise>; - protected fetchStreamRaw(options: SyncStreamOptions): Promise<{ - isBson: boolean; - stream: SimpleAsyncIterator; - }>; - // (undocumented) - get(path: string, headers?: Record): Promise; - getCredentials(): Promise; - // (undocumented) - getUserAgent(): string; - invalidateCredentials(): void; - // (undocumented) - protected logger: ILogger; - // (undocumented) - protected options: AbstractRemoteOptions; - // (undocumented) - post(path: string, data: any, headers?: Record): Promise; - prefetchCredentials(): Promise; - socketStreamRaw(options: SocketSyncStreamOptions): Promise>; - // (undocumented) - protected get supportsStreamingBinaryResponses(): boolean; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractRemoteOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type AbstractRemoteOptions = { - socketUrlTransformer: (url: string) => string; - fetchImplementation: FetchImplementation | FetchImplementationProvider; - fetchOptions?: {}; -}; - -// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractStreamingSyncImplementation extends BaseObserver implements StreamingSyncImplementation { - constructor(options: AbstractStreamingSyncImplementationOptions); - // (undocumented) - protected abortController: AbortController | null; - // (undocumented) - connect(options?: PowerSyncConnectionOptions): Promise; - // (undocumented) - protected crudUpdateListener?: () => void; - // (undocumented) - disconnect(): Promise; - // (undocumented) - dispose(): Promise; - // (undocumented) - getWriteCheckpoint(): Promise; - // (undocumented) - get isConnected(): boolean; - // (undocumented) - get lastSyncedAt(): Date | undefined; - // (undocumented) - protected logger: ILogger; - // (undocumented) - markConnectionMayHaveChanged(): void; - // (undocumented) - abstract obtainLock(lockOptions: LockOptions_2): Promise; - // (undocumented) - protected options: AbstractStreamingSyncImplementationOptions; - // Warning: (ae-forgotten-export) The symbol "RustIterationResult" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected streamingSyncIteration(signal: AbortSignal, options?: PowerSyncConnectionOptions): Promise; - // (undocumented) - protected streamingSyncPromise?: Promise<[void, void]>; - // (undocumented) - syncStatus: SyncStatus; - // (undocumented) - triggerCrudUpload(): void; - // (undocumented) - updateSubscriptions(subscriptions: SubscribedStream[]): void; - // (undocumented) - protected updateSyncStatus(options: SyncStatusOptions): void; - // (undocumented) - waitForReady(): Promise; - // (undocumented) - waitForStatus(status: SyncStatusOptions): Promise; - // (undocumented) - waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AbstractStreamingSyncImplementationOptions extends RequiredAdditionalConnectionOptions { - // (undocumented) - adapter: BucketStorageAdapter; - identifier?: string; - // (undocumented) - logger?: ILogger; - // (undocumented) - remote: AbstractRemote; - // (undocumented) - subscriptions: SubscribedStream[]; - // (undocumented) - uploadCrud: () => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AdditionalConnectionOptions { - crudUploadThrottleMs?: number; - retryDelayMs?: number; -} - -// @public -export class ArrayComparator implements WatchedQueryComparator { - constructor(options: ArrayComparatorOptions); - // (undocumented) - checkEquality(current: ItemType[], previous: ItemType[]): boolean; - // (undocumented) - protected options: ArrayComparatorOptions; -} - -// @public -export type ArrayComparatorOptions = { - compareBy: (item: ItemType) => string; -}; - -// @public -export interface ArrayQueryDefinition { - mapper?: (row: Record) => RowType; - // (undocumented) - parameters?: ReadonlyArray>; - // (undocumented) - sql: string; -} - -// @alpha -export const ATTACHMENT_TABLE = "attachments"; - -// @alpha -export class AttachmentContext { - constructor(db: AbstractPowerSyncDatabase, tableName: string | undefined, logger: ILogger, archivedCacheLimit: number); - readonly archivedCacheLimit: number; - // (undocumented) - clearQueue(): Promise; - readonly db: AbstractPowerSyncDatabase; - // (undocumented) - deleteArchivedAttachments(callback?: (attachments: AttachmentRecord[]) => Promise): Promise; - deleteAttachment(attachmentId: string): Promise; - getActiveAttachments(): Promise; - getArchivedAttachments(): Promise; - // (undocumented) - getAttachment(id: string): Promise; - getAttachments(): Promise; - readonly logger: ILogger; - saveAttachments(attachments: AttachmentRecord[]): Promise; - readonly tableName: string; - upsertAttachment(attachment: AttachmentRecord, context: Transaction): Promise; -} - -// @alpha (undocumented) -export type AttachmentData = ArrayBuffer | string; - -// @alpha -export interface AttachmentErrorHandler { - onDeleteError(attachment: AttachmentRecord, error: unknown): Promise; - onDownloadError(attachment: AttachmentRecord, error: unknown): Promise; - onUploadError(attachment: AttachmentRecord, error: unknown): Promise; -} - -// @alpha -export function attachmentFromSql(row: any): AttachmentRecord; - -// @alpha -export class AttachmentQueue implements AttachmentQueue { - constructor(input: { - db: AbstractPowerSyncDatabase; - remoteStorage: RemoteStorageAdapter; - localStorage: LocalStorageAdapter; - watchAttachments: (onUpdate: (attachment: WatchedAttachmentItem[]) => Promise, signal: AbortSignal) => void; - tableName?: string; - logger?: ILogger; - syncIntervalMs?: number; - syncThrottleDuration?: number; - downloadAttachments?: boolean; - archivedCacheLimit?: number; - errorHandler?: AttachmentErrorHandler; - }); - readonly archivedCacheLimit: number; - // (undocumented) - clearQueue(): Promise; - // (undocumented) - deleteFile(input: { - id: string; - updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; - }): Promise; - readonly downloadAttachments: boolean; - // (undocumented) - expireCache(): Promise; - generateAttachmentId(): Promise; - readonly localStorage: LocalStorageAdapter; - readonly logger: ILogger; - readonly remoteStorage: RemoteStorageAdapter; - saveFile(input: { - data: AttachmentData; - fileExtension: string; - mediaType?: string; - metaData?: string; - id?: string; - updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; - }): Promise; - startSync(): Promise; - stopSync(): Promise; - readonly syncIntervalMs: number; - syncStorage(): Promise; - readonly syncThrottleDuration: number; - readonly tableName: string; - verifyAttachments(): Promise; - withAttachmentContext(callback: (context: AttachmentContext) => Promise): Promise; -} - -// @alpha -export interface AttachmentRecord { - // (undocumented) - filename: string; - // (undocumented) - hasSynced?: boolean; - // (undocumented) - id: string; - // (undocumented) - localUri?: string; - // (undocumented) - mediaType?: string; - // (undocumented) - metaData?: string; - // (undocumented) - size?: number; - // (undocumented) - state: AttachmentState; - // (undocumented) - timestamp?: number; -} - -// Warning: (ae-internal-missing-underscore) The name "AttachmentService" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class AttachmentService { - constructor(db: AbstractPowerSyncDatabase, logger: ILogger, tableName?: string, archivedCacheLimit?: number); - watchActiveAttachments(input?: { - throttleMs?: number; - }): DifferentialWatchedQuery; - withContext(callback: (context: AttachmentContext) => Promise): Promise; -} - -// @alpha -export enum AttachmentState { - // (undocumented) - ARCHIVED = 4,// Attachment to be uploaded - // (undocumented) - QUEUED_DELETE = 2,// Attachment to be downloaded - // (undocumented) - QUEUED_DOWNLOAD = 1,// Attachment to be deleted - // (undocumented) - QUEUED_UPLOAD = 0,// Attachment has been synced - // (undocumented) - SYNCED = 3 -} - -// @alpha -export class AttachmentTable extends Table { - constructor(options?: AttachmentTableOptions); -} - -// @alpha (undocumented) -export interface AttachmentTableOptions extends Omit { -} - -// @public (undocumented) -export type BaseColumnType = { - type: ColumnType; -}; - -// @public (undocumented) -export interface BaseConnectionOptions { - appMetadata?: Record; - // @deprecated (undocumented) - clientImplementation?: SyncClientImplementation; - connectionMethod?: SyncStreamConnectionMethod; - fetchStrategy?: FetchStrategy; - includeDefaultStreams?: boolean; - params?: Record; - serializedSchema?: any; -} - -// @public (undocumented) -export type BaseListener = Record any) | undefined>; - -// Warning: (ae-internal-missing-underscore) The name "BaseObserver" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class BaseObserver implements BaseObserverInterface { - constructor(); - // (undocumented) - dispose(): void; - // (undocumented) - iterateAsyncListeners(cb: (listener: Partial) => Promise): Promise; - // (undocumented) - iterateListeners(cb: (listener: Partial) => any): void; - // (undocumented) - protected listeners: Set>; - registerListener(listener: Partial): () => void; -} - -// @public (undocumented) -export interface BaseObserverInterface { - // (undocumented) - registerListener(listener: Partial): () => void; -} - -// Warning: (ae-incompatible-release-tags) The symbol "BasePowerSyncDatabaseOptions" is marked as @public, but its signature references "AdditionalConnectionOptions" which is marked as @internal -// -// @public (undocumented) -export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions { - // (undocumented) - logger?: ILogger; - // @deprecated (undocumented) - retryDelay?: number; - schema: Schema; -} - -// @alpha -export interface BaseTriggerDiffRecord { - id: string; - operation: DiffTriggerOperation; - operation_id: TOperationId; - timestamp: string; -} - -// @public (undocumented) -export interface BatchedUpdateNotification { - // (undocumented) - groupedUpdates: Record; - // (undocumented) - rawUpdates: UpdateNotification[]; - // (undocumented) - tables: string[]; -} - -// Warning: (ae-internal-missing-underscore) The name "BucketStorageAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface BucketStorageAdapter extends BaseObserverInterface, Disposable_2 { - control(op: PowerSyncControlCommand, payload: string | Uint8Array | null): Promise; - getClientId(): Promise; - // (undocumented) - getCrudBatch(limit?: number): Promise; - // (undocumented) - getMaxOpId(): string; - // (undocumented) - hasCrud(): Promise; - // (undocumented) - hasMigratedSubkeys(): Promise; - // (undocumented) - init(): Promise; - // (undocumented) - migrateToFixedSubkeys(): Promise; - // (undocumented) - nextCrudItem(): Promise; - // (undocumented) - updateLocalTarget(cb: () => Promise): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "BucketStorageListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface BucketStorageListener extends BaseListener { - // (undocumented) - crudUpdate: () => void; -} - -// @public (undocumented) -export class Column { - constructor(options: ColumnOptions); - // (undocumented) - get name(): string; - // (undocumented) - protected options: ColumnOptions; - // (undocumented) - toJSON(): { - name: string; - type: ColumnType | undefined; - }; - // (undocumented) - get type(): ColumnType | undefined; -} - -// @public (undocumented) -export const column: { - text: BaseColumnType; - integer: BaseColumnType; - real: BaseColumnType; -}; - -// @public (undocumented) -export interface ColumnOptions { - // (undocumented) - name: string; - // (undocumented) - type?: ColumnType; -} - -// @public (undocumented) -export type ColumnsType = Record>; - -// @public (undocumented) -export enum ColumnType { - // (undocumented) - INTEGER = "INTEGER", - // (undocumented) - REAL = "REAL", - // (undocumented) - TEXT = "TEXT" -} - -// @public (undocumented) -export interface CompilableQuery { - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(): Promise; -} - -// @public (undocumented) -export function compilableQueryWatch(db: AbstractPowerSyncDatabase, query: CompilableQuery, handler: CompilableQueryWatchHandler, options?: SQLWatchOptions): void; - -// @public (undocumented) -export interface CompilableQueryWatchHandler { - // (undocumented) - onError?: (error: Error) => void; - // (undocumented) - onResult: (results: T[]) => void; -} - -// @public (undocumented) -export interface CompiledQuery { - // (undocumented) - readonly parameters: ReadonlyArray; - // (undocumented) - readonly sql: string; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionClosedError" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class ConnectionClosedError extends Error { - constructor(message: string); - // (undocumented) - static MATCHES(input: any): boolean; - // (undocumented) - static NAME: string; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManager" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class ConnectionManager extends BaseObserver { - constructor(options: ConnectionManagerOptions); - get activeStreams(): { - name: string; - params: Record | null; - }[]; - // (undocumented) - close(): Promise; - // (undocumented) - connect(connector: PowerSyncBackendConnector, options: InternalConnectionOptions): Promise; - protected connectingPromise: Promise | null; - // (undocumented) - protected connectInternal(): Promise; - // (undocumented) - get connectionOptions(): InternalConnectionOptions | null; - // (undocumented) - get connector(): PowerSyncBackendConnector | null; - disconnect(): Promise; - protected disconnectingPromise: Promise | null; - // (undocumented) - protected disconnectInternal(): Promise; - // (undocumented) - get logger(): ILogger; - // (undocumented) - protected options: ConnectionManagerOptions; - // Warning: (ae-forgotten-export) The symbol "StoredConnectionOptions" needs to be exported by the entry point index.d.ts - protected pendingConnectionOptions: StoredConnectionOptions | null; - // (undocumented) - protected performDisconnect(): Promise; - // (undocumented) - stream(adapter: InternalSubscriptionAdapter, name: string, parameters: Record | null): SyncStream; - protected syncDisposer: (() => Promise | void) | null; - // (undocumented) - syncStreamImplementation: StreamingSyncImplementation | null; - protected syncStreamInitPromise: Promise | null; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerListener extends BaseListener { - // (undocumented) - syncStreamCreated: (sync: StreamingSyncImplementation) => void; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerOptions { - // (undocumented) - createSyncImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions): Promise; - // (undocumented) - logger: ILogger; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerSyncImplementationResult" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerSyncImplementationResult { - onDispose: () => Promise | void; - // (undocumented) - sync: StreamingSyncImplementation; -} - -// @public (undocumented) -export interface ConnectionPool extends BaseObserverInterface { - // (undocumented) - close: () => void | Promise; - // (undocumented) - name: string; - // (undocumented) - readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - refreshSchema: () => Promise; - // (undocumented) - writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "ControlledExecutor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class ControlledExecutor { - constructor(task: (param: T) => Promise | void, options?: ControlledExecutorOptions); - // (undocumented) - dispose(): void; - // (undocumented) - schedule(param: T): void; -} - -// Warning: (ae-internal-missing-underscore) The name "ControlledExecutorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ControlledExecutorOptions { - throttleEnabled?: boolean; -} - -// @public -export function createBaseLogger(): typeof Logger; - -// Warning: (ae-forgotten-export) The symbol "BaseCreateDiffTriggerOptions" needs to be exported by the entry point index.d.ts -// -// @alpha -export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions { - destination: string; - setupContext?: LockContext; -} - -// @public -export function createLogger(name: string, options?: CreateLoggerOptions): ILogger; - -// @public (undocumented) -export interface CreateLoggerOptions { - // (undocumented) - logLevel?: ILogLevel; -} - -// Warning: (ae-internal-missing-underscore) The name "CreateSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export interface CreateSyncImplementationOptions extends AdditionalConnectionOptions { - // (undocumented) - subscriptions: SubscribedStream[]; -} - -// @public -export class CrudBatch { - constructor( - crud: CrudEntry[], - haveMore: boolean, - complete: (writeCheckpoint?: string) => Promise); - complete: (writeCheckpoint?: string) => Promise; - crud: CrudEntry[]; - haveMore: boolean; -} - -// @public -export class CrudEntry { - constructor(clientId: number, op: UpdateType, table: string, id: string, transactionId?: number, opData?: Record, previousValues?: Record, metadata?: string); - clientId: number; - // (undocumented) - equals(entry: CrudEntry): boolean; - // Warning: (ae-forgotten-export) The symbol "CrudEntryJSON" needs to be exported by the entry point index.d.ts - // - // (undocumented) - static fromRow(dbRow: CrudEntryJSON): CrudEntry; - // @deprecated - hashCode(): string; - id: string; - metadata?: string; - op: UpdateType; - opData?: Record; - previousValues?: Record; - table: string; - toComparisonArray(): (string | number | Record | undefined)[]; - // Warning: (ae-forgotten-export) The symbol "CrudEntryOutputJSON" needs to be exported by the entry point index.d.ts - toJSON(): CrudEntryOutputJSON; - transactionId?: number; -} - -// @public (undocumented) -export class CrudTransaction extends CrudBatch { - constructor( - crud: CrudEntry[], - complete: (checkpoint?: string) => Promise, - transactionId?: number | undefined); - complete: (checkpoint?: string) => Promise; - crud: CrudEntry[]; - transactionId?: number | undefined; -} - -// @public (undocumented) -export interface DBAdapter extends ConnectionPool, SqlExecutor, DBGetUtils { - // (undocumented) - readTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; - // (undocumented) - writeTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "DBAdapterDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function DBAdapterDefaultMixin ConnectionPool>(Base: TBase): { - new (...args: any[]): { - readTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; - writeTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - get(sql: string, parameters?: any[]): Promise; - execute(query: string, params?: any[]): Promise; - executeRaw(query: string, params?: any[]): Promise; - executeBatch(query: string, params?: any[][]): Promise; - name: string; - close: () => void | Promise; - readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - refreshSchema: () => Promise; - registerListener(listener: Partial): () => void; - }; -} & TBase; - -// @public (undocumented) -export interface DBAdapterListener extends BaseListener { - tablesUpdated: (updateNotification: BatchedUpdateNotification | UpdateNotification) => void; -} - -// @public (undocumented) -export interface DBGetUtils { - get(sql: string, parameters?: any[]): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "DBGetUtilsDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function DBGetUtilsDefaultMixin Omit>(Base: TBase): { - new (...args: any[]): { - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - get(sql: string, parameters?: any[]): Promise; - executeBatch(query: string, params?: any[][]): Promise; - execute: (query: string, params?: any[] | undefined) => Promise; - executeRaw: (query: string, params?: any[] | undefined) => Promise; - }; -} & TBase; - -// @public (undocumented) -export interface DBLockOptions { - // (undocumented) - timeoutMs?: number; -} - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_BATCH_LIMIT" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_CRUD_BATCH_LIMIT = 100; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_UPLOAD_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_COLUMN_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_INDEX_COLUMN_OPTIONS: Partial; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_INDEX_OPTIONS: Partial; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_LOCK_TIMEOUT_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const DEFAULT_LOCK_TIMEOUT_MS = 120000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_CLOSE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_DB_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_POWERSYNC_DB_OPTIONS: { - retryDelayMs: number; - crudUploadThrottleMs: number; -}; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_LOGGER" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_REMOTE_LOGGER: Logger.ILogger; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_RETRY_DELAY_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_RETRY_DELAY_MS = 5000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_ROW_COMPARATOR" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const DEFAULT_ROW_COMPARATOR: DifferentialWatchedQueryComparator; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAM_CONNECTION_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAMING_SYNC_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_STREAMING_SYNC_OPTIONS: { - retryDelayMs: number; - crudUploadThrottleMs: number; -}; - -// @public @deprecated -export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_TABLE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_TABLE_OPTIONS: { - indexes: never[]; - insertOnly: boolean; - localOnly: boolean; - trackPrevious: boolean; - trackMetadata: boolean; - ignoreEmptyUpdates: boolean; -}; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_QUERY_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_WATCH_QUERY_OPTIONS: WatchedQueryOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_WATCH_THROTTLE_MS = 30; - -// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class DifferentialQueryProcessor extends AbstractQueryProcessor>, DifferentialWatchedQuerySettings> implements DifferentialWatchedQuery { - constructor(options: DifferentialQueryProcessorOptions); - // (undocumented) - protected comparator: DifferentialWatchedQueryComparator; - // Warning: (ae-forgotten-export) The symbol "DataHashMap" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected differentiate(current: RowType[], previousMap: DataHashMap): { - diff: WatchedQueryDifferential; - map: DataHashMap; - hasChanged: boolean; - }; - // (undocumented) - protected linkQuery(options: LinkQueryOptions>): Promise; - // (undocumented) - protected options: DifferentialQueryProcessorOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface DifferentialQueryProcessorOptions extends AbstractQueryProcessorOptions> { - // (undocumented) - rowComparator?: DifferentialWatchedQueryComparator; -} - -// @public (undocumented) -export type DifferentialWatchedQuery = WatchedQuery>, DifferentialWatchedQuerySettings, DifferentialWatchedQueryListener>; - -// @public -export interface DifferentialWatchedQueryComparator { - compareBy: (item: RowType) => string; - keyBy: (item: RowType) => string; -} - -// @public (undocumented) -export interface DifferentialWatchedQueryListener extends WatchedQueryListener>> { - // (undocumented) - onDiff?: (diff: WatchedQueryDifferential) => void | Promise; -} - -// @public -export interface DifferentialWatchedQueryOptions extends WatchedQueryOptions { - placeholderData?: RowType[]; - rowComparator?: DifferentialWatchedQueryComparator; -} - -// @public -export interface DifferentialWatchedQuerySettings extends DifferentialWatchedQueryOptions { - query: WatchCompatibleQuery; -} - -// @alpha -export enum DiffTriggerOperation { - // (undocumented) - DELETE = "DELETE", - // (undocumented) - INSERT = "INSERT", - // (undocumented) - UPDATE = "UPDATE" -} - -// @public (undocumented) -export interface DisconnectAndClearOptions { - clearLocal?: boolean; -} - -// @public (undocumented) -interface Disposable_2 { - // (undocumented) - dispose: () => Promise | void; -} -export { Disposable_2 as Disposable } - -// Warning: (ae-internal-missing-underscore) The name "EMPTY_DIFFERENTIAL" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const EMPTY_DIFFERENTIAL: { - added: never[]; - all: never[]; - removed: never[]; - updated: never[]; - unchanged: never[]; -}; - -// @alpha (undocumented) -export enum EncodingType { - // (undocumented) - Base64 = "base64", - // (undocumented) - UTF8 = "utf8" -} - -// @public (undocumented) -export type ExtractColumnValueType> = T extends BaseColumnType ? R : unknown; - -// @alpha -export type ExtractedTriggerDiffRecord = T & { - [K in keyof Omit, 'id'> as `__${string & K}`]: TriggerDiffRecord[K]; -} & { - __previous_value?: string; -}; - -// Warning: (ae-internal-missing-underscore) The name "extractTableUpdates" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function extractTableUpdates(update: BatchedUpdateNotification | UpdateNotification): string[]; - -// @public -export const FalsyComparator: WatchedQueryComparator; - -// Warning: (ae-internal-missing-underscore) The name "FetchImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type FetchImplementation = typeof fetch_2; - -// Warning: (ae-internal-missing-underscore) The name "FetchImplementationProvider" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class FetchImplementationProvider { - // (undocumented) - getFetch(): FetchImplementation; -} - -// @public (undocumented) -export enum FetchStrategy { - Buffered = "buffered", - Sequential = "sequential" -} - -// @public -export class GetAllQuery implements WatchCompatibleQuery { - constructor(options: GetAllQueryOptions); - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(options: { - db: AbstractPowerSyncDatabase; - }): Promise; - // (undocumented) - protected options: GetAllQueryOptions; -} - -// @public -export type GetAllQueryOptions = { - sql: string; - parameters?: ReadonlyArray; - mapper?: (rawRow: Record) => RowType; -}; - -export { GlobalLogger } - -export { ILogger } - -export { ILoggerOpts } - -export { ILogHandler } - -export { ILogLevel } - -// @public (undocumented) -export class Index { - constructor(options: IndexOptions); - // (undocumented) - get columns(): IndexedColumn[]; - // (undocumented) - static createAscending(options: IndexOptions, columnNames: string[]): Index; - // (undocumented) - get name(): string; - // (undocumented) - protected options: IndexOptions; - // (undocumented) - toJSON(table: Table): { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }; -} - -// @public (undocumented) -export interface IndexColumnOptions { - // (undocumented) - ascending?: boolean; - // (undocumented) - name: string; -} - -// @public (undocumented) -export class IndexedColumn { - constructor(options: IndexColumnOptions); - // (undocumented) - get ascending(): boolean | undefined; - // (undocumented) - static createAscending(column: string): IndexedColumn; - // (undocumented) - get name(): string; - // (undocumented) - protected options: IndexColumnOptions; - // (undocumented) - toJSON(table: Table): { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }; -} - -// @public (undocumented) -export interface IndexOptions { - // (undocumented) - columns?: IndexedColumn[]; - // (undocumented) - name: string; -} - -// @public (undocumented) -export type IndexShorthand = Record; - -// Warning: (ae-internal-missing-underscore) The name "InternalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions { -} - -// Warning: (ae-internal-missing-underscore) The name "InternalSubscriptionAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface InternalSubscriptionAdapter { - // (undocumented) - firstStatusMatching(predicate: (status: SyncStatus) => any, abort?: AbortSignal): Promise; - // (undocumented) - resolveOfflineSyncStatus(): Promise; - // (undocumented) - rustSubscriptionsCommand(payload: any): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "InvalidSQLCharacters" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const InvalidSQLCharacters: RegExp; - -// Warning: (ae-internal-missing-underscore) The name "isBatchedUpdateNotification" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function isBatchedUpdateNotification(update: BatchedUpdateNotification | UpdateNotification): update is BatchedUpdateNotification; - -// Warning: (ae-internal-missing-underscore) The name "isDBAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isDBAdapter: (test: any) => test is DBAdapter; - -// Warning: (ae-internal-missing-underscore) The name "isPowerSyncDatabaseOptionsWithSettings" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isPowerSyncDatabaseOptionsWithSettings: (test: any) => test is PowerSyncDatabaseOptionsWithSettings; - -// Warning: (ae-internal-missing-underscore) The name "isSQLOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isSQLOpenFactory: (test: any) => test is SQLOpenFactory; - -// Warning: (ae-internal-missing-underscore) The name "isSQLOpenOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isSQLOpenOptions: (test: any) => test is SQLOpenOptions; - -// Warning: (ae-internal-missing-underscore) The name "LinkQueryOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface LinkQueryOptions { - // (undocumented) - abortSignal: AbortSignal; - // (undocumented) - settings: Settings; -} - -// @alpha -export interface LocalStorageAdapter { - clear(): Promise; - deleteFile(filePath: string): Promise; - fileExists(filePath: string): Promise; - getLocalUri(filename: string): string; - initialize(): Promise; - makeDir(path: string): Promise; - readFile(filePath: string): Promise; - rmDir(path: string): Promise; - saveFile(filePath: string, data: AttachmentData): Promise; -} - -// @public (undocumented) -export interface LockContext extends SqlExecutor, DBGetUtils { - connectionType?: 'writer' | 'queryOnly' | 'readOnly'; -} - -// @internal -interface LockOptions_2 { - // (undocumented) - callback: () => Promise; - // (undocumented) - signal?: AbortSignal; - // (undocumented) - type: LockType; -} - -// Warning: (ae-internal-missing-underscore) The name "LockOptions" should be prefixed with an underscore because the declaration is marked as @internal -export { LockOptions_2 as LockOptions } - -// Warning: (ae-internal-missing-underscore) The name "LockType" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum LockType { - // (undocumented) - CRUD = "crud", - // (undocumented) - SYNC = "sync" -} - -// @public (undocumented) -export const LogLevel: { - TRACE: Logger.ILogLevel; - DEBUG: Logger.ILogLevel; - INFO: Logger.ILogLevel; - TIME: Logger.ILogLevel; - WARN: Logger.ILogLevel; - ERROR: Logger.ILogLevel; - OFF: Logger.ILogLevel; -}; - -// Warning: (ae-internal-missing-underscore) The name "MAX_AMOUNT_OF_COLUMNS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const MAX_AMOUNT_OF_COLUMNS = 1999; - -// Warning: (ae-internal-missing-underscore) The name "MAX_OP_ID" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const MAX_OP_ID = "9223372036854775807"; - -// Warning: (ae-internal-missing-underscore) The name "MEMORY_TRIGGER_CLAIM_MANAGER" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const MEMORY_TRIGGER_CLAIM_MANAGER: TriggerClaimManager; - -// Warning: (ae-forgotten-export) The symbol "MutableDeep" needs to be exported by the entry point index.d.ts -// Warning: (ae-internal-missing-underscore) The name "MutableWatchedQueryState" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export type MutableWatchedQueryState = { - -readonly [P in keyof WatchedQueryState]: MutableDeep[P]>; -}; - -// Warning: (ae-internal-missing-underscore) The name "Mutex" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class Mutex { - // (undocumented) - acquire(abort?: AbortSignal): Promise; - // (undocumented) - runExclusive(fn: () => PromiseLike | T, abort?: AbortSignal): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class OnChangeQueryProcessor extends AbstractQueryProcessor> { - constructor(options: OnChangeQueryProcessorOptions); - // (undocumented) - protected checkEquality(current: Data, previous: Data): boolean; - // (undocumented) - protected linkQuery(options: LinkQueryOptions): Promise; - // (undocumented) - protected options: OnChangeQueryProcessorOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface OnChangeQueryProcessorOptions extends AbstractQueryProcessorOptions> { - // (undocumented) - comparator?: WatchedQueryComparator; -} - -// @public -export type OpId = string; - -// Warning: (ae-internal-missing-underscore) The name "ParsedQuery" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ParsedQuery { - // (undocumented) - parameters: any[]; - // (undocumented) - sqlStatement: string; -} - -// Warning: (ae-internal-missing-underscore) The name "parseQuery" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const parseQuery: (query: string | CompilableQuery, parameters: any[]) => ParsedQuery; - -// @public -export type PendingStatement = { - sql: string; - params: PendingStatementParameter[]; -}; - -// @public -export type PendingStatementParameter = 'Id' | { - Column: string; -} | 'Rest'; - -// @public (undocumented) -export interface PowerSyncBackendConnector { - fetchCredentials: () => Promise; - uploadData: (database: AbstractPowerSyncDatabase) => Promise; -} - -// @public (undocumented) -export interface PowerSyncCloseOptions { - disconnect?: boolean; -} - -// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncConnectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal -// -// @public -export type PowerSyncConnectionOptions = Omit; - -// Warning: (ae-internal-missing-underscore) The name "PowerSyncControlCommand" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum PowerSyncControlCommand { - CONNECTION_STATE = "connection", - // (undocumented) - NOTIFY_CRUD_UPLOAD_COMPLETED = "completed_upload", - // (undocumented) - NOTIFY_TOKEN_REFRESHED = "refreshed_token", - // (undocumented) - PROCESS_BSON_LINE = "line_binary", - // (undocumented) - PROCESS_TEXT_LINE = "line_text", - // (undocumented) - START = "start", - // (undocumented) - STOP = "stop", - // (undocumented) - UPDATE_SUBSCRIPTIONS = "update_subscriptions" -} - -// @public (undocumented) -export interface PowerSyncCredentials { - // (undocumented) - endpoint: string; - // (undocumented) - expiresAt?: Date; - // (undocumented) - token: string; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions { - database: DBAdapter | SQLOpenFactory | SQLOpenOptions; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithDBAdapter extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: DBAdapter; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithOpenFactory extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: SQLOpenFactory; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithSettings extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: SQLOpenOptions; -} - -// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncDBListener" is marked as @public, but its signature references "StreamingSyncImplementationListener" which is marked as @internal -// -// @public (undocumented) -export interface PowerSyncDBListener extends StreamingSyncImplementationListener { - // (undocumented) - closed: () => Promise | void; - // (undocumented) - closing: () => Promise | void; - // (undocumented) - initialized: () => void; - // (undocumented) - schemaChanged: (schema: Schema) => void; -} - -// Warning: (ae-internal-missing-underscore) The name "PowerSyncOpenFactoryOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface PowerSyncOpenFactoryOptions extends Partial, SQLOpenOptions { - schema: Schema; -} - -// @public -export interface ProgressWithOperations { - downloadedFraction: number; - downloadedOperations: number; - totalOperations: number; -} - -// Warning: (ae-internal-missing-underscore) The name "PSInternalTable" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum PSInternalTable { - // (undocumented) - BUCKETS = "ps_buckets", - // (undocumented) - CRUD = "ps_crud", - // (undocumented) - DATA = "ps_data", - // (undocumented) - OPLOG = "ps_oplog", - // (undocumented) - UNTYPED = "ps_untyped" -} - -// @public (undocumented) -export interface Query { - differentialWatch(options?: DifferentialWatchedQueryOptions): DifferentialWatchedQuery; - watch(options?: StandardWatchedQueryOptions): StandardWatchedQuery>>; -} - -// @public -export type QueryParam = string | number | boolean | null | undefined | bigint | Uint8Array; - -// @public -export type QueryResult = { - insertId?: number; - rowsAffected: number; - rows?: { - _array: any[]; - length: number; - item: (idx: number) => any; - }; -}; - -// Warning: (ae-forgotten-export) The symbol "RawTableTypeWithStatements" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "InferredRawTableType" needs to be exported by the entry point index.d.ts -// -// @public -export type RawTableType = RawTableTypeWithStatements | InferredRawTableType; - -// Warning: (ae-internal-missing-underscore) The name "RemoteConnector" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type RemoteConnector = { - fetchCredentials: () => Promise; - invalidateCredentials?: () => void; -}; - -// @alpha -export interface RemoteStorageAdapter { - deleteFile(attachment: AttachmentRecord): Promise; - downloadFile(attachment: AttachmentRecord): Promise; - uploadFile(fileData: ArrayBuffer, attachment: AttachmentRecord): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "RequiredAdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface RequiredAdditionalConnectionOptions extends Required { - // (undocumented) - subscriptions: SubscribedStream[]; -} - -// Warning: (ae-internal-missing-underscore) The name "RequiredPowerSyncConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type RequiredPowerSyncConnectionOptions = Required; - -// @public (undocumented) -export type RowType> = { - [K in keyof T['columnMap']]: ExtractColumnValueType; -} & { - id: string; -}; - -// @public -export enum RowUpdateType { - // (undocumented) - SQLITE_DELETE = 9, - // (undocumented) - SQLITE_INSERT = 18, - // (undocumented) - SQLITE_UPDATE = 23 -} - -// Warning: (ae-internal-missing-underscore) The name "runOnSchemaChange" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function runOnSchemaChange(callback: (signal: AbortSignal) => void, db: AbstractPowerSyncDatabase, options?: SQLWatchOptions): void; - -// @alpha -export function sanitizeSQL(strings: TemplateStringsArray, ...values: any[]): string; - -// @alpha -export function sanitizeUUID(uuid: string): string; - -// Warning: (ae-forgotten-export) The symbol "SchemaType" needs to be exported by the entry point index.d.ts -// -// @public -export class Schema { - constructor(tables: Table[] | S); - // (undocumented) - readonly props: S; - // Warning: (ae-forgotten-export) The symbol "RawTable" needs to be exported by the entry point index.d.ts - // - // (undocumented) - readonly rawTables: RawTable[]; - static rawTableToJson(table: RawTable): unknown; - // (undocumented) - readonly tables: Table[]; - // (undocumented) - toJSON(): { - tables: { - local_only: boolean | undefined; - insert_only: boolean | undefined; - include_old: any; - include_old_only_when_changed: boolean; - include_metadata: boolean | undefined; - ignore_empty_update: boolean | undefined; - name: string; - view_name: string; - columns: { - name: string; - type: ColumnType | undefined; - }[]; - indexes: { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }[]; - }[]; - raw_tables: unknown[]; - }; - // (undocumented) - readonly types: SchemaTableType; - // (undocumented) - validate(): void; - withRawTables(tables: Record): void; -} - -// @public (undocumented) -export type SchemaTableType = { - [K in keyof S]: RowType; -}; - -// Warning: (ae-internal-missing-underscore) The name "Semaphore" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class Semaphore { - constructor(elements: Iterable); - requestAll(abort?: AbortSignal): Promise<{ - items: T[]; - release: UnlockFn; - }>; - requestOne(abort?: AbortSignal): Promise<{ - item: T; - release: UnlockFn; - }>; - // (undocumented) - readonly size: number; -} - -// Warning: (ae-internal-missing-underscore) The name "SimpleAsyncIterator" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export type SimpleAsyncIterator = Pick, 'next'>; - -// Warning: (ae-internal-missing-underscore) The name "SocketSyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SocketSyncStreamOptions = SyncStreamOptions & { - fetchStrategy: FetchStrategy; -}; - -// @public (undocumented) -export interface SqlExecutor { - execute: (query: string, params?: any[] | undefined) => Promise; - // (undocumented) - executeBatch: (query: string, params?: any[][]) => Promise; - executeRaw: (query: string, params?: any[] | undefined) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "SqliteBucketStorage" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class SqliteBucketStorage extends BaseObserver implements BucketStorageAdapter { - constructor(db: DBAdapter, logger?: ILogger); - // (undocumented) - control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise; - // (undocumented) - dispose(): Promise; - // (undocumented) - getClientId(): Promise; - // (undocumented) - _getClientId(): Promise; - getCrudBatch(limit?: number): Promise; - // (undocumented) - getMaxOpId(): string; - // (undocumented) - hasCrud(): Promise; - // (undocumented) - hasMigratedSubkeys(): Promise; - // (undocumented) - init(): Promise; - // (undocumented) - migrateToFixedSubkeys(): Promise; - // (undocumented) - nextCrudItem(): Promise; - // (undocumented) - static _subkeyMigrationKey: string; - // (undocumented) - tableNames: Set; - // (undocumented) - updateLocalTarget(cb: () => Promise): Promise; - // (undocumented) - writeTransaction(callback: (tx: Transaction) => Promise, options?: { - timeoutMs: number; - }): Promise; -} - -// @public (undocumented) -export interface SQLOnChangeOptions { - // @deprecated (undocumented) - rawTableNames?: boolean; - // (undocumented) - signal?: AbortSignal; - // (undocumented) - tables?: string[]; - throttleMs?: number; - triggerImmediate?: boolean; -} - -// @public (undocumented) -export interface SQLOpenFactory { - openDB(): DBAdapter; -} - -// @public (undocumented) -export interface SQLOpenOptions { - dbFilename: string; - dbLocation?: string; - debugMode?: boolean; -} - -// @public (undocumented) -export interface SQLWatchOptions extends SQLOnChangeOptions { - comparator?: WatchedQueryComparator; -} - -// @public -export type StandardWatchedQuery = WatchedQuery>; - -// @public -export interface StandardWatchedQueryOptions extends WatchedQueryOptions { - comparator?: WatchedQueryComparator; - placeholderData?: RowType[]; -} - -// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface StreamingSyncImplementation extends BaseObserverInterface, Disposable_2 { - connect(options?: InternalConnectionOptions): Promise; - disconnect(): Promise; - // (undocumented) - getWriteCheckpoint: () => Promise; - // (undocumented) - isConnected: boolean; - // (undocumented) - markConnectionMayHaveChanged(): void; - // (undocumented) - syncStatus: SyncStatus; - // (undocumented) - triggerCrudUpload: () => void; - // (undocumented) - updateSubscriptions(subscriptions: SubscribedStream[]): void; - // (undocumented) - waitForReady(): Promise; - // (undocumented) - waitForStatus(status: SyncStatusOptions): Promise; - // (undocumented) - waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementationListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface StreamingSyncImplementationListener extends BaseListener { - statusChanged?: ((status: SyncStatus) => void) | undefined; - statusUpdated?: ((statusUpdate: SyncStatusOptions) => void) | undefined; -} - -// Warning: (ae-forgotten-export) The symbol "JSONValue" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export type StreamingSyncRequestParameterType = JSONValue; - -// Warning: (ae-internal-missing-underscore) The name "SubscribedStream" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SubscribedStream = { - name: string; - params: Record | null; -}; - -// @public @deprecated (undocumented) -export enum SyncClientImplementation { - RUST = "rust" -} - -// @public (undocumented) -export type SyncDataFlowStatus = Partial<{ - downloading: boolean; - uploading: boolean; - downloadError?: Error; - uploadError?: Error; - downloadProgress: InternalProgressInformation | null; - internalStreamSubscriptions: CoreStreamSubscription[] | null; -}>; - -// Warning: (ae-internal-missing-underscore) The name "SyncingService" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class SyncingService { - constructor(attachmentService: AttachmentService, localStorage: LocalStorageAdapter, remoteStorage: RemoteStorageAdapter, logger: ILogger, errorHandler?: AttachmentErrorHandler); - deleteArchivedAttachments(context: AttachmentContext): Promise; - deleteAttachment(attachment: AttachmentRecord, context: AttachmentContext): Promise; - downloadAttachment(attachment: AttachmentRecord): Promise; - processAttachments(attachments: AttachmentRecord[], context: AttachmentContext): Promise; - uploadAttachment(attachment: AttachmentRecord): Promise; -} - -// @public (undocumented) -export interface SyncPriorityStatus { - // (undocumented) - hasSynced?: boolean; - // (undocumented) - lastSyncedAt?: Date; - // (undocumented) - priority: number; -} - -// @public -export class SyncProgress implements ProgressWithOperations { - constructor(internal: InternalProgressInformation); - // (undocumented) - downloadedFraction: number; - // (undocumented) - downloadedOperations: number; - // (undocumented) - protected internal: InternalProgressInformation; - // (undocumented) - totalOperations: number; - untilPriority(priority: number): ProgressWithOperations; -} - -// @public (undocumented) -export class SyncStatus { - // Warning: (ae-incompatible-release-tags) The symbol "__constructor" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - constructor(options: SyncStatusOptions); - // @deprecated - get clientImplementation(): SyncClientImplementation | undefined; - get connected(): boolean; - get connecting(): boolean; - get dataFlowStatus(): SyncDataFlowStatus; - get downloadProgress(): SyncProgress | null; - forStream(stream: SyncStreamDescription): SyncStreamStatus | undefined; - getMessage(): string; - get hasSynced(): boolean | undefined; - isEqual(status: SyncStatus): boolean; - get lastSyncedAt(): Date | undefined; - // Warning: (ae-incompatible-release-tags) The symbol "options" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - // - // (undocumented) - protected options: SyncStatusOptions; - get priorityStatusEntries(): SyncPriorityStatus[]; - protected serializeError(error?: Error): { - name: string; - message: string; - stack: string | undefined; - } | undefined; - statusForPriority(priority: number): SyncPriorityStatus; - get syncStreams(): SyncStreamStatus[] | undefined; - // Warning: (ae-incompatible-release-tags) The symbol "toJSON" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - toJSON(): SyncStatusOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "SyncStatusOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SyncStatusOptions = { - connected?: boolean; - connecting?: boolean; - dataFlow?: SyncDataFlowStatus; - lastSyncedAt?: Date; - hasSynced?: boolean; - priorityStatusEntries?: SyncPriorityStatus[]; - clientImplementation?: SyncClientImplementation; -}; - -// @public -export interface SyncStream extends SyncStreamDescription { - subscribe(options?: SyncStreamSubscribeOptions): Promise; - unsubscribeAll(): Promise; -} - -// @public (undocumented) -export enum SyncStreamConnectionMethod { - // (undocumented) - HTTP = "http", - // (undocumented) - WEB_SOCKET = "web-socket" -} - -// @public -export interface SyncStreamDescription { - name: string; - parameters: Record | null; -} - -// Warning: (ae-internal-missing-underscore) The name "SyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SyncStreamOptions = { - path: string; - data: unknown; - headers?: Record; - abortSignal: AbortSignal; - fetchOptions?: Request; -}; - -// @public -export interface SyncStreamStatus { - // (undocumented) - priority: number | null; - // (undocumented) - progress: ProgressWithOperations | null; - // (undocumented) - subscription: SyncSubscriptionDescription; -} - -// @public (undocumented) -export interface SyncStreamSubscribeOptions { - priority?: 0 | 1 | 2 | 3; - ttl?: number; -} - -// @public (undocumented) -export interface SyncStreamSubscription extends SyncStreamDescription { - unsubscribe(): void; - waitForFirstSync(abort?: AbortSignal): Promise; -} - -// @public -export interface SyncSubscriptionDescription extends SyncStreamDescription { - // (undocumented) - active: boolean; - expiresAt: Date | null; - hasExplicitSubscription: boolean; - hasSynced: boolean; - isDefault: boolean; - lastSyncedAt: Date | null; -} - -// @public (undocumented) -export class Table { - constructor(columns: Columns, options?: TableV2Options); - // @deprecated - constructor(options: TableOptions); - // (undocumented) - get columnMap(): Columns; - // (undocumented) - get columns(): Column[]; - // (undocumented) - copyWithName(name: string): Table; - // (undocumented) - static createInsertOnly(options: TableOptions): Table; - // (undocumented) - static createLocalOnly(options: TableOptions): Table; - // @deprecated - static createTable(name: string, table: Table): Table; - // (undocumented) - get ignoreEmptyUpdates(): boolean; - // (undocumented) - get indexes(): Index[]; - // (undocumented) - get insertOnly(): boolean; - // (undocumented) - get internalName(): string; - // (undocumented) - get localOnly(): boolean; - // (undocumented) - protected _mappedColumns: Columns; - // (undocumented) - get name(): string; - // (undocumented) - protected options: TableOptions; - // (undocumented) - toJSON(): { - local_only: boolean | undefined; - insert_only: boolean | undefined; - include_old: any; - include_old_only_when_changed: boolean; - include_metadata: boolean | undefined; - ignore_empty_update: boolean | undefined; - name: string; - view_name: string; - columns: { - name: string; - type: ColumnType | undefined; - }[]; - indexes: { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }[]; - }; - // (undocumented) - get trackMetadata(): boolean; - // (undocumented) - get trackPrevious(): boolean | TrackPreviousOptions; - // (undocumented) - validate(): void; - // (undocumented) - get validName(): boolean; - // (undocumented) - get viewName(): string; - // (undocumented) - get viewNameOverride(): string | undefined; -} - -// Warning: (ae-forgotten-export) The symbol "SharedTableOptions" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export interface TableOptions extends SharedTableOptions { - // (undocumented) - columns: Column[]; - // (undocumented) - indexes?: Index[]; - name: string; -} - -// @public -export interface TableOrRawTableOptions { - // (undocumented) - ignoreEmptyUpdates?: boolean; - // (undocumented) - insertOnly?: boolean; - // (undocumented) - localOnly?: boolean; - // (undocumented) - trackMetadata?: boolean; - // (undocumented) - trackPrevious?: boolean | TrackPreviousOptions; -} - -// @public (undocumented) -export interface TableUpdateOperation { - // (undocumented) - opType: RowUpdateType; - // (undocumented) - rowId: number; -} - -// @public @deprecated -export class TableV2 extends Table { -} - -// @public (undocumented) -export interface TableV2Options extends SharedTableOptions { - // (undocumented) - indexes?: IndexShorthand; -} - -// Warning: (ae-internal-missing-underscore) The name "timeoutSignal" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function timeoutSignal(timeout: number): AbortSignal; - -// @internal (undocumented) -export function timeoutSignal(timeout?: number): AbortSignal | undefined; - -// @alpha -export interface TrackDiffOptions extends BaseCreateDiffTriggerOptions { - onChange: (context: TriggerDiffHandlerContext) => Promise; - throttleMs?: number; -} - -// @public -export interface TrackPreviousOptions { - columns?: string[]; - onlyWhenChanged?: boolean; -} - -// @public (undocumented) -export interface Transaction extends LockContext { - commit: () => Promise; - rollback: () => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerClaimManager" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export interface TriggerClaimManager { - checkClaim: (identifier: string) => Promise; - obtainClaim: (identifier: string) => Promise<() => Promise>; -} - -// @alpha -export interface TriggerCreationHooks { - beforeCreate?: (context: LockContext) => Promise; -} - -// @alpha -export interface TriggerDiffDeleteRecord extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.DELETE; - value: string; -} - -// @alpha -export interface TriggerDiffHandlerContext extends LockContext { - destinationTable: string; - withDiff: (query: string, params?: ReadonlyArray>, options?: WithDiffOptions) => Promise; - withExtractedDiff: (query: string, params?: ReadonlyArray>) => Promise; -} - -// @alpha -export interface TriggerDiffInsertRecord extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.INSERT; - value: string; -} - -// @alpha -export type TriggerDiffRecord = TriggerDiffUpdateRecord | TriggerDiffInsertRecord | TriggerDiffDeleteRecord; - -// @alpha -export interface TriggerDiffUpdateRecord extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.UPDATE; - previous_value: string; - value: string; -} - -// @alpha (undocumented) -export interface TriggerManager { - createDiffTrigger(options: CreateDiffTriggerOptions): Promise; - trackTableDiff(options: TrackDiffOptions): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerManagerConfig" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface TriggerManagerConfig { - // (undocumented) - claimManager: TriggerClaimManager; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerManagerImpl" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class TriggerManagerImpl implements TriggerManager { - constructor(options: TriggerManagerImplOptions); - cleanupResources(): Promise; - // (undocumented) - protected cleanupTimeout: ReturnType | null; - // (undocumented) - createDiffTrigger(options: CreateDiffTriggerOptions): Promise<(options?: TriggerRemoveCallbackOptions) => Promise>; - // (undocumented) - protected get db(): AbstractPowerSyncDatabase; - // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplConfiguration" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected defaultConfig: TriggerManagerImplConfiguration; - // (undocumented) - dispose(): void; - // (undocumented) - protected generateTriggerName(operation: DiffTriggerOperation, destinationTable: string, triggerId: string): string; - // (undocumented) - protected getUUID(): Promise; - // (undocumented) - protected isDisposed: boolean; - // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplOptions" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected options: TriggerManagerImplOptions; - // (undocumented) - protected removeTriggers(tx: LockContext, triggerIds: string[]): Promise; - // (undocumented) - protected schema: Schema; - // (undocumented) - trackTableDiff(options: TrackDiffOptions): Promise; - updateDefaults(config: TriggerManagerImplConfiguration): void; -} - -// @alpha -export type TriggerRemoveCallback = (options?: TriggerRemoveCallbackOptions) => Promise; - -// @alpha -export interface TriggerRemoveCallbackOptions { - // (undocumented) - context?: LockContext; -} - -// Warning: (ae-internal-missing-underscore) The name "UnlockFn" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type UnlockFn = () => void; - -// @public -export interface UpdateNotification extends TableUpdateOperation { - // (undocumented) - table: string; -} - -// @public -export enum UpdateType { - DELETE = "DELETE", - PATCH = "PATCH", - PUT = "PUT" -} - -// @public (undocumented) -export class UploadQueueStats { - constructor( - count: number, - size?: number | null); - count: number; - size: number | null; - // (undocumented) - toString(): string; -} - -// @public (undocumented) -export interface WatchCompatibleQuery { - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(options: WatchExecuteOptions): Promise; -} - -// @alpha -export type WatchedAttachmentItem = { - id: string; - filename: string; - fileExtension?: never; - metaData?: string; - mediaType?: string; -} | { - id: string; - fileExtension: string; - filename?: never; - metaData?: string; - mediaType?: string; -}; - -// Warning: (ae-forgotten-export) The symbol "MetaBaseObserverInterface" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export interface WatchedQuery = WatchedQueryListener> extends MetaBaseObserverInterface { - close(): Promise; - // (undocumented) - readonly closed: boolean; - registerListener(listener: Listener): () => void; - readonly state: WatchedQueryState; - updateSettings(options: Settings): Promise; -} - -// @public -export interface WatchedQueryComparator { - // (undocumented) - checkEquality: (current: Data, previous: Data) => boolean; -} - -// @public -export interface WatchedQueryDifferential { - // (undocumented) - readonly added: ReadonlyArray>; - readonly all: ReadonlyArray>; - // (undocumented) - readonly removed: ReadonlyArray>; - // (undocumented) - readonly unchanged: ReadonlyArray>; - // (undocumented) - readonly updated: ReadonlyArray>>; -} - -// @public (undocumented) -export interface WatchedQueryListener extends BaseListener { - // (undocumented) - [WatchedQueryListenerEvent.CLOSED]?: () => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_DATA]?: (data: Data) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_ERROR]?: (error: Error) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_STATE_CHANGE]?: (state: WatchedQueryState) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.SETTINGS_WILL_UPDATE]?: () => void; -} - -// @public (undocumented) -export enum WatchedQueryListenerEvent { - // (undocumented) - CLOSED = "closed", - // (undocumented) - ON_DATA = "onData", - // (undocumented) - ON_ERROR = "onError", - // (undocumented) - ON_STATE_CHANGE = "onStateChange", - // (undocumented) - SETTINGS_WILL_UPDATE = "settingsWillUpdate" -} - -// @public (undocumented) -export interface WatchedQueryOptions { - reportFetching?: boolean; - throttleMs?: number; - triggerOnTables?: string[]; -} - -// @public -export interface WatchedQueryRowDifferential { - // (undocumented) - readonly current: RowType; - // (undocumented) - readonly previous: RowType; -} - -// @public -export interface WatchedQuerySettings extends WatchedQueryOptions { - // (undocumented) - query: WatchCompatibleQuery; -} - -// @public -export interface WatchedQueryState { - readonly data: Data; - readonly error: Error | null; - readonly isFetching: boolean; - readonly isLoading: boolean; - readonly lastUpdated: Date | null; -} - -// @public -export interface WatchExecuteOptions { - // (undocumented) - db: AbstractPowerSyncDatabase; - // (undocumented) - parameters: any[]; - // (undocumented) - sql: string; -} - -// @public (undocumented) -export interface WatchHandler { - // (undocumented) - onError?: (error: Error) => void; - // (undocumented) - onResult: (results: QueryResult) => void; -} - -// @public (undocumented) -export interface WatchOnChangeEvent { - // (undocumented) - changedTables: string[]; -} - -// @public (undocumented) -export interface WatchOnChangeHandler { - // (undocumented) - onChange: (event: WatchOnChangeEvent) => Promise | void; - // (undocumented) - onError?: (error: Error) => void; -} - -// @alpha -export interface WithDiffOptions { - castOperationIdAsText?: boolean; -} - -// Warnings were encountered during analysis: -// -// lib/db/crud/SyncStatus.d.ts:27:5 - (ae-forgotten-export) The symbol "InternalProgressInformation" needs to be exported by the entry point index.d.ts -// lib/db/crud/SyncStatus.d.ts:31:5 - (ae-forgotten-export) The symbol "CoreStreamSubscription" needs to be exported by the entry point index.d.ts - -// (No @packageDocumentation comment for this package) - -``` +## API Report File for "@powersync/common" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { fetch as fetch_2 } from 'cross-fetch'; +import { GlobalLogger } from 'js-logger'; +import { ILogger } from 'js-logger'; +import { ILoggerOpts } from 'js-logger'; +import { ILogHandler } from 'js-logger'; +import { ILogLevel } from 'js-logger'; +import Logger from 'js-logger'; + +// Warning: (ae-internal-missing-underscore) The name "AbortOperation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class AbortOperation extends Error { + constructor(reason: string); + // (undocumented) + protected reason: string; +} + +// Warning: (ae-incompatible-release-tags) The symbol "AbstractPowerSyncDatabase" is marked as @public, but its signature references "BaseObserver" which is marked as @internal +// +// @public (undocumented) +export abstract class AbstractPowerSyncDatabase extends BaseObserver { + constructor(options: PowerSyncDatabaseOptionsWithDBAdapter); + constructor(options: PowerSyncDatabaseOptionsWithOpenFactory); + constructor(options: PowerSyncDatabaseOptionsWithSettings); + constructor(options: PowerSyncDatabaseOptions); + // Warning: (ae-incompatible-release-tags) The symbol "bucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal + // + // (undocumented) + protected bucketStorageAdapter: BucketStorageAdapter; + close(options?: PowerSyncCloseOptions): Promise; + closed: boolean; + connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise; + get connected(): boolean; + // (undocumented) + get connecting(): boolean; + // Warning: (ae-incompatible-release-tags) The symbol "connectionManager" is marked as @public, but its signature references "ConnectionManager" which is marked as @internal + // + // (undocumented) + protected connectionManager: ConnectionManager; + // Warning: (ae-incompatible-release-tags) The symbol "connectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal + get connectionOptions(): InternalConnectionOptions | null; + get connector(): PowerSyncBackendConnector | null; + currentStatus: SyncStatus; + customQuery(query: WatchCompatibleQuery): Query; + get database(): DBAdapter; + disconnect(): Promise; + disconnectAndClear(options?: DisconnectAndClearOptions): Promise; + // @deprecated (undocumented) + dispose(): void; + execute(sql: string, parameters?: any[]): Promise; + executeBatch(sql: string, parameters?: any[][]): Promise; + executeRaw(sql: string, parameters?: any[]): Promise; + // Warning: (ae-incompatible-release-tags) The symbol "generateBucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal + // + // (undocumented) + protected abstract generateBucketStorageAdapter(): BucketStorageAdapter; + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal + // + // (undocumented) + protected abstract generateSyncStreamImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions): StreamingSyncImplementation; + // Warning: (ae-incompatible-release-tags) The symbol "generateTriggerManagerConfig" is marked as @public, but its signature references "TriggerManagerConfig" which is marked as @internal + protected generateTriggerManagerConfig(): TriggerManagerConfig; + get(sql: string, parameters?: any[]): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getClientId(): Promise; + getCrudBatch(limit?: number): Promise; + getCrudTransactions(): AsyncIterable; + getNextCrudTransaction(): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + getUploadQueueStats(includeSize?: boolean): Promise; + init(): Promise; + protected initialize(): Promise; + abstract _initialize(): Promise; + // (undocumented) + protected _isReadyPromise: Promise; + // (undocumented) + protected loadVersion(): Promise; + // (undocumented) + logger: ILogger; + onChange(options?: SQLOnChangeOptions): AsyncIterable; + onChange(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; + onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable; + onChangeWithCallback(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; + protected abstract openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter; + // (undocumented) + protected options: PowerSyncDatabaseOptions; + query(query: ArrayQueryDefinition): Query; + readLock(callback: (db: LockContext) => Promise): Promise; + readTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; + // (undocumented) + ready: boolean; + // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal + // + // (undocumented) + protected resolvedConnectionOptions(options: CreateSyncImplementationOptions): CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions; + // (undocumented) + protected resolveOfflineSyncStatus(): Promise; + resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise; + protected runExclusive(callback: () => Promise): Promise; + // Warning: (ae-incompatible-release-tags) The symbol "runExclusiveMutex" is marked as @public, but its signature references "Mutex" which is marked as @internal + // + // (undocumented) + protected runExclusiveMutex: Mutex; + get schema(): Schema<{ + [x: string]: Table; + }>; + // (undocumented) + protected _schema: Schema; + // (undocumented) + sdkVersion: string; + syncStream(name: string, params?: Record): SyncStream; + // Warning: (ae-incompatible-release-tags) The symbol "syncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal + // + // (undocumented) + get syncStreamImplementation(): StreamingSyncImplementation | null; + // Warning: (ae-incompatible-release-tags) The symbol "triggers" is marked as @public, but its signature references "TriggerManager" which is marked as @alpha + readonly triggers: TriggerManager; + // Warning: (ae-incompatible-release-tags) The symbol "triggersImpl" is marked as @public, but its signature references "TriggerManagerImpl" which is marked as @internal + // + // (undocumented) + protected triggersImpl: TriggerManagerImpl; + updateSchema(schema: Schema): Promise; + waitForFirstSync(request?: AbortSignal | { + signal?: AbortSignal; + priority?: number; + }): Promise; + // (undocumented) + waitForReady(): Promise; + waitForStatus(predicate: (status: SyncStatus) => any, signal?: AbortSignal): Promise; + watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; + watch(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; + watchWithAsyncGenerator(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; + watchWithCallback(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; + writeLock(callback: (db: LockContext) => Promise): Promise; + writeTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractPowerSyncDatabaseOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractPowerSyncDatabaseOpenFactory { + constructor(options: PowerSyncOpenFactoryOptions); + // (undocumented) + abstract generateInstance(options: PowerSyncDatabaseOptions): AbstractPowerSyncDatabase; + // (undocumented) + generateOptions(): PowerSyncDatabaseOptions; + // (undocumented) + getInstance(): AbstractPowerSyncDatabase; + // (undocumented) + protected abstract openDB(): DBAdapter; + // (undocumented) + protected options: PowerSyncOpenFactoryOptions; + get schema(): Schema<{ + [x: string]: Table; + }>; +} + +// Warning: (ae-forgotten-export) The symbol "MetaBaseObserver" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "WatchedQueryProcessorListener" needs to be exported by the entry point index.d.ts +// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export abstract class AbstractQueryProcessor extends MetaBaseObserver> implements WatchedQuery { + constructor(options: AbstractQueryProcessorOptions); + // (undocumented) + protected abortController: AbortController; + // (undocumented) + close(): Promise; + // (undocumented) + get closed(): boolean; + // (undocumented) + protected _closed: boolean; + // (undocumented) + protected constructInitialState(): WatchedQueryState; + // (undocumented) + protected disposeListeners: (() => void) | null; + protected init(signal: AbortSignal): Promise; + // (undocumented) + protected initialized: Promise; + protected iterateAsyncListenersWithError(callback: (listener: Partial>) => Promise | void): Promise; + protected abstract linkQuery(options: LinkQueryOptions): Promise; + // (undocumented) + protected options: AbstractQueryProcessorOptions; + // (undocumented) + protected get reportFetching(): boolean; + protected runWithReporting(callback: () => Promise): Promise; + // (undocumented) + readonly state: WatchedQueryState; + updateSettings(settings: Settings): Promise; + // (undocumented) + protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise; + // (undocumented) + protected updateState(update: Partial>): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AbstractQueryProcessorOptions { + // (undocumented) + db: AbstractPowerSyncDatabase; + // (undocumented) + placeholderData: Data; + // (undocumented) + watchOptions: Settings; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractRemote" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractRemote { + constructor(connector: RemoteConnector, logger?: ILogger, options?: Partial); + // (undocumented) + protected buildRequest(path: string): Promise<{ + url: string; + headers: { + 'content-type': string; + Authorization: string; + 'x-user-agent': string; + }; + }>; + // (undocumented) + protected connector: RemoteConnector; + // (undocumented) + protected createSocket(url: string): WebSocket; + // (undocumented) + createTextDecoder(): TextDecoder; + // (undocumented) + protected credentials: PowerSyncCredentials | null; + // (undocumented) + get fetch(): FetchImplementation; + fetchCredentials(): Promise; + fetchStream(options: SyncStreamOptions): Promise>; + protected fetchStreamRaw(options: SyncStreamOptions): Promise<{ + isBson: boolean; + stream: SimpleAsyncIterator; + }>; + // (undocumented) + get(path: string, headers?: Record): Promise; + getCredentials(): Promise; + // (undocumented) + getUserAgent(): string; + invalidateCredentials(): void; + // (undocumented) + protected logger: ILogger; + // (undocumented) + protected options: AbstractRemoteOptions; + // (undocumented) + post(path: string, data: any, headers?: Record): Promise; + prefetchCredentials(): Promise; + socketStreamRaw(options: SocketSyncStreamOptions): Promise>; + // (undocumented) + protected get supportsStreamingBinaryResponses(): boolean; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractRemoteOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type AbstractRemoteOptions = { + socketUrlTransformer: (url: string) => string; + fetchImplementation: FetchImplementation | FetchImplementationProvider; + fetchOptions?: {}; +}; + +// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractStreamingSyncImplementation extends BaseObserver implements StreamingSyncImplementation { + constructor(options: AbstractStreamingSyncImplementationOptions); + // (undocumented) + protected abortController: AbortController | null; + // (undocumented) + connect(options?: PowerSyncConnectionOptions): Promise; + // (undocumented) + protected crudUpdateListener?: () => void; + // (undocumented) + disconnect(): Promise; + // (undocumented) + dispose(): Promise; + // (undocumented) + getWriteCheckpoint(): Promise; + // (undocumented) + get isConnected(): boolean; + // (undocumented) + get lastSyncedAt(): Date | undefined; + // (undocumented) + protected logger: ILogger; + // (undocumented) + markConnectionMayHaveChanged(): void; + // (undocumented) + abstract obtainLock(lockOptions: LockOptions_2): Promise; + // (undocumented) + protected options: AbstractStreamingSyncImplementationOptions; + // Warning: (ae-forgotten-export) The symbol "RustIterationResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected streamingSyncIteration(signal: AbortSignal, options?: PowerSyncConnectionOptions): Promise; + // (undocumented) + protected streamingSyncPromise?: Promise<[void, void]>; + // (undocumented) + syncStatus: SyncStatus; + // (undocumented) + triggerCrudUpload(): void; + // (undocumented) + updateSubscriptions(subscriptions: SubscribedStream[]): void; + // (undocumented) + protected updateSyncStatus(options: SyncStatusOptions): void; + // (undocumented) + waitForReady(): Promise; + // (undocumented) + waitForStatus(status: SyncStatusOptions): Promise; + // (undocumented) + waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AbstractStreamingSyncImplementationOptions extends RequiredAdditionalConnectionOptions { + // (undocumented) + adapter: BucketStorageAdapter; + identifier?: string; + // (undocumented) + logger?: ILogger; + // (undocumented) + remote: AbstractRemote; + // (undocumented) + subscriptions: SubscribedStream[]; + // (undocumented) + uploadCrud: () => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AdditionalConnectionOptions { + crudUploadThrottleMs?: number; + retryDelayMs?: number; +} + +// @public +export class ArrayComparator implements WatchedQueryComparator { + constructor(options: ArrayComparatorOptions); + // (undocumented) + checkEquality(current: ItemType[], previous: ItemType[]): boolean; + // (undocumented) + protected options: ArrayComparatorOptions; +} + +// @public +export type ArrayComparatorOptions = { + compareBy: (item: ItemType) => string; +}; + +// @public +export interface ArrayQueryDefinition { + mapper?: (row: Record) => RowType; + // (undocumented) + parameters?: ReadonlyArray>; + // (undocumented) + sql: string; +} + +// @alpha +export const ATTACHMENT_TABLE = "attachments"; + +// @alpha +export class AttachmentContext { + constructor(db: AbstractPowerSyncDatabase, tableName: string | undefined, logger: ILogger, archivedCacheLimit: number); + readonly archivedCacheLimit: number; + // (undocumented) + clearQueue(): Promise; + readonly db: AbstractPowerSyncDatabase; + // (undocumented) + deleteArchivedAttachments(callback?: (attachments: AttachmentRecord[]) => Promise): Promise; + deleteAttachment(attachmentId: string): Promise; + getActiveAttachments(): Promise; + getArchivedAttachments(): Promise; + // (undocumented) + getAttachment(id: string): Promise; + getAttachments(): Promise; + readonly logger: ILogger; + saveAttachments(attachments: AttachmentRecord[]): Promise; + readonly tableName: string; + upsertAttachment(attachment: AttachmentRecord, context: Transaction): Promise; +} + +// @alpha (undocumented) +export type AttachmentData = ArrayBuffer | string; + +// @alpha +export interface AttachmentErrorHandler { + onDeleteError(attachment: AttachmentRecord, error: unknown): Promise; + onDownloadError(attachment: AttachmentRecord, error: unknown): Promise; + onUploadError(attachment: AttachmentRecord, error: unknown): Promise; +} + +// @alpha +export function attachmentFromSql(row: any): AttachmentRecord; + +// @alpha +export class AttachmentQueue implements AttachmentQueue { + constructor(input: { + db: AbstractPowerSyncDatabase; + remoteStorage: RemoteStorageAdapter; + localStorage: LocalStorageAdapter; + watchAttachments: (onUpdate: (attachment: WatchedAttachmentItem[]) => Promise, signal: AbortSignal) => void; + tableName?: string; + logger?: ILogger; + syncIntervalMs?: number; + syncThrottleDuration?: number; + downloadAttachments?: boolean; + archivedCacheLimit?: number; + errorHandler?: AttachmentErrorHandler; + }); + readonly archivedCacheLimit: number; + // (undocumented) + clearQueue(): Promise; + // (undocumented) + deleteFile(input: { + id: string; + updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; + }): Promise; + readonly downloadAttachments: boolean; + // (undocumented) + expireCache(): Promise; + generateAttachmentId(): Promise; + readonly localStorage: LocalStorageAdapter; + readonly logger: ILogger; + readonly remoteStorage: RemoteStorageAdapter; + saveFile(input: { + data: AttachmentData; + fileExtension: string; + mediaType?: string; + metaData?: string; + id?: string; + updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; + }): Promise; + startSync(): Promise; + stopSync(): Promise; + readonly syncIntervalMs: number; + syncStorage(): Promise; + readonly syncThrottleDuration: number; + readonly tableName: string; + verifyAttachments(): Promise; + withAttachmentContext(callback: (context: AttachmentContext) => Promise): Promise; +} + +// @alpha +export interface AttachmentRecord { + // (undocumented) + filename: string; + // (undocumented) + hasSynced?: boolean; + // (undocumented) + id: string; + // (undocumented) + localUri?: string; + // (undocumented) + mediaType?: string; + // (undocumented) + metaData?: string; + // (undocumented) + size?: number; + // (undocumented) + state: AttachmentState; + // (undocumented) + timestamp?: number; +} + +// Warning: (ae-internal-missing-underscore) The name "AttachmentService" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class AttachmentService { + constructor(db: AbstractPowerSyncDatabase, logger: ILogger, tableName?: string, archivedCacheLimit?: number); + watchActiveAttachments(input?: { + throttleMs?: number; + }): DifferentialWatchedQuery; + withContext(callback: (context: AttachmentContext) => Promise): Promise; +} + +// @alpha +export enum AttachmentState { + // (undocumented) + ARCHIVED = 4,// Attachment to be uploaded + // (undocumented) + QUEUED_DELETE = 2,// Attachment to be downloaded + // (undocumented) + QUEUED_DOWNLOAD = 1,// Attachment to be deleted + // (undocumented) + QUEUED_UPLOAD = 0,// Attachment has been synced + // (undocumented) + SYNCED = 3 +} + +// @alpha +export class AttachmentTable extends Table { + constructor(options?: AttachmentTableOptions); +} + +// @alpha (undocumented) +export interface AttachmentTableOptions extends Omit { +} + +// @public (undocumented) +export type BaseColumnType = { + type: ColumnType; +}; + +// @public (undocumented) +export interface BaseConnectionOptions { + appMetadata?: Record; + // @deprecated (undocumented) + clientImplementation?: SyncClientImplementation; + connectionMethod?: SyncStreamConnectionMethod; + fetchStrategy?: FetchStrategy; + includeDefaultStreams?: boolean; + params?: Record; + serializedSchema?: any; +} + +// @public (undocumented) +export type BaseListener = Record any) | undefined>; + +// Warning: (ae-internal-missing-underscore) The name "BaseObserver" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class BaseObserver implements BaseObserverInterface { + constructor(); + // (undocumented) + dispose(): void; + // (undocumented) + iterateAsyncListeners(cb: (listener: Partial) => Promise): Promise; + // (undocumented) + iterateListeners(cb: (listener: Partial) => any): void; + // (undocumented) + protected listeners: Set>; + registerListener(listener: Partial): () => void; +} + +// @public (undocumented) +export interface BaseObserverInterface { + // (undocumented) + registerListener(listener: Partial): () => void; +} + +// Warning: (ae-incompatible-release-tags) The symbol "BasePowerSyncDatabaseOptions" is marked as @public, but its signature references "AdditionalConnectionOptions" which is marked as @internal +// +// @public (undocumented) +export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions { + // (undocumented) + logger?: ILogger; + // @deprecated (undocumented) + retryDelay?: number; + schema: Schema; +} + +// @alpha +export interface BaseTriggerDiffRecord { + id: string; + operation: DiffTriggerOperation; + operation_id: TOperationId; + timestamp: string; +} + +// @public (undocumented) +export interface BatchedUpdateNotification { + // (undocumented) + groupedUpdates: Record; + // (undocumented) + rawUpdates: UpdateNotification[]; + // (undocumented) + tables: string[]; +} + +// Warning: (ae-internal-missing-underscore) The name "BucketStorageAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface BucketStorageAdapter extends BaseObserverInterface, Disposable_2 { + control(op: PowerSyncControlCommand, payload: string | Uint8Array | null): Promise; + getClientId(): Promise; + // (undocumented) + getCrudBatch(limit?: number): Promise; + // (undocumented) + getMaxOpId(): string; + // (undocumented) + hasCrud(): Promise; + // (undocumented) + hasMigratedSubkeys(): Promise; + // (undocumented) + init(): Promise; + // (undocumented) + migrateToFixedSubkeys(): Promise; + // (undocumented) + nextCrudItem(): Promise; + // (undocumented) + updateLocalTarget(cb: () => Promise): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "BucketStorageListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface BucketStorageListener extends BaseListener { + // (undocumented) + crudUpdate: () => void; +} + +// @public (undocumented) +export class Column { + constructor(options: ColumnOptions); + // (undocumented) + get name(): string; + // (undocumented) + protected options: ColumnOptions; + // (undocumented) + toJSON(): { + name: string; + type: ColumnType | undefined; + }; + // (undocumented) + get type(): ColumnType | undefined; +} + +// @public (undocumented) +export const column: { + text: BaseColumnType; + integer: BaseColumnType; + real: BaseColumnType; +}; + +// @public (undocumented) +export interface ColumnOptions { + // (undocumented) + name: string; + // (undocumented) + type?: ColumnType; +} + +// @public (undocumented) +export type ColumnsType = Record>; + +// @public (undocumented) +export enum ColumnType { + // (undocumented) + INTEGER = "INTEGER", + // (undocumented) + REAL = "REAL", + // (undocumented) + TEXT = "TEXT" +} + +// @public (undocumented) +export interface CompilableQuery { + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(): Promise; +} + +// @public (undocumented) +export function compilableQueryWatch(db: AbstractPowerSyncDatabase, query: CompilableQuery, handler: CompilableQueryWatchHandler, options?: SQLWatchOptions): void; + +// @public (undocumented) +export interface CompilableQueryWatchHandler { + // (undocumented) + onError?: (error: Error) => void; + // (undocumented) + onResult: (results: T[]) => void; +} + +// @public (undocumented) +export interface CompiledQuery { + // (undocumented) + readonly parameters: ReadonlyArray; + // (undocumented) + readonly sql: string; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionClosedError" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class ConnectionClosedError extends Error { + constructor(message: string); + // (undocumented) + static MATCHES(input: any): boolean; + // (undocumented) + static NAME: string; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManager" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class ConnectionManager extends BaseObserver { + constructor(options: ConnectionManagerOptions); + get activeStreams(): { + name: string; + params: Record | null; + }[]; + // (undocumented) + close(): Promise; + // (undocumented) + connect(connector: PowerSyncBackendConnector, options: InternalConnectionOptions): Promise; + protected connectingPromise: Promise | null; + // (undocumented) + protected connectInternal(): Promise; + // (undocumented) + get connectionOptions(): InternalConnectionOptions | null; + // (undocumented) + get connector(): PowerSyncBackendConnector | null; + disconnect(): Promise; + protected disconnectingPromise: Promise | null; + // (undocumented) + protected disconnectInternal(): Promise; + // (undocumented) + get logger(): ILogger; + // (undocumented) + protected options: ConnectionManagerOptions; + // Warning: (ae-forgotten-export) The symbol "StoredConnectionOptions" needs to be exported by the entry point index.d.ts + protected pendingConnectionOptions: StoredConnectionOptions | null; + // (undocumented) + protected performDisconnect(): Promise; + // (undocumented) + stream(adapter: InternalSubscriptionAdapter, name: string, parameters: Record | null): SyncStream; + protected syncDisposer: (() => Promise | void) | null; + // (undocumented) + syncStreamImplementation: StreamingSyncImplementation | null; + protected syncStreamInitPromise: Promise | null; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerListener extends BaseListener { + // (undocumented) + syncStreamCreated: (sync: StreamingSyncImplementation) => void; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerOptions { + // (undocumented) + createSyncImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions): Promise; + // (undocumented) + logger: ILogger; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerSyncImplementationResult" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerSyncImplementationResult { + onDispose: () => Promise | void; + // (undocumented) + sync: StreamingSyncImplementation; +} + +// @public (undocumented) +export interface ConnectionPool extends BaseObserverInterface { + // (undocumented) + close: () => void | Promise; + // (undocumented) + name: string; + // (undocumented) + readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + refreshSchema: () => Promise; + // (undocumented) + writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "ControlledExecutor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class ControlledExecutor { + constructor(task: (param: T) => Promise | void, options?: ControlledExecutorOptions); + // (undocumented) + dispose(): void; + // (undocumented) + schedule(param: T): void; +} + +// Warning: (ae-internal-missing-underscore) The name "ControlledExecutorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ControlledExecutorOptions { + throttleEnabled?: boolean; +} + +// @public +export function createBaseLogger(): typeof Logger; + +// Warning: (ae-forgotten-export) The symbol "BaseCreateDiffTriggerOptions" needs to be exported by the entry point index.d.ts +// +// @alpha +export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions { + destination: string; + setupContext?: LockContext; +} + +// @public +export function createLogger(name: string, options?: CreateLoggerOptions): ILogger; + +// @public (undocumented) +export interface CreateLoggerOptions { + // (undocumented) + logLevel?: ILogLevel; +} + +// Warning: (ae-internal-missing-underscore) The name "CreateSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export interface CreateSyncImplementationOptions extends AdditionalConnectionOptions { + // (undocumented) + subscriptions: SubscribedStream[]; +} + +// @public +export class CrudBatch { + constructor( + crud: CrudEntry[], + haveMore: boolean, + complete: (writeCheckpoint?: string) => Promise); + complete: (writeCheckpoint?: string) => Promise; + crud: CrudEntry[]; + haveMore: boolean; +} + +// @public +export class CrudEntry { + constructor(clientId: number, op: UpdateType, table: string, id: string, transactionId?: number, opData?: Record, previousValues?: Record, metadata?: string); + clientId: number; + // (undocumented) + equals(entry: CrudEntry): boolean; + // Warning: (ae-forgotten-export) The symbol "CrudEntryJSON" needs to be exported by the entry point index.d.ts + // + // (undocumented) + static fromRow(dbRow: CrudEntryJSON): CrudEntry; + // @deprecated + hashCode(): string; + id: string; + metadata?: string; + op: UpdateType; + opData?: Record; + previousValues?: Record; + table: string; + toComparisonArray(): (string | number | Record | undefined)[]; + // Warning: (ae-forgotten-export) The symbol "CrudEntryOutputJSON" needs to be exported by the entry point index.d.ts + toJSON(): CrudEntryOutputJSON; + transactionId?: number; +} + +// @public (undocumented) +export class CrudTransaction extends CrudBatch { + constructor( + crud: CrudEntry[], + complete: (checkpoint?: string) => Promise, + transactionId?: number | undefined); + complete: (checkpoint?: string) => Promise; + crud: CrudEntry[]; + transactionId?: number | undefined; +} + +// @public (undocumented) +export interface DBAdapter extends ConnectionPool, SqlExecutor, DBGetUtils { + // (undocumented) + readTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; + // (undocumented) + writeTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "DBAdapterDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function DBAdapterDefaultMixin ConnectionPool>(Base: TBase): { + new (...args: any[]): { + readTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; + writeTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + get(sql: string, parameters?: any[]): Promise; + execute(query: string, params?: any[]): Promise; + executeRaw(query: string, params?: any[]): Promise; + executeBatch(query: string, params?: any[][]): Promise; + name: string; + close: () => void | Promise; + readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + refreshSchema: () => Promise; + registerListener(listener: Partial): () => void; + }; +} & TBase; + +// @public (undocumented) +export interface DBAdapterListener extends BaseListener { + tablesUpdated: (updateNotification: BatchedUpdateNotification | UpdateNotification) => void; +} + +// @public (undocumented) +export interface DBGetUtils { + get(sql: string, parameters?: any[]): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "DBGetUtilsDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function DBGetUtilsDefaultMixin Omit>(Base: TBase): { + new (...args: any[]): { + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + get(sql: string, parameters?: any[]): Promise; + executeBatch(query: string, params?: any[][]): Promise; + execute: (query: string, params?: any[] | undefined) => Promise; + executeRaw: (query: string, params?: any[] | undefined) => Promise; + }; +} & TBase; + +// @public (undocumented) +export interface DBLockOptions { + // (undocumented) + timeoutMs?: number; +} + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_BATCH_LIMIT" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_CRUD_BATCH_LIMIT = 100; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_UPLOAD_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_COLUMN_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_INDEX_COLUMN_OPTIONS: Partial; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_INDEX_OPTIONS: Partial; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_LOCK_TIMEOUT_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const DEFAULT_LOCK_TIMEOUT_MS = 120000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_CLOSE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_DB_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_POWERSYNC_DB_OPTIONS: { + retryDelayMs: number; + crudUploadThrottleMs: number; +}; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_LOGGER" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_REMOTE_LOGGER: Logger.ILogger; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_RETRY_DELAY_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_RETRY_DELAY_MS = 5000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_ROW_COMPARATOR" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const DEFAULT_ROW_COMPARATOR: DifferentialWatchedQueryComparator; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAM_CONNECTION_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAMING_SYNC_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_STREAMING_SYNC_OPTIONS: { + retryDelayMs: number; + crudUploadThrottleMs: number; +}; + +// @public @deprecated +export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_TABLE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_TABLE_OPTIONS: { + indexes: never[]; + insertOnly: boolean; + localOnly: boolean; + trackPrevious: boolean; + trackMetadata: boolean; + ignoreEmptyUpdates: boolean; +}; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_QUERY_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_WATCH_QUERY_OPTIONS: WatchedQueryOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_WATCH_THROTTLE_MS = 30; + +// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class DifferentialQueryProcessor extends AbstractQueryProcessor>, DifferentialWatchedQuerySettings> implements DifferentialWatchedQuery { + constructor(options: DifferentialQueryProcessorOptions); + // (undocumented) + protected comparator: DifferentialWatchedQueryComparator; + // Warning: (ae-forgotten-export) The symbol "DataHashMap" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected differentiate(current: RowType[], previousMap: DataHashMap): { + diff: WatchedQueryDifferential; + map: DataHashMap; + hasChanged: boolean; + }; + // (undocumented) + protected linkQuery(options: LinkQueryOptions>): Promise; + // (undocumented) + protected options: DifferentialQueryProcessorOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface DifferentialQueryProcessorOptions extends AbstractQueryProcessorOptions> { + // (undocumented) + rowComparator?: DifferentialWatchedQueryComparator; +} + +// @public (undocumented) +export type DifferentialWatchedQuery = WatchedQuery>, DifferentialWatchedQuerySettings, DifferentialWatchedQueryListener>; + +// @public +export interface DifferentialWatchedQueryComparator { + compareBy: (item: RowType) => string; + keyBy: (item: RowType) => string; +} + +// @public (undocumented) +export interface DifferentialWatchedQueryListener extends WatchedQueryListener>> { + // (undocumented) + onDiff?: (diff: WatchedQueryDifferential) => void | Promise; +} + +// @public +export interface DifferentialWatchedQueryOptions extends WatchedQueryOptions { + placeholderData?: RowType[]; + rowComparator?: DifferentialWatchedQueryComparator; +} + +// @public +export interface DifferentialWatchedQuerySettings extends DifferentialWatchedQueryOptions { + query: WatchCompatibleQuery; +} + +// @alpha +export enum DiffTriggerOperation { + // (undocumented) + DELETE = "DELETE", + // (undocumented) + INSERT = "INSERT", + // (undocumented) + UPDATE = "UPDATE" +} + +// @public (undocumented) +export interface DisconnectAndClearOptions { + clearLocal?: boolean; +} + +// @public (undocumented) +interface Disposable_2 { + // (undocumented) + dispose: () => Promise | void; +} +export { Disposable_2 as Disposable } + +// Warning: (ae-internal-missing-underscore) The name "EMPTY_DIFFERENTIAL" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const EMPTY_DIFFERENTIAL: { + added: never[]; + all: never[]; + removed: never[]; + updated: never[]; + unchanged: never[]; +}; + +// @alpha (undocumented) +export enum EncodingType { + // (undocumented) + Base64 = "base64", + // (undocumented) + UTF8 = "utf8" +} + +// @public (undocumented) +export type ExtractColumnValueType> = T extends BaseColumnType ? R : unknown; + +// @alpha +export type ExtractedTriggerDiffRecord = T & { + [K in keyof Omit, 'id'> as `__${string & K}`]: TriggerDiffRecord[K]; +} & { + __previous_value?: string; +}; + +// Warning: (ae-internal-missing-underscore) The name "extractTableUpdates" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function extractTableUpdates(update: BatchedUpdateNotification | UpdateNotification): string[]; + +// @public +export const FalsyComparator: WatchedQueryComparator; + +// Warning: (ae-internal-missing-underscore) The name "FetchImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type FetchImplementation = typeof fetch_2; + +// Warning: (ae-internal-missing-underscore) The name "FetchImplementationProvider" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class FetchImplementationProvider { + // (undocumented) + getFetch(): FetchImplementation; +} + +// @public (undocumented) +export enum FetchStrategy { + Buffered = "buffered", + Sequential = "sequential" +} + +// @public +export class GetAllQuery implements WatchCompatibleQuery { + constructor(options: GetAllQueryOptions); + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(options: { + db: AbstractPowerSyncDatabase; + }): Promise; + // (undocumented) + protected options: GetAllQueryOptions; +} + +// @public +export type GetAllQueryOptions = { + sql: string; + parameters?: ReadonlyArray; + mapper?: (rawRow: Record) => RowType; +}; + +export { GlobalLogger } + +export { ILogger } + +export { ILoggerOpts } + +export { ILogHandler } + +export { ILogLevel } + +// @public (undocumented) +export class Index { + constructor(options: IndexOptions); + // (undocumented) + get columns(): IndexedColumn[]; + // (undocumented) + static createAscending(options: IndexOptions, columnNames: string[]): Index; + // (undocumented) + get name(): string; + // (undocumented) + protected options: IndexOptions; + // (undocumented) + toJSON(table: Table): { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }; +} + +// @public (undocumented) +export interface IndexColumnOptions { + // (undocumented) + ascending?: boolean; + // (undocumented) + name: string; +} + +// @public (undocumented) +export class IndexedColumn { + constructor(options: IndexColumnOptions); + // (undocumented) + get ascending(): boolean | undefined; + // (undocumented) + static createAscending(column: string): IndexedColumn; + // (undocumented) + get name(): string; + // (undocumented) + protected options: IndexColumnOptions; + // (undocumented) + toJSON(table: Table): { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }; +} + +// @public (undocumented) +export interface IndexOptions { + // (undocumented) + columns?: IndexedColumn[]; + // (undocumented) + name: string; +} + +// @public (undocumented) +export type IndexShorthand = Record; + +// Warning: (ae-internal-missing-underscore) The name "InternalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions { +} + +// Warning: (ae-internal-missing-underscore) The name "InternalSubscriptionAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface InternalSubscriptionAdapter { + // (undocumented) + firstStatusMatching(predicate: (status: SyncStatus) => any, abort?: AbortSignal): Promise; + // (undocumented) + resolveOfflineSyncStatus(): Promise; + // (undocumented) + rustSubscriptionsCommand(payload: any): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "InvalidSQLCharacters" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const InvalidSQLCharacters: RegExp; + +// Warning: (ae-internal-missing-underscore) The name "isBatchedUpdateNotification" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function isBatchedUpdateNotification(update: BatchedUpdateNotification | UpdateNotification): update is BatchedUpdateNotification; + +// Warning: (ae-internal-missing-underscore) The name "isDBAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isDBAdapter: (test: any) => test is DBAdapter; + +// Warning: (ae-internal-missing-underscore) The name "isPowerSyncDatabaseOptionsWithSettings" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isPowerSyncDatabaseOptionsWithSettings: (test: any) => test is PowerSyncDatabaseOptionsWithSettings; + +// Warning: (ae-internal-missing-underscore) The name "isSQLOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isSQLOpenFactory: (test: any) => test is SQLOpenFactory; + +// Warning: (ae-internal-missing-underscore) The name "isSQLOpenOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isSQLOpenOptions: (test: any) => test is SQLOpenOptions; + +// Warning: (ae-internal-missing-underscore) The name "LinkQueryOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface LinkQueryOptions { + // (undocumented) + abortSignal: AbortSignal; + // (undocumented) + settings: Settings; +} + +// @alpha +export interface LocalStorageAdapter { + clear(): Promise; + deleteFile(filePath: string): Promise; + fileExists(filePath: string): Promise; + getLocalUri(filename: string): string; + initialize(): Promise; + makeDir(path: string): Promise; + readFile(filePath: string): Promise; + rmDir(path: string): Promise; + saveFile(filePath: string, data: AttachmentData): Promise; +} + +// @public (undocumented) +export interface LockContext extends SqlExecutor, DBGetUtils { + connectionType?: 'writer' | 'queryOnly' | 'readOnly'; +} + +// @internal +interface LockOptions_2 { + // (undocumented) + callback: () => Promise; + // (undocumented) + signal?: AbortSignal; + // (undocumented) + type: LockType; +} + +// Warning: (ae-internal-missing-underscore) The name "LockOptions" should be prefixed with an underscore because the declaration is marked as @internal +export { LockOptions_2 as LockOptions } + +// Warning: (ae-internal-missing-underscore) The name "LockType" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum LockType { + // (undocumented) + CRUD = "crud", + // (undocumented) + SYNC = "sync" +} + +// @public (undocumented) +export const LogLevel: { + TRACE: Logger.ILogLevel; + DEBUG: Logger.ILogLevel; + INFO: Logger.ILogLevel; + TIME: Logger.ILogLevel; + WARN: Logger.ILogLevel; + ERROR: Logger.ILogLevel; + OFF: Logger.ILogLevel; +}; + +// Warning: (ae-internal-missing-underscore) The name "MAX_AMOUNT_OF_COLUMNS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const MAX_AMOUNT_OF_COLUMNS = 1999; + +// Warning: (ae-internal-missing-underscore) The name "MAX_OP_ID" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const MAX_OP_ID = "9223372036854775807"; + +// Warning: (ae-internal-missing-underscore) The name "MEMORY_TRIGGER_CLAIM_MANAGER" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const MEMORY_TRIGGER_CLAIM_MANAGER: TriggerClaimManager; + +// Warning: (ae-forgotten-export) The symbol "MutableDeep" needs to be exported by the entry point index.d.ts +// Warning: (ae-internal-missing-underscore) The name "MutableWatchedQueryState" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export type MutableWatchedQueryState = { + -readonly [P in keyof WatchedQueryState]: MutableDeep[P]>; +}; + +// Warning: (ae-internal-missing-underscore) The name "Mutex" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class Mutex { + // (undocumented) + acquire(abort?: AbortSignal): Promise; + // (undocumented) + runExclusive(fn: () => PromiseLike | T, abort?: AbortSignal): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class OnChangeQueryProcessor extends AbstractQueryProcessor> { + constructor(options: OnChangeQueryProcessorOptions); + // (undocumented) + protected checkEquality(current: Data, previous: Data): boolean; + // (undocumented) + protected linkQuery(options: LinkQueryOptions): Promise; + // (undocumented) + protected options: OnChangeQueryProcessorOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface OnChangeQueryProcessorOptions extends AbstractQueryProcessorOptions> { + // (undocumented) + comparator?: WatchedQueryComparator; +} + +// @public +export type OpId = string; + +// Warning: (ae-internal-missing-underscore) The name "ParsedQuery" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ParsedQuery { + // (undocumented) + parameters: any[]; + // (undocumented) + sqlStatement: string; +} + +// Warning: (ae-internal-missing-underscore) The name "parseQuery" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const parseQuery: (query: string | CompilableQuery, parameters: any[]) => ParsedQuery; + +// @public +export type PendingStatement = { + sql: string; + params: PendingStatementParameter[]; +}; + +// @public +export type PendingStatementParameter = 'Id' | { + Column: string; +} | 'Rest'; + +// @public (undocumented) +export interface PowerSyncBackendConnector { + fetchCredentials: () => Promise; + uploadData: (database: AbstractPowerSyncDatabase) => Promise; +} + +// @public (undocumented) +export interface PowerSyncCloseOptions { + disconnect?: boolean; +} + +// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncConnectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal +// +// @public +export type PowerSyncConnectionOptions = Omit; + +// Warning: (ae-internal-missing-underscore) The name "PowerSyncControlCommand" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum PowerSyncControlCommand { + CONNECTION_STATE = "connection", + // (undocumented) + NOTIFY_CRUD_UPLOAD_COMPLETED = "completed_upload", + // (undocumented) + NOTIFY_TOKEN_REFRESHED = "refreshed_token", + // (undocumented) + PROCESS_BSON_LINE = "line_binary", + // (undocumented) + PROCESS_TEXT_LINE = "line_text", + // (undocumented) + START = "start", + // (undocumented) + STOP = "stop", + // (undocumented) + UPDATE_SUBSCRIPTIONS = "update_subscriptions" +} + +// @public (undocumented) +export interface PowerSyncCredentials { + // (undocumented) + endpoint: string; + // (undocumented) + expiresAt?: Date; + // (undocumented) + token: string; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions { + database: DBAdapter | SQLOpenFactory | SQLOpenOptions; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithDBAdapter extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: DBAdapter; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithOpenFactory extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: SQLOpenFactory; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithSettings extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: SQLOpenOptions; +} + +// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncDBListener" is marked as @public, but its signature references "StreamingSyncImplementationListener" which is marked as @internal +// +// @public (undocumented) +export interface PowerSyncDBListener extends StreamingSyncImplementationListener { + // (undocumented) + closed: () => Promise | void; + // (undocumented) + closing: () => Promise | void; + // (undocumented) + initialized: () => void; + // (undocumented) + schemaChanged: (schema: Schema) => void; +} + +// Warning: (ae-internal-missing-underscore) The name "PowerSyncOpenFactoryOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface PowerSyncOpenFactoryOptions extends Partial, SQLOpenOptions { + schema: Schema; +} + +// @public +export interface ProgressWithOperations { + downloadedFraction: number; + downloadedOperations: number; + totalOperations: number; +} + +// Warning: (ae-internal-missing-underscore) The name "PSInternalTable" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum PSInternalTable { + // (undocumented) + BUCKETS = "ps_buckets", + // (undocumented) + CRUD = "ps_crud", + // (undocumented) + DATA = "ps_data", + // (undocumented) + OPLOG = "ps_oplog", + // (undocumented) + UNTYPED = "ps_untyped" +} + +// @public (undocumented) +export interface Query { + differentialWatch(options?: DifferentialWatchedQueryOptions): DifferentialWatchedQuery; + watch(options?: StandardWatchedQueryOptions): StandardWatchedQuery>>; +} + +// @public +export type QueryParam = string | number | boolean | null | undefined | bigint | Uint8Array; + +// @public +export type QueryResult = { + insertId?: number; + rowsAffected: number; + rows?: { + _array: any[]; + length: number; + item: (idx: number) => any; + }; +}; + +// Warning: (ae-forgotten-export) The symbol "RawTableTypeWithStatements" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "InferredRawTableType" needs to be exported by the entry point index.d.ts +// +// @public +export type RawTableType = RawTableTypeWithStatements | InferredRawTableType; + +// Warning: (ae-internal-missing-underscore) The name "RemoteConnector" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type RemoteConnector = { + fetchCredentials: () => Promise; + invalidateCredentials?: () => void; +}; + +// @alpha +export interface RemoteStorageAdapter { + deleteFile(attachment: AttachmentRecord): Promise; + downloadFile(attachment: AttachmentRecord): Promise; + uploadFile(fileData: ArrayBuffer, attachment: AttachmentRecord): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "RequiredAdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface RequiredAdditionalConnectionOptions extends Required { + // (undocumented) + subscriptions: SubscribedStream[]; +} + +// Warning: (ae-internal-missing-underscore) The name "RequiredPowerSyncConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type RequiredPowerSyncConnectionOptions = Required; + +// @public (undocumented) +export type RowType> = { + [K in keyof T['columnMap']]: ExtractColumnValueType; +} & { + id: string; +}; + +// @public +export enum RowUpdateType { + // (undocumented) + SQLITE_DELETE = 9, + // (undocumented) + SQLITE_INSERT = 18, + // (undocumented) + SQLITE_UPDATE = 23 +} + +// Warning: (ae-internal-missing-underscore) The name "runOnSchemaChange" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function runOnSchemaChange(callback: (signal: AbortSignal) => void, db: AbstractPowerSyncDatabase, options?: SQLWatchOptions): void; + +// @alpha +export function sanitizeSQL(strings: TemplateStringsArray, ...values: any[]): string; + +// @alpha +export function sanitizeUUID(uuid: string): string; + +// Warning: (ae-forgotten-export) The symbol "SchemaType" needs to be exported by the entry point index.d.ts +// +// @public +export class Schema { + constructor(tables: Table[] | S); + // (undocumented) + readonly props: S; + // Warning: (ae-forgotten-export) The symbol "RawTable" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly rawTables: RawTable[]; + static rawTableToJson(table: RawTable): unknown; + // (undocumented) + readonly tables: Table[]; + // (undocumented) + toJSON(): { + tables: { + local_only: boolean | undefined; + insert_only: boolean | undefined; + include_old: any; + include_old_only_when_changed: boolean; + include_metadata: boolean | undefined; + ignore_empty_update: boolean | undefined; + name: string; + view_name: string; + columns: { + name: string; + type: ColumnType | undefined; + }[]; + indexes: { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }[]; + }[]; + raw_tables: unknown[]; + }; + // (undocumented) + readonly types: SchemaTableType; + // (undocumented) + validate(): void; + withRawTables(tables: Record): void; +} + +// @public (undocumented) +export type SchemaTableType = { + [K in keyof S]: RowType; +}; + +// Warning: (ae-internal-missing-underscore) The name "Semaphore" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class Semaphore { + constructor(elements: Iterable); + requestAll(abort?: AbortSignal): Promise<{ + items: T[]; + release: UnlockFn; + }>; + requestOne(abort?: AbortSignal): Promise<{ + item: T; + release: UnlockFn; + }>; + // (undocumented) + readonly size: number; +} + +// Warning: (ae-internal-missing-underscore) The name "SimpleAsyncIterator" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export type SimpleAsyncIterator = Pick, 'next'>; + +// Warning: (ae-internal-missing-underscore) The name "SocketSyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SocketSyncStreamOptions = SyncStreamOptions & { + fetchStrategy: FetchStrategy; +}; + +// @public (undocumented) +export interface SqlExecutor { + execute: (query: string, params?: any[] | undefined) => Promise; + // (undocumented) + executeBatch: (query: string, params?: any[][]) => Promise; + executeRaw: (query: string, params?: any[] | undefined) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "SqliteBucketStorage" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class SqliteBucketStorage extends BaseObserver implements BucketStorageAdapter { + constructor(db: DBAdapter, logger?: ILogger); + // (undocumented) + control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise; + // (undocumented) + dispose(): Promise; + // (undocumented) + getClientId(): Promise; + // (undocumented) + _getClientId(): Promise; + getCrudBatch(limit?: number): Promise; + // (undocumented) + getMaxOpId(): string; + // (undocumented) + hasCrud(): Promise; + // (undocumented) + hasMigratedSubkeys(): Promise; + // (undocumented) + init(): Promise; + // (undocumented) + migrateToFixedSubkeys(): Promise; + // (undocumented) + nextCrudItem(): Promise; + // (undocumented) + static _subkeyMigrationKey: string; + // (undocumented) + tableNames: Set; + // (undocumented) + updateLocalTarget(cb: () => Promise): Promise; + // (undocumented) + writeTransaction(callback: (tx: Transaction) => Promise, options?: { + timeoutMs: number; + }): Promise; +} + +// @public (undocumented) +export interface SQLOnChangeOptions { + // @deprecated (undocumented) + rawTableNames?: boolean; + // (undocumented) + signal?: AbortSignal; + // (undocumented) + tables?: string[]; + throttleMs?: number; + triggerImmediate?: boolean; +} + +// @public (undocumented) +export interface SQLOpenFactory { + openDB(): DBAdapter; +} + +// @public (undocumented) +export interface SQLOpenOptions { + dbFilename: string; + dbLocation?: string; + debugMode?: boolean; +} + +// @public (undocumented) +export interface SQLWatchOptions extends SQLOnChangeOptions { + comparator?: WatchedQueryComparator; +} + +// @public +export type StandardWatchedQuery = WatchedQuery>; + +// @public +export interface StandardWatchedQueryOptions extends WatchedQueryOptions { + comparator?: WatchedQueryComparator; + placeholderData?: RowType[]; +} + +// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface StreamingSyncImplementation extends BaseObserverInterface, Disposable_2 { + connect(options?: InternalConnectionOptions): Promise; + disconnect(): Promise; + // (undocumented) + getWriteCheckpoint: () => Promise; + // (undocumented) + isConnected: boolean; + // (undocumented) + markConnectionMayHaveChanged(): void; + // (undocumented) + syncStatus: SyncStatus; + // (undocumented) + triggerCrudUpload: () => void; + // (undocumented) + updateSubscriptions(subscriptions: SubscribedStream[]): void; + // (undocumented) + waitForReady(): Promise; + // (undocumented) + waitForStatus(status: SyncStatusOptions): Promise; + // (undocumented) + waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementationListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface StreamingSyncImplementationListener extends BaseListener { + statusChanged?: ((status: SyncStatus) => void) | undefined; + statusUpdated?: ((statusUpdate: SyncStatusOptions) => void) | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "JSONValue" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StreamingSyncRequestParameterType = JSONValue; + +// Warning: (ae-internal-missing-underscore) The name "SubscribedStream" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SubscribedStream = { + name: string; + params: Record | null; +}; + +// @public @deprecated (undocumented) +export enum SyncClientImplementation { + RUST = "rust" +} + +// @public (undocumented) +export type SyncDataFlowStatus = Partial<{ + downloading: boolean; + uploading: boolean; + downloadError?: Error; + uploadError?: Error; + downloadProgress: InternalProgressInformation | null; + internalStreamSubscriptions: CoreStreamSubscription[] | null; +}>; + +// Warning: (ae-internal-missing-underscore) The name "SyncingService" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class SyncingService { + constructor(attachmentService: AttachmentService, localStorage: LocalStorageAdapter, remoteStorage: RemoteStorageAdapter, logger: ILogger, errorHandler?: AttachmentErrorHandler); + deleteArchivedAttachments(context: AttachmentContext): Promise; + deleteAttachment(attachment: AttachmentRecord, context: AttachmentContext): Promise; + downloadAttachment(attachment: AttachmentRecord): Promise; + processAttachments(attachments: AttachmentRecord[], context: AttachmentContext): Promise; + uploadAttachment(attachment: AttachmentRecord): Promise; +} + +// @public (undocumented) +export interface SyncPriorityStatus { + // (undocumented) + hasSynced?: boolean; + // (undocumented) + lastSyncedAt?: Date; + // (undocumented) + priority: number; +} + +// @public +export class SyncProgress implements ProgressWithOperations { + constructor(internal: InternalProgressInformation); + // (undocumented) + downloadedFraction: number; + // (undocumented) + downloadedOperations: number; + // (undocumented) + protected internal: InternalProgressInformation; + // (undocumented) + totalOperations: number; + untilPriority(priority: number): ProgressWithOperations; +} + +// @public (undocumented) +export class SyncStatus { + // Warning: (ae-incompatible-release-tags) The symbol "__constructor" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + constructor(options: SyncStatusOptions); + // @deprecated + get clientImplementation(): SyncClientImplementation | undefined; + get connected(): boolean; + get connecting(): boolean; + get dataFlowStatus(): SyncDataFlowStatus; + get downloadProgress(): SyncProgress | null; + forStream(stream: SyncStreamDescription): SyncStreamStatus | undefined; + getMessage(): string; + get hasSynced(): boolean | undefined; + isEqual(status: SyncStatus): boolean; + get lastSyncedAt(): Date | undefined; + // Warning: (ae-incompatible-release-tags) The symbol "options" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + // + // (undocumented) + protected options: SyncStatusOptions; + get priorityStatusEntries(): SyncPriorityStatus[]; + protected serializeError(error?: Error): { + name: string; + message: string; + stack: string | undefined; + } | undefined; + statusForPriority(priority: number): SyncPriorityStatus; + get syncStreams(): SyncStreamStatus[] | undefined; + // Warning: (ae-incompatible-release-tags) The symbol "toJSON" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + toJSON(): SyncStatusOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "SyncStatusOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SyncStatusOptions = { + connected?: boolean; + connecting?: boolean; + dataFlow?: SyncDataFlowStatus; + lastSyncedAt?: Date; + hasSynced?: boolean; + priorityStatusEntries?: SyncPriorityStatus[]; + clientImplementation?: SyncClientImplementation; +}; + +// @public +export interface SyncStream extends SyncStreamDescription { + subscribe(options?: SyncStreamSubscribeOptions): Promise; + unsubscribeAll(): Promise; +} + +// @public (undocumented) +export enum SyncStreamConnectionMethod { + // (undocumented) + HTTP = "http", + // (undocumented) + WEB_SOCKET = "web-socket" +} + +// @public +export interface SyncStreamDescription { + name: string; + parameters: Record | null; +} + +// Warning: (ae-internal-missing-underscore) The name "SyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SyncStreamOptions = { + path: string; + data: unknown; + headers?: Record; + abortSignal: AbortSignal; + fetchOptions?: Request; +}; + +// @public +export interface SyncStreamStatus { + // (undocumented) + priority: number | null; + // (undocumented) + progress: ProgressWithOperations | null; + // (undocumented) + subscription: SyncSubscriptionDescription; +} + +// @public (undocumented) +export interface SyncStreamSubscribeOptions { + priority?: 0 | 1 | 2 | 3; + ttl?: number; +} + +// @public (undocumented) +export interface SyncStreamSubscription extends SyncStreamDescription { + unsubscribe(): void; + waitForFirstSync(abort?: AbortSignal): Promise; +} + +// @public +export interface SyncSubscriptionDescription extends SyncStreamDescription { + // (undocumented) + active: boolean; + expiresAt: Date | null; + hasExplicitSubscription: boolean; + hasSynced: boolean; + isDefault: boolean; + lastSyncedAt: Date | null; +} + +// @public (undocumented) +export class Table { + constructor(columns: Columns, options?: TableV2Options); + // @deprecated + constructor(options: TableOptions); + // (undocumented) + get columnMap(): Columns; + // (undocumented) + get columns(): Column[]; + // (undocumented) + copyWithName(name: string): Table; + // (undocumented) + static createInsertOnly(options: TableOptions): Table; + // (undocumented) + static createLocalOnly(options: TableOptions): Table; + // @deprecated + static createTable(name: string, table: Table): Table; + // (undocumented) + get ignoreEmptyUpdates(): boolean; + // (undocumented) + get indexes(): Index[]; + // (undocumented) + get insertOnly(): boolean; + // (undocumented) + get internalName(): string; + // (undocumented) + get localOnly(): boolean; + // (undocumented) + protected _mappedColumns: Columns; + // (undocumented) + get name(): string; + // (undocumented) + protected options: TableOptions; + // (undocumented) + toJSON(): { + local_only: boolean | undefined; + insert_only: boolean | undefined; + include_old: any; + include_old_only_when_changed: boolean; + include_metadata: boolean | undefined; + ignore_empty_update: boolean | undefined; + name: string; + view_name: string; + columns: { + name: string; + type: ColumnType | undefined; + }[]; + indexes: { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }[]; + }; + // (undocumented) + get trackMetadata(): boolean; + // (undocumented) + get trackPrevious(): boolean | TrackPreviousOptions; + // (undocumented) + validate(): void; + // (undocumented) + get validName(): boolean; + // (undocumented) + get viewName(): string; + // (undocumented) + get viewNameOverride(): string | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "SharedTableOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export interface TableOptions extends SharedTableOptions { + // (undocumented) + columns: Column[]; + // (undocumented) + indexes?: Index[]; + name: string; +} + +// @public +export interface TableOrRawTableOptions { + // (undocumented) + ignoreEmptyUpdates?: boolean; + // (undocumented) + insertOnly?: boolean; + // (undocumented) + localOnly?: boolean; + // (undocumented) + trackMetadata?: boolean; + // (undocumented) + trackPrevious?: boolean | TrackPreviousOptions; +} + +// @public (undocumented) +export interface TableUpdateOperation { + // (undocumented) + opType: RowUpdateType; + // (undocumented) + rowId: number; +} + +// @public @deprecated +export class TableV2 extends Table { +} + +// @public (undocumented) +export interface TableV2Options extends SharedTableOptions { + // (undocumented) + indexes?: IndexShorthand; +} + +// Warning: (ae-internal-missing-underscore) The name "timeoutSignal" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function timeoutSignal(timeout: number): AbortSignal; + +// @internal (undocumented) +export function timeoutSignal(timeout?: number): AbortSignal | undefined; + +// @alpha +export interface TrackDiffOptions extends BaseCreateDiffTriggerOptions { + onChange: (context: TriggerDiffHandlerContext) => Promise; + throttleMs?: number; +} + +// @public +export interface TrackPreviousOptions { + columns?: string[]; + onlyWhenChanged?: boolean; +} + +// @public (undocumented) +export interface Transaction extends LockContext { + commit: () => Promise; + rollback: () => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerClaimManager" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export interface TriggerClaimManager { + checkClaim: (identifier: string) => Promise; + obtainClaim: (identifier: string) => Promise<() => Promise>; +} + +// @alpha +export interface TriggerCreationHooks { + beforeCreate?: (context: LockContext) => Promise; +} + +// @alpha +export interface TriggerDiffDeleteRecord extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.DELETE; + value: string; +} + +// @alpha +export interface TriggerDiffHandlerContext extends LockContext { + destinationTable: string; + withDiff: (query: string, params?: ReadonlyArray>, options?: WithDiffOptions) => Promise; + withExtractedDiff: (query: string, params?: ReadonlyArray>) => Promise; +} + +// @alpha +export interface TriggerDiffInsertRecord extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.INSERT; + value: string; +} + +// @alpha +export type TriggerDiffRecord = TriggerDiffUpdateRecord | TriggerDiffInsertRecord | TriggerDiffDeleteRecord; + +// @alpha +export interface TriggerDiffUpdateRecord extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.UPDATE; + previous_value: string; + value: string; +} + +// @alpha (undocumented) +export interface TriggerManager { + createDiffTrigger(options: CreateDiffTriggerOptions): Promise; + trackTableDiff(options: TrackDiffOptions): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerManagerConfig" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface TriggerManagerConfig { + // (undocumented) + claimManager: TriggerClaimManager; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerManagerImpl" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class TriggerManagerImpl implements TriggerManager { + constructor(options: TriggerManagerImplOptions); + cleanupResources(): Promise; + // (undocumented) + protected cleanupTimeout: ReturnType | null; + // (undocumented) + createDiffTrigger(options: CreateDiffTriggerOptions): Promise<(options?: TriggerRemoveCallbackOptions) => Promise>; + // (undocumented) + protected get db(): AbstractPowerSyncDatabase; + // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplConfiguration" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected defaultConfig: TriggerManagerImplConfiguration; + // (undocumented) + dispose(): void; + // (undocumented) + protected generateTriggerName(operation: DiffTriggerOperation, destinationTable: string, triggerId: string): string; + // (undocumented) + protected getUUID(ctx?: LockContext): Promise; + // (undocumented) + protected isDisposed: boolean; + // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected options: TriggerManagerImplOptions; + // (undocumented) + protected removeTriggers(tx: LockContext, triggerIds: string[]): Promise; + // (undocumented) + protected schema: Schema; + // (undocumented) + trackTableDiff(options: TrackDiffOptions): Promise; + updateDefaults(config: TriggerManagerImplConfiguration): void; +} + +// @alpha +export type TriggerRemoveCallback = (options?: TriggerRemoveCallbackOptions) => Promise; + +// @alpha +export interface TriggerRemoveCallbackOptions { + // (undocumented) + context?: LockContext; +} + +// Warning: (ae-internal-missing-underscore) The name "UnlockFn" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type UnlockFn = () => void; + +// @public +export interface UpdateNotification extends TableUpdateOperation { + // (undocumented) + table: string; +} + +// @public +export enum UpdateType { + DELETE = "DELETE", + PATCH = "PATCH", + PUT = "PUT" +} + +// @public (undocumented) +export class UploadQueueStats { + constructor( + count: number, + size?: number | null); + count: number; + size: number | null; + // (undocumented) + toString(): string; +} + +// @public (undocumented) +export interface WatchCompatibleQuery { + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(options: WatchExecuteOptions): Promise; +} + +// @alpha +export type WatchedAttachmentItem = { + id: string; + filename: string; + fileExtension?: never; + metaData?: string; + mediaType?: string; +} | { + id: string; + fileExtension: string; + filename?: never; + metaData?: string; + mediaType?: string; +}; + +// Warning: (ae-forgotten-export) The symbol "MetaBaseObserverInterface" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export interface WatchedQuery = WatchedQueryListener> extends MetaBaseObserverInterface { + close(): Promise; + // (undocumented) + readonly closed: boolean; + registerListener(listener: Listener): () => void; + readonly state: WatchedQueryState; + updateSettings(options: Settings): Promise; +} + +// @public +export interface WatchedQueryComparator { + // (undocumented) + checkEquality: (current: Data, previous: Data) => boolean; +} + +// @public +export interface WatchedQueryDifferential { + // (undocumented) + readonly added: ReadonlyArray>; + readonly all: ReadonlyArray>; + // (undocumented) + readonly removed: ReadonlyArray>; + // (undocumented) + readonly unchanged: ReadonlyArray>; + // (undocumented) + readonly updated: ReadonlyArray>>; +} + +// @public (undocumented) +export interface WatchedQueryListener extends BaseListener { + // (undocumented) + [WatchedQueryListenerEvent.CLOSED]?: () => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_DATA]?: (data: Data) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_ERROR]?: (error: Error) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_STATE_CHANGE]?: (state: WatchedQueryState) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.SETTINGS_WILL_UPDATE]?: () => void; +} + +// @public (undocumented) +export enum WatchedQueryListenerEvent { + // (undocumented) + CLOSED = "closed", + // (undocumented) + ON_DATA = "onData", + // (undocumented) + ON_ERROR = "onError", + // (undocumented) + ON_STATE_CHANGE = "onStateChange", + // (undocumented) + SETTINGS_WILL_UPDATE = "settingsWillUpdate" +} + +// @public (undocumented) +export interface WatchedQueryOptions { + reportFetching?: boolean; + throttleMs?: number; + triggerOnTables?: string[]; +} + +// @public +export interface WatchedQueryRowDifferential { + // (undocumented) + readonly current: RowType; + // (undocumented) + readonly previous: RowType; +} + +// @public +export interface WatchedQuerySettings extends WatchedQueryOptions { + // (undocumented) + query: WatchCompatibleQuery; +} + +// @public +export interface WatchedQueryState { + readonly data: Data; + readonly error: Error | null; + readonly isFetching: boolean; + readonly isLoading: boolean; + readonly lastUpdated: Date | null; +} + +// @public +export interface WatchExecuteOptions { + // (undocumented) + db: AbstractPowerSyncDatabase; + // (undocumented) + parameters: any[]; + // (undocumented) + sql: string; +} + +// @public (undocumented) +export interface WatchHandler { + // (undocumented) + onError?: (error: Error) => void; + // (undocumented) + onResult: (results: QueryResult) => void; +} + +// @public (undocumented) +export interface WatchOnChangeEvent { + // (undocumented) + changedTables: string[]; +} + +// @public (undocumented) +export interface WatchOnChangeHandler { + // (undocumented) + onChange: (event: WatchOnChangeEvent) => Promise | void; + // (undocumented) + onError?: (error: Error) => void; +} + +// @alpha +export interface WithDiffOptions { + castOperationIdAsText?: boolean; +} + +// Warnings were encountered during analysis: +// +// lib/db/crud/SyncStatus.d.ts:27:5 - (ae-forgotten-export) The symbol "InternalProgressInformation" needs to be exported by the entry point index.d.ts +// lib/db/crud/SyncStatus.d.ts:31:5 - (ae-forgotten-export) The symbol "CoreStreamSubscription" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` From b98f7970e57e0bd871723af166b5e5c93017acfe Mon Sep 17 00:00:00 2001 From: Christiaan Landman Date: Wed, 10 Jun 2026 14:55:17 +0200 Subject: [PATCH 3/5] Reverting whitespace changes. --- packages/common/etc/common.api.md | 4970 +++++++++++++++-------------- 1 file changed, 2529 insertions(+), 2441 deletions(-) diff --git a/packages/common/etc/common.api.md b/packages/common/etc/common.api.md index 64bf23062..7b133a7d9 100644 --- a/packages/common/etc/common.api.md +++ b/packages/common/etc/common.api.md @@ -1,2441 +1,2529 @@ -## API Report File for "@powersync/common" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { fetch as fetch_2 } from 'cross-fetch'; -import { GlobalLogger } from 'js-logger'; -import { ILogger } from 'js-logger'; -import { ILoggerOpts } from 'js-logger'; -import { ILogHandler } from 'js-logger'; -import { ILogLevel } from 'js-logger'; -import Logger from 'js-logger'; - -// Warning: (ae-internal-missing-underscore) The name "AbortOperation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class AbortOperation extends Error { - constructor(reason: string); - // (undocumented) - protected reason: string; -} - -// Warning: (ae-incompatible-release-tags) The symbol "AbstractPowerSyncDatabase" is marked as @public, but its signature references "BaseObserver" which is marked as @internal -// -// @public (undocumented) -export abstract class AbstractPowerSyncDatabase extends BaseObserver { - constructor(options: PowerSyncDatabaseOptionsWithDBAdapter); - constructor(options: PowerSyncDatabaseOptionsWithOpenFactory); - constructor(options: PowerSyncDatabaseOptionsWithSettings); - constructor(options: PowerSyncDatabaseOptions); - // Warning: (ae-incompatible-release-tags) The symbol "bucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal - // - // (undocumented) - protected bucketStorageAdapter: BucketStorageAdapter; - close(options?: PowerSyncCloseOptions): Promise; - closed: boolean; - connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise; - get connected(): boolean; - // (undocumented) - get connecting(): boolean; - // Warning: (ae-incompatible-release-tags) The symbol "connectionManager" is marked as @public, but its signature references "ConnectionManager" which is marked as @internal - // - // (undocumented) - protected connectionManager: ConnectionManager; - // Warning: (ae-incompatible-release-tags) The symbol "connectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal - get connectionOptions(): InternalConnectionOptions | null; - get connector(): PowerSyncBackendConnector | null; - currentStatus: SyncStatus; - customQuery(query: WatchCompatibleQuery): Query; - get database(): DBAdapter; - disconnect(): Promise; - disconnectAndClear(options?: DisconnectAndClearOptions): Promise; - // @deprecated (undocumented) - dispose(): void; - execute(sql: string, parameters?: any[]): Promise; - executeBatch(sql: string, parameters?: any[][]): Promise; - executeRaw(sql: string, parameters?: any[]): Promise; - // Warning: (ae-incompatible-release-tags) The symbol "generateBucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal - // - // (undocumented) - protected abstract generateBucketStorageAdapter(): BucketStorageAdapter; - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal - // - // (undocumented) - protected abstract generateSyncStreamImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions): StreamingSyncImplementation; - // Warning: (ae-incompatible-release-tags) The symbol "generateTriggerManagerConfig" is marked as @public, but its signature references "TriggerManagerConfig" which is marked as @internal - protected generateTriggerManagerConfig(): TriggerManagerConfig; - get(sql: string, parameters?: any[]): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getClientId(): Promise; - getCrudBatch(limit?: number): Promise; - getCrudTransactions(): AsyncIterable; - getNextCrudTransaction(): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - getUploadQueueStats(includeSize?: boolean): Promise; - init(): Promise; - protected initialize(): Promise; - abstract _initialize(): Promise; - // (undocumented) - protected _isReadyPromise: Promise; - // (undocumented) - protected loadVersion(): Promise; - // (undocumented) - logger: ILogger; - onChange(options?: SQLOnChangeOptions): AsyncIterable; - onChange(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; - onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable; - onChangeWithCallback(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; - protected abstract openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter; - // (undocumented) - protected options: PowerSyncDatabaseOptions; - query(query: ArrayQueryDefinition): Query; - readLock(callback: (db: LockContext) => Promise): Promise; - readTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; - // (undocumented) - ready: boolean; - // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal - // - // (undocumented) - protected resolvedConnectionOptions(options: CreateSyncImplementationOptions): CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions; - // (undocumented) - protected resolveOfflineSyncStatus(): Promise; - resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise; - protected runExclusive(callback: () => Promise): Promise; - // Warning: (ae-incompatible-release-tags) The symbol "runExclusiveMutex" is marked as @public, but its signature references "Mutex" which is marked as @internal - // - // (undocumented) - protected runExclusiveMutex: Mutex; - get schema(): Schema<{ - [x: string]: Table; - }>; - // (undocumented) - protected _schema: Schema; - // (undocumented) - sdkVersion: string; - syncStream(name: string, params?: Record): SyncStream; - // Warning: (ae-incompatible-release-tags) The symbol "syncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal - // - // (undocumented) - get syncStreamImplementation(): StreamingSyncImplementation | null; - // Warning: (ae-incompatible-release-tags) The symbol "triggers" is marked as @public, but its signature references "TriggerManager" which is marked as @alpha - readonly triggers: TriggerManager; - // Warning: (ae-incompatible-release-tags) The symbol "triggersImpl" is marked as @public, but its signature references "TriggerManagerImpl" which is marked as @internal - // - // (undocumented) - protected triggersImpl: TriggerManagerImpl; - updateSchema(schema: Schema): Promise; - waitForFirstSync(request?: AbortSignal | { - signal?: AbortSignal; - priority?: number; - }): Promise; - // (undocumented) - waitForReady(): Promise; - waitForStatus(predicate: (status: SyncStatus) => any, signal?: AbortSignal): Promise; - watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; - watch(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; - watchWithAsyncGenerator(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; - watchWithCallback(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; - writeLock(callback: (db: LockContext) => Promise): Promise; - writeTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractPowerSyncDatabaseOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractPowerSyncDatabaseOpenFactory { - constructor(options: PowerSyncOpenFactoryOptions); - // (undocumented) - abstract generateInstance(options: PowerSyncDatabaseOptions): AbstractPowerSyncDatabase; - // (undocumented) - generateOptions(): PowerSyncDatabaseOptions; - // (undocumented) - getInstance(): AbstractPowerSyncDatabase; - // (undocumented) - protected abstract openDB(): DBAdapter; - // (undocumented) - protected options: PowerSyncOpenFactoryOptions; - get schema(): Schema<{ - [x: string]: Table; - }>; -} - -// Warning: (ae-forgotten-export) The symbol "MetaBaseObserver" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "WatchedQueryProcessorListener" needs to be exported by the entry point index.d.ts -// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export abstract class AbstractQueryProcessor extends MetaBaseObserver> implements WatchedQuery { - constructor(options: AbstractQueryProcessorOptions); - // (undocumented) - protected abortController: AbortController; - // (undocumented) - close(): Promise; - // (undocumented) - get closed(): boolean; - // (undocumented) - protected _closed: boolean; - // (undocumented) - protected constructInitialState(): WatchedQueryState; - // (undocumented) - protected disposeListeners: (() => void) | null; - protected init(signal: AbortSignal): Promise; - // (undocumented) - protected initialized: Promise; - protected iterateAsyncListenersWithError(callback: (listener: Partial>) => Promise | void): Promise; - protected abstract linkQuery(options: LinkQueryOptions): Promise; - // (undocumented) - protected options: AbstractQueryProcessorOptions; - // (undocumented) - protected get reportFetching(): boolean; - protected runWithReporting(callback: () => Promise): Promise; - // (undocumented) - readonly state: WatchedQueryState; - updateSettings(settings: Settings): Promise; - // (undocumented) - protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise; - // (undocumented) - protected updateState(update: Partial>): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AbstractQueryProcessorOptions { - // (undocumented) - db: AbstractPowerSyncDatabase; - // (undocumented) - placeholderData: Data; - // (undocumented) - watchOptions: Settings; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractRemote" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractRemote { - constructor(connector: RemoteConnector, logger?: ILogger, options?: Partial); - // (undocumented) - protected buildRequest(path: string): Promise<{ - url: string; - headers: { - 'content-type': string; - Authorization: string; - 'x-user-agent': string; - }; - }>; - // (undocumented) - protected connector: RemoteConnector; - // (undocumented) - protected createSocket(url: string): WebSocket; - // (undocumented) - createTextDecoder(): TextDecoder; - // (undocumented) - protected credentials: PowerSyncCredentials | null; - // (undocumented) - get fetch(): FetchImplementation; - fetchCredentials(): Promise; - fetchStream(options: SyncStreamOptions): Promise>; - protected fetchStreamRaw(options: SyncStreamOptions): Promise<{ - isBson: boolean; - stream: SimpleAsyncIterator; - }>; - // (undocumented) - get(path: string, headers?: Record): Promise; - getCredentials(): Promise; - // (undocumented) - getUserAgent(): string; - invalidateCredentials(): void; - // (undocumented) - protected logger: ILogger; - // (undocumented) - protected options: AbstractRemoteOptions; - // (undocumented) - post(path: string, data: any, headers?: Record): Promise; - prefetchCredentials(): Promise; - socketStreamRaw(options: SocketSyncStreamOptions): Promise>; - // (undocumented) - protected get supportsStreamingBinaryResponses(): boolean; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractRemoteOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type AbstractRemoteOptions = { - socketUrlTransformer: (url: string) => string; - fetchImplementation: FetchImplementation | FetchImplementationProvider; - fetchOptions?: {}; -}; - -// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractStreamingSyncImplementation extends BaseObserver implements StreamingSyncImplementation { - constructor(options: AbstractStreamingSyncImplementationOptions); - // (undocumented) - protected abortController: AbortController | null; - // (undocumented) - connect(options?: PowerSyncConnectionOptions): Promise; - // (undocumented) - protected crudUpdateListener?: () => void; - // (undocumented) - disconnect(): Promise; - // (undocumented) - dispose(): Promise; - // (undocumented) - getWriteCheckpoint(): Promise; - // (undocumented) - get isConnected(): boolean; - // (undocumented) - get lastSyncedAt(): Date | undefined; - // (undocumented) - protected logger: ILogger; - // (undocumented) - markConnectionMayHaveChanged(): void; - // (undocumented) - abstract obtainLock(lockOptions: LockOptions_2): Promise; - // (undocumented) - protected options: AbstractStreamingSyncImplementationOptions; - // Warning: (ae-forgotten-export) The symbol "RustIterationResult" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected streamingSyncIteration(signal: AbortSignal, options?: PowerSyncConnectionOptions): Promise; - // (undocumented) - protected streamingSyncPromise?: Promise<[void, void]>; - // (undocumented) - syncStatus: SyncStatus; - // (undocumented) - triggerCrudUpload(): void; - // (undocumented) - updateSubscriptions(subscriptions: SubscribedStream[]): void; - // (undocumented) - protected updateSyncStatus(options: SyncStatusOptions): void; - // (undocumented) - waitForReady(): Promise; - // (undocumented) - waitForStatus(status: SyncStatusOptions): Promise; - // (undocumented) - waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AbstractStreamingSyncImplementationOptions extends RequiredAdditionalConnectionOptions { - // (undocumented) - adapter: BucketStorageAdapter; - identifier?: string; - // (undocumented) - logger?: ILogger; - // (undocumented) - remote: AbstractRemote; - // (undocumented) - subscriptions: SubscribedStream[]; - // (undocumented) - uploadCrud: () => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AdditionalConnectionOptions { - crudUploadThrottleMs?: number; - retryDelayMs?: number; -} - -// @public -export class ArrayComparator implements WatchedQueryComparator { - constructor(options: ArrayComparatorOptions); - // (undocumented) - checkEquality(current: ItemType[], previous: ItemType[]): boolean; - // (undocumented) - protected options: ArrayComparatorOptions; -} - -// @public -export type ArrayComparatorOptions = { - compareBy: (item: ItemType) => string; -}; - -// @public -export interface ArrayQueryDefinition { - mapper?: (row: Record) => RowType; - // (undocumented) - parameters?: ReadonlyArray>; - // (undocumented) - sql: string; -} - -// @alpha -export const ATTACHMENT_TABLE = "attachments"; - -// @alpha -export class AttachmentContext { - constructor(db: AbstractPowerSyncDatabase, tableName: string | undefined, logger: ILogger, archivedCacheLimit: number); - readonly archivedCacheLimit: number; - // (undocumented) - clearQueue(): Promise; - readonly db: AbstractPowerSyncDatabase; - // (undocumented) - deleteArchivedAttachments(callback?: (attachments: AttachmentRecord[]) => Promise): Promise; - deleteAttachment(attachmentId: string): Promise; - getActiveAttachments(): Promise; - getArchivedAttachments(): Promise; - // (undocumented) - getAttachment(id: string): Promise; - getAttachments(): Promise; - readonly logger: ILogger; - saveAttachments(attachments: AttachmentRecord[]): Promise; - readonly tableName: string; - upsertAttachment(attachment: AttachmentRecord, context: Transaction): Promise; -} - -// @alpha (undocumented) -export type AttachmentData = ArrayBuffer | string; - -// @alpha -export interface AttachmentErrorHandler { - onDeleteError(attachment: AttachmentRecord, error: unknown): Promise; - onDownloadError(attachment: AttachmentRecord, error: unknown): Promise; - onUploadError(attachment: AttachmentRecord, error: unknown): Promise; -} - -// @alpha -export function attachmentFromSql(row: any): AttachmentRecord; - -// @alpha -export class AttachmentQueue implements AttachmentQueue { - constructor(input: { - db: AbstractPowerSyncDatabase; - remoteStorage: RemoteStorageAdapter; - localStorage: LocalStorageAdapter; - watchAttachments: (onUpdate: (attachment: WatchedAttachmentItem[]) => Promise, signal: AbortSignal) => void; - tableName?: string; - logger?: ILogger; - syncIntervalMs?: number; - syncThrottleDuration?: number; - downloadAttachments?: boolean; - archivedCacheLimit?: number; - errorHandler?: AttachmentErrorHandler; - }); - readonly archivedCacheLimit: number; - // (undocumented) - clearQueue(): Promise; - // (undocumented) - deleteFile(input: { - id: string; - updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; - }): Promise; - readonly downloadAttachments: boolean; - // (undocumented) - expireCache(): Promise; - generateAttachmentId(): Promise; - readonly localStorage: LocalStorageAdapter; - readonly logger: ILogger; - readonly remoteStorage: RemoteStorageAdapter; - saveFile(input: { - data: AttachmentData; - fileExtension: string; - mediaType?: string; - metaData?: string; - id?: string; - updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; - }): Promise; - startSync(): Promise; - stopSync(): Promise; - readonly syncIntervalMs: number; - syncStorage(): Promise; - readonly syncThrottleDuration: number; - readonly tableName: string; - verifyAttachments(): Promise; - withAttachmentContext(callback: (context: AttachmentContext) => Promise): Promise; -} - -// @alpha -export interface AttachmentRecord { - // (undocumented) - filename: string; - // (undocumented) - hasSynced?: boolean; - // (undocumented) - id: string; - // (undocumented) - localUri?: string; - // (undocumented) - mediaType?: string; - // (undocumented) - metaData?: string; - // (undocumented) - size?: number; - // (undocumented) - state: AttachmentState; - // (undocumented) - timestamp?: number; -} - -// Warning: (ae-internal-missing-underscore) The name "AttachmentService" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class AttachmentService { - constructor(db: AbstractPowerSyncDatabase, logger: ILogger, tableName?: string, archivedCacheLimit?: number); - watchActiveAttachments(input?: { - throttleMs?: number; - }): DifferentialWatchedQuery; - withContext(callback: (context: AttachmentContext) => Promise): Promise; -} - -// @alpha -export enum AttachmentState { - // (undocumented) - ARCHIVED = 4,// Attachment to be uploaded - // (undocumented) - QUEUED_DELETE = 2,// Attachment to be downloaded - // (undocumented) - QUEUED_DOWNLOAD = 1,// Attachment to be deleted - // (undocumented) - QUEUED_UPLOAD = 0,// Attachment has been synced - // (undocumented) - SYNCED = 3 -} - -// @alpha -export class AttachmentTable extends Table { - constructor(options?: AttachmentTableOptions); -} - -// @alpha (undocumented) -export interface AttachmentTableOptions extends Omit { -} - -// @public (undocumented) -export type BaseColumnType = { - type: ColumnType; -}; - -// @public (undocumented) -export interface BaseConnectionOptions { - appMetadata?: Record; - // @deprecated (undocumented) - clientImplementation?: SyncClientImplementation; - connectionMethod?: SyncStreamConnectionMethod; - fetchStrategy?: FetchStrategy; - includeDefaultStreams?: boolean; - params?: Record; - serializedSchema?: any; -} - -// @public (undocumented) -export type BaseListener = Record any) | undefined>; - -// Warning: (ae-internal-missing-underscore) The name "BaseObserver" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class BaseObserver implements BaseObserverInterface { - constructor(); - // (undocumented) - dispose(): void; - // (undocumented) - iterateAsyncListeners(cb: (listener: Partial) => Promise): Promise; - // (undocumented) - iterateListeners(cb: (listener: Partial) => any): void; - // (undocumented) - protected listeners: Set>; - registerListener(listener: Partial): () => void; -} - -// @public (undocumented) -export interface BaseObserverInterface { - // (undocumented) - registerListener(listener: Partial): () => void; -} - -// Warning: (ae-incompatible-release-tags) The symbol "BasePowerSyncDatabaseOptions" is marked as @public, but its signature references "AdditionalConnectionOptions" which is marked as @internal -// -// @public (undocumented) -export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions { - // (undocumented) - logger?: ILogger; - // @deprecated (undocumented) - retryDelay?: number; - schema: Schema; -} - -// @alpha -export interface BaseTriggerDiffRecord { - id: string; - operation: DiffTriggerOperation; - operation_id: TOperationId; - timestamp: string; -} - -// @public (undocumented) -export interface BatchedUpdateNotification { - // (undocumented) - groupedUpdates: Record; - // (undocumented) - rawUpdates: UpdateNotification[]; - // (undocumented) - tables: string[]; -} - -// Warning: (ae-internal-missing-underscore) The name "BucketStorageAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface BucketStorageAdapter extends BaseObserverInterface, Disposable_2 { - control(op: PowerSyncControlCommand, payload: string | Uint8Array | null): Promise; - getClientId(): Promise; - // (undocumented) - getCrudBatch(limit?: number): Promise; - // (undocumented) - getMaxOpId(): string; - // (undocumented) - hasCrud(): Promise; - // (undocumented) - hasMigratedSubkeys(): Promise; - // (undocumented) - init(): Promise; - // (undocumented) - migrateToFixedSubkeys(): Promise; - // (undocumented) - nextCrudItem(): Promise; - // (undocumented) - updateLocalTarget(cb: () => Promise): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "BucketStorageListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface BucketStorageListener extends BaseListener { - // (undocumented) - crudUpdate: () => void; -} - -// @public (undocumented) -export class Column { - constructor(options: ColumnOptions); - // (undocumented) - get name(): string; - // (undocumented) - protected options: ColumnOptions; - // (undocumented) - toJSON(): { - name: string; - type: ColumnType | undefined; - }; - // (undocumented) - get type(): ColumnType | undefined; -} - -// @public (undocumented) -export const column: { - text: BaseColumnType; - integer: BaseColumnType; - real: BaseColumnType; -}; - -// @public (undocumented) -export interface ColumnOptions { - // (undocumented) - name: string; - // (undocumented) - type?: ColumnType; -} - -// @public (undocumented) -export type ColumnsType = Record>; - -// @public (undocumented) -export enum ColumnType { - // (undocumented) - INTEGER = "INTEGER", - // (undocumented) - REAL = "REAL", - // (undocumented) - TEXT = "TEXT" -} - -// @public (undocumented) -export interface CompilableQuery { - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(): Promise; -} - -// @public (undocumented) -export function compilableQueryWatch(db: AbstractPowerSyncDatabase, query: CompilableQuery, handler: CompilableQueryWatchHandler, options?: SQLWatchOptions): void; - -// @public (undocumented) -export interface CompilableQueryWatchHandler { - // (undocumented) - onError?: (error: Error) => void; - // (undocumented) - onResult: (results: T[]) => void; -} - -// @public (undocumented) -export interface CompiledQuery { - // (undocumented) - readonly parameters: ReadonlyArray; - // (undocumented) - readonly sql: string; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionClosedError" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class ConnectionClosedError extends Error { - constructor(message: string); - // (undocumented) - static MATCHES(input: any): boolean; - // (undocumented) - static NAME: string; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManager" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class ConnectionManager extends BaseObserver { - constructor(options: ConnectionManagerOptions); - get activeStreams(): { - name: string; - params: Record | null; - }[]; - // (undocumented) - close(): Promise; - // (undocumented) - connect(connector: PowerSyncBackendConnector, options: InternalConnectionOptions): Promise; - protected connectingPromise: Promise | null; - // (undocumented) - protected connectInternal(): Promise; - // (undocumented) - get connectionOptions(): InternalConnectionOptions | null; - // (undocumented) - get connector(): PowerSyncBackendConnector | null; - disconnect(): Promise; - protected disconnectingPromise: Promise | null; - // (undocumented) - protected disconnectInternal(): Promise; - // (undocumented) - get logger(): ILogger; - // (undocumented) - protected options: ConnectionManagerOptions; - // Warning: (ae-forgotten-export) The symbol "StoredConnectionOptions" needs to be exported by the entry point index.d.ts - protected pendingConnectionOptions: StoredConnectionOptions | null; - // (undocumented) - protected performDisconnect(): Promise; - // (undocumented) - stream(adapter: InternalSubscriptionAdapter, name: string, parameters: Record | null): SyncStream; - protected syncDisposer: (() => Promise | void) | null; - // (undocumented) - syncStreamImplementation: StreamingSyncImplementation | null; - protected syncStreamInitPromise: Promise | null; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerListener extends BaseListener { - // (undocumented) - syncStreamCreated: (sync: StreamingSyncImplementation) => void; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerOptions { - // (undocumented) - createSyncImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions): Promise; - // (undocumented) - logger: ILogger; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerSyncImplementationResult" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerSyncImplementationResult { - onDispose: () => Promise | void; - // (undocumented) - sync: StreamingSyncImplementation; -} - -// @public (undocumented) -export interface ConnectionPool extends BaseObserverInterface { - // (undocumented) - close: () => void | Promise; - // (undocumented) - name: string; - // (undocumented) - readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - refreshSchema: () => Promise; - // (undocumented) - writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "ControlledExecutor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class ControlledExecutor { - constructor(task: (param: T) => Promise | void, options?: ControlledExecutorOptions); - // (undocumented) - dispose(): void; - // (undocumented) - schedule(param: T): void; -} - -// Warning: (ae-internal-missing-underscore) The name "ControlledExecutorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ControlledExecutorOptions { - throttleEnabled?: boolean; -} - -// @public -export function createBaseLogger(): typeof Logger; - -// Warning: (ae-forgotten-export) The symbol "BaseCreateDiffTriggerOptions" needs to be exported by the entry point index.d.ts -// -// @alpha -export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions { - destination: string; - setupContext?: LockContext; -} - -// @public -export function createLogger(name: string, options?: CreateLoggerOptions): ILogger; - -// @public (undocumented) -export interface CreateLoggerOptions { - // (undocumented) - logLevel?: ILogLevel; -} - -// Warning: (ae-internal-missing-underscore) The name "CreateSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export interface CreateSyncImplementationOptions extends AdditionalConnectionOptions { - // (undocumented) - subscriptions: SubscribedStream[]; -} - -// @public -export class CrudBatch { - constructor( - crud: CrudEntry[], - haveMore: boolean, - complete: (writeCheckpoint?: string) => Promise); - complete: (writeCheckpoint?: string) => Promise; - crud: CrudEntry[]; - haveMore: boolean; -} - -// @public -export class CrudEntry { - constructor(clientId: number, op: UpdateType, table: string, id: string, transactionId?: number, opData?: Record, previousValues?: Record, metadata?: string); - clientId: number; - // (undocumented) - equals(entry: CrudEntry): boolean; - // Warning: (ae-forgotten-export) The symbol "CrudEntryJSON" needs to be exported by the entry point index.d.ts - // - // (undocumented) - static fromRow(dbRow: CrudEntryJSON): CrudEntry; - // @deprecated - hashCode(): string; - id: string; - metadata?: string; - op: UpdateType; - opData?: Record; - previousValues?: Record; - table: string; - toComparisonArray(): (string | number | Record | undefined)[]; - // Warning: (ae-forgotten-export) The symbol "CrudEntryOutputJSON" needs to be exported by the entry point index.d.ts - toJSON(): CrudEntryOutputJSON; - transactionId?: number; -} - -// @public (undocumented) -export class CrudTransaction extends CrudBatch { - constructor( - crud: CrudEntry[], - complete: (checkpoint?: string) => Promise, - transactionId?: number | undefined); - complete: (checkpoint?: string) => Promise; - crud: CrudEntry[]; - transactionId?: number | undefined; -} - -// @public (undocumented) -export interface DBAdapter extends ConnectionPool, SqlExecutor, DBGetUtils { - // (undocumented) - readTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; - // (undocumented) - writeTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "DBAdapterDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function DBAdapterDefaultMixin ConnectionPool>(Base: TBase): { - new (...args: any[]): { - readTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; - writeTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - get(sql: string, parameters?: any[]): Promise; - execute(query: string, params?: any[]): Promise; - executeRaw(query: string, params?: any[]): Promise; - executeBatch(query: string, params?: any[][]): Promise; - name: string; - close: () => void | Promise; - readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - refreshSchema: () => Promise; - registerListener(listener: Partial): () => void; - }; -} & TBase; - -// @public (undocumented) -export interface DBAdapterListener extends BaseListener { - tablesUpdated: (updateNotification: BatchedUpdateNotification | UpdateNotification) => void; -} - -// @public (undocumented) -export interface DBGetUtils { - get(sql: string, parameters?: any[]): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "DBGetUtilsDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function DBGetUtilsDefaultMixin Omit>(Base: TBase): { - new (...args: any[]): { - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - get(sql: string, parameters?: any[]): Promise; - executeBatch(query: string, params?: any[][]): Promise; - execute: (query: string, params?: any[] | undefined) => Promise; - executeRaw: (query: string, params?: any[] | undefined) => Promise; - }; -} & TBase; - -// @public (undocumented) -export interface DBLockOptions { - // (undocumented) - timeoutMs?: number; -} - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_BATCH_LIMIT" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_CRUD_BATCH_LIMIT = 100; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_UPLOAD_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_COLUMN_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_INDEX_COLUMN_OPTIONS: Partial; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_INDEX_OPTIONS: Partial; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_LOCK_TIMEOUT_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const DEFAULT_LOCK_TIMEOUT_MS = 120000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_CLOSE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_DB_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_POWERSYNC_DB_OPTIONS: { - retryDelayMs: number; - crudUploadThrottleMs: number; -}; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_LOGGER" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_REMOTE_LOGGER: Logger.ILogger; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_RETRY_DELAY_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_RETRY_DELAY_MS = 5000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_ROW_COMPARATOR" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const DEFAULT_ROW_COMPARATOR: DifferentialWatchedQueryComparator; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAM_CONNECTION_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAMING_SYNC_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_STREAMING_SYNC_OPTIONS: { - retryDelayMs: number; - crudUploadThrottleMs: number; -}; - -// @public @deprecated -export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_TABLE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_TABLE_OPTIONS: { - indexes: never[]; - insertOnly: boolean; - localOnly: boolean; - trackPrevious: boolean; - trackMetadata: boolean; - ignoreEmptyUpdates: boolean; -}; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_QUERY_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_WATCH_QUERY_OPTIONS: WatchedQueryOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_WATCH_THROTTLE_MS = 30; - -// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class DifferentialQueryProcessor extends AbstractQueryProcessor>, DifferentialWatchedQuerySettings> implements DifferentialWatchedQuery { - constructor(options: DifferentialQueryProcessorOptions); - // (undocumented) - protected comparator: DifferentialWatchedQueryComparator; - // Warning: (ae-forgotten-export) The symbol "DataHashMap" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected differentiate(current: RowType[], previousMap: DataHashMap): { - diff: WatchedQueryDifferential; - map: DataHashMap; - hasChanged: boolean; - }; - // (undocumented) - protected linkQuery(options: LinkQueryOptions>): Promise; - // (undocumented) - protected options: DifferentialQueryProcessorOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface DifferentialQueryProcessorOptions extends AbstractQueryProcessorOptions> { - // (undocumented) - rowComparator?: DifferentialWatchedQueryComparator; -} - -// @public (undocumented) -export type DifferentialWatchedQuery = WatchedQuery>, DifferentialWatchedQuerySettings, DifferentialWatchedQueryListener>; - -// @public -export interface DifferentialWatchedQueryComparator { - compareBy: (item: RowType) => string; - keyBy: (item: RowType) => string; -} - -// @public (undocumented) -export interface DifferentialWatchedQueryListener extends WatchedQueryListener>> { - // (undocumented) - onDiff?: (diff: WatchedQueryDifferential) => void | Promise; -} - -// @public -export interface DifferentialWatchedQueryOptions extends WatchedQueryOptions { - placeholderData?: RowType[]; - rowComparator?: DifferentialWatchedQueryComparator; -} - -// @public -export interface DifferentialWatchedQuerySettings extends DifferentialWatchedQueryOptions { - query: WatchCompatibleQuery; -} - -// @alpha -export enum DiffTriggerOperation { - // (undocumented) - DELETE = "DELETE", - // (undocumented) - INSERT = "INSERT", - // (undocumented) - UPDATE = "UPDATE" -} - -// @public (undocumented) -export interface DisconnectAndClearOptions { - clearLocal?: boolean; -} - -// @public (undocumented) -interface Disposable_2 { - // (undocumented) - dispose: () => Promise | void; -} -export { Disposable_2 as Disposable } - -// Warning: (ae-internal-missing-underscore) The name "EMPTY_DIFFERENTIAL" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const EMPTY_DIFFERENTIAL: { - added: never[]; - all: never[]; - removed: never[]; - updated: never[]; - unchanged: never[]; -}; - -// @alpha (undocumented) -export enum EncodingType { - // (undocumented) - Base64 = "base64", - // (undocumented) - UTF8 = "utf8" -} - -// @public (undocumented) -export type ExtractColumnValueType> = T extends BaseColumnType ? R : unknown; - -// @alpha -export type ExtractedTriggerDiffRecord = T & { - [K in keyof Omit, 'id'> as `__${string & K}`]: TriggerDiffRecord[K]; -} & { - __previous_value?: string; -}; - -// Warning: (ae-internal-missing-underscore) The name "extractTableUpdates" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function extractTableUpdates(update: BatchedUpdateNotification | UpdateNotification): string[]; - -// @public -export const FalsyComparator: WatchedQueryComparator; - -// Warning: (ae-internal-missing-underscore) The name "FetchImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type FetchImplementation = typeof fetch_2; - -// Warning: (ae-internal-missing-underscore) The name "FetchImplementationProvider" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class FetchImplementationProvider { - // (undocumented) - getFetch(): FetchImplementation; -} - -// @public (undocumented) -export enum FetchStrategy { - Buffered = "buffered", - Sequential = "sequential" -} - -// @public -export class GetAllQuery implements WatchCompatibleQuery { - constructor(options: GetAllQueryOptions); - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(options: { - db: AbstractPowerSyncDatabase; - }): Promise; - // (undocumented) - protected options: GetAllQueryOptions; -} - -// @public -export type GetAllQueryOptions = { - sql: string; - parameters?: ReadonlyArray; - mapper?: (rawRow: Record) => RowType; -}; - -export { GlobalLogger } - -export { ILogger } - -export { ILoggerOpts } - -export { ILogHandler } - -export { ILogLevel } - -// @public (undocumented) -export class Index { - constructor(options: IndexOptions); - // (undocumented) - get columns(): IndexedColumn[]; - // (undocumented) - static createAscending(options: IndexOptions, columnNames: string[]): Index; - // (undocumented) - get name(): string; - // (undocumented) - protected options: IndexOptions; - // (undocumented) - toJSON(table: Table): { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }; -} - -// @public (undocumented) -export interface IndexColumnOptions { - // (undocumented) - ascending?: boolean; - // (undocumented) - name: string; -} - -// @public (undocumented) -export class IndexedColumn { - constructor(options: IndexColumnOptions); - // (undocumented) - get ascending(): boolean | undefined; - // (undocumented) - static createAscending(column: string): IndexedColumn; - // (undocumented) - get name(): string; - // (undocumented) - protected options: IndexColumnOptions; - // (undocumented) - toJSON(table: Table): { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }; -} - -// @public (undocumented) -export interface IndexOptions { - // (undocumented) - columns?: IndexedColumn[]; - // (undocumented) - name: string; -} - -// @public (undocumented) -export type IndexShorthand = Record; - -// Warning: (ae-internal-missing-underscore) The name "InternalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions { -} - -// Warning: (ae-internal-missing-underscore) The name "InternalSubscriptionAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface InternalSubscriptionAdapter { - // (undocumented) - firstStatusMatching(predicate: (status: SyncStatus) => any, abort?: AbortSignal): Promise; - // (undocumented) - resolveOfflineSyncStatus(): Promise; - // (undocumented) - rustSubscriptionsCommand(payload: any): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "InvalidSQLCharacters" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const InvalidSQLCharacters: RegExp; - -// Warning: (ae-internal-missing-underscore) The name "isBatchedUpdateNotification" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function isBatchedUpdateNotification(update: BatchedUpdateNotification | UpdateNotification): update is BatchedUpdateNotification; - -// Warning: (ae-internal-missing-underscore) The name "isDBAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isDBAdapter: (test: any) => test is DBAdapter; - -// Warning: (ae-internal-missing-underscore) The name "isPowerSyncDatabaseOptionsWithSettings" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isPowerSyncDatabaseOptionsWithSettings: (test: any) => test is PowerSyncDatabaseOptionsWithSettings; - -// Warning: (ae-internal-missing-underscore) The name "isSQLOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isSQLOpenFactory: (test: any) => test is SQLOpenFactory; - -// Warning: (ae-internal-missing-underscore) The name "isSQLOpenOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isSQLOpenOptions: (test: any) => test is SQLOpenOptions; - -// Warning: (ae-internal-missing-underscore) The name "LinkQueryOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface LinkQueryOptions { - // (undocumented) - abortSignal: AbortSignal; - // (undocumented) - settings: Settings; -} - -// @alpha -export interface LocalStorageAdapter { - clear(): Promise; - deleteFile(filePath: string): Promise; - fileExists(filePath: string): Promise; - getLocalUri(filename: string): string; - initialize(): Promise; - makeDir(path: string): Promise; - readFile(filePath: string): Promise; - rmDir(path: string): Promise; - saveFile(filePath: string, data: AttachmentData): Promise; -} - -// @public (undocumented) -export interface LockContext extends SqlExecutor, DBGetUtils { - connectionType?: 'writer' | 'queryOnly' | 'readOnly'; -} - -// @internal -interface LockOptions_2 { - // (undocumented) - callback: () => Promise; - // (undocumented) - signal?: AbortSignal; - // (undocumented) - type: LockType; -} - -// Warning: (ae-internal-missing-underscore) The name "LockOptions" should be prefixed with an underscore because the declaration is marked as @internal -export { LockOptions_2 as LockOptions } - -// Warning: (ae-internal-missing-underscore) The name "LockType" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum LockType { - // (undocumented) - CRUD = "crud", - // (undocumented) - SYNC = "sync" -} - -// @public (undocumented) -export const LogLevel: { - TRACE: Logger.ILogLevel; - DEBUG: Logger.ILogLevel; - INFO: Logger.ILogLevel; - TIME: Logger.ILogLevel; - WARN: Logger.ILogLevel; - ERROR: Logger.ILogLevel; - OFF: Logger.ILogLevel; -}; - -// Warning: (ae-internal-missing-underscore) The name "MAX_AMOUNT_OF_COLUMNS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const MAX_AMOUNT_OF_COLUMNS = 1999; - -// Warning: (ae-internal-missing-underscore) The name "MAX_OP_ID" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const MAX_OP_ID = "9223372036854775807"; - -// Warning: (ae-internal-missing-underscore) The name "MEMORY_TRIGGER_CLAIM_MANAGER" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const MEMORY_TRIGGER_CLAIM_MANAGER: TriggerClaimManager; - -// Warning: (ae-forgotten-export) The symbol "MutableDeep" needs to be exported by the entry point index.d.ts -// Warning: (ae-internal-missing-underscore) The name "MutableWatchedQueryState" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export type MutableWatchedQueryState = { - -readonly [P in keyof WatchedQueryState]: MutableDeep[P]>; -}; - -// Warning: (ae-internal-missing-underscore) The name "Mutex" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class Mutex { - // (undocumented) - acquire(abort?: AbortSignal): Promise; - // (undocumented) - runExclusive(fn: () => PromiseLike | T, abort?: AbortSignal): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class OnChangeQueryProcessor extends AbstractQueryProcessor> { - constructor(options: OnChangeQueryProcessorOptions); - // (undocumented) - protected checkEquality(current: Data, previous: Data): boolean; - // (undocumented) - protected linkQuery(options: LinkQueryOptions): Promise; - // (undocumented) - protected options: OnChangeQueryProcessorOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface OnChangeQueryProcessorOptions extends AbstractQueryProcessorOptions> { - // (undocumented) - comparator?: WatchedQueryComparator; -} - -// @public -export type OpId = string; - -// Warning: (ae-internal-missing-underscore) The name "ParsedQuery" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ParsedQuery { - // (undocumented) - parameters: any[]; - // (undocumented) - sqlStatement: string; -} - -// Warning: (ae-internal-missing-underscore) The name "parseQuery" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const parseQuery: (query: string | CompilableQuery, parameters: any[]) => ParsedQuery; - -// @public -export type PendingStatement = { - sql: string; - params: PendingStatementParameter[]; -}; - -// @public -export type PendingStatementParameter = 'Id' | { - Column: string; -} | 'Rest'; - -// @public (undocumented) -export interface PowerSyncBackendConnector { - fetchCredentials: () => Promise; - uploadData: (database: AbstractPowerSyncDatabase) => Promise; -} - -// @public (undocumented) -export interface PowerSyncCloseOptions { - disconnect?: boolean; -} - -// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncConnectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal -// -// @public -export type PowerSyncConnectionOptions = Omit; - -// Warning: (ae-internal-missing-underscore) The name "PowerSyncControlCommand" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum PowerSyncControlCommand { - CONNECTION_STATE = "connection", - // (undocumented) - NOTIFY_CRUD_UPLOAD_COMPLETED = "completed_upload", - // (undocumented) - NOTIFY_TOKEN_REFRESHED = "refreshed_token", - // (undocumented) - PROCESS_BSON_LINE = "line_binary", - // (undocumented) - PROCESS_TEXT_LINE = "line_text", - // (undocumented) - START = "start", - // (undocumented) - STOP = "stop", - // (undocumented) - UPDATE_SUBSCRIPTIONS = "update_subscriptions" -} - -// @public (undocumented) -export interface PowerSyncCredentials { - // (undocumented) - endpoint: string; - // (undocumented) - expiresAt?: Date; - // (undocumented) - token: string; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions { - database: DBAdapter | SQLOpenFactory | SQLOpenOptions; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithDBAdapter extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: DBAdapter; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithOpenFactory extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: SQLOpenFactory; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithSettings extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: SQLOpenOptions; -} - -// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncDBListener" is marked as @public, but its signature references "StreamingSyncImplementationListener" which is marked as @internal -// -// @public (undocumented) -export interface PowerSyncDBListener extends StreamingSyncImplementationListener { - // (undocumented) - closed: () => Promise | void; - // (undocumented) - closing: () => Promise | void; - // (undocumented) - initialized: () => void; - // (undocumented) - schemaChanged: (schema: Schema) => void; -} - -// Warning: (ae-internal-missing-underscore) The name "PowerSyncOpenFactoryOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface PowerSyncOpenFactoryOptions extends Partial, SQLOpenOptions { - schema: Schema; -} - -// @public -export interface ProgressWithOperations { - downloadedFraction: number; - downloadedOperations: number; - totalOperations: number; -} - -// Warning: (ae-internal-missing-underscore) The name "PSInternalTable" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum PSInternalTable { - // (undocumented) - BUCKETS = "ps_buckets", - // (undocumented) - CRUD = "ps_crud", - // (undocumented) - DATA = "ps_data", - // (undocumented) - OPLOG = "ps_oplog", - // (undocumented) - UNTYPED = "ps_untyped" -} - -// @public (undocumented) -export interface Query { - differentialWatch(options?: DifferentialWatchedQueryOptions): DifferentialWatchedQuery; - watch(options?: StandardWatchedQueryOptions): StandardWatchedQuery>>; -} - -// @public -export type QueryParam = string | number | boolean | null | undefined | bigint | Uint8Array; - -// @public -export type QueryResult = { - insertId?: number; - rowsAffected: number; - rows?: { - _array: any[]; - length: number; - item: (idx: number) => any; - }; -}; - -// Warning: (ae-forgotten-export) The symbol "RawTableTypeWithStatements" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "InferredRawTableType" needs to be exported by the entry point index.d.ts -// -// @public -export type RawTableType = RawTableTypeWithStatements | InferredRawTableType; - -// Warning: (ae-internal-missing-underscore) The name "RemoteConnector" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type RemoteConnector = { - fetchCredentials: () => Promise; - invalidateCredentials?: () => void; -}; - -// @alpha -export interface RemoteStorageAdapter { - deleteFile(attachment: AttachmentRecord): Promise; - downloadFile(attachment: AttachmentRecord): Promise; - uploadFile(fileData: ArrayBuffer, attachment: AttachmentRecord): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "RequiredAdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface RequiredAdditionalConnectionOptions extends Required { - // (undocumented) - subscriptions: SubscribedStream[]; -} - -// Warning: (ae-internal-missing-underscore) The name "RequiredPowerSyncConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type RequiredPowerSyncConnectionOptions = Required; - -// @public (undocumented) -export type RowType> = { - [K in keyof T['columnMap']]: ExtractColumnValueType; -} & { - id: string; -}; - -// @public -export enum RowUpdateType { - // (undocumented) - SQLITE_DELETE = 9, - // (undocumented) - SQLITE_INSERT = 18, - // (undocumented) - SQLITE_UPDATE = 23 -} - -// Warning: (ae-internal-missing-underscore) The name "runOnSchemaChange" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function runOnSchemaChange(callback: (signal: AbortSignal) => void, db: AbstractPowerSyncDatabase, options?: SQLWatchOptions): void; - -// @alpha -export function sanitizeSQL(strings: TemplateStringsArray, ...values: any[]): string; - -// @alpha -export function sanitizeUUID(uuid: string): string; - -// Warning: (ae-forgotten-export) The symbol "SchemaType" needs to be exported by the entry point index.d.ts -// -// @public -export class Schema { - constructor(tables: Table[] | S); - // (undocumented) - readonly props: S; - // Warning: (ae-forgotten-export) The symbol "RawTable" needs to be exported by the entry point index.d.ts - // - // (undocumented) - readonly rawTables: RawTable[]; - static rawTableToJson(table: RawTable): unknown; - // (undocumented) - readonly tables: Table[]; - // (undocumented) - toJSON(): { - tables: { - local_only: boolean | undefined; - insert_only: boolean | undefined; - include_old: any; - include_old_only_when_changed: boolean; - include_metadata: boolean | undefined; - ignore_empty_update: boolean | undefined; - name: string; - view_name: string; - columns: { - name: string; - type: ColumnType | undefined; - }[]; - indexes: { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }[]; - }[]; - raw_tables: unknown[]; - }; - // (undocumented) - readonly types: SchemaTableType; - // (undocumented) - validate(): void; - withRawTables(tables: Record): void; -} - -// @public (undocumented) -export type SchemaTableType = { - [K in keyof S]: RowType; -}; - -// Warning: (ae-internal-missing-underscore) The name "Semaphore" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class Semaphore { - constructor(elements: Iterable); - requestAll(abort?: AbortSignal): Promise<{ - items: T[]; - release: UnlockFn; - }>; - requestOne(abort?: AbortSignal): Promise<{ - item: T; - release: UnlockFn; - }>; - // (undocumented) - readonly size: number; -} - -// Warning: (ae-internal-missing-underscore) The name "SimpleAsyncIterator" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export type SimpleAsyncIterator = Pick, 'next'>; - -// Warning: (ae-internal-missing-underscore) The name "SocketSyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SocketSyncStreamOptions = SyncStreamOptions & { - fetchStrategy: FetchStrategy; -}; - -// @public (undocumented) -export interface SqlExecutor { - execute: (query: string, params?: any[] | undefined) => Promise; - // (undocumented) - executeBatch: (query: string, params?: any[][]) => Promise; - executeRaw: (query: string, params?: any[] | undefined) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "SqliteBucketStorage" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class SqliteBucketStorage extends BaseObserver implements BucketStorageAdapter { - constructor(db: DBAdapter, logger?: ILogger); - // (undocumented) - control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise; - // (undocumented) - dispose(): Promise; - // (undocumented) - getClientId(): Promise; - // (undocumented) - _getClientId(): Promise; - getCrudBatch(limit?: number): Promise; - // (undocumented) - getMaxOpId(): string; - // (undocumented) - hasCrud(): Promise; - // (undocumented) - hasMigratedSubkeys(): Promise; - // (undocumented) - init(): Promise; - // (undocumented) - migrateToFixedSubkeys(): Promise; - // (undocumented) - nextCrudItem(): Promise; - // (undocumented) - static _subkeyMigrationKey: string; - // (undocumented) - tableNames: Set; - // (undocumented) - updateLocalTarget(cb: () => Promise): Promise; - // (undocumented) - writeTransaction(callback: (tx: Transaction) => Promise, options?: { - timeoutMs: number; - }): Promise; -} - -// @public (undocumented) -export interface SQLOnChangeOptions { - // @deprecated (undocumented) - rawTableNames?: boolean; - // (undocumented) - signal?: AbortSignal; - // (undocumented) - tables?: string[]; - throttleMs?: number; - triggerImmediate?: boolean; -} - -// @public (undocumented) -export interface SQLOpenFactory { - openDB(): DBAdapter; -} - -// @public (undocumented) -export interface SQLOpenOptions { - dbFilename: string; - dbLocation?: string; - debugMode?: boolean; -} - -// @public (undocumented) -export interface SQLWatchOptions extends SQLOnChangeOptions { - comparator?: WatchedQueryComparator; -} - -// @public -export type StandardWatchedQuery = WatchedQuery>; - -// @public -export interface StandardWatchedQueryOptions extends WatchedQueryOptions { - comparator?: WatchedQueryComparator; - placeholderData?: RowType[]; -} - -// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface StreamingSyncImplementation extends BaseObserverInterface, Disposable_2 { - connect(options?: InternalConnectionOptions): Promise; - disconnect(): Promise; - // (undocumented) - getWriteCheckpoint: () => Promise; - // (undocumented) - isConnected: boolean; - // (undocumented) - markConnectionMayHaveChanged(): void; - // (undocumented) - syncStatus: SyncStatus; - // (undocumented) - triggerCrudUpload: () => void; - // (undocumented) - updateSubscriptions(subscriptions: SubscribedStream[]): void; - // (undocumented) - waitForReady(): Promise; - // (undocumented) - waitForStatus(status: SyncStatusOptions): Promise; - // (undocumented) - waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementationListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface StreamingSyncImplementationListener extends BaseListener { - statusChanged?: ((status: SyncStatus) => void) | undefined; - statusUpdated?: ((statusUpdate: SyncStatusOptions) => void) | undefined; -} - -// Warning: (ae-forgotten-export) The symbol "JSONValue" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export type StreamingSyncRequestParameterType = JSONValue; - -// Warning: (ae-internal-missing-underscore) The name "SubscribedStream" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SubscribedStream = { - name: string; - params: Record | null; -}; - -// @public @deprecated (undocumented) -export enum SyncClientImplementation { - RUST = "rust" -} - -// @public (undocumented) -export type SyncDataFlowStatus = Partial<{ - downloading: boolean; - uploading: boolean; - downloadError?: Error; - uploadError?: Error; - downloadProgress: InternalProgressInformation | null; - internalStreamSubscriptions: CoreStreamSubscription[] | null; -}>; - -// Warning: (ae-internal-missing-underscore) The name "SyncingService" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class SyncingService { - constructor(attachmentService: AttachmentService, localStorage: LocalStorageAdapter, remoteStorage: RemoteStorageAdapter, logger: ILogger, errorHandler?: AttachmentErrorHandler); - deleteArchivedAttachments(context: AttachmentContext): Promise; - deleteAttachment(attachment: AttachmentRecord, context: AttachmentContext): Promise; - downloadAttachment(attachment: AttachmentRecord): Promise; - processAttachments(attachments: AttachmentRecord[], context: AttachmentContext): Promise; - uploadAttachment(attachment: AttachmentRecord): Promise; -} - -// @public (undocumented) -export interface SyncPriorityStatus { - // (undocumented) - hasSynced?: boolean; - // (undocumented) - lastSyncedAt?: Date; - // (undocumented) - priority: number; -} - -// @public -export class SyncProgress implements ProgressWithOperations { - constructor(internal: InternalProgressInformation); - // (undocumented) - downloadedFraction: number; - // (undocumented) - downloadedOperations: number; - // (undocumented) - protected internal: InternalProgressInformation; - // (undocumented) - totalOperations: number; - untilPriority(priority: number): ProgressWithOperations; -} - -// @public (undocumented) -export class SyncStatus { - // Warning: (ae-incompatible-release-tags) The symbol "__constructor" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - constructor(options: SyncStatusOptions); - // @deprecated - get clientImplementation(): SyncClientImplementation | undefined; - get connected(): boolean; - get connecting(): boolean; - get dataFlowStatus(): SyncDataFlowStatus; - get downloadProgress(): SyncProgress | null; - forStream(stream: SyncStreamDescription): SyncStreamStatus | undefined; - getMessage(): string; - get hasSynced(): boolean | undefined; - isEqual(status: SyncStatus): boolean; - get lastSyncedAt(): Date | undefined; - // Warning: (ae-incompatible-release-tags) The symbol "options" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - // - // (undocumented) - protected options: SyncStatusOptions; - get priorityStatusEntries(): SyncPriorityStatus[]; - protected serializeError(error?: Error): { - name: string; - message: string; - stack: string | undefined; - } | undefined; - statusForPriority(priority: number): SyncPriorityStatus; - get syncStreams(): SyncStreamStatus[] | undefined; - // Warning: (ae-incompatible-release-tags) The symbol "toJSON" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - toJSON(): SyncStatusOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "SyncStatusOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SyncStatusOptions = { - connected?: boolean; - connecting?: boolean; - dataFlow?: SyncDataFlowStatus; - lastSyncedAt?: Date; - hasSynced?: boolean; - priorityStatusEntries?: SyncPriorityStatus[]; - clientImplementation?: SyncClientImplementation; -}; - -// @public -export interface SyncStream extends SyncStreamDescription { - subscribe(options?: SyncStreamSubscribeOptions): Promise; - unsubscribeAll(): Promise; -} - -// @public (undocumented) -export enum SyncStreamConnectionMethod { - // (undocumented) - HTTP = "http", - // (undocumented) - WEB_SOCKET = "web-socket" -} - -// @public -export interface SyncStreamDescription { - name: string; - parameters: Record | null; -} - -// Warning: (ae-internal-missing-underscore) The name "SyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SyncStreamOptions = { - path: string; - data: unknown; - headers?: Record; - abortSignal: AbortSignal; - fetchOptions?: Request; -}; - -// @public -export interface SyncStreamStatus { - // (undocumented) - priority: number | null; - // (undocumented) - progress: ProgressWithOperations | null; - // (undocumented) - subscription: SyncSubscriptionDescription; -} - -// @public (undocumented) -export interface SyncStreamSubscribeOptions { - priority?: 0 | 1 | 2 | 3; - ttl?: number; -} - -// @public (undocumented) -export interface SyncStreamSubscription extends SyncStreamDescription { - unsubscribe(): void; - waitForFirstSync(abort?: AbortSignal): Promise; -} - -// @public -export interface SyncSubscriptionDescription extends SyncStreamDescription { - // (undocumented) - active: boolean; - expiresAt: Date | null; - hasExplicitSubscription: boolean; - hasSynced: boolean; - isDefault: boolean; - lastSyncedAt: Date | null; -} - -// @public (undocumented) -export class Table { - constructor(columns: Columns, options?: TableV2Options); - // @deprecated - constructor(options: TableOptions); - // (undocumented) - get columnMap(): Columns; - // (undocumented) - get columns(): Column[]; - // (undocumented) - copyWithName(name: string): Table; - // (undocumented) - static createInsertOnly(options: TableOptions): Table; - // (undocumented) - static createLocalOnly(options: TableOptions): Table; - // @deprecated - static createTable(name: string, table: Table): Table; - // (undocumented) - get ignoreEmptyUpdates(): boolean; - // (undocumented) - get indexes(): Index[]; - // (undocumented) - get insertOnly(): boolean; - // (undocumented) - get internalName(): string; - // (undocumented) - get localOnly(): boolean; - // (undocumented) - protected _mappedColumns: Columns; - // (undocumented) - get name(): string; - // (undocumented) - protected options: TableOptions; - // (undocumented) - toJSON(): { - local_only: boolean | undefined; - insert_only: boolean | undefined; - include_old: any; - include_old_only_when_changed: boolean; - include_metadata: boolean | undefined; - ignore_empty_update: boolean | undefined; - name: string; - view_name: string; - columns: { - name: string; - type: ColumnType | undefined; - }[]; - indexes: { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }[]; - }; - // (undocumented) - get trackMetadata(): boolean; - // (undocumented) - get trackPrevious(): boolean | TrackPreviousOptions; - // (undocumented) - validate(): void; - // (undocumented) - get validName(): boolean; - // (undocumented) - get viewName(): string; - // (undocumented) - get viewNameOverride(): string | undefined; -} - -// Warning: (ae-forgotten-export) The symbol "SharedTableOptions" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export interface TableOptions extends SharedTableOptions { - // (undocumented) - columns: Column[]; - // (undocumented) - indexes?: Index[]; - name: string; -} - -// @public -export interface TableOrRawTableOptions { - // (undocumented) - ignoreEmptyUpdates?: boolean; - // (undocumented) - insertOnly?: boolean; - // (undocumented) - localOnly?: boolean; - // (undocumented) - trackMetadata?: boolean; - // (undocumented) - trackPrevious?: boolean | TrackPreviousOptions; -} - -// @public (undocumented) -export interface TableUpdateOperation { - // (undocumented) - opType: RowUpdateType; - // (undocumented) - rowId: number; -} - -// @public @deprecated -export class TableV2 extends Table { -} - -// @public (undocumented) -export interface TableV2Options extends SharedTableOptions { - // (undocumented) - indexes?: IndexShorthand; -} - -// Warning: (ae-internal-missing-underscore) The name "timeoutSignal" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function timeoutSignal(timeout: number): AbortSignal; - -// @internal (undocumented) -export function timeoutSignal(timeout?: number): AbortSignal | undefined; - -// @alpha -export interface TrackDiffOptions extends BaseCreateDiffTriggerOptions { - onChange: (context: TriggerDiffHandlerContext) => Promise; - throttleMs?: number; -} - -// @public -export interface TrackPreviousOptions { - columns?: string[]; - onlyWhenChanged?: boolean; -} - -// @public (undocumented) -export interface Transaction extends LockContext { - commit: () => Promise; - rollback: () => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerClaimManager" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export interface TriggerClaimManager { - checkClaim: (identifier: string) => Promise; - obtainClaim: (identifier: string) => Promise<() => Promise>; -} - -// @alpha -export interface TriggerCreationHooks { - beforeCreate?: (context: LockContext) => Promise; -} - -// @alpha -export interface TriggerDiffDeleteRecord extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.DELETE; - value: string; -} - -// @alpha -export interface TriggerDiffHandlerContext extends LockContext { - destinationTable: string; - withDiff: (query: string, params?: ReadonlyArray>, options?: WithDiffOptions) => Promise; - withExtractedDiff: (query: string, params?: ReadonlyArray>) => Promise; -} - -// @alpha -export interface TriggerDiffInsertRecord extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.INSERT; - value: string; -} - -// @alpha -export type TriggerDiffRecord = TriggerDiffUpdateRecord | TriggerDiffInsertRecord | TriggerDiffDeleteRecord; - -// @alpha -export interface TriggerDiffUpdateRecord extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.UPDATE; - previous_value: string; - value: string; -} - -// @alpha (undocumented) -export interface TriggerManager { - createDiffTrigger(options: CreateDiffTriggerOptions): Promise; - trackTableDiff(options: TrackDiffOptions): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerManagerConfig" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface TriggerManagerConfig { - // (undocumented) - claimManager: TriggerClaimManager; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerManagerImpl" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class TriggerManagerImpl implements TriggerManager { - constructor(options: TriggerManagerImplOptions); - cleanupResources(): Promise; - // (undocumented) - protected cleanupTimeout: ReturnType | null; - // (undocumented) - createDiffTrigger(options: CreateDiffTriggerOptions): Promise<(options?: TriggerRemoveCallbackOptions) => Promise>; - // (undocumented) - protected get db(): AbstractPowerSyncDatabase; - // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplConfiguration" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected defaultConfig: TriggerManagerImplConfiguration; - // (undocumented) - dispose(): void; - // (undocumented) - protected generateTriggerName(operation: DiffTriggerOperation, destinationTable: string, triggerId: string): string; - // (undocumented) - protected getUUID(ctx?: LockContext): Promise; - // (undocumented) - protected isDisposed: boolean; - // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplOptions" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected options: TriggerManagerImplOptions; - // (undocumented) - protected removeTriggers(tx: LockContext, triggerIds: string[]): Promise; - // (undocumented) - protected schema: Schema; - // (undocumented) - trackTableDiff(options: TrackDiffOptions): Promise; - updateDefaults(config: TriggerManagerImplConfiguration): void; -} - -// @alpha -export type TriggerRemoveCallback = (options?: TriggerRemoveCallbackOptions) => Promise; - -// @alpha -export interface TriggerRemoveCallbackOptions { - // (undocumented) - context?: LockContext; -} - -// Warning: (ae-internal-missing-underscore) The name "UnlockFn" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type UnlockFn = () => void; - -// @public -export interface UpdateNotification extends TableUpdateOperation { - // (undocumented) - table: string; -} - -// @public -export enum UpdateType { - DELETE = "DELETE", - PATCH = "PATCH", - PUT = "PUT" -} - -// @public (undocumented) -export class UploadQueueStats { - constructor( - count: number, - size?: number | null); - count: number; - size: number | null; - // (undocumented) - toString(): string; -} - -// @public (undocumented) -export interface WatchCompatibleQuery { - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(options: WatchExecuteOptions): Promise; -} - -// @alpha -export type WatchedAttachmentItem = { - id: string; - filename: string; - fileExtension?: never; - metaData?: string; - mediaType?: string; -} | { - id: string; - fileExtension: string; - filename?: never; - metaData?: string; - mediaType?: string; -}; - -// Warning: (ae-forgotten-export) The symbol "MetaBaseObserverInterface" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export interface WatchedQuery = WatchedQueryListener> extends MetaBaseObserverInterface { - close(): Promise; - // (undocumented) - readonly closed: boolean; - registerListener(listener: Listener): () => void; - readonly state: WatchedQueryState; - updateSettings(options: Settings): Promise; -} - -// @public -export interface WatchedQueryComparator { - // (undocumented) - checkEquality: (current: Data, previous: Data) => boolean; -} - -// @public -export interface WatchedQueryDifferential { - // (undocumented) - readonly added: ReadonlyArray>; - readonly all: ReadonlyArray>; - // (undocumented) - readonly removed: ReadonlyArray>; - // (undocumented) - readonly unchanged: ReadonlyArray>; - // (undocumented) - readonly updated: ReadonlyArray>>; -} - -// @public (undocumented) -export interface WatchedQueryListener extends BaseListener { - // (undocumented) - [WatchedQueryListenerEvent.CLOSED]?: () => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_DATA]?: (data: Data) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_ERROR]?: (error: Error) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_STATE_CHANGE]?: (state: WatchedQueryState) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.SETTINGS_WILL_UPDATE]?: () => void; -} - -// @public (undocumented) -export enum WatchedQueryListenerEvent { - // (undocumented) - CLOSED = "closed", - // (undocumented) - ON_DATA = "onData", - // (undocumented) - ON_ERROR = "onError", - // (undocumented) - ON_STATE_CHANGE = "onStateChange", - // (undocumented) - SETTINGS_WILL_UPDATE = "settingsWillUpdate" -} - -// @public (undocumented) -export interface WatchedQueryOptions { - reportFetching?: boolean; - throttleMs?: number; - triggerOnTables?: string[]; -} - -// @public -export interface WatchedQueryRowDifferential { - // (undocumented) - readonly current: RowType; - // (undocumented) - readonly previous: RowType; -} - -// @public -export interface WatchedQuerySettings extends WatchedQueryOptions { - // (undocumented) - query: WatchCompatibleQuery; -} - -// @public -export interface WatchedQueryState { - readonly data: Data; - readonly error: Error | null; - readonly isFetching: boolean; - readonly isLoading: boolean; - readonly lastUpdated: Date | null; -} - -// @public -export interface WatchExecuteOptions { - // (undocumented) - db: AbstractPowerSyncDatabase; - // (undocumented) - parameters: any[]; - // (undocumented) - sql: string; -} - -// @public (undocumented) -export interface WatchHandler { - // (undocumented) - onError?: (error: Error) => void; - // (undocumented) - onResult: (results: QueryResult) => void; -} - -// @public (undocumented) -export interface WatchOnChangeEvent { - // (undocumented) - changedTables: string[]; -} - -// @public (undocumented) -export interface WatchOnChangeHandler { - // (undocumented) - onChange: (event: WatchOnChangeEvent) => Promise | void; - // (undocumented) - onError?: (error: Error) => void; -} - -// @alpha -export interface WithDiffOptions { - castOperationIdAsText?: boolean; -} - -// Warnings were encountered during analysis: -// -// lib/db/crud/SyncStatus.d.ts:27:5 - (ae-forgotten-export) The symbol "InternalProgressInformation" needs to be exported by the entry point index.d.ts -// lib/db/crud/SyncStatus.d.ts:31:5 - (ae-forgotten-export) The symbol "CoreStreamSubscription" needs to be exported by the entry point index.d.ts - -// (No @packageDocumentation comment for this package) - -``` +## API Report File for "@powersync/common" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { fetch as fetch_2 } from 'cross-fetch'; +import { GlobalLogger } from 'js-logger'; +import { ILogger } from 'js-logger'; +import { ILoggerOpts } from 'js-logger'; +import { ILogHandler } from 'js-logger'; +import { ILogLevel } from 'js-logger'; +import Logger from 'js-logger'; + +// Warning: (ae-internal-missing-underscore) The name "AbortOperation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class AbortOperation extends Error { + constructor(reason: string); + // (undocumented) + protected reason: string; +} + +// Warning: (ae-incompatible-release-tags) The symbol "AbstractPowerSyncDatabase" is marked as @public, but its signature references "BaseObserver" which is marked as @internal +// +// @public (undocumented) +export abstract class AbstractPowerSyncDatabase extends BaseObserver { + constructor(options: PowerSyncDatabaseOptionsWithDBAdapter); + constructor(options: PowerSyncDatabaseOptionsWithOpenFactory); + constructor(options: PowerSyncDatabaseOptionsWithSettings); + constructor(options: PowerSyncDatabaseOptions); + // Warning: (ae-incompatible-release-tags) The symbol "bucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal + // + // (undocumented) + protected bucketStorageAdapter: BucketStorageAdapter; + close(options?: PowerSyncCloseOptions): Promise; + closed: boolean; + connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise; + get connected(): boolean; + // (undocumented) + get connecting(): boolean; + // Warning: (ae-incompatible-release-tags) The symbol "connectionManager" is marked as @public, but its signature references "ConnectionManager" which is marked as @internal + // + // (undocumented) + protected connectionManager: ConnectionManager; + // Warning: (ae-incompatible-release-tags) The symbol "connectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal + get connectionOptions(): InternalConnectionOptions | null; + get connector(): PowerSyncBackendConnector | null; + currentStatus: SyncStatus; + customQuery(query: WatchCompatibleQuery): Query; + get database(): DBAdapter; + disconnect(): Promise; + disconnectAndClear(options?: DisconnectAndClearOptions): Promise; + // @deprecated (undocumented) + dispose(): void; + execute(sql: string, parameters?: any[]): Promise; + executeBatch(sql: string, parameters?: any[][]): Promise; + executeRaw(sql: string, parameters?: any[]): Promise; + // Warning: (ae-incompatible-release-tags) The symbol "generateBucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal + // + // (undocumented) + protected abstract generateBucketStorageAdapter(): BucketStorageAdapter; + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal + // + // (undocumented) + protected abstract generateSyncStreamImplementation( + connector: PowerSyncBackendConnector, + options: CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions + ): StreamingSyncImplementation; + // Warning: (ae-incompatible-release-tags) The symbol "generateTriggerManagerConfig" is marked as @public, but its signature references "TriggerManagerConfig" which is marked as @internal + protected generateTriggerManagerConfig(): TriggerManagerConfig; + get(sql: string, parameters?: any[]): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getClientId(): Promise; + getCrudBatch(limit?: number): Promise; + getCrudTransactions(): AsyncIterable; + getNextCrudTransaction(): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + getUploadQueueStats(includeSize?: boolean): Promise; + init(): Promise; + protected initialize(): Promise; + abstract _initialize(): Promise; + // (undocumented) + protected _isReadyPromise: Promise; + // (undocumented) + protected loadVersion(): Promise; + // (undocumented) + logger: ILogger; + onChange(options?: SQLOnChangeOptions): AsyncIterable; + onChange(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; + onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable; + onChangeWithCallback(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; + protected abstract openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter; + // (undocumented) + protected options: PowerSyncDatabaseOptions; + query(query: ArrayQueryDefinition): Query; + readLock(callback: (db: LockContext) => Promise): Promise; + readTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; + // (undocumented) + ready: boolean; + // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal + // + // (undocumented) + protected resolvedConnectionOptions( + options: CreateSyncImplementationOptions + ): CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions; + // (undocumented) + protected resolveOfflineSyncStatus(): Promise; + resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise; + protected runExclusive(callback: () => Promise): Promise; + // Warning: (ae-incompatible-release-tags) The symbol "runExclusiveMutex" is marked as @public, but its signature references "Mutex" which is marked as @internal + // + // (undocumented) + protected runExclusiveMutex: Mutex; + get schema(): Schema<{ + [x: string]: Table; + }>; + // (undocumented) + protected _schema: Schema; + // (undocumented) + sdkVersion: string; + syncStream(name: string, params?: Record): SyncStream; + // Warning: (ae-incompatible-release-tags) The symbol "syncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal + // + // (undocumented) + get syncStreamImplementation(): StreamingSyncImplementation | null; + // Warning: (ae-incompatible-release-tags) The symbol "triggers" is marked as @public, but its signature references "TriggerManager" which is marked as @alpha + readonly triggers: TriggerManager; + // Warning: (ae-incompatible-release-tags) The symbol "triggersImpl" is marked as @public, but its signature references "TriggerManagerImpl" which is marked as @internal + // + // (undocumented) + protected triggersImpl: TriggerManagerImpl; + updateSchema(schema: Schema): Promise; + waitForFirstSync( + request?: + | AbortSignal + | { + signal?: AbortSignal; + priority?: number; + } + ): Promise; + // (undocumented) + waitForReady(): Promise; + waitForStatus(predicate: (status: SyncStatus) => any, signal?: AbortSignal): Promise; + watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; + watch(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; + watchWithAsyncGenerator(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; + watchWithCallback(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; + writeLock(callback: (db: LockContext) => Promise): Promise; + writeTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractPowerSyncDatabaseOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractPowerSyncDatabaseOpenFactory { + constructor(options: PowerSyncOpenFactoryOptions); + // (undocumented) + abstract generateInstance(options: PowerSyncDatabaseOptions): AbstractPowerSyncDatabase; + // (undocumented) + generateOptions(): PowerSyncDatabaseOptions; + // (undocumented) + getInstance(): AbstractPowerSyncDatabase; + // (undocumented) + protected abstract openDB(): DBAdapter; + // (undocumented) + protected options: PowerSyncOpenFactoryOptions; + get schema(): Schema<{ + [x: string]: Table; + }>; +} + +// Warning: (ae-forgotten-export) The symbol "MetaBaseObserver" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "WatchedQueryProcessorListener" needs to be exported by the entry point index.d.ts +// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export abstract class AbstractQueryProcessor< + Data = unknown[], + Settings extends WatchedQueryOptions = WatchedQueryOptions +> + extends MetaBaseObserver> + implements WatchedQuery +{ + constructor(options: AbstractQueryProcessorOptions); + // (undocumented) + protected abortController: AbortController; + // (undocumented) + close(): Promise; + // (undocumented) + get closed(): boolean; + // (undocumented) + protected _closed: boolean; + // (undocumented) + protected constructInitialState(): WatchedQueryState; + // (undocumented) + protected disposeListeners: (() => void) | null; + protected init(signal: AbortSignal): Promise; + // (undocumented) + protected initialized: Promise; + protected iterateAsyncListenersWithError( + callback: (listener: Partial>) => Promise | void + ): Promise; + protected abstract linkQuery(options: LinkQueryOptions): Promise; + // (undocumented) + protected options: AbstractQueryProcessorOptions; + // (undocumented) + protected get reportFetching(): boolean; + protected runWithReporting(callback: () => Promise): Promise; + // (undocumented) + readonly state: WatchedQueryState; + updateSettings(settings: Settings): Promise; + // (undocumented) + protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise; + // (undocumented) + protected updateState(update: Partial>): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AbstractQueryProcessorOptions { + // (undocumented) + db: AbstractPowerSyncDatabase; + // (undocumented) + placeholderData: Data; + // (undocumented) + watchOptions: Settings; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractRemote" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractRemote { + constructor(connector: RemoteConnector, logger?: ILogger, options?: Partial); + // (undocumented) + protected buildRequest(path: string): Promise<{ + url: string; + headers: { + 'content-type': string; + Authorization: string; + 'x-user-agent': string; + }; + }>; + // (undocumented) + protected connector: RemoteConnector; + // (undocumented) + protected createSocket(url: string): WebSocket; + // (undocumented) + createTextDecoder(): TextDecoder; + // (undocumented) + protected credentials: PowerSyncCredentials | null; + // (undocumented) + get fetch(): FetchImplementation; + fetchCredentials(): Promise; + fetchStream(options: SyncStreamOptions): Promise>; + protected fetchStreamRaw(options: SyncStreamOptions): Promise<{ + isBson: boolean; + stream: SimpleAsyncIterator; + }>; + // (undocumented) + get(path: string, headers?: Record): Promise; + getCredentials(): Promise; + // (undocumented) + getUserAgent(): string; + invalidateCredentials(): void; + // (undocumented) + protected logger: ILogger; + // (undocumented) + protected options: AbstractRemoteOptions; + // (undocumented) + post(path: string, data: any, headers?: Record): Promise; + prefetchCredentials(): Promise; + socketStreamRaw(options: SocketSyncStreamOptions): Promise>; + // (undocumented) + protected get supportsStreamingBinaryResponses(): boolean; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractRemoteOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type AbstractRemoteOptions = { + socketUrlTransformer: (url: string) => string; + fetchImplementation: FetchImplementation | FetchImplementationProvider; + fetchOptions?: {}; +}; + +// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractStreamingSyncImplementation + extends BaseObserver + implements StreamingSyncImplementation +{ + constructor(options: AbstractStreamingSyncImplementationOptions); + // (undocumented) + protected abortController: AbortController | null; + // (undocumented) + connect(options?: PowerSyncConnectionOptions): Promise; + // (undocumented) + protected crudUpdateListener?: () => void; + // (undocumented) + disconnect(): Promise; + // (undocumented) + dispose(): Promise; + // (undocumented) + getWriteCheckpoint(): Promise; + // (undocumented) + get isConnected(): boolean; + // (undocumented) + get lastSyncedAt(): Date | undefined; + // (undocumented) + protected logger: ILogger; + // (undocumented) + markConnectionMayHaveChanged(): void; + // (undocumented) + abstract obtainLock(lockOptions: LockOptions_2): Promise; + // (undocumented) + protected options: AbstractStreamingSyncImplementationOptions; + // Warning: (ae-forgotten-export) The symbol "RustIterationResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected streamingSyncIteration( + signal: AbortSignal, + options?: PowerSyncConnectionOptions + ): Promise; + // (undocumented) + protected streamingSyncPromise?: Promise<[void, void]>; + // (undocumented) + syncStatus: SyncStatus; + // (undocumented) + triggerCrudUpload(): void; + // (undocumented) + updateSubscriptions(subscriptions: SubscribedStream[]): void; + // (undocumented) + protected updateSyncStatus(options: SyncStatusOptions): void; + // (undocumented) + waitForReady(): Promise; + // (undocumented) + waitForStatus(status: SyncStatusOptions): Promise; + // (undocumented) + waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AbstractStreamingSyncImplementationOptions extends RequiredAdditionalConnectionOptions { + // (undocumented) + adapter: BucketStorageAdapter; + identifier?: string; + // (undocumented) + logger?: ILogger; + // (undocumented) + remote: AbstractRemote; + // (undocumented) + subscriptions: SubscribedStream[]; + // (undocumented) + uploadCrud: () => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AdditionalConnectionOptions { + crudUploadThrottleMs?: number; + retryDelayMs?: number; +} + +// @public +export class ArrayComparator implements WatchedQueryComparator { + constructor(options: ArrayComparatorOptions); + // (undocumented) + checkEquality(current: ItemType[], previous: ItemType[]): boolean; + // (undocumented) + protected options: ArrayComparatorOptions; +} + +// @public +export type ArrayComparatorOptions = { + compareBy: (item: ItemType) => string; +}; + +// @public +export interface ArrayQueryDefinition { + mapper?: (row: Record) => RowType; + // (undocumented) + parameters?: ReadonlyArray>; + // (undocumented) + sql: string; +} + +// @alpha +export const ATTACHMENT_TABLE = 'attachments'; + +// @alpha +export class AttachmentContext { + constructor( + db: AbstractPowerSyncDatabase, + tableName: string | undefined, + logger: ILogger, + archivedCacheLimit: number + ); + readonly archivedCacheLimit: number; + // (undocumented) + clearQueue(): Promise; + readonly db: AbstractPowerSyncDatabase; + // (undocumented) + deleteArchivedAttachments(callback?: (attachments: AttachmentRecord[]) => Promise): Promise; + deleteAttachment(attachmentId: string): Promise; + getActiveAttachments(): Promise; + getArchivedAttachments(): Promise; + // (undocumented) + getAttachment(id: string): Promise; + getAttachments(): Promise; + readonly logger: ILogger; + saveAttachments(attachments: AttachmentRecord[]): Promise; + readonly tableName: string; + upsertAttachment(attachment: AttachmentRecord, context: Transaction): Promise; +} + +// @alpha (undocumented) +export type AttachmentData = ArrayBuffer | string; + +// @alpha +export interface AttachmentErrorHandler { + onDeleteError(attachment: AttachmentRecord, error: unknown): Promise; + onDownloadError(attachment: AttachmentRecord, error: unknown): Promise; + onUploadError(attachment: AttachmentRecord, error: unknown): Promise; +} + +// @alpha +export function attachmentFromSql(row: any): AttachmentRecord; + +// @alpha +export class AttachmentQueue implements AttachmentQueue { + constructor(input: { + db: AbstractPowerSyncDatabase; + remoteStorage: RemoteStorageAdapter; + localStorage: LocalStorageAdapter; + watchAttachments: (onUpdate: (attachment: WatchedAttachmentItem[]) => Promise, signal: AbortSignal) => void; + tableName?: string; + logger?: ILogger; + syncIntervalMs?: number; + syncThrottleDuration?: number; + downloadAttachments?: boolean; + archivedCacheLimit?: number; + errorHandler?: AttachmentErrorHandler; + }); + readonly archivedCacheLimit: number; + // (undocumented) + clearQueue(): Promise; + // (undocumented) + deleteFile(input: { + id: string; + updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; + }): Promise; + readonly downloadAttachments: boolean; + // (undocumented) + expireCache(): Promise; + generateAttachmentId(): Promise; + readonly localStorage: LocalStorageAdapter; + readonly logger: ILogger; + readonly remoteStorage: RemoteStorageAdapter; + saveFile(input: { + data: AttachmentData; + fileExtension: string; + mediaType?: string; + metaData?: string; + id?: string; + updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; + }): Promise; + startSync(): Promise; + stopSync(): Promise; + readonly syncIntervalMs: number; + syncStorage(): Promise; + readonly syncThrottleDuration: number; + readonly tableName: string; + verifyAttachments(): Promise; + withAttachmentContext(callback: (context: AttachmentContext) => Promise): Promise; +} + +// @alpha +export interface AttachmentRecord { + // (undocumented) + filename: string; + // (undocumented) + hasSynced?: boolean; + // (undocumented) + id: string; + // (undocumented) + localUri?: string; + // (undocumented) + mediaType?: string; + // (undocumented) + metaData?: string; + // (undocumented) + size?: number; + // (undocumented) + state: AttachmentState; + // (undocumented) + timestamp?: number; +} + +// Warning: (ae-internal-missing-underscore) The name "AttachmentService" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class AttachmentService { + constructor(db: AbstractPowerSyncDatabase, logger: ILogger, tableName?: string, archivedCacheLimit?: number); + watchActiveAttachments(input?: { throttleMs?: number }): DifferentialWatchedQuery; + withContext(callback: (context: AttachmentContext) => Promise): Promise; +} + +// @alpha +export enum AttachmentState { + // (undocumented) + ARCHIVED = 4, // Attachment to be uploaded + // (undocumented) + QUEUED_DELETE = 2, // Attachment to be downloaded + // (undocumented) + QUEUED_DOWNLOAD = 1, // Attachment to be deleted + // (undocumented) + QUEUED_UPLOAD = 0, // Attachment has been synced + // (undocumented) + SYNCED = 3 +} + +// @alpha +export class AttachmentTable extends Table { + constructor(options?: AttachmentTableOptions); +} + +// @alpha (undocumented) +export interface AttachmentTableOptions extends Omit {} + +// @public (undocumented) +export type BaseColumnType = { + type: ColumnType; +}; + +// @public (undocumented) +export interface BaseConnectionOptions { + appMetadata?: Record; + // @deprecated (undocumented) + clientImplementation?: SyncClientImplementation; + connectionMethod?: SyncStreamConnectionMethod; + fetchStrategy?: FetchStrategy; + includeDefaultStreams?: boolean; + params?: Record; + serializedSchema?: any; +} + +// @public (undocumented) +export type BaseListener = Record any) | undefined>; + +// Warning: (ae-internal-missing-underscore) The name "BaseObserver" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class BaseObserver implements BaseObserverInterface { + constructor(); + // (undocumented) + dispose(): void; + // (undocumented) + iterateAsyncListeners(cb: (listener: Partial) => Promise): Promise; + // (undocumented) + iterateListeners(cb: (listener: Partial) => any): void; + // (undocumented) + protected listeners: Set>; + registerListener(listener: Partial): () => void; +} + +// @public (undocumented) +export interface BaseObserverInterface { + // (undocumented) + registerListener(listener: Partial): () => void; +} + +// Warning: (ae-incompatible-release-tags) The symbol "BasePowerSyncDatabaseOptions" is marked as @public, but its signature references "AdditionalConnectionOptions" which is marked as @internal +// +// @public (undocumented) +export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions { + // (undocumented) + logger?: ILogger; + // @deprecated (undocumented) + retryDelay?: number; + schema: Schema; +} + +// @alpha +export interface BaseTriggerDiffRecord { + id: string; + operation: DiffTriggerOperation; + operation_id: TOperationId; + timestamp: string; +} + +// @public (undocumented) +export interface BatchedUpdateNotification { + // (undocumented) + groupedUpdates: Record; + // (undocumented) + rawUpdates: UpdateNotification[]; + // (undocumented) + tables: string[]; +} + +// Warning: (ae-internal-missing-underscore) The name "BucketStorageAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface BucketStorageAdapter extends BaseObserverInterface, Disposable_2 { + control(op: PowerSyncControlCommand, payload: string | Uint8Array | null): Promise; + getClientId(): Promise; + // (undocumented) + getCrudBatch(limit?: number): Promise; + // (undocumented) + getMaxOpId(): string; + // (undocumented) + hasCrud(): Promise; + // (undocumented) + hasMigratedSubkeys(): Promise; + // (undocumented) + init(): Promise; + // (undocumented) + migrateToFixedSubkeys(): Promise; + // (undocumented) + nextCrudItem(): Promise; + // (undocumented) + updateLocalTarget(cb: () => Promise): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "BucketStorageListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface BucketStorageListener extends BaseListener { + // (undocumented) + crudUpdate: () => void; +} + +// @public (undocumented) +export class Column { + constructor(options: ColumnOptions); + // (undocumented) + get name(): string; + // (undocumented) + protected options: ColumnOptions; + // (undocumented) + toJSON(): { + name: string; + type: ColumnType | undefined; + }; + // (undocumented) + get type(): ColumnType | undefined; +} + +// @public (undocumented) +export const column: { + text: BaseColumnType; + integer: BaseColumnType; + real: BaseColumnType; +}; + +// @public (undocumented) +export interface ColumnOptions { + // (undocumented) + name: string; + // (undocumented) + type?: ColumnType; +} + +// @public (undocumented) +export type ColumnsType = Record>; + +// @public (undocumented) +export enum ColumnType { + // (undocumented) + INTEGER = 'INTEGER', + // (undocumented) + REAL = 'REAL', + // (undocumented) + TEXT = 'TEXT' +} + +// @public (undocumented) +export interface CompilableQuery { + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(): Promise; +} + +// @public (undocumented) +export function compilableQueryWatch( + db: AbstractPowerSyncDatabase, + query: CompilableQuery, + handler: CompilableQueryWatchHandler, + options?: SQLWatchOptions +): void; + +// @public (undocumented) +export interface CompilableQueryWatchHandler { + // (undocumented) + onError?: (error: Error) => void; + // (undocumented) + onResult: (results: T[]) => void; +} + +// @public (undocumented) +export interface CompiledQuery { + // (undocumented) + readonly parameters: ReadonlyArray; + // (undocumented) + readonly sql: string; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionClosedError" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class ConnectionClosedError extends Error { + constructor(message: string); + // (undocumented) + static MATCHES(input: any): boolean; + // (undocumented) + static NAME: string; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManager" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class ConnectionManager extends BaseObserver { + constructor(options: ConnectionManagerOptions); + get activeStreams(): { + name: string; + params: Record | null; + }[]; + // (undocumented) + close(): Promise; + // (undocumented) + connect(connector: PowerSyncBackendConnector, options: InternalConnectionOptions): Promise; + protected connectingPromise: Promise | null; + // (undocumented) + protected connectInternal(): Promise; + // (undocumented) + get connectionOptions(): InternalConnectionOptions | null; + // (undocumented) + get connector(): PowerSyncBackendConnector | null; + disconnect(): Promise; + protected disconnectingPromise: Promise | null; + // (undocumented) + protected disconnectInternal(): Promise; + // (undocumented) + get logger(): ILogger; + // (undocumented) + protected options: ConnectionManagerOptions; + // Warning: (ae-forgotten-export) The symbol "StoredConnectionOptions" needs to be exported by the entry point index.d.ts + protected pendingConnectionOptions: StoredConnectionOptions | null; + // (undocumented) + protected performDisconnect(): Promise; + // (undocumented) + stream(adapter: InternalSubscriptionAdapter, name: string, parameters: Record | null): SyncStream; + protected syncDisposer: (() => Promise | void) | null; + // (undocumented) + syncStreamImplementation: StreamingSyncImplementation | null; + protected syncStreamInitPromise: Promise | null; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerListener extends BaseListener { + // (undocumented) + syncStreamCreated: (sync: StreamingSyncImplementation) => void; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerOptions { + // (undocumented) + createSyncImplementation( + connector: PowerSyncBackendConnector, + options: CreateSyncImplementationOptions + ): Promise; + // (undocumented) + logger: ILogger; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerSyncImplementationResult" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerSyncImplementationResult { + onDispose: () => Promise | void; + // (undocumented) + sync: StreamingSyncImplementation; +} + +// @public (undocumented) +export interface ConnectionPool extends BaseObserverInterface { + // (undocumented) + close: () => void | Promise; + // (undocumented) + name: string; + // (undocumented) + readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + refreshSchema: () => Promise; + // (undocumented) + writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "ControlledExecutor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class ControlledExecutor { + constructor(task: (param: T) => Promise | void, options?: ControlledExecutorOptions); + // (undocumented) + dispose(): void; + // (undocumented) + schedule(param: T): void; +} + +// Warning: (ae-internal-missing-underscore) The name "ControlledExecutorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ControlledExecutorOptions { + throttleEnabled?: boolean; +} + +// @public +export function createBaseLogger(): typeof Logger; + +// Warning: (ae-forgotten-export) The symbol "BaseCreateDiffTriggerOptions" needs to be exported by the entry point index.d.ts +// +// @alpha +export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions { + destination: string; + setupContext?: LockContext; +} + +// @public +export function createLogger(name: string, options?: CreateLoggerOptions): ILogger; + +// @public (undocumented) +export interface CreateLoggerOptions { + // (undocumented) + logLevel?: ILogLevel; +} + +// Warning: (ae-internal-missing-underscore) The name "CreateSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export interface CreateSyncImplementationOptions extends AdditionalConnectionOptions { + // (undocumented) + subscriptions: SubscribedStream[]; +} + +// @public +export class CrudBatch { + constructor(crud: CrudEntry[], haveMore: boolean, complete: (writeCheckpoint?: string) => Promise); + complete: (writeCheckpoint?: string) => Promise; + crud: CrudEntry[]; + haveMore: boolean; +} + +// @public +export class CrudEntry { + constructor( + clientId: number, + op: UpdateType, + table: string, + id: string, + transactionId?: number, + opData?: Record, + previousValues?: Record, + metadata?: string + ); + clientId: number; + // (undocumented) + equals(entry: CrudEntry): boolean; + // Warning: (ae-forgotten-export) The symbol "CrudEntryJSON" needs to be exported by the entry point index.d.ts + // + // (undocumented) + static fromRow(dbRow: CrudEntryJSON): CrudEntry; + // @deprecated + hashCode(): string; + id: string; + metadata?: string; + op: UpdateType; + opData?: Record; + previousValues?: Record; + table: string; + toComparisonArray(): (string | number | Record | undefined)[]; + // Warning: (ae-forgotten-export) The symbol "CrudEntryOutputJSON" needs to be exported by the entry point index.d.ts + toJSON(): CrudEntryOutputJSON; + transactionId?: number; +} + +// @public (undocumented) +export class CrudTransaction extends CrudBatch { + constructor(crud: CrudEntry[], complete: (checkpoint?: string) => Promise, transactionId?: number | undefined); + complete: (checkpoint?: string) => Promise; + crud: CrudEntry[]; + transactionId?: number | undefined; +} + +// @public (undocumented) +export interface DBAdapter extends ConnectionPool, SqlExecutor, DBGetUtils { + // (undocumented) + readTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; + // (undocumented) + writeTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "DBAdapterDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function DBAdapterDefaultMixin ConnectionPool>( + Base: TBase +): { + new (...args: any[]): { + readTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; + writeTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + get(sql: string, parameters?: any[]): Promise; + execute(query: string, params?: any[]): Promise; + executeRaw(query: string, params?: any[]): Promise; + executeBatch(query: string, params?: any[][]): Promise; + name: string; + close: () => void | Promise; + readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + refreshSchema: () => Promise; + registerListener(listener: Partial): () => void; + }; +} & TBase; + +// @public (undocumented) +export interface DBAdapterListener extends BaseListener { + tablesUpdated: (updateNotification: BatchedUpdateNotification | UpdateNotification) => void; +} + +// @public (undocumented) +export interface DBGetUtils { + get(sql: string, parameters?: any[]): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "DBGetUtilsDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function DBGetUtilsDefaultMixin Omit>( + Base: TBase +): { + new (...args: any[]): { + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + get(sql: string, parameters?: any[]): Promise; + executeBatch(query: string, params?: any[][]): Promise; + execute: (query: string, params?: any[] | undefined) => Promise; + executeRaw: (query: string, params?: any[] | undefined) => Promise; + }; +} & TBase; + +// @public (undocumented) +export interface DBLockOptions { + // (undocumented) + timeoutMs?: number; +} + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_BATCH_LIMIT" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_CRUD_BATCH_LIMIT = 100; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_UPLOAD_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_COLUMN_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_INDEX_COLUMN_OPTIONS: Partial; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_INDEX_OPTIONS: Partial; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_LOCK_TIMEOUT_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const DEFAULT_LOCK_TIMEOUT_MS = 120000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_CLOSE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_DB_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_POWERSYNC_DB_OPTIONS: { + retryDelayMs: number; + crudUploadThrottleMs: number; +}; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_LOGGER" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_REMOTE_LOGGER: Logger.ILogger; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_RETRY_DELAY_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_RETRY_DELAY_MS = 5000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_ROW_COMPARATOR" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const DEFAULT_ROW_COMPARATOR: DifferentialWatchedQueryComparator; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAM_CONNECTION_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAMING_SYNC_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_STREAMING_SYNC_OPTIONS: { + retryDelayMs: number; + crudUploadThrottleMs: number; +}; + +// @public @deprecated +export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_TABLE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_TABLE_OPTIONS: { + indexes: never[]; + insertOnly: boolean; + localOnly: boolean; + trackPrevious: boolean; + trackMetadata: boolean; + ignoreEmptyUpdates: boolean; +}; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_QUERY_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_WATCH_QUERY_OPTIONS: WatchedQueryOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_WATCH_THROTTLE_MS = 30; + +// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class DifferentialQueryProcessor + extends AbstractQueryProcessor>, DifferentialWatchedQuerySettings> + implements DifferentialWatchedQuery +{ + constructor(options: DifferentialQueryProcessorOptions); + // (undocumented) + protected comparator: DifferentialWatchedQueryComparator; + // Warning: (ae-forgotten-export) The symbol "DataHashMap" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected differentiate( + current: RowType[], + previousMap: DataHashMap + ): { + diff: WatchedQueryDifferential; + map: DataHashMap; + hasChanged: boolean; + }; + // (undocumented) + protected linkQuery(options: LinkQueryOptions>): Promise; + // (undocumented) + protected options: DifferentialQueryProcessorOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface DifferentialQueryProcessorOptions extends AbstractQueryProcessorOptions< + RowType[], + DifferentialWatchedQuerySettings +> { + // (undocumented) + rowComparator?: DifferentialWatchedQueryComparator; +} + +// @public (undocumented) +export type DifferentialWatchedQuery = WatchedQuery< + ReadonlyArray>, + DifferentialWatchedQuerySettings, + DifferentialWatchedQueryListener +>; + +// @public +export interface DifferentialWatchedQueryComparator { + compareBy: (item: RowType) => string; + keyBy: (item: RowType) => string; +} + +// @public (undocumented) +export interface DifferentialWatchedQueryListener extends WatchedQueryListener< + ReadonlyArray> +> { + // (undocumented) + onDiff?: (diff: WatchedQueryDifferential) => void | Promise; +} + +// @public +export interface DifferentialWatchedQueryOptions extends WatchedQueryOptions { + placeholderData?: RowType[]; + rowComparator?: DifferentialWatchedQueryComparator; +} + +// @public +export interface DifferentialWatchedQuerySettings extends DifferentialWatchedQueryOptions { + query: WatchCompatibleQuery; +} + +// @alpha +export enum DiffTriggerOperation { + // (undocumented) + DELETE = 'DELETE', + // (undocumented) + INSERT = 'INSERT', + // (undocumented) + UPDATE = 'UPDATE' +} + +// @public (undocumented) +export interface DisconnectAndClearOptions { + clearLocal?: boolean; +} + +// @public (undocumented) +interface Disposable_2 { + // (undocumented) + dispose: () => Promise | void; +} +export { Disposable_2 as Disposable }; + +// Warning: (ae-internal-missing-underscore) The name "EMPTY_DIFFERENTIAL" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const EMPTY_DIFFERENTIAL: { + added: never[]; + all: never[]; + removed: never[]; + updated: never[]; + unchanged: never[]; +}; + +// @alpha (undocumented) +export enum EncodingType { + // (undocumented) + Base64 = 'base64', + // (undocumented) + UTF8 = 'utf8' +} + +// @public (undocumented) +export type ExtractColumnValueType> = T extends BaseColumnType ? R : unknown; + +// @alpha +export type ExtractedTriggerDiffRecord = T & { + [K in keyof Omit, 'id'> as `__${string & K}`]: TriggerDiffRecord[K]; +} & { + __previous_value?: string; +}; + +// Warning: (ae-internal-missing-underscore) The name "extractTableUpdates" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function extractTableUpdates(update: BatchedUpdateNotification | UpdateNotification): string[]; + +// @public +export const FalsyComparator: WatchedQueryComparator; + +// Warning: (ae-internal-missing-underscore) The name "FetchImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type FetchImplementation = typeof fetch_2; + +// Warning: (ae-internal-missing-underscore) The name "FetchImplementationProvider" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class FetchImplementationProvider { + // (undocumented) + getFetch(): FetchImplementation; +} + +// @public (undocumented) +export enum FetchStrategy { + Buffered = 'buffered', + Sequential = 'sequential' +} + +// @public +export class GetAllQuery implements WatchCompatibleQuery { + constructor(options: GetAllQueryOptions); + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(options: { db: AbstractPowerSyncDatabase }): Promise; + // (undocumented) + protected options: GetAllQueryOptions; +} + +// @public +export type GetAllQueryOptions = { + sql: string; + parameters?: ReadonlyArray; + mapper?: (rawRow: Record) => RowType; +}; + +export { GlobalLogger }; + +export { ILogger }; + +export { ILoggerOpts }; + +export { ILogHandler }; + +export { ILogLevel }; + +// @public (undocumented) +export class Index { + constructor(options: IndexOptions); + // (undocumented) + get columns(): IndexedColumn[]; + // (undocumented) + static createAscending(options: IndexOptions, columnNames: string[]): Index; + // (undocumented) + get name(): string; + // (undocumented) + protected options: IndexOptions; + // (undocumented) + toJSON(table: Table): { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }; +} + +// @public (undocumented) +export interface IndexColumnOptions { + // (undocumented) + ascending?: boolean; + // (undocumented) + name: string; +} + +// @public (undocumented) +export class IndexedColumn { + constructor(options: IndexColumnOptions); + // (undocumented) + get ascending(): boolean | undefined; + // (undocumented) + static createAscending(column: string): IndexedColumn; + // (undocumented) + get name(): string; + // (undocumented) + protected options: IndexColumnOptions; + // (undocumented) + toJSON(table: Table): { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }; +} + +// @public (undocumented) +export interface IndexOptions { + // (undocumented) + columns?: IndexedColumn[]; + // (undocumented) + name: string; +} + +// @public (undocumented) +export type IndexShorthand = Record; + +// Warning: (ae-internal-missing-underscore) The name "InternalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions {} + +// Warning: (ae-internal-missing-underscore) The name "InternalSubscriptionAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface InternalSubscriptionAdapter { + // (undocumented) + firstStatusMatching(predicate: (status: SyncStatus) => any, abort?: AbortSignal): Promise; + // (undocumented) + resolveOfflineSyncStatus(): Promise; + // (undocumented) + rustSubscriptionsCommand(payload: any): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "InvalidSQLCharacters" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const InvalidSQLCharacters: RegExp; + +// Warning: (ae-internal-missing-underscore) The name "isBatchedUpdateNotification" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function isBatchedUpdateNotification( + update: BatchedUpdateNotification | UpdateNotification +): update is BatchedUpdateNotification; + +// Warning: (ae-internal-missing-underscore) The name "isDBAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isDBAdapter: (test: any) => test is DBAdapter; + +// Warning: (ae-internal-missing-underscore) The name "isPowerSyncDatabaseOptionsWithSettings" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isPowerSyncDatabaseOptionsWithSettings: (test: any) => test is PowerSyncDatabaseOptionsWithSettings; + +// Warning: (ae-internal-missing-underscore) The name "isSQLOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isSQLOpenFactory: (test: any) => test is SQLOpenFactory; + +// Warning: (ae-internal-missing-underscore) The name "isSQLOpenOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isSQLOpenOptions: (test: any) => test is SQLOpenOptions; + +// Warning: (ae-internal-missing-underscore) The name "LinkQueryOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface LinkQueryOptions { + // (undocumented) + abortSignal: AbortSignal; + // (undocumented) + settings: Settings; +} + +// @alpha +export interface LocalStorageAdapter { + clear(): Promise; + deleteFile(filePath: string): Promise; + fileExists(filePath: string): Promise; + getLocalUri(filename: string): string; + initialize(): Promise; + makeDir(path: string): Promise; + readFile(filePath: string): Promise; + rmDir(path: string): Promise; + saveFile(filePath: string, data: AttachmentData): Promise; +} + +// @public (undocumented) +export interface LockContext extends SqlExecutor, DBGetUtils { + connectionType?: 'writer' | 'queryOnly' | 'readOnly'; +} + +// @internal +interface LockOptions_2 { + // (undocumented) + callback: () => Promise; + // (undocumented) + signal?: AbortSignal; + // (undocumented) + type: LockType; +} + +// Warning: (ae-internal-missing-underscore) The name "LockOptions" should be prefixed with an underscore because the declaration is marked as @internal +export { LockOptions_2 as LockOptions }; + +// Warning: (ae-internal-missing-underscore) The name "LockType" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum LockType { + // (undocumented) + CRUD = 'crud', + // (undocumented) + SYNC = 'sync' +} + +// @public (undocumented) +export const LogLevel: { + TRACE: Logger.ILogLevel; + DEBUG: Logger.ILogLevel; + INFO: Logger.ILogLevel; + TIME: Logger.ILogLevel; + WARN: Logger.ILogLevel; + ERROR: Logger.ILogLevel; + OFF: Logger.ILogLevel; +}; + +// Warning: (ae-internal-missing-underscore) The name "MAX_AMOUNT_OF_COLUMNS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const MAX_AMOUNT_OF_COLUMNS = 1999; + +// Warning: (ae-internal-missing-underscore) The name "MAX_OP_ID" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const MAX_OP_ID = '9223372036854775807'; + +// Warning: (ae-internal-missing-underscore) The name "MEMORY_TRIGGER_CLAIM_MANAGER" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const MEMORY_TRIGGER_CLAIM_MANAGER: TriggerClaimManager; + +// Warning: (ae-forgotten-export) The symbol "MutableDeep" needs to be exported by the entry point index.d.ts +// Warning: (ae-internal-missing-underscore) The name "MutableWatchedQueryState" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export type MutableWatchedQueryState = { + -readonly [P in keyof WatchedQueryState]: MutableDeep[P]>; +}; + +// Warning: (ae-internal-missing-underscore) The name "Mutex" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class Mutex { + // (undocumented) + acquire(abort?: AbortSignal): Promise; + // (undocumented) + runExclusive(fn: () => PromiseLike | T, abort?: AbortSignal): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class OnChangeQueryProcessor extends AbstractQueryProcessor> { + constructor(options: OnChangeQueryProcessorOptions); + // (undocumented) + protected checkEquality(current: Data, previous: Data): boolean; + // (undocumented) + protected linkQuery(options: LinkQueryOptions): Promise; + // (undocumented) + protected options: OnChangeQueryProcessorOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface OnChangeQueryProcessorOptions extends AbstractQueryProcessorOptions< + Data, + WatchedQuerySettings +> { + // (undocumented) + comparator?: WatchedQueryComparator; +} + +// @public +export type OpId = string; + +// Warning: (ae-internal-missing-underscore) The name "ParsedQuery" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ParsedQuery { + // (undocumented) + parameters: any[]; + // (undocumented) + sqlStatement: string; +} + +// Warning: (ae-internal-missing-underscore) The name "parseQuery" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const parseQuery: (query: string | CompilableQuery, parameters: any[]) => ParsedQuery; + +// @public +export type PendingStatement = { + sql: string; + params: PendingStatementParameter[]; +}; + +// @public +export type PendingStatementParameter = + | 'Id' + | { + Column: string; + } + | 'Rest'; + +// @public (undocumented) +export interface PowerSyncBackendConnector { + fetchCredentials: () => Promise; + uploadData: (database: AbstractPowerSyncDatabase) => Promise; +} + +// @public (undocumented) +export interface PowerSyncCloseOptions { + disconnect?: boolean; +} + +// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncConnectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal +// +// @public +export type PowerSyncConnectionOptions = Omit; + +// Warning: (ae-internal-missing-underscore) The name "PowerSyncControlCommand" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum PowerSyncControlCommand { + CONNECTION_STATE = 'connection', + // (undocumented) + NOTIFY_CRUD_UPLOAD_COMPLETED = 'completed_upload', + // (undocumented) + NOTIFY_TOKEN_REFRESHED = 'refreshed_token', + // (undocumented) + PROCESS_BSON_LINE = 'line_binary', + // (undocumented) + PROCESS_TEXT_LINE = 'line_text', + // (undocumented) + START = 'start', + // (undocumented) + STOP = 'stop', + // (undocumented) + UPDATE_SUBSCRIPTIONS = 'update_subscriptions' +} + +// @public (undocumented) +export interface PowerSyncCredentials { + // (undocumented) + endpoint: string; + // (undocumented) + expiresAt?: Date; + // (undocumented) + token: string; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions { + database: DBAdapter | SQLOpenFactory | SQLOpenOptions; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithDBAdapter extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: DBAdapter; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithOpenFactory extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: SQLOpenFactory; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithSettings extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: SQLOpenOptions; +} + +// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncDBListener" is marked as @public, but its signature references "StreamingSyncImplementationListener" which is marked as @internal +// +// @public (undocumented) +export interface PowerSyncDBListener extends StreamingSyncImplementationListener { + // (undocumented) + closed: () => Promise | void; + // (undocumented) + closing: () => Promise | void; + // (undocumented) + initialized: () => void; + // (undocumented) + schemaChanged: (schema: Schema) => void; +} + +// Warning: (ae-internal-missing-underscore) The name "PowerSyncOpenFactoryOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface PowerSyncOpenFactoryOptions extends Partial, SQLOpenOptions { + schema: Schema; +} + +// @public +export interface ProgressWithOperations { + downloadedFraction: number; + downloadedOperations: number; + totalOperations: number; +} + +// Warning: (ae-internal-missing-underscore) The name "PSInternalTable" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum PSInternalTable { + // (undocumented) + BUCKETS = 'ps_buckets', + // (undocumented) + CRUD = 'ps_crud', + // (undocumented) + DATA = 'ps_data', + // (undocumented) + OPLOG = 'ps_oplog', + // (undocumented) + UNTYPED = 'ps_untyped' +} + +// @public (undocumented) +export interface Query { + differentialWatch(options?: DifferentialWatchedQueryOptions): DifferentialWatchedQuery; + watch(options?: StandardWatchedQueryOptions): StandardWatchedQuery>>; +} + +// @public +export type QueryParam = string | number | boolean | null | undefined | bigint | Uint8Array; + +// @public +export type QueryResult = { + insertId?: number; + rowsAffected: number; + rows?: { + _array: any[]; + length: number; + item: (idx: number) => any; + }; +}; + +// Warning: (ae-forgotten-export) The symbol "RawTableTypeWithStatements" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "InferredRawTableType" needs to be exported by the entry point index.d.ts +// +// @public +export type RawTableType = RawTableTypeWithStatements | InferredRawTableType; + +// Warning: (ae-internal-missing-underscore) The name "RemoteConnector" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type RemoteConnector = { + fetchCredentials: () => Promise; + invalidateCredentials?: () => void; +}; + +// @alpha +export interface RemoteStorageAdapter { + deleteFile(attachment: AttachmentRecord): Promise; + downloadFile(attachment: AttachmentRecord): Promise; + uploadFile(fileData: ArrayBuffer, attachment: AttachmentRecord): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "RequiredAdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface RequiredAdditionalConnectionOptions extends Required { + // (undocumented) + subscriptions: SubscribedStream[]; +} + +// Warning: (ae-internal-missing-underscore) The name "RequiredPowerSyncConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type RequiredPowerSyncConnectionOptions = Required; + +// @public (undocumented) +export type RowType> = { + [K in keyof T['columnMap']]: ExtractColumnValueType; +} & { + id: string; +}; + +// @public +export enum RowUpdateType { + // (undocumented) + SQLITE_DELETE = 9, + // (undocumented) + SQLITE_INSERT = 18, + // (undocumented) + SQLITE_UPDATE = 23 +} + +// Warning: (ae-internal-missing-underscore) The name "runOnSchemaChange" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function runOnSchemaChange( + callback: (signal: AbortSignal) => void, + db: AbstractPowerSyncDatabase, + options?: SQLWatchOptions +): void; + +// @alpha +export function sanitizeSQL(strings: TemplateStringsArray, ...values: any[]): string; + +// @alpha +export function sanitizeUUID(uuid: string): string; + +// Warning: (ae-forgotten-export) The symbol "SchemaType" needs to be exported by the entry point index.d.ts +// +// @public +export class Schema { + constructor(tables: Table[] | S); + // (undocumented) + readonly props: S; + // Warning: (ae-forgotten-export) The symbol "RawTable" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly rawTables: RawTable[]; + static rawTableToJson(table: RawTable): unknown; + // (undocumented) + readonly tables: Table[]; + // (undocumented) + toJSON(): { + tables: { + local_only: boolean | undefined; + insert_only: boolean | undefined; + include_old: any; + include_old_only_when_changed: boolean; + include_metadata: boolean | undefined; + ignore_empty_update: boolean | undefined; + name: string; + view_name: string; + columns: { + name: string; + type: ColumnType | undefined; + }[]; + indexes: { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }[]; + }[]; + raw_tables: unknown[]; + }; + // (undocumented) + readonly types: SchemaTableType; + // (undocumented) + validate(): void; + withRawTables(tables: Record): void; +} + +// @public (undocumented) +export type SchemaTableType = { + [K in keyof S]: RowType; +}; + +// Warning: (ae-internal-missing-underscore) The name "Semaphore" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class Semaphore { + constructor(elements: Iterable); + requestAll(abort?: AbortSignal): Promise<{ + items: T[]; + release: UnlockFn; + }>; + requestOne(abort?: AbortSignal): Promise<{ + item: T; + release: UnlockFn; + }>; + // (undocumented) + readonly size: number; +} + +// Warning: (ae-internal-missing-underscore) The name "SimpleAsyncIterator" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export type SimpleAsyncIterator = Pick, 'next'>; + +// Warning: (ae-internal-missing-underscore) The name "SocketSyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SocketSyncStreamOptions = SyncStreamOptions & { + fetchStrategy: FetchStrategy; +}; + +// @public (undocumented) +export interface SqlExecutor { + execute: (query: string, params?: any[] | undefined) => Promise; + // (undocumented) + executeBatch: (query: string, params?: any[][]) => Promise; + executeRaw: (query: string, params?: any[] | undefined) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "SqliteBucketStorage" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class SqliteBucketStorage extends BaseObserver implements BucketStorageAdapter { + constructor(db: DBAdapter, logger?: ILogger); + // (undocumented) + control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise; + // (undocumented) + dispose(): Promise; + // (undocumented) + getClientId(): Promise; + // (undocumented) + _getClientId(): Promise; + getCrudBatch(limit?: number): Promise; + // (undocumented) + getMaxOpId(): string; + // (undocumented) + hasCrud(): Promise; + // (undocumented) + hasMigratedSubkeys(): Promise; + // (undocumented) + init(): Promise; + // (undocumented) + migrateToFixedSubkeys(): Promise; + // (undocumented) + nextCrudItem(): Promise; + // (undocumented) + static _subkeyMigrationKey: string; + // (undocumented) + tableNames: Set; + // (undocumented) + updateLocalTarget(cb: () => Promise): Promise; + // (undocumented) + writeTransaction( + callback: (tx: Transaction) => Promise, + options?: { + timeoutMs: number; + } + ): Promise; +} + +// @public (undocumented) +export interface SQLOnChangeOptions { + // @deprecated (undocumented) + rawTableNames?: boolean; + // (undocumented) + signal?: AbortSignal; + // (undocumented) + tables?: string[]; + throttleMs?: number; + triggerImmediate?: boolean; +} + +// @public (undocumented) +export interface SQLOpenFactory { + openDB(): DBAdapter; +} + +// @public (undocumented) +export interface SQLOpenOptions { + dbFilename: string; + dbLocation?: string; + debugMode?: boolean; +} + +// @public (undocumented) +export interface SQLWatchOptions extends SQLOnChangeOptions { + comparator?: WatchedQueryComparator; +} + +// @public +export type StandardWatchedQuery = WatchedQuery>; + +// @public +export interface StandardWatchedQueryOptions extends WatchedQueryOptions { + comparator?: WatchedQueryComparator; + placeholderData?: RowType[]; +} + +// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface StreamingSyncImplementation + extends BaseObserverInterface, Disposable_2 { + connect(options?: InternalConnectionOptions): Promise; + disconnect(): Promise; + // (undocumented) + getWriteCheckpoint: () => Promise; + // (undocumented) + isConnected: boolean; + // (undocumented) + markConnectionMayHaveChanged(): void; + // (undocumented) + syncStatus: SyncStatus; + // (undocumented) + triggerCrudUpload: () => void; + // (undocumented) + updateSubscriptions(subscriptions: SubscribedStream[]): void; + // (undocumented) + waitForReady(): Promise; + // (undocumented) + waitForStatus(status: SyncStatusOptions): Promise; + // (undocumented) + waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementationListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface StreamingSyncImplementationListener extends BaseListener { + statusChanged?: ((status: SyncStatus) => void) | undefined; + statusUpdated?: ((statusUpdate: SyncStatusOptions) => void) | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "JSONValue" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StreamingSyncRequestParameterType = JSONValue; + +// Warning: (ae-internal-missing-underscore) The name "SubscribedStream" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SubscribedStream = { + name: string; + params: Record | null; +}; + +// @public @deprecated (undocumented) +export enum SyncClientImplementation { + RUST = 'rust' +} + +// @public (undocumented) +export type SyncDataFlowStatus = Partial<{ + downloading: boolean; + uploading: boolean; + downloadError?: Error; + uploadError?: Error; + downloadProgress: InternalProgressInformation | null; + internalStreamSubscriptions: CoreStreamSubscription[] | null; +}>; + +// Warning: (ae-internal-missing-underscore) The name "SyncingService" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class SyncingService { + constructor( + attachmentService: AttachmentService, + localStorage: LocalStorageAdapter, + remoteStorage: RemoteStorageAdapter, + logger: ILogger, + errorHandler?: AttachmentErrorHandler + ); + deleteArchivedAttachments(context: AttachmentContext): Promise; + deleteAttachment(attachment: AttachmentRecord, context: AttachmentContext): Promise; + downloadAttachment(attachment: AttachmentRecord): Promise; + processAttachments(attachments: AttachmentRecord[], context: AttachmentContext): Promise; + uploadAttachment(attachment: AttachmentRecord): Promise; +} + +// @public (undocumented) +export interface SyncPriorityStatus { + // (undocumented) + hasSynced?: boolean; + // (undocumented) + lastSyncedAt?: Date; + // (undocumented) + priority: number; +} + +// @public +export class SyncProgress implements ProgressWithOperations { + constructor(internal: InternalProgressInformation); + // (undocumented) + downloadedFraction: number; + // (undocumented) + downloadedOperations: number; + // (undocumented) + protected internal: InternalProgressInformation; + // (undocumented) + totalOperations: number; + untilPriority(priority: number): ProgressWithOperations; +} + +// @public (undocumented) +export class SyncStatus { + // Warning: (ae-incompatible-release-tags) The symbol "__constructor" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + constructor(options: SyncStatusOptions); + // @deprecated + get clientImplementation(): SyncClientImplementation | undefined; + get connected(): boolean; + get connecting(): boolean; + get dataFlowStatus(): SyncDataFlowStatus; + get downloadProgress(): SyncProgress | null; + forStream(stream: SyncStreamDescription): SyncStreamStatus | undefined; + getMessage(): string; + get hasSynced(): boolean | undefined; + isEqual(status: SyncStatus): boolean; + get lastSyncedAt(): Date | undefined; + // Warning: (ae-incompatible-release-tags) The symbol "options" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + // + // (undocumented) + protected options: SyncStatusOptions; + get priorityStatusEntries(): SyncPriorityStatus[]; + protected serializeError(error?: Error): + | { + name: string; + message: string; + stack: string | undefined; + } + | undefined; + statusForPriority(priority: number): SyncPriorityStatus; + get syncStreams(): SyncStreamStatus[] | undefined; + // Warning: (ae-incompatible-release-tags) The symbol "toJSON" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + toJSON(): SyncStatusOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "SyncStatusOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SyncStatusOptions = { + connected?: boolean; + connecting?: boolean; + dataFlow?: SyncDataFlowStatus; + lastSyncedAt?: Date; + hasSynced?: boolean; + priorityStatusEntries?: SyncPriorityStatus[]; + clientImplementation?: SyncClientImplementation; +}; + +// @public +export interface SyncStream extends SyncStreamDescription { + subscribe(options?: SyncStreamSubscribeOptions): Promise; + unsubscribeAll(): Promise; +} + +// @public (undocumented) +export enum SyncStreamConnectionMethod { + // (undocumented) + HTTP = 'http', + // (undocumented) + WEB_SOCKET = 'web-socket' +} + +// @public +export interface SyncStreamDescription { + name: string; + parameters: Record | null; +} + +// Warning: (ae-internal-missing-underscore) The name "SyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SyncStreamOptions = { + path: string; + data: unknown; + headers?: Record; + abortSignal: AbortSignal; + fetchOptions?: Request; +}; + +// @public +export interface SyncStreamStatus { + // (undocumented) + priority: number | null; + // (undocumented) + progress: ProgressWithOperations | null; + // (undocumented) + subscription: SyncSubscriptionDescription; +} + +// @public (undocumented) +export interface SyncStreamSubscribeOptions { + priority?: 0 | 1 | 2 | 3; + ttl?: number; +} + +// @public (undocumented) +export interface SyncStreamSubscription extends SyncStreamDescription { + unsubscribe(): void; + waitForFirstSync(abort?: AbortSignal): Promise; +} + +// @public +export interface SyncSubscriptionDescription extends SyncStreamDescription { + // (undocumented) + active: boolean; + expiresAt: Date | null; + hasExplicitSubscription: boolean; + hasSynced: boolean; + isDefault: boolean; + lastSyncedAt: Date | null; +} + +// @public (undocumented) +export class Table { + constructor(columns: Columns, options?: TableV2Options); + // @deprecated + constructor(options: TableOptions); + // (undocumented) + get columnMap(): Columns; + // (undocumented) + get columns(): Column[]; + // (undocumented) + copyWithName(name: string): Table; + // (undocumented) + static createInsertOnly(options: TableOptions): Table; + // (undocumented) + static createLocalOnly(options: TableOptions): Table; + // @deprecated + static createTable(name: string, table: Table): Table; + // (undocumented) + get ignoreEmptyUpdates(): boolean; + // (undocumented) + get indexes(): Index[]; + // (undocumented) + get insertOnly(): boolean; + // (undocumented) + get internalName(): string; + // (undocumented) + get localOnly(): boolean; + // (undocumented) + protected _mappedColumns: Columns; + // (undocumented) + get name(): string; + // (undocumented) + protected options: TableOptions; + // (undocumented) + toJSON(): { + local_only: boolean | undefined; + insert_only: boolean | undefined; + include_old: any; + include_old_only_when_changed: boolean; + include_metadata: boolean | undefined; + ignore_empty_update: boolean | undefined; + name: string; + view_name: string; + columns: { + name: string; + type: ColumnType | undefined; + }[]; + indexes: { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }[]; + }; + // (undocumented) + get trackMetadata(): boolean; + // (undocumented) + get trackPrevious(): boolean | TrackPreviousOptions; + // (undocumented) + validate(): void; + // (undocumented) + get validName(): boolean; + // (undocumented) + get viewName(): string; + // (undocumented) + get viewNameOverride(): string | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "SharedTableOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export interface TableOptions extends SharedTableOptions { + // (undocumented) + columns: Column[]; + // (undocumented) + indexes?: Index[]; + name: string; +} + +// @public +export interface TableOrRawTableOptions { + // (undocumented) + ignoreEmptyUpdates?: boolean; + // (undocumented) + insertOnly?: boolean; + // (undocumented) + localOnly?: boolean; + // (undocumented) + trackMetadata?: boolean; + // (undocumented) + trackPrevious?: boolean | TrackPreviousOptions; +} + +// @public (undocumented) +export interface TableUpdateOperation { + // (undocumented) + opType: RowUpdateType; + // (undocumented) + rowId: number; +} + +// @public @deprecated +export class TableV2 extends Table {} + +// @public (undocumented) +export interface TableV2Options extends SharedTableOptions { + // (undocumented) + indexes?: IndexShorthand; +} + +// Warning: (ae-internal-missing-underscore) The name "timeoutSignal" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function timeoutSignal(timeout: number): AbortSignal; + +// @internal (undocumented) +export function timeoutSignal(timeout?: number): AbortSignal | undefined; + +// @alpha +export interface TrackDiffOptions extends BaseCreateDiffTriggerOptions { + onChange: (context: TriggerDiffHandlerContext) => Promise; + throttleMs?: number; +} + +// @public +export interface TrackPreviousOptions { + columns?: string[]; + onlyWhenChanged?: boolean; +} + +// @public (undocumented) +export interface Transaction extends LockContext { + commit: () => Promise; + rollback: () => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerClaimManager" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export interface TriggerClaimManager { + checkClaim: (identifier: string) => Promise; + obtainClaim: (identifier: string) => Promise<() => Promise>; +} + +// @alpha +export interface TriggerCreationHooks { + beforeCreate?: (context: LockContext) => Promise; +} + +// @alpha +export interface TriggerDiffDeleteRecord< + TOperationId extends string | number = number +> extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.DELETE; + value: string; +} + +// @alpha +export interface TriggerDiffHandlerContext extends LockContext { + destinationTable: string; + withDiff: (query: string, params?: ReadonlyArray>, options?: WithDiffOptions) => Promise; + withExtractedDiff: (query: string, params?: ReadonlyArray>) => Promise; +} + +// @alpha +export interface TriggerDiffInsertRecord< + TOperationId extends string | number = number +> extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.INSERT; + value: string; +} + +// @alpha +export type TriggerDiffRecord = + | TriggerDiffUpdateRecord + | TriggerDiffInsertRecord + | TriggerDiffDeleteRecord; + +// @alpha +export interface TriggerDiffUpdateRecord< + TOperationId extends string | number = number +> extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.UPDATE; + previous_value: string; + value: string; +} + +// @alpha (undocumented) +export interface TriggerManager { + createDiffTrigger(options: CreateDiffTriggerOptions): Promise; + trackTableDiff(options: TrackDiffOptions): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerManagerConfig" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface TriggerManagerConfig { + // (undocumented) + claimManager: TriggerClaimManager; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerManagerImpl" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class TriggerManagerImpl implements TriggerManager { + constructor(options: TriggerManagerImplOptions); + cleanupResources(): Promise; + // (undocumented) + protected cleanupTimeout: ReturnType | null; + // (undocumented) + createDiffTrigger( + options: CreateDiffTriggerOptions + ): Promise<(options?: TriggerRemoveCallbackOptions) => Promise>; + // (undocumented) + protected get db(): AbstractPowerSyncDatabase; + // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplConfiguration" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected defaultConfig: TriggerManagerImplConfiguration; + // (undocumented) + dispose(): void; + // (undocumented) + protected generateTriggerName(operation: DiffTriggerOperation, destinationTable: string, triggerId: string): string; + // (undocumented) + protected getUUID(ctx?: LockContext): Promise; + // (undocumented) + protected isDisposed: boolean; + // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected options: TriggerManagerImplOptions; + // (undocumented) + protected removeTriggers(tx: LockContext, triggerIds: string[]): Promise; + // (undocumented) + protected schema: Schema; + // (undocumented) + trackTableDiff(options: TrackDiffOptions): Promise; + updateDefaults(config: TriggerManagerImplConfiguration): void; +} + +// @alpha +export type TriggerRemoveCallback = (options?: TriggerRemoveCallbackOptions) => Promise; + +// @alpha +export interface TriggerRemoveCallbackOptions { + // (undocumented) + context?: LockContext; +} + +// Warning: (ae-internal-missing-underscore) The name "UnlockFn" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type UnlockFn = () => void; + +// @public +export interface UpdateNotification extends TableUpdateOperation { + // (undocumented) + table: string; +} + +// @public +export enum UpdateType { + DELETE = 'DELETE', + PATCH = 'PATCH', + PUT = 'PUT' +} + +// @public (undocumented) +export class UploadQueueStats { + constructor(count: number, size?: number | null); + count: number; + size: number | null; + // (undocumented) + toString(): string; +} + +// @public (undocumented) +export interface WatchCompatibleQuery { + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(options: WatchExecuteOptions): Promise; +} + +// @alpha +export type WatchedAttachmentItem = + | { + id: string; + filename: string; + fileExtension?: never; + metaData?: string; + mediaType?: string; + } + | { + id: string; + fileExtension: string; + filename?: never; + metaData?: string; + mediaType?: string; + }; + +// Warning: (ae-forgotten-export) The symbol "MetaBaseObserverInterface" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export interface WatchedQuery< + Data = unknown, + Settings extends WatchedQueryOptions = WatchedQueryOptions, + Listener extends WatchedQueryListener = WatchedQueryListener +> extends MetaBaseObserverInterface { + close(): Promise; + // (undocumented) + readonly closed: boolean; + registerListener(listener: Listener): () => void; + readonly state: WatchedQueryState; + updateSettings(options: Settings): Promise; +} + +// @public +export interface WatchedQueryComparator { + // (undocumented) + checkEquality: (current: Data, previous: Data) => boolean; +} + +// @public +export interface WatchedQueryDifferential { + // (undocumented) + readonly added: ReadonlyArray>; + readonly all: ReadonlyArray>; + // (undocumented) + readonly removed: ReadonlyArray>; + // (undocumented) + readonly unchanged: ReadonlyArray>; + // (undocumented) + readonly updated: ReadonlyArray>>; +} + +// @public (undocumented) +export interface WatchedQueryListener extends BaseListener { + // (undocumented) + [WatchedQueryListenerEvent.CLOSED]?: () => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_DATA]?: (data: Data) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_ERROR]?: (error: Error) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_STATE_CHANGE]?: (state: WatchedQueryState) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.SETTINGS_WILL_UPDATE]?: () => void; +} + +// @public (undocumented) +export enum WatchedQueryListenerEvent { + // (undocumented) + CLOSED = 'closed', + // (undocumented) + ON_DATA = 'onData', + // (undocumented) + ON_ERROR = 'onError', + // (undocumented) + ON_STATE_CHANGE = 'onStateChange', + // (undocumented) + SETTINGS_WILL_UPDATE = 'settingsWillUpdate' +} + +// @public (undocumented) +export interface WatchedQueryOptions { + reportFetching?: boolean; + throttleMs?: number; + triggerOnTables?: string[]; +} + +// @public +export interface WatchedQueryRowDifferential { + // (undocumented) + readonly current: RowType; + // (undocumented) + readonly previous: RowType; +} + +// @public +export interface WatchedQuerySettings extends WatchedQueryOptions { + // (undocumented) + query: WatchCompatibleQuery; +} + +// @public +export interface WatchedQueryState { + readonly data: Data; + readonly error: Error | null; + readonly isFetching: boolean; + readonly isLoading: boolean; + readonly lastUpdated: Date | null; +} + +// @public +export interface WatchExecuteOptions { + // (undocumented) + db: AbstractPowerSyncDatabase; + // (undocumented) + parameters: any[]; + // (undocumented) + sql: string; +} + +// @public (undocumented) +export interface WatchHandler { + // (undocumented) + onError?: (error: Error) => void; + // (undocumented) + onResult: (results: QueryResult) => void; +} + +// @public (undocumented) +export interface WatchOnChangeEvent { + // (undocumented) + changedTables: string[]; +} + +// @public (undocumented) +export interface WatchOnChangeHandler { + // (undocumented) + onChange: (event: WatchOnChangeEvent) => Promise | void; + // (undocumented) + onError?: (error: Error) => void; +} + +// @alpha +export interface WithDiffOptions { + castOperationIdAsText?: boolean; +} + +// Warnings were encountered during analysis: +// +// lib/db/crud/SyncStatus.d.ts:27:5 - (ae-forgotten-export) The symbol "InternalProgressInformation" needs to be exported by the entry point index.d.ts +// lib/db/crud/SyncStatus.d.ts:31:5 - (ae-forgotten-export) The symbol "CoreStreamSubscription" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) +``` From fa5305b93320c2c2904d35972c7a33e450140471 Mon Sep 17 00:00:00 2001 From: Christiaan Landman Date: Wed, 10 Jun 2026 14:58:49 +0200 Subject: [PATCH 4/5] Updated common.api.md --- packages/common/etc/common.api.md | 4970 ++++++++++++++--------------- 1 file changed, 2441 insertions(+), 2529 deletions(-) diff --git a/packages/common/etc/common.api.md b/packages/common/etc/common.api.md index 7b133a7d9..64bf23062 100644 --- a/packages/common/etc/common.api.md +++ b/packages/common/etc/common.api.md @@ -1,2529 +1,2441 @@ -## API Report File for "@powersync/common" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts -import { fetch as fetch_2 } from 'cross-fetch'; -import { GlobalLogger } from 'js-logger'; -import { ILogger } from 'js-logger'; -import { ILoggerOpts } from 'js-logger'; -import { ILogHandler } from 'js-logger'; -import { ILogLevel } from 'js-logger'; -import Logger from 'js-logger'; - -// Warning: (ae-internal-missing-underscore) The name "AbortOperation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class AbortOperation extends Error { - constructor(reason: string); - // (undocumented) - protected reason: string; -} - -// Warning: (ae-incompatible-release-tags) The symbol "AbstractPowerSyncDatabase" is marked as @public, but its signature references "BaseObserver" which is marked as @internal -// -// @public (undocumented) -export abstract class AbstractPowerSyncDatabase extends BaseObserver { - constructor(options: PowerSyncDatabaseOptionsWithDBAdapter); - constructor(options: PowerSyncDatabaseOptionsWithOpenFactory); - constructor(options: PowerSyncDatabaseOptionsWithSettings); - constructor(options: PowerSyncDatabaseOptions); - // Warning: (ae-incompatible-release-tags) The symbol "bucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal - // - // (undocumented) - protected bucketStorageAdapter: BucketStorageAdapter; - close(options?: PowerSyncCloseOptions): Promise; - closed: boolean; - connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise; - get connected(): boolean; - // (undocumented) - get connecting(): boolean; - // Warning: (ae-incompatible-release-tags) The symbol "connectionManager" is marked as @public, but its signature references "ConnectionManager" which is marked as @internal - // - // (undocumented) - protected connectionManager: ConnectionManager; - // Warning: (ae-incompatible-release-tags) The symbol "connectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal - get connectionOptions(): InternalConnectionOptions | null; - get connector(): PowerSyncBackendConnector | null; - currentStatus: SyncStatus; - customQuery(query: WatchCompatibleQuery): Query; - get database(): DBAdapter; - disconnect(): Promise; - disconnectAndClear(options?: DisconnectAndClearOptions): Promise; - // @deprecated (undocumented) - dispose(): void; - execute(sql: string, parameters?: any[]): Promise; - executeBatch(sql: string, parameters?: any[][]): Promise; - executeRaw(sql: string, parameters?: any[]): Promise; - // Warning: (ae-incompatible-release-tags) The symbol "generateBucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal - // - // (undocumented) - protected abstract generateBucketStorageAdapter(): BucketStorageAdapter; - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal - // - // (undocumented) - protected abstract generateSyncStreamImplementation( - connector: PowerSyncBackendConnector, - options: CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions - ): StreamingSyncImplementation; - // Warning: (ae-incompatible-release-tags) The symbol "generateTriggerManagerConfig" is marked as @public, but its signature references "TriggerManagerConfig" which is marked as @internal - protected generateTriggerManagerConfig(): TriggerManagerConfig; - get(sql: string, parameters?: any[]): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getClientId(): Promise; - getCrudBatch(limit?: number): Promise; - getCrudTransactions(): AsyncIterable; - getNextCrudTransaction(): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - getUploadQueueStats(includeSize?: boolean): Promise; - init(): Promise; - protected initialize(): Promise; - abstract _initialize(): Promise; - // (undocumented) - protected _isReadyPromise: Promise; - // (undocumented) - protected loadVersion(): Promise; - // (undocumented) - logger: ILogger; - onChange(options?: SQLOnChangeOptions): AsyncIterable; - onChange(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; - onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable; - onChangeWithCallback(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; - protected abstract openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter; - // (undocumented) - protected options: PowerSyncDatabaseOptions; - query(query: ArrayQueryDefinition): Query; - readLock(callback: (db: LockContext) => Promise): Promise; - readTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; - // (undocumented) - ready: boolean; - // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal - // - // (undocumented) - protected resolvedConnectionOptions( - options: CreateSyncImplementationOptions - ): CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions; - // (undocumented) - protected resolveOfflineSyncStatus(): Promise; - resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise; - protected runExclusive(callback: () => Promise): Promise; - // Warning: (ae-incompatible-release-tags) The symbol "runExclusiveMutex" is marked as @public, but its signature references "Mutex" which is marked as @internal - // - // (undocumented) - protected runExclusiveMutex: Mutex; - get schema(): Schema<{ - [x: string]: Table; - }>; - // (undocumented) - protected _schema: Schema; - // (undocumented) - sdkVersion: string; - syncStream(name: string, params?: Record): SyncStream; - // Warning: (ae-incompatible-release-tags) The symbol "syncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal - // - // (undocumented) - get syncStreamImplementation(): StreamingSyncImplementation | null; - // Warning: (ae-incompatible-release-tags) The symbol "triggers" is marked as @public, but its signature references "TriggerManager" which is marked as @alpha - readonly triggers: TriggerManager; - // Warning: (ae-incompatible-release-tags) The symbol "triggersImpl" is marked as @public, but its signature references "TriggerManagerImpl" which is marked as @internal - // - // (undocumented) - protected triggersImpl: TriggerManagerImpl; - updateSchema(schema: Schema): Promise; - waitForFirstSync( - request?: - | AbortSignal - | { - signal?: AbortSignal; - priority?: number; - } - ): Promise; - // (undocumented) - waitForReady(): Promise; - waitForStatus(predicate: (status: SyncStatus) => any, signal?: AbortSignal): Promise; - watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; - watch(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; - watchWithAsyncGenerator(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; - watchWithCallback(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; - writeLock(callback: (db: LockContext) => Promise): Promise; - writeTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractPowerSyncDatabaseOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractPowerSyncDatabaseOpenFactory { - constructor(options: PowerSyncOpenFactoryOptions); - // (undocumented) - abstract generateInstance(options: PowerSyncDatabaseOptions): AbstractPowerSyncDatabase; - // (undocumented) - generateOptions(): PowerSyncDatabaseOptions; - // (undocumented) - getInstance(): AbstractPowerSyncDatabase; - // (undocumented) - protected abstract openDB(): DBAdapter; - // (undocumented) - protected options: PowerSyncOpenFactoryOptions; - get schema(): Schema<{ - [x: string]: Table; - }>; -} - -// Warning: (ae-forgotten-export) The symbol "MetaBaseObserver" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "WatchedQueryProcessorListener" needs to be exported by the entry point index.d.ts -// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export abstract class AbstractQueryProcessor< - Data = unknown[], - Settings extends WatchedQueryOptions = WatchedQueryOptions -> - extends MetaBaseObserver> - implements WatchedQuery -{ - constructor(options: AbstractQueryProcessorOptions); - // (undocumented) - protected abortController: AbortController; - // (undocumented) - close(): Promise; - // (undocumented) - get closed(): boolean; - // (undocumented) - protected _closed: boolean; - // (undocumented) - protected constructInitialState(): WatchedQueryState; - // (undocumented) - protected disposeListeners: (() => void) | null; - protected init(signal: AbortSignal): Promise; - // (undocumented) - protected initialized: Promise; - protected iterateAsyncListenersWithError( - callback: (listener: Partial>) => Promise | void - ): Promise; - protected abstract linkQuery(options: LinkQueryOptions): Promise; - // (undocumented) - protected options: AbstractQueryProcessorOptions; - // (undocumented) - protected get reportFetching(): boolean; - protected runWithReporting(callback: () => Promise): Promise; - // (undocumented) - readonly state: WatchedQueryState; - updateSettings(settings: Settings): Promise; - // (undocumented) - protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise; - // (undocumented) - protected updateState(update: Partial>): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AbstractQueryProcessorOptions { - // (undocumented) - db: AbstractPowerSyncDatabase; - // (undocumented) - placeholderData: Data; - // (undocumented) - watchOptions: Settings; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractRemote" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractRemote { - constructor(connector: RemoteConnector, logger?: ILogger, options?: Partial); - // (undocumented) - protected buildRequest(path: string): Promise<{ - url: string; - headers: { - 'content-type': string; - Authorization: string; - 'x-user-agent': string; - }; - }>; - // (undocumented) - protected connector: RemoteConnector; - // (undocumented) - protected createSocket(url: string): WebSocket; - // (undocumented) - createTextDecoder(): TextDecoder; - // (undocumented) - protected credentials: PowerSyncCredentials | null; - // (undocumented) - get fetch(): FetchImplementation; - fetchCredentials(): Promise; - fetchStream(options: SyncStreamOptions): Promise>; - protected fetchStreamRaw(options: SyncStreamOptions): Promise<{ - isBson: boolean; - stream: SimpleAsyncIterator; - }>; - // (undocumented) - get(path: string, headers?: Record): Promise; - getCredentials(): Promise; - // (undocumented) - getUserAgent(): string; - invalidateCredentials(): void; - // (undocumented) - protected logger: ILogger; - // (undocumented) - protected options: AbstractRemoteOptions; - // (undocumented) - post(path: string, data: any, headers?: Record): Promise; - prefetchCredentials(): Promise; - socketStreamRaw(options: SocketSyncStreamOptions): Promise>; - // (undocumented) - protected get supportsStreamingBinaryResponses(): boolean; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractRemoteOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type AbstractRemoteOptions = { - socketUrlTransformer: (url: string) => string; - fetchImplementation: FetchImplementation | FetchImplementationProvider; - fetchOptions?: {}; -}; - -// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractStreamingSyncImplementation - extends BaseObserver - implements StreamingSyncImplementation -{ - constructor(options: AbstractStreamingSyncImplementationOptions); - // (undocumented) - protected abortController: AbortController | null; - // (undocumented) - connect(options?: PowerSyncConnectionOptions): Promise; - // (undocumented) - protected crudUpdateListener?: () => void; - // (undocumented) - disconnect(): Promise; - // (undocumented) - dispose(): Promise; - // (undocumented) - getWriteCheckpoint(): Promise; - // (undocumented) - get isConnected(): boolean; - // (undocumented) - get lastSyncedAt(): Date | undefined; - // (undocumented) - protected logger: ILogger; - // (undocumented) - markConnectionMayHaveChanged(): void; - // (undocumented) - abstract obtainLock(lockOptions: LockOptions_2): Promise; - // (undocumented) - protected options: AbstractStreamingSyncImplementationOptions; - // Warning: (ae-forgotten-export) The symbol "RustIterationResult" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected streamingSyncIteration( - signal: AbortSignal, - options?: PowerSyncConnectionOptions - ): Promise; - // (undocumented) - protected streamingSyncPromise?: Promise<[void, void]>; - // (undocumented) - syncStatus: SyncStatus; - // (undocumented) - triggerCrudUpload(): void; - // (undocumented) - updateSubscriptions(subscriptions: SubscribedStream[]): void; - // (undocumented) - protected updateSyncStatus(options: SyncStatusOptions): void; - // (undocumented) - waitForReady(): Promise; - // (undocumented) - waitForStatus(status: SyncStatusOptions): Promise; - // (undocumented) - waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AbstractStreamingSyncImplementationOptions extends RequiredAdditionalConnectionOptions { - // (undocumented) - adapter: BucketStorageAdapter; - identifier?: string; - // (undocumented) - logger?: ILogger; - // (undocumented) - remote: AbstractRemote; - // (undocumented) - subscriptions: SubscribedStream[]; - // (undocumented) - uploadCrud: () => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AdditionalConnectionOptions { - crudUploadThrottleMs?: number; - retryDelayMs?: number; -} - -// @public -export class ArrayComparator implements WatchedQueryComparator { - constructor(options: ArrayComparatorOptions); - // (undocumented) - checkEquality(current: ItemType[], previous: ItemType[]): boolean; - // (undocumented) - protected options: ArrayComparatorOptions; -} - -// @public -export type ArrayComparatorOptions = { - compareBy: (item: ItemType) => string; -}; - -// @public -export interface ArrayQueryDefinition { - mapper?: (row: Record) => RowType; - // (undocumented) - parameters?: ReadonlyArray>; - // (undocumented) - sql: string; -} - -// @alpha -export const ATTACHMENT_TABLE = 'attachments'; - -// @alpha -export class AttachmentContext { - constructor( - db: AbstractPowerSyncDatabase, - tableName: string | undefined, - logger: ILogger, - archivedCacheLimit: number - ); - readonly archivedCacheLimit: number; - // (undocumented) - clearQueue(): Promise; - readonly db: AbstractPowerSyncDatabase; - // (undocumented) - deleteArchivedAttachments(callback?: (attachments: AttachmentRecord[]) => Promise): Promise; - deleteAttachment(attachmentId: string): Promise; - getActiveAttachments(): Promise; - getArchivedAttachments(): Promise; - // (undocumented) - getAttachment(id: string): Promise; - getAttachments(): Promise; - readonly logger: ILogger; - saveAttachments(attachments: AttachmentRecord[]): Promise; - readonly tableName: string; - upsertAttachment(attachment: AttachmentRecord, context: Transaction): Promise; -} - -// @alpha (undocumented) -export type AttachmentData = ArrayBuffer | string; - -// @alpha -export interface AttachmentErrorHandler { - onDeleteError(attachment: AttachmentRecord, error: unknown): Promise; - onDownloadError(attachment: AttachmentRecord, error: unknown): Promise; - onUploadError(attachment: AttachmentRecord, error: unknown): Promise; -} - -// @alpha -export function attachmentFromSql(row: any): AttachmentRecord; - -// @alpha -export class AttachmentQueue implements AttachmentQueue { - constructor(input: { - db: AbstractPowerSyncDatabase; - remoteStorage: RemoteStorageAdapter; - localStorage: LocalStorageAdapter; - watchAttachments: (onUpdate: (attachment: WatchedAttachmentItem[]) => Promise, signal: AbortSignal) => void; - tableName?: string; - logger?: ILogger; - syncIntervalMs?: number; - syncThrottleDuration?: number; - downloadAttachments?: boolean; - archivedCacheLimit?: number; - errorHandler?: AttachmentErrorHandler; - }); - readonly archivedCacheLimit: number; - // (undocumented) - clearQueue(): Promise; - // (undocumented) - deleteFile(input: { - id: string; - updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; - }): Promise; - readonly downloadAttachments: boolean; - // (undocumented) - expireCache(): Promise; - generateAttachmentId(): Promise; - readonly localStorage: LocalStorageAdapter; - readonly logger: ILogger; - readonly remoteStorage: RemoteStorageAdapter; - saveFile(input: { - data: AttachmentData; - fileExtension: string; - mediaType?: string; - metaData?: string; - id?: string; - updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; - }): Promise; - startSync(): Promise; - stopSync(): Promise; - readonly syncIntervalMs: number; - syncStorage(): Promise; - readonly syncThrottleDuration: number; - readonly tableName: string; - verifyAttachments(): Promise; - withAttachmentContext(callback: (context: AttachmentContext) => Promise): Promise; -} - -// @alpha -export interface AttachmentRecord { - // (undocumented) - filename: string; - // (undocumented) - hasSynced?: boolean; - // (undocumented) - id: string; - // (undocumented) - localUri?: string; - // (undocumented) - mediaType?: string; - // (undocumented) - metaData?: string; - // (undocumented) - size?: number; - // (undocumented) - state: AttachmentState; - // (undocumented) - timestamp?: number; -} - -// Warning: (ae-internal-missing-underscore) The name "AttachmentService" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class AttachmentService { - constructor(db: AbstractPowerSyncDatabase, logger: ILogger, tableName?: string, archivedCacheLimit?: number); - watchActiveAttachments(input?: { throttleMs?: number }): DifferentialWatchedQuery; - withContext(callback: (context: AttachmentContext) => Promise): Promise; -} - -// @alpha -export enum AttachmentState { - // (undocumented) - ARCHIVED = 4, // Attachment to be uploaded - // (undocumented) - QUEUED_DELETE = 2, // Attachment to be downloaded - // (undocumented) - QUEUED_DOWNLOAD = 1, // Attachment to be deleted - // (undocumented) - QUEUED_UPLOAD = 0, // Attachment has been synced - // (undocumented) - SYNCED = 3 -} - -// @alpha -export class AttachmentTable extends Table { - constructor(options?: AttachmentTableOptions); -} - -// @alpha (undocumented) -export interface AttachmentTableOptions extends Omit {} - -// @public (undocumented) -export type BaseColumnType = { - type: ColumnType; -}; - -// @public (undocumented) -export interface BaseConnectionOptions { - appMetadata?: Record; - // @deprecated (undocumented) - clientImplementation?: SyncClientImplementation; - connectionMethod?: SyncStreamConnectionMethod; - fetchStrategy?: FetchStrategy; - includeDefaultStreams?: boolean; - params?: Record; - serializedSchema?: any; -} - -// @public (undocumented) -export type BaseListener = Record any) | undefined>; - -// Warning: (ae-internal-missing-underscore) The name "BaseObserver" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class BaseObserver implements BaseObserverInterface { - constructor(); - // (undocumented) - dispose(): void; - // (undocumented) - iterateAsyncListeners(cb: (listener: Partial) => Promise): Promise; - // (undocumented) - iterateListeners(cb: (listener: Partial) => any): void; - // (undocumented) - protected listeners: Set>; - registerListener(listener: Partial): () => void; -} - -// @public (undocumented) -export interface BaseObserverInterface { - // (undocumented) - registerListener(listener: Partial): () => void; -} - -// Warning: (ae-incompatible-release-tags) The symbol "BasePowerSyncDatabaseOptions" is marked as @public, but its signature references "AdditionalConnectionOptions" which is marked as @internal -// -// @public (undocumented) -export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions { - // (undocumented) - logger?: ILogger; - // @deprecated (undocumented) - retryDelay?: number; - schema: Schema; -} - -// @alpha -export interface BaseTriggerDiffRecord { - id: string; - operation: DiffTriggerOperation; - operation_id: TOperationId; - timestamp: string; -} - -// @public (undocumented) -export interface BatchedUpdateNotification { - // (undocumented) - groupedUpdates: Record; - // (undocumented) - rawUpdates: UpdateNotification[]; - // (undocumented) - tables: string[]; -} - -// Warning: (ae-internal-missing-underscore) The name "BucketStorageAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface BucketStorageAdapter extends BaseObserverInterface, Disposable_2 { - control(op: PowerSyncControlCommand, payload: string | Uint8Array | null): Promise; - getClientId(): Promise; - // (undocumented) - getCrudBatch(limit?: number): Promise; - // (undocumented) - getMaxOpId(): string; - // (undocumented) - hasCrud(): Promise; - // (undocumented) - hasMigratedSubkeys(): Promise; - // (undocumented) - init(): Promise; - // (undocumented) - migrateToFixedSubkeys(): Promise; - // (undocumented) - nextCrudItem(): Promise; - // (undocumented) - updateLocalTarget(cb: () => Promise): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "BucketStorageListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface BucketStorageListener extends BaseListener { - // (undocumented) - crudUpdate: () => void; -} - -// @public (undocumented) -export class Column { - constructor(options: ColumnOptions); - // (undocumented) - get name(): string; - // (undocumented) - protected options: ColumnOptions; - // (undocumented) - toJSON(): { - name: string; - type: ColumnType | undefined; - }; - // (undocumented) - get type(): ColumnType | undefined; -} - -// @public (undocumented) -export const column: { - text: BaseColumnType; - integer: BaseColumnType; - real: BaseColumnType; -}; - -// @public (undocumented) -export interface ColumnOptions { - // (undocumented) - name: string; - // (undocumented) - type?: ColumnType; -} - -// @public (undocumented) -export type ColumnsType = Record>; - -// @public (undocumented) -export enum ColumnType { - // (undocumented) - INTEGER = 'INTEGER', - // (undocumented) - REAL = 'REAL', - // (undocumented) - TEXT = 'TEXT' -} - -// @public (undocumented) -export interface CompilableQuery { - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(): Promise; -} - -// @public (undocumented) -export function compilableQueryWatch( - db: AbstractPowerSyncDatabase, - query: CompilableQuery, - handler: CompilableQueryWatchHandler, - options?: SQLWatchOptions -): void; - -// @public (undocumented) -export interface CompilableQueryWatchHandler { - // (undocumented) - onError?: (error: Error) => void; - // (undocumented) - onResult: (results: T[]) => void; -} - -// @public (undocumented) -export interface CompiledQuery { - // (undocumented) - readonly parameters: ReadonlyArray; - // (undocumented) - readonly sql: string; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionClosedError" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class ConnectionClosedError extends Error { - constructor(message: string); - // (undocumented) - static MATCHES(input: any): boolean; - // (undocumented) - static NAME: string; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManager" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class ConnectionManager extends BaseObserver { - constructor(options: ConnectionManagerOptions); - get activeStreams(): { - name: string; - params: Record | null; - }[]; - // (undocumented) - close(): Promise; - // (undocumented) - connect(connector: PowerSyncBackendConnector, options: InternalConnectionOptions): Promise; - protected connectingPromise: Promise | null; - // (undocumented) - protected connectInternal(): Promise; - // (undocumented) - get connectionOptions(): InternalConnectionOptions | null; - // (undocumented) - get connector(): PowerSyncBackendConnector | null; - disconnect(): Promise; - protected disconnectingPromise: Promise | null; - // (undocumented) - protected disconnectInternal(): Promise; - // (undocumented) - get logger(): ILogger; - // (undocumented) - protected options: ConnectionManagerOptions; - // Warning: (ae-forgotten-export) The symbol "StoredConnectionOptions" needs to be exported by the entry point index.d.ts - protected pendingConnectionOptions: StoredConnectionOptions | null; - // (undocumented) - protected performDisconnect(): Promise; - // (undocumented) - stream(adapter: InternalSubscriptionAdapter, name: string, parameters: Record | null): SyncStream; - protected syncDisposer: (() => Promise | void) | null; - // (undocumented) - syncStreamImplementation: StreamingSyncImplementation | null; - protected syncStreamInitPromise: Promise | null; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerListener extends BaseListener { - // (undocumented) - syncStreamCreated: (sync: StreamingSyncImplementation) => void; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerOptions { - // (undocumented) - createSyncImplementation( - connector: PowerSyncBackendConnector, - options: CreateSyncImplementationOptions - ): Promise; - // (undocumented) - logger: ILogger; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerSyncImplementationResult" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerSyncImplementationResult { - onDispose: () => Promise | void; - // (undocumented) - sync: StreamingSyncImplementation; -} - -// @public (undocumented) -export interface ConnectionPool extends BaseObserverInterface { - // (undocumented) - close: () => void | Promise; - // (undocumented) - name: string; - // (undocumented) - readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - refreshSchema: () => Promise; - // (undocumented) - writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "ControlledExecutor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class ControlledExecutor { - constructor(task: (param: T) => Promise | void, options?: ControlledExecutorOptions); - // (undocumented) - dispose(): void; - // (undocumented) - schedule(param: T): void; -} - -// Warning: (ae-internal-missing-underscore) The name "ControlledExecutorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ControlledExecutorOptions { - throttleEnabled?: boolean; -} - -// @public -export function createBaseLogger(): typeof Logger; - -// Warning: (ae-forgotten-export) The symbol "BaseCreateDiffTriggerOptions" needs to be exported by the entry point index.d.ts -// -// @alpha -export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions { - destination: string; - setupContext?: LockContext; -} - -// @public -export function createLogger(name: string, options?: CreateLoggerOptions): ILogger; - -// @public (undocumented) -export interface CreateLoggerOptions { - // (undocumented) - logLevel?: ILogLevel; -} - -// Warning: (ae-internal-missing-underscore) The name "CreateSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export interface CreateSyncImplementationOptions extends AdditionalConnectionOptions { - // (undocumented) - subscriptions: SubscribedStream[]; -} - -// @public -export class CrudBatch { - constructor(crud: CrudEntry[], haveMore: boolean, complete: (writeCheckpoint?: string) => Promise); - complete: (writeCheckpoint?: string) => Promise; - crud: CrudEntry[]; - haveMore: boolean; -} - -// @public -export class CrudEntry { - constructor( - clientId: number, - op: UpdateType, - table: string, - id: string, - transactionId?: number, - opData?: Record, - previousValues?: Record, - metadata?: string - ); - clientId: number; - // (undocumented) - equals(entry: CrudEntry): boolean; - // Warning: (ae-forgotten-export) The symbol "CrudEntryJSON" needs to be exported by the entry point index.d.ts - // - // (undocumented) - static fromRow(dbRow: CrudEntryJSON): CrudEntry; - // @deprecated - hashCode(): string; - id: string; - metadata?: string; - op: UpdateType; - opData?: Record; - previousValues?: Record; - table: string; - toComparisonArray(): (string | number | Record | undefined)[]; - // Warning: (ae-forgotten-export) The symbol "CrudEntryOutputJSON" needs to be exported by the entry point index.d.ts - toJSON(): CrudEntryOutputJSON; - transactionId?: number; -} - -// @public (undocumented) -export class CrudTransaction extends CrudBatch { - constructor(crud: CrudEntry[], complete: (checkpoint?: string) => Promise, transactionId?: number | undefined); - complete: (checkpoint?: string) => Promise; - crud: CrudEntry[]; - transactionId?: number | undefined; -} - -// @public (undocumented) -export interface DBAdapter extends ConnectionPool, SqlExecutor, DBGetUtils { - // (undocumented) - readTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; - // (undocumented) - writeTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "DBAdapterDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function DBAdapterDefaultMixin ConnectionPool>( - Base: TBase -): { - new (...args: any[]): { - readTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; - writeTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - get(sql: string, parameters?: any[]): Promise; - execute(query: string, params?: any[]): Promise; - executeRaw(query: string, params?: any[]): Promise; - executeBatch(query: string, params?: any[][]): Promise; - name: string; - close: () => void | Promise; - readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - refreshSchema: () => Promise; - registerListener(listener: Partial): () => void; - }; -} & TBase; - -// @public (undocumented) -export interface DBAdapterListener extends BaseListener { - tablesUpdated: (updateNotification: BatchedUpdateNotification | UpdateNotification) => void; -} - -// @public (undocumented) -export interface DBGetUtils { - get(sql: string, parameters?: any[]): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "DBGetUtilsDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function DBGetUtilsDefaultMixin Omit>( - Base: TBase -): { - new (...args: any[]): { - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - get(sql: string, parameters?: any[]): Promise; - executeBatch(query: string, params?: any[][]): Promise; - execute: (query: string, params?: any[] | undefined) => Promise; - executeRaw: (query: string, params?: any[] | undefined) => Promise; - }; -} & TBase; - -// @public (undocumented) -export interface DBLockOptions { - // (undocumented) - timeoutMs?: number; -} - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_BATCH_LIMIT" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_CRUD_BATCH_LIMIT = 100; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_UPLOAD_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_COLUMN_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_INDEX_COLUMN_OPTIONS: Partial; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_INDEX_OPTIONS: Partial; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_LOCK_TIMEOUT_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const DEFAULT_LOCK_TIMEOUT_MS = 120000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_CLOSE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_DB_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_POWERSYNC_DB_OPTIONS: { - retryDelayMs: number; - crudUploadThrottleMs: number; -}; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_LOGGER" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_REMOTE_LOGGER: Logger.ILogger; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_RETRY_DELAY_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_RETRY_DELAY_MS = 5000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_ROW_COMPARATOR" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const DEFAULT_ROW_COMPARATOR: DifferentialWatchedQueryComparator; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAM_CONNECTION_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAMING_SYNC_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_STREAMING_SYNC_OPTIONS: { - retryDelayMs: number; - crudUploadThrottleMs: number; -}; - -// @public @deprecated -export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_TABLE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_TABLE_OPTIONS: { - indexes: never[]; - insertOnly: boolean; - localOnly: boolean; - trackPrevious: boolean; - trackMetadata: boolean; - ignoreEmptyUpdates: boolean; -}; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_QUERY_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_WATCH_QUERY_OPTIONS: WatchedQueryOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_WATCH_THROTTLE_MS = 30; - -// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class DifferentialQueryProcessor - extends AbstractQueryProcessor>, DifferentialWatchedQuerySettings> - implements DifferentialWatchedQuery -{ - constructor(options: DifferentialQueryProcessorOptions); - // (undocumented) - protected comparator: DifferentialWatchedQueryComparator; - // Warning: (ae-forgotten-export) The symbol "DataHashMap" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected differentiate( - current: RowType[], - previousMap: DataHashMap - ): { - diff: WatchedQueryDifferential; - map: DataHashMap; - hasChanged: boolean; - }; - // (undocumented) - protected linkQuery(options: LinkQueryOptions>): Promise; - // (undocumented) - protected options: DifferentialQueryProcessorOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface DifferentialQueryProcessorOptions extends AbstractQueryProcessorOptions< - RowType[], - DifferentialWatchedQuerySettings -> { - // (undocumented) - rowComparator?: DifferentialWatchedQueryComparator; -} - -// @public (undocumented) -export type DifferentialWatchedQuery = WatchedQuery< - ReadonlyArray>, - DifferentialWatchedQuerySettings, - DifferentialWatchedQueryListener ->; - -// @public -export interface DifferentialWatchedQueryComparator { - compareBy: (item: RowType) => string; - keyBy: (item: RowType) => string; -} - -// @public (undocumented) -export interface DifferentialWatchedQueryListener extends WatchedQueryListener< - ReadonlyArray> -> { - // (undocumented) - onDiff?: (diff: WatchedQueryDifferential) => void | Promise; -} - -// @public -export interface DifferentialWatchedQueryOptions extends WatchedQueryOptions { - placeholderData?: RowType[]; - rowComparator?: DifferentialWatchedQueryComparator; -} - -// @public -export interface DifferentialWatchedQuerySettings extends DifferentialWatchedQueryOptions { - query: WatchCompatibleQuery; -} - -// @alpha -export enum DiffTriggerOperation { - // (undocumented) - DELETE = 'DELETE', - // (undocumented) - INSERT = 'INSERT', - // (undocumented) - UPDATE = 'UPDATE' -} - -// @public (undocumented) -export interface DisconnectAndClearOptions { - clearLocal?: boolean; -} - -// @public (undocumented) -interface Disposable_2 { - // (undocumented) - dispose: () => Promise | void; -} -export { Disposable_2 as Disposable }; - -// Warning: (ae-internal-missing-underscore) The name "EMPTY_DIFFERENTIAL" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const EMPTY_DIFFERENTIAL: { - added: never[]; - all: never[]; - removed: never[]; - updated: never[]; - unchanged: never[]; -}; - -// @alpha (undocumented) -export enum EncodingType { - // (undocumented) - Base64 = 'base64', - // (undocumented) - UTF8 = 'utf8' -} - -// @public (undocumented) -export type ExtractColumnValueType> = T extends BaseColumnType ? R : unknown; - -// @alpha -export type ExtractedTriggerDiffRecord = T & { - [K in keyof Omit, 'id'> as `__${string & K}`]: TriggerDiffRecord[K]; -} & { - __previous_value?: string; -}; - -// Warning: (ae-internal-missing-underscore) The name "extractTableUpdates" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function extractTableUpdates(update: BatchedUpdateNotification | UpdateNotification): string[]; - -// @public -export const FalsyComparator: WatchedQueryComparator; - -// Warning: (ae-internal-missing-underscore) The name "FetchImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type FetchImplementation = typeof fetch_2; - -// Warning: (ae-internal-missing-underscore) The name "FetchImplementationProvider" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class FetchImplementationProvider { - // (undocumented) - getFetch(): FetchImplementation; -} - -// @public (undocumented) -export enum FetchStrategy { - Buffered = 'buffered', - Sequential = 'sequential' -} - -// @public -export class GetAllQuery implements WatchCompatibleQuery { - constructor(options: GetAllQueryOptions); - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(options: { db: AbstractPowerSyncDatabase }): Promise; - // (undocumented) - protected options: GetAllQueryOptions; -} - -// @public -export type GetAllQueryOptions = { - sql: string; - parameters?: ReadonlyArray; - mapper?: (rawRow: Record) => RowType; -}; - -export { GlobalLogger }; - -export { ILogger }; - -export { ILoggerOpts }; - -export { ILogHandler }; - -export { ILogLevel }; - -// @public (undocumented) -export class Index { - constructor(options: IndexOptions); - // (undocumented) - get columns(): IndexedColumn[]; - // (undocumented) - static createAscending(options: IndexOptions, columnNames: string[]): Index; - // (undocumented) - get name(): string; - // (undocumented) - protected options: IndexOptions; - // (undocumented) - toJSON(table: Table): { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }; -} - -// @public (undocumented) -export interface IndexColumnOptions { - // (undocumented) - ascending?: boolean; - // (undocumented) - name: string; -} - -// @public (undocumented) -export class IndexedColumn { - constructor(options: IndexColumnOptions); - // (undocumented) - get ascending(): boolean | undefined; - // (undocumented) - static createAscending(column: string): IndexedColumn; - // (undocumented) - get name(): string; - // (undocumented) - protected options: IndexColumnOptions; - // (undocumented) - toJSON(table: Table): { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }; -} - -// @public (undocumented) -export interface IndexOptions { - // (undocumented) - columns?: IndexedColumn[]; - // (undocumented) - name: string; -} - -// @public (undocumented) -export type IndexShorthand = Record; - -// Warning: (ae-internal-missing-underscore) The name "InternalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions {} - -// Warning: (ae-internal-missing-underscore) The name "InternalSubscriptionAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface InternalSubscriptionAdapter { - // (undocumented) - firstStatusMatching(predicate: (status: SyncStatus) => any, abort?: AbortSignal): Promise; - // (undocumented) - resolveOfflineSyncStatus(): Promise; - // (undocumented) - rustSubscriptionsCommand(payload: any): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "InvalidSQLCharacters" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const InvalidSQLCharacters: RegExp; - -// Warning: (ae-internal-missing-underscore) The name "isBatchedUpdateNotification" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function isBatchedUpdateNotification( - update: BatchedUpdateNotification | UpdateNotification -): update is BatchedUpdateNotification; - -// Warning: (ae-internal-missing-underscore) The name "isDBAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isDBAdapter: (test: any) => test is DBAdapter; - -// Warning: (ae-internal-missing-underscore) The name "isPowerSyncDatabaseOptionsWithSettings" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isPowerSyncDatabaseOptionsWithSettings: (test: any) => test is PowerSyncDatabaseOptionsWithSettings; - -// Warning: (ae-internal-missing-underscore) The name "isSQLOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isSQLOpenFactory: (test: any) => test is SQLOpenFactory; - -// Warning: (ae-internal-missing-underscore) The name "isSQLOpenOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isSQLOpenOptions: (test: any) => test is SQLOpenOptions; - -// Warning: (ae-internal-missing-underscore) The name "LinkQueryOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface LinkQueryOptions { - // (undocumented) - abortSignal: AbortSignal; - // (undocumented) - settings: Settings; -} - -// @alpha -export interface LocalStorageAdapter { - clear(): Promise; - deleteFile(filePath: string): Promise; - fileExists(filePath: string): Promise; - getLocalUri(filename: string): string; - initialize(): Promise; - makeDir(path: string): Promise; - readFile(filePath: string): Promise; - rmDir(path: string): Promise; - saveFile(filePath: string, data: AttachmentData): Promise; -} - -// @public (undocumented) -export interface LockContext extends SqlExecutor, DBGetUtils { - connectionType?: 'writer' | 'queryOnly' | 'readOnly'; -} - -// @internal -interface LockOptions_2 { - // (undocumented) - callback: () => Promise; - // (undocumented) - signal?: AbortSignal; - // (undocumented) - type: LockType; -} - -// Warning: (ae-internal-missing-underscore) The name "LockOptions" should be prefixed with an underscore because the declaration is marked as @internal -export { LockOptions_2 as LockOptions }; - -// Warning: (ae-internal-missing-underscore) The name "LockType" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum LockType { - // (undocumented) - CRUD = 'crud', - // (undocumented) - SYNC = 'sync' -} - -// @public (undocumented) -export const LogLevel: { - TRACE: Logger.ILogLevel; - DEBUG: Logger.ILogLevel; - INFO: Logger.ILogLevel; - TIME: Logger.ILogLevel; - WARN: Logger.ILogLevel; - ERROR: Logger.ILogLevel; - OFF: Logger.ILogLevel; -}; - -// Warning: (ae-internal-missing-underscore) The name "MAX_AMOUNT_OF_COLUMNS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const MAX_AMOUNT_OF_COLUMNS = 1999; - -// Warning: (ae-internal-missing-underscore) The name "MAX_OP_ID" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const MAX_OP_ID = '9223372036854775807'; - -// Warning: (ae-internal-missing-underscore) The name "MEMORY_TRIGGER_CLAIM_MANAGER" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const MEMORY_TRIGGER_CLAIM_MANAGER: TriggerClaimManager; - -// Warning: (ae-forgotten-export) The symbol "MutableDeep" needs to be exported by the entry point index.d.ts -// Warning: (ae-internal-missing-underscore) The name "MutableWatchedQueryState" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export type MutableWatchedQueryState = { - -readonly [P in keyof WatchedQueryState]: MutableDeep[P]>; -}; - -// Warning: (ae-internal-missing-underscore) The name "Mutex" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class Mutex { - // (undocumented) - acquire(abort?: AbortSignal): Promise; - // (undocumented) - runExclusive(fn: () => PromiseLike | T, abort?: AbortSignal): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class OnChangeQueryProcessor extends AbstractQueryProcessor> { - constructor(options: OnChangeQueryProcessorOptions); - // (undocumented) - protected checkEquality(current: Data, previous: Data): boolean; - // (undocumented) - protected linkQuery(options: LinkQueryOptions): Promise; - // (undocumented) - protected options: OnChangeQueryProcessorOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface OnChangeQueryProcessorOptions extends AbstractQueryProcessorOptions< - Data, - WatchedQuerySettings -> { - // (undocumented) - comparator?: WatchedQueryComparator; -} - -// @public -export type OpId = string; - -// Warning: (ae-internal-missing-underscore) The name "ParsedQuery" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ParsedQuery { - // (undocumented) - parameters: any[]; - // (undocumented) - sqlStatement: string; -} - -// Warning: (ae-internal-missing-underscore) The name "parseQuery" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const parseQuery: (query: string | CompilableQuery, parameters: any[]) => ParsedQuery; - -// @public -export type PendingStatement = { - sql: string; - params: PendingStatementParameter[]; -}; - -// @public -export type PendingStatementParameter = - | 'Id' - | { - Column: string; - } - | 'Rest'; - -// @public (undocumented) -export interface PowerSyncBackendConnector { - fetchCredentials: () => Promise; - uploadData: (database: AbstractPowerSyncDatabase) => Promise; -} - -// @public (undocumented) -export interface PowerSyncCloseOptions { - disconnect?: boolean; -} - -// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncConnectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal -// -// @public -export type PowerSyncConnectionOptions = Omit; - -// Warning: (ae-internal-missing-underscore) The name "PowerSyncControlCommand" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum PowerSyncControlCommand { - CONNECTION_STATE = 'connection', - // (undocumented) - NOTIFY_CRUD_UPLOAD_COMPLETED = 'completed_upload', - // (undocumented) - NOTIFY_TOKEN_REFRESHED = 'refreshed_token', - // (undocumented) - PROCESS_BSON_LINE = 'line_binary', - // (undocumented) - PROCESS_TEXT_LINE = 'line_text', - // (undocumented) - START = 'start', - // (undocumented) - STOP = 'stop', - // (undocumented) - UPDATE_SUBSCRIPTIONS = 'update_subscriptions' -} - -// @public (undocumented) -export interface PowerSyncCredentials { - // (undocumented) - endpoint: string; - // (undocumented) - expiresAt?: Date; - // (undocumented) - token: string; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions { - database: DBAdapter | SQLOpenFactory | SQLOpenOptions; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithDBAdapter extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: DBAdapter; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithOpenFactory extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: SQLOpenFactory; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithSettings extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: SQLOpenOptions; -} - -// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncDBListener" is marked as @public, but its signature references "StreamingSyncImplementationListener" which is marked as @internal -// -// @public (undocumented) -export interface PowerSyncDBListener extends StreamingSyncImplementationListener { - // (undocumented) - closed: () => Promise | void; - // (undocumented) - closing: () => Promise | void; - // (undocumented) - initialized: () => void; - // (undocumented) - schemaChanged: (schema: Schema) => void; -} - -// Warning: (ae-internal-missing-underscore) The name "PowerSyncOpenFactoryOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface PowerSyncOpenFactoryOptions extends Partial, SQLOpenOptions { - schema: Schema; -} - -// @public -export interface ProgressWithOperations { - downloadedFraction: number; - downloadedOperations: number; - totalOperations: number; -} - -// Warning: (ae-internal-missing-underscore) The name "PSInternalTable" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum PSInternalTable { - // (undocumented) - BUCKETS = 'ps_buckets', - // (undocumented) - CRUD = 'ps_crud', - // (undocumented) - DATA = 'ps_data', - // (undocumented) - OPLOG = 'ps_oplog', - // (undocumented) - UNTYPED = 'ps_untyped' -} - -// @public (undocumented) -export interface Query { - differentialWatch(options?: DifferentialWatchedQueryOptions): DifferentialWatchedQuery; - watch(options?: StandardWatchedQueryOptions): StandardWatchedQuery>>; -} - -// @public -export type QueryParam = string | number | boolean | null | undefined | bigint | Uint8Array; - -// @public -export type QueryResult = { - insertId?: number; - rowsAffected: number; - rows?: { - _array: any[]; - length: number; - item: (idx: number) => any; - }; -}; - -// Warning: (ae-forgotten-export) The symbol "RawTableTypeWithStatements" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "InferredRawTableType" needs to be exported by the entry point index.d.ts -// -// @public -export type RawTableType = RawTableTypeWithStatements | InferredRawTableType; - -// Warning: (ae-internal-missing-underscore) The name "RemoteConnector" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type RemoteConnector = { - fetchCredentials: () => Promise; - invalidateCredentials?: () => void; -}; - -// @alpha -export interface RemoteStorageAdapter { - deleteFile(attachment: AttachmentRecord): Promise; - downloadFile(attachment: AttachmentRecord): Promise; - uploadFile(fileData: ArrayBuffer, attachment: AttachmentRecord): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "RequiredAdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface RequiredAdditionalConnectionOptions extends Required { - // (undocumented) - subscriptions: SubscribedStream[]; -} - -// Warning: (ae-internal-missing-underscore) The name "RequiredPowerSyncConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type RequiredPowerSyncConnectionOptions = Required; - -// @public (undocumented) -export type RowType> = { - [K in keyof T['columnMap']]: ExtractColumnValueType; -} & { - id: string; -}; - -// @public -export enum RowUpdateType { - // (undocumented) - SQLITE_DELETE = 9, - // (undocumented) - SQLITE_INSERT = 18, - // (undocumented) - SQLITE_UPDATE = 23 -} - -// Warning: (ae-internal-missing-underscore) The name "runOnSchemaChange" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function runOnSchemaChange( - callback: (signal: AbortSignal) => void, - db: AbstractPowerSyncDatabase, - options?: SQLWatchOptions -): void; - -// @alpha -export function sanitizeSQL(strings: TemplateStringsArray, ...values: any[]): string; - -// @alpha -export function sanitizeUUID(uuid: string): string; - -// Warning: (ae-forgotten-export) The symbol "SchemaType" needs to be exported by the entry point index.d.ts -// -// @public -export class Schema { - constructor(tables: Table[] | S); - // (undocumented) - readonly props: S; - // Warning: (ae-forgotten-export) The symbol "RawTable" needs to be exported by the entry point index.d.ts - // - // (undocumented) - readonly rawTables: RawTable[]; - static rawTableToJson(table: RawTable): unknown; - // (undocumented) - readonly tables: Table[]; - // (undocumented) - toJSON(): { - tables: { - local_only: boolean | undefined; - insert_only: boolean | undefined; - include_old: any; - include_old_only_when_changed: boolean; - include_metadata: boolean | undefined; - ignore_empty_update: boolean | undefined; - name: string; - view_name: string; - columns: { - name: string; - type: ColumnType | undefined; - }[]; - indexes: { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }[]; - }[]; - raw_tables: unknown[]; - }; - // (undocumented) - readonly types: SchemaTableType; - // (undocumented) - validate(): void; - withRawTables(tables: Record): void; -} - -// @public (undocumented) -export type SchemaTableType = { - [K in keyof S]: RowType; -}; - -// Warning: (ae-internal-missing-underscore) The name "Semaphore" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class Semaphore { - constructor(elements: Iterable); - requestAll(abort?: AbortSignal): Promise<{ - items: T[]; - release: UnlockFn; - }>; - requestOne(abort?: AbortSignal): Promise<{ - item: T; - release: UnlockFn; - }>; - // (undocumented) - readonly size: number; -} - -// Warning: (ae-internal-missing-underscore) The name "SimpleAsyncIterator" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export type SimpleAsyncIterator = Pick, 'next'>; - -// Warning: (ae-internal-missing-underscore) The name "SocketSyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SocketSyncStreamOptions = SyncStreamOptions & { - fetchStrategy: FetchStrategy; -}; - -// @public (undocumented) -export interface SqlExecutor { - execute: (query: string, params?: any[] | undefined) => Promise; - // (undocumented) - executeBatch: (query: string, params?: any[][]) => Promise; - executeRaw: (query: string, params?: any[] | undefined) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "SqliteBucketStorage" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class SqliteBucketStorage extends BaseObserver implements BucketStorageAdapter { - constructor(db: DBAdapter, logger?: ILogger); - // (undocumented) - control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise; - // (undocumented) - dispose(): Promise; - // (undocumented) - getClientId(): Promise; - // (undocumented) - _getClientId(): Promise; - getCrudBatch(limit?: number): Promise; - // (undocumented) - getMaxOpId(): string; - // (undocumented) - hasCrud(): Promise; - // (undocumented) - hasMigratedSubkeys(): Promise; - // (undocumented) - init(): Promise; - // (undocumented) - migrateToFixedSubkeys(): Promise; - // (undocumented) - nextCrudItem(): Promise; - // (undocumented) - static _subkeyMigrationKey: string; - // (undocumented) - tableNames: Set; - // (undocumented) - updateLocalTarget(cb: () => Promise): Promise; - // (undocumented) - writeTransaction( - callback: (tx: Transaction) => Promise, - options?: { - timeoutMs: number; - } - ): Promise; -} - -// @public (undocumented) -export interface SQLOnChangeOptions { - // @deprecated (undocumented) - rawTableNames?: boolean; - // (undocumented) - signal?: AbortSignal; - // (undocumented) - tables?: string[]; - throttleMs?: number; - triggerImmediate?: boolean; -} - -// @public (undocumented) -export interface SQLOpenFactory { - openDB(): DBAdapter; -} - -// @public (undocumented) -export interface SQLOpenOptions { - dbFilename: string; - dbLocation?: string; - debugMode?: boolean; -} - -// @public (undocumented) -export interface SQLWatchOptions extends SQLOnChangeOptions { - comparator?: WatchedQueryComparator; -} - -// @public -export type StandardWatchedQuery = WatchedQuery>; - -// @public -export interface StandardWatchedQueryOptions extends WatchedQueryOptions { - comparator?: WatchedQueryComparator; - placeholderData?: RowType[]; -} - -// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface StreamingSyncImplementation - extends BaseObserverInterface, Disposable_2 { - connect(options?: InternalConnectionOptions): Promise; - disconnect(): Promise; - // (undocumented) - getWriteCheckpoint: () => Promise; - // (undocumented) - isConnected: boolean; - // (undocumented) - markConnectionMayHaveChanged(): void; - // (undocumented) - syncStatus: SyncStatus; - // (undocumented) - triggerCrudUpload: () => void; - // (undocumented) - updateSubscriptions(subscriptions: SubscribedStream[]): void; - // (undocumented) - waitForReady(): Promise; - // (undocumented) - waitForStatus(status: SyncStatusOptions): Promise; - // (undocumented) - waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementationListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface StreamingSyncImplementationListener extends BaseListener { - statusChanged?: ((status: SyncStatus) => void) | undefined; - statusUpdated?: ((statusUpdate: SyncStatusOptions) => void) | undefined; -} - -// Warning: (ae-forgotten-export) The symbol "JSONValue" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export type StreamingSyncRequestParameterType = JSONValue; - -// Warning: (ae-internal-missing-underscore) The name "SubscribedStream" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SubscribedStream = { - name: string; - params: Record | null; -}; - -// @public @deprecated (undocumented) -export enum SyncClientImplementation { - RUST = 'rust' -} - -// @public (undocumented) -export type SyncDataFlowStatus = Partial<{ - downloading: boolean; - uploading: boolean; - downloadError?: Error; - uploadError?: Error; - downloadProgress: InternalProgressInformation | null; - internalStreamSubscriptions: CoreStreamSubscription[] | null; -}>; - -// Warning: (ae-internal-missing-underscore) The name "SyncingService" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class SyncingService { - constructor( - attachmentService: AttachmentService, - localStorage: LocalStorageAdapter, - remoteStorage: RemoteStorageAdapter, - logger: ILogger, - errorHandler?: AttachmentErrorHandler - ); - deleteArchivedAttachments(context: AttachmentContext): Promise; - deleteAttachment(attachment: AttachmentRecord, context: AttachmentContext): Promise; - downloadAttachment(attachment: AttachmentRecord): Promise; - processAttachments(attachments: AttachmentRecord[], context: AttachmentContext): Promise; - uploadAttachment(attachment: AttachmentRecord): Promise; -} - -// @public (undocumented) -export interface SyncPriorityStatus { - // (undocumented) - hasSynced?: boolean; - // (undocumented) - lastSyncedAt?: Date; - // (undocumented) - priority: number; -} - -// @public -export class SyncProgress implements ProgressWithOperations { - constructor(internal: InternalProgressInformation); - // (undocumented) - downloadedFraction: number; - // (undocumented) - downloadedOperations: number; - // (undocumented) - protected internal: InternalProgressInformation; - // (undocumented) - totalOperations: number; - untilPriority(priority: number): ProgressWithOperations; -} - -// @public (undocumented) -export class SyncStatus { - // Warning: (ae-incompatible-release-tags) The symbol "__constructor" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - constructor(options: SyncStatusOptions); - // @deprecated - get clientImplementation(): SyncClientImplementation | undefined; - get connected(): boolean; - get connecting(): boolean; - get dataFlowStatus(): SyncDataFlowStatus; - get downloadProgress(): SyncProgress | null; - forStream(stream: SyncStreamDescription): SyncStreamStatus | undefined; - getMessage(): string; - get hasSynced(): boolean | undefined; - isEqual(status: SyncStatus): boolean; - get lastSyncedAt(): Date | undefined; - // Warning: (ae-incompatible-release-tags) The symbol "options" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - // - // (undocumented) - protected options: SyncStatusOptions; - get priorityStatusEntries(): SyncPriorityStatus[]; - protected serializeError(error?: Error): - | { - name: string; - message: string; - stack: string | undefined; - } - | undefined; - statusForPriority(priority: number): SyncPriorityStatus; - get syncStreams(): SyncStreamStatus[] | undefined; - // Warning: (ae-incompatible-release-tags) The symbol "toJSON" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - toJSON(): SyncStatusOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "SyncStatusOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SyncStatusOptions = { - connected?: boolean; - connecting?: boolean; - dataFlow?: SyncDataFlowStatus; - lastSyncedAt?: Date; - hasSynced?: boolean; - priorityStatusEntries?: SyncPriorityStatus[]; - clientImplementation?: SyncClientImplementation; -}; - -// @public -export interface SyncStream extends SyncStreamDescription { - subscribe(options?: SyncStreamSubscribeOptions): Promise; - unsubscribeAll(): Promise; -} - -// @public (undocumented) -export enum SyncStreamConnectionMethod { - // (undocumented) - HTTP = 'http', - // (undocumented) - WEB_SOCKET = 'web-socket' -} - -// @public -export interface SyncStreamDescription { - name: string; - parameters: Record | null; -} - -// Warning: (ae-internal-missing-underscore) The name "SyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SyncStreamOptions = { - path: string; - data: unknown; - headers?: Record; - abortSignal: AbortSignal; - fetchOptions?: Request; -}; - -// @public -export interface SyncStreamStatus { - // (undocumented) - priority: number | null; - // (undocumented) - progress: ProgressWithOperations | null; - // (undocumented) - subscription: SyncSubscriptionDescription; -} - -// @public (undocumented) -export interface SyncStreamSubscribeOptions { - priority?: 0 | 1 | 2 | 3; - ttl?: number; -} - -// @public (undocumented) -export interface SyncStreamSubscription extends SyncStreamDescription { - unsubscribe(): void; - waitForFirstSync(abort?: AbortSignal): Promise; -} - -// @public -export interface SyncSubscriptionDescription extends SyncStreamDescription { - // (undocumented) - active: boolean; - expiresAt: Date | null; - hasExplicitSubscription: boolean; - hasSynced: boolean; - isDefault: boolean; - lastSyncedAt: Date | null; -} - -// @public (undocumented) -export class Table { - constructor(columns: Columns, options?: TableV2Options); - // @deprecated - constructor(options: TableOptions); - // (undocumented) - get columnMap(): Columns; - // (undocumented) - get columns(): Column[]; - // (undocumented) - copyWithName(name: string): Table; - // (undocumented) - static createInsertOnly(options: TableOptions): Table; - // (undocumented) - static createLocalOnly(options: TableOptions): Table; - // @deprecated - static createTable(name: string, table: Table): Table; - // (undocumented) - get ignoreEmptyUpdates(): boolean; - // (undocumented) - get indexes(): Index[]; - // (undocumented) - get insertOnly(): boolean; - // (undocumented) - get internalName(): string; - // (undocumented) - get localOnly(): boolean; - // (undocumented) - protected _mappedColumns: Columns; - // (undocumented) - get name(): string; - // (undocumented) - protected options: TableOptions; - // (undocumented) - toJSON(): { - local_only: boolean | undefined; - insert_only: boolean | undefined; - include_old: any; - include_old_only_when_changed: boolean; - include_metadata: boolean | undefined; - ignore_empty_update: boolean | undefined; - name: string; - view_name: string; - columns: { - name: string; - type: ColumnType | undefined; - }[]; - indexes: { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }[]; - }; - // (undocumented) - get trackMetadata(): boolean; - // (undocumented) - get trackPrevious(): boolean | TrackPreviousOptions; - // (undocumented) - validate(): void; - // (undocumented) - get validName(): boolean; - // (undocumented) - get viewName(): string; - // (undocumented) - get viewNameOverride(): string | undefined; -} - -// Warning: (ae-forgotten-export) The symbol "SharedTableOptions" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export interface TableOptions extends SharedTableOptions { - // (undocumented) - columns: Column[]; - // (undocumented) - indexes?: Index[]; - name: string; -} - -// @public -export interface TableOrRawTableOptions { - // (undocumented) - ignoreEmptyUpdates?: boolean; - // (undocumented) - insertOnly?: boolean; - // (undocumented) - localOnly?: boolean; - // (undocumented) - trackMetadata?: boolean; - // (undocumented) - trackPrevious?: boolean | TrackPreviousOptions; -} - -// @public (undocumented) -export interface TableUpdateOperation { - // (undocumented) - opType: RowUpdateType; - // (undocumented) - rowId: number; -} - -// @public @deprecated -export class TableV2 extends Table {} - -// @public (undocumented) -export interface TableV2Options extends SharedTableOptions { - // (undocumented) - indexes?: IndexShorthand; -} - -// Warning: (ae-internal-missing-underscore) The name "timeoutSignal" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function timeoutSignal(timeout: number): AbortSignal; - -// @internal (undocumented) -export function timeoutSignal(timeout?: number): AbortSignal | undefined; - -// @alpha -export interface TrackDiffOptions extends BaseCreateDiffTriggerOptions { - onChange: (context: TriggerDiffHandlerContext) => Promise; - throttleMs?: number; -} - -// @public -export interface TrackPreviousOptions { - columns?: string[]; - onlyWhenChanged?: boolean; -} - -// @public (undocumented) -export interface Transaction extends LockContext { - commit: () => Promise; - rollback: () => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerClaimManager" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export interface TriggerClaimManager { - checkClaim: (identifier: string) => Promise; - obtainClaim: (identifier: string) => Promise<() => Promise>; -} - -// @alpha -export interface TriggerCreationHooks { - beforeCreate?: (context: LockContext) => Promise; -} - -// @alpha -export interface TriggerDiffDeleteRecord< - TOperationId extends string | number = number -> extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.DELETE; - value: string; -} - -// @alpha -export interface TriggerDiffHandlerContext extends LockContext { - destinationTable: string; - withDiff: (query: string, params?: ReadonlyArray>, options?: WithDiffOptions) => Promise; - withExtractedDiff: (query: string, params?: ReadonlyArray>) => Promise; -} - -// @alpha -export interface TriggerDiffInsertRecord< - TOperationId extends string | number = number -> extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.INSERT; - value: string; -} - -// @alpha -export type TriggerDiffRecord = - | TriggerDiffUpdateRecord - | TriggerDiffInsertRecord - | TriggerDiffDeleteRecord; - -// @alpha -export interface TriggerDiffUpdateRecord< - TOperationId extends string | number = number -> extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.UPDATE; - previous_value: string; - value: string; -} - -// @alpha (undocumented) -export interface TriggerManager { - createDiffTrigger(options: CreateDiffTriggerOptions): Promise; - trackTableDiff(options: TrackDiffOptions): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerManagerConfig" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface TriggerManagerConfig { - // (undocumented) - claimManager: TriggerClaimManager; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerManagerImpl" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class TriggerManagerImpl implements TriggerManager { - constructor(options: TriggerManagerImplOptions); - cleanupResources(): Promise; - // (undocumented) - protected cleanupTimeout: ReturnType | null; - // (undocumented) - createDiffTrigger( - options: CreateDiffTriggerOptions - ): Promise<(options?: TriggerRemoveCallbackOptions) => Promise>; - // (undocumented) - protected get db(): AbstractPowerSyncDatabase; - // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplConfiguration" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected defaultConfig: TriggerManagerImplConfiguration; - // (undocumented) - dispose(): void; - // (undocumented) - protected generateTriggerName(operation: DiffTriggerOperation, destinationTable: string, triggerId: string): string; - // (undocumented) - protected getUUID(ctx?: LockContext): Promise; - // (undocumented) - protected isDisposed: boolean; - // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplOptions" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected options: TriggerManagerImplOptions; - // (undocumented) - protected removeTriggers(tx: LockContext, triggerIds: string[]): Promise; - // (undocumented) - protected schema: Schema; - // (undocumented) - trackTableDiff(options: TrackDiffOptions): Promise; - updateDefaults(config: TriggerManagerImplConfiguration): void; -} - -// @alpha -export type TriggerRemoveCallback = (options?: TriggerRemoveCallbackOptions) => Promise; - -// @alpha -export interface TriggerRemoveCallbackOptions { - // (undocumented) - context?: LockContext; -} - -// Warning: (ae-internal-missing-underscore) The name "UnlockFn" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type UnlockFn = () => void; - -// @public -export interface UpdateNotification extends TableUpdateOperation { - // (undocumented) - table: string; -} - -// @public -export enum UpdateType { - DELETE = 'DELETE', - PATCH = 'PATCH', - PUT = 'PUT' -} - -// @public (undocumented) -export class UploadQueueStats { - constructor(count: number, size?: number | null); - count: number; - size: number | null; - // (undocumented) - toString(): string; -} - -// @public (undocumented) -export interface WatchCompatibleQuery { - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(options: WatchExecuteOptions): Promise; -} - -// @alpha -export type WatchedAttachmentItem = - | { - id: string; - filename: string; - fileExtension?: never; - metaData?: string; - mediaType?: string; - } - | { - id: string; - fileExtension: string; - filename?: never; - metaData?: string; - mediaType?: string; - }; - -// Warning: (ae-forgotten-export) The symbol "MetaBaseObserverInterface" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export interface WatchedQuery< - Data = unknown, - Settings extends WatchedQueryOptions = WatchedQueryOptions, - Listener extends WatchedQueryListener = WatchedQueryListener -> extends MetaBaseObserverInterface { - close(): Promise; - // (undocumented) - readonly closed: boolean; - registerListener(listener: Listener): () => void; - readonly state: WatchedQueryState; - updateSettings(options: Settings): Promise; -} - -// @public -export interface WatchedQueryComparator { - // (undocumented) - checkEquality: (current: Data, previous: Data) => boolean; -} - -// @public -export interface WatchedQueryDifferential { - // (undocumented) - readonly added: ReadonlyArray>; - readonly all: ReadonlyArray>; - // (undocumented) - readonly removed: ReadonlyArray>; - // (undocumented) - readonly unchanged: ReadonlyArray>; - // (undocumented) - readonly updated: ReadonlyArray>>; -} - -// @public (undocumented) -export interface WatchedQueryListener extends BaseListener { - // (undocumented) - [WatchedQueryListenerEvent.CLOSED]?: () => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_DATA]?: (data: Data) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_ERROR]?: (error: Error) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_STATE_CHANGE]?: (state: WatchedQueryState) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.SETTINGS_WILL_UPDATE]?: () => void; -} - -// @public (undocumented) -export enum WatchedQueryListenerEvent { - // (undocumented) - CLOSED = 'closed', - // (undocumented) - ON_DATA = 'onData', - // (undocumented) - ON_ERROR = 'onError', - // (undocumented) - ON_STATE_CHANGE = 'onStateChange', - // (undocumented) - SETTINGS_WILL_UPDATE = 'settingsWillUpdate' -} - -// @public (undocumented) -export interface WatchedQueryOptions { - reportFetching?: boolean; - throttleMs?: number; - triggerOnTables?: string[]; -} - -// @public -export interface WatchedQueryRowDifferential { - // (undocumented) - readonly current: RowType; - // (undocumented) - readonly previous: RowType; -} - -// @public -export interface WatchedQuerySettings extends WatchedQueryOptions { - // (undocumented) - query: WatchCompatibleQuery; -} - -// @public -export interface WatchedQueryState { - readonly data: Data; - readonly error: Error | null; - readonly isFetching: boolean; - readonly isLoading: boolean; - readonly lastUpdated: Date | null; -} - -// @public -export interface WatchExecuteOptions { - // (undocumented) - db: AbstractPowerSyncDatabase; - // (undocumented) - parameters: any[]; - // (undocumented) - sql: string; -} - -// @public (undocumented) -export interface WatchHandler { - // (undocumented) - onError?: (error: Error) => void; - // (undocumented) - onResult: (results: QueryResult) => void; -} - -// @public (undocumented) -export interface WatchOnChangeEvent { - // (undocumented) - changedTables: string[]; -} - -// @public (undocumented) -export interface WatchOnChangeHandler { - // (undocumented) - onChange: (event: WatchOnChangeEvent) => Promise | void; - // (undocumented) - onError?: (error: Error) => void; -} - -// @alpha -export interface WithDiffOptions { - castOperationIdAsText?: boolean; -} - -// Warnings were encountered during analysis: -// -// lib/db/crud/SyncStatus.d.ts:27:5 - (ae-forgotten-export) The symbol "InternalProgressInformation" needs to be exported by the entry point index.d.ts -// lib/db/crud/SyncStatus.d.ts:31:5 - (ae-forgotten-export) The symbol "CoreStreamSubscription" needs to be exported by the entry point index.d.ts - -// (No @packageDocumentation comment for this package) -``` +## API Report File for "@powersync/common" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { fetch as fetch_2 } from 'cross-fetch'; +import { GlobalLogger } from 'js-logger'; +import { ILogger } from 'js-logger'; +import { ILoggerOpts } from 'js-logger'; +import { ILogHandler } from 'js-logger'; +import { ILogLevel } from 'js-logger'; +import Logger from 'js-logger'; + +// Warning: (ae-internal-missing-underscore) The name "AbortOperation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class AbortOperation extends Error { + constructor(reason: string); + // (undocumented) + protected reason: string; +} + +// Warning: (ae-incompatible-release-tags) The symbol "AbstractPowerSyncDatabase" is marked as @public, but its signature references "BaseObserver" which is marked as @internal +// +// @public (undocumented) +export abstract class AbstractPowerSyncDatabase extends BaseObserver { + constructor(options: PowerSyncDatabaseOptionsWithDBAdapter); + constructor(options: PowerSyncDatabaseOptionsWithOpenFactory); + constructor(options: PowerSyncDatabaseOptionsWithSettings); + constructor(options: PowerSyncDatabaseOptions); + // Warning: (ae-incompatible-release-tags) The symbol "bucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal + // + // (undocumented) + protected bucketStorageAdapter: BucketStorageAdapter; + close(options?: PowerSyncCloseOptions): Promise; + closed: boolean; + connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise; + get connected(): boolean; + // (undocumented) + get connecting(): boolean; + // Warning: (ae-incompatible-release-tags) The symbol "connectionManager" is marked as @public, but its signature references "ConnectionManager" which is marked as @internal + // + // (undocumented) + protected connectionManager: ConnectionManager; + // Warning: (ae-incompatible-release-tags) The symbol "connectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal + get connectionOptions(): InternalConnectionOptions | null; + get connector(): PowerSyncBackendConnector | null; + currentStatus: SyncStatus; + customQuery(query: WatchCompatibleQuery): Query; + get database(): DBAdapter; + disconnect(): Promise; + disconnectAndClear(options?: DisconnectAndClearOptions): Promise; + // @deprecated (undocumented) + dispose(): void; + execute(sql: string, parameters?: any[]): Promise; + executeBatch(sql: string, parameters?: any[][]): Promise; + executeRaw(sql: string, parameters?: any[]): Promise; + // Warning: (ae-incompatible-release-tags) The symbol "generateBucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal + // + // (undocumented) + protected abstract generateBucketStorageAdapter(): BucketStorageAdapter; + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal + // + // (undocumented) + protected abstract generateSyncStreamImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions): StreamingSyncImplementation; + // Warning: (ae-incompatible-release-tags) The symbol "generateTriggerManagerConfig" is marked as @public, but its signature references "TriggerManagerConfig" which is marked as @internal + protected generateTriggerManagerConfig(): TriggerManagerConfig; + get(sql: string, parameters?: any[]): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getClientId(): Promise; + getCrudBatch(limit?: number): Promise; + getCrudTransactions(): AsyncIterable; + getNextCrudTransaction(): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + getUploadQueueStats(includeSize?: boolean): Promise; + init(): Promise; + protected initialize(): Promise; + abstract _initialize(): Promise; + // (undocumented) + protected _isReadyPromise: Promise; + // (undocumented) + protected loadVersion(): Promise; + // (undocumented) + logger: ILogger; + onChange(options?: SQLOnChangeOptions): AsyncIterable; + onChange(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; + onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable; + onChangeWithCallback(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; + protected abstract openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter; + // (undocumented) + protected options: PowerSyncDatabaseOptions; + query(query: ArrayQueryDefinition): Query; + readLock(callback: (db: LockContext) => Promise): Promise; + readTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; + // (undocumented) + ready: boolean; + // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal + // + // (undocumented) + protected resolvedConnectionOptions(options: CreateSyncImplementationOptions): CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions; + // (undocumented) + protected resolveOfflineSyncStatus(): Promise; + resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise; + protected runExclusive(callback: () => Promise): Promise; + // Warning: (ae-incompatible-release-tags) The symbol "runExclusiveMutex" is marked as @public, but its signature references "Mutex" which is marked as @internal + // + // (undocumented) + protected runExclusiveMutex: Mutex; + get schema(): Schema<{ + [x: string]: Table; + }>; + // (undocumented) + protected _schema: Schema; + // (undocumented) + sdkVersion: string; + syncStream(name: string, params?: Record): SyncStream; + // Warning: (ae-incompatible-release-tags) The symbol "syncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal + // + // (undocumented) + get syncStreamImplementation(): StreamingSyncImplementation | null; + // Warning: (ae-incompatible-release-tags) The symbol "triggers" is marked as @public, but its signature references "TriggerManager" which is marked as @alpha + readonly triggers: TriggerManager; + // Warning: (ae-incompatible-release-tags) The symbol "triggersImpl" is marked as @public, but its signature references "TriggerManagerImpl" which is marked as @internal + // + // (undocumented) + protected triggersImpl: TriggerManagerImpl; + updateSchema(schema: Schema): Promise; + waitForFirstSync(request?: AbortSignal | { + signal?: AbortSignal; + priority?: number; + }): Promise; + // (undocumented) + waitForReady(): Promise; + waitForStatus(predicate: (status: SyncStatus) => any, signal?: AbortSignal): Promise; + watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; + watch(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; + watchWithAsyncGenerator(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; + watchWithCallback(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; + writeLock(callback: (db: LockContext) => Promise): Promise; + writeTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractPowerSyncDatabaseOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractPowerSyncDatabaseOpenFactory { + constructor(options: PowerSyncOpenFactoryOptions); + // (undocumented) + abstract generateInstance(options: PowerSyncDatabaseOptions): AbstractPowerSyncDatabase; + // (undocumented) + generateOptions(): PowerSyncDatabaseOptions; + // (undocumented) + getInstance(): AbstractPowerSyncDatabase; + // (undocumented) + protected abstract openDB(): DBAdapter; + // (undocumented) + protected options: PowerSyncOpenFactoryOptions; + get schema(): Schema<{ + [x: string]: Table; + }>; +} + +// Warning: (ae-forgotten-export) The symbol "MetaBaseObserver" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "WatchedQueryProcessorListener" needs to be exported by the entry point index.d.ts +// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export abstract class AbstractQueryProcessor extends MetaBaseObserver> implements WatchedQuery { + constructor(options: AbstractQueryProcessorOptions); + // (undocumented) + protected abortController: AbortController; + // (undocumented) + close(): Promise; + // (undocumented) + get closed(): boolean; + // (undocumented) + protected _closed: boolean; + // (undocumented) + protected constructInitialState(): WatchedQueryState; + // (undocumented) + protected disposeListeners: (() => void) | null; + protected init(signal: AbortSignal): Promise; + // (undocumented) + protected initialized: Promise; + protected iterateAsyncListenersWithError(callback: (listener: Partial>) => Promise | void): Promise; + protected abstract linkQuery(options: LinkQueryOptions): Promise; + // (undocumented) + protected options: AbstractQueryProcessorOptions; + // (undocumented) + protected get reportFetching(): boolean; + protected runWithReporting(callback: () => Promise): Promise; + // (undocumented) + readonly state: WatchedQueryState; + updateSettings(settings: Settings): Promise; + // (undocumented) + protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise; + // (undocumented) + protected updateState(update: Partial>): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AbstractQueryProcessorOptions { + // (undocumented) + db: AbstractPowerSyncDatabase; + // (undocumented) + placeholderData: Data; + // (undocumented) + watchOptions: Settings; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractRemote" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractRemote { + constructor(connector: RemoteConnector, logger?: ILogger, options?: Partial); + // (undocumented) + protected buildRequest(path: string): Promise<{ + url: string; + headers: { + 'content-type': string; + Authorization: string; + 'x-user-agent': string; + }; + }>; + // (undocumented) + protected connector: RemoteConnector; + // (undocumented) + protected createSocket(url: string): WebSocket; + // (undocumented) + createTextDecoder(): TextDecoder; + // (undocumented) + protected credentials: PowerSyncCredentials | null; + // (undocumented) + get fetch(): FetchImplementation; + fetchCredentials(): Promise; + fetchStream(options: SyncStreamOptions): Promise>; + protected fetchStreamRaw(options: SyncStreamOptions): Promise<{ + isBson: boolean; + stream: SimpleAsyncIterator; + }>; + // (undocumented) + get(path: string, headers?: Record): Promise; + getCredentials(): Promise; + // (undocumented) + getUserAgent(): string; + invalidateCredentials(): void; + // (undocumented) + protected logger: ILogger; + // (undocumented) + protected options: AbstractRemoteOptions; + // (undocumented) + post(path: string, data: any, headers?: Record): Promise; + prefetchCredentials(): Promise; + socketStreamRaw(options: SocketSyncStreamOptions): Promise>; + // (undocumented) + protected get supportsStreamingBinaryResponses(): boolean; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractRemoteOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type AbstractRemoteOptions = { + socketUrlTransformer: (url: string) => string; + fetchImplementation: FetchImplementation | FetchImplementationProvider; + fetchOptions?: {}; +}; + +// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractStreamingSyncImplementation extends BaseObserver implements StreamingSyncImplementation { + constructor(options: AbstractStreamingSyncImplementationOptions); + // (undocumented) + protected abortController: AbortController | null; + // (undocumented) + connect(options?: PowerSyncConnectionOptions): Promise; + // (undocumented) + protected crudUpdateListener?: () => void; + // (undocumented) + disconnect(): Promise; + // (undocumented) + dispose(): Promise; + // (undocumented) + getWriteCheckpoint(): Promise; + // (undocumented) + get isConnected(): boolean; + // (undocumented) + get lastSyncedAt(): Date | undefined; + // (undocumented) + protected logger: ILogger; + // (undocumented) + markConnectionMayHaveChanged(): void; + // (undocumented) + abstract obtainLock(lockOptions: LockOptions_2): Promise; + // (undocumented) + protected options: AbstractStreamingSyncImplementationOptions; + // Warning: (ae-forgotten-export) The symbol "RustIterationResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected streamingSyncIteration(signal: AbortSignal, options?: PowerSyncConnectionOptions): Promise; + // (undocumented) + protected streamingSyncPromise?: Promise<[void, void]>; + // (undocumented) + syncStatus: SyncStatus; + // (undocumented) + triggerCrudUpload(): void; + // (undocumented) + updateSubscriptions(subscriptions: SubscribedStream[]): void; + // (undocumented) + protected updateSyncStatus(options: SyncStatusOptions): void; + // (undocumented) + waitForReady(): Promise; + // (undocumented) + waitForStatus(status: SyncStatusOptions): Promise; + // (undocumented) + waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AbstractStreamingSyncImplementationOptions extends RequiredAdditionalConnectionOptions { + // (undocumented) + adapter: BucketStorageAdapter; + identifier?: string; + // (undocumented) + logger?: ILogger; + // (undocumented) + remote: AbstractRemote; + // (undocumented) + subscriptions: SubscribedStream[]; + // (undocumented) + uploadCrud: () => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AdditionalConnectionOptions { + crudUploadThrottleMs?: number; + retryDelayMs?: number; +} + +// @public +export class ArrayComparator implements WatchedQueryComparator { + constructor(options: ArrayComparatorOptions); + // (undocumented) + checkEquality(current: ItemType[], previous: ItemType[]): boolean; + // (undocumented) + protected options: ArrayComparatorOptions; +} + +// @public +export type ArrayComparatorOptions = { + compareBy: (item: ItemType) => string; +}; + +// @public +export interface ArrayQueryDefinition { + mapper?: (row: Record) => RowType; + // (undocumented) + parameters?: ReadonlyArray>; + // (undocumented) + sql: string; +} + +// @alpha +export const ATTACHMENT_TABLE = "attachments"; + +// @alpha +export class AttachmentContext { + constructor(db: AbstractPowerSyncDatabase, tableName: string | undefined, logger: ILogger, archivedCacheLimit: number); + readonly archivedCacheLimit: number; + // (undocumented) + clearQueue(): Promise; + readonly db: AbstractPowerSyncDatabase; + // (undocumented) + deleteArchivedAttachments(callback?: (attachments: AttachmentRecord[]) => Promise): Promise; + deleteAttachment(attachmentId: string): Promise; + getActiveAttachments(): Promise; + getArchivedAttachments(): Promise; + // (undocumented) + getAttachment(id: string): Promise; + getAttachments(): Promise; + readonly logger: ILogger; + saveAttachments(attachments: AttachmentRecord[]): Promise; + readonly tableName: string; + upsertAttachment(attachment: AttachmentRecord, context: Transaction): Promise; +} + +// @alpha (undocumented) +export type AttachmentData = ArrayBuffer | string; + +// @alpha +export interface AttachmentErrorHandler { + onDeleteError(attachment: AttachmentRecord, error: unknown): Promise; + onDownloadError(attachment: AttachmentRecord, error: unknown): Promise; + onUploadError(attachment: AttachmentRecord, error: unknown): Promise; +} + +// @alpha +export function attachmentFromSql(row: any): AttachmentRecord; + +// @alpha +export class AttachmentQueue implements AttachmentQueue { + constructor(input: { + db: AbstractPowerSyncDatabase; + remoteStorage: RemoteStorageAdapter; + localStorage: LocalStorageAdapter; + watchAttachments: (onUpdate: (attachment: WatchedAttachmentItem[]) => Promise, signal: AbortSignal) => void; + tableName?: string; + logger?: ILogger; + syncIntervalMs?: number; + syncThrottleDuration?: number; + downloadAttachments?: boolean; + archivedCacheLimit?: number; + errorHandler?: AttachmentErrorHandler; + }); + readonly archivedCacheLimit: number; + // (undocumented) + clearQueue(): Promise; + // (undocumented) + deleteFile(input: { + id: string; + updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; + }): Promise; + readonly downloadAttachments: boolean; + // (undocumented) + expireCache(): Promise; + generateAttachmentId(): Promise; + readonly localStorage: LocalStorageAdapter; + readonly logger: ILogger; + readonly remoteStorage: RemoteStorageAdapter; + saveFile(input: { + data: AttachmentData; + fileExtension: string; + mediaType?: string; + metaData?: string; + id?: string; + updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; + }): Promise; + startSync(): Promise; + stopSync(): Promise; + readonly syncIntervalMs: number; + syncStorage(): Promise; + readonly syncThrottleDuration: number; + readonly tableName: string; + verifyAttachments(): Promise; + withAttachmentContext(callback: (context: AttachmentContext) => Promise): Promise; +} + +// @alpha +export interface AttachmentRecord { + // (undocumented) + filename: string; + // (undocumented) + hasSynced?: boolean; + // (undocumented) + id: string; + // (undocumented) + localUri?: string; + // (undocumented) + mediaType?: string; + // (undocumented) + metaData?: string; + // (undocumented) + size?: number; + // (undocumented) + state: AttachmentState; + // (undocumented) + timestamp?: number; +} + +// Warning: (ae-internal-missing-underscore) The name "AttachmentService" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class AttachmentService { + constructor(db: AbstractPowerSyncDatabase, logger: ILogger, tableName?: string, archivedCacheLimit?: number); + watchActiveAttachments(input?: { + throttleMs?: number; + }): DifferentialWatchedQuery; + withContext(callback: (context: AttachmentContext) => Promise): Promise; +} + +// @alpha +export enum AttachmentState { + // (undocumented) + ARCHIVED = 4,// Attachment to be uploaded + // (undocumented) + QUEUED_DELETE = 2,// Attachment to be downloaded + // (undocumented) + QUEUED_DOWNLOAD = 1,// Attachment to be deleted + // (undocumented) + QUEUED_UPLOAD = 0,// Attachment has been synced + // (undocumented) + SYNCED = 3 +} + +// @alpha +export class AttachmentTable extends Table { + constructor(options?: AttachmentTableOptions); +} + +// @alpha (undocumented) +export interface AttachmentTableOptions extends Omit { +} + +// @public (undocumented) +export type BaseColumnType = { + type: ColumnType; +}; + +// @public (undocumented) +export interface BaseConnectionOptions { + appMetadata?: Record; + // @deprecated (undocumented) + clientImplementation?: SyncClientImplementation; + connectionMethod?: SyncStreamConnectionMethod; + fetchStrategy?: FetchStrategy; + includeDefaultStreams?: boolean; + params?: Record; + serializedSchema?: any; +} + +// @public (undocumented) +export type BaseListener = Record any) | undefined>; + +// Warning: (ae-internal-missing-underscore) The name "BaseObserver" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class BaseObserver implements BaseObserverInterface { + constructor(); + // (undocumented) + dispose(): void; + // (undocumented) + iterateAsyncListeners(cb: (listener: Partial) => Promise): Promise; + // (undocumented) + iterateListeners(cb: (listener: Partial) => any): void; + // (undocumented) + protected listeners: Set>; + registerListener(listener: Partial): () => void; +} + +// @public (undocumented) +export interface BaseObserverInterface { + // (undocumented) + registerListener(listener: Partial): () => void; +} + +// Warning: (ae-incompatible-release-tags) The symbol "BasePowerSyncDatabaseOptions" is marked as @public, but its signature references "AdditionalConnectionOptions" which is marked as @internal +// +// @public (undocumented) +export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions { + // (undocumented) + logger?: ILogger; + // @deprecated (undocumented) + retryDelay?: number; + schema: Schema; +} + +// @alpha +export interface BaseTriggerDiffRecord { + id: string; + operation: DiffTriggerOperation; + operation_id: TOperationId; + timestamp: string; +} + +// @public (undocumented) +export interface BatchedUpdateNotification { + // (undocumented) + groupedUpdates: Record; + // (undocumented) + rawUpdates: UpdateNotification[]; + // (undocumented) + tables: string[]; +} + +// Warning: (ae-internal-missing-underscore) The name "BucketStorageAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface BucketStorageAdapter extends BaseObserverInterface, Disposable_2 { + control(op: PowerSyncControlCommand, payload: string | Uint8Array | null): Promise; + getClientId(): Promise; + // (undocumented) + getCrudBatch(limit?: number): Promise; + // (undocumented) + getMaxOpId(): string; + // (undocumented) + hasCrud(): Promise; + // (undocumented) + hasMigratedSubkeys(): Promise; + // (undocumented) + init(): Promise; + // (undocumented) + migrateToFixedSubkeys(): Promise; + // (undocumented) + nextCrudItem(): Promise; + // (undocumented) + updateLocalTarget(cb: () => Promise): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "BucketStorageListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface BucketStorageListener extends BaseListener { + // (undocumented) + crudUpdate: () => void; +} + +// @public (undocumented) +export class Column { + constructor(options: ColumnOptions); + // (undocumented) + get name(): string; + // (undocumented) + protected options: ColumnOptions; + // (undocumented) + toJSON(): { + name: string; + type: ColumnType | undefined; + }; + // (undocumented) + get type(): ColumnType | undefined; +} + +// @public (undocumented) +export const column: { + text: BaseColumnType; + integer: BaseColumnType; + real: BaseColumnType; +}; + +// @public (undocumented) +export interface ColumnOptions { + // (undocumented) + name: string; + // (undocumented) + type?: ColumnType; +} + +// @public (undocumented) +export type ColumnsType = Record>; + +// @public (undocumented) +export enum ColumnType { + // (undocumented) + INTEGER = "INTEGER", + // (undocumented) + REAL = "REAL", + // (undocumented) + TEXT = "TEXT" +} + +// @public (undocumented) +export interface CompilableQuery { + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(): Promise; +} + +// @public (undocumented) +export function compilableQueryWatch(db: AbstractPowerSyncDatabase, query: CompilableQuery, handler: CompilableQueryWatchHandler, options?: SQLWatchOptions): void; + +// @public (undocumented) +export interface CompilableQueryWatchHandler { + // (undocumented) + onError?: (error: Error) => void; + // (undocumented) + onResult: (results: T[]) => void; +} + +// @public (undocumented) +export interface CompiledQuery { + // (undocumented) + readonly parameters: ReadonlyArray; + // (undocumented) + readonly sql: string; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionClosedError" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class ConnectionClosedError extends Error { + constructor(message: string); + // (undocumented) + static MATCHES(input: any): boolean; + // (undocumented) + static NAME: string; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManager" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class ConnectionManager extends BaseObserver { + constructor(options: ConnectionManagerOptions); + get activeStreams(): { + name: string; + params: Record | null; + }[]; + // (undocumented) + close(): Promise; + // (undocumented) + connect(connector: PowerSyncBackendConnector, options: InternalConnectionOptions): Promise; + protected connectingPromise: Promise | null; + // (undocumented) + protected connectInternal(): Promise; + // (undocumented) + get connectionOptions(): InternalConnectionOptions | null; + // (undocumented) + get connector(): PowerSyncBackendConnector | null; + disconnect(): Promise; + protected disconnectingPromise: Promise | null; + // (undocumented) + protected disconnectInternal(): Promise; + // (undocumented) + get logger(): ILogger; + // (undocumented) + protected options: ConnectionManagerOptions; + // Warning: (ae-forgotten-export) The symbol "StoredConnectionOptions" needs to be exported by the entry point index.d.ts + protected pendingConnectionOptions: StoredConnectionOptions | null; + // (undocumented) + protected performDisconnect(): Promise; + // (undocumented) + stream(adapter: InternalSubscriptionAdapter, name: string, parameters: Record | null): SyncStream; + protected syncDisposer: (() => Promise | void) | null; + // (undocumented) + syncStreamImplementation: StreamingSyncImplementation | null; + protected syncStreamInitPromise: Promise | null; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerListener extends BaseListener { + // (undocumented) + syncStreamCreated: (sync: StreamingSyncImplementation) => void; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerOptions { + // (undocumented) + createSyncImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions): Promise; + // (undocumented) + logger: ILogger; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerSyncImplementationResult" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerSyncImplementationResult { + onDispose: () => Promise | void; + // (undocumented) + sync: StreamingSyncImplementation; +} + +// @public (undocumented) +export interface ConnectionPool extends BaseObserverInterface { + // (undocumented) + close: () => void | Promise; + // (undocumented) + name: string; + // (undocumented) + readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + refreshSchema: () => Promise; + // (undocumented) + writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "ControlledExecutor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class ControlledExecutor { + constructor(task: (param: T) => Promise | void, options?: ControlledExecutorOptions); + // (undocumented) + dispose(): void; + // (undocumented) + schedule(param: T): void; +} + +// Warning: (ae-internal-missing-underscore) The name "ControlledExecutorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ControlledExecutorOptions { + throttleEnabled?: boolean; +} + +// @public +export function createBaseLogger(): typeof Logger; + +// Warning: (ae-forgotten-export) The symbol "BaseCreateDiffTriggerOptions" needs to be exported by the entry point index.d.ts +// +// @alpha +export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions { + destination: string; + setupContext?: LockContext; +} + +// @public +export function createLogger(name: string, options?: CreateLoggerOptions): ILogger; + +// @public (undocumented) +export interface CreateLoggerOptions { + // (undocumented) + logLevel?: ILogLevel; +} + +// Warning: (ae-internal-missing-underscore) The name "CreateSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export interface CreateSyncImplementationOptions extends AdditionalConnectionOptions { + // (undocumented) + subscriptions: SubscribedStream[]; +} + +// @public +export class CrudBatch { + constructor( + crud: CrudEntry[], + haveMore: boolean, + complete: (writeCheckpoint?: string) => Promise); + complete: (writeCheckpoint?: string) => Promise; + crud: CrudEntry[]; + haveMore: boolean; +} + +// @public +export class CrudEntry { + constructor(clientId: number, op: UpdateType, table: string, id: string, transactionId?: number, opData?: Record, previousValues?: Record, metadata?: string); + clientId: number; + // (undocumented) + equals(entry: CrudEntry): boolean; + // Warning: (ae-forgotten-export) The symbol "CrudEntryJSON" needs to be exported by the entry point index.d.ts + // + // (undocumented) + static fromRow(dbRow: CrudEntryJSON): CrudEntry; + // @deprecated + hashCode(): string; + id: string; + metadata?: string; + op: UpdateType; + opData?: Record; + previousValues?: Record; + table: string; + toComparisonArray(): (string | number | Record | undefined)[]; + // Warning: (ae-forgotten-export) The symbol "CrudEntryOutputJSON" needs to be exported by the entry point index.d.ts + toJSON(): CrudEntryOutputJSON; + transactionId?: number; +} + +// @public (undocumented) +export class CrudTransaction extends CrudBatch { + constructor( + crud: CrudEntry[], + complete: (checkpoint?: string) => Promise, + transactionId?: number | undefined); + complete: (checkpoint?: string) => Promise; + crud: CrudEntry[]; + transactionId?: number | undefined; +} + +// @public (undocumented) +export interface DBAdapter extends ConnectionPool, SqlExecutor, DBGetUtils { + // (undocumented) + readTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; + // (undocumented) + writeTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "DBAdapterDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function DBAdapterDefaultMixin ConnectionPool>(Base: TBase): { + new (...args: any[]): { + readTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; + writeTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + get(sql: string, parameters?: any[]): Promise; + execute(query: string, params?: any[]): Promise; + executeRaw(query: string, params?: any[]): Promise; + executeBatch(query: string, params?: any[][]): Promise; + name: string; + close: () => void | Promise; + readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + refreshSchema: () => Promise; + registerListener(listener: Partial): () => void; + }; +} & TBase; + +// @public (undocumented) +export interface DBAdapterListener extends BaseListener { + tablesUpdated: (updateNotification: BatchedUpdateNotification | UpdateNotification) => void; +} + +// @public (undocumented) +export interface DBGetUtils { + get(sql: string, parameters?: any[]): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "DBGetUtilsDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function DBGetUtilsDefaultMixin Omit>(Base: TBase): { + new (...args: any[]): { + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + get(sql: string, parameters?: any[]): Promise; + executeBatch(query: string, params?: any[][]): Promise; + execute: (query: string, params?: any[] | undefined) => Promise; + executeRaw: (query: string, params?: any[] | undefined) => Promise; + }; +} & TBase; + +// @public (undocumented) +export interface DBLockOptions { + // (undocumented) + timeoutMs?: number; +} + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_BATCH_LIMIT" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_CRUD_BATCH_LIMIT = 100; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_UPLOAD_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_COLUMN_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_INDEX_COLUMN_OPTIONS: Partial; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_INDEX_OPTIONS: Partial; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_LOCK_TIMEOUT_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const DEFAULT_LOCK_TIMEOUT_MS = 120000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_CLOSE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_DB_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_POWERSYNC_DB_OPTIONS: { + retryDelayMs: number; + crudUploadThrottleMs: number; +}; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_LOGGER" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_REMOTE_LOGGER: Logger.ILogger; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_RETRY_DELAY_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_RETRY_DELAY_MS = 5000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_ROW_COMPARATOR" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const DEFAULT_ROW_COMPARATOR: DifferentialWatchedQueryComparator; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAM_CONNECTION_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAMING_SYNC_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_STREAMING_SYNC_OPTIONS: { + retryDelayMs: number; + crudUploadThrottleMs: number; +}; + +// @public @deprecated +export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_TABLE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_TABLE_OPTIONS: { + indexes: never[]; + insertOnly: boolean; + localOnly: boolean; + trackPrevious: boolean; + trackMetadata: boolean; + ignoreEmptyUpdates: boolean; +}; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_QUERY_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_WATCH_QUERY_OPTIONS: WatchedQueryOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_WATCH_THROTTLE_MS = 30; + +// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class DifferentialQueryProcessor extends AbstractQueryProcessor>, DifferentialWatchedQuerySettings> implements DifferentialWatchedQuery { + constructor(options: DifferentialQueryProcessorOptions); + // (undocumented) + protected comparator: DifferentialWatchedQueryComparator; + // Warning: (ae-forgotten-export) The symbol "DataHashMap" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected differentiate(current: RowType[], previousMap: DataHashMap): { + diff: WatchedQueryDifferential; + map: DataHashMap; + hasChanged: boolean; + }; + // (undocumented) + protected linkQuery(options: LinkQueryOptions>): Promise; + // (undocumented) + protected options: DifferentialQueryProcessorOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface DifferentialQueryProcessorOptions extends AbstractQueryProcessorOptions> { + // (undocumented) + rowComparator?: DifferentialWatchedQueryComparator; +} + +// @public (undocumented) +export type DifferentialWatchedQuery = WatchedQuery>, DifferentialWatchedQuerySettings, DifferentialWatchedQueryListener>; + +// @public +export interface DifferentialWatchedQueryComparator { + compareBy: (item: RowType) => string; + keyBy: (item: RowType) => string; +} + +// @public (undocumented) +export interface DifferentialWatchedQueryListener extends WatchedQueryListener>> { + // (undocumented) + onDiff?: (diff: WatchedQueryDifferential) => void | Promise; +} + +// @public +export interface DifferentialWatchedQueryOptions extends WatchedQueryOptions { + placeholderData?: RowType[]; + rowComparator?: DifferentialWatchedQueryComparator; +} + +// @public +export interface DifferentialWatchedQuerySettings extends DifferentialWatchedQueryOptions { + query: WatchCompatibleQuery; +} + +// @alpha +export enum DiffTriggerOperation { + // (undocumented) + DELETE = "DELETE", + // (undocumented) + INSERT = "INSERT", + // (undocumented) + UPDATE = "UPDATE" +} + +// @public (undocumented) +export interface DisconnectAndClearOptions { + clearLocal?: boolean; +} + +// @public (undocumented) +interface Disposable_2 { + // (undocumented) + dispose: () => Promise | void; +} +export { Disposable_2 as Disposable } + +// Warning: (ae-internal-missing-underscore) The name "EMPTY_DIFFERENTIAL" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const EMPTY_DIFFERENTIAL: { + added: never[]; + all: never[]; + removed: never[]; + updated: never[]; + unchanged: never[]; +}; + +// @alpha (undocumented) +export enum EncodingType { + // (undocumented) + Base64 = "base64", + // (undocumented) + UTF8 = "utf8" +} + +// @public (undocumented) +export type ExtractColumnValueType> = T extends BaseColumnType ? R : unknown; + +// @alpha +export type ExtractedTriggerDiffRecord = T & { + [K in keyof Omit, 'id'> as `__${string & K}`]: TriggerDiffRecord[K]; +} & { + __previous_value?: string; +}; + +// Warning: (ae-internal-missing-underscore) The name "extractTableUpdates" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function extractTableUpdates(update: BatchedUpdateNotification | UpdateNotification): string[]; + +// @public +export const FalsyComparator: WatchedQueryComparator; + +// Warning: (ae-internal-missing-underscore) The name "FetchImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type FetchImplementation = typeof fetch_2; + +// Warning: (ae-internal-missing-underscore) The name "FetchImplementationProvider" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class FetchImplementationProvider { + // (undocumented) + getFetch(): FetchImplementation; +} + +// @public (undocumented) +export enum FetchStrategy { + Buffered = "buffered", + Sequential = "sequential" +} + +// @public +export class GetAllQuery implements WatchCompatibleQuery { + constructor(options: GetAllQueryOptions); + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(options: { + db: AbstractPowerSyncDatabase; + }): Promise; + // (undocumented) + protected options: GetAllQueryOptions; +} + +// @public +export type GetAllQueryOptions = { + sql: string; + parameters?: ReadonlyArray; + mapper?: (rawRow: Record) => RowType; +}; + +export { GlobalLogger } + +export { ILogger } + +export { ILoggerOpts } + +export { ILogHandler } + +export { ILogLevel } + +// @public (undocumented) +export class Index { + constructor(options: IndexOptions); + // (undocumented) + get columns(): IndexedColumn[]; + // (undocumented) + static createAscending(options: IndexOptions, columnNames: string[]): Index; + // (undocumented) + get name(): string; + // (undocumented) + protected options: IndexOptions; + // (undocumented) + toJSON(table: Table): { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }; +} + +// @public (undocumented) +export interface IndexColumnOptions { + // (undocumented) + ascending?: boolean; + // (undocumented) + name: string; +} + +// @public (undocumented) +export class IndexedColumn { + constructor(options: IndexColumnOptions); + // (undocumented) + get ascending(): boolean | undefined; + // (undocumented) + static createAscending(column: string): IndexedColumn; + // (undocumented) + get name(): string; + // (undocumented) + protected options: IndexColumnOptions; + // (undocumented) + toJSON(table: Table): { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }; +} + +// @public (undocumented) +export interface IndexOptions { + // (undocumented) + columns?: IndexedColumn[]; + // (undocumented) + name: string; +} + +// @public (undocumented) +export type IndexShorthand = Record; + +// Warning: (ae-internal-missing-underscore) The name "InternalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions { +} + +// Warning: (ae-internal-missing-underscore) The name "InternalSubscriptionAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface InternalSubscriptionAdapter { + // (undocumented) + firstStatusMatching(predicate: (status: SyncStatus) => any, abort?: AbortSignal): Promise; + // (undocumented) + resolveOfflineSyncStatus(): Promise; + // (undocumented) + rustSubscriptionsCommand(payload: any): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "InvalidSQLCharacters" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const InvalidSQLCharacters: RegExp; + +// Warning: (ae-internal-missing-underscore) The name "isBatchedUpdateNotification" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function isBatchedUpdateNotification(update: BatchedUpdateNotification | UpdateNotification): update is BatchedUpdateNotification; + +// Warning: (ae-internal-missing-underscore) The name "isDBAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isDBAdapter: (test: any) => test is DBAdapter; + +// Warning: (ae-internal-missing-underscore) The name "isPowerSyncDatabaseOptionsWithSettings" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isPowerSyncDatabaseOptionsWithSettings: (test: any) => test is PowerSyncDatabaseOptionsWithSettings; + +// Warning: (ae-internal-missing-underscore) The name "isSQLOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isSQLOpenFactory: (test: any) => test is SQLOpenFactory; + +// Warning: (ae-internal-missing-underscore) The name "isSQLOpenOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isSQLOpenOptions: (test: any) => test is SQLOpenOptions; + +// Warning: (ae-internal-missing-underscore) The name "LinkQueryOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface LinkQueryOptions { + // (undocumented) + abortSignal: AbortSignal; + // (undocumented) + settings: Settings; +} + +// @alpha +export interface LocalStorageAdapter { + clear(): Promise; + deleteFile(filePath: string): Promise; + fileExists(filePath: string): Promise; + getLocalUri(filename: string): string; + initialize(): Promise; + makeDir(path: string): Promise; + readFile(filePath: string): Promise; + rmDir(path: string): Promise; + saveFile(filePath: string, data: AttachmentData): Promise; +} + +// @public (undocumented) +export interface LockContext extends SqlExecutor, DBGetUtils { + connectionType?: 'writer' | 'queryOnly' | 'readOnly'; +} + +// @internal +interface LockOptions_2 { + // (undocumented) + callback: () => Promise; + // (undocumented) + signal?: AbortSignal; + // (undocumented) + type: LockType; +} + +// Warning: (ae-internal-missing-underscore) The name "LockOptions" should be prefixed with an underscore because the declaration is marked as @internal +export { LockOptions_2 as LockOptions } + +// Warning: (ae-internal-missing-underscore) The name "LockType" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum LockType { + // (undocumented) + CRUD = "crud", + // (undocumented) + SYNC = "sync" +} + +// @public (undocumented) +export const LogLevel: { + TRACE: Logger.ILogLevel; + DEBUG: Logger.ILogLevel; + INFO: Logger.ILogLevel; + TIME: Logger.ILogLevel; + WARN: Logger.ILogLevel; + ERROR: Logger.ILogLevel; + OFF: Logger.ILogLevel; +}; + +// Warning: (ae-internal-missing-underscore) The name "MAX_AMOUNT_OF_COLUMNS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const MAX_AMOUNT_OF_COLUMNS = 1999; + +// Warning: (ae-internal-missing-underscore) The name "MAX_OP_ID" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const MAX_OP_ID = "9223372036854775807"; + +// Warning: (ae-internal-missing-underscore) The name "MEMORY_TRIGGER_CLAIM_MANAGER" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const MEMORY_TRIGGER_CLAIM_MANAGER: TriggerClaimManager; + +// Warning: (ae-forgotten-export) The symbol "MutableDeep" needs to be exported by the entry point index.d.ts +// Warning: (ae-internal-missing-underscore) The name "MutableWatchedQueryState" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export type MutableWatchedQueryState = { + -readonly [P in keyof WatchedQueryState]: MutableDeep[P]>; +}; + +// Warning: (ae-internal-missing-underscore) The name "Mutex" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class Mutex { + // (undocumented) + acquire(abort?: AbortSignal): Promise; + // (undocumented) + runExclusive(fn: () => PromiseLike | T, abort?: AbortSignal): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class OnChangeQueryProcessor extends AbstractQueryProcessor> { + constructor(options: OnChangeQueryProcessorOptions); + // (undocumented) + protected checkEquality(current: Data, previous: Data): boolean; + // (undocumented) + protected linkQuery(options: LinkQueryOptions): Promise; + // (undocumented) + protected options: OnChangeQueryProcessorOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface OnChangeQueryProcessorOptions extends AbstractQueryProcessorOptions> { + // (undocumented) + comparator?: WatchedQueryComparator; +} + +// @public +export type OpId = string; + +// Warning: (ae-internal-missing-underscore) The name "ParsedQuery" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ParsedQuery { + // (undocumented) + parameters: any[]; + // (undocumented) + sqlStatement: string; +} + +// Warning: (ae-internal-missing-underscore) The name "parseQuery" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const parseQuery: (query: string | CompilableQuery, parameters: any[]) => ParsedQuery; + +// @public +export type PendingStatement = { + sql: string; + params: PendingStatementParameter[]; +}; + +// @public +export type PendingStatementParameter = 'Id' | { + Column: string; +} | 'Rest'; + +// @public (undocumented) +export interface PowerSyncBackendConnector { + fetchCredentials: () => Promise; + uploadData: (database: AbstractPowerSyncDatabase) => Promise; +} + +// @public (undocumented) +export interface PowerSyncCloseOptions { + disconnect?: boolean; +} + +// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncConnectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal +// +// @public +export type PowerSyncConnectionOptions = Omit; + +// Warning: (ae-internal-missing-underscore) The name "PowerSyncControlCommand" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum PowerSyncControlCommand { + CONNECTION_STATE = "connection", + // (undocumented) + NOTIFY_CRUD_UPLOAD_COMPLETED = "completed_upload", + // (undocumented) + NOTIFY_TOKEN_REFRESHED = "refreshed_token", + // (undocumented) + PROCESS_BSON_LINE = "line_binary", + // (undocumented) + PROCESS_TEXT_LINE = "line_text", + // (undocumented) + START = "start", + // (undocumented) + STOP = "stop", + // (undocumented) + UPDATE_SUBSCRIPTIONS = "update_subscriptions" +} + +// @public (undocumented) +export interface PowerSyncCredentials { + // (undocumented) + endpoint: string; + // (undocumented) + expiresAt?: Date; + // (undocumented) + token: string; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions { + database: DBAdapter | SQLOpenFactory | SQLOpenOptions; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithDBAdapter extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: DBAdapter; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithOpenFactory extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: SQLOpenFactory; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithSettings extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: SQLOpenOptions; +} + +// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncDBListener" is marked as @public, but its signature references "StreamingSyncImplementationListener" which is marked as @internal +// +// @public (undocumented) +export interface PowerSyncDBListener extends StreamingSyncImplementationListener { + // (undocumented) + closed: () => Promise | void; + // (undocumented) + closing: () => Promise | void; + // (undocumented) + initialized: () => void; + // (undocumented) + schemaChanged: (schema: Schema) => void; +} + +// Warning: (ae-internal-missing-underscore) The name "PowerSyncOpenFactoryOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface PowerSyncOpenFactoryOptions extends Partial, SQLOpenOptions { + schema: Schema; +} + +// @public +export interface ProgressWithOperations { + downloadedFraction: number; + downloadedOperations: number; + totalOperations: number; +} + +// Warning: (ae-internal-missing-underscore) The name "PSInternalTable" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum PSInternalTable { + // (undocumented) + BUCKETS = "ps_buckets", + // (undocumented) + CRUD = "ps_crud", + // (undocumented) + DATA = "ps_data", + // (undocumented) + OPLOG = "ps_oplog", + // (undocumented) + UNTYPED = "ps_untyped" +} + +// @public (undocumented) +export interface Query { + differentialWatch(options?: DifferentialWatchedQueryOptions): DifferentialWatchedQuery; + watch(options?: StandardWatchedQueryOptions): StandardWatchedQuery>>; +} + +// @public +export type QueryParam = string | number | boolean | null | undefined | bigint | Uint8Array; + +// @public +export type QueryResult = { + insertId?: number; + rowsAffected: number; + rows?: { + _array: any[]; + length: number; + item: (idx: number) => any; + }; +}; + +// Warning: (ae-forgotten-export) The symbol "RawTableTypeWithStatements" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "InferredRawTableType" needs to be exported by the entry point index.d.ts +// +// @public +export type RawTableType = RawTableTypeWithStatements | InferredRawTableType; + +// Warning: (ae-internal-missing-underscore) The name "RemoteConnector" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type RemoteConnector = { + fetchCredentials: () => Promise; + invalidateCredentials?: () => void; +}; + +// @alpha +export interface RemoteStorageAdapter { + deleteFile(attachment: AttachmentRecord): Promise; + downloadFile(attachment: AttachmentRecord): Promise; + uploadFile(fileData: ArrayBuffer, attachment: AttachmentRecord): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "RequiredAdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface RequiredAdditionalConnectionOptions extends Required { + // (undocumented) + subscriptions: SubscribedStream[]; +} + +// Warning: (ae-internal-missing-underscore) The name "RequiredPowerSyncConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type RequiredPowerSyncConnectionOptions = Required; + +// @public (undocumented) +export type RowType> = { + [K in keyof T['columnMap']]: ExtractColumnValueType; +} & { + id: string; +}; + +// @public +export enum RowUpdateType { + // (undocumented) + SQLITE_DELETE = 9, + // (undocumented) + SQLITE_INSERT = 18, + // (undocumented) + SQLITE_UPDATE = 23 +} + +// Warning: (ae-internal-missing-underscore) The name "runOnSchemaChange" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function runOnSchemaChange(callback: (signal: AbortSignal) => void, db: AbstractPowerSyncDatabase, options?: SQLWatchOptions): void; + +// @alpha +export function sanitizeSQL(strings: TemplateStringsArray, ...values: any[]): string; + +// @alpha +export function sanitizeUUID(uuid: string): string; + +// Warning: (ae-forgotten-export) The symbol "SchemaType" needs to be exported by the entry point index.d.ts +// +// @public +export class Schema { + constructor(tables: Table[] | S); + // (undocumented) + readonly props: S; + // Warning: (ae-forgotten-export) The symbol "RawTable" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly rawTables: RawTable[]; + static rawTableToJson(table: RawTable): unknown; + // (undocumented) + readonly tables: Table[]; + // (undocumented) + toJSON(): { + tables: { + local_only: boolean | undefined; + insert_only: boolean | undefined; + include_old: any; + include_old_only_when_changed: boolean; + include_metadata: boolean | undefined; + ignore_empty_update: boolean | undefined; + name: string; + view_name: string; + columns: { + name: string; + type: ColumnType | undefined; + }[]; + indexes: { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }[]; + }[]; + raw_tables: unknown[]; + }; + // (undocumented) + readonly types: SchemaTableType; + // (undocumented) + validate(): void; + withRawTables(tables: Record): void; +} + +// @public (undocumented) +export type SchemaTableType = { + [K in keyof S]: RowType; +}; + +// Warning: (ae-internal-missing-underscore) The name "Semaphore" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class Semaphore { + constructor(elements: Iterable); + requestAll(abort?: AbortSignal): Promise<{ + items: T[]; + release: UnlockFn; + }>; + requestOne(abort?: AbortSignal): Promise<{ + item: T; + release: UnlockFn; + }>; + // (undocumented) + readonly size: number; +} + +// Warning: (ae-internal-missing-underscore) The name "SimpleAsyncIterator" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export type SimpleAsyncIterator = Pick, 'next'>; + +// Warning: (ae-internal-missing-underscore) The name "SocketSyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SocketSyncStreamOptions = SyncStreamOptions & { + fetchStrategy: FetchStrategy; +}; + +// @public (undocumented) +export interface SqlExecutor { + execute: (query: string, params?: any[] | undefined) => Promise; + // (undocumented) + executeBatch: (query: string, params?: any[][]) => Promise; + executeRaw: (query: string, params?: any[] | undefined) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "SqliteBucketStorage" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class SqliteBucketStorage extends BaseObserver implements BucketStorageAdapter { + constructor(db: DBAdapter, logger?: ILogger); + // (undocumented) + control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise; + // (undocumented) + dispose(): Promise; + // (undocumented) + getClientId(): Promise; + // (undocumented) + _getClientId(): Promise; + getCrudBatch(limit?: number): Promise; + // (undocumented) + getMaxOpId(): string; + // (undocumented) + hasCrud(): Promise; + // (undocumented) + hasMigratedSubkeys(): Promise; + // (undocumented) + init(): Promise; + // (undocumented) + migrateToFixedSubkeys(): Promise; + // (undocumented) + nextCrudItem(): Promise; + // (undocumented) + static _subkeyMigrationKey: string; + // (undocumented) + tableNames: Set; + // (undocumented) + updateLocalTarget(cb: () => Promise): Promise; + // (undocumented) + writeTransaction(callback: (tx: Transaction) => Promise, options?: { + timeoutMs: number; + }): Promise; +} + +// @public (undocumented) +export interface SQLOnChangeOptions { + // @deprecated (undocumented) + rawTableNames?: boolean; + // (undocumented) + signal?: AbortSignal; + // (undocumented) + tables?: string[]; + throttleMs?: number; + triggerImmediate?: boolean; +} + +// @public (undocumented) +export interface SQLOpenFactory { + openDB(): DBAdapter; +} + +// @public (undocumented) +export interface SQLOpenOptions { + dbFilename: string; + dbLocation?: string; + debugMode?: boolean; +} + +// @public (undocumented) +export interface SQLWatchOptions extends SQLOnChangeOptions { + comparator?: WatchedQueryComparator; +} + +// @public +export type StandardWatchedQuery = WatchedQuery>; + +// @public +export interface StandardWatchedQueryOptions extends WatchedQueryOptions { + comparator?: WatchedQueryComparator; + placeholderData?: RowType[]; +} + +// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface StreamingSyncImplementation extends BaseObserverInterface, Disposable_2 { + connect(options?: InternalConnectionOptions): Promise; + disconnect(): Promise; + // (undocumented) + getWriteCheckpoint: () => Promise; + // (undocumented) + isConnected: boolean; + // (undocumented) + markConnectionMayHaveChanged(): void; + // (undocumented) + syncStatus: SyncStatus; + // (undocumented) + triggerCrudUpload: () => void; + // (undocumented) + updateSubscriptions(subscriptions: SubscribedStream[]): void; + // (undocumented) + waitForReady(): Promise; + // (undocumented) + waitForStatus(status: SyncStatusOptions): Promise; + // (undocumented) + waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementationListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface StreamingSyncImplementationListener extends BaseListener { + statusChanged?: ((status: SyncStatus) => void) | undefined; + statusUpdated?: ((statusUpdate: SyncStatusOptions) => void) | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "JSONValue" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StreamingSyncRequestParameterType = JSONValue; + +// Warning: (ae-internal-missing-underscore) The name "SubscribedStream" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SubscribedStream = { + name: string; + params: Record | null; +}; + +// @public @deprecated (undocumented) +export enum SyncClientImplementation { + RUST = "rust" +} + +// @public (undocumented) +export type SyncDataFlowStatus = Partial<{ + downloading: boolean; + uploading: boolean; + downloadError?: Error; + uploadError?: Error; + downloadProgress: InternalProgressInformation | null; + internalStreamSubscriptions: CoreStreamSubscription[] | null; +}>; + +// Warning: (ae-internal-missing-underscore) The name "SyncingService" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class SyncingService { + constructor(attachmentService: AttachmentService, localStorage: LocalStorageAdapter, remoteStorage: RemoteStorageAdapter, logger: ILogger, errorHandler?: AttachmentErrorHandler); + deleteArchivedAttachments(context: AttachmentContext): Promise; + deleteAttachment(attachment: AttachmentRecord, context: AttachmentContext): Promise; + downloadAttachment(attachment: AttachmentRecord): Promise; + processAttachments(attachments: AttachmentRecord[], context: AttachmentContext): Promise; + uploadAttachment(attachment: AttachmentRecord): Promise; +} + +// @public (undocumented) +export interface SyncPriorityStatus { + // (undocumented) + hasSynced?: boolean; + // (undocumented) + lastSyncedAt?: Date; + // (undocumented) + priority: number; +} + +// @public +export class SyncProgress implements ProgressWithOperations { + constructor(internal: InternalProgressInformation); + // (undocumented) + downloadedFraction: number; + // (undocumented) + downloadedOperations: number; + // (undocumented) + protected internal: InternalProgressInformation; + // (undocumented) + totalOperations: number; + untilPriority(priority: number): ProgressWithOperations; +} + +// @public (undocumented) +export class SyncStatus { + // Warning: (ae-incompatible-release-tags) The symbol "__constructor" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + constructor(options: SyncStatusOptions); + // @deprecated + get clientImplementation(): SyncClientImplementation | undefined; + get connected(): boolean; + get connecting(): boolean; + get dataFlowStatus(): SyncDataFlowStatus; + get downloadProgress(): SyncProgress | null; + forStream(stream: SyncStreamDescription): SyncStreamStatus | undefined; + getMessage(): string; + get hasSynced(): boolean | undefined; + isEqual(status: SyncStatus): boolean; + get lastSyncedAt(): Date | undefined; + // Warning: (ae-incompatible-release-tags) The symbol "options" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + // + // (undocumented) + protected options: SyncStatusOptions; + get priorityStatusEntries(): SyncPriorityStatus[]; + protected serializeError(error?: Error): { + name: string; + message: string; + stack: string | undefined; + } | undefined; + statusForPriority(priority: number): SyncPriorityStatus; + get syncStreams(): SyncStreamStatus[] | undefined; + // Warning: (ae-incompatible-release-tags) The symbol "toJSON" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + toJSON(): SyncStatusOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "SyncStatusOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SyncStatusOptions = { + connected?: boolean; + connecting?: boolean; + dataFlow?: SyncDataFlowStatus; + lastSyncedAt?: Date; + hasSynced?: boolean; + priorityStatusEntries?: SyncPriorityStatus[]; + clientImplementation?: SyncClientImplementation; +}; + +// @public +export interface SyncStream extends SyncStreamDescription { + subscribe(options?: SyncStreamSubscribeOptions): Promise; + unsubscribeAll(): Promise; +} + +// @public (undocumented) +export enum SyncStreamConnectionMethod { + // (undocumented) + HTTP = "http", + // (undocumented) + WEB_SOCKET = "web-socket" +} + +// @public +export interface SyncStreamDescription { + name: string; + parameters: Record | null; +} + +// Warning: (ae-internal-missing-underscore) The name "SyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SyncStreamOptions = { + path: string; + data: unknown; + headers?: Record; + abortSignal: AbortSignal; + fetchOptions?: Request; +}; + +// @public +export interface SyncStreamStatus { + // (undocumented) + priority: number | null; + // (undocumented) + progress: ProgressWithOperations | null; + // (undocumented) + subscription: SyncSubscriptionDescription; +} + +// @public (undocumented) +export interface SyncStreamSubscribeOptions { + priority?: 0 | 1 | 2 | 3; + ttl?: number; +} + +// @public (undocumented) +export interface SyncStreamSubscription extends SyncStreamDescription { + unsubscribe(): void; + waitForFirstSync(abort?: AbortSignal): Promise; +} + +// @public +export interface SyncSubscriptionDescription extends SyncStreamDescription { + // (undocumented) + active: boolean; + expiresAt: Date | null; + hasExplicitSubscription: boolean; + hasSynced: boolean; + isDefault: boolean; + lastSyncedAt: Date | null; +} + +// @public (undocumented) +export class Table { + constructor(columns: Columns, options?: TableV2Options); + // @deprecated + constructor(options: TableOptions); + // (undocumented) + get columnMap(): Columns; + // (undocumented) + get columns(): Column[]; + // (undocumented) + copyWithName(name: string): Table; + // (undocumented) + static createInsertOnly(options: TableOptions): Table; + // (undocumented) + static createLocalOnly(options: TableOptions): Table; + // @deprecated + static createTable(name: string, table: Table): Table; + // (undocumented) + get ignoreEmptyUpdates(): boolean; + // (undocumented) + get indexes(): Index[]; + // (undocumented) + get insertOnly(): boolean; + // (undocumented) + get internalName(): string; + // (undocumented) + get localOnly(): boolean; + // (undocumented) + protected _mappedColumns: Columns; + // (undocumented) + get name(): string; + // (undocumented) + protected options: TableOptions; + // (undocumented) + toJSON(): { + local_only: boolean | undefined; + insert_only: boolean | undefined; + include_old: any; + include_old_only_when_changed: boolean; + include_metadata: boolean | undefined; + ignore_empty_update: boolean | undefined; + name: string; + view_name: string; + columns: { + name: string; + type: ColumnType | undefined; + }[]; + indexes: { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }[]; + }; + // (undocumented) + get trackMetadata(): boolean; + // (undocumented) + get trackPrevious(): boolean | TrackPreviousOptions; + // (undocumented) + validate(): void; + // (undocumented) + get validName(): boolean; + // (undocumented) + get viewName(): string; + // (undocumented) + get viewNameOverride(): string | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "SharedTableOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export interface TableOptions extends SharedTableOptions { + // (undocumented) + columns: Column[]; + // (undocumented) + indexes?: Index[]; + name: string; +} + +// @public +export interface TableOrRawTableOptions { + // (undocumented) + ignoreEmptyUpdates?: boolean; + // (undocumented) + insertOnly?: boolean; + // (undocumented) + localOnly?: boolean; + // (undocumented) + trackMetadata?: boolean; + // (undocumented) + trackPrevious?: boolean | TrackPreviousOptions; +} + +// @public (undocumented) +export interface TableUpdateOperation { + // (undocumented) + opType: RowUpdateType; + // (undocumented) + rowId: number; +} + +// @public @deprecated +export class TableV2 extends Table { +} + +// @public (undocumented) +export interface TableV2Options extends SharedTableOptions { + // (undocumented) + indexes?: IndexShorthand; +} + +// Warning: (ae-internal-missing-underscore) The name "timeoutSignal" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function timeoutSignal(timeout: number): AbortSignal; + +// @internal (undocumented) +export function timeoutSignal(timeout?: number): AbortSignal | undefined; + +// @alpha +export interface TrackDiffOptions extends BaseCreateDiffTriggerOptions { + onChange: (context: TriggerDiffHandlerContext) => Promise; + throttleMs?: number; +} + +// @public +export interface TrackPreviousOptions { + columns?: string[]; + onlyWhenChanged?: boolean; +} + +// @public (undocumented) +export interface Transaction extends LockContext { + commit: () => Promise; + rollback: () => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerClaimManager" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export interface TriggerClaimManager { + checkClaim: (identifier: string) => Promise; + obtainClaim: (identifier: string) => Promise<() => Promise>; +} + +// @alpha +export interface TriggerCreationHooks { + beforeCreate?: (context: LockContext) => Promise; +} + +// @alpha +export interface TriggerDiffDeleteRecord extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.DELETE; + value: string; +} + +// @alpha +export interface TriggerDiffHandlerContext extends LockContext { + destinationTable: string; + withDiff: (query: string, params?: ReadonlyArray>, options?: WithDiffOptions) => Promise; + withExtractedDiff: (query: string, params?: ReadonlyArray>) => Promise; +} + +// @alpha +export interface TriggerDiffInsertRecord extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.INSERT; + value: string; +} + +// @alpha +export type TriggerDiffRecord = TriggerDiffUpdateRecord | TriggerDiffInsertRecord | TriggerDiffDeleteRecord; + +// @alpha +export interface TriggerDiffUpdateRecord extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.UPDATE; + previous_value: string; + value: string; +} + +// @alpha (undocumented) +export interface TriggerManager { + createDiffTrigger(options: CreateDiffTriggerOptions): Promise; + trackTableDiff(options: TrackDiffOptions): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerManagerConfig" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface TriggerManagerConfig { + // (undocumented) + claimManager: TriggerClaimManager; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerManagerImpl" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class TriggerManagerImpl implements TriggerManager { + constructor(options: TriggerManagerImplOptions); + cleanupResources(): Promise; + // (undocumented) + protected cleanupTimeout: ReturnType | null; + // (undocumented) + createDiffTrigger(options: CreateDiffTriggerOptions): Promise<(options?: TriggerRemoveCallbackOptions) => Promise>; + // (undocumented) + protected get db(): AbstractPowerSyncDatabase; + // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplConfiguration" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected defaultConfig: TriggerManagerImplConfiguration; + // (undocumented) + dispose(): void; + // (undocumented) + protected generateTriggerName(operation: DiffTriggerOperation, destinationTable: string, triggerId: string): string; + // (undocumented) + protected getUUID(ctx?: LockContext): Promise; + // (undocumented) + protected isDisposed: boolean; + // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected options: TriggerManagerImplOptions; + // (undocumented) + protected removeTriggers(tx: LockContext, triggerIds: string[]): Promise; + // (undocumented) + protected schema: Schema; + // (undocumented) + trackTableDiff(options: TrackDiffOptions): Promise; + updateDefaults(config: TriggerManagerImplConfiguration): void; +} + +// @alpha +export type TriggerRemoveCallback = (options?: TriggerRemoveCallbackOptions) => Promise; + +// @alpha +export interface TriggerRemoveCallbackOptions { + // (undocumented) + context?: LockContext; +} + +// Warning: (ae-internal-missing-underscore) The name "UnlockFn" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type UnlockFn = () => void; + +// @public +export interface UpdateNotification extends TableUpdateOperation { + // (undocumented) + table: string; +} + +// @public +export enum UpdateType { + DELETE = "DELETE", + PATCH = "PATCH", + PUT = "PUT" +} + +// @public (undocumented) +export class UploadQueueStats { + constructor( + count: number, + size?: number | null); + count: number; + size: number | null; + // (undocumented) + toString(): string; +} + +// @public (undocumented) +export interface WatchCompatibleQuery { + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(options: WatchExecuteOptions): Promise; +} + +// @alpha +export type WatchedAttachmentItem = { + id: string; + filename: string; + fileExtension?: never; + metaData?: string; + mediaType?: string; +} | { + id: string; + fileExtension: string; + filename?: never; + metaData?: string; + mediaType?: string; +}; + +// Warning: (ae-forgotten-export) The symbol "MetaBaseObserverInterface" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export interface WatchedQuery = WatchedQueryListener> extends MetaBaseObserverInterface { + close(): Promise; + // (undocumented) + readonly closed: boolean; + registerListener(listener: Listener): () => void; + readonly state: WatchedQueryState; + updateSettings(options: Settings): Promise; +} + +// @public +export interface WatchedQueryComparator { + // (undocumented) + checkEquality: (current: Data, previous: Data) => boolean; +} + +// @public +export interface WatchedQueryDifferential { + // (undocumented) + readonly added: ReadonlyArray>; + readonly all: ReadonlyArray>; + // (undocumented) + readonly removed: ReadonlyArray>; + // (undocumented) + readonly unchanged: ReadonlyArray>; + // (undocumented) + readonly updated: ReadonlyArray>>; +} + +// @public (undocumented) +export interface WatchedQueryListener extends BaseListener { + // (undocumented) + [WatchedQueryListenerEvent.CLOSED]?: () => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_DATA]?: (data: Data) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_ERROR]?: (error: Error) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_STATE_CHANGE]?: (state: WatchedQueryState) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.SETTINGS_WILL_UPDATE]?: () => void; +} + +// @public (undocumented) +export enum WatchedQueryListenerEvent { + // (undocumented) + CLOSED = "closed", + // (undocumented) + ON_DATA = "onData", + // (undocumented) + ON_ERROR = "onError", + // (undocumented) + ON_STATE_CHANGE = "onStateChange", + // (undocumented) + SETTINGS_WILL_UPDATE = "settingsWillUpdate" +} + +// @public (undocumented) +export interface WatchedQueryOptions { + reportFetching?: boolean; + throttleMs?: number; + triggerOnTables?: string[]; +} + +// @public +export interface WatchedQueryRowDifferential { + // (undocumented) + readonly current: RowType; + // (undocumented) + readonly previous: RowType; +} + +// @public +export interface WatchedQuerySettings extends WatchedQueryOptions { + // (undocumented) + query: WatchCompatibleQuery; +} + +// @public +export interface WatchedQueryState { + readonly data: Data; + readonly error: Error | null; + readonly isFetching: boolean; + readonly isLoading: boolean; + readonly lastUpdated: Date | null; +} + +// @public +export interface WatchExecuteOptions { + // (undocumented) + db: AbstractPowerSyncDatabase; + // (undocumented) + parameters: any[]; + // (undocumented) + sql: string; +} + +// @public (undocumented) +export interface WatchHandler { + // (undocumented) + onError?: (error: Error) => void; + // (undocumented) + onResult: (results: QueryResult) => void; +} + +// @public (undocumented) +export interface WatchOnChangeEvent { + // (undocumented) + changedTables: string[]; +} + +// @public (undocumented) +export interface WatchOnChangeHandler { + // (undocumented) + onChange: (event: WatchOnChangeEvent) => Promise | void; + // (undocumented) + onError?: (error: Error) => void; +} + +// @alpha +export interface WithDiffOptions { + castOperationIdAsText?: boolean; +} + +// Warnings were encountered during analysis: +// +// lib/db/crud/SyncStatus.d.ts:27:5 - (ae-forgotten-export) The symbol "InternalProgressInformation" needs to be exported by the entry point index.d.ts +// lib/db/crud/SyncStatus.d.ts:31:5 - (ae-forgotten-export) The symbol "CoreStreamSubscription" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` From 6f2cff487bbda11803ca8688647fd1173d16cb3d Mon Sep 17 00:00:00 2001 From: Christiaan Landman Date: Wed, 10 Jun 2026 15:04:47 +0200 Subject: [PATCH 5/5] Changed api-extractor option to `lf` newlines. --- packages/common/api-extractor.json | 2 +- packages/common/etc/common.api.md | 4882 ++++++++++++++-------------- 2 files changed, 2442 insertions(+), 2442 deletions(-) diff --git a/packages/common/api-extractor.json b/packages/common/api-extractor.json index 7078885d1..2218e31d6 100644 --- a/packages/common/api-extractor.json +++ b/packages/common/api-extractor.json @@ -76,7 +76,7 @@ * * DEFAULT VALUE: "crlf" */ - // "newlineKind": "crlf", + "newlineKind": "lf", /** * Specifies how API Extractor sorts members of an enum when generating the .api.json file. By default, the output diff --git a/packages/common/etc/common.api.md b/packages/common/etc/common.api.md index 64bf23062..f2816502d 100644 --- a/packages/common/etc/common.api.md +++ b/packages/common/etc/common.api.md @@ -1,2441 +1,2441 @@ -## API Report File for "@powersync/common" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { fetch as fetch_2 } from 'cross-fetch'; -import { GlobalLogger } from 'js-logger'; -import { ILogger } from 'js-logger'; -import { ILoggerOpts } from 'js-logger'; -import { ILogHandler } from 'js-logger'; -import { ILogLevel } from 'js-logger'; -import Logger from 'js-logger'; - -// Warning: (ae-internal-missing-underscore) The name "AbortOperation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class AbortOperation extends Error { - constructor(reason: string); - // (undocumented) - protected reason: string; -} - -// Warning: (ae-incompatible-release-tags) The symbol "AbstractPowerSyncDatabase" is marked as @public, but its signature references "BaseObserver" which is marked as @internal -// -// @public (undocumented) -export abstract class AbstractPowerSyncDatabase extends BaseObserver { - constructor(options: PowerSyncDatabaseOptionsWithDBAdapter); - constructor(options: PowerSyncDatabaseOptionsWithOpenFactory); - constructor(options: PowerSyncDatabaseOptionsWithSettings); - constructor(options: PowerSyncDatabaseOptions); - // Warning: (ae-incompatible-release-tags) The symbol "bucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal - // - // (undocumented) - protected bucketStorageAdapter: BucketStorageAdapter; - close(options?: PowerSyncCloseOptions): Promise; - closed: boolean; - connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise; - get connected(): boolean; - // (undocumented) - get connecting(): boolean; - // Warning: (ae-incompatible-release-tags) The symbol "connectionManager" is marked as @public, but its signature references "ConnectionManager" which is marked as @internal - // - // (undocumented) - protected connectionManager: ConnectionManager; - // Warning: (ae-incompatible-release-tags) The symbol "connectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal - get connectionOptions(): InternalConnectionOptions | null; - get connector(): PowerSyncBackendConnector | null; - currentStatus: SyncStatus; - customQuery(query: WatchCompatibleQuery): Query; - get database(): DBAdapter; - disconnect(): Promise; - disconnectAndClear(options?: DisconnectAndClearOptions): Promise; - // @deprecated (undocumented) - dispose(): void; - execute(sql: string, parameters?: any[]): Promise; - executeBatch(sql: string, parameters?: any[][]): Promise; - executeRaw(sql: string, parameters?: any[]): Promise; - // Warning: (ae-incompatible-release-tags) The symbol "generateBucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal - // - // (undocumented) - protected abstract generateBucketStorageAdapter(): BucketStorageAdapter; - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal - // - // (undocumented) - protected abstract generateSyncStreamImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions): StreamingSyncImplementation; - // Warning: (ae-incompatible-release-tags) The symbol "generateTriggerManagerConfig" is marked as @public, but its signature references "TriggerManagerConfig" which is marked as @internal - protected generateTriggerManagerConfig(): TriggerManagerConfig; - get(sql: string, parameters?: any[]): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getClientId(): Promise; - getCrudBatch(limit?: number): Promise; - getCrudTransactions(): AsyncIterable; - getNextCrudTransaction(): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - getUploadQueueStats(includeSize?: boolean): Promise; - init(): Promise; - protected initialize(): Promise; - abstract _initialize(): Promise; - // (undocumented) - protected _isReadyPromise: Promise; - // (undocumented) - protected loadVersion(): Promise; - // (undocumented) - logger: ILogger; - onChange(options?: SQLOnChangeOptions): AsyncIterable; - onChange(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; - onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable; - onChangeWithCallback(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; - protected abstract openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter; - // (undocumented) - protected options: PowerSyncDatabaseOptions; - query(query: ArrayQueryDefinition): Query; - readLock(callback: (db: LockContext) => Promise): Promise; - readTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; - // (undocumented) - ready: boolean; - // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal - // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal - // - // (undocumented) - protected resolvedConnectionOptions(options: CreateSyncImplementationOptions): CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions; - // (undocumented) - protected resolveOfflineSyncStatus(): Promise; - resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise; - protected runExclusive(callback: () => Promise): Promise; - // Warning: (ae-incompatible-release-tags) The symbol "runExclusiveMutex" is marked as @public, but its signature references "Mutex" which is marked as @internal - // - // (undocumented) - protected runExclusiveMutex: Mutex; - get schema(): Schema<{ - [x: string]: Table; - }>; - // (undocumented) - protected _schema: Schema; - // (undocumented) - sdkVersion: string; - syncStream(name: string, params?: Record): SyncStream; - // Warning: (ae-incompatible-release-tags) The symbol "syncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal - // - // (undocumented) - get syncStreamImplementation(): StreamingSyncImplementation | null; - // Warning: (ae-incompatible-release-tags) The symbol "triggers" is marked as @public, but its signature references "TriggerManager" which is marked as @alpha - readonly triggers: TriggerManager; - // Warning: (ae-incompatible-release-tags) The symbol "triggersImpl" is marked as @public, but its signature references "TriggerManagerImpl" which is marked as @internal - // - // (undocumented) - protected triggersImpl: TriggerManagerImpl; - updateSchema(schema: Schema): Promise; - waitForFirstSync(request?: AbortSignal | { - signal?: AbortSignal; - priority?: number; - }): Promise; - // (undocumented) - waitForReady(): Promise; - waitForStatus(predicate: (status: SyncStatus) => any, signal?: AbortSignal): Promise; - watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; - watch(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; - watchWithAsyncGenerator(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; - watchWithCallback(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; - writeLock(callback: (db: LockContext) => Promise): Promise; - writeTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractPowerSyncDatabaseOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractPowerSyncDatabaseOpenFactory { - constructor(options: PowerSyncOpenFactoryOptions); - // (undocumented) - abstract generateInstance(options: PowerSyncDatabaseOptions): AbstractPowerSyncDatabase; - // (undocumented) - generateOptions(): PowerSyncDatabaseOptions; - // (undocumented) - getInstance(): AbstractPowerSyncDatabase; - // (undocumented) - protected abstract openDB(): DBAdapter; - // (undocumented) - protected options: PowerSyncOpenFactoryOptions; - get schema(): Schema<{ - [x: string]: Table; - }>; -} - -// Warning: (ae-forgotten-export) The symbol "MetaBaseObserver" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "WatchedQueryProcessorListener" needs to be exported by the entry point index.d.ts -// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export abstract class AbstractQueryProcessor extends MetaBaseObserver> implements WatchedQuery { - constructor(options: AbstractQueryProcessorOptions); - // (undocumented) - protected abortController: AbortController; - // (undocumented) - close(): Promise; - // (undocumented) - get closed(): boolean; - // (undocumented) - protected _closed: boolean; - // (undocumented) - protected constructInitialState(): WatchedQueryState; - // (undocumented) - protected disposeListeners: (() => void) | null; - protected init(signal: AbortSignal): Promise; - // (undocumented) - protected initialized: Promise; - protected iterateAsyncListenersWithError(callback: (listener: Partial>) => Promise | void): Promise; - protected abstract linkQuery(options: LinkQueryOptions): Promise; - // (undocumented) - protected options: AbstractQueryProcessorOptions; - // (undocumented) - protected get reportFetching(): boolean; - protected runWithReporting(callback: () => Promise): Promise; - // (undocumented) - readonly state: WatchedQueryState; - updateSettings(settings: Settings): Promise; - // (undocumented) - protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise; - // (undocumented) - protected updateState(update: Partial>): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AbstractQueryProcessorOptions { - // (undocumented) - db: AbstractPowerSyncDatabase; - // (undocumented) - placeholderData: Data; - // (undocumented) - watchOptions: Settings; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractRemote" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractRemote { - constructor(connector: RemoteConnector, logger?: ILogger, options?: Partial); - // (undocumented) - protected buildRequest(path: string): Promise<{ - url: string; - headers: { - 'content-type': string; - Authorization: string; - 'x-user-agent': string; - }; - }>; - // (undocumented) - protected connector: RemoteConnector; - // (undocumented) - protected createSocket(url: string): WebSocket; - // (undocumented) - createTextDecoder(): TextDecoder; - // (undocumented) - protected credentials: PowerSyncCredentials | null; - // (undocumented) - get fetch(): FetchImplementation; - fetchCredentials(): Promise; - fetchStream(options: SyncStreamOptions): Promise>; - protected fetchStreamRaw(options: SyncStreamOptions): Promise<{ - isBson: boolean; - stream: SimpleAsyncIterator; - }>; - // (undocumented) - get(path: string, headers?: Record): Promise; - getCredentials(): Promise; - // (undocumented) - getUserAgent(): string; - invalidateCredentials(): void; - // (undocumented) - protected logger: ILogger; - // (undocumented) - protected options: AbstractRemoteOptions; - // (undocumented) - post(path: string, data: any, headers?: Record): Promise; - prefetchCredentials(): Promise; - socketStreamRaw(options: SocketSyncStreamOptions): Promise>; - // (undocumented) - protected get supportsStreamingBinaryResponses(): boolean; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractRemoteOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type AbstractRemoteOptions = { - socketUrlTransformer: (url: string) => string; - fetchImplementation: FetchImplementation | FetchImplementationProvider; - fetchOptions?: {}; -}; - -// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export abstract class AbstractStreamingSyncImplementation extends BaseObserver implements StreamingSyncImplementation { - constructor(options: AbstractStreamingSyncImplementationOptions); - // (undocumented) - protected abortController: AbortController | null; - // (undocumented) - connect(options?: PowerSyncConnectionOptions): Promise; - // (undocumented) - protected crudUpdateListener?: () => void; - // (undocumented) - disconnect(): Promise; - // (undocumented) - dispose(): Promise; - // (undocumented) - getWriteCheckpoint(): Promise; - // (undocumented) - get isConnected(): boolean; - // (undocumented) - get lastSyncedAt(): Date | undefined; - // (undocumented) - protected logger: ILogger; - // (undocumented) - markConnectionMayHaveChanged(): void; - // (undocumented) - abstract obtainLock(lockOptions: LockOptions_2): Promise; - // (undocumented) - protected options: AbstractStreamingSyncImplementationOptions; - // Warning: (ae-forgotten-export) The symbol "RustIterationResult" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected streamingSyncIteration(signal: AbortSignal, options?: PowerSyncConnectionOptions): Promise; - // (undocumented) - protected streamingSyncPromise?: Promise<[void, void]>; - // (undocumented) - syncStatus: SyncStatus; - // (undocumented) - triggerCrudUpload(): void; - // (undocumented) - updateSubscriptions(subscriptions: SubscribedStream[]): void; - // (undocumented) - protected updateSyncStatus(options: SyncStatusOptions): void; - // (undocumented) - waitForReady(): Promise; - // (undocumented) - waitForStatus(status: SyncStatusOptions): Promise; - // (undocumented) - waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AbstractStreamingSyncImplementationOptions extends RequiredAdditionalConnectionOptions { - // (undocumented) - adapter: BucketStorageAdapter; - identifier?: string; - // (undocumented) - logger?: ILogger; - // (undocumented) - remote: AbstractRemote; - // (undocumented) - subscriptions: SubscribedStream[]; - // (undocumented) - uploadCrud: () => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "AdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface AdditionalConnectionOptions { - crudUploadThrottleMs?: number; - retryDelayMs?: number; -} - -// @public -export class ArrayComparator implements WatchedQueryComparator { - constructor(options: ArrayComparatorOptions); - // (undocumented) - checkEquality(current: ItemType[], previous: ItemType[]): boolean; - // (undocumented) - protected options: ArrayComparatorOptions; -} - -// @public -export type ArrayComparatorOptions = { - compareBy: (item: ItemType) => string; -}; - -// @public -export interface ArrayQueryDefinition { - mapper?: (row: Record) => RowType; - // (undocumented) - parameters?: ReadonlyArray>; - // (undocumented) - sql: string; -} - -// @alpha -export const ATTACHMENT_TABLE = "attachments"; - -// @alpha -export class AttachmentContext { - constructor(db: AbstractPowerSyncDatabase, tableName: string | undefined, logger: ILogger, archivedCacheLimit: number); - readonly archivedCacheLimit: number; - // (undocumented) - clearQueue(): Promise; - readonly db: AbstractPowerSyncDatabase; - // (undocumented) - deleteArchivedAttachments(callback?: (attachments: AttachmentRecord[]) => Promise): Promise; - deleteAttachment(attachmentId: string): Promise; - getActiveAttachments(): Promise; - getArchivedAttachments(): Promise; - // (undocumented) - getAttachment(id: string): Promise; - getAttachments(): Promise; - readonly logger: ILogger; - saveAttachments(attachments: AttachmentRecord[]): Promise; - readonly tableName: string; - upsertAttachment(attachment: AttachmentRecord, context: Transaction): Promise; -} - -// @alpha (undocumented) -export type AttachmentData = ArrayBuffer | string; - -// @alpha -export interface AttachmentErrorHandler { - onDeleteError(attachment: AttachmentRecord, error: unknown): Promise; - onDownloadError(attachment: AttachmentRecord, error: unknown): Promise; - onUploadError(attachment: AttachmentRecord, error: unknown): Promise; -} - -// @alpha -export function attachmentFromSql(row: any): AttachmentRecord; - -// @alpha -export class AttachmentQueue implements AttachmentQueue { - constructor(input: { - db: AbstractPowerSyncDatabase; - remoteStorage: RemoteStorageAdapter; - localStorage: LocalStorageAdapter; - watchAttachments: (onUpdate: (attachment: WatchedAttachmentItem[]) => Promise, signal: AbortSignal) => void; - tableName?: string; - logger?: ILogger; - syncIntervalMs?: number; - syncThrottleDuration?: number; - downloadAttachments?: boolean; - archivedCacheLimit?: number; - errorHandler?: AttachmentErrorHandler; - }); - readonly archivedCacheLimit: number; - // (undocumented) - clearQueue(): Promise; - // (undocumented) - deleteFile(input: { - id: string; - updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; - }): Promise; - readonly downloadAttachments: boolean; - // (undocumented) - expireCache(): Promise; - generateAttachmentId(): Promise; - readonly localStorage: LocalStorageAdapter; - readonly logger: ILogger; - readonly remoteStorage: RemoteStorageAdapter; - saveFile(input: { - data: AttachmentData; - fileExtension: string; - mediaType?: string; - metaData?: string; - id?: string; - updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; - }): Promise; - startSync(): Promise; - stopSync(): Promise; - readonly syncIntervalMs: number; - syncStorage(): Promise; - readonly syncThrottleDuration: number; - readonly tableName: string; - verifyAttachments(): Promise; - withAttachmentContext(callback: (context: AttachmentContext) => Promise): Promise; -} - -// @alpha -export interface AttachmentRecord { - // (undocumented) - filename: string; - // (undocumented) - hasSynced?: boolean; - // (undocumented) - id: string; - // (undocumented) - localUri?: string; - // (undocumented) - mediaType?: string; - // (undocumented) - metaData?: string; - // (undocumented) - size?: number; - // (undocumented) - state: AttachmentState; - // (undocumented) - timestamp?: number; -} - -// Warning: (ae-internal-missing-underscore) The name "AttachmentService" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class AttachmentService { - constructor(db: AbstractPowerSyncDatabase, logger: ILogger, tableName?: string, archivedCacheLimit?: number); - watchActiveAttachments(input?: { - throttleMs?: number; - }): DifferentialWatchedQuery; - withContext(callback: (context: AttachmentContext) => Promise): Promise; -} - -// @alpha -export enum AttachmentState { - // (undocumented) - ARCHIVED = 4,// Attachment to be uploaded - // (undocumented) - QUEUED_DELETE = 2,// Attachment to be downloaded - // (undocumented) - QUEUED_DOWNLOAD = 1,// Attachment to be deleted - // (undocumented) - QUEUED_UPLOAD = 0,// Attachment has been synced - // (undocumented) - SYNCED = 3 -} - -// @alpha -export class AttachmentTable extends Table { - constructor(options?: AttachmentTableOptions); -} - -// @alpha (undocumented) -export interface AttachmentTableOptions extends Omit { -} - -// @public (undocumented) -export type BaseColumnType = { - type: ColumnType; -}; - -// @public (undocumented) -export interface BaseConnectionOptions { - appMetadata?: Record; - // @deprecated (undocumented) - clientImplementation?: SyncClientImplementation; - connectionMethod?: SyncStreamConnectionMethod; - fetchStrategy?: FetchStrategy; - includeDefaultStreams?: boolean; - params?: Record; - serializedSchema?: any; -} - -// @public (undocumented) -export type BaseListener = Record any) | undefined>; - -// Warning: (ae-internal-missing-underscore) The name "BaseObserver" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class BaseObserver implements BaseObserverInterface { - constructor(); - // (undocumented) - dispose(): void; - // (undocumented) - iterateAsyncListeners(cb: (listener: Partial) => Promise): Promise; - // (undocumented) - iterateListeners(cb: (listener: Partial) => any): void; - // (undocumented) - protected listeners: Set>; - registerListener(listener: Partial): () => void; -} - -// @public (undocumented) -export interface BaseObserverInterface { - // (undocumented) - registerListener(listener: Partial): () => void; -} - -// Warning: (ae-incompatible-release-tags) The symbol "BasePowerSyncDatabaseOptions" is marked as @public, but its signature references "AdditionalConnectionOptions" which is marked as @internal -// -// @public (undocumented) -export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions { - // (undocumented) - logger?: ILogger; - // @deprecated (undocumented) - retryDelay?: number; - schema: Schema; -} - -// @alpha -export interface BaseTriggerDiffRecord { - id: string; - operation: DiffTriggerOperation; - operation_id: TOperationId; - timestamp: string; -} - -// @public (undocumented) -export interface BatchedUpdateNotification { - // (undocumented) - groupedUpdates: Record; - // (undocumented) - rawUpdates: UpdateNotification[]; - // (undocumented) - tables: string[]; -} - -// Warning: (ae-internal-missing-underscore) The name "BucketStorageAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface BucketStorageAdapter extends BaseObserverInterface, Disposable_2 { - control(op: PowerSyncControlCommand, payload: string | Uint8Array | null): Promise; - getClientId(): Promise; - // (undocumented) - getCrudBatch(limit?: number): Promise; - // (undocumented) - getMaxOpId(): string; - // (undocumented) - hasCrud(): Promise; - // (undocumented) - hasMigratedSubkeys(): Promise; - // (undocumented) - init(): Promise; - // (undocumented) - migrateToFixedSubkeys(): Promise; - // (undocumented) - nextCrudItem(): Promise; - // (undocumented) - updateLocalTarget(cb: () => Promise): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "BucketStorageListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface BucketStorageListener extends BaseListener { - // (undocumented) - crudUpdate: () => void; -} - -// @public (undocumented) -export class Column { - constructor(options: ColumnOptions); - // (undocumented) - get name(): string; - // (undocumented) - protected options: ColumnOptions; - // (undocumented) - toJSON(): { - name: string; - type: ColumnType | undefined; - }; - // (undocumented) - get type(): ColumnType | undefined; -} - -// @public (undocumented) -export const column: { - text: BaseColumnType; - integer: BaseColumnType; - real: BaseColumnType; -}; - -// @public (undocumented) -export interface ColumnOptions { - // (undocumented) - name: string; - // (undocumented) - type?: ColumnType; -} - -// @public (undocumented) -export type ColumnsType = Record>; - -// @public (undocumented) -export enum ColumnType { - // (undocumented) - INTEGER = "INTEGER", - // (undocumented) - REAL = "REAL", - // (undocumented) - TEXT = "TEXT" -} - -// @public (undocumented) -export interface CompilableQuery { - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(): Promise; -} - -// @public (undocumented) -export function compilableQueryWatch(db: AbstractPowerSyncDatabase, query: CompilableQuery, handler: CompilableQueryWatchHandler, options?: SQLWatchOptions): void; - -// @public (undocumented) -export interface CompilableQueryWatchHandler { - // (undocumented) - onError?: (error: Error) => void; - // (undocumented) - onResult: (results: T[]) => void; -} - -// @public (undocumented) -export interface CompiledQuery { - // (undocumented) - readonly parameters: ReadonlyArray; - // (undocumented) - readonly sql: string; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionClosedError" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class ConnectionClosedError extends Error { - constructor(message: string); - // (undocumented) - static MATCHES(input: any): boolean; - // (undocumented) - static NAME: string; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManager" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class ConnectionManager extends BaseObserver { - constructor(options: ConnectionManagerOptions); - get activeStreams(): { - name: string; - params: Record | null; - }[]; - // (undocumented) - close(): Promise; - // (undocumented) - connect(connector: PowerSyncBackendConnector, options: InternalConnectionOptions): Promise; - protected connectingPromise: Promise | null; - // (undocumented) - protected connectInternal(): Promise; - // (undocumented) - get connectionOptions(): InternalConnectionOptions | null; - // (undocumented) - get connector(): PowerSyncBackendConnector | null; - disconnect(): Promise; - protected disconnectingPromise: Promise | null; - // (undocumented) - protected disconnectInternal(): Promise; - // (undocumented) - get logger(): ILogger; - // (undocumented) - protected options: ConnectionManagerOptions; - // Warning: (ae-forgotten-export) The symbol "StoredConnectionOptions" needs to be exported by the entry point index.d.ts - protected pendingConnectionOptions: StoredConnectionOptions | null; - // (undocumented) - protected performDisconnect(): Promise; - // (undocumented) - stream(adapter: InternalSubscriptionAdapter, name: string, parameters: Record | null): SyncStream; - protected syncDisposer: (() => Promise | void) | null; - // (undocumented) - syncStreamImplementation: StreamingSyncImplementation | null; - protected syncStreamInitPromise: Promise | null; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerListener extends BaseListener { - // (undocumented) - syncStreamCreated: (sync: StreamingSyncImplementation) => void; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerOptions { - // (undocumented) - createSyncImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions): Promise; - // (undocumented) - logger: ILogger; -} - -// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerSyncImplementationResult" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ConnectionManagerSyncImplementationResult { - onDispose: () => Promise | void; - // (undocumented) - sync: StreamingSyncImplementation; -} - -// @public (undocumented) -export interface ConnectionPool extends BaseObserverInterface { - // (undocumented) - close: () => void | Promise; - // (undocumented) - name: string; - // (undocumented) - readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - refreshSchema: () => Promise; - // (undocumented) - writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "ControlledExecutor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class ControlledExecutor { - constructor(task: (param: T) => Promise | void, options?: ControlledExecutorOptions); - // (undocumented) - dispose(): void; - // (undocumented) - schedule(param: T): void; -} - -// Warning: (ae-internal-missing-underscore) The name "ControlledExecutorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ControlledExecutorOptions { - throttleEnabled?: boolean; -} - -// @public -export function createBaseLogger(): typeof Logger; - -// Warning: (ae-forgotten-export) The symbol "BaseCreateDiffTriggerOptions" needs to be exported by the entry point index.d.ts -// -// @alpha -export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions { - destination: string; - setupContext?: LockContext; -} - -// @public -export function createLogger(name: string, options?: CreateLoggerOptions): ILogger; - -// @public (undocumented) -export interface CreateLoggerOptions { - // (undocumented) - logLevel?: ILogLevel; -} - -// Warning: (ae-internal-missing-underscore) The name "CreateSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export interface CreateSyncImplementationOptions extends AdditionalConnectionOptions { - // (undocumented) - subscriptions: SubscribedStream[]; -} - -// @public -export class CrudBatch { - constructor( - crud: CrudEntry[], - haveMore: boolean, - complete: (writeCheckpoint?: string) => Promise); - complete: (writeCheckpoint?: string) => Promise; - crud: CrudEntry[]; - haveMore: boolean; -} - -// @public -export class CrudEntry { - constructor(clientId: number, op: UpdateType, table: string, id: string, transactionId?: number, opData?: Record, previousValues?: Record, metadata?: string); - clientId: number; - // (undocumented) - equals(entry: CrudEntry): boolean; - // Warning: (ae-forgotten-export) The symbol "CrudEntryJSON" needs to be exported by the entry point index.d.ts - // - // (undocumented) - static fromRow(dbRow: CrudEntryJSON): CrudEntry; - // @deprecated - hashCode(): string; - id: string; - metadata?: string; - op: UpdateType; - opData?: Record; - previousValues?: Record; - table: string; - toComparisonArray(): (string | number | Record | undefined)[]; - // Warning: (ae-forgotten-export) The symbol "CrudEntryOutputJSON" needs to be exported by the entry point index.d.ts - toJSON(): CrudEntryOutputJSON; - transactionId?: number; -} - -// @public (undocumented) -export class CrudTransaction extends CrudBatch { - constructor( - crud: CrudEntry[], - complete: (checkpoint?: string) => Promise, - transactionId?: number | undefined); - complete: (checkpoint?: string) => Promise; - crud: CrudEntry[]; - transactionId?: number | undefined; -} - -// @public (undocumented) -export interface DBAdapter extends ConnectionPool, SqlExecutor, DBGetUtils { - // (undocumented) - readTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; - // (undocumented) - writeTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "DBAdapterDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function DBAdapterDefaultMixin ConnectionPool>(Base: TBase): { - new (...args: any[]): { - readTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; - writeTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - get(sql: string, parameters?: any[]): Promise; - execute(query: string, params?: any[]): Promise; - executeRaw(query: string, params?: any[]): Promise; - executeBatch(query: string, params?: any[][]): Promise; - name: string; - close: () => void | Promise; - readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; - refreshSchema: () => Promise; - registerListener(listener: Partial): () => void; - }; -} & TBase; - -// @public (undocumented) -export interface DBAdapterListener extends BaseListener { - tablesUpdated: (updateNotification: BatchedUpdateNotification | UpdateNotification) => void; -} - -// @public (undocumented) -export interface DBGetUtils { - get(sql: string, parameters?: any[]): Promise; - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "DBGetUtilsDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function DBGetUtilsDefaultMixin Omit>(Base: TBase): { - new (...args: any[]): { - getAll(sql: string, parameters?: any[]): Promise; - getOptional(sql: string, parameters?: any[]): Promise; - get(sql: string, parameters?: any[]): Promise; - executeBatch(query: string, params?: any[][]): Promise; - execute: (query: string, params?: any[] | undefined) => Promise; - executeRaw: (query: string, params?: any[] | undefined) => Promise; - }; -} & TBase; - -// @public (undocumented) -export interface DBLockOptions { - // (undocumented) - timeoutMs?: number; -} - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_BATCH_LIMIT" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_CRUD_BATCH_LIMIT = 100; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_UPLOAD_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_COLUMN_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_INDEX_COLUMN_OPTIONS: Partial; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_INDEX_OPTIONS: Partial; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_LOCK_TIMEOUT_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const DEFAULT_LOCK_TIMEOUT_MS = 120000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_CLOSE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_DB_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_POWERSYNC_DB_OPTIONS: { - retryDelayMs: number; - crudUploadThrottleMs: number; -}; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_LOGGER" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_REMOTE_LOGGER: Logger.ILogger; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_RETRY_DELAY_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_RETRY_DELAY_MS = 5000; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_ROW_COMPARATOR" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const DEFAULT_ROW_COMPARATOR: DifferentialWatchedQueryComparator; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAM_CONNECTION_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAMING_SYNC_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_STREAMING_SYNC_OPTIONS: { - retryDelayMs: number; - crudUploadThrottleMs: number; -}; - -// @public @deprecated -export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_TABLE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_TABLE_OPTIONS: { - indexes: never[]; - insertOnly: boolean; - localOnly: boolean; - trackPrevious: boolean; - trackMetadata: boolean; - ignoreEmptyUpdates: boolean; -}; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_QUERY_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_WATCH_QUERY_OPTIONS: WatchedQueryOptions; - -// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const DEFAULT_WATCH_THROTTLE_MS = 30; - -// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class DifferentialQueryProcessor extends AbstractQueryProcessor>, DifferentialWatchedQuerySettings> implements DifferentialWatchedQuery { - constructor(options: DifferentialQueryProcessorOptions); - // (undocumented) - protected comparator: DifferentialWatchedQueryComparator; - // Warning: (ae-forgotten-export) The symbol "DataHashMap" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected differentiate(current: RowType[], previousMap: DataHashMap): { - diff: WatchedQueryDifferential; - map: DataHashMap; - hasChanged: boolean; - }; - // (undocumented) - protected linkQuery(options: LinkQueryOptions>): Promise; - // (undocumented) - protected options: DifferentialQueryProcessorOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface DifferentialQueryProcessorOptions extends AbstractQueryProcessorOptions> { - // (undocumented) - rowComparator?: DifferentialWatchedQueryComparator; -} - -// @public (undocumented) -export type DifferentialWatchedQuery = WatchedQuery>, DifferentialWatchedQuerySettings, DifferentialWatchedQueryListener>; - -// @public -export interface DifferentialWatchedQueryComparator { - compareBy: (item: RowType) => string; - keyBy: (item: RowType) => string; -} - -// @public (undocumented) -export interface DifferentialWatchedQueryListener extends WatchedQueryListener>> { - // (undocumented) - onDiff?: (diff: WatchedQueryDifferential) => void | Promise; -} - -// @public -export interface DifferentialWatchedQueryOptions extends WatchedQueryOptions { - placeholderData?: RowType[]; - rowComparator?: DifferentialWatchedQueryComparator; -} - -// @public -export interface DifferentialWatchedQuerySettings extends DifferentialWatchedQueryOptions { - query: WatchCompatibleQuery; -} - -// @alpha -export enum DiffTriggerOperation { - // (undocumented) - DELETE = "DELETE", - // (undocumented) - INSERT = "INSERT", - // (undocumented) - UPDATE = "UPDATE" -} - -// @public (undocumented) -export interface DisconnectAndClearOptions { - clearLocal?: boolean; -} - -// @public (undocumented) -interface Disposable_2 { - // (undocumented) - dispose: () => Promise | void; -} -export { Disposable_2 as Disposable } - -// Warning: (ae-internal-missing-underscore) The name "EMPTY_DIFFERENTIAL" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const EMPTY_DIFFERENTIAL: { - added: never[]; - all: never[]; - removed: never[]; - updated: never[]; - unchanged: never[]; -}; - -// @alpha (undocumented) -export enum EncodingType { - // (undocumented) - Base64 = "base64", - // (undocumented) - UTF8 = "utf8" -} - -// @public (undocumented) -export type ExtractColumnValueType> = T extends BaseColumnType ? R : unknown; - -// @alpha -export type ExtractedTriggerDiffRecord = T & { - [K in keyof Omit, 'id'> as `__${string & K}`]: TriggerDiffRecord[K]; -} & { - __previous_value?: string; -}; - -// Warning: (ae-internal-missing-underscore) The name "extractTableUpdates" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function extractTableUpdates(update: BatchedUpdateNotification | UpdateNotification): string[]; - -// @public -export const FalsyComparator: WatchedQueryComparator; - -// Warning: (ae-internal-missing-underscore) The name "FetchImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type FetchImplementation = typeof fetch_2; - -// Warning: (ae-internal-missing-underscore) The name "FetchImplementationProvider" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class FetchImplementationProvider { - // (undocumented) - getFetch(): FetchImplementation; -} - -// @public (undocumented) -export enum FetchStrategy { - Buffered = "buffered", - Sequential = "sequential" -} - -// @public -export class GetAllQuery implements WatchCompatibleQuery { - constructor(options: GetAllQueryOptions); - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(options: { - db: AbstractPowerSyncDatabase; - }): Promise; - // (undocumented) - protected options: GetAllQueryOptions; -} - -// @public -export type GetAllQueryOptions = { - sql: string; - parameters?: ReadonlyArray; - mapper?: (rawRow: Record) => RowType; -}; - -export { GlobalLogger } - -export { ILogger } - -export { ILoggerOpts } - -export { ILogHandler } - -export { ILogLevel } - -// @public (undocumented) -export class Index { - constructor(options: IndexOptions); - // (undocumented) - get columns(): IndexedColumn[]; - // (undocumented) - static createAscending(options: IndexOptions, columnNames: string[]): Index; - // (undocumented) - get name(): string; - // (undocumented) - protected options: IndexOptions; - // (undocumented) - toJSON(table: Table): { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }; -} - -// @public (undocumented) -export interface IndexColumnOptions { - // (undocumented) - ascending?: boolean; - // (undocumented) - name: string; -} - -// @public (undocumented) -export class IndexedColumn { - constructor(options: IndexColumnOptions); - // (undocumented) - get ascending(): boolean | undefined; - // (undocumented) - static createAscending(column: string): IndexedColumn; - // (undocumented) - get name(): string; - // (undocumented) - protected options: IndexColumnOptions; - // (undocumented) - toJSON(table: Table): { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }; -} - -// @public (undocumented) -export interface IndexOptions { - // (undocumented) - columns?: IndexedColumn[]; - // (undocumented) - name: string; -} - -// @public (undocumented) -export type IndexShorthand = Record; - -// Warning: (ae-internal-missing-underscore) The name "InternalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions { -} - -// Warning: (ae-internal-missing-underscore) The name "InternalSubscriptionAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface InternalSubscriptionAdapter { - // (undocumented) - firstStatusMatching(predicate: (status: SyncStatus) => any, abort?: AbortSignal): Promise; - // (undocumented) - resolveOfflineSyncStatus(): Promise; - // (undocumented) - rustSubscriptionsCommand(payload: any): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "InvalidSQLCharacters" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const InvalidSQLCharacters: RegExp; - -// Warning: (ae-internal-missing-underscore) The name "isBatchedUpdateNotification" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function isBatchedUpdateNotification(update: BatchedUpdateNotification | UpdateNotification): update is BatchedUpdateNotification; - -// Warning: (ae-internal-missing-underscore) The name "isDBAdapter" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isDBAdapter: (test: any) => test is DBAdapter; - -// Warning: (ae-internal-missing-underscore) The name "isPowerSyncDatabaseOptionsWithSettings" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isPowerSyncDatabaseOptionsWithSettings: (test: any) => test is PowerSyncDatabaseOptionsWithSettings; - -// Warning: (ae-internal-missing-underscore) The name "isSQLOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isSQLOpenFactory: (test: any) => test is SQLOpenFactory; - -// Warning: (ae-internal-missing-underscore) The name "isSQLOpenOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const isSQLOpenOptions: (test: any) => test is SQLOpenOptions; - -// Warning: (ae-internal-missing-underscore) The name "LinkQueryOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface LinkQueryOptions { - // (undocumented) - abortSignal: AbortSignal; - // (undocumented) - settings: Settings; -} - -// @alpha -export interface LocalStorageAdapter { - clear(): Promise; - deleteFile(filePath: string): Promise; - fileExists(filePath: string): Promise; - getLocalUri(filename: string): string; - initialize(): Promise; - makeDir(path: string): Promise; - readFile(filePath: string): Promise; - rmDir(path: string): Promise; - saveFile(filePath: string, data: AttachmentData): Promise; -} - -// @public (undocumented) -export interface LockContext extends SqlExecutor, DBGetUtils { - connectionType?: 'writer' | 'queryOnly' | 'readOnly'; -} - -// @internal -interface LockOptions_2 { - // (undocumented) - callback: () => Promise; - // (undocumented) - signal?: AbortSignal; - // (undocumented) - type: LockType; -} - -// Warning: (ae-internal-missing-underscore) The name "LockOptions" should be prefixed with an underscore because the declaration is marked as @internal -export { LockOptions_2 as LockOptions } - -// Warning: (ae-internal-missing-underscore) The name "LockType" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum LockType { - // (undocumented) - CRUD = "crud", - // (undocumented) - SYNC = "sync" -} - -// @public (undocumented) -export const LogLevel: { - TRACE: Logger.ILogLevel; - DEBUG: Logger.ILogLevel; - INFO: Logger.ILogLevel; - TIME: Logger.ILogLevel; - WARN: Logger.ILogLevel; - ERROR: Logger.ILogLevel; - OFF: Logger.ILogLevel; -}; - -// Warning: (ae-internal-missing-underscore) The name "MAX_AMOUNT_OF_COLUMNS" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export const MAX_AMOUNT_OF_COLUMNS = 1999; - -// Warning: (ae-internal-missing-underscore) The name "MAX_OP_ID" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const MAX_OP_ID = "9223372036854775807"; - -// Warning: (ae-internal-missing-underscore) The name "MEMORY_TRIGGER_CLAIM_MANAGER" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const MEMORY_TRIGGER_CLAIM_MANAGER: TriggerClaimManager; - -// Warning: (ae-forgotten-export) The symbol "MutableDeep" needs to be exported by the entry point index.d.ts -// Warning: (ae-internal-missing-underscore) The name "MutableWatchedQueryState" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export type MutableWatchedQueryState = { - -readonly [P in keyof WatchedQueryState]: MutableDeep[P]>; -}; - -// Warning: (ae-internal-missing-underscore) The name "Mutex" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class Mutex { - // (undocumented) - acquire(abort?: AbortSignal): Promise; - // (undocumented) - runExclusive(fn: () => PromiseLike | T, abort?: AbortSignal): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class OnChangeQueryProcessor extends AbstractQueryProcessor> { - constructor(options: OnChangeQueryProcessorOptions); - // (undocumented) - protected checkEquality(current: Data, previous: Data): boolean; - // (undocumented) - protected linkQuery(options: LinkQueryOptions): Promise; - // (undocumented) - protected options: OnChangeQueryProcessorOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface OnChangeQueryProcessorOptions extends AbstractQueryProcessorOptions> { - // (undocumented) - comparator?: WatchedQueryComparator; -} - -// @public -export type OpId = string; - -// Warning: (ae-internal-missing-underscore) The name "ParsedQuery" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface ParsedQuery { - // (undocumented) - parameters: any[]; - // (undocumented) - sqlStatement: string; -} - -// Warning: (ae-internal-missing-underscore) The name "parseQuery" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export const parseQuery: (query: string | CompilableQuery, parameters: any[]) => ParsedQuery; - -// @public -export type PendingStatement = { - sql: string; - params: PendingStatementParameter[]; -}; - -// @public -export type PendingStatementParameter = 'Id' | { - Column: string; -} | 'Rest'; - -// @public (undocumented) -export interface PowerSyncBackendConnector { - fetchCredentials: () => Promise; - uploadData: (database: AbstractPowerSyncDatabase) => Promise; -} - -// @public (undocumented) -export interface PowerSyncCloseOptions { - disconnect?: boolean; -} - -// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncConnectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal -// -// @public -export type PowerSyncConnectionOptions = Omit; - -// Warning: (ae-internal-missing-underscore) The name "PowerSyncControlCommand" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum PowerSyncControlCommand { - CONNECTION_STATE = "connection", - // (undocumented) - NOTIFY_CRUD_UPLOAD_COMPLETED = "completed_upload", - // (undocumented) - NOTIFY_TOKEN_REFRESHED = "refreshed_token", - // (undocumented) - PROCESS_BSON_LINE = "line_binary", - // (undocumented) - PROCESS_TEXT_LINE = "line_text", - // (undocumented) - START = "start", - // (undocumented) - STOP = "stop", - // (undocumented) - UPDATE_SUBSCRIPTIONS = "update_subscriptions" -} - -// @public (undocumented) -export interface PowerSyncCredentials { - // (undocumented) - endpoint: string; - // (undocumented) - expiresAt?: Date; - // (undocumented) - token: string; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions { - database: DBAdapter | SQLOpenFactory | SQLOpenOptions; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithDBAdapter extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: DBAdapter; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithOpenFactory extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: SQLOpenFactory; -} - -// @public (undocumented) -export interface PowerSyncDatabaseOptionsWithSettings extends BasePowerSyncDatabaseOptions { - // (undocumented) - database: SQLOpenOptions; -} - -// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncDBListener" is marked as @public, but its signature references "StreamingSyncImplementationListener" which is marked as @internal -// -// @public (undocumented) -export interface PowerSyncDBListener extends StreamingSyncImplementationListener { - // (undocumented) - closed: () => Promise | void; - // (undocumented) - closing: () => Promise | void; - // (undocumented) - initialized: () => void; - // (undocumented) - schemaChanged: (schema: Schema) => void; -} - -// Warning: (ae-internal-missing-underscore) The name "PowerSyncOpenFactoryOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface PowerSyncOpenFactoryOptions extends Partial, SQLOpenOptions { - schema: Schema; -} - -// @public -export interface ProgressWithOperations { - downloadedFraction: number; - downloadedOperations: number; - totalOperations: number; -} - -// Warning: (ae-internal-missing-underscore) The name "PSInternalTable" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export enum PSInternalTable { - // (undocumented) - BUCKETS = "ps_buckets", - // (undocumented) - CRUD = "ps_crud", - // (undocumented) - DATA = "ps_data", - // (undocumented) - OPLOG = "ps_oplog", - // (undocumented) - UNTYPED = "ps_untyped" -} - -// @public (undocumented) -export interface Query { - differentialWatch(options?: DifferentialWatchedQueryOptions): DifferentialWatchedQuery; - watch(options?: StandardWatchedQueryOptions): StandardWatchedQuery>>; -} - -// @public -export type QueryParam = string | number | boolean | null | undefined | bigint | Uint8Array; - -// @public -export type QueryResult = { - insertId?: number; - rowsAffected: number; - rows?: { - _array: any[]; - length: number; - item: (idx: number) => any; - }; -}; - -// Warning: (ae-forgotten-export) The symbol "RawTableTypeWithStatements" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "InferredRawTableType" needs to be exported by the entry point index.d.ts -// -// @public -export type RawTableType = RawTableTypeWithStatements | InferredRawTableType; - -// Warning: (ae-internal-missing-underscore) The name "RemoteConnector" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type RemoteConnector = { - fetchCredentials: () => Promise; - invalidateCredentials?: () => void; -}; - -// @alpha -export interface RemoteStorageAdapter { - deleteFile(attachment: AttachmentRecord): Promise; - downloadFile(attachment: AttachmentRecord): Promise; - uploadFile(fileData: ArrayBuffer, attachment: AttachmentRecord): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "RequiredAdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface RequiredAdditionalConnectionOptions extends Required { - // (undocumented) - subscriptions: SubscribedStream[]; -} - -// Warning: (ae-internal-missing-underscore) The name "RequiredPowerSyncConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type RequiredPowerSyncConnectionOptions = Required; - -// @public (undocumented) -export type RowType> = { - [K in keyof T['columnMap']]: ExtractColumnValueType; -} & { - id: string; -}; - -// @public -export enum RowUpdateType { - // (undocumented) - SQLITE_DELETE = 9, - // (undocumented) - SQLITE_INSERT = 18, - // (undocumented) - SQLITE_UPDATE = 23 -} - -// Warning: (ae-internal-missing-underscore) The name "runOnSchemaChange" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export function runOnSchemaChange(callback: (signal: AbortSignal) => void, db: AbstractPowerSyncDatabase, options?: SQLWatchOptions): void; - -// @alpha -export function sanitizeSQL(strings: TemplateStringsArray, ...values: any[]): string; - -// @alpha -export function sanitizeUUID(uuid: string): string; - -// Warning: (ae-forgotten-export) The symbol "SchemaType" needs to be exported by the entry point index.d.ts -// -// @public -export class Schema { - constructor(tables: Table[] | S); - // (undocumented) - readonly props: S; - // Warning: (ae-forgotten-export) The symbol "RawTable" needs to be exported by the entry point index.d.ts - // - // (undocumented) - readonly rawTables: RawTable[]; - static rawTableToJson(table: RawTable): unknown; - // (undocumented) - readonly tables: Table[]; - // (undocumented) - toJSON(): { - tables: { - local_only: boolean | undefined; - insert_only: boolean | undefined; - include_old: any; - include_old_only_when_changed: boolean; - include_metadata: boolean | undefined; - ignore_empty_update: boolean | undefined; - name: string; - view_name: string; - columns: { - name: string; - type: ColumnType | undefined; - }[]; - indexes: { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }[]; - }[]; - raw_tables: unknown[]; - }; - // (undocumented) - readonly types: SchemaTableType; - // (undocumented) - validate(): void; - withRawTables(tables: Record): void; -} - -// @public (undocumented) -export type SchemaTableType = { - [K in keyof S]: RowType; -}; - -// Warning: (ae-internal-missing-underscore) The name "Semaphore" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class Semaphore { - constructor(elements: Iterable); - requestAll(abort?: AbortSignal): Promise<{ - items: T[]; - release: UnlockFn; - }>; - requestOne(abort?: AbortSignal): Promise<{ - item: T; - release: UnlockFn; - }>; - // (undocumented) - readonly size: number; -} - -// Warning: (ae-internal-missing-underscore) The name "SimpleAsyncIterator" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export type SimpleAsyncIterator = Pick, 'next'>; - -// Warning: (ae-internal-missing-underscore) The name "SocketSyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SocketSyncStreamOptions = SyncStreamOptions & { - fetchStrategy: FetchStrategy; -}; - -// @public (undocumented) -export interface SqlExecutor { - execute: (query: string, params?: any[] | undefined) => Promise; - // (undocumented) - executeBatch: (query: string, params?: any[][]) => Promise; - executeRaw: (query: string, params?: any[] | undefined) => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "SqliteBucketStorage" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class SqliteBucketStorage extends BaseObserver implements BucketStorageAdapter { - constructor(db: DBAdapter, logger?: ILogger); - // (undocumented) - control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise; - // (undocumented) - dispose(): Promise; - // (undocumented) - getClientId(): Promise; - // (undocumented) - _getClientId(): Promise; - getCrudBatch(limit?: number): Promise; - // (undocumented) - getMaxOpId(): string; - // (undocumented) - hasCrud(): Promise; - // (undocumented) - hasMigratedSubkeys(): Promise; - // (undocumented) - init(): Promise; - // (undocumented) - migrateToFixedSubkeys(): Promise; - // (undocumented) - nextCrudItem(): Promise; - // (undocumented) - static _subkeyMigrationKey: string; - // (undocumented) - tableNames: Set; - // (undocumented) - updateLocalTarget(cb: () => Promise): Promise; - // (undocumented) - writeTransaction(callback: (tx: Transaction) => Promise, options?: { - timeoutMs: number; - }): Promise; -} - -// @public (undocumented) -export interface SQLOnChangeOptions { - // @deprecated (undocumented) - rawTableNames?: boolean; - // (undocumented) - signal?: AbortSignal; - // (undocumented) - tables?: string[]; - throttleMs?: number; - triggerImmediate?: boolean; -} - -// @public (undocumented) -export interface SQLOpenFactory { - openDB(): DBAdapter; -} - -// @public (undocumented) -export interface SQLOpenOptions { - dbFilename: string; - dbLocation?: string; - debugMode?: boolean; -} - -// @public (undocumented) -export interface SQLWatchOptions extends SQLOnChangeOptions { - comparator?: WatchedQueryComparator; -} - -// @public -export type StandardWatchedQuery = WatchedQuery>; - -// @public -export interface StandardWatchedQueryOptions extends WatchedQueryOptions { - comparator?: WatchedQueryComparator; - placeholderData?: RowType[]; -} - -// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface StreamingSyncImplementation extends BaseObserverInterface, Disposable_2 { - connect(options?: InternalConnectionOptions): Promise; - disconnect(): Promise; - // (undocumented) - getWriteCheckpoint: () => Promise; - // (undocumented) - isConnected: boolean; - // (undocumented) - markConnectionMayHaveChanged(): void; - // (undocumented) - syncStatus: SyncStatus; - // (undocumented) - triggerCrudUpload: () => void; - // (undocumented) - updateSubscriptions(subscriptions: SubscribedStream[]): void; - // (undocumented) - waitForReady(): Promise; - // (undocumented) - waitForStatus(status: SyncStatusOptions): Promise; - // (undocumented) - waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementationListener" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface StreamingSyncImplementationListener extends BaseListener { - statusChanged?: ((status: SyncStatus) => void) | undefined; - statusUpdated?: ((statusUpdate: SyncStatusOptions) => void) | undefined; -} - -// Warning: (ae-forgotten-export) The symbol "JSONValue" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export type StreamingSyncRequestParameterType = JSONValue; - -// Warning: (ae-internal-missing-underscore) The name "SubscribedStream" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SubscribedStream = { - name: string; - params: Record | null; -}; - -// @public @deprecated (undocumented) -export enum SyncClientImplementation { - RUST = "rust" -} - -// @public (undocumented) -export type SyncDataFlowStatus = Partial<{ - downloading: boolean; - uploading: boolean; - downloadError?: Error; - uploadError?: Error; - downloadProgress: InternalProgressInformation | null; - internalStreamSubscriptions: CoreStreamSubscription[] | null; -}>; - -// Warning: (ae-internal-missing-underscore) The name "SyncingService" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export class SyncingService { - constructor(attachmentService: AttachmentService, localStorage: LocalStorageAdapter, remoteStorage: RemoteStorageAdapter, logger: ILogger, errorHandler?: AttachmentErrorHandler); - deleteArchivedAttachments(context: AttachmentContext): Promise; - deleteAttachment(attachment: AttachmentRecord, context: AttachmentContext): Promise; - downloadAttachment(attachment: AttachmentRecord): Promise; - processAttachments(attachments: AttachmentRecord[], context: AttachmentContext): Promise; - uploadAttachment(attachment: AttachmentRecord): Promise; -} - -// @public (undocumented) -export interface SyncPriorityStatus { - // (undocumented) - hasSynced?: boolean; - // (undocumented) - lastSyncedAt?: Date; - // (undocumented) - priority: number; -} - -// @public -export class SyncProgress implements ProgressWithOperations { - constructor(internal: InternalProgressInformation); - // (undocumented) - downloadedFraction: number; - // (undocumented) - downloadedOperations: number; - // (undocumented) - protected internal: InternalProgressInformation; - // (undocumented) - totalOperations: number; - untilPriority(priority: number): ProgressWithOperations; -} - -// @public (undocumented) -export class SyncStatus { - // Warning: (ae-incompatible-release-tags) The symbol "__constructor" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - constructor(options: SyncStatusOptions); - // @deprecated - get clientImplementation(): SyncClientImplementation | undefined; - get connected(): boolean; - get connecting(): boolean; - get dataFlowStatus(): SyncDataFlowStatus; - get downloadProgress(): SyncProgress | null; - forStream(stream: SyncStreamDescription): SyncStreamStatus | undefined; - getMessage(): string; - get hasSynced(): boolean | undefined; - isEqual(status: SyncStatus): boolean; - get lastSyncedAt(): Date | undefined; - // Warning: (ae-incompatible-release-tags) The symbol "options" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - // - // (undocumented) - protected options: SyncStatusOptions; - get priorityStatusEntries(): SyncPriorityStatus[]; - protected serializeError(error?: Error): { - name: string; - message: string; - stack: string | undefined; - } | undefined; - statusForPriority(priority: number): SyncPriorityStatus; - get syncStreams(): SyncStreamStatus[] | undefined; - // Warning: (ae-incompatible-release-tags) The symbol "toJSON" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal - toJSON(): SyncStatusOptions; -} - -// Warning: (ae-internal-missing-underscore) The name "SyncStatusOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SyncStatusOptions = { - connected?: boolean; - connecting?: boolean; - dataFlow?: SyncDataFlowStatus; - lastSyncedAt?: Date; - hasSynced?: boolean; - priorityStatusEntries?: SyncPriorityStatus[]; - clientImplementation?: SyncClientImplementation; -}; - -// @public -export interface SyncStream extends SyncStreamDescription { - subscribe(options?: SyncStreamSubscribeOptions): Promise; - unsubscribeAll(): Promise; -} - -// @public (undocumented) -export enum SyncStreamConnectionMethod { - // (undocumented) - HTTP = "http", - // (undocumented) - WEB_SOCKET = "web-socket" -} - -// @public -export interface SyncStreamDescription { - name: string; - parameters: Record | null; -} - -// Warning: (ae-internal-missing-underscore) The name "SyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type SyncStreamOptions = { - path: string; - data: unknown; - headers?: Record; - abortSignal: AbortSignal; - fetchOptions?: Request; -}; - -// @public -export interface SyncStreamStatus { - // (undocumented) - priority: number | null; - // (undocumented) - progress: ProgressWithOperations | null; - // (undocumented) - subscription: SyncSubscriptionDescription; -} - -// @public (undocumented) -export interface SyncStreamSubscribeOptions { - priority?: 0 | 1 | 2 | 3; - ttl?: number; -} - -// @public (undocumented) -export interface SyncStreamSubscription extends SyncStreamDescription { - unsubscribe(): void; - waitForFirstSync(abort?: AbortSignal): Promise; -} - -// @public -export interface SyncSubscriptionDescription extends SyncStreamDescription { - // (undocumented) - active: boolean; - expiresAt: Date | null; - hasExplicitSubscription: boolean; - hasSynced: boolean; - isDefault: boolean; - lastSyncedAt: Date | null; -} - -// @public (undocumented) -export class Table { - constructor(columns: Columns, options?: TableV2Options); - // @deprecated - constructor(options: TableOptions); - // (undocumented) - get columnMap(): Columns; - // (undocumented) - get columns(): Column[]; - // (undocumented) - copyWithName(name: string): Table; - // (undocumented) - static createInsertOnly(options: TableOptions): Table; - // (undocumented) - static createLocalOnly(options: TableOptions): Table; - // @deprecated - static createTable(name: string, table: Table): Table; - // (undocumented) - get ignoreEmptyUpdates(): boolean; - // (undocumented) - get indexes(): Index[]; - // (undocumented) - get insertOnly(): boolean; - // (undocumented) - get internalName(): string; - // (undocumented) - get localOnly(): boolean; - // (undocumented) - protected _mappedColumns: Columns; - // (undocumented) - get name(): string; - // (undocumented) - protected options: TableOptions; - // (undocumented) - toJSON(): { - local_only: boolean | undefined; - insert_only: boolean | undefined; - include_old: any; - include_old_only_when_changed: boolean; - include_metadata: boolean | undefined; - ignore_empty_update: boolean | undefined; - name: string; - view_name: string; - columns: { - name: string; - type: ColumnType | undefined; - }[]; - indexes: { - name: string; - columns: { - name: string; - ascending: boolean | undefined; - type: ColumnType; - }[]; - }[]; - }; - // (undocumented) - get trackMetadata(): boolean; - // (undocumented) - get trackPrevious(): boolean | TrackPreviousOptions; - // (undocumented) - validate(): void; - // (undocumented) - get validName(): boolean; - // (undocumented) - get viewName(): string; - // (undocumented) - get viewNameOverride(): string | undefined; -} - -// Warning: (ae-forgotten-export) The symbol "SharedTableOptions" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export interface TableOptions extends SharedTableOptions { - // (undocumented) - columns: Column[]; - // (undocumented) - indexes?: Index[]; - name: string; -} - -// @public -export interface TableOrRawTableOptions { - // (undocumented) - ignoreEmptyUpdates?: boolean; - // (undocumented) - insertOnly?: boolean; - // (undocumented) - localOnly?: boolean; - // (undocumented) - trackMetadata?: boolean; - // (undocumented) - trackPrevious?: boolean | TrackPreviousOptions; -} - -// @public (undocumented) -export interface TableUpdateOperation { - // (undocumented) - opType: RowUpdateType; - // (undocumented) - rowId: number; -} - -// @public @deprecated -export class TableV2 extends Table { -} - -// @public (undocumented) -export interface TableV2Options extends SharedTableOptions { - // (undocumented) - indexes?: IndexShorthand; -} - -// Warning: (ae-internal-missing-underscore) The name "timeoutSignal" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function timeoutSignal(timeout: number): AbortSignal; - -// @internal (undocumented) -export function timeoutSignal(timeout?: number): AbortSignal | undefined; - -// @alpha -export interface TrackDiffOptions extends BaseCreateDiffTriggerOptions { - onChange: (context: TriggerDiffHandlerContext) => Promise; - throttleMs?: number; -} - -// @public -export interface TrackPreviousOptions { - columns?: string[]; - onlyWhenChanged?: boolean; -} - -// @public (undocumented) -export interface Transaction extends LockContext { - commit: () => Promise; - rollback: () => Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerClaimManager" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export interface TriggerClaimManager { - checkClaim: (identifier: string) => Promise; - obtainClaim: (identifier: string) => Promise<() => Promise>; -} - -// @alpha -export interface TriggerCreationHooks { - beforeCreate?: (context: LockContext) => Promise; -} - -// @alpha -export interface TriggerDiffDeleteRecord extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.DELETE; - value: string; -} - -// @alpha -export interface TriggerDiffHandlerContext extends LockContext { - destinationTable: string; - withDiff: (query: string, params?: ReadonlyArray>, options?: WithDiffOptions) => Promise; - withExtractedDiff: (query: string, params?: ReadonlyArray>) => Promise; -} - -// @alpha -export interface TriggerDiffInsertRecord extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.INSERT; - value: string; -} - -// @alpha -export type TriggerDiffRecord = TriggerDiffUpdateRecord | TriggerDiffInsertRecord | TriggerDiffDeleteRecord; - -// @alpha -export interface TriggerDiffUpdateRecord extends BaseTriggerDiffRecord { - // (undocumented) - operation: DiffTriggerOperation.UPDATE; - previous_value: string; - value: string; -} - -// @alpha (undocumented) -export interface TriggerManager { - createDiffTrigger(options: CreateDiffTriggerOptions): Promise; - trackTableDiff(options: TrackDiffOptions): Promise; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerManagerConfig" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export interface TriggerManagerConfig { - // (undocumented) - claimManager: TriggerClaimManager; -} - -// Warning: (ae-internal-missing-underscore) The name "TriggerManagerImpl" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export class TriggerManagerImpl implements TriggerManager { - constructor(options: TriggerManagerImplOptions); - cleanupResources(): Promise; - // (undocumented) - protected cleanupTimeout: ReturnType | null; - // (undocumented) - createDiffTrigger(options: CreateDiffTriggerOptions): Promise<(options?: TriggerRemoveCallbackOptions) => Promise>; - // (undocumented) - protected get db(): AbstractPowerSyncDatabase; - // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplConfiguration" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected defaultConfig: TriggerManagerImplConfiguration; - // (undocumented) - dispose(): void; - // (undocumented) - protected generateTriggerName(operation: DiffTriggerOperation, destinationTable: string, triggerId: string): string; - // (undocumented) - protected getUUID(ctx?: LockContext): Promise; - // (undocumented) - protected isDisposed: boolean; - // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplOptions" needs to be exported by the entry point index.d.ts - // - // (undocumented) - protected options: TriggerManagerImplOptions; - // (undocumented) - protected removeTriggers(tx: LockContext, triggerIds: string[]): Promise; - // (undocumented) - protected schema: Schema; - // (undocumented) - trackTableDiff(options: TrackDiffOptions): Promise; - updateDefaults(config: TriggerManagerImplConfiguration): void; -} - -// @alpha -export type TriggerRemoveCallback = (options?: TriggerRemoveCallbackOptions) => Promise; - -// @alpha -export interface TriggerRemoveCallbackOptions { - // (undocumented) - context?: LockContext; -} - -// Warning: (ae-internal-missing-underscore) The name "UnlockFn" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal (undocumented) -export type UnlockFn = () => void; - -// @public -export interface UpdateNotification extends TableUpdateOperation { - // (undocumented) - table: string; -} - -// @public -export enum UpdateType { - DELETE = "DELETE", - PATCH = "PATCH", - PUT = "PUT" -} - -// @public (undocumented) -export class UploadQueueStats { - constructor( - count: number, - size?: number | null); - count: number; - size: number | null; - // (undocumented) - toString(): string; -} - -// @public (undocumented) -export interface WatchCompatibleQuery { - // (undocumented) - compile(): CompiledQuery; - // (undocumented) - execute(options: WatchExecuteOptions): Promise; -} - -// @alpha -export type WatchedAttachmentItem = { - id: string; - filename: string; - fileExtension?: never; - metaData?: string; - mediaType?: string; -} | { - id: string; - fileExtension: string; - filename?: never; - metaData?: string; - mediaType?: string; -}; - -// Warning: (ae-forgotten-export) The symbol "MetaBaseObserverInterface" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export interface WatchedQuery = WatchedQueryListener> extends MetaBaseObserverInterface { - close(): Promise; - // (undocumented) - readonly closed: boolean; - registerListener(listener: Listener): () => void; - readonly state: WatchedQueryState; - updateSettings(options: Settings): Promise; -} - -// @public -export interface WatchedQueryComparator { - // (undocumented) - checkEquality: (current: Data, previous: Data) => boolean; -} - -// @public -export interface WatchedQueryDifferential { - // (undocumented) - readonly added: ReadonlyArray>; - readonly all: ReadonlyArray>; - // (undocumented) - readonly removed: ReadonlyArray>; - // (undocumented) - readonly unchanged: ReadonlyArray>; - // (undocumented) - readonly updated: ReadonlyArray>>; -} - -// @public (undocumented) -export interface WatchedQueryListener extends BaseListener { - // (undocumented) - [WatchedQueryListenerEvent.CLOSED]?: () => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_DATA]?: (data: Data) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_ERROR]?: (error: Error) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.ON_STATE_CHANGE]?: (state: WatchedQueryState) => void | Promise; - // (undocumented) - [WatchedQueryListenerEvent.SETTINGS_WILL_UPDATE]?: () => void; -} - -// @public (undocumented) -export enum WatchedQueryListenerEvent { - // (undocumented) - CLOSED = "closed", - // (undocumented) - ON_DATA = "onData", - // (undocumented) - ON_ERROR = "onError", - // (undocumented) - ON_STATE_CHANGE = "onStateChange", - // (undocumented) - SETTINGS_WILL_UPDATE = "settingsWillUpdate" -} - -// @public (undocumented) -export interface WatchedQueryOptions { - reportFetching?: boolean; - throttleMs?: number; - triggerOnTables?: string[]; -} - -// @public -export interface WatchedQueryRowDifferential { - // (undocumented) - readonly current: RowType; - // (undocumented) - readonly previous: RowType; -} - -// @public -export interface WatchedQuerySettings extends WatchedQueryOptions { - // (undocumented) - query: WatchCompatibleQuery; -} - -// @public -export interface WatchedQueryState { - readonly data: Data; - readonly error: Error | null; - readonly isFetching: boolean; - readonly isLoading: boolean; - readonly lastUpdated: Date | null; -} - -// @public -export interface WatchExecuteOptions { - // (undocumented) - db: AbstractPowerSyncDatabase; - // (undocumented) - parameters: any[]; - // (undocumented) - sql: string; -} - -// @public (undocumented) -export interface WatchHandler { - // (undocumented) - onError?: (error: Error) => void; - // (undocumented) - onResult: (results: QueryResult) => void; -} - -// @public (undocumented) -export interface WatchOnChangeEvent { - // (undocumented) - changedTables: string[]; -} - -// @public (undocumented) -export interface WatchOnChangeHandler { - // (undocumented) - onChange: (event: WatchOnChangeEvent) => Promise | void; - // (undocumented) - onError?: (error: Error) => void; -} - -// @alpha -export interface WithDiffOptions { - castOperationIdAsText?: boolean; -} - -// Warnings were encountered during analysis: -// -// lib/db/crud/SyncStatus.d.ts:27:5 - (ae-forgotten-export) The symbol "InternalProgressInformation" needs to be exported by the entry point index.d.ts -// lib/db/crud/SyncStatus.d.ts:31:5 - (ae-forgotten-export) The symbol "CoreStreamSubscription" needs to be exported by the entry point index.d.ts - -// (No @packageDocumentation comment for this package) - -``` +## API Report File for "@powersync/common" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { fetch as fetch_2 } from 'cross-fetch'; +import { GlobalLogger } from 'js-logger'; +import { ILogger } from 'js-logger'; +import { ILoggerOpts } from 'js-logger'; +import { ILogHandler } from 'js-logger'; +import { ILogLevel } from 'js-logger'; +import Logger from 'js-logger'; + +// Warning: (ae-internal-missing-underscore) The name "AbortOperation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class AbortOperation extends Error { + constructor(reason: string); + // (undocumented) + protected reason: string; +} + +// Warning: (ae-incompatible-release-tags) The symbol "AbstractPowerSyncDatabase" is marked as @public, but its signature references "BaseObserver" which is marked as @internal +// +// @public (undocumented) +export abstract class AbstractPowerSyncDatabase extends BaseObserver { + constructor(options: PowerSyncDatabaseOptionsWithDBAdapter); + constructor(options: PowerSyncDatabaseOptionsWithOpenFactory); + constructor(options: PowerSyncDatabaseOptionsWithSettings); + constructor(options: PowerSyncDatabaseOptions); + // Warning: (ae-incompatible-release-tags) The symbol "bucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal + // + // (undocumented) + protected bucketStorageAdapter: BucketStorageAdapter; + close(options?: PowerSyncCloseOptions): Promise; + closed: boolean; + connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise; + get connected(): boolean; + // (undocumented) + get connecting(): boolean; + // Warning: (ae-incompatible-release-tags) The symbol "connectionManager" is marked as @public, but its signature references "ConnectionManager" which is marked as @internal + // + // (undocumented) + protected connectionManager: ConnectionManager; + // Warning: (ae-incompatible-release-tags) The symbol "connectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal + get connectionOptions(): InternalConnectionOptions | null; + get connector(): PowerSyncBackendConnector | null; + currentStatus: SyncStatus; + customQuery(query: WatchCompatibleQuery): Query; + get database(): DBAdapter; + disconnect(): Promise; + disconnectAndClear(options?: DisconnectAndClearOptions): Promise; + // @deprecated (undocumented) + dispose(): void; + execute(sql: string, parameters?: any[]): Promise; + executeBatch(sql: string, parameters?: any[][]): Promise; + executeRaw(sql: string, parameters?: any[]): Promise; + // Warning: (ae-incompatible-release-tags) The symbol "generateBucketStorageAdapter" is marked as @public, but its signature references "BucketStorageAdapter" which is marked as @internal + // + // (undocumented) + protected abstract generateBucketStorageAdapter(): BucketStorageAdapter; + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "generateSyncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal + // + // (undocumented) + protected abstract generateSyncStreamImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions): StreamingSyncImplementation; + // Warning: (ae-incompatible-release-tags) The symbol "generateTriggerManagerConfig" is marked as @public, but its signature references "TriggerManagerConfig" which is marked as @internal + protected generateTriggerManagerConfig(): TriggerManagerConfig; + get(sql: string, parameters?: any[]): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getClientId(): Promise; + getCrudBatch(limit?: number): Promise; + getCrudTransactions(): AsyncIterable; + getNextCrudTransaction(): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + getUploadQueueStats(includeSize?: boolean): Promise; + init(): Promise; + protected initialize(): Promise; + abstract _initialize(): Promise; + // (undocumented) + protected _isReadyPromise: Promise; + // (undocumented) + protected loadVersion(): Promise; + // (undocumented) + logger: ILogger; + onChange(options?: SQLOnChangeOptions): AsyncIterable; + onChange(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; + onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable; + onChangeWithCallback(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void; + protected abstract openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter; + // (undocumented) + protected options: PowerSyncDatabaseOptions; + query(query: ArrayQueryDefinition): Query; + readLock(callback: (db: LockContext) => Promise): Promise; + readTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; + // (undocumented) + ready: boolean; + // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "CreateSyncImplementationOptions" which is marked as @internal + // Warning: (ae-incompatible-release-tags) The symbol "resolvedConnectionOptions" is marked as @public, but its signature references "RequiredAdditionalConnectionOptions" which is marked as @internal + // + // (undocumented) + protected resolvedConnectionOptions(options: CreateSyncImplementationOptions): CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions; + // (undocumented) + protected resolveOfflineSyncStatus(): Promise; + resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise; + protected runExclusive(callback: () => Promise): Promise; + // Warning: (ae-incompatible-release-tags) The symbol "runExclusiveMutex" is marked as @public, but its signature references "Mutex" which is marked as @internal + // + // (undocumented) + protected runExclusiveMutex: Mutex; + get schema(): Schema<{ + [x: string]: Table; + }>; + // (undocumented) + protected _schema: Schema; + // (undocumented) + sdkVersion: string; + syncStream(name: string, params?: Record): SyncStream; + // Warning: (ae-incompatible-release-tags) The symbol "syncStreamImplementation" is marked as @public, but its signature references "StreamingSyncImplementation" which is marked as @internal + // + // (undocumented) + get syncStreamImplementation(): StreamingSyncImplementation | null; + // Warning: (ae-incompatible-release-tags) The symbol "triggers" is marked as @public, but its signature references "TriggerManager" which is marked as @alpha + readonly triggers: TriggerManager; + // Warning: (ae-incompatible-release-tags) The symbol "triggersImpl" is marked as @public, but its signature references "TriggerManagerImpl" which is marked as @internal + // + // (undocumented) + protected triggersImpl: TriggerManagerImpl; + updateSchema(schema: Schema): Promise; + waitForFirstSync(request?: AbortSignal | { + signal?: AbortSignal; + priority?: number; + }): Promise; + // (undocumented) + waitForReady(): Promise; + waitForStatus(predicate: (status: SyncStatus) => any, signal?: AbortSignal): Promise; + watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; + watch(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; + watchWithAsyncGenerator(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable; + watchWithCallback(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void; + writeLock(callback: (db: LockContext) => Promise): Promise; + writeTransaction(callback: (tx: Transaction) => Promise, lockTimeout?: number): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractPowerSyncDatabaseOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractPowerSyncDatabaseOpenFactory { + constructor(options: PowerSyncOpenFactoryOptions); + // (undocumented) + abstract generateInstance(options: PowerSyncDatabaseOptions): AbstractPowerSyncDatabase; + // (undocumented) + generateOptions(): PowerSyncDatabaseOptions; + // (undocumented) + getInstance(): AbstractPowerSyncDatabase; + // (undocumented) + protected abstract openDB(): DBAdapter; + // (undocumented) + protected options: PowerSyncOpenFactoryOptions; + get schema(): Schema<{ + [x: string]: Table; + }>; +} + +// Warning: (ae-forgotten-export) The symbol "MetaBaseObserver" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "WatchedQueryProcessorListener" needs to be exported by the entry point index.d.ts +// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export abstract class AbstractQueryProcessor extends MetaBaseObserver> implements WatchedQuery { + constructor(options: AbstractQueryProcessorOptions); + // (undocumented) + protected abortController: AbortController; + // (undocumented) + close(): Promise; + // (undocumented) + get closed(): boolean; + // (undocumented) + protected _closed: boolean; + // (undocumented) + protected constructInitialState(): WatchedQueryState; + // (undocumented) + protected disposeListeners: (() => void) | null; + protected init(signal: AbortSignal): Promise; + // (undocumented) + protected initialized: Promise; + protected iterateAsyncListenersWithError(callback: (listener: Partial>) => Promise | void): Promise; + protected abstract linkQuery(options: LinkQueryOptions): Promise; + // (undocumented) + protected options: AbstractQueryProcessorOptions; + // (undocumented) + protected get reportFetching(): boolean; + protected runWithReporting(callback: () => Promise): Promise; + // (undocumented) + readonly state: WatchedQueryState; + updateSettings(settings: Settings): Promise; + // (undocumented) + protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise; + // (undocumented) + protected updateState(update: Partial>): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AbstractQueryProcessorOptions { + // (undocumented) + db: AbstractPowerSyncDatabase; + // (undocumented) + placeholderData: Data; + // (undocumented) + watchOptions: Settings; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractRemote" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractRemote { + constructor(connector: RemoteConnector, logger?: ILogger, options?: Partial); + // (undocumented) + protected buildRequest(path: string): Promise<{ + url: string; + headers: { + 'content-type': string; + Authorization: string; + 'x-user-agent': string; + }; + }>; + // (undocumented) + protected connector: RemoteConnector; + // (undocumented) + protected createSocket(url: string): WebSocket; + // (undocumented) + createTextDecoder(): TextDecoder; + // (undocumented) + protected credentials: PowerSyncCredentials | null; + // (undocumented) + get fetch(): FetchImplementation; + fetchCredentials(): Promise; + fetchStream(options: SyncStreamOptions): Promise>; + protected fetchStreamRaw(options: SyncStreamOptions): Promise<{ + isBson: boolean; + stream: SimpleAsyncIterator; + }>; + // (undocumented) + get(path: string, headers?: Record): Promise; + getCredentials(): Promise; + // (undocumented) + getUserAgent(): string; + invalidateCredentials(): void; + // (undocumented) + protected logger: ILogger; + // (undocumented) + protected options: AbstractRemoteOptions; + // (undocumented) + post(path: string, data: any, headers?: Record): Promise; + prefetchCredentials(): Promise; + socketStreamRaw(options: SocketSyncStreamOptions): Promise>; + // (undocumented) + protected get supportsStreamingBinaryResponses(): boolean; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractRemoteOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type AbstractRemoteOptions = { + socketUrlTransformer: (url: string) => string; + fetchImplementation: FetchImplementation | FetchImplementationProvider; + fetchOptions?: {}; +}; + +// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export abstract class AbstractStreamingSyncImplementation extends BaseObserver implements StreamingSyncImplementation { + constructor(options: AbstractStreamingSyncImplementationOptions); + // (undocumented) + protected abortController: AbortController | null; + // (undocumented) + connect(options?: PowerSyncConnectionOptions): Promise; + // (undocumented) + protected crudUpdateListener?: () => void; + // (undocumented) + disconnect(): Promise; + // (undocumented) + dispose(): Promise; + // (undocumented) + getWriteCheckpoint(): Promise; + // (undocumented) + get isConnected(): boolean; + // (undocumented) + get lastSyncedAt(): Date | undefined; + // (undocumented) + protected logger: ILogger; + // (undocumented) + markConnectionMayHaveChanged(): void; + // (undocumented) + abstract obtainLock(lockOptions: LockOptions_2): Promise; + // (undocumented) + protected options: AbstractStreamingSyncImplementationOptions; + // Warning: (ae-forgotten-export) The symbol "RustIterationResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected streamingSyncIteration(signal: AbortSignal, options?: PowerSyncConnectionOptions): Promise; + // (undocumented) + protected streamingSyncPromise?: Promise<[void, void]>; + // (undocumented) + syncStatus: SyncStatus; + // (undocumented) + triggerCrudUpload(): void; + // (undocumented) + updateSubscriptions(subscriptions: SubscribedStream[]): void; + // (undocumented) + protected updateSyncStatus(options: SyncStatusOptions): void; + // (undocumented) + waitForReady(): Promise; + // (undocumented) + waitForStatus(status: SyncStatusOptions): Promise; + // (undocumented) + waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AbstractStreamingSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AbstractStreamingSyncImplementationOptions extends RequiredAdditionalConnectionOptions { + // (undocumented) + adapter: BucketStorageAdapter; + identifier?: string; + // (undocumented) + logger?: ILogger; + // (undocumented) + remote: AbstractRemote; + // (undocumented) + subscriptions: SubscribedStream[]; + // (undocumented) + uploadCrud: () => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "AdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface AdditionalConnectionOptions { + crudUploadThrottleMs?: number; + retryDelayMs?: number; +} + +// @public +export class ArrayComparator implements WatchedQueryComparator { + constructor(options: ArrayComparatorOptions); + // (undocumented) + checkEquality(current: ItemType[], previous: ItemType[]): boolean; + // (undocumented) + protected options: ArrayComparatorOptions; +} + +// @public +export type ArrayComparatorOptions = { + compareBy: (item: ItemType) => string; +}; + +// @public +export interface ArrayQueryDefinition { + mapper?: (row: Record) => RowType; + // (undocumented) + parameters?: ReadonlyArray>; + // (undocumented) + sql: string; +} + +// @alpha +export const ATTACHMENT_TABLE = "attachments"; + +// @alpha +export class AttachmentContext { + constructor(db: AbstractPowerSyncDatabase, tableName: string | undefined, logger: ILogger, archivedCacheLimit: number); + readonly archivedCacheLimit: number; + // (undocumented) + clearQueue(): Promise; + readonly db: AbstractPowerSyncDatabase; + // (undocumented) + deleteArchivedAttachments(callback?: (attachments: AttachmentRecord[]) => Promise): Promise; + deleteAttachment(attachmentId: string): Promise; + getActiveAttachments(): Promise; + getArchivedAttachments(): Promise; + // (undocumented) + getAttachment(id: string): Promise; + getAttachments(): Promise; + readonly logger: ILogger; + saveAttachments(attachments: AttachmentRecord[]): Promise; + readonly tableName: string; + upsertAttachment(attachment: AttachmentRecord, context: Transaction): Promise; +} + +// @alpha (undocumented) +export type AttachmentData = ArrayBuffer | string; + +// @alpha +export interface AttachmentErrorHandler { + onDeleteError(attachment: AttachmentRecord, error: unknown): Promise; + onDownloadError(attachment: AttachmentRecord, error: unknown): Promise; + onUploadError(attachment: AttachmentRecord, error: unknown): Promise; +} + +// @alpha +export function attachmentFromSql(row: any): AttachmentRecord; + +// @alpha +export class AttachmentQueue implements AttachmentQueue { + constructor(input: { + db: AbstractPowerSyncDatabase; + remoteStorage: RemoteStorageAdapter; + localStorage: LocalStorageAdapter; + watchAttachments: (onUpdate: (attachment: WatchedAttachmentItem[]) => Promise, signal: AbortSignal) => void; + tableName?: string; + logger?: ILogger; + syncIntervalMs?: number; + syncThrottleDuration?: number; + downloadAttachments?: boolean; + archivedCacheLimit?: number; + errorHandler?: AttachmentErrorHandler; + }); + readonly archivedCacheLimit: number; + // (undocumented) + clearQueue(): Promise; + // (undocumented) + deleteFile(input: { + id: string; + updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; + }): Promise; + readonly downloadAttachments: boolean; + // (undocumented) + expireCache(): Promise; + generateAttachmentId(): Promise; + readonly localStorage: LocalStorageAdapter; + readonly logger: ILogger; + readonly remoteStorage: RemoteStorageAdapter; + saveFile(input: { + data: AttachmentData; + fileExtension: string; + mediaType?: string; + metaData?: string; + id?: string; + updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise; + }): Promise; + startSync(): Promise; + stopSync(): Promise; + readonly syncIntervalMs: number; + syncStorage(): Promise; + readonly syncThrottleDuration: number; + readonly tableName: string; + verifyAttachments(): Promise; + withAttachmentContext(callback: (context: AttachmentContext) => Promise): Promise; +} + +// @alpha +export interface AttachmentRecord { + // (undocumented) + filename: string; + // (undocumented) + hasSynced?: boolean; + // (undocumented) + id: string; + // (undocumented) + localUri?: string; + // (undocumented) + mediaType?: string; + // (undocumented) + metaData?: string; + // (undocumented) + size?: number; + // (undocumented) + state: AttachmentState; + // (undocumented) + timestamp?: number; +} + +// Warning: (ae-internal-missing-underscore) The name "AttachmentService" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class AttachmentService { + constructor(db: AbstractPowerSyncDatabase, logger: ILogger, tableName?: string, archivedCacheLimit?: number); + watchActiveAttachments(input?: { + throttleMs?: number; + }): DifferentialWatchedQuery; + withContext(callback: (context: AttachmentContext) => Promise): Promise; +} + +// @alpha +export enum AttachmentState { + // (undocumented) + ARCHIVED = 4,// Attachment to be uploaded + // (undocumented) + QUEUED_DELETE = 2,// Attachment to be downloaded + // (undocumented) + QUEUED_DOWNLOAD = 1,// Attachment to be deleted + // (undocumented) + QUEUED_UPLOAD = 0,// Attachment has been synced + // (undocumented) + SYNCED = 3 +} + +// @alpha +export class AttachmentTable extends Table { + constructor(options?: AttachmentTableOptions); +} + +// @alpha (undocumented) +export interface AttachmentTableOptions extends Omit { +} + +// @public (undocumented) +export type BaseColumnType = { + type: ColumnType; +}; + +// @public (undocumented) +export interface BaseConnectionOptions { + appMetadata?: Record; + // @deprecated (undocumented) + clientImplementation?: SyncClientImplementation; + connectionMethod?: SyncStreamConnectionMethod; + fetchStrategy?: FetchStrategy; + includeDefaultStreams?: boolean; + params?: Record; + serializedSchema?: any; +} + +// @public (undocumented) +export type BaseListener = Record any) | undefined>; + +// Warning: (ae-internal-missing-underscore) The name "BaseObserver" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class BaseObserver implements BaseObserverInterface { + constructor(); + // (undocumented) + dispose(): void; + // (undocumented) + iterateAsyncListeners(cb: (listener: Partial) => Promise): Promise; + // (undocumented) + iterateListeners(cb: (listener: Partial) => any): void; + // (undocumented) + protected listeners: Set>; + registerListener(listener: Partial): () => void; +} + +// @public (undocumented) +export interface BaseObserverInterface { + // (undocumented) + registerListener(listener: Partial): () => void; +} + +// Warning: (ae-incompatible-release-tags) The symbol "BasePowerSyncDatabaseOptions" is marked as @public, but its signature references "AdditionalConnectionOptions" which is marked as @internal +// +// @public (undocumented) +export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions { + // (undocumented) + logger?: ILogger; + // @deprecated (undocumented) + retryDelay?: number; + schema: Schema; +} + +// @alpha +export interface BaseTriggerDiffRecord { + id: string; + operation: DiffTriggerOperation; + operation_id: TOperationId; + timestamp: string; +} + +// @public (undocumented) +export interface BatchedUpdateNotification { + // (undocumented) + groupedUpdates: Record; + // (undocumented) + rawUpdates: UpdateNotification[]; + // (undocumented) + tables: string[]; +} + +// Warning: (ae-internal-missing-underscore) The name "BucketStorageAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface BucketStorageAdapter extends BaseObserverInterface, Disposable_2 { + control(op: PowerSyncControlCommand, payload: string | Uint8Array | null): Promise; + getClientId(): Promise; + // (undocumented) + getCrudBatch(limit?: number): Promise; + // (undocumented) + getMaxOpId(): string; + // (undocumented) + hasCrud(): Promise; + // (undocumented) + hasMigratedSubkeys(): Promise; + // (undocumented) + init(): Promise; + // (undocumented) + migrateToFixedSubkeys(): Promise; + // (undocumented) + nextCrudItem(): Promise; + // (undocumented) + updateLocalTarget(cb: () => Promise): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "BucketStorageListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface BucketStorageListener extends BaseListener { + // (undocumented) + crudUpdate: () => void; +} + +// @public (undocumented) +export class Column { + constructor(options: ColumnOptions); + // (undocumented) + get name(): string; + // (undocumented) + protected options: ColumnOptions; + // (undocumented) + toJSON(): { + name: string; + type: ColumnType | undefined; + }; + // (undocumented) + get type(): ColumnType | undefined; +} + +// @public (undocumented) +export const column: { + text: BaseColumnType; + integer: BaseColumnType; + real: BaseColumnType; +}; + +// @public (undocumented) +export interface ColumnOptions { + // (undocumented) + name: string; + // (undocumented) + type?: ColumnType; +} + +// @public (undocumented) +export type ColumnsType = Record>; + +// @public (undocumented) +export enum ColumnType { + // (undocumented) + INTEGER = "INTEGER", + // (undocumented) + REAL = "REAL", + // (undocumented) + TEXT = "TEXT" +} + +// @public (undocumented) +export interface CompilableQuery { + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(): Promise; +} + +// @public (undocumented) +export function compilableQueryWatch(db: AbstractPowerSyncDatabase, query: CompilableQuery, handler: CompilableQueryWatchHandler, options?: SQLWatchOptions): void; + +// @public (undocumented) +export interface CompilableQueryWatchHandler { + // (undocumented) + onError?: (error: Error) => void; + // (undocumented) + onResult: (results: T[]) => void; +} + +// @public (undocumented) +export interface CompiledQuery { + // (undocumented) + readonly parameters: ReadonlyArray; + // (undocumented) + readonly sql: string; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionClosedError" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class ConnectionClosedError extends Error { + constructor(message: string); + // (undocumented) + static MATCHES(input: any): boolean; + // (undocumented) + static NAME: string; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManager" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class ConnectionManager extends BaseObserver { + constructor(options: ConnectionManagerOptions); + get activeStreams(): { + name: string; + params: Record | null; + }[]; + // (undocumented) + close(): Promise; + // (undocumented) + connect(connector: PowerSyncBackendConnector, options: InternalConnectionOptions): Promise; + protected connectingPromise: Promise | null; + // (undocumented) + protected connectInternal(): Promise; + // (undocumented) + get connectionOptions(): InternalConnectionOptions | null; + // (undocumented) + get connector(): PowerSyncBackendConnector | null; + disconnect(): Promise; + protected disconnectingPromise: Promise | null; + // (undocumented) + protected disconnectInternal(): Promise; + // (undocumented) + get logger(): ILogger; + // (undocumented) + protected options: ConnectionManagerOptions; + // Warning: (ae-forgotten-export) The symbol "StoredConnectionOptions" needs to be exported by the entry point index.d.ts + protected pendingConnectionOptions: StoredConnectionOptions | null; + // (undocumented) + protected performDisconnect(): Promise; + // (undocumented) + stream(adapter: InternalSubscriptionAdapter, name: string, parameters: Record | null): SyncStream; + protected syncDisposer: (() => Promise | void) | null; + // (undocumented) + syncStreamImplementation: StreamingSyncImplementation | null; + protected syncStreamInitPromise: Promise | null; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerListener extends BaseListener { + // (undocumented) + syncStreamCreated: (sync: StreamingSyncImplementation) => void; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerOptions { + // (undocumented) + createSyncImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions): Promise; + // (undocumented) + logger: ILogger; +} + +// Warning: (ae-internal-missing-underscore) The name "ConnectionManagerSyncImplementationResult" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ConnectionManagerSyncImplementationResult { + onDispose: () => Promise | void; + // (undocumented) + sync: StreamingSyncImplementation; +} + +// @public (undocumented) +export interface ConnectionPool extends BaseObserverInterface { + // (undocumented) + close: () => void | Promise; + // (undocumented) + name: string; + // (undocumented) + readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + refreshSchema: () => Promise; + // (undocumented) + writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "ControlledExecutor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class ControlledExecutor { + constructor(task: (param: T) => Promise | void, options?: ControlledExecutorOptions); + // (undocumented) + dispose(): void; + // (undocumented) + schedule(param: T): void; +} + +// Warning: (ae-internal-missing-underscore) The name "ControlledExecutorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ControlledExecutorOptions { + throttleEnabled?: boolean; +} + +// @public +export function createBaseLogger(): typeof Logger; + +// Warning: (ae-forgotten-export) The symbol "BaseCreateDiffTriggerOptions" needs to be exported by the entry point index.d.ts +// +// @alpha +export interface CreateDiffTriggerOptions extends BaseCreateDiffTriggerOptions { + destination: string; + setupContext?: LockContext; +} + +// @public +export function createLogger(name: string, options?: CreateLoggerOptions): ILogger; + +// @public (undocumented) +export interface CreateLoggerOptions { + // (undocumented) + logLevel?: ILogLevel; +} + +// Warning: (ae-internal-missing-underscore) The name "CreateSyncImplementationOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export interface CreateSyncImplementationOptions extends AdditionalConnectionOptions { + // (undocumented) + subscriptions: SubscribedStream[]; +} + +// @public +export class CrudBatch { + constructor( + crud: CrudEntry[], + haveMore: boolean, + complete: (writeCheckpoint?: string) => Promise); + complete: (writeCheckpoint?: string) => Promise; + crud: CrudEntry[]; + haveMore: boolean; +} + +// @public +export class CrudEntry { + constructor(clientId: number, op: UpdateType, table: string, id: string, transactionId?: number, opData?: Record, previousValues?: Record, metadata?: string); + clientId: number; + // (undocumented) + equals(entry: CrudEntry): boolean; + // Warning: (ae-forgotten-export) The symbol "CrudEntryJSON" needs to be exported by the entry point index.d.ts + // + // (undocumented) + static fromRow(dbRow: CrudEntryJSON): CrudEntry; + // @deprecated + hashCode(): string; + id: string; + metadata?: string; + op: UpdateType; + opData?: Record; + previousValues?: Record; + table: string; + toComparisonArray(): (string | number | Record | undefined)[]; + // Warning: (ae-forgotten-export) The symbol "CrudEntryOutputJSON" needs to be exported by the entry point index.d.ts + toJSON(): CrudEntryOutputJSON; + transactionId?: number; +} + +// @public (undocumented) +export class CrudTransaction extends CrudBatch { + constructor( + crud: CrudEntry[], + complete: (checkpoint?: string) => Promise, + transactionId?: number | undefined); + complete: (checkpoint?: string) => Promise; + crud: CrudEntry[]; + transactionId?: number | undefined; +} + +// @public (undocumented) +export interface DBAdapter extends ConnectionPool, SqlExecutor, DBGetUtils { + // (undocumented) + readTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; + // (undocumented) + writeTransaction: (fn: (tx: Transaction) => Promise, options?: DBLockOptions) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "DBAdapterDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function DBAdapterDefaultMixin ConnectionPool>(Base: TBase): { + new (...args: any[]): { + readTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; + writeTransaction(fn: (tx: Transaction) => Promise, options?: DBLockOptions): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + get(sql: string, parameters?: any[]): Promise; + execute(query: string, params?: any[]): Promise; + executeRaw(query: string, params?: any[]): Promise; + executeBatch(query: string, params?: any[][]): Promise; + name: string; + close: () => void | Promise; + readLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + writeLock: (fn: (tx: LockContext) => Promise, options?: DBLockOptions) => Promise; + refreshSchema: () => Promise; + registerListener(listener: Partial): () => void; + }; +} & TBase; + +// @public (undocumented) +export interface DBAdapterListener extends BaseListener { + tablesUpdated: (updateNotification: BatchedUpdateNotification | UpdateNotification) => void; +} + +// @public (undocumented) +export interface DBGetUtils { + get(sql: string, parameters?: any[]): Promise; + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "DBGetUtilsDefaultMixin" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function DBGetUtilsDefaultMixin Omit>(Base: TBase): { + new (...args: any[]): { + getAll(sql: string, parameters?: any[]): Promise; + getOptional(sql: string, parameters?: any[]): Promise; + get(sql: string, parameters?: any[]): Promise; + executeBatch(query: string, params?: any[][]): Promise; + execute: (query: string, params?: any[] | undefined) => Promise; + executeRaw: (query: string, params?: any[] | undefined) => Promise; + }; +} & TBase; + +// @public (undocumented) +export interface DBLockOptions { + // (undocumented) + timeoutMs?: number; +} + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_BATCH_LIMIT" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_CRUD_BATCH_LIMIT = 100; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_CRUD_UPLOAD_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_CRUD_UPLOAD_THROTTLE_MS = 1000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_COLUMN_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_INDEX_COLUMN_OPTIONS: Partial; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_INDEX_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_INDEX_OPTIONS: Partial; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_LOCK_TIMEOUT_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const DEFAULT_LOCK_TIMEOUT_MS = 120000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_CLOSE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_POWERSYNC_DB_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_POWERSYNC_DB_OPTIONS: { + retryDelayMs: number; + crudUploadThrottleMs: number; +}; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_LOGGER" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_REMOTE_LOGGER: Logger.ILogger; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_REMOTE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_RETRY_DELAY_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_RETRY_DELAY_MS = 5000; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_ROW_COMPARATOR" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const DEFAULT_ROW_COMPARATOR: DifferentialWatchedQueryComparator; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAM_CONNECTION_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_STREAMING_SYNC_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_STREAMING_SYNC_OPTIONS: { + retryDelayMs: number; + crudUploadThrottleMs: number; +}; + +// @public @deprecated +export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_TABLE_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_TABLE_OPTIONS: { + indexes: never[]; + insertOnly: boolean; + localOnly: boolean; + trackPrevious: boolean; + trackMetadata: boolean; + ignoreEmptyUpdates: boolean; +}; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_QUERY_OPTIONS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_WATCH_QUERY_OPTIONS: WatchedQueryOptions; + +// Warning: (ae-internal-missing-underscore) The name "DEFAULT_WATCH_THROTTLE_MS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const DEFAULT_WATCH_THROTTLE_MS = 30; + +// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class DifferentialQueryProcessor extends AbstractQueryProcessor>, DifferentialWatchedQuerySettings> implements DifferentialWatchedQuery { + constructor(options: DifferentialQueryProcessorOptions); + // (undocumented) + protected comparator: DifferentialWatchedQueryComparator; + // Warning: (ae-forgotten-export) The symbol "DataHashMap" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected differentiate(current: RowType[], previousMap: DataHashMap): { + diff: WatchedQueryDifferential; + map: DataHashMap; + hasChanged: boolean; + }; + // (undocumented) + protected linkQuery(options: LinkQueryOptions>): Promise; + // (undocumented) + protected options: DifferentialQueryProcessorOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "DifferentialQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface DifferentialQueryProcessorOptions extends AbstractQueryProcessorOptions> { + // (undocumented) + rowComparator?: DifferentialWatchedQueryComparator; +} + +// @public (undocumented) +export type DifferentialWatchedQuery = WatchedQuery>, DifferentialWatchedQuerySettings, DifferentialWatchedQueryListener>; + +// @public +export interface DifferentialWatchedQueryComparator { + compareBy: (item: RowType) => string; + keyBy: (item: RowType) => string; +} + +// @public (undocumented) +export interface DifferentialWatchedQueryListener extends WatchedQueryListener>> { + // (undocumented) + onDiff?: (diff: WatchedQueryDifferential) => void | Promise; +} + +// @public +export interface DifferentialWatchedQueryOptions extends WatchedQueryOptions { + placeholderData?: RowType[]; + rowComparator?: DifferentialWatchedQueryComparator; +} + +// @public +export interface DifferentialWatchedQuerySettings extends DifferentialWatchedQueryOptions { + query: WatchCompatibleQuery; +} + +// @alpha +export enum DiffTriggerOperation { + // (undocumented) + DELETE = "DELETE", + // (undocumented) + INSERT = "INSERT", + // (undocumented) + UPDATE = "UPDATE" +} + +// @public (undocumented) +export interface DisconnectAndClearOptions { + clearLocal?: boolean; +} + +// @public (undocumented) +interface Disposable_2 { + // (undocumented) + dispose: () => Promise | void; +} +export { Disposable_2 as Disposable } + +// Warning: (ae-internal-missing-underscore) The name "EMPTY_DIFFERENTIAL" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const EMPTY_DIFFERENTIAL: { + added: never[]; + all: never[]; + removed: never[]; + updated: never[]; + unchanged: never[]; +}; + +// @alpha (undocumented) +export enum EncodingType { + // (undocumented) + Base64 = "base64", + // (undocumented) + UTF8 = "utf8" +} + +// @public (undocumented) +export type ExtractColumnValueType> = T extends BaseColumnType ? R : unknown; + +// @alpha +export type ExtractedTriggerDiffRecord = T & { + [K in keyof Omit, 'id'> as `__${string & K}`]: TriggerDiffRecord[K]; +} & { + __previous_value?: string; +}; + +// Warning: (ae-internal-missing-underscore) The name "extractTableUpdates" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function extractTableUpdates(update: BatchedUpdateNotification | UpdateNotification): string[]; + +// @public +export const FalsyComparator: WatchedQueryComparator; + +// Warning: (ae-internal-missing-underscore) The name "FetchImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type FetchImplementation = typeof fetch_2; + +// Warning: (ae-internal-missing-underscore) The name "FetchImplementationProvider" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class FetchImplementationProvider { + // (undocumented) + getFetch(): FetchImplementation; +} + +// @public (undocumented) +export enum FetchStrategy { + Buffered = "buffered", + Sequential = "sequential" +} + +// @public +export class GetAllQuery implements WatchCompatibleQuery { + constructor(options: GetAllQueryOptions); + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(options: { + db: AbstractPowerSyncDatabase; + }): Promise; + // (undocumented) + protected options: GetAllQueryOptions; +} + +// @public +export type GetAllQueryOptions = { + sql: string; + parameters?: ReadonlyArray; + mapper?: (rawRow: Record) => RowType; +}; + +export { GlobalLogger } + +export { ILogger } + +export { ILoggerOpts } + +export { ILogHandler } + +export { ILogLevel } + +// @public (undocumented) +export class Index { + constructor(options: IndexOptions); + // (undocumented) + get columns(): IndexedColumn[]; + // (undocumented) + static createAscending(options: IndexOptions, columnNames: string[]): Index; + // (undocumented) + get name(): string; + // (undocumented) + protected options: IndexOptions; + // (undocumented) + toJSON(table: Table): { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }; +} + +// @public (undocumented) +export interface IndexColumnOptions { + // (undocumented) + ascending?: boolean; + // (undocumented) + name: string; +} + +// @public (undocumented) +export class IndexedColumn { + constructor(options: IndexColumnOptions); + // (undocumented) + get ascending(): boolean | undefined; + // (undocumented) + static createAscending(column: string): IndexedColumn; + // (undocumented) + get name(): string; + // (undocumented) + protected options: IndexColumnOptions; + // (undocumented) + toJSON(table: Table): { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }; +} + +// @public (undocumented) +export interface IndexOptions { + // (undocumented) + columns?: IndexedColumn[]; + // (undocumented) + name: string; +} + +// @public (undocumented) +export type IndexShorthand = Record; + +// Warning: (ae-internal-missing-underscore) The name "InternalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface InternalConnectionOptions extends BaseConnectionOptions, AdditionalConnectionOptions { +} + +// Warning: (ae-internal-missing-underscore) The name "InternalSubscriptionAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface InternalSubscriptionAdapter { + // (undocumented) + firstStatusMatching(predicate: (status: SyncStatus) => any, abort?: AbortSignal): Promise; + // (undocumented) + resolveOfflineSyncStatus(): Promise; + // (undocumented) + rustSubscriptionsCommand(payload: any): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "InvalidSQLCharacters" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const InvalidSQLCharacters: RegExp; + +// Warning: (ae-internal-missing-underscore) The name "isBatchedUpdateNotification" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function isBatchedUpdateNotification(update: BatchedUpdateNotification | UpdateNotification): update is BatchedUpdateNotification; + +// Warning: (ae-internal-missing-underscore) The name "isDBAdapter" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isDBAdapter: (test: any) => test is DBAdapter; + +// Warning: (ae-internal-missing-underscore) The name "isPowerSyncDatabaseOptionsWithSettings" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isPowerSyncDatabaseOptionsWithSettings: (test: any) => test is PowerSyncDatabaseOptionsWithSettings; + +// Warning: (ae-internal-missing-underscore) The name "isSQLOpenFactory" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isSQLOpenFactory: (test: any) => test is SQLOpenFactory; + +// Warning: (ae-internal-missing-underscore) The name "isSQLOpenOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const isSQLOpenOptions: (test: any) => test is SQLOpenOptions; + +// Warning: (ae-internal-missing-underscore) The name "LinkQueryOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface LinkQueryOptions { + // (undocumented) + abortSignal: AbortSignal; + // (undocumented) + settings: Settings; +} + +// @alpha +export interface LocalStorageAdapter { + clear(): Promise; + deleteFile(filePath: string): Promise; + fileExists(filePath: string): Promise; + getLocalUri(filename: string): string; + initialize(): Promise; + makeDir(path: string): Promise; + readFile(filePath: string): Promise; + rmDir(path: string): Promise; + saveFile(filePath: string, data: AttachmentData): Promise; +} + +// @public (undocumented) +export interface LockContext extends SqlExecutor, DBGetUtils { + connectionType?: 'writer' | 'queryOnly' | 'readOnly'; +} + +// @internal +interface LockOptions_2 { + // (undocumented) + callback: () => Promise; + // (undocumented) + signal?: AbortSignal; + // (undocumented) + type: LockType; +} + +// Warning: (ae-internal-missing-underscore) The name "LockOptions" should be prefixed with an underscore because the declaration is marked as @internal +export { LockOptions_2 as LockOptions } + +// Warning: (ae-internal-missing-underscore) The name "LockType" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum LockType { + // (undocumented) + CRUD = "crud", + // (undocumented) + SYNC = "sync" +} + +// @public (undocumented) +export const LogLevel: { + TRACE: Logger.ILogLevel; + DEBUG: Logger.ILogLevel; + INFO: Logger.ILogLevel; + TIME: Logger.ILogLevel; + WARN: Logger.ILogLevel; + ERROR: Logger.ILogLevel; + OFF: Logger.ILogLevel; +}; + +// Warning: (ae-internal-missing-underscore) The name "MAX_AMOUNT_OF_COLUMNS" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export const MAX_AMOUNT_OF_COLUMNS = 1999; + +// Warning: (ae-internal-missing-underscore) The name "MAX_OP_ID" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const MAX_OP_ID = "9223372036854775807"; + +// Warning: (ae-internal-missing-underscore) The name "MEMORY_TRIGGER_CLAIM_MANAGER" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const MEMORY_TRIGGER_CLAIM_MANAGER: TriggerClaimManager; + +// Warning: (ae-forgotten-export) The symbol "MutableDeep" needs to be exported by the entry point index.d.ts +// Warning: (ae-internal-missing-underscore) The name "MutableWatchedQueryState" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export type MutableWatchedQueryState = { + -readonly [P in keyof WatchedQueryState]: MutableDeep[P]>; +}; + +// Warning: (ae-internal-missing-underscore) The name "Mutex" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class Mutex { + // (undocumented) + acquire(abort?: AbortSignal): Promise; + // (undocumented) + runExclusive(fn: () => PromiseLike | T, abort?: AbortSignal): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessor" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class OnChangeQueryProcessor extends AbstractQueryProcessor> { + constructor(options: OnChangeQueryProcessorOptions); + // (undocumented) + protected checkEquality(current: Data, previous: Data): boolean; + // (undocumented) + protected linkQuery(options: LinkQueryOptions): Promise; + // (undocumented) + protected options: OnChangeQueryProcessorOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "OnChangeQueryProcessorOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface OnChangeQueryProcessorOptions extends AbstractQueryProcessorOptions> { + // (undocumented) + comparator?: WatchedQueryComparator; +} + +// @public +export type OpId = string; + +// Warning: (ae-internal-missing-underscore) The name "ParsedQuery" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface ParsedQuery { + // (undocumented) + parameters: any[]; + // (undocumented) + sqlStatement: string; +} + +// Warning: (ae-internal-missing-underscore) The name "parseQuery" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export const parseQuery: (query: string | CompilableQuery, parameters: any[]) => ParsedQuery; + +// @public +export type PendingStatement = { + sql: string; + params: PendingStatementParameter[]; +}; + +// @public +export type PendingStatementParameter = 'Id' | { + Column: string; +} | 'Rest'; + +// @public (undocumented) +export interface PowerSyncBackendConnector { + fetchCredentials: () => Promise; + uploadData: (database: AbstractPowerSyncDatabase) => Promise; +} + +// @public (undocumented) +export interface PowerSyncCloseOptions { + disconnect?: boolean; +} + +// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncConnectionOptions" is marked as @public, but its signature references "InternalConnectionOptions" which is marked as @internal +// +// @public +export type PowerSyncConnectionOptions = Omit; + +// Warning: (ae-internal-missing-underscore) The name "PowerSyncControlCommand" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum PowerSyncControlCommand { + CONNECTION_STATE = "connection", + // (undocumented) + NOTIFY_CRUD_UPLOAD_COMPLETED = "completed_upload", + // (undocumented) + NOTIFY_TOKEN_REFRESHED = "refreshed_token", + // (undocumented) + PROCESS_BSON_LINE = "line_binary", + // (undocumented) + PROCESS_TEXT_LINE = "line_text", + // (undocumented) + START = "start", + // (undocumented) + STOP = "stop", + // (undocumented) + UPDATE_SUBSCRIPTIONS = "update_subscriptions" +} + +// @public (undocumented) +export interface PowerSyncCredentials { + // (undocumented) + endpoint: string; + // (undocumented) + expiresAt?: Date; + // (undocumented) + token: string; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions { + database: DBAdapter | SQLOpenFactory | SQLOpenOptions; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithDBAdapter extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: DBAdapter; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithOpenFactory extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: SQLOpenFactory; +} + +// @public (undocumented) +export interface PowerSyncDatabaseOptionsWithSettings extends BasePowerSyncDatabaseOptions { + // (undocumented) + database: SQLOpenOptions; +} + +// Warning: (ae-incompatible-release-tags) The symbol "PowerSyncDBListener" is marked as @public, but its signature references "StreamingSyncImplementationListener" which is marked as @internal +// +// @public (undocumented) +export interface PowerSyncDBListener extends StreamingSyncImplementationListener { + // (undocumented) + closed: () => Promise | void; + // (undocumented) + closing: () => Promise | void; + // (undocumented) + initialized: () => void; + // (undocumented) + schemaChanged: (schema: Schema) => void; +} + +// Warning: (ae-internal-missing-underscore) The name "PowerSyncOpenFactoryOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface PowerSyncOpenFactoryOptions extends Partial, SQLOpenOptions { + schema: Schema; +} + +// @public +export interface ProgressWithOperations { + downloadedFraction: number; + downloadedOperations: number; + totalOperations: number; +} + +// Warning: (ae-internal-missing-underscore) The name "PSInternalTable" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export enum PSInternalTable { + // (undocumented) + BUCKETS = "ps_buckets", + // (undocumented) + CRUD = "ps_crud", + // (undocumented) + DATA = "ps_data", + // (undocumented) + OPLOG = "ps_oplog", + // (undocumented) + UNTYPED = "ps_untyped" +} + +// @public (undocumented) +export interface Query { + differentialWatch(options?: DifferentialWatchedQueryOptions): DifferentialWatchedQuery; + watch(options?: StandardWatchedQueryOptions): StandardWatchedQuery>>; +} + +// @public +export type QueryParam = string | number | boolean | null | undefined | bigint | Uint8Array; + +// @public +export type QueryResult = { + insertId?: number; + rowsAffected: number; + rows?: { + _array: any[]; + length: number; + item: (idx: number) => any; + }; +}; + +// Warning: (ae-forgotten-export) The symbol "RawTableTypeWithStatements" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "InferredRawTableType" needs to be exported by the entry point index.d.ts +// +// @public +export type RawTableType = RawTableTypeWithStatements | InferredRawTableType; + +// Warning: (ae-internal-missing-underscore) The name "RemoteConnector" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type RemoteConnector = { + fetchCredentials: () => Promise; + invalidateCredentials?: () => void; +}; + +// @alpha +export interface RemoteStorageAdapter { + deleteFile(attachment: AttachmentRecord): Promise; + downloadFile(attachment: AttachmentRecord): Promise; + uploadFile(fileData: ArrayBuffer, attachment: AttachmentRecord): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "RequiredAdditionalConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface RequiredAdditionalConnectionOptions extends Required { + // (undocumented) + subscriptions: SubscribedStream[]; +} + +// Warning: (ae-internal-missing-underscore) The name "RequiredPowerSyncConnectionOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type RequiredPowerSyncConnectionOptions = Required; + +// @public (undocumented) +export type RowType> = { + [K in keyof T['columnMap']]: ExtractColumnValueType; +} & { + id: string; +}; + +// @public +export enum RowUpdateType { + // (undocumented) + SQLITE_DELETE = 9, + // (undocumented) + SQLITE_INSERT = 18, + // (undocumented) + SQLITE_UPDATE = 23 +} + +// Warning: (ae-internal-missing-underscore) The name "runOnSchemaChange" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export function runOnSchemaChange(callback: (signal: AbortSignal) => void, db: AbstractPowerSyncDatabase, options?: SQLWatchOptions): void; + +// @alpha +export function sanitizeSQL(strings: TemplateStringsArray, ...values: any[]): string; + +// @alpha +export function sanitizeUUID(uuid: string): string; + +// Warning: (ae-forgotten-export) The symbol "SchemaType" needs to be exported by the entry point index.d.ts +// +// @public +export class Schema { + constructor(tables: Table[] | S); + // (undocumented) + readonly props: S; + // Warning: (ae-forgotten-export) The symbol "RawTable" needs to be exported by the entry point index.d.ts + // + // (undocumented) + readonly rawTables: RawTable[]; + static rawTableToJson(table: RawTable): unknown; + // (undocumented) + readonly tables: Table[]; + // (undocumented) + toJSON(): { + tables: { + local_only: boolean | undefined; + insert_only: boolean | undefined; + include_old: any; + include_old_only_when_changed: boolean; + include_metadata: boolean | undefined; + ignore_empty_update: boolean | undefined; + name: string; + view_name: string; + columns: { + name: string; + type: ColumnType | undefined; + }[]; + indexes: { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }[]; + }[]; + raw_tables: unknown[]; + }; + // (undocumented) + readonly types: SchemaTableType; + // (undocumented) + validate(): void; + withRawTables(tables: Record): void; +} + +// @public (undocumented) +export type SchemaTableType = { + [K in keyof S]: RowType; +}; + +// Warning: (ae-internal-missing-underscore) The name "Semaphore" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class Semaphore { + constructor(elements: Iterable); + requestAll(abort?: AbortSignal): Promise<{ + items: T[]; + release: UnlockFn; + }>; + requestOne(abort?: AbortSignal): Promise<{ + item: T; + release: UnlockFn; + }>; + // (undocumented) + readonly size: number; +} + +// Warning: (ae-internal-missing-underscore) The name "SimpleAsyncIterator" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export type SimpleAsyncIterator = Pick, 'next'>; + +// Warning: (ae-internal-missing-underscore) The name "SocketSyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SocketSyncStreamOptions = SyncStreamOptions & { + fetchStrategy: FetchStrategy; +}; + +// @public (undocumented) +export interface SqlExecutor { + execute: (query: string, params?: any[] | undefined) => Promise; + // (undocumented) + executeBatch: (query: string, params?: any[][]) => Promise; + executeRaw: (query: string, params?: any[] | undefined) => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "SqliteBucketStorage" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class SqliteBucketStorage extends BaseObserver implements BucketStorageAdapter { + constructor(db: DBAdapter, logger?: ILogger); + // (undocumented) + control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise; + // (undocumented) + dispose(): Promise; + // (undocumented) + getClientId(): Promise; + // (undocumented) + _getClientId(): Promise; + getCrudBatch(limit?: number): Promise; + // (undocumented) + getMaxOpId(): string; + // (undocumented) + hasCrud(): Promise; + // (undocumented) + hasMigratedSubkeys(): Promise; + // (undocumented) + init(): Promise; + // (undocumented) + migrateToFixedSubkeys(): Promise; + // (undocumented) + nextCrudItem(): Promise; + // (undocumented) + static _subkeyMigrationKey: string; + // (undocumented) + tableNames: Set; + // (undocumented) + updateLocalTarget(cb: () => Promise): Promise; + // (undocumented) + writeTransaction(callback: (tx: Transaction) => Promise, options?: { + timeoutMs: number; + }): Promise; +} + +// @public (undocumented) +export interface SQLOnChangeOptions { + // @deprecated (undocumented) + rawTableNames?: boolean; + // (undocumented) + signal?: AbortSignal; + // (undocumented) + tables?: string[]; + throttleMs?: number; + triggerImmediate?: boolean; +} + +// @public (undocumented) +export interface SQLOpenFactory { + openDB(): DBAdapter; +} + +// @public (undocumented) +export interface SQLOpenOptions { + dbFilename: string; + dbLocation?: string; + debugMode?: boolean; +} + +// @public (undocumented) +export interface SQLWatchOptions extends SQLOnChangeOptions { + comparator?: WatchedQueryComparator; +} + +// @public +export type StandardWatchedQuery = WatchedQuery>; + +// @public +export interface StandardWatchedQueryOptions extends WatchedQueryOptions { + comparator?: WatchedQueryComparator; + placeholderData?: RowType[]; +} + +// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementation" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface StreamingSyncImplementation extends BaseObserverInterface, Disposable_2 { + connect(options?: InternalConnectionOptions): Promise; + disconnect(): Promise; + // (undocumented) + getWriteCheckpoint: () => Promise; + // (undocumented) + isConnected: boolean; + // (undocumented) + markConnectionMayHaveChanged(): void; + // (undocumented) + syncStatus: SyncStatus; + // (undocumented) + triggerCrudUpload: () => void; + // (undocumented) + updateSubscriptions(subscriptions: SubscribedStream[]): void; + // (undocumented) + waitForReady(): Promise; + // (undocumented) + waitForStatus(status: SyncStatusOptions): Promise; + // (undocumented) + waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "StreamingSyncImplementationListener" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface StreamingSyncImplementationListener extends BaseListener { + statusChanged?: ((status: SyncStatus) => void) | undefined; + statusUpdated?: ((statusUpdate: SyncStatusOptions) => void) | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "JSONValue" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export type StreamingSyncRequestParameterType = JSONValue; + +// Warning: (ae-internal-missing-underscore) The name "SubscribedStream" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SubscribedStream = { + name: string; + params: Record | null; +}; + +// @public @deprecated (undocumented) +export enum SyncClientImplementation { + RUST = "rust" +} + +// @public (undocumented) +export type SyncDataFlowStatus = Partial<{ + downloading: boolean; + uploading: boolean; + downloadError?: Error; + uploadError?: Error; + downloadProgress: InternalProgressInformation | null; + internalStreamSubscriptions: CoreStreamSubscription[] | null; +}>; + +// Warning: (ae-internal-missing-underscore) The name "SyncingService" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export class SyncingService { + constructor(attachmentService: AttachmentService, localStorage: LocalStorageAdapter, remoteStorage: RemoteStorageAdapter, logger: ILogger, errorHandler?: AttachmentErrorHandler); + deleteArchivedAttachments(context: AttachmentContext): Promise; + deleteAttachment(attachment: AttachmentRecord, context: AttachmentContext): Promise; + downloadAttachment(attachment: AttachmentRecord): Promise; + processAttachments(attachments: AttachmentRecord[], context: AttachmentContext): Promise; + uploadAttachment(attachment: AttachmentRecord): Promise; +} + +// @public (undocumented) +export interface SyncPriorityStatus { + // (undocumented) + hasSynced?: boolean; + // (undocumented) + lastSyncedAt?: Date; + // (undocumented) + priority: number; +} + +// @public +export class SyncProgress implements ProgressWithOperations { + constructor(internal: InternalProgressInformation); + // (undocumented) + downloadedFraction: number; + // (undocumented) + downloadedOperations: number; + // (undocumented) + protected internal: InternalProgressInformation; + // (undocumented) + totalOperations: number; + untilPriority(priority: number): ProgressWithOperations; +} + +// @public (undocumented) +export class SyncStatus { + // Warning: (ae-incompatible-release-tags) The symbol "__constructor" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + constructor(options: SyncStatusOptions); + // @deprecated + get clientImplementation(): SyncClientImplementation | undefined; + get connected(): boolean; + get connecting(): boolean; + get dataFlowStatus(): SyncDataFlowStatus; + get downloadProgress(): SyncProgress | null; + forStream(stream: SyncStreamDescription): SyncStreamStatus | undefined; + getMessage(): string; + get hasSynced(): boolean | undefined; + isEqual(status: SyncStatus): boolean; + get lastSyncedAt(): Date | undefined; + // Warning: (ae-incompatible-release-tags) The symbol "options" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + // + // (undocumented) + protected options: SyncStatusOptions; + get priorityStatusEntries(): SyncPriorityStatus[]; + protected serializeError(error?: Error): { + name: string; + message: string; + stack: string | undefined; + } | undefined; + statusForPriority(priority: number): SyncPriorityStatus; + get syncStreams(): SyncStreamStatus[] | undefined; + // Warning: (ae-incompatible-release-tags) The symbol "toJSON" is marked as @public, but its signature references "SyncStatusOptions" which is marked as @internal + toJSON(): SyncStatusOptions; +} + +// Warning: (ae-internal-missing-underscore) The name "SyncStatusOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SyncStatusOptions = { + connected?: boolean; + connecting?: boolean; + dataFlow?: SyncDataFlowStatus; + lastSyncedAt?: Date; + hasSynced?: boolean; + priorityStatusEntries?: SyncPriorityStatus[]; + clientImplementation?: SyncClientImplementation; +}; + +// @public +export interface SyncStream extends SyncStreamDescription { + subscribe(options?: SyncStreamSubscribeOptions): Promise; + unsubscribeAll(): Promise; +} + +// @public (undocumented) +export enum SyncStreamConnectionMethod { + // (undocumented) + HTTP = "http", + // (undocumented) + WEB_SOCKET = "web-socket" +} + +// @public +export interface SyncStreamDescription { + name: string; + parameters: Record | null; +} + +// Warning: (ae-internal-missing-underscore) The name "SyncStreamOptions" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type SyncStreamOptions = { + path: string; + data: unknown; + headers?: Record; + abortSignal: AbortSignal; + fetchOptions?: Request; +}; + +// @public +export interface SyncStreamStatus { + // (undocumented) + priority: number | null; + // (undocumented) + progress: ProgressWithOperations | null; + // (undocumented) + subscription: SyncSubscriptionDescription; +} + +// @public (undocumented) +export interface SyncStreamSubscribeOptions { + priority?: 0 | 1 | 2 | 3; + ttl?: number; +} + +// @public (undocumented) +export interface SyncStreamSubscription extends SyncStreamDescription { + unsubscribe(): void; + waitForFirstSync(abort?: AbortSignal): Promise; +} + +// @public +export interface SyncSubscriptionDescription extends SyncStreamDescription { + // (undocumented) + active: boolean; + expiresAt: Date | null; + hasExplicitSubscription: boolean; + hasSynced: boolean; + isDefault: boolean; + lastSyncedAt: Date | null; +} + +// @public (undocumented) +export class Table { + constructor(columns: Columns, options?: TableV2Options); + // @deprecated + constructor(options: TableOptions); + // (undocumented) + get columnMap(): Columns; + // (undocumented) + get columns(): Column[]; + // (undocumented) + copyWithName(name: string): Table; + // (undocumented) + static createInsertOnly(options: TableOptions): Table; + // (undocumented) + static createLocalOnly(options: TableOptions): Table; + // @deprecated + static createTable(name: string, table: Table): Table; + // (undocumented) + get ignoreEmptyUpdates(): boolean; + // (undocumented) + get indexes(): Index[]; + // (undocumented) + get insertOnly(): boolean; + // (undocumented) + get internalName(): string; + // (undocumented) + get localOnly(): boolean; + // (undocumented) + protected _mappedColumns: Columns; + // (undocumented) + get name(): string; + // (undocumented) + protected options: TableOptions; + // (undocumented) + toJSON(): { + local_only: boolean | undefined; + insert_only: boolean | undefined; + include_old: any; + include_old_only_when_changed: boolean; + include_metadata: boolean | undefined; + ignore_empty_update: boolean | undefined; + name: string; + view_name: string; + columns: { + name: string; + type: ColumnType | undefined; + }[]; + indexes: { + name: string; + columns: { + name: string; + ascending: boolean | undefined; + type: ColumnType; + }[]; + }[]; + }; + // (undocumented) + get trackMetadata(): boolean; + // (undocumented) + get trackPrevious(): boolean | TrackPreviousOptions; + // (undocumented) + validate(): void; + // (undocumented) + get validName(): boolean; + // (undocumented) + get viewName(): string; + // (undocumented) + get viewNameOverride(): string | undefined; +} + +// Warning: (ae-forgotten-export) The symbol "SharedTableOptions" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export interface TableOptions extends SharedTableOptions { + // (undocumented) + columns: Column[]; + // (undocumented) + indexes?: Index[]; + name: string; +} + +// @public +export interface TableOrRawTableOptions { + // (undocumented) + ignoreEmptyUpdates?: boolean; + // (undocumented) + insertOnly?: boolean; + // (undocumented) + localOnly?: boolean; + // (undocumented) + trackMetadata?: boolean; + // (undocumented) + trackPrevious?: boolean | TrackPreviousOptions; +} + +// @public (undocumented) +export interface TableUpdateOperation { + // (undocumented) + opType: RowUpdateType; + // (undocumented) + rowId: number; +} + +// @public @deprecated +export class TableV2 extends Table { +} + +// @public (undocumented) +export interface TableV2Options extends SharedTableOptions { + // (undocumented) + indexes?: IndexShorthand; +} + +// Warning: (ae-internal-missing-underscore) The name "timeoutSignal" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function timeoutSignal(timeout: number): AbortSignal; + +// @internal (undocumented) +export function timeoutSignal(timeout?: number): AbortSignal | undefined; + +// @alpha +export interface TrackDiffOptions extends BaseCreateDiffTriggerOptions { + onChange: (context: TriggerDiffHandlerContext) => Promise; + throttleMs?: number; +} + +// @public +export interface TrackPreviousOptions { + columns?: string[]; + onlyWhenChanged?: boolean; +} + +// @public (undocumented) +export interface Transaction extends LockContext { + commit: () => Promise; + rollback: () => Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerClaimManager" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export interface TriggerClaimManager { + checkClaim: (identifier: string) => Promise; + obtainClaim: (identifier: string) => Promise<() => Promise>; +} + +// @alpha +export interface TriggerCreationHooks { + beforeCreate?: (context: LockContext) => Promise; +} + +// @alpha +export interface TriggerDiffDeleteRecord extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.DELETE; + value: string; +} + +// @alpha +export interface TriggerDiffHandlerContext extends LockContext { + destinationTable: string; + withDiff: (query: string, params?: ReadonlyArray>, options?: WithDiffOptions) => Promise; + withExtractedDiff: (query: string, params?: ReadonlyArray>) => Promise; +} + +// @alpha +export interface TriggerDiffInsertRecord extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.INSERT; + value: string; +} + +// @alpha +export type TriggerDiffRecord = TriggerDiffUpdateRecord | TriggerDiffInsertRecord | TriggerDiffDeleteRecord; + +// @alpha +export interface TriggerDiffUpdateRecord extends BaseTriggerDiffRecord { + // (undocumented) + operation: DiffTriggerOperation.UPDATE; + previous_value: string; + value: string; +} + +// @alpha (undocumented) +export interface TriggerManager { + createDiffTrigger(options: CreateDiffTriggerOptions): Promise; + trackTableDiff(options: TrackDiffOptions): Promise; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerManagerConfig" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export interface TriggerManagerConfig { + // (undocumented) + claimManager: TriggerClaimManager; +} + +// Warning: (ae-internal-missing-underscore) The name "TriggerManagerImpl" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export class TriggerManagerImpl implements TriggerManager { + constructor(options: TriggerManagerImplOptions); + cleanupResources(): Promise; + // (undocumented) + protected cleanupTimeout: ReturnType | null; + // (undocumented) + createDiffTrigger(options: CreateDiffTriggerOptions): Promise<(options?: TriggerRemoveCallbackOptions) => Promise>; + // (undocumented) + protected get db(): AbstractPowerSyncDatabase; + // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplConfiguration" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected defaultConfig: TriggerManagerImplConfiguration; + // (undocumented) + dispose(): void; + // (undocumented) + protected generateTriggerName(operation: DiffTriggerOperation, destinationTable: string, triggerId: string): string; + // (undocumented) + protected getUUID(ctx?: LockContext): Promise; + // (undocumented) + protected isDisposed: boolean; + // Warning: (ae-forgotten-export) The symbol "TriggerManagerImplOptions" needs to be exported by the entry point index.d.ts + // + // (undocumented) + protected options: TriggerManagerImplOptions; + // (undocumented) + protected removeTriggers(tx: LockContext, triggerIds: string[]): Promise; + // (undocumented) + protected schema: Schema; + // (undocumented) + trackTableDiff(options: TrackDiffOptions): Promise; + updateDefaults(config: TriggerManagerImplConfiguration): void; +} + +// @alpha +export type TriggerRemoveCallback = (options?: TriggerRemoveCallbackOptions) => Promise; + +// @alpha +export interface TriggerRemoveCallbackOptions { + // (undocumented) + context?: LockContext; +} + +// Warning: (ae-internal-missing-underscore) The name "UnlockFn" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal (undocumented) +export type UnlockFn = () => void; + +// @public +export interface UpdateNotification extends TableUpdateOperation { + // (undocumented) + table: string; +} + +// @public +export enum UpdateType { + DELETE = "DELETE", + PATCH = "PATCH", + PUT = "PUT" +} + +// @public (undocumented) +export class UploadQueueStats { + constructor( + count: number, + size?: number | null); + count: number; + size: number | null; + // (undocumented) + toString(): string; +} + +// @public (undocumented) +export interface WatchCompatibleQuery { + // (undocumented) + compile(): CompiledQuery; + // (undocumented) + execute(options: WatchExecuteOptions): Promise; +} + +// @alpha +export type WatchedAttachmentItem = { + id: string; + filename: string; + fileExtension?: never; + metaData?: string; + mediaType?: string; +} | { + id: string; + fileExtension: string; + filename?: never; + metaData?: string; + mediaType?: string; +}; + +// Warning: (ae-forgotten-export) The symbol "MetaBaseObserverInterface" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +export interface WatchedQuery = WatchedQueryListener> extends MetaBaseObserverInterface { + close(): Promise; + // (undocumented) + readonly closed: boolean; + registerListener(listener: Listener): () => void; + readonly state: WatchedQueryState; + updateSettings(options: Settings): Promise; +} + +// @public +export interface WatchedQueryComparator { + // (undocumented) + checkEquality: (current: Data, previous: Data) => boolean; +} + +// @public +export interface WatchedQueryDifferential { + // (undocumented) + readonly added: ReadonlyArray>; + readonly all: ReadonlyArray>; + // (undocumented) + readonly removed: ReadonlyArray>; + // (undocumented) + readonly unchanged: ReadonlyArray>; + // (undocumented) + readonly updated: ReadonlyArray>>; +} + +// @public (undocumented) +export interface WatchedQueryListener extends BaseListener { + // (undocumented) + [WatchedQueryListenerEvent.CLOSED]?: () => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_DATA]?: (data: Data) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_ERROR]?: (error: Error) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.ON_STATE_CHANGE]?: (state: WatchedQueryState) => void | Promise; + // (undocumented) + [WatchedQueryListenerEvent.SETTINGS_WILL_UPDATE]?: () => void; +} + +// @public (undocumented) +export enum WatchedQueryListenerEvent { + // (undocumented) + CLOSED = "closed", + // (undocumented) + ON_DATA = "onData", + // (undocumented) + ON_ERROR = "onError", + // (undocumented) + ON_STATE_CHANGE = "onStateChange", + // (undocumented) + SETTINGS_WILL_UPDATE = "settingsWillUpdate" +} + +// @public (undocumented) +export interface WatchedQueryOptions { + reportFetching?: boolean; + throttleMs?: number; + triggerOnTables?: string[]; +} + +// @public +export interface WatchedQueryRowDifferential { + // (undocumented) + readonly current: RowType; + // (undocumented) + readonly previous: RowType; +} + +// @public +export interface WatchedQuerySettings extends WatchedQueryOptions { + // (undocumented) + query: WatchCompatibleQuery; +} + +// @public +export interface WatchedQueryState { + readonly data: Data; + readonly error: Error | null; + readonly isFetching: boolean; + readonly isLoading: boolean; + readonly lastUpdated: Date | null; +} + +// @public +export interface WatchExecuteOptions { + // (undocumented) + db: AbstractPowerSyncDatabase; + // (undocumented) + parameters: any[]; + // (undocumented) + sql: string; +} + +// @public (undocumented) +export interface WatchHandler { + // (undocumented) + onError?: (error: Error) => void; + // (undocumented) + onResult: (results: QueryResult) => void; +} + +// @public (undocumented) +export interface WatchOnChangeEvent { + // (undocumented) + changedTables: string[]; +} + +// @public (undocumented) +export interface WatchOnChangeHandler { + // (undocumented) + onChange: (event: WatchOnChangeEvent) => Promise | void; + // (undocumented) + onError?: (error: Error) => void; +} + +// @alpha +export interface WithDiffOptions { + castOperationIdAsText?: boolean; +} + +// Warnings were encountered during analysis: +// +// lib/db/crud/SyncStatus.d.ts:27:5 - (ae-forgotten-export) The symbol "InternalProgressInformation" needs to be exported by the entry point index.d.ts +// lib/db/crud/SyncStatus.d.ts:31:5 - (ae-forgotten-export) The symbol "CoreStreamSubscription" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +```