Do not edit this file. It is a report generated by API Extractor.
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<PowerSyncDBListener> {
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<void>;
closed: boolean;
connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise<void>;
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<RowType>(query: WatchCompatibleQuery<RowType[]>): Query<RowType>;
get database(): DBAdapter;
disconnect(): Promise<void>;
disconnectAndClear(options?: DisconnectAndClearOptions): Promise<void>;
// @deprecated (undocumented)
dispose(): void;
execute(sql: string, parameters?: any[]): Promise<QueryResult>;
executeBatch(sql: string, parameters?: any[][]): Promise<QueryResult>;
executeRaw(sql: string, parameters?: any[]): Promise<any[][]>;
// 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<T>(sql: string, parameters?: any[]): Promise<T>;
getAll<T>(sql: string, parameters?: any[]): Promise<T[]>;
getClientId(): Promise<string>;
getCrudBatch(limit?: number): Promise<CrudBatch | null>;
getCrudTransactions(): AsyncIterable<CrudTransaction, null>;
getNextCrudTransaction(): Promise<CrudTransaction | null>;
getOptional<T>(sql: string, parameters?: any[]): Promise<T | null>;
getUploadQueueStats(includeSize?: boolean): Promise<UploadQueueStats>;
init(): Promise<void>;
protected initialize(): Promise<void>;
abstract _initialize(): Promise<void>;
// (undocumented)
protected _isReadyPromise: Promise<void>;
// (undocumented)
protected loadVersion(): Promise<void>;
// (undocumented)
logger: ILogger;
onChange(options?: SQLOnChangeOptions): AsyncIterable<WatchOnChangeEvent>;
onChange(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void;
onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable<WatchOnChangeEvent>;
onChangeWithCallback(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void;
protected abstract openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter;
// (undocumented)
protected options: PowerSyncDatabaseOptions;
query<RowType>(query: ArrayQueryDefinition<RowType>): Query<RowType>;
readLock<T>(callback: (db: LockContext) => Promise<T>): Promise<T>;
readTransaction<T>(callback: (tx: Transaction) => Promise<T>, lockTimeout?: number): Promise<T>;
// (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<void>;
resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise<string[]>;
protected runExclusive<T>(callback: () => Promise<T>): Promise<T>;
// 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<any>;
}>;
// (undocumented)
protected _schema: Schema;
// (undocumented)
sdkVersion: string;
syncStream(name: string, params?: Record<string, any>): 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<void>;
waitForFirstSync(request?: AbortSignal | {
signal?: AbortSignal;
priority?: number;
}): Promise<void>;
// (undocumented)
waitForReady(): Promise<void>;
waitForStatus(predicate: (status: SyncStatus) => any, signal?: AbortSignal): Promise<void>;
watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable<QueryResult>;
watch(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void;
watchWithAsyncGenerator(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable<QueryResult>;
watchWithCallback(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void;
writeLock<T>(callback: (db: LockContext) => Promise<T>): Promise<T>;
writeTransaction<T>(callback: (tx: Transaction) => Promise<T>, lockTimeout?: number): Promise<T>;
}
// 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<any>;
}>;
}
// 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<WatchedQueryProcessorListener<Data>> implements WatchedQuery<Data, Settings> {
constructor(options: AbstractQueryProcessorOptions<Data, Settings>);
// (undocumented)
protected abortController: AbortController;
// (undocumented)
close(): Promise<void>;
// (undocumented)
get closed(): boolean;
// (undocumented)
protected _closed: boolean;
// (undocumented)
protected constructInitialState(): WatchedQueryState<Data>;
// (undocumented)
protected disposeListeners: (() => void) | null;
protected init(signal: AbortSignal): Promise<void>;
// (undocumented)
protected initialized: Promise<void>;
protected iterateAsyncListenersWithError(callback: (listener: Partial<WatchedQueryProcessorListener<Data>>) => Promise<void> | void): Promise<void>;
protected abstract linkQuery(options: LinkQueryOptions<Data>): Promise<void>;
// (undocumented)
protected options: AbstractQueryProcessorOptions<Data, Settings>;
// (undocumented)
protected get reportFetching(): boolean;
protected runWithReporting<T>(callback: () => Promise<T>): Promise<void>;
// (undocumented)
readonly state: WatchedQueryState<Data>;
updateSettings(settings: Settings): Promise<void>;
// (undocumented)
protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise<void>;
// (undocumented)
protected updateState(update: Partial<MutableWatchedQueryState<Data>>): Promise<void>;
}
// 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<Data, Settings extends WatchedQueryOptions = WatchedQueryOptions> {
// (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<AbstractRemoteOptions>);
// (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<PowerSyncCredentials | null>;
fetchStream(options: SyncStreamOptions): Promise<SimpleAsyncIterator<Uint8Array | string>>;
protected fetchStreamRaw(options: SyncStreamOptions): Promise<{
isBson: boolean;
stream: SimpleAsyncIterator<Uint8Array>;
}>;
// (undocumented)
get(path: string, headers?: Record<string, string>): Promise<any>;
getCredentials(): Promise<PowerSyncCredentials | null>;
// (undocumented)
getUserAgent(): string;
invalidateCredentials(): void;
// (undocumented)
protected logger: ILogger;
// (undocumented)
protected options: AbstractRemoteOptions;
// (undocumented)
post(path: string, data: any, headers?: Record<string, string>): Promise<any>;
prefetchCredentials(): Promise<PowerSyncCredentials | null>;
socketStreamRaw(options: SocketSyncStreamOptions): Promise<SimpleAsyncIterator<Uint8Array>>;
// (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<StreamingSyncImplementationListener> implements StreamingSyncImplementation {
constructor(options: AbstractStreamingSyncImplementationOptions);
// (undocumented)
protected abortController: AbortController | null;
// (undocumented)
connect(options?: PowerSyncConnectionOptions): Promise<void>;
// (undocumented)
protected crudUpdateListener?: () => void;
// (undocumented)
disconnect(): Promise<void>;
// (undocumented)
dispose(): Promise<void>;
// (undocumented)
getWriteCheckpoint(): Promise<string>;
// (undocumented)
get isConnected(): boolean;
// (undocumented)
get lastSyncedAt(): Date | undefined;
// (undocumented)
protected logger: ILogger;
// (undocumented)
markConnectionMayHaveChanged(): void;
// (undocumented)
abstract obtainLock<T>(lockOptions: LockOptions_2<T>): Promise<T>;
// (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<RustIterationResult | null>;
// (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<void>;
// (undocumented)
waitForStatus(status: SyncStatusOptions): Promise<void>;
// (undocumented)
waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise<void>;
}
// 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<void>;
}
// 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<ItemType> implements WatchedQueryComparator<ItemType[]> {
constructor(options: ArrayComparatorOptions<ItemType>);
// (undocumented)
checkEquality(current: ItemType[], previous: ItemType[]): boolean;
// (undocumented)
protected options: ArrayComparatorOptions<ItemType>;
}
// @public
export type ArrayComparatorOptions<ItemType> = {
compareBy: (item: ItemType) => string;
};
// @public
export interface ArrayQueryDefinition<RowType = unknown> {
mapper?: (row: Record<string, unknown>) => RowType;
// (undocumented)
parameters?: ReadonlyArray<Readonly<QueryParam>>;
// (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<void>;
readonly db: AbstractPowerSyncDatabase;
// (undocumented)
deleteArchivedAttachments(callback?: (attachments: AttachmentRecord[]) => Promise<void>): Promise<boolean>;
deleteAttachment(attachmentId: string): Promise<void>;
getActiveAttachments(): Promise<AttachmentRecord[]>;
getArchivedAttachments(): Promise<AttachmentRecord[]>;
// (undocumented)
getAttachment(id: string): Promise<AttachmentRecord | undefined>;
getAttachments(): Promise<AttachmentRecord[]>;
readonly logger: ILogger;
saveAttachments(attachments: AttachmentRecord[]): Promise<void>;
readonly tableName: string;
upsertAttachment(attachment: AttachmentRecord, context: Transaction): Promise<void>;
}
// @alpha (undocumented)
export type AttachmentData = ArrayBuffer | string;
// @alpha
export interface AttachmentErrorHandler {
onDeleteError(attachment: AttachmentRecord, error: unknown): Promise<boolean>;
onDownloadError(attachment: AttachmentRecord, error: unknown): Promise<boolean>;
onUploadError(attachment: AttachmentRecord, error: unknown): Promise<boolean>;
}
// @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<void>, signal: AbortSignal) => void;
tableName?: string;
logger?: ILogger;
syncIntervalMs?: number;
syncThrottleDuration?: number;
downloadAttachments?: boolean;
archivedCacheLimit?: number;
errorHandler?: AttachmentErrorHandler;
});
readonly archivedCacheLimit: number;
// (undocumented)
clearQueue(): Promise<void>;
// (undocumented)
deleteFile(input: {
id: string;
updateHook?: (transaction: Transaction, attachment: AttachmentRecord) => Promise<void>;
}): Promise<void>;
readonly downloadAttachments: boolean;
// (undocumented)
expireCache(): Promise<void>;
generateAttachmentId(): Promise<string>;
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<void>;
}): Promise<AttachmentRecord>;
startSync(): Promise<void>;
stopSync(): Promise<void>;
readonly syncIntervalMs: number;
syncStorage(): Promise<void>;
readonly syncThrottleDuration: number;
readonly tableName: string;
verifyAttachments(): Promise<void>;
withAttachmentContext<T>(callback: (context: AttachmentContext) => Promise<T>): Promise<T>;
}
// @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<AttachmentRecord>;
withContext<T>(callback: (context: AttachmentContext) => Promise<T>): Promise<T>;
}
// @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<TableV2Options, 'name' | 'columns'> {
}
// @public (undocumented)
export type BaseColumnType<T extends number | string | null> = {
type: ColumnType;
};
// @public (undocumented)
export interface BaseConnectionOptions {
appMetadata?: Record<string, string>;
// @deprecated (undocumented)
clientImplementation?: SyncClientImplementation;
connectionMethod?: SyncStreamConnectionMethod;
fetchStrategy?: FetchStrategy;
includeDefaultStreams?: boolean;
params?: Record<string, StreamingSyncRequestParameterType>;
serializedSchema?: any;
}
// @public (undocumented)
export type BaseListener = Record<string, ((...event: any) => 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<T extends BaseListener = BaseListener> implements BaseObserverInterface<T> {
constructor();
// (undocumented)
dispose(): void;
// (undocumented)
iterateAsyncListeners(cb: (listener: Partial<T>) => Promise<any>): Promise<void>;
// (undocumented)
iterateListeners(cb: (listener: Partial<T>) => any): void;
// (undocumented)
protected listeners: Set<Partial<T>>;
registerListener(listener: Partial<T>): () => void;
}
// @public (undocumented)
export interface BaseObserverInterface<T extends BaseListener> {
// (undocumented)
registerListener(listener: Partial<T>): () => 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<TOperationId extends string | number = number> {
id: string;
operation: DiffTriggerOperation;
operation_id: TOperationId;
timestamp: string;
}
// @public (undocumented)
export interface BatchedUpdateNotification {
// (undocumented)
groupedUpdates: Record<string, TableUpdateOperation[]>;
// (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<BucketStorageListener>, Disposable_2 {
control(op: PowerSyncControlCommand, payload: string | Uint8Array | null): Promise<string>;
getClientId(): Promise<string>;
// (undocumented)
getCrudBatch(limit?: number): Promise<CrudBatch | null>;
// (undocumented)
getMaxOpId(): string;
// (undocumented)
hasCrud(): Promise<boolean>;
// (undocumented)
hasMigratedSubkeys(): Promise<boolean>;
// (undocumented)
init(): Promise<void>;
// (undocumented)
migrateToFixedSubkeys(): Promise<void>;
// (undocumented)
nextCrudItem(): Promise<CrudEntry | undefined>;
// (undocumented)
updateLocalTarget(cb: () => Promise<string>): Promise<boolean>;
}
// 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<string | null>;
integer: BaseColumnType<number | null>;
real: BaseColumnType<number | null>;
};
// @public (undocumented)
export interface ColumnOptions {
// (undocumented)
name: string;
// (undocumented)
type?: ColumnType;
}
// @public (undocumented)
export type ColumnsType = Record<string, BaseColumnType<any>>;
// @public (undocumented)
export enum ColumnType {
// (undocumented)
INTEGER = "INTEGER",
// (undocumented)
REAL = "REAL",
// (undocumented)
TEXT = "TEXT"
}
// @public (undocumented)
export interface CompilableQuery<T> {
// (undocumented)
compile(): CompiledQuery;
// (undocumented)
execute(): Promise<T[]>;
}
// @public (undocumented)
export function compilableQueryWatch<T>(db: AbstractPowerSyncDatabase, query: CompilableQuery<T>, handler: CompilableQueryWatchHandler<T>, options?: SQLWatchOptions): void;
// @public (undocumented)
export interface CompilableQueryWatchHandler<T> {
// (undocumented)
onError?: (error: Error) => void;
// (undocumented)
onResult: (results: T[]) => void;
}
// @public (undocumented)
export interface CompiledQuery {
// (undocumented)
readonly parameters: ReadonlyArray<unknown>;
// (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<ConnectionManagerListener> {
constructor(options: ConnectionManagerOptions);
get activeStreams(): {
name: string;
params: Record<string, any> | null;
}[];
// (undocumented)
close(): Promise<void>;
// (undocumented)
connect(connector: PowerSyncBackendConnector, options: InternalConnectionOptions): Promise<void>;
protected connectingPromise: Promise<void> | null;
// (undocumented)
protected connectInternal(): Promise<void>;
// (undocumented)
get connectionOptions(): InternalConnectionOptions | null;
// (undocumented)
get connector(): PowerSyncBackendConnector | null;
disconnect(): Promise<void>;
protected disconnectingPromise: Promise<void> | null;
// (undocumented)
protected disconnectInternal(): Promise<void>;
// (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<void>;
// (undocumented)
stream(adapter: InternalSubscriptionAdapter, name: string, parameters: Record<string, any> | null): SyncStream;
protected syncDisposer: (() => Promise<void> | void) | null;
// (undocumented)
syncStreamImplementation: StreamingSyncImplementation | null;
protected syncStreamInitPromise: Promise<void> | 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<ConnectionManagerSyncImplementationResult>;
// (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> | void;
// (undocumented)
sync: StreamingSyncImplementation;
}
// @public (undocumented)
export interface ConnectionPool extends BaseObserverInterface<DBAdapterListener> {
// (undocumented)
close: () => void | Promise<void>;
// (undocumented)
name: string;
// (undocumented)
readLock: <T>(fn: (tx: LockContext) => Promise<T>, options?: DBLockOptions) => Promise<T>;
refreshSchema: () => Promise<void>;
// (undocumented)
writeLock: <T>(fn: (tx: LockContext) => Promise<T>, options?: DBLockOptions) => Promise<T>;
}
// 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<T> {
constructor(task: (param: T) => Promise<void> | 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<void>);
complete: (writeCheckpoint?: string) => Promise<void>;
crud: CrudEntry[];
haveMore: boolean;
}
// @public
export class CrudEntry {
constructor(clientId: number, op: UpdateType, table: string, id: string, transactionId?: number, opData?: Record<string, any>, previousValues?: Record<string, any>, 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<string, any>;
previousValues?: Record<string, any>;
table: string;
toComparisonArray(): (string | number | Record<string, any> | 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<void>,
transactionId?: number | undefined);
complete: (checkpoint?: string) => Promise<void>;
crud: CrudEntry[];
transactionId?: number | undefined;
}
// @public (undocumented)
export interface DBAdapter extends ConnectionPool, SqlExecutor, DBGetUtils {
// (undocumented)
readTransaction: <T>(fn: (tx: Transaction) => Promise<T>, options?: DBLockOptions) => Promise<T>;
// (undocumented)
writeTransaction: <T>(fn: (tx: Transaction) => Promise<T>, options?: DBLockOptions) => Promise<T>;
}
// 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<TBase extends new (...args: any[]) => ConnectionPool>(Base: TBase): {
new (...args: any[]): {
readTransaction<T>(fn: (tx: Transaction) => Promise<T>, options?: DBLockOptions): Promise<T>;
writeTransaction<T>(fn: (tx: Transaction) => Promise<T>, options?: DBLockOptions): Promise<T>;
getAll<T>(sql: string, parameters?: any[]): Promise<T[]>;
getOptional<T>(sql: string, parameters?: any[]): Promise<T | null>;
get<T>(sql: string, parameters?: any[]): Promise<T>;
execute(query: string, params?: any[]): Promise<QueryResult>;
executeRaw(query: string, params?: any[]): Promise<any[][]>;
executeBatch(query: string, params?: any[][]): Promise<QueryResult>;
name: string;
close: () => void | Promise<void>;
readLock: <T>(fn: (tx: LockContext) => Promise<T>, options?: DBLockOptions) => Promise<T>;
writeLock: <T>(fn: (tx: LockContext) => Promise<T>, options?: DBLockOptions) => Promise<T>;
refreshSchema: () => Promise<void>;
registerListener(listener: Partial<DBAdapterListener>): () => void;
};
} & TBase;
// @public (undocumented)
export interface DBAdapterListener extends BaseListener {
tablesUpdated: (updateNotification: BatchedUpdateNotification | UpdateNotification) => void;
}
// @public (undocumented)
export interface DBGetUtils {
get<T>(sql: string, parameters?: any[]): Promise<T>;
getAll<T>(sql: string, parameters?: any[]): Promise<T[]>;
getOptional<T>(sql: string, parameters?: any[]): Promise<T | null>;
}
// 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<TBase extends new (...args: any[]) => Omit<SqlExecutor, 'executeBatch'>>(Base: TBase): {
new (...args: any[]): {
getAll<T>(sql: string, parameters?: any[]): Promise<T[]>;
getOptional<T>(sql: string, parameters?: any[]): Promise<T | null>;
get<T>(sql: string, parameters?: any[]): Promise<T>;
executeBatch(query: string, params?: any[][]): Promise<QueryResult>;
execute: (query: string, params?: any[] | undefined) => Promise<QueryResult>;
executeRaw: (query: string, params?: any[] | undefined) => Promise<any[][]>;
};
} & 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<IndexColumnOptions>;
// 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<IndexOptions>;
// 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<any>;
// 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<RowType> extends AbstractQueryProcessor<ReadonlyArray<Readonly<RowType>>, DifferentialWatchedQuerySettings<RowType>> implements DifferentialWatchedQuery<RowType> {
constructor(options: DifferentialQueryProcessorOptions<RowType>);
// (undocumented)
protected comparator: DifferentialWatchedQueryComparator<RowType>;
// 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<RowType>): {
diff: WatchedQueryDifferential<RowType>;
map: DataHashMap<RowType>;
hasChanged: boolean;
};
// (undocumented)
protected linkQuery(options: LinkQueryOptions<WatchedQueryDifferential<RowType>>): Promise<void>;
// (undocumented)
protected options: DifferentialQueryProcessorOptions<RowType>;
}
// 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<RowType> extends AbstractQueryProcessorOptions<RowType[], DifferentialWatchedQuerySettings<RowType>> {
// (undocumented)
rowComparator?: DifferentialWatchedQueryComparator<RowType>;
}
// @public (undocumented)
export type DifferentialWatchedQuery<RowType> = WatchedQuery<ReadonlyArray<Readonly<RowType>>, DifferentialWatchedQuerySettings<RowType>, DifferentialWatchedQueryListener<RowType>>;
// @public
export interface DifferentialWatchedQueryComparator<RowType> {
compareBy: (item: RowType) => string;
keyBy: (item: RowType) => string;
}
// @public (undocumented)
export interface DifferentialWatchedQueryListener<RowType> extends WatchedQueryListener<ReadonlyArray<Readonly<RowType>>> {
// (undocumented)
onDiff?: (diff: WatchedQueryDifferential<RowType>) => void | Promise<void>;
}
// @public
export interface DifferentialWatchedQueryOptions<RowType> extends WatchedQueryOptions {
placeholderData?: RowType[];
rowComparator?: DifferentialWatchedQueryComparator<RowType>;
}
// @public
export interface DifferentialWatchedQuerySettings<RowType> extends DifferentialWatchedQueryOptions<RowType> {
query: WatchCompatibleQuery<RowType[]>;
}
// @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> | 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<any>> = T extends BaseColumnType<infer R> ? R : unknown;
// @alpha
export type ExtractedTriggerDiffRecord<T, TOperationId extends string | number = number> = T & {
[K in keyof Omit<BaseTriggerDiffRecord<TOperationId>, 'id'> as `__${string & K}`]: TriggerDiffRecord<TOperationId>[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<unknown>;
// 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<RowType = unknown> implements WatchCompatibleQuery<RowType[]> {
constructor(options: GetAllQueryOptions<RowType>);
// (undocumented)
compile(): CompiledQuery;
// (undocumented)
execute(options: {
db: AbstractPowerSyncDatabase;
}): Promise<RowType[]>;
// (undocumented)
protected options: GetAllQueryOptions<RowType>;
}
// @public
export type GetAllQueryOptions<RowType = unknown> = {
sql: string;
parameters?: ReadonlyArray<unknown>;
mapper?: (rawRow: Record<string, unknown>) => 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<string, string[]>;
// 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<void>;
// (undocumented)
resolveOfflineSyncStatus(): Promise<void>;
// (undocumented)
rustSubscriptionsCommand(payload: any): Promise<void>;
}
// 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<Data, Settings extends WatchedQueryOptions = WatchedQueryOptions> {
// (undocumented)
abortSignal: AbortSignal;
// (undocumented)
settings: Settings;
}
// @alpha
export interface LocalStorageAdapter {
clear(): Promise<void>;
deleteFile(filePath: string): Promise<void>;
fileExists(filePath: string): Promise<boolean>;
getLocalUri(filename: string): string;
initialize(): Promise<void>;
makeDir(path: string): Promise<void>;
readFile(filePath: string): Promise<ArrayBuffer>;
rmDir(path: string): Promise<void>;
saveFile(filePath: string, data: AttachmentData): Promise<number>;
}
// @public (undocumented)
export interface LockContext extends SqlExecutor, DBGetUtils {
connectionType?: 'writer' | 'queryOnly' | 'readOnly';
}
// @internal
interface LockOptions_2<T> {
// (undocumented)
callback: () => Promise<T>;
// (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<Data> = {
-readonly [P in keyof WatchedQueryState<Data>]: MutableDeep<WatchedQueryState<Data>[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<UnlockFn>;
// (undocumented)
runExclusive<T>(fn: () => PromiseLike<T> | T, abort?: AbortSignal): Promise<T>;
}
// 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<Data> extends AbstractQueryProcessor<Data, WatchedQuerySettings<Data>> {
constructor(options: OnChangeQueryProcessorOptions<Data>);
// (undocumented)
protected checkEquality(current: Data, previous: Data): boolean;
// (undocumented)
protected linkQuery(options: LinkQueryOptions<Data>): Promise<void>;
// (undocumented)
protected options: OnChangeQueryProcessorOptions<Data>;
}
// 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<Data> extends AbstractQueryProcessorOptions<Data, WatchedQuerySettings<Data>> {
// (undocumented)
comparator?: WatchedQueryComparator<Data>;
}
// @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: <T>(query: string | CompilableQuery<T>, 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<PowerSyncCredentials | null>;
uploadData: (database: AbstractPowerSyncDatabase) => Promise<void>;
}
// @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<InternalConnectionOptions, 'serializedSchema'>;
// 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> | void;
// (undocumented)
closing: () => Promise<void> | 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<PowerSyncDatabaseOptions>, 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<RowType> {
differentialWatch(options?: DifferentialWatchedQueryOptions<RowType>): DifferentialWatchedQuery<RowType>;
watch(options?: StandardWatchedQueryOptions<RowType>): StandardWatchedQuery<ReadonlyArray<Readonly<RowType>>>;
}
// @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<PowerSyncCredentials | null>;
invalidateCredentials?: () => void;
};
// @alpha
export interface RemoteStorageAdapter {
deleteFile(attachment: AttachmentRecord): Promise<void>;
downloadFile(attachment: AttachmentRecord): Promise<ArrayBuffer>;
uploadFile(fileData: ArrayBuffer, attachment: AttachmentRecord): Promise<void>;
}
// 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<AdditionalConnectionOptions> {
// (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<BaseConnectionOptions>;
// @public (undocumented)
export type RowType<T extends TableV2<any>> = {
[K in keyof T['columnMap']]: ExtractColumnValueType<T['columnMap'][K]>;
} & {
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<S extends SchemaType = SchemaType> {
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<S>;
// (undocumented)
validate(): void;
withRawTables(tables: Record<string, RawTableType>): void;
}
// @public (undocumented)
export type SchemaTableType<S extends SchemaType> = {
[K in keyof S]: RowType<S[K]>;
};
// 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<T> {
constructor(elements: Iterable<T>);
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<T> = Pick<AsyncIterator<T>, '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<QueryResult>;
// (undocumented)
executeBatch: (query: string, params?: any[][]) => Promise<QueryResult>;
executeRaw: (query: string, params?: any[] | undefined) => Promise<any[][]>;
}
// 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<BucketStorageListener> implements BucketStorageAdapter {
constructor(db: DBAdapter, logger?: ILogger);
// (undocumented)
control(op: PowerSyncControlCommand, payload: string | Uint8Array | ArrayBuffer | null): Promise<string>;
// (undocumented)
dispose(): Promise<void>;
// (undocumented)
getClientId(): Promise<string>;
// (undocumented)
_getClientId(): Promise<string>;
getCrudBatch(limit?: number): Promise<CrudBatch | null>;
// (undocumented)
getMaxOpId(): string;
// (undocumented)
hasCrud(): Promise<boolean>;
// (undocumented)
hasMigratedSubkeys(): Promise<boolean>;
// (undocumented)
init(): Promise<void>;
// (undocumented)
migrateToFixedSubkeys(): Promise<void>;
// (undocumented)
nextCrudItem(): Promise<CrudEntry | undefined>;
// (undocumented)
static _subkeyMigrationKey: string;
// (undocumented)
tableNames: Set<string>;
// (undocumented)
updateLocalTarget(cb: () => Promise<string>): Promise<boolean>;
// (undocumented)
writeTransaction<T>(callback: (tx: Transaction) => Promise<T>, options?: {
timeoutMs: number;
}): Promise<T>;
}
// @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<QueryResult>;
}
// @public
export type StandardWatchedQuery<DataType> = WatchedQuery<DataType, WatchedQuerySettings<DataType>>;
// @public
export interface StandardWatchedQueryOptions<RowType> extends WatchedQueryOptions {
comparator?: WatchedQueryComparator<RowType[]>;
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<StreamingSyncImplementationListener>, Disposable_2 {
connect(options?: InternalConnectionOptions): Promise<void>;
disconnect(): Promise<void>;
// (undocumented)
getWriteCheckpoint: () => Promise<string>;
// (undocumented)
isConnected: boolean;
// (undocumented)
markConnectionMayHaveChanged(): void;
// (undocumented)
syncStatus: SyncStatus;
// (undocumented)
triggerCrudUpload: () => void;
// (undocumented)
updateSubscriptions(subscriptions: SubscribedStream[]): void;
// (undocumented)
waitForReady(): Promise<void>;
// (undocumented)
waitForStatus(status: SyncStatusOptions): Promise<void>;
// (undocumented)
waitUntilStatusMatches(predicate: (status: SyncStatus) => boolean): Promise<void>;
}
// 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<string, any> | 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<boolean>;
deleteAttachment(attachment: AttachmentRecord, context: AttachmentContext): Promise<AttachmentRecord>;
downloadAttachment(attachment: AttachmentRecord): Promise<AttachmentRecord>;
processAttachments(attachments: AttachmentRecord[], context: AttachmentContext): Promise<void>;
uploadAttachment(attachment: AttachmentRecord): Promise<AttachmentRecord>;
}
// @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<SyncStreamSubscription>;
unsubscribeAll(): Promise<void>;
}
// @public (undocumented)
export enum SyncStreamConnectionMethod {
// (undocumented)
HTTP = "http",
// (undocumented)
WEB_SOCKET = "web-socket"
}
// @public
export interface SyncStreamDescription {
name: string;
parameters: Record<string, any> | 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<string, string>;
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<void>;
}
// @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<Columns extends ColumnsType = ColumnsType> {
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<ColumnsType>;
// (undocumented)
static createLocalOnly(options: TableOptions): Table<ColumnsType>;
// @deprecated
static createTable(name: string, table: Table): Table<ColumnsType>;
// (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<Columns extends ColumnsType = ColumnsType> extends Table<Columns> {
}
// @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<void>;
throttleMs?: number;
}
// @public
export interface TrackPreviousOptions {
columns?: string[];
onlyWhenChanged?: boolean;
}
// @public (undocumented)
export interface Transaction extends LockContext {
commit: () => Promise<QueryResult>;
rollback: () => Promise<QueryResult>;
}
// 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<boolean>;
obtainClaim: (identifier: string) => Promise<() => Promise<void>>;
}
// @alpha
export interface TriggerCreationHooks {
beforeCreate?: (context: LockContext) => Promise<void>;
}
// @alpha
export interface TriggerDiffDeleteRecord<TOperationId extends string | number = number> extends BaseTriggerDiffRecord<TOperationId> {
// (undocumented)
operation: DiffTriggerOperation.DELETE;
value: string;
}
// @alpha
export interface TriggerDiffHandlerContext extends LockContext {
destinationTable: string;
withDiff: <T = any>(query: string, params?: ReadonlyArray<Readonly<any>>, options?: WithDiffOptions) => Promise<T[]>;
withExtractedDiff: <T = any>(query: string, params?: ReadonlyArray<Readonly<any>>) => Promise<T[]>;
}
// @alpha
export interface TriggerDiffInsertRecord<TOperationId extends string | number = number> extends BaseTriggerDiffRecord<TOperationId> {
// (undocumented)
operation: DiffTriggerOperation.INSERT;
value: string;
}
// @alpha
export type TriggerDiffRecord<TOperationId extends string | number = number> = TriggerDiffUpdateRecord<TOperationId> | TriggerDiffInsertRecord<TOperationId> | TriggerDiffDeleteRecord<TOperationId>;
// @alpha
export interface TriggerDiffUpdateRecord<TOperationId extends string | number = number> extends BaseTriggerDiffRecord<TOperationId> {
// (undocumented)
operation: DiffTriggerOperation.UPDATE;
previous_value: string;
value: string;
}
// @alpha (undocumented)
export interface TriggerManager {
createDiffTrigger(options: CreateDiffTriggerOptions): Promise<TriggerRemoveCallback>;
trackTableDiff(options: TrackDiffOptions): Promise<TriggerRemoveCallback>;
}
// 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<void>;
// (undocumented)
protected cleanupTimeout: ReturnType<typeof setTimeout> | null;
// (undocumented)
createDiffTrigger(options: CreateDiffTriggerOptions): Promise<(options?: TriggerRemoveCallbackOptions) => Promise<void>>;
// (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<string>;
// (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<void>;
// (undocumented)
protected schema: Schema;
// (undocumented)
trackTableDiff(options: TrackDiffOptions): Promise<TriggerRemoveCallback>;
updateDefaults(config: TriggerManagerImplConfiguration): void;
}
// @alpha
export type TriggerRemoveCallback = (options?: TriggerRemoveCallbackOptions) => Promise<void>;
// @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<ResultType> {
// (undocumented)
compile(): CompiledQuery;
// (undocumented)
execute(options: WatchExecuteOptions): Promise<ResultType>;
}
// @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<Data> = WatchedQueryListener<Data>> extends MetaBaseObserverInterface<Listener> {
close(): Promise<void>;
// (undocumented)
readonly closed: boolean;
registerListener(listener: Listener): () => void;
readonly state: WatchedQueryState<Data>;
updateSettings(options: Settings): Promise<void>;
}
// @public
export interface WatchedQueryComparator<Data> {
// (undocumented)
checkEquality: (current: Data, previous: Data) => boolean;
}
// @public
export interface WatchedQueryDifferential<RowType> {
// (undocumented)
readonly added: ReadonlyArray<Readonly<RowType>>;
readonly all: ReadonlyArray<Readonly<RowType>>;
// (undocumented)
readonly removed: ReadonlyArray<Readonly<RowType>>;
// (undocumented)
readonly unchanged: ReadonlyArray<Readonly<RowType>>;
// (undocumented)
readonly updated: ReadonlyArray<WatchedQueryRowDifferential<Readonly<RowType>>>;
}
// @public (undocumented)
export interface WatchedQueryListener<Data> extends BaseListener {
// (undocumented)
[WatchedQueryListenerEvent.CLOSED]?: () => void | Promise<void>;
// (undocumented)
[WatchedQueryListenerEvent.ON_DATA]?: (data: Data) => void | Promise<void>;
// (undocumented)
[WatchedQueryListenerEvent.ON_ERROR]?: (error: Error) => void | Promise<void>;
// (undocumented)
[WatchedQueryListenerEvent.ON_STATE_CHANGE]?: (state: WatchedQueryState<Data>) => void | Promise<void>;
// (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<RowType> {
// (undocumented)
readonly current: RowType;
// (undocumented)
readonly previous: RowType;
}
// @public
export interface WatchedQuerySettings<DataType> extends WatchedQueryOptions {
// (undocumented)
query: WatchCompatibleQuery<DataType>;
}
// @public
export interface WatchedQueryState<Data> {
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> | 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)