@tursodatabase/sync-react-native 0.5.0-pre.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +117 -0
  2. package/android/CMakeLists.txt +53 -0
  3. package/android/build.gradle +84 -0
  4. package/android/cpp-adapter.cpp +49 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/java/com/turso/sync/reactnative/TursoBridge.java +44 -0
  7. package/android/src/main/java/com/turso/sync/reactnative/TursoModule.java +82 -0
  8. package/android/src/main/java/com/turso/sync/reactnative/TursoPackage.java +29 -0
  9. package/cpp/TursoConnectionHostObject.cpp +179 -0
  10. package/cpp/TursoConnectionHostObject.h +52 -0
  11. package/cpp/TursoDatabaseHostObject.cpp +98 -0
  12. package/cpp/TursoDatabaseHostObject.h +49 -0
  13. package/cpp/TursoHostObject.cpp +561 -0
  14. package/cpp/TursoHostObject.h +24 -0
  15. package/cpp/TursoStatementHostObject.cpp +414 -0
  16. package/cpp/TursoStatementHostObject.h +65 -0
  17. package/cpp/TursoSyncChangesHostObject.cpp +41 -0
  18. package/cpp/TursoSyncChangesHostObject.h +52 -0
  19. package/cpp/TursoSyncDatabaseHostObject.cpp +328 -0
  20. package/cpp/TursoSyncDatabaseHostObject.h +61 -0
  21. package/cpp/TursoSyncIoItemHostObject.cpp +304 -0
  22. package/cpp/TursoSyncIoItemHostObject.h +52 -0
  23. package/cpp/TursoSyncOperationHostObject.cpp +168 -0
  24. package/cpp/TursoSyncOperationHostObject.h +53 -0
  25. package/ios/TursoModule.h +8 -0
  26. package/ios/TursoModule.mm +95 -0
  27. package/lib/commonjs/Database.js +445 -0
  28. package/lib/commonjs/Database.js.map +1 -0
  29. package/lib/commonjs/Statement.js +339 -0
  30. package/lib/commonjs/Statement.js.map +1 -0
  31. package/lib/commonjs/index.js +229 -0
  32. package/lib/commonjs/index.js.map +1 -0
  33. package/lib/commonjs/internal/asyncOperation.js +124 -0
  34. package/lib/commonjs/internal/asyncOperation.js.map +1 -0
  35. package/lib/commonjs/internal/ioProcessor.js +315 -0
  36. package/lib/commonjs/internal/ioProcessor.js.map +1 -0
  37. package/lib/commonjs/package.json +1 -0
  38. package/lib/commonjs/types.js +133 -0
  39. package/lib/commonjs/types.js.map +1 -0
  40. package/lib/module/Database.js +441 -0
  41. package/lib/module/Database.js.map +1 -0
  42. package/lib/module/Statement.js +335 -0
  43. package/lib/module/Statement.js.map +1 -0
  44. package/lib/module/index.js +205 -0
  45. package/lib/module/index.js.map +1 -0
  46. package/lib/module/internal/asyncOperation.js +116 -0
  47. package/lib/module/internal/asyncOperation.js.map +1 -0
  48. package/lib/module/internal/ioProcessor.js +309 -0
  49. package/lib/module/internal/ioProcessor.js.map +1 -0
  50. package/lib/module/package.json +1 -0
  51. package/lib/module/types.js +163 -0
  52. package/lib/module/types.js.map +1 -0
  53. package/lib/typescript/Database.d.ts +140 -0
  54. package/lib/typescript/Database.d.ts.map +1 -0
  55. package/lib/typescript/Statement.d.ts +105 -0
  56. package/lib/typescript/Statement.d.ts.map +1 -0
  57. package/lib/typescript/index.d.ts +175 -0
  58. package/lib/typescript/index.d.ts.map +1 -0
  59. package/lib/typescript/internal/asyncOperation.d.ts +39 -0
  60. package/lib/typescript/internal/asyncOperation.d.ts.map +1 -0
  61. package/lib/typescript/internal/ioProcessor.d.ts +48 -0
  62. package/lib/typescript/internal/ioProcessor.d.ts.map +1 -0
  63. package/lib/typescript/types.d.ts +316 -0
  64. package/lib/typescript/types.d.ts.map +1 -0
  65. package/package.json +97 -0
  66. package/src/Database.ts +480 -0
  67. package/src/Statement.ts +372 -0
  68. package/src/index.ts +240 -0
  69. package/src/internal/asyncOperation.ts +147 -0
  70. package/src/internal/ioProcessor.ts +328 -0
  71. package/src/types.ts +391 -0
  72. package/turso-sync-react-native.podspec +56 -0
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Statement
3
+ *
4
+ * High-level wrapper around NativeStatement providing a clean API.
5
+ * Handles parameter binding, row conversion, and result collection.
6
+ */
7
+ import type { NativeStatement, BindParams, Row, RunResult } from './types';
8
+ /**
9
+ * Prepared SQL statement
10
+ */
11
+ export declare class Statement {
12
+ private _statement;
13
+ private _finalized;
14
+ private _extraIo?;
15
+ constructor(statement: NativeStatement, extraIo?: () => Promise<void>);
16
+ /**
17
+ * Bind parameters to the statement
18
+ *
19
+ * @param params - Parameters to bind (array, object, or single value)
20
+ * @returns this for chaining
21
+ */
22
+ bind(...params: BindParams[]): this;
23
+ /**
24
+ * Bind positional parameters (1-indexed)
25
+ *
26
+ * @param params - Array of values to bind
27
+ */
28
+ private bindPositional;
29
+ /**
30
+ * Bind named parameters
31
+ *
32
+ * @param params - Object with named parameters
33
+ */
34
+ private bindNamed;
35
+ /**
36
+ * Bind a single value at a position
37
+ *
38
+ * @param position - 1-indexed position
39
+ * @param value - Value to bind
40
+ */
41
+ private bindValue;
42
+ /**
43
+ * Execute statement without returning rows (for INSERT, UPDATE, DELETE)
44
+ *
45
+ * @param params - Optional parameters to bind
46
+ * @returns Result with changes and lastInsertRowid
47
+ */
48
+ run(...params: BindParams[]): Promise<RunResult>;
49
+ /**
50
+ * Execute statement handling potential IO (for partial sync)
51
+ * Matches Python's _run_execute_with_io pattern
52
+ *
53
+ * @returns Execution result
54
+ */
55
+ private executeWithIo;
56
+ /**
57
+ * Step statement once handling potential IO (for partial sync)
58
+ * Matches Python's _step_once_with_io pattern
59
+ *
60
+ * @returns Status code
61
+ */
62
+ private stepWithIo;
63
+ /**
64
+ * Execute statement and return first row
65
+ *
66
+ * @param params - Optional parameters to bind
67
+ * @returns First row or undefined
68
+ */
69
+ get(...params: BindParams[]): Promise<Row | undefined>;
70
+ /**
71
+ * Execute statement and return all rows
72
+ *
73
+ * @param params - Optional parameters to bind
74
+ * @returns Array of rows
75
+ */
76
+ all(...params: BindParams[]): Promise<Row[]>;
77
+ /**
78
+ * Read current row into an object
79
+ *
80
+ * @returns Row object with column name keys
81
+ */
82
+ private readRow;
83
+ /**
84
+ * Read value at column index
85
+ *
86
+ * @param index - Column index
87
+ * @returns Column value
88
+ */
89
+ private readColumnValue;
90
+ /**
91
+ * Reset statement for re-execution
92
+ *
93
+ * @returns this for chaining
94
+ */
95
+ reset(): this;
96
+ /**
97
+ * Finalize and release statement resources
98
+ */
99
+ finalize(): Promise<void>;
100
+ /**
101
+ * Check if statement has been finalized
102
+ */
103
+ get finalized(): boolean;
104
+ }
105
+ //# sourceMappingURL=Statement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Statement.d.ts","sourceRoot":"","sources":["../../src/Statement.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,eAAe,EAEf,UAAU,EACV,GAAG,EACH,SAAS,EACV,MAAM,SAAS,CAAC;AAGjB;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAsB;gBAE3B,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;IAKrE;;;;;OAKG;IACH,IAAI,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI;IAuBnC;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAStB;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAYjB;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAoBjB;;;;;OAKG;IACG,GAAG,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;IAsBtD;;;;;OAKG;YACW,aAAa;IAwB3B;;;;;OAKG;YACW,UAAU;IAoBxB;;;;;OAKG;IACG,GAAG,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IA2B5D;;;;;OAKG;IACG,GAAG,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IA6BlD;;;;OAIG;IACH,OAAO,CAAC,OAAO;IAiBf;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAyBvB;;;;OAIG;IACH,KAAK,IAAI,IAAI;IASb;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B/B;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;CACF"}
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Turso React Native SDK
3
+ *
4
+ * Main entry point for the SDK. Supports both local-only and sync databases.
5
+ */
6
+ import { Database } from './Database';
7
+ import type { DatabaseOpts } from './types';
8
+ import { setFileSystemImpl } from './internal/ioProcessor';
9
+ export type { SQLiteValue, BindParams, Row, RunResult, DatabaseOpts, EncryptionOpts, SyncStats, TursoStatus, TursoType, } from './types';
10
+ export { Database } from './Database';
11
+ export { Statement } from './Statement';
12
+ export { setFileSystemImpl } from './internal/ioProcessor';
13
+ /**
14
+ * Helper function to construct a database path in a writable directory.
15
+ * On mobile platforms, you must use writable directories (not relative paths).
16
+ *
17
+ * @param filename - Database filename (e.g., 'mydb.db')
18
+ * @param directory - Directory to use ('documents', 'database', or 'library')
19
+ * @returns Absolute path to the database file
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { getDbPath, connect } from '@tursodatabase/sync-react-native';
24
+ *
25
+ * const dbPath = getDbPath('mydb.db');
26
+ * const db = await connect({ path: dbPath });
27
+ * ```
28
+ */
29
+ export declare function getDbPath(filename: string, directory?: 'documents' | 'database' | 'library'): string;
30
+ /**
31
+ * Connect to a database asynchronously (matches JavaScript bindings API)
32
+ *
33
+ * This is the main entry point for the SDK, matching the API from
34
+ * @tursodatabase/sync-native and @tursodatabase/database-native.
35
+ *
36
+ * **Path handling**: Relative paths are automatically placed in writable directories:
37
+ * - Android: app's database directory (`/data/data/com.app/databases/`)
38
+ * - iOS: app's documents directory
39
+ *
40
+ * Absolute paths and `:memory:` are used as-is.
41
+ *
42
+ * @param opts - Database options
43
+ * @returns Promise resolving to Database instance
44
+ *
45
+ * @example Local database (relative path)
46
+ * ```ts
47
+ * import { connect } from '@tursodatabase/sync-react-native';
48
+ *
49
+ * // Relative path automatically placed in writable directory
50
+ * const db = await connect({ path: 'local.db' });
51
+ * await db.exec('CREATE TABLE users (id INTEGER, name TEXT)');
52
+ * ```
53
+ *
54
+ * @example Using :memory: for in-memory database
55
+ * ```ts
56
+ * const db = await connect({ path: ':memory:' });
57
+ * ```
58
+ *
59
+ * @example Sync database
60
+ * ```ts
61
+ * const db = await connect({
62
+ * path: 'replica.db',
63
+ * url: 'libsql://mydb.turso.io',
64
+ * authToken: 'token-here',
65
+ * });
66
+ * const users = await db.all('SELECT * FROM users');
67
+ * await db.push();
68
+ * await db.pull();
69
+ * ```
70
+ *
71
+ * @example Using absolute path (advanced)
72
+ * ```ts
73
+ * import { connect, paths } from '@tursodatabase/sync-react-native';
74
+ *
75
+ * const db = await connect({ path: `${paths.documents}/mydb.db` });
76
+ * ```
77
+ */
78
+ export declare function connect(opts: DatabaseOpts): Promise<Database>;
79
+ /**
80
+ * Returns the Turso library version.
81
+ */
82
+ export declare function version(): string;
83
+ /**
84
+ * Configure Turso settings such as logging.
85
+ * Should be called before any database operations.
86
+ *
87
+ * @param options - Configuration options
88
+ * @example
89
+ * ```ts
90
+ * import { setup } from '@tursodatabase/sync-react-native';
91
+ *
92
+ * setup({ logLevel: 'debug' });
93
+ * ```
94
+ */
95
+ export declare function setup(options: {
96
+ logLevel?: string;
97
+ }): void;
98
+ /**
99
+ * Platform-specific writable directory paths.
100
+ * Use these to construct absolute paths for database files.
101
+ *
102
+ * NOTE: With automatic path normalization, you typically don't need this.
103
+ * Just pass relative paths like 'mydb.db' and they'll be placed in the correct directory.
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * import { paths, connect } from '@tursodatabase/sync-react-native';
108
+ *
109
+ * // Create database in app's documents/files directory
110
+ * const dbPath = `${paths.documents}/mydb.db`;
111
+ * const db = await connect({ path: dbPath });
112
+ * ```
113
+ */
114
+ export declare const paths: {
115
+ /**
116
+ * Primary documents/database directory (writable)
117
+ * - iOS: App's Documents directory (absolute path)
118
+ * - Android: App's database directory (absolute path) - preferred for databases
119
+ */
120
+ readonly documents: string;
121
+ /**
122
+ * Database-specific directory (writable)
123
+ * - iOS: Same as documents
124
+ * - Android: Database directory (absolute path)
125
+ */
126
+ readonly database: string;
127
+ /**
128
+ * Files directory (writable)
129
+ * - iOS: Same as documents
130
+ * - Android: App's files directory (absolute path)
131
+ */
132
+ readonly files: string;
133
+ /**
134
+ * Library directory (iOS only, writable)
135
+ * - iOS: App's Library directory (absolute path)
136
+ * - Android: Same as files
137
+ */
138
+ readonly library: string;
139
+ };
140
+ declare const _default: {
141
+ connect: typeof connect;
142
+ version: typeof version;
143
+ setup: typeof setup;
144
+ setFileSystemImpl: typeof setFileSystemImpl;
145
+ getDbPath: typeof getDbPath;
146
+ paths: {
147
+ /**
148
+ * Primary documents/database directory (writable)
149
+ * - iOS: App's Documents directory (absolute path)
150
+ * - Android: App's database directory (absolute path) - preferred for databases
151
+ */
152
+ readonly documents: string;
153
+ /**
154
+ * Database-specific directory (writable)
155
+ * - iOS: Same as documents
156
+ * - Android: Database directory (absolute path)
157
+ */
158
+ readonly database: string;
159
+ /**
160
+ * Files directory (writable)
161
+ * - iOS: Same as documents
162
+ * - Android: App's files directory (absolute path)
163
+ */
164
+ readonly files: string;
165
+ /**
166
+ * Library directory (iOS only, writable)
167
+ * - iOS: App's Library directory (absolute path)
168
+ * - Android: Same as files
169
+ */
170
+ readonly library: string;
171
+ };
172
+ Database: typeof Database;
173
+ };
174
+ export default _default;
175
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,YAAY,EAEV,WAAW,EACX,UAAU,EACV,GAAG,EACH,SAAS,EAGT,YAAY,EACZ,cAAc,EAGd,SAAS,EAGT,WAAW,EACX,SAAS,GACV,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAgC3D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAE,WAAW,GAAG,UAAU,GAAG,SAAuB,GAAG,MAAM,CASjH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAInE;AAED;;GAEG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,CAExD;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,KAAK;IAChB;;;;OAIG;wBACc,MAAM;IAIvB;;;;OAIG;uBACa,MAAM;IAItB;;;;OAIG;oBACU,MAAM;IAInB;;;;OAIG;sBACY,MAAM;CAGtB,CAAC;;;;;;;;QAnCA;;;;WAIG;4BACc,MAAM;QAIvB;;;;WAIG;2BACa,MAAM;QAItB;;;;WAIG;wBACU,MAAM;QAInB;;;;WAIG;0BACY,MAAM;;;;AAMvB,wBAQE"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Async Operation Driver
3
+ *
4
+ * Drives async operations returned by sync SDK-KIT methods.
5
+ * This is where ALL the async logic lives - the C++ layer is just a thin bridge.
6
+ *
7
+ * Key responsibilities:
8
+ * - Call resume() in a loop until DONE
9
+ * - When IO is needed, process all pending IO items
10
+ * - Extract and return the final result
11
+ */
12
+ import type { NativeSyncOperation, NativeSyncDatabase, NativeConnection, NativeSyncChanges, SyncStats } from '../types';
13
+ import type { IoContext } from './ioProcessor';
14
+ /**
15
+ * Drive an async operation to completion
16
+ *
17
+ * @param operation - The native operation to drive
18
+ * @param database - The native sync database (for IO queue access)
19
+ * @param context - IO context with auth and URL information
20
+ * @returns Promise that resolves when operation completes
21
+ */
22
+ export declare function driveOperation<T = void>(operation: NativeSyncOperation, database: NativeSyncDatabase, context: IoContext): Promise<T>;
23
+ /**
24
+ * Helper type for operations that return connections
25
+ */
26
+ export declare function driveConnectionOperation(operation: NativeSyncOperation, database: NativeSyncDatabase, context: IoContext): Promise<NativeConnection>;
27
+ /**
28
+ * Helper type for operations that return changes
29
+ */
30
+ export declare function driveChangesOperation(operation: NativeSyncOperation, database: NativeSyncDatabase, context: IoContext): Promise<NativeSyncChanges | null>;
31
+ /**
32
+ * Helper type for operations that return stats
33
+ */
34
+ export declare function driveStatsOperation(operation: NativeSyncOperation, database: NativeSyncDatabase, context: IoContext): Promise<SyncStats>;
35
+ /**
36
+ * Helper type for operations that return void
37
+ */
38
+ export declare function driveVoidOperation(operation: NativeSyncOperation, database: NativeSyncDatabase, context: IoContext): Promise<void>;
39
+ //# sourceMappingURL=asyncOperation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncOperation.d.ts","sourceRoot":"","sources":["../../../src/internal/asyncOperation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACV,MAAM,UAAU,CAAC;AAGlB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,CAAC,GAAG,IAAI,EAC3C,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,CAAC,CAAC,CA2CZ;AA0BD;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAEnC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,SAAS,CAAC,CAEpB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,IAAI,CAAC,CAEf"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * IO Processor
3
+ *
4
+ * Processes IO requests from the sync engine using JavaScript APIs.
5
+ * This is the key benefit of the thin JSI layer - all IO is handled by
6
+ * React Native's standard APIs (fetch, file system), not C++ code.
7
+ *
8
+ * Benefits:
9
+ * - Network requests visible in React Native debugger
10
+ * - Can customize fetch (add proxies, custom headers, etc.)
11
+ * - Easier to test (can mock fetch)
12
+ * - Uses platform-native networking (not C++ HTTP libraries)
13
+ */
14
+ import type { NativeSyncIoItem, NativeSyncDatabase } from '../types';
15
+ /**
16
+ * IO context contains auth and URL information for HTTP requests
17
+ */
18
+ export interface IoContext {
19
+ /** Auth token for HTTP requests */
20
+ authToken?: string | (() => string | Promise<string> | null);
21
+ /** Base URL for normalization (e.g., 'libsql://mydb.turso.io') */
22
+ baseUrl?: string;
23
+ }
24
+ /**
25
+ * Set custom file system implementation (optional)
26
+ * By default, uses built-in JSI file system functions.
27
+ * Only call this if you need custom behavior (e.g., encryption, compression).
28
+ *
29
+ * @param readFile - Function to read file as Uint8Array
30
+ * @param writeFile - Function to write Uint8Array to file
31
+ */
32
+ export declare function setFileSystemImpl(readFile: (path: string) => Promise<Uint8Array>, writeFile: (path: string, data: Uint8Array) => Promise<void>): void;
33
+ /**
34
+ * Process a single IO item
35
+ *
36
+ * @param item - The IO item to process
37
+ * @param context - IO context with auth and URL information
38
+ */
39
+ export declare function processIoItem(item: NativeSyncIoItem, context: IoContext): Promise<void>;
40
+ /**
41
+ * Drain all pending IO items from sync engine queue and process them.
42
+ * This is called during statement execution when partial sync needs to load missing pages.
43
+ *
44
+ * @param database - The native sync database
45
+ * @param context - IO context with auth and URL information
46
+ */
47
+ export declare function drainSyncIo(database: NativeSyncDatabase, context: IoContext): Promise<void>;
48
+ //# sourceMappingURL=ioProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ioProcessor.d.ts","sourceRoot":"","sources":["../../../src/internal/ioProcessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7D,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAMD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,EAC/C,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAC3D,IAAI,CAGN;AA+BD;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CA4B7F;AA+LD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBjG"}