|
| 1 | +## API Report File for "@powersync/node" |
| 2 | + |
| 3 | +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). |
| 4 | +
|
| 5 | +```ts |
| 6 | + |
| 7 | +import { AttachmentData } from '@powersync/common'; |
| 8 | +import type { AttachmentRecord } from '@powersync/common'; |
| 9 | +import { AttachmentTransportAdapter } from '@powersync/common'; |
| 10 | +import { BasePowerSyncDatabaseOptions } from '@powersync/common'; |
| 11 | +import { CommonPowerSyncDatabase } from '@powersync/common'; |
| 12 | +import { DatabaseSource } from '@powersync/common'; |
| 13 | +import { Dispatcher } from 'undici'; |
| 14 | +import { EncodingType } from '@powersync/common'; |
| 15 | +import type { LocatedAttachmentRecord } from '@powersync/common'; |
| 16 | +import { LockContext } from '@powersync/common'; |
| 17 | +import { PowerSyncDatabaseConstructor } from '@powersync/common'; |
| 18 | +import { SQLOpenOptions } from '@powersync/common'; |
| 19 | +import { StreamingLocalStorageAdapter } from '@powersync/common'; |
| 20 | +import { Worker as Worker_2 } from 'node:worker_threads'; |
| 21 | + |
| 22 | +// @public |
| 23 | +export interface BetterSqlite3Options { |
| 24 | + // (undocumented) |
| 25 | + type: 'better-sqlite3'; |
| 26 | +} |
| 27 | + |
| 28 | +// Warning: (ae-incompatible-release-tags) The symbol "NodeDatabaseImplementation" is marked as @public, but its signature references "NodeSqliteOptions" which is marked as @alpha |
| 29 | +// |
| 30 | +// @public |
| 31 | +export type NodeDatabaseImplementation = BetterSqlite3Options | NodeSqliteOptions; |
| 32 | + |
| 33 | +// @alpha |
| 34 | +export interface NodeDownloadRequest { |
| 35 | + headers?: Record<string, string>; |
| 36 | + url: string; |
| 37 | +} |
| 38 | + |
| 39 | +// @public |
| 40 | +export class NodeFileSystemAdapter implements StreamingLocalStorageAdapter { |
| 41 | + constructor(storageDirectory?: string); |
| 42 | + // (undocumented) |
| 43 | + clear(): Promise<void>; |
| 44 | + // Warning: (ae-incompatible-release-tags) The symbol "createTransportAdapter" is marked as @public, but its signature references "NodeFileSystemTransportAdapterOptions" which is marked as @alpha |
| 45 | + createTransportAdapter(options: NodeFileSystemTransportAdapterOptions): AttachmentTransportAdapter; |
| 46 | + // (undocumented) |
| 47 | + deleteFile(path: string, options?: { |
| 48 | + filename?: string; |
| 49 | + }): Promise<void>; |
| 50 | + // (undocumented) |
| 51 | + downloadFile(filePath: string): Promise<Blob>; |
| 52 | + // (undocumented) |
| 53 | + fileExists(filePath: string): Promise<boolean>; |
| 54 | + // (undocumented) |
| 55 | + getLocalUri(filename: string): string; |
| 56 | + // (undocumented) |
| 57 | + initialize(): Promise<void>; |
| 58 | + // (undocumented) |
| 59 | + makeDir(path: string): Promise<void>; |
| 60 | + // (undocumented) |
| 61 | + moveFile(sourceUri: string, targetUri: string): Promise<number>; |
| 62 | + // (undocumented) |
| 63 | + readFile(filePath: string, options?: { |
| 64 | + encoding?: EncodingType; |
| 65 | + mediaType?: string; |
| 66 | + }): Promise<ArrayBuffer>; |
| 67 | + // (undocumented) |
| 68 | + rmDir(path: string): Promise<void>; |
| 69 | + // (undocumented) |
| 70 | + saveFile(filePath: string, data: AttachmentData, options?: { |
| 71 | + encoding?: EncodingType; |
| 72 | + mediaType?: string; |
| 73 | + }): Promise<number>; |
| 74 | + // (undocumented) |
| 75 | + uploadFile(filePath: string, data: ArrayBuffer, options?: { |
| 76 | + encoding: EncodingType; |
| 77 | + }): Promise<void>; |
| 78 | +} |
| 79 | + |
| 80 | +// @alpha |
| 81 | +export interface NodeFileSystemTransportAdapterOptions { |
| 82 | + deleteFile: (attachment: AttachmentRecord) => Promise<void>; |
| 83 | + resolveDownload: (attachment: LocatedAttachmentRecord) => Promise<NodeDownloadRequest> | NodeDownloadRequest; |
| 84 | + resolveUpload: (attachment: LocatedAttachmentRecord) => Promise<NodeUploadRequest> | NodeUploadRequest; |
| 85 | +} |
| 86 | + |
| 87 | +// @public |
| 88 | +export type NodePowerSyncDatabaseOptions = BasePowerSyncDatabaseOptions & DatabaseSource<NodeSQLOpenOptions> & { |
| 89 | + remoteOptions?: NodeRemoteOptions; |
| 90 | +}; |
| 91 | + |
| 92 | +// @public |
| 93 | +export interface NodeRemoteOptions { |
| 94 | + // @internal |
| 95 | + customFetch?: typeof fetch; |
| 96 | + dispatcher?: Dispatcher; |
| 97 | +} |
| 98 | + |
| 99 | +// @alpha |
| 100 | +export interface NodeSqliteOptions { |
| 101 | + // (undocumented) |
| 102 | + type: 'node:sqlite'; |
| 103 | +} |
| 104 | + |
| 105 | +// @public |
| 106 | +export interface NodeSQLOpenOptions extends SQLOpenOptions { |
| 107 | + // (undocumented) |
| 108 | + implementation?: NodeDatabaseImplementation; |
| 109 | + initializeConnection?: (db: LockContext, isWriter: boolean) => Promise<void>; |
| 110 | + openWorker?: WorkerOpener; |
| 111 | + readWorkerCount?: number; |
| 112 | +} |
| 113 | + |
| 114 | +// @alpha |
| 115 | +export interface NodeUploadRequest { |
| 116 | + headers?: Record<string, string>; |
| 117 | + httpMethod?: 'POST' | 'PUT' | 'PATCH'; |
| 118 | + mimeType?: string; |
| 119 | + url: string; |
| 120 | +} |
| 121 | + |
| 122 | +// @public |
| 123 | +export const PowerSyncDatabase: PowerSyncDatabaseConstructor<NodePowerSyncDatabaseOptions>; |
| 124 | + |
| 125 | +// @public (undocumented) |
| 126 | +export interface PowerSyncDatabase extends CommonPowerSyncDatabase { |
| 127 | +} |
| 128 | + |
| 129 | +// @public |
| 130 | +export type WorkerOpener = (...args: ConstructorParameters<typeof Worker_2>) => InstanceType<typeof Worker_2>; |
| 131 | + |
| 132 | + |
| 133 | +export * from "@powersync/common"; |
| 134 | + |
| 135 | +// (No @packageDocumentation comment for this package) |
| 136 | + |
| 137 | +``` |
0 commit comments