@powersync/common 1.53.1 → 1.54.0

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 (217) hide show
  1. package/dist/bundle.cjs +560 -353
  2. package/dist/bundle.cjs.map +1 -1
  3. package/dist/bundle.mjs +560 -353
  4. package/dist/bundle.mjs.map +1 -1
  5. package/dist/bundle.node.cjs +560 -353
  6. package/dist/bundle.node.cjs.map +1 -1
  7. package/dist/bundle.node.mjs +560 -353
  8. package/dist/bundle.node.mjs.map +1 -1
  9. package/dist/index.d.cts +733 -198
  10. package/lib/attachments/AttachmentContext.d.ts +7 -6
  11. package/lib/attachments/AttachmentContext.js +2 -1
  12. package/lib/attachments/AttachmentContext.js.map +1 -1
  13. package/lib/attachments/AttachmentErrorHandler.d.ts +6 -6
  14. package/lib/attachments/AttachmentQueue.d.ts +61 -20
  15. package/lib/attachments/AttachmentQueue.js +16 -18
  16. package/lib/attachments/AttachmentQueue.js.map +1 -1
  17. package/lib/attachments/LocalStorageAdapter.d.ts +14 -8
  18. package/lib/attachments/LocalStorageAdapter.js +3 -0
  19. package/lib/attachments/LocalStorageAdapter.js.map +1 -1
  20. package/lib/attachments/RemoteStorageAdapter.d.ts +4 -4
  21. package/lib/attachments/Schema.d.ts +12 -4
  22. package/lib/attachments/Schema.js +8 -3
  23. package/lib/attachments/Schema.js.map +1 -1
  24. package/lib/attachments/WatchedAttachmentItem.d.ts +3 -1
  25. package/lib/client/AbstractPowerSyncDatabase.d.ts +110 -58
  26. package/lib/client/AbstractPowerSyncDatabase.js +59 -48
  27. package/lib/client/AbstractPowerSyncDatabase.js.map +1 -1
  28. package/lib/client/AbstractPowerSyncOpenFactory.d.ts +6 -0
  29. package/lib/client/AbstractPowerSyncOpenFactory.js +3 -0
  30. package/lib/client/AbstractPowerSyncOpenFactory.js.map +1 -1
  31. package/lib/client/ConnectionManager.d.ts +4 -1
  32. package/lib/client/ConnectionManager.js +1 -1
  33. package/lib/client/ConnectionManager.js.map +1 -1
  34. package/lib/client/Query.d.ts +9 -0
  35. package/lib/client/SQLOpenFactory.d.ts +12 -0
  36. package/lib/client/SQLOpenFactory.js +6 -0
  37. package/lib/client/SQLOpenFactory.js.map +1 -1
  38. package/lib/client/compilableQueryWatch.d.ts +6 -0
  39. package/lib/client/compilableQueryWatch.js +3 -0
  40. package/lib/client/compilableQueryWatch.js.map +1 -1
  41. package/lib/client/connection/PowerSyncBackendConnector.d.ts +3 -0
  42. package/lib/client/connection/PowerSyncCredentials.d.ts +3 -0
  43. package/lib/client/constants.d.ts +3 -0
  44. package/lib/client/constants.js +3 -0
  45. package/lib/client/constants.js.map +1 -1
  46. package/lib/client/runOnSchemaChange.d.ts +3 -0
  47. package/lib/client/runOnSchemaChange.js +3 -0
  48. package/lib/client/runOnSchemaChange.js.map +1 -1
  49. package/lib/client/sync/bucket/BucketStorageAdapter.d.ts +12 -0
  50. package/lib/client/sync/bucket/BucketStorageAdapter.js +6 -0
  51. package/lib/client/sync/bucket/BucketStorageAdapter.js.map +1 -1
  52. package/lib/client/sync/bucket/CrudBatch.d.ts +2 -0
  53. package/lib/client/sync/bucket/CrudBatch.js +2 -0
  54. package/lib/client/sync/bucket/CrudBatch.js.map +1 -1
  55. package/lib/client/sync/bucket/CrudEntry.d.ts +9 -0
  56. package/lib/client/sync/bucket/CrudEntry.js +4 -0
  57. package/lib/client/sync/bucket/CrudEntry.js.map +1 -1
  58. package/lib/client/sync/bucket/CrudTransaction.d.ts +3 -0
  59. package/lib/client/sync/bucket/CrudTransaction.js +3 -0
  60. package/lib/client/sync/bucket/CrudTransaction.js.map +1 -1
  61. package/lib/client/sync/bucket/SqliteBucketStorage.d.ts +3 -0
  62. package/lib/client/sync/bucket/SqliteBucketStorage.js +3 -0
  63. package/lib/client/sync/bucket/SqliteBucketStorage.js.map +1 -1
  64. package/lib/client/sync/stream/AbstractRemote.d.ts +30 -1
  65. package/lib/client/sync/stream/AbstractRemote.js +15 -1
  66. package/lib/client/sync/stream/AbstractRemote.js.map +1 -1
  67. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +61 -14
  68. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +60 -47
  69. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +1 -1
  70. package/lib/client/sync/stream/JsonValue.d.ts +3 -0
  71. package/lib/client/sync/stream/WebsocketClientTransport.js +2 -1
  72. package/lib/client/sync/stream/WebsocketClientTransport.js.map +1 -1
  73. package/lib/client/sync/sync-streams.d.ts +22 -7
  74. package/lib/client/triggers/TriggerManager.d.ts +19 -18
  75. package/lib/client/triggers/TriggerManager.js +2 -1
  76. package/lib/client/triggers/TriggerManager.js.map +1 -1
  77. package/lib/client/triggers/TriggerManagerImpl.d.ts +1 -1
  78. package/lib/client/triggers/TriggerManagerImpl.js +3 -3
  79. package/lib/client/triggers/TriggerManagerImpl.js.map +1 -1
  80. package/lib/client/triggers/sanitizeSQL.d.ts +4 -0
  81. package/lib/client/triggers/sanitizeSQL.js +4 -0
  82. package/lib/client/triggers/sanitizeSQL.js.map +1 -1
  83. package/lib/client/watched/GetAllQuery.d.ts +4 -0
  84. package/lib/client/watched/GetAllQuery.js +2 -0
  85. package/lib/client/watched/GetAllQuery.js.map +1 -1
  86. package/lib/client/watched/WatchedQuery.d.ts +24 -2
  87. package/lib/client/watched/WatchedQuery.js +9 -0
  88. package/lib/client/watched/WatchedQuery.js.map +1 -1
  89. package/lib/client/watched/processors/AbstractQueryProcessor.d.ts +1 -1
  90. package/lib/client/watched/processors/AbstractQueryProcessor.js.map +1 -1
  91. package/lib/client/watched/processors/DifferentialQueryProcessor.d.ts +20 -0
  92. package/lib/client/watched/processors/DifferentialQueryProcessor.js +4 -0
  93. package/lib/client/watched/processors/DifferentialQueryProcessor.js.map +1 -1
  94. package/lib/client/watched/processors/OnChangeQueryProcessor.d.ts +4 -0
  95. package/lib/client/watched/processors/OnChangeQueryProcessor.js.map +1 -1
  96. package/lib/client/watched/processors/comparators.d.ts +8 -0
  97. package/lib/client/watched/processors/comparators.js +4 -0
  98. package/lib/client/watched/processors/comparators.js.map +1 -1
  99. package/lib/db/ConnectionClosedError.d.ts +2 -0
  100. package/lib/db/ConnectionClosedError.js +2 -0
  101. package/lib/db/ConnectionClosedError.js.map +1 -1
  102. package/lib/db/DBAdapter.d.ts +56 -6
  103. package/lib/db/DBAdapter.js +15 -3
  104. package/lib/db/DBAdapter.js.map +1 -1
  105. package/lib/db/crud/SyncProgress.d.ts +6 -1
  106. package/lib/db/crud/SyncProgress.js +2 -0
  107. package/lib/db/crud/SyncProgress.js.map +1 -1
  108. package/lib/db/crud/SyncStatus.d.ts +36 -38
  109. package/lib/db/crud/SyncStatus.js +19 -14
  110. package/lib/db/crud/SyncStatus.js.map +1 -1
  111. package/lib/db/crud/UploadQueueStatus.d.ts +3 -0
  112. package/lib/db/crud/UploadQueueStatus.js +3 -0
  113. package/lib/db/crud/UploadQueueStatus.js.map +1 -1
  114. package/lib/db/schema/Column.d.ts +28 -0
  115. package/lib/db/schema/Column.js +16 -3
  116. package/lib/db/schema/Column.js.map +1 -1
  117. package/lib/db/schema/Index.d.ts +9 -0
  118. package/lib/db/schema/Index.js +6 -0
  119. package/lib/db/schema/Index.js.map +1 -1
  120. package/lib/db/schema/IndexedColumn.d.ts +9 -0
  121. package/lib/db/schema/IndexedColumn.js +6 -0
  122. package/lib/db/schema/IndexedColumn.js.map +1 -1
  123. package/lib/db/schema/RawTable.d.ts +7 -1
  124. package/lib/db/schema/Schema.d.ts +6 -1
  125. package/lib/db/schema/Schema.js +3 -1
  126. package/lib/db/schema/Schema.js.map +1 -1
  127. package/lib/db/schema/Table.d.ts +27 -3
  128. package/lib/db/schema/Table.js +9 -0
  129. package/lib/db/schema/Table.js.map +1 -1
  130. package/lib/db/schema/TableV2.d.ts +2 -0
  131. package/lib/db/schema/TableV2.js +2 -0
  132. package/lib/db/schema/TableV2.js.map +1 -1
  133. package/lib/index.d.ts +1 -1
  134. package/lib/types/types.d.ts +6 -0
  135. package/lib/utils/AbortOperation.d.ts +2 -0
  136. package/lib/utils/AbortOperation.js +2 -0
  137. package/lib/utils/AbortOperation.js.map +1 -1
  138. package/lib/utils/BaseObserver.d.ts +12 -0
  139. package/lib/utils/BaseObserver.js +3 -0
  140. package/lib/utils/BaseObserver.js.map +1 -1
  141. package/lib/utils/ControlledExecutor.d.ts +6 -0
  142. package/lib/utils/ControlledExecutor.js +3 -0
  143. package/lib/utils/ControlledExecutor.js.map +1 -1
  144. package/lib/utils/Logger.d.ts +9 -0
  145. package/lib/utils/Logger.js +6 -0
  146. package/lib/utils/Logger.js.map +1 -1
  147. package/lib/utils/async.d.ts +13 -7
  148. package/lib/utils/async.js +38 -24
  149. package/lib/utils/async.js.map +1 -1
  150. package/lib/utils/mutex.d.ts +8 -0
  151. package/lib/utils/mutex.js +3 -0
  152. package/lib/utils/mutex.js.map +1 -1
  153. package/lib/utils/parseQuery.d.ts +6 -0
  154. package/lib/utils/parseQuery.js +3 -0
  155. package/lib/utils/parseQuery.js.map +1 -1
  156. package/lib/utils/stream_transform.d.ts +3 -1
  157. package/lib/utils/stream_transform.js.map +1 -1
  158. package/package.json +3 -2
  159. package/src/attachments/AttachmentContext.ts +7 -6
  160. package/src/attachments/AttachmentErrorHandler.ts +6 -6
  161. package/src/attachments/AttachmentQueue.ts +71 -23
  162. package/src/attachments/LocalStorageAdapter.ts +14 -8
  163. package/src/attachments/README.md +2 -0
  164. package/src/attachments/RemoteStorageAdapter.ts +4 -4
  165. package/src/attachments/Schema.ts +12 -4
  166. package/src/attachments/WatchedAttachmentItem.ts +3 -1
  167. package/src/client/AbstractPowerSyncDatabase.ts +117 -62
  168. package/src/client/AbstractPowerSyncOpenFactory.ts +6 -0
  169. package/src/client/ConnectionManager.ts +4 -1
  170. package/src/client/Query.ts +9 -0
  171. package/src/client/SQLOpenFactory.ts +12 -0
  172. package/src/client/compilableQueryWatch.ts +6 -0
  173. package/src/client/connection/PowerSyncBackendConnector.ts +3 -0
  174. package/src/client/connection/PowerSyncCredentials.ts +3 -0
  175. package/src/client/constants.ts +3 -0
  176. package/src/client/runOnSchemaChange.ts +3 -0
  177. package/src/client/sync/bucket/BucketStorageAdapter.ts +12 -0
  178. package/src/client/sync/bucket/CrudBatch.ts +2 -0
  179. package/src/client/sync/bucket/CrudEntry.ts +9 -0
  180. package/src/client/sync/bucket/CrudTransaction.ts +3 -0
  181. package/src/client/sync/bucket/SqliteBucketStorage.ts +3 -0
  182. package/src/client/sync/stream/AbstractRemote.ts +30 -1
  183. package/src/client/sync/stream/AbstractStreamingSyncImplementation.ts +86 -59
  184. package/src/client/sync/stream/JsonValue.ts +3 -0
  185. package/src/client/sync/stream/WebsocketClientTransport.ts +3 -1
  186. package/src/client/sync/sync-streams.ts +22 -9
  187. package/src/client/triggers/TriggerManager.ts +19 -18
  188. package/src/client/triggers/TriggerManagerImpl.ts +5 -5
  189. package/src/client/triggers/sanitizeSQL.ts +5 -0
  190. package/src/client/watched/GetAllQuery.ts +5 -1
  191. package/src/client/watched/WatchedQuery.ts +24 -2
  192. package/src/client/watched/processors/AbstractQueryProcessor.ts +6 -6
  193. package/src/client/watched/processors/DifferentialQueryProcessor.ts +28 -5
  194. package/src/client/watched/processors/OnChangeQueryProcessor.ts +9 -3
  195. package/src/client/watched/processors/comparators.ts +8 -0
  196. package/src/db/ConnectionClosedError.ts +2 -0
  197. package/src/db/DBAdapter.ts +58 -6
  198. package/src/db/crud/SyncProgress.ts +6 -1
  199. package/src/db/crud/SyncStatus.ts +40 -21
  200. package/src/db/crud/UploadQueueStatus.ts +3 -0
  201. package/src/db/schema/Column.ts +28 -3
  202. package/src/db/schema/Index.ts +9 -0
  203. package/src/db/schema/IndexedColumn.ts +9 -0
  204. package/src/db/schema/RawTable.ts +7 -1
  205. package/src/db/schema/Schema.ts +8 -3
  206. package/src/db/schema/Table.ts +30 -5
  207. package/src/db/schema/TableV2.ts +2 -0
  208. package/src/index.ts +1 -1
  209. package/src/types/types.ts +6 -0
  210. package/src/utils/AbortOperation.ts +2 -0
  211. package/src/utils/BaseObserver.ts +12 -0
  212. package/src/utils/ControlledExecutor.ts +6 -0
  213. package/src/utils/Logger.ts +9 -0
  214. package/src/utils/async.ts +51 -24
  215. package/src/utils/mutex.ts +12 -0
  216. package/src/utils/parseQuery.ts +6 -0
  217. package/src/utils/stream_transform.ts +3 -1
@@ -1,5 +1,5 @@
1
1
  import { ILogger } from 'js-logger';
2
- import { DBAdapter, QueryResult, Transaction } from '../db/DBAdapter.js';
2
+ import { DBAdapter, LockContext, QueryResult, Transaction } from '../db/DBAdapter.js';
3
3
  import { SyncStatus } from '../db/crud/SyncStatus.js';
4
4
  import { UploadQueueStats } from '../db/crud/UploadQueueStatus.js';
5
5
  import { Schema } from '../db/schema/Schema.js';
@@ -18,19 +18,29 @@ import { TriggerManagerImpl } from './triggers/TriggerManagerImpl.js';
18
18
  import { WatchCompatibleQuery } from './watched/WatchedQuery.js';
19
19
  import { WatchedQueryComparator } from './watched/processors/comparators.js';
20
20
  import { Mutex } from '../utils/mutex.js';
21
+ /**
22
+ * @public
23
+ */
21
24
  export interface DisconnectAndClearOptions {
22
25
  /** When set to false, data in local-only tables is preserved. */
23
26
  clearLocal?: boolean;
24
27
  }
28
+ /**
29
+ * @public
30
+ */
25
31
  export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions {
26
32
  /** Schema used for the local database. */
27
33
  schema: Schema;
28
34
  /**
29
- * @deprecated Use {@link retryDelayMs} instead as this will be removed in future releases.
35
+ * @deprecated Use {@link AdditionalConnectionOptions.retryDelayMs} instead as this will be removed in future
36
+ * releases.
30
37
  */
31
38
  retryDelay?: number;
32
39
  logger?: ILogger;
33
40
  }
41
+ /**
42
+ * @public
43
+ */
34
44
  export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions {
35
45
  /**
36
46
  * Source for a SQLite database connection.
@@ -41,22 +51,35 @@ export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions {
41
51
  */
42
52
  database: DBAdapter | SQLOpenFactory | SQLOpenOptions;
43
53
  }
54
+ /**
55
+ * @public
56
+ */
44
57
  export interface PowerSyncDatabaseOptionsWithDBAdapter extends BasePowerSyncDatabaseOptions {
45
58
  database: DBAdapter;
46
59
  }
60
+ /**
61
+ * @public
62
+ */
47
63
  export interface PowerSyncDatabaseOptionsWithOpenFactory extends BasePowerSyncDatabaseOptions {
48
64
  database: SQLOpenFactory;
49
65
  }
66
+ /**
67
+ * @public
68
+ */
50
69
  export interface PowerSyncDatabaseOptionsWithSettings extends BasePowerSyncDatabaseOptions {
51
70
  database: SQLOpenOptions;
52
71
  }
72
+ /**
73
+ * @public
74
+ */
53
75
  export interface SQLOnChangeOptions {
54
76
  signal?: AbortSignal;
55
77
  tables?: string[];
56
78
  /** The minimum interval between queries. */
57
79
  throttleMs?: number;
58
80
  /**
59
- * @deprecated All tables specified in {@link tables} will be watched, including PowerSync tables with prefixes.
81
+ * @deprecated All tables specified in {@link SQLOnChangeOptions.tables} will be watched, including PowerSync tables
82
+ * with prefixes.
60
83
  *
61
84
  * Allows for watching any SQL table
62
85
  * by not removing PowerSync table name prefixes
@@ -67,6 +90,9 @@ export interface SQLOnChangeOptions {
67
90
  */
68
91
  triggerImmediate?: boolean;
69
92
  }
93
+ /**
94
+ * @public
95
+ */
70
96
  export interface SQLWatchOptions extends SQLOnChangeOptions {
71
97
  /**
72
98
  * Optional comparator which will be used to compare the results of the query.
@@ -74,23 +100,38 @@ export interface SQLWatchOptions extends SQLOnChangeOptions {
74
100
  */
75
101
  comparator?: WatchedQueryComparator<QueryResult>;
76
102
  }
103
+ /**
104
+ * @public
105
+ */
77
106
  export interface WatchOnChangeEvent {
78
107
  changedTables: string[];
79
108
  }
109
+ /**
110
+ * @public
111
+ */
80
112
  export interface WatchHandler {
81
113
  onResult: (results: QueryResult) => void;
82
114
  onError?: (error: Error) => void;
83
115
  }
116
+ /**
117
+ * @public
118
+ */
84
119
  export interface WatchOnChangeHandler {
85
120
  onChange: (event: WatchOnChangeEvent) => Promise<void> | void;
86
121
  onError?: (error: Error) => void;
87
122
  }
123
+ /**
124
+ * @public
125
+ */
88
126
  export interface PowerSyncDBListener extends StreamingSyncImplementationListener {
89
127
  initialized: () => void;
90
128
  schemaChanged: (schema: Schema) => void;
91
129
  closing: () => Promise<void> | void;
92
130
  closed: () => Promise<void> | void;
93
131
  }
132
+ /**
133
+ * @public
134
+ */
94
135
  export interface PowerSyncCloseOptions {
95
136
  /**
96
137
  * Disconnect the sync stream client if connected.
@@ -99,16 +140,27 @@ export interface PowerSyncCloseOptions {
99
140
  */
100
141
  disconnect?: boolean;
101
142
  }
143
+ /**
144
+ * @internal
145
+ */
102
146
  export declare const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions;
147
+ /**
148
+ * @internal
149
+ */
103
150
  export declare const DEFAULT_POWERSYNC_DB_OPTIONS: {
104
151
  retryDelayMs: number;
105
152
  crudUploadThrottleMs: number;
106
153
  };
154
+ /**
155
+ * @internal
156
+ */
107
157
  export declare const DEFAULT_CRUD_BATCH_LIMIT = 100;
108
158
  /**
109
159
  * Requesting nested or recursive locks can block the application in some circumstances.
110
160
  * This default lock timeout will act as a failsafe to throw an error if a lock cannot
111
161
  * be obtained.
162
+ *
163
+ * @internal
112
164
  */
113
165
  export declare const DEFAULT_LOCK_TIMEOUT_MS = 120000;
114
166
  /**
@@ -116,6 +168,9 @@ export declare const DEFAULT_LOCK_TIMEOUT_MS = 120000;
116
168
  * @internal
117
169
  */
118
170
  export declare const isPowerSyncDatabaseOptionsWithSettings: (test: any) => test is PowerSyncDatabaseOptionsWithSettings;
171
+ /**
172
+ * @public
173
+ */
119
174
  export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDBListener> {
120
175
  protected options: PowerSyncDatabaseOptions;
121
176
  /**
@@ -194,7 +249,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
194
249
  /**
195
250
  * Wait for the first sync operation to complete.
196
251
  *
197
- * @param request Either an abort signal (after which the promise will complete regardless of
252
+ * @param request - Either an abort signal (after which the promise will complete regardless of
198
253
  * whether a full sync was completed) or an object providing an abort signal and a priority target.
199
254
  * When a priority target is set, the promise may complete when all buckets with the given (or higher)
200
255
  * priorities have been synchronized. This can be earlier than a complete sync.
@@ -249,7 +304,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
249
304
  /**
250
305
  * Close the sync connection.
251
306
  *
252
- * Use {@link connect} to connect again.
307
+ * Use {@link AbstractPowerSyncDatabase.connect} to connect again.
253
308
  */
254
309
  disconnect(): Promise<void>;
255
310
  /**
@@ -264,8 +319,8 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
264
319
  /**
265
320
  * Create a sync stream to query its status or to subscribe to it.
266
321
  *
267
- * @param name The name of the stream to subscribe to.
268
- * @param params Optional parameters for the stream subscription.
322
+ * @param name - The name of the stream to subscribe to.
323
+ * @param params - Optional parameters for the stream subscription.
269
324
  * @returns A {@link SyncStream} instance that can be subscribed to.
270
325
  * @experimental Sync streams are currently in alpha.
271
326
  */
@@ -293,14 +348,14 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
293
348
  * Once the data have been successfully uploaded, call {@link CrudBatch.complete} before
294
349
  * requesting the next batch.
295
350
  *
296
- * Use {@link limit} to specify the maximum number of updates to return in a single
351
+ * Use the `limit` parameter to specify the maximum number of updates to return in a single
297
352
  * batch.
298
353
  *
299
354
  * This method does include transaction ids in the result, but does not group
300
355
  * data by transaction. One batch may contain data from multiple transactions,
301
356
  * and a single transaction may be split over multiple batches.
302
357
  *
303
- * @param limit Maximum number of CRUD entries to include in the batch
358
+ * @param limit - Maximum number of CRUD entries to include in the batch
304
359
  * @returns A batch of CRUD operations to upload, or null if there are none
305
360
  */
306
361
  getCrudBatch(limit?: number): Promise<CrudBatch | null>;
@@ -314,7 +369,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
314
369
  * Once the data have been successfully uploaded, call {@link CrudTransaction.complete} before
315
370
  * requesting the next transaction.
316
371
  *
317
- * Unlike {@link getCrudBatch}, this only returns data from a single transaction at a time.
372
+ * Unlike {@link AbstractPowerSyncDatabase.getCrudBatch}, this only returns data from a single transaction at a time.
318
373
  * All data for the transaction is loaded into memory.
319
374
  *
320
375
  * @returns A transaction of CRUD operations to upload, or null if there are none
@@ -326,7 +381,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
326
381
  * This is typically used from the {@link PowerSyncBackendConnector.uploadData} callback. Each entry emitted by the
327
382
  * returned iterator is a full transaction containing all local writes made while that transaction was active.
328
383
  *
329
- * Unlike {@link getNextCrudTransaction}, which always returns the oldest transaction that hasn't been
384
+ * Unlike {@link AbstractPowerSyncDatabase.getNextCrudTransaction}, which always returns the oldest transaction that hasn't been
330
385
  * {@link CrudTransaction.complete}d yet, this iterator can be used to receive multiple transactions. Calling
331
386
  * {@link CrudTransaction.complete} will mark that and all prior transactions emitted by the iterator as completed.
332
387
  *
@@ -369,8 +424,8 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
369
424
  * the returned result's `rowsAffected` may be `0` for successful `UPDATE` and `DELETE` statements.
370
425
  * Use a `RETURNING` clause and inspect `result.rows` when you need to confirm which rows changed.
371
426
  *
372
- * @param sql The SQL query to execute
373
- * @param parameters Optional array of parameters to bind to the query
427
+ * @param sql - The SQL query to execute
428
+ * @param parameters - Optional array of parameters to bind to the query
374
429
  * @returns The query result as an object with structured key-value pairs
375
430
  */
376
431
  execute(sql: string, parameters?: any[]): Promise<QueryResult>;
@@ -378,8 +433,8 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
378
433
  * Execute a SQL write (INSERT/UPDATE/DELETE) query directly on the database without any PowerSync processing.
379
434
  * This bypasses certain PowerSync abstractions and is useful for accessing the raw database results.
380
435
  *
381
- * @param sql The SQL query to execute
382
- * @param parameters Optional array of parameters to bind to the query
436
+ * @param sql - The SQL query to execute
437
+ * @param parameters - Optional array of parameters to bind to the query
383
438
  * @returns The raw query result from the underlying database as a nested array of raw values, where each row is
384
439
  * represented as an array of column values without field names.
385
440
  */
@@ -389,53 +444,53 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
389
444
  * and optionally return results.
390
445
  * This is faster than executing separately with each parameter set.
391
446
  *
392
- * @param sql The SQL query to execute
393
- * @param parameters Optional 2D array of parameter sets, where each inner array is a set of parameters for one execution
447
+ * @param sql - The SQL query to execute
448
+ * @param parameters - Optional 2D array of parameter sets, where each inner array is a set of parameters for one execution
394
449
  * @returns The query result
395
450
  */
396
451
  executeBatch(sql: string, parameters?: any[][]): Promise<QueryResult>;
397
452
  /**
398
453
  * Execute a read-only query and return results.
399
454
  *
400
- * @param sql The SQL query to execute
401
- * @param parameters Optional array of parameters to bind to the query
455
+ * @param sql - The SQL query to execute
456
+ * @param parameters - Optional array of parameters to bind to the query
402
457
  * @returns An array of results
403
458
  */
404
459
  getAll<T>(sql: string, parameters?: any[]): Promise<T[]>;
405
460
  /**
406
461
  * Execute a read-only query and return the first result, or null if the ResultSet is empty.
407
462
  *
408
- * @param sql The SQL query to execute
409
- * @param parameters Optional array of parameters to bind to the query
463
+ * @param sql - The SQL query to execute
464
+ * @param parameters - Optional array of parameters to bind to the query
410
465
  * @returns The first result if found, or null if no results are returned
411
466
  */
412
467
  getOptional<T>(sql: string, parameters?: any[]): Promise<T | null>;
413
468
  /**
414
469
  * Execute a read-only query and return the first result, error if the ResultSet is empty.
415
470
  *
416
- * @param sql The SQL query to execute
417
- * @param parameters Optional array of parameters to bind to the query
471
+ * @param sql - The SQL query to execute
472
+ * @param parameters - Optional array of parameters to bind to the query
418
473
  * @returns The first result matching the query
419
474
  * @throws Error if no rows are returned
420
475
  */
421
476
  get<T>(sql: string, parameters?: any[]): Promise<T>;
422
477
  /**
423
478
  * Takes a read lock, without starting a transaction.
424
- * In most cases, {@link readTransaction} should be used instead.
479
+ * In most cases, {@link AbstractPowerSyncDatabase.readTransaction} should be used instead.
425
480
  */
426
- readLock<T>(callback: (db: DBAdapter) => Promise<T>): Promise<T>;
481
+ readLock<T>(callback: (db: LockContext) => Promise<T>): Promise<T>;
427
482
  /**
428
483
  * Takes a global lock, without starting a transaction.
429
- * In most cases, {@link writeTransaction} should be used instead.
484
+ * In most cases, {@link AbstractPowerSyncDatabase.writeTransaction} should be used instead.
430
485
  */
431
- writeLock<T>(callback: (db: DBAdapter) => Promise<T>): Promise<T>;
486
+ writeLock<T>(callback: (db: LockContext) => Promise<T>): Promise<T>;
432
487
  /**
433
488
  * Open a read-only transaction.
434
489
  * Read transactions can run concurrently to a write transaction.
435
490
  * Changes from any write transaction are not visible to read transactions started before it.
436
491
  *
437
- * @param callback Function to execute within the transaction
438
- * @param lockTimeout Time in milliseconds to wait for a lock before throwing an error
492
+ * @param callback - Function to execute within the transaction
493
+ * @param lockTimeout - Time in milliseconds to wait for a lock before throwing an error
439
494
  * @returns The result of the callback
440
495
  * @throws Error if the lock cannot be obtained within the timeout period
441
496
  */
@@ -445,15 +500,15 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
445
500
  * This takes a global lock - only one write transaction can execute against the database at a time.
446
501
  * Statements within the transaction must be done on the provided {@link Transaction} interface.
447
502
  *
448
- * @param callback Function to execute within the transaction
449
- * @param lockTimeout Time in milliseconds to wait for a lock before throwing an error
503
+ * @param callback - Function to execute within the transaction
504
+ * @param lockTimeout - Time in milliseconds to wait for a lock before throwing an error
450
505
  * @returns The result of the callback
451
506
  * @throws Error if the lock cannot be obtained within the timeout period
452
507
  */
453
508
  writeTransaction<T>(callback: (tx: Transaction) => Promise<T>, lockTimeout?: number): Promise<T>;
454
509
  /**
455
- * This version of `watch` uses {@link AsyncGenerator}, for documentation see {@link watchWithAsyncGenerator}.
456
- * Can be overloaded to use a callback handler instead, for documentation see {@link watchWithCallback}.
510
+ * This version of `watch` uses `AsyncGenerator`, for documentation see {@link AbstractPowerSyncDatabase.watchWithAsyncGenerator}.
511
+ * Can be overloaded to use a callback handler instead, for documentation see {@link AbstractPowerSyncDatabase.watchWithCallback}.
457
512
  *
458
513
  * @example
459
514
  * ```javascript
@@ -469,7 +524,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
469
524
  */
470
525
  watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable<QueryResult>;
471
526
  /**
472
- * See {@link watchWithCallback}.
527
+ * See {@link AbstractPowerSyncDatabase.watchWithCallback}.
473
528
  *
474
529
  * @example
475
530
  * ```javascript
@@ -523,25 +578,25 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
523
578
  customQuery<RowType>(query: WatchCompatibleQuery<RowType[]>): Query<RowType>;
524
579
  /**
525
580
  * Execute a read query every time the source tables are modified.
526
- * Use {@link SQLWatchOptions.throttleMs} to specify the minimum interval between queries.
581
+ * Use {@link SQLOnChangeOptions.throttleMs} to specify the minimum interval between queries.
527
582
  * Source tables are automatically detected using `EXPLAIN QUERY PLAN`.
528
583
  *
529
584
  * Note that the `onChange` callback member of the handler is required.
530
585
  *
531
- * @param sql The SQL query to execute
532
- * @param parameters Optional array of parameters to bind to the query
533
- * @param handler Callbacks for handling results and errors
534
- * @param options Options for configuring watch behavior
586
+ * @param sql - The SQL query to execute
587
+ * @param parameters - Optional array of parameters to bind to the query
588
+ * @param handler - Callbacks for handling results and errors
589
+ * @param options - Options for configuring watch behavior
535
590
  */
536
591
  watchWithCallback(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void;
537
592
  /**
538
593
  * Execute a read query every time the source tables are modified.
539
- * Use {@link SQLWatchOptions.throttleMs} to specify the minimum interval between queries.
594
+ * Use {@link SQLOnChangeOptions.throttleMs} to specify the minimum interval between queries.
540
595
  * Source tables are automatically detected using `EXPLAIN QUERY PLAN`.
541
596
  *
542
- * @param sql The SQL query to execute
543
- * @param parameters Optional array of parameters to bind to the query
544
- * @param options Options for configuring watch behavior
597
+ * @param sql - The SQL query to execute
598
+ * @param parameters - Optional array of parameters to bind to the query
599
+ * @param options - Options for configuring watch behavior
545
600
  * @returns An AsyncIterable that yields QueryResults whenever the data changes
546
601
  */
547
602
  watchWithAsyncGenerator(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable<QueryResult>;
@@ -550,15 +605,15 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
550
605
  * If tables are specified in the options, those are used directly.
551
606
  * Otherwise, analyzes the query using EXPLAIN to determine which tables are accessed.
552
607
  *
553
- * @param sql The SQL query to analyze
554
- * @param parameters Optional parameters for the SQL query
555
- * @param options Optional watch options that may contain explicit table list
608
+ * @param sql - The SQL query to analyze
609
+ * @param parameters - Optional parameters for the SQL query
610
+ * @param options - Optional watch options that may contain explicit table list
556
611
  * @returns Array of table names that the query depends on
557
612
  */
558
613
  resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise<string[]>;
559
614
  /**
560
- * This version of `onChange` uses {@link AsyncGenerator}, for documentation see {@link onChangeWithAsyncGenerator}.
561
- * Can be overloaded to use a callback handler instead, for documentation see {@link onChangeWithCallback}.
615
+ * This version of `onChange` uses `AsyncGenerator`, for documentation see {@link AbstractPowerSyncDatabase.onChangeWithAsyncGenerator}.
616
+ * Can be overloaded to use a callback handler instead, for documentation see {@link AbstractPowerSyncDatabase.onChangeWithCallback}.
562
617
  *
563
618
  * @example
564
619
  * ```javascript
@@ -571,7 +626,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
571
626
  */
572
627
  onChange(options?: SQLOnChangeOptions): AsyncIterable<WatchOnChangeEvent>;
573
628
  /**
574
- * See {@link onChangeWithCallback}.
629
+ * See {@link AbstractPowerSyncDatabase.onChangeWithCallback}.
575
630
  *
576
631
  * @example
577
632
  * ```javascript
@@ -588,32 +643,29 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
588
643
  /**
589
644
  * Invoke the provided callback on any changes to any of the specified tables.
590
645
  *
591
- * This is preferred over {@link watchWithCallback} when multiple queries need to be performed
646
+ * This is preferred over {@link AbstractPowerSyncDatabase.watchWithCallback} when multiple queries need to be performed
592
647
  * together when data is changed.
593
648
  *
594
649
  * Note that the `onChange` callback member of the handler is required.
595
650
  *
596
- * @param handler Callbacks for handling change events and errors
597
- * @param options Options for configuring watch behavior
651
+ * @param handler - Callbacks for handling change events and errors
652
+ * @param options - Options for configuring watch behavior
598
653
  * @returns A dispose function to stop watching for changes
599
654
  */
600
655
  onChangeWithCallback(handler?: WatchOnChangeHandler, options?: SQLOnChangeOptions): () => void;
601
656
  /**
602
657
  * Create a Stream of changes to any of the specified tables.
603
658
  *
604
- * This is preferred over {@link watchWithAsyncGenerator} when multiple queries need to be performed
605
- * together when data is changed.
659
+ * This is preferred over {@link AbstractPowerSyncDatabase.watchWithAsyncGenerator} when multiple queries need to be
660
+ * performed together when data is changed.
606
661
  *
607
662
  * Note: do not declare this as `async *onChange` as it will not work in React Native.
608
663
  *
609
- * @param options Options for configuring watch behavior
664
+ * @param options - Options for configuring watch behavior
610
665
  * @returns An AsyncIterable that yields change events whenever the specified tables change
611
666
  */
612
667
  onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable<WatchOnChangeEvent>;
613
668
  private handleTableChanges;
614
669
  private processTableUpdates;
615
- /**
616
- * @ignore
617
- */
618
670
  private executeReadOnly;
619
671
  }