@powersync/common 1.57.1 → 2.0.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 (219) hide show
  1. package/lib/attachments/AttachmentContext.d.ts +5 -5
  2. package/lib/attachments/AttachmentContext.js +6 -2
  3. package/lib/attachments/AttachmentContext.js.map +1 -1
  4. package/lib/attachments/AttachmentQueue.d.ts +6 -6
  5. package/lib/attachments/AttachmentQueue.js +9 -8
  6. package/lib/attachments/AttachmentQueue.js.map +1 -1
  7. package/lib/attachments/AttachmentService.d.ts +3 -3
  8. package/lib/attachments/AttachmentService.js +4 -3
  9. package/lib/attachments/AttachmentService.js.map +1 -1
  10. package/lib/attachments/Schema.d.ts +2 -2
  11. package/lib/attachments/SyncingService.d.ts +2 -2
  12. package/lib/attachments/SyncingService.js +21 -6
  13. package/lib/attachments/SyncingService.js.map +1 -1
  14. package/lib/client/{AbstractPowerSyncDatabase.d.ts → CommonPowerSyncDatabase.d.ts} +56 -232
  15. package/lib/client/CommonPowerSyncDatabase.js +2 -0
  16. package/lib/client/CommonPowerSyncDatabase.js.map +1 -0
  17. package/lib/client/SQLOpenFactory.d.ts +35 -13
  18. package/lib/client/SQLOpenFactory.js +1 -25
  19. package/lib/client/SQLOpenFactory.js.map +1 -1
  20. package/lib/client/compilableQueryWatch.d.ts +2 -2
  21. package/lib/client/compilableQueryWatch.js +1 -2
  22. package/lib/client/compilableQueryWatch.js.map +1 -1
  23. package/lib/client/connection/PowerSyncBackendConnector.d.ts +3 -3
  24. package/lib/client/runOnSchemaChange.d.ts +2 -2
  25. package/lib/client/runOnSchemaChange.js.map +1 -1
  26. package/lib/client/sync/bucket/CrudEntry.d.ts +3 -34
  27. package/lib/client/sync/bucket/CrudEntry.js +0 -99
  28. package/lib/client/sync/bucket/CrudEntry.js.map +1 -1
  29. package/lib/client/sync/options.d.ts +65 -0
  30. package/lib/client/sync/options.js +25 -0
  31. package/lib/client/sync/options.js.map +1 -0
  32. package/lib/client/sync/sync-streams.d.ts +1 -1
  33. package/lib/client/triggers/TriggerManager.d.ts +9 -38
  34. package/lib/client/watched/GetAllQuery.d.ts +3 -3
  35. package/lib/client/watched/GetAllQuery.js +1 -1
  36. package/lib/client/watched/GetAllQuery.js.map +1 -1
  37. package/lib/client/watched/WatchedQuery.d.ts +2 -10
  38. package/lib/client/watched/WatchedQuery.js +0 -11
  39. package/lib/client/watched/WatchedQuery.js.map +1 -1
  40. package/lib/client/watched/processors/DifferentialQueryProcessor.d.ts +0 -50
  41. package/lib/client/watched/processors/DifferentialQueryProcessor.js +1 -176
  42. package/lib/client/watched/processors/DifferentialQueryProcessor.js.map +1 -1
  43. package/lib/client/watched/processors/OnChangeQueryProcessor.d.ts +0 -22
  44. package/lib/client/watched/processors/OnChangeQueryProcessor.js +1 -82
  45. package/lib/client/watched/processors/OnChangeQueryProcessor.js.map +1 -1
  46. package/lib/db/DBAdapter.d.ts +72 -154
  47. package/lib/db/DBAdapter.js +70 -108
  48. package/lib/db/DBAdapter.js.map +1 -1
  49. package/lib/db/QueryResult.d.ts +104 -0
  50. package/lib/db/QueryResult.js +96 -0
  51. package/lib/db/QueryResult.js.map +1 -0
  52. package/lib/db/crud/SyncProgress.d.ts +1 -13
  53. package/lib/db/crud/SyncProgress.js +1 -62
  54. package/lib/db/crud/SyncProgress.js.map +1 -1
  55. package/lib/db/crud/SyncStatus.d.ts +32 -66
  56. package/lib/db/crud/SyncStatus.js +1 -253
  57. package/lib/db/crud/SyncStatus.js.map +1 -1
  58. package/lib/db/schema/Column.d.ts +0 -7
  59. package/lib/db/schema/Column.js +0 -7
  60. package/lib/db/schema/Column.js.map +1 -1
  61. package/lib/db/schema/Index.d.ts +2 -6
  62. package/lib/db/schema/Index.js +1 -4
  63. package/lib/db/schema/Index.js.map +1 -1
  64. package/lib/db/schema/IndexedColumn.d.ts +2 -6
  65. package/lib/db/schema/IndexedColumn.js +1 -4
  66. package/lib/db/schema/IndexedColumn.js.map +1 -1
  67. package/lib/db/schema/Schema.d.ts +4 -28
  68. package/lib/db/schema/Schema.js.map +1 -1
  69. package/lib/db/schema/Table.d.ts +50 -96
  70. package/lib/db/schema/Table.js +83 -91
  71. package/lib/db/schema/Table.js.map +1 -1
  72. package/lib/index.d.ts +5 -21
  73. package/lib/index.js +5 -22
  74. package/lib/index.js.map +1 -1
  75. package/lib/utils/BaseObserver.d.ts +1 -1
  76. package/lib/utils/BaseObserver.js +1 -1
  77. package/lib/utils/Logger.d.ts +52 -23
  78. package/lib/utils/Logger.js +35 -33
  79. package/lib/utils/Logger.js.map +1 -1
  80. package/lib/utils/MetaBaseObserver.d.ts +11 -11
  81. package/lib/utils/MetaBaseObserver.js +1 -50
  82. package/lib/utils/MetaBaseObserver.js.map +1 -1
  83. package/lib/utils/mutex.d.ts +3 -53
  84. package/lib/utils/mutex.js +1 -156
  85. package/lib/utils/mutex.js.map +1 -1
  86. package/package.json +8 -45
  87. package/src/attachments/AttachmentContext.ts +11 -10
  88. package/src/attachments/AttachmentQueue.ts +15 -14
  89. package/src/attachments/AttachmentService.ts +7 -6
  90. package/src/attachments/Schema.ts +2 -2
  91. package/src/attachments/SyncingService.ts +23 -9
  92. package/src/client/CommonPowerSyncDatabase.ts +540 -0
  93. package/src/client/SQLOpenFactory.ts +38 -22
  94. package/src/client/compilableQueryWatch.ts +3 -4
  95. package/src/client/connection/PowerSyncBackendConnector.ts +3 -3
  96. package/src/client/runOnSchemaChange.ts +2 -2
  97. package/src/client/sync/bucket/CrudEntry.ts +4 -104
  98. package/src/client/sync/options.ts +77 -0
  99. package/src/client/sync/sync-streams.ts +1 -1
  100. package/src/client/triggers/TriggerManager.ts +10 -41
  101. package/src/client/watched/GetAllQuery.ts +3 -3
  102. package/src/client/watched/WatchedQuery.ts +2 -15
  103. package/src/client/watched/processors/DifferentialQueryProcessor.ts +0 -223
  104. package/src/client/watched/processors/OnChangeQueryProcessor.ts +0 -111
  105. package/src/db/DBAdapter.ts +141 -226
  106. package/src/db/QueryResult.ts +195 -0
  107. package/src/db/crud/SyncProgress.ts +2 -42
  108. package/src/db/crud/SyncStatus.ts +45 -220
  109. package/src/db/schema/Column.ts +0 -8
  110. package/src/db/schema/Index.ts +3 -6
  111. package/src/db/schema/IndexedColumn.ts +3 -6
  112. package/src/db/schema/Schema.ts +4 -4
  113. package/src/db/schema/Table.ts +111 -186
  114. package/src/index.ts +5 -21
  115. package/src/utils/BaseObserver.ts +1 -1
  116. package/src/utils/Logger.ts +80 -34
  117. package/src/utils/MetaBaseObserver.ts +14 -60
  118. package/src/utils/mutex.ts +4 -201
  119. package/dist/bundle.cjs +0 -14390
  120. package/dist/bundle.cjs.map +0 -1
  121. package/dist/bundle.mjs +0 -14309
  122. package/dist/bundle.mjs.map +0 -1
  123. package/dist/bundle.node.cjs +0 -12021
  124. package/dist/bundle.node.cjs.map +0 -1
  125. package/dist/bundle.node.mjs +0 -11940
  126. package/dist/bundle.node.mjs.map +0 -1
  127. package/dist/index.d.cts +0 -4651
  128. package/legacy/sync_protocol.d.ts +0 -103
  129. package/lib/client/AbstractPowerSyncDatabase.js +0 -990
  130. package/lib/client/AbstractPowerSyncDatabase.js.map +0 -1
  131. package/lib/client/AbstractPowerSyncOpenFactory.d.ts +0 -28
  132. package/lib/client/AbstractPowerSyncOpenFactory.js +0 -28
  133. package/lib/client/AbstractPowerSyncOpenFactory.js.map +0 -1
  134. package/lib/client/ConnectionManager.d.ts +0 -115
  135. package/lib/client/ConnectionManager.js +0 -294
  136. package/lib/client/ConnectionManager.js.map +0 -1
  137. package/lib/client/CustomQuery.d.ts +0 -22
  138. package/lib/client/CustomQuery.js +0 -43
  139. package/lib/client/CustomQuery.js.map +0 -1
  140. package/lib/client/constants.d.ts +0 -4
  141. package/lib/client/constants.js +0 -5
  142. package/lib/client/constants.js.map +0 -1
  143. package/lib/client/sync/bucket/BucketStorageAdapter.d.ts +0 -56
  144. package/lib/client/sync/bucket/BucketStorageAdapter.js +0 -29
  145. package/lib/client/sync/bucket/BucketStorageAdapter.js.map +0 -1
  146. package/lib/client/sync/bucket/SqliteBucketStorage.d.ts +0 -37
  147. package/lib/client/sync/bucket/SqliteBucketStorage.js +0 -165
  148. package/lib/client/sync/bucket/SqliteBucketStorage.js.map +0 -1
  149. package/lib/client/sync/stream/AbstractRemote.d.ts +0 -180
  150. package/lib/client/sync/stream/AbstractRemote.js +0 -505
  151. package/lib/client/sync/stream/AbstractRemote.js.map +0 -1
  152. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.d.ts +0 -265
  153. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js +0 -705
  154. package/lib/client/sync/stream/AbstractStreamingSyncImplementation.js.map +0 -1
  155. package/lib/client/sync/stream/WebsocketClientTransport.d.ts +0 -15
  156. package/lib/client/sync/stream/WebsocketClientTransport.js +0 -62
  157. package/lib/client/sync/stream/WebsocketClientTransport.js.map +0 -1
  158. package/lib/client/sync/stream/core-instruction.d.ts +0 -77
  159. package/lib/client/sync/stream/core-instruction.js +0 -30
  160. package/lib/client/sync/stream/core-instruction.js.map +0 -1
  161. package/lib/client/triggers/MemoryTriggerClaimManager.d.ts +0 -6
  162. package/lib/client/triggers/MemoryTriggerClaimManager.js +0 -21
  163. package/lib/client/triggers/MemoryTriggerClaimManager.js.map +0 -1
  164. package/lib/client/triggers/TriggerManagerImpl.d.ts +0 -39
  165. package/lib/client/triggers/TriggerManagerImpl.js +0 -410
  166. package/lib/client/triggers/TriggerManagerImpl.js.map +0 -1
  167. package/lib/client/watched/processors/AbstractQueryProcessor.d.ts +0 -68
  168. package/lib/client/watched/processors/AbstractQueryProcessor.js +0 -151
  169. package/lib/client/watched/processors/AbstractQueryProcessor.js.map +0 -1
  170. package/lib/db/ConnectionClosedError.d.ts +0 -12
  171. package/lib/db/ConnectionClosedError.js +0 -23
  172. package/lib/db/ConnectionClosedError.js.map +0 -1
  173. package/lib/db/schema/TableV2.d.ts +0 -11
  174. package/lib/db/schema/TableV2.js +0 -11
  175. package/lib/db/schema/TableV2.js.map +0 -1
  176. package/lib/utils/AbortOperation.d.ts +0 -11
  177. package/lib/utils/AbortOperation.js +0 -21
  178. package/lib/utils/AbortOperation.js.map +0 -1
  179. package/lib/utils/ControlledExecutor.d.ts +0 -31
  180. package/lib/utils/ControlledExecutor.js +0 -54
  181. package/lib/utils/ControlledExecutor.js.map +0 -1
  182. package/lib/utils/async.d.ts +0 -46
  183. package/lib/utils/async.js +0 -147
  184. package/lib/utils/async.js.map +0 -1
  185. package/lib/utils/compatibility.d.ts +0 -8
  186. package/lib/utils/compatibility.js +0 -9
  187. package/lib/utils/compatibility.js.map +0 -1
  188. package/lib/utils/parseQuery.d.ts +0 -12
  189. package/lib/utils/parseQuery.js +0 -20
  190. package/lib/utils/parseQuery.js.map +0 -1
  191. package/lib/utils/queue.d.ts +0 -16
  192. package/lib/utils/queue.js +0 -42
  193. package/lib/utils/queue.js.map +0 -1
  194. package/lib/utils/stream_transform.d.ts +0 -41
  195. package/lib/utils/stream_transform.js +0 -211
  196. package/lib/utils/stream_transform.js.map +0 -1
  197. package/src/client/AbstractPowerSyncDatabase.ts +0 -1408
  198. package/src/client/AbstractPowerSyncOpenFactory.ts +0 -45
  199. package/src/client/ConnectionManager.ts +0 -405
  200. package/src/client/CustomQuery.ts +0 -56
  201. package/src/client/constants.ts +0 -4
  202. package/src/client/sync/bucket/BucketStorageAdapter.ts +0 -65
  203. package/src/client/sync/bucket/SqliteBucketStorage.ts +0 -202
  204. package/src/client/sync/stream/AbstractRemote.ts +0 -644
  205. package/src/client/sync/stream/AbstractStreamingSyncImplementation.ts +0 -970
  206. package/src/client/sync/stream/WebsocketClientTransport.ts +0 -82
  207. package/src/client/sync/stream/core-instruction.ts +0 -109
  208. package/src/client/triggers/MemoryTriggerClaimManager.ts +0 -25
  209. package/src/client/triggers/TriggerManagerImpl.ts +0 -501
  210. package/src/client/watched/processors/AbstractQueryProcessor.ts +0 -226
  211. package/src/db/ConnectionClosedError.ts +0 -25
  212. package/src/db/schema/TableV2.ts +0 -11
  213. package/src/utils/AbortOperation.ts +0 -19
  214. package/src/utils/ControlledExecutor.ts +0 -78
  215. package/src/utils/async.ts +0 -185
  216. package/src/utils/compatibility.ts +0 -9
  217. package/src/utils/parseQuery.ts +0 -31
  218. package/src/utils/queue.ts +0 -48
  219. package/src/utils/stream_transform.ts +0 -260
@@ -1,23 +1,21 @@
1
- import { ILogger } from 'js-logger';
2
- import { DBAdapter, LockContext, QueryResult, Transaction } from '../db/DBAdapter.js';
1
+ import { DBAdapter, DBGetUtils, LockContext, SqlExecutor, Transaction } from '../db/DBAdapter.js';
3
2
  import { SyncStatus } from '../db/crud/SyncStatus.js';
4
- import { UploadQueueStats } from '../db/crud/UploadQueueStatus.js';
5
3
  import { Schema } from '../db/schema/Schema.js';
6
- import { BaseObserver } from '../utils/BaseObserver.js';
7
- import { ConnectionManager, CreateSyncImplementationOptions } from './ConnectionManager.js';
8
- import { ArrayQueryDefinition, Query } from './Query.js';
9
- import { SQLOpenFactory, SQLOpenOptions } from './SQLOpenFactory.js';
4
+ import { BaseListener, BaseObserverInterface } from '../utils/BaseObserver.js';
5
+ import { WatchedQueryComparator } from './watched/processors/comparators.js';
6
+ import { PowerSyncLogger } from '../utils/Logger.js';
7
+ import { DatabaseSource } from './SQLOpenFactory.js';
8
+ import { TriggerManager } from './triggers/TriggerManager.js';
10
9
  import { PowerSyncBackendConnector } from './connection/PowerSyncBackendConnector.js';
11
- import { BucketStorageAdapter } from './sync/bucket/BucketStorageAdapter.js';
10
+ import { SyncOptions } from './sync/options.js';
11
+ import { SyncStream } from './sync/sync-streams.js';
12
+ import { UploadQueueStats } from '../db/crud/UploadQueueStatus.js';
12
13
  import { CrudBatch } from './sync/bucket/CrudBatch.js';
13
14
  import { CrudTransaction } from './sync/bucket/CrudTransaction.js';
14
- import { InternalConnectionOptions, StreamingSyncImplementation, StreamingSyncImplementationListener, type AdditionalConnectionOptions, type PowerSyncConnectionOptions, type RequiredAdditionalConnectionOptions } from './sync/stream/AbstractStreamingSyncImplementation.js';
15
- import { SyncStream } from './sync/sync-streams.js';
16
- import { TriggerManager, TriggerManagerConfig } from './triggers/TriggerManager.js';
17
- import { TriggerManagerImpl } from './triggers/TriggerManagerImpl.js';
15
+ import { ArrayQueryDefinition, Query } from './Query.js';
18
16
  import { WatchCompatibleQuery } from './watched/WatchedQuery.js';
19
- import { WatchedQueryComparator } from './watched/processors/comparators.js';
20
17
  import { Mutex } from '../utils/mutex.js';
18
+ import { QueryResult } from '../db/QueryResult.js';
21
19
  /**
22
20
  * @public
23
21
  */
@@ -26,49 +24,19 @@ export interface DisconnectAndClearOptions {
26
24
  clearLocal?: boolean;
27
25
  }
28
26
  /**
27
+ * Options required regardless of how a PowerSync database is opened.
28
+ *
29
29
  * @public
30
30
  */
31
- export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions {
31
+ export interface BasePowerSyncDatabaseOptions {
32
32
  /** Schema used for the local database. */
33
33
  schema: Schema;
34
- /**
35
- * @deprecated Use {@link AdditionalConnectionOptions.retryDelayMs} instead as this will be removed in future
36
- * releases.
37
- */
38
- retryDelay?: number;
39
- logger?: ILogger;
40
- }
41
- /**
42
- * @public
43
- */
44
- export interface PowerSyncDatabaseOptions extends BasePowerSyncDatabaseOptions {
45
- /**
46
- * Source for a SQLite database connection.
47
- * This can be either:
48
- * - A {@link DBAdapter} if providing an instantiated SQLite connection
49
- * - A {@link SQLOpenFactory} which will be used to open a SQLite connection
50
- * - {@link SQLOpenOptions} for opening a SQLite connection with a default {@link SQLOpenFactory}
51
- */
52
- database: DBAdapter | SQLOpenFactory | SQLOpenOptions;
53
- }
54
- /**
55
- * @public
56
- */
57
- export interface PowerSyncDatabaseOptionsWithDBAdapter extends BasePowerSyncDatabaseOptions {
58
- database: DBAdapter;
59
- }
60
- /**
61
- * @public
62
- */
63
- export interface PowerSyncDatabaseOptionsWithOpenFactory extends BasePowerSyncDatabaseOptions {
64
- database: SQLOpenFactory;
34
+ logger?: PowerSyncLogger;
65
35
  }
66
36
  /**
67
37
  * @public
68
38
  */
69
- export interface PowerSyncDatabaseOptionsWithSettings extends BasePowerSyncDatabaseOptions {
70
- database: SQLOpenOptions;
71
- }
39
+ export type PowerSyncDatabaseOptions = BasePowerSyncDatabaseOptions & DatabaseSource;
72
40
  /**
73
41
  * @public
74
42
  */
@@ -77,14 +45,6 @@ export interface SQLOnChangeOptions {
77
45
  tables?: string[];
78
46
  /** The minimum interval between queries. */
79
47
  throttleMs?: number;
80
- /**
81
- * @deprecated All tables specified in {@link SQLOnChangeOptions.tables} will be watched, including PowerSync tables
82
- * with prefixes.
83
- *
84
- * Allows for watching any SQL table
85
- * by not removing PowerSync table name prefixes
86
- */
87
- rawTableNames?: boolean;
88
48
  /**
89
49
  * Emits an empty result set immediately
90
50
  */
@@ -118,14 +78,14 @@ export interface WatchHandler {
118
78
  */
119
79
  export interface WatchOnChangeHandler {
120
80
  onChange: (event: WatchOnChangeEvent) => Promise<void> | void;
121
- onError?: (error: Error) => void;
122
81
  }
123
82
  /**
124
83
  * @public
125
84
  */
126
- export interface PowerSyncDBListener extends StreamingSyncImplementationListener {
85
+ export interface PowerSyncDBListener extends BaseListener {
127
86
  initialized: () => void;
128
87
  schemaChanged: (schema: Schema) => void;
88
+ statusChanged?: (status: SyncStatus) => void;
129
89
  closing: () => Promise<void> | void;
130
90
  closed: () => Promise<void> | void;
131
91
  }
@@ -141,89 +101,44 @@ export interface PowerSyncCloseOptions {
141
101
  disconnect?: boolean;
142
102
  }
143
103
  /**
144
- * @internal
145
- */
146
- export declare const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions;
147
- /**
148
- * @internal
149
- */
150
- export declare const DEFAULT_POWERSYNC_DB_OPTIONS: {
151
- retryDelayMs: number;
152
- crudUploadThrottleMs: number;
153
- };
154
- /**
155
- * @internal
156
- */
157
- export declare const DEFAULT_CRUD_BATCH_LIMIT = 100;
158
- /**
159
- * Requesting nested or recursive locks can block the application in some circumstances.
160
- * This default lock timeout will act as a failsafe to throw an error if a lock cannot
161
- * be obtained.
162
- *
163
- * @internal
104
+ * @public
164
105
  */
165
- export declare const DEFAULT_LOCK_TIMEOUT_MS = 120000;
106
+ export interface PowerSyncDatabaseConstructor<Options> {
107
+ new (options: Options): CommonPowerSyncDatabase;
108
+ }
166
109
  /**
167
- * Tests if the input is a {@link PowerSyncDatabaseOptionsWithSettings}
168
- * @internal
110
+ * @public
111
+ * @deprecated Use {@link CommonPowerSyncDatabase} instead.
169
112
  */
170
- export declare const isPowerSyncDatabaseOptionsWithSettings: (test: any) => test is PowerSyncDatabaseOptionsWithSettings;
113
+ export type AbstractPowerSyncDatabase = CommonPowerSyncDatabase;
171
114
  /**
172
115
  * @public
173
116
  */
174
- export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDBListener> {
175
- protected options: PowerSyncDatabaseOptions;
117
+ export interface CommonPowerSyncDatabase extends BaseObserverInterface<PowerSyncDBListener>, SqlExecutor, DBGetUtils {
176
118
  /**
177
119
  * Returns true if the connection is closed.
178
120
  */
179
- closed: boolean;
180
- ready: boolean;
121
+ readonly closed: boolean;
122
+ readonly ready: boolean;
181
123
  /**
182
124
  * Current connection status.
183
125
  */
184
- currentStatus: SyncStatus;
185
- sdkVersion: string;
186
- protected bucketStorageAdapter: BucketStorageAdapter;
187
- protected _isReadyPromise: Promise<void>;
188
- protected connectionManager: ConnectionManager;
189
- private subscriptions;
190
- get syncStreamImplementation(): StreamingSyncImplementation | null;
191
- /**
192
- * The connector used to connect to the PowerSync service.
193
- *
194
- * @returns The connector used to connect to the PowerSync service or null if `connect()` has not been called.
195
- */
196
- get connector(): PowerSyncBackendConnector | null;
197
- /**
198
- * The resolved connection options used to connect to the PowerSync service.
199
- *
200
- * @returns The resolved connection options used to connect to the PowerSync service or null if `connect()` has not been called.
201
- */
202
- get connectionOptions(): InternalConnectionOptions | null;
203
- protected _schema: Schema;
204
- private _database;
205
- protected runExclusiveMutex: Mutex;
126
+ readonly currentStatus: SyncStatus;
127
+ readonly sdkVersion: string;
206
128
  /**
207
- * @experimental
129
+ * @experimental @alpha
208
130
  * Allows creating SQLite triggers which can be used to track various operations on SQLite tables.
209
131
  */
210
132
  readonly triggers: TriggerManager;
211
- protected triggersImpl: TriggerManagerImpl;
212
- logger: ILogger;
213
- constructor(options: PowerSyncDatabaseOptionsWithDBAdapter);
214
- constructor(options: PowerSyncDatabaseOptionsWithOpenFactory);
215
- constructor(options: PowerSyncDatabaseOptionsWithSettings);
216
- constructor(options: PowerSyncDatabaseOptions);
133
+ readonly logger: PowerSyncLogger;
217
134
  /**
218
135
  * Schema used for the local database.
219
136
  */
220
- get schema(): Schema<{
221
- [x: string]: import("../index.js").Table<any>;
222
- }>;
137
+ readonly schema: Schema;
223
138
  /**
224
139
  * The underlying database.
225
140
  *
226
- * For the most part, behavior is the same whether querying on the underlying database, or on {@link AbstractPowerSyncDatabase}.
141
+ * For the most part, behavior is the same whether querying on the underlying database, or on {@link CommonPowerSyncDatabase}.
227
142
  */
228
143
  get database(): DBAdapter;
229
144
  /**
@@ -231,17 +146,6 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
231
146
  */
232
147
  get connected(): boolean;
233
148
  get connecting(): boolean;
234
- /**
235
- * Opens the DBAdapter given open options using a default open factory
236
- */
237
- protected abstract openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter;
238
- /**
239
- * Generates a base configuration for {@link TriggerManagerImpl}.
240
- * Implementations should override this if necessary.
241
- */
242
- protected generateTriggerManagerConfig(): TriggerManagerConfig;
243
- protected abstract generateSyncStreamImplementation(connector: PowerSyncBackendConnector, options: CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions): StreamingSyncImplementation;
244
- protected abstract generateBucketStorageAdapter(): BucketStorageAdapter;
245
149
  /**
246
150
  * @returns A promise which will resolve once initialization is completed.
247
151
  */
@@ -263,22 +167,10 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
263
167
  * Waits for the first sync status for which the `status` callback returns a truthy value.
264
168
  */
265
169
  waitForStatus(predicate: (status: SyncStatus) => any, signal?: AbortSignal): Promise<void>;
266
- /**
267
- * Allows for extended implementations to execute custom initialization
268
- * logic as part of the total init process
269
- */
270
- abstract _initialize(): Promise<void>;
271
- /**
272
- * Entry point for executing initialization logic.
273
- * This is to be automatically executed in the constructor.
274
- */
275
- protected initialize(): Promise<void>;
276
- protected loadVersion(): Promise<void>;
277
- protected resolveOfflineSyncStatus(): Promise<void>;
278
170
  /**
279
171
  * Replace the schema with a new version. This is for advanced use cases - typically the schema should just be specified once in the constructor.
280
172
  *
281
- * Cannot be used while connected - this should only be called before {@link AbstractPowerSyncDatabase.connect}.
173
+ * Cannot be used while connected - this should only be called before {@link CommonPowerSyncDatabase.connect}.
282
174
  */
283
175
  updateSchema(schema: Schema): Promise<void>;
284
176
  /**
@@ -286,25 +178,14 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
286
178
  * While initializing is automatic, this helps to catch and report initialization errors.
287
179
  */
288
180
  init(): Promise<void>;
289
- protected resolvedConnectionOptions(options: CreateSyncImplementationOptions): CreateSyncImplementationOptions & RequiredAdditionalConnectionOptions;
290
- /**
291
- * @deprecated Use {@link AbstractPowerSyncDatabase#close} instead.
292
- * Clears all listeners registered by {@link AbstractPowerSyncDatabase#registerListener}.
293
- */
294
- dispose(): void;
295
- /**
296
- * Locking mechanism for exclusively running critical portions of connect/disconnect operations.
297
- * Locking here is mostly only important on web for multiple tab scenarios.
298
- */
299
- protected runExclusive<T>(callback: () => Promise<T>): Promise<T>;
300
181
  /**
301
182
  * Connects to stream of events from the PowerSync instance.
302
183
  */
303
- connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise<void>;
184
+ connect(connector: PowerSyncBackendConnector, options?: SyncOptions): Promise<void>;
304
185
  /**
305
186
  * Close the sync connection.
306
187
  *
307
- * Use {@link AbstractPowerSyncDatabase.connect} to connect again.
188
+ * Use {@link CommonPowerSyncDatabase.connect} to connect again.
308
189
  */
309
190
  disconnect(): Promise<void>;
310
191
  /**
@@ -322,7 +203,6 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
322
203
  * @param name - The name of the stream to subscribe to.
323
204
  * @param params - Optional parameters for the stream subscription.
324
205
  * @returns A {@link SyncStream} instance that can be subscribed to.
325
- * @experimental Sync streams are currently in alpha.
326
206
  */
327
207
  syncStream(name: string, params?: Record<string, any>): SyncStream;
328
208
  /**
@@ -369,7 +249,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
369
249
  * Once the data have been successfully uploaded, call {@link CrudTransaction.complete} before
370
250
  * requesting the next transaction.
371
251
  *
372
- * Unlike {@link AbstractPowerSyncDatabase.getCrudBatch}, this only returns data from a single transaction at a time.
252
+ * Unlike {@link CommonPowerSyncDatabase.getCrudBatch}, this only returns data from a single transaction at a time.
373
253
  * All data for the transaction is loaded into memory.
374
254
  *
375
255
  * @returns A transaction of CRUD operations to upload, or null if there are none
@@ -381,7 +261,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
381
261
  * This is typically used from the {@link PowerSyncBackendConnector.uploadData} callback. Each entry emitted by the
382
262
  * returned iterator is a full transaction containing all local writes made while that transaction was active.
383
263
  *
384
- * Unlike {@link AbstractPowerSyncDatabase.getNextCrudTransaction}, which always returns the oldest transaction that hasn't been
264
+ * Unlike {@link CommonPowerSyncDatabase.getNextCrudTransaction}, which always returns the oldest transaction that hasn't been
385
265
  * {@link CrudTransaction.complete}d yet, this iterator can be used to receive multiple transactions. Calling
386
266
  * {@link CrudTransaction.complete} will mark that and all prior transactions emitted by the iterator as completed.
387
267
  *
@@ -415,73 +295,14 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
415
295
  * @returns A unique identifier for the database instance
416
296
  */
417
297
  getClientId(): Promise<string>;
418
- private handleCrudCheckpoint;
419
- /**
420
- * Execute a SQL write (INSERT/UPDATE/DELETE) query
421
- * and optionally return results.
422
- *
423
- * When using the default client-side [JSON-based view system](https://docs.powersync.com/architecture/client-architecture#client-side-schema-and-sqlite-database-structure),
424
- * the returned result's `rowsAffected` may be `0` for successful `UPDATE` and `DELETE` statements.
425
- * Use a `RETURNING` clause and inspect `result.rows` when you need to confirm which rows changed.
426
- *
427
- * @param sql - The SQL query to execute
428
- * @param parameters - Optional array of parameters to bind to the query
429
- * @returns The query result as an object with structured key-value pairs
430
- */
431
- execute(sql: string, parameters?: any[]): Promise<QueryResult>;
432
- /**
433
- * Execute a SQL write (INSERT/UPDATE/DELETE) query directly on the database without any PowerSync processing.
434
- * This bypasses certain PowerSync abstractions and is useful for accessing the raw database results.
435
- *
436
- * @param sql - The SQL query to execute
437
- * @param parameters - Optional array of parameters to bind to the query
438
- * @returns The raw query result from the underlying database as a nested array of raw values, where each row is
439
- * represented as an array of column values without field names.
440
- */
441
- executeRaw(sql: string, parameters?: any[]): Promise<any[][]>;
442
- /**
443
- * Execute a write query (INSERT/UPDATE/DELETE) multiple times with each parameter set
444
- * and optionally return results.
445
- * This is faster than executing separately with each parameter set.
446
- *
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
449
- * @returns The query result
450
- */
451
- executeBatch(sql: string, parameters?: any[][]): Promise<QueryResult>;
452
- /**
453
- * Execute a read-only query and return results.
454
- *
455
- * @param sql - The SQL query to execute
456
- * @param parameters - Optional array of parameters to bind to the query
457
- * @returns An array of results
458
- */
459
- getAll<T>(sql: string, parameters?: any[]): Promise<T[]>;
460
- /**
461
- * Execute a read-only query and return the first result, or null if the ResultSet is empty.
462
- *
463
- * @param sql - The SQL query to execute
464
- * @param parameters - Optional array of parameters to bind to the query
465
- * @returns The first result if found, or null if no results are returned
466
- */
467
- getOptional<T>(sql: string, parameters?: any[]): Promise<T | null>;
468
- /**
469
- * Execute a read-only query and return the first result, error if the ResultSet is empty.
470
- *
471
- * @param sql - The SQL query to execute
472
- * @param parameters - Optional array of parameters to bind to the query
473
- * @returns The first result matching the query
474
- * @throws Error if no rows are returned
475
- */
476
- get<T>(sql: string, parameters?: any[]): Promise<T>;
477
298
  /**
478
299
  * Takes a read lock, without starting a transaction.
479
- * In most cases, {@link AbstractPowerSyncDatabase.readTransaction} should be used instead.
300
+ * In most cases, {@link CommonPowerSyncDatabase.readTransaction} should be used instead.
480
301
  */
481
302
  readLock<T>(callback: (db: LockContext) => Promise<T>): Promise<T>;
482
303
  /**
483
304
  * Takes a global lock, without starting a transaction.
484
- * In most cases, {@link AbstractPowerSyncDatabase.writeTransaction} should be used instead.
305
+ * In most cases, {@link CommonPowerSyncDatabase.writeTransaction} should be used instead.
485
306
  */
486
307
  writeLock<T>(callback: (db: LockContext) => Promise<T>): Promise<T>;
487
308
  /**
@@ -507,8 +328,8 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
507
328
  */
508
329
  writeTransaction<T>(callback: (tx: Transaction) => Promise<T>, lockTimeout?: number): Promise<T>;
509
330
  /**
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}.
331
+ * This version of `watch` uses `AsyncGenerator`, for documentation see {@link CommonPowerSyncDatabase.watchWithAsyncGenerator}.
332
+ * Can be overloaded to use a callback handler instead, for documentation see {@link CommonPowerSyncDatabase.watchWithCallback}.
512
333
  *
513
334
  * @example
514
335
  * ```javascript
@@ -524,7 +345,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
524
345
  */
525
346
  watch(sql: string, parameters?: any[], options?: SQLWatchOptions): AsyncIterable<QueryResult>;
526
347
  /**
527
- * See {@link AbstractPowerSyncDatabase.watchWithCallback}.
348
+ * See {@link CommonPowerSyncDatabase.watchWithCallback}.
528
349
  *
529
350
  * @example
530
351
  * ```javascript
@@ -542,7 +363,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
542
363
  watch(sql: string, parameters?: any[], handler?: WatchHandler, options?: SQLWatchOptions): void;
543
364
  /**
544
365
  * Allows defining a query which can be used to build a {@link WatchedQuery}.
545
- * The defined query will be executed with {@link AbstractPowerSyncDatabase#getAll}.
366
+ * The defined query will be executed with {@link CommonPowerSyncDatabase#getAll}.
546
367
  * An optional mapper function can be provided to transform the results.
547
368
  *
548
369
  * @example
@@ -612,8 +433,8 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
612
433
  */
613
434
  resolveTables(sql: string, parameters?: any[], options?: SQLWatchOptions): Promise<string[]>;
614
435
  /**
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}.
436
+ * This version of `onChange` uses `AsyncGenerator`, for documentation see {@link CommonPowerSyncDatabase.onChangeWithAsyncGenerator}.
437
+ * Can be overloaded to use a callback handler instead, for documentation see {@link CommonPowerSyncDatabase.onChangeWithCallback}.
617
438
  *
618
439
  * @example
619
440
  * ```javascript
@@ -626,7 +447,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
626
447
  */
627
448
  onChange(options?: SQLOnChangeOptions): AsyncIterable<WatchOnChangeEvent>;
628
449
  /**
629
- * See {@link AbstractPowerSyncDatabase.onChangeWithCallback}.
450
+ * See {@link CommonPowerSyncDatabase.onChangeWithCallback}.
630
451
  *
631
452
  * @example
632
453
  * ```javascript
@@ -643,7 +464,7 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
643
464
  /**
644
465
  * Invoke the provided callback on any changes to any of the specified tables.
645
466
  *
646
- * This is preferred over {@link AbstractPowerSyncDatabase.watchWithCallback} when multiple queries need to be performed
467
+ * This is preferred over {@link CommonPowerSyncDatabase.watchWithCallback} when multiple queries need to be performed
647
468
  * together when data is changed.
648
469
  *
649
470
  * Note that the `onChange` callback member of the handler is required.
@@ -656,14 +477,17 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
656
477
  /**
657
478
  * Create a Stream of changes to any of the specified tables.
658
479
  *
659
- * This is preferred over {@link AbstractPowerSyncDatabase.watchWithAsyncGenerator} when multiple queries need to be
480
+ * This is preferred over {@link CommonPowerSyncDatabase.watchWithAsyncGenerator} when multiple queries need to be
660
481
  * performed together when data is changed.
661
482
  *
483
+ * Note: do not declare this as `async *onChange` as it will not work in React Native.
484
+ *
662
485
  * @param options - Options for configuring watch behavior
663
486
  * @returns An AsyncIterable that yields change events whenever the specified tables change
664
487
  */
665
488
  onChangeWithAsyncGenerator(options?: SQLWatchOptions): AsyncIterable<WatchOnChangeEvent>;
666
- private handleTableChanges;
667
- private processTableUpdates;
668
- private executeReadOnly;
489
+ /**
490
+ * @internal
491
+ */
492
+ createMutex(): Mutex;
669
493
  }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CommonPowerSyncDatabase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommonPowerSyncDatabase.js","sourceRoot":"","sources":["../../src/client/CommonPowerSyncDatabase.ts"],"names":[],"mappings":""}
@@ -35,20 +35,42 @@ export interface SQLOpenFactory {
35
35
  openDB(): DBAdapter;
36
36
  }
37
37
  /**
38
- * Tests if the input is a {@link SQLOpenOptions}
38
+ * A source describing how to open databases.
39
39
  *
40
- * @internal
41
- */
42
- export declare const isSQLOpenOptions: (test: any) => test is SQLOpenOptions;
43
- /**
44
- * Tests if input is a {@link SQLOpenFactory}
40
+ * - A {@link DBAdapter} providing access to an opened SQLite connection pool.
41
+ * - A {@link SQLOpenFactory} which will be used to open a SQLite connection pool lazily.
42
+ * - A {@link SQLOpenOptions} for opening a SQLite connection with a default {@link SQLOpenFactory} for the current
43
+ * platform.
45
44
  *
46
- * @internal
47
- */
48
- export declare const isSQLOpenFactory: (test: any) => test is SQLOpenFactory;
49
- /**
50
- * Tests if input is a {@link DBAdapter}
45
+ * For most apps, using the `database` key with {@link SQLOpenOptions} is the easiest and recommended option.
51
46
  *
52
- * @internal
47
+ * @public
53
48
  */
54
- export declare const isDBAdapter: (test: any) => test is DBAdapter;
49
+ export type DatabaseSource<OpenOptions extends SQLOpenOptions = SQLOpenOptions> = {
50
+ /**
51
+ * Wrap an opened {@link DBAdapter} as a PowerSync database instance.
52
+ *
53
+ * This is primarily useful for testing. On most platforms, PowerSync would open a pool of SQLite connections by
54
+ * default. This option allows using a single in-memory instance instead. It can also be used to customize the
55
+ * database used by default, e.g. to install additional logging on SQL statements by intercepting methods.
56
+ */
57
+ opened: DBAdapter;
58
+ } | {
59
+ /**
60
+ * Construct a PowerSync database that will call {@link SQLOpenFactory.openDB} when opened.
61
+ *
62
+ * On most SDKs, passing {@link SQLOpenOptions} is a better option. An exception is React Native, where using an
63
+ * [OP-SQLite factory](https://docs.powersync.com/client-sdks/reference/react-native-and-expo#op-sqlite) is
64
+ * recommended.
65
+ */
66
+ factory: SQLOpenFactory;
67
+ } | {
68
+ /**
69
+ * Construct a PowerSync database opening a connection pool from the {@link SQLOpenOptions}.
70
+ *
71
+ * At the very least, options include the {@link SQLOpenOptions.dbFilename} to open. Depending on the PowerSync
72
+ * SDK used, additional options are available. For example, the web SDK allows configuring the virtual file system
73
+ * implementation used to persist files on the web too.
74
+ */
75
+ database: OpenOptions;
76
+ };
@@ -1,26 +1,2 @@
1
- /**
2
- * Tests if the input is a {@link SQLOpenOptions}
3
- *
4
- * @internal
5
- */
6
- export const isSQLOpenOptions = (test) => {
7
- // typeof null is `object`, but you cannot use the `in` operator on `null.
8
- return test && typeof test == 'object' && 'dbFilename' in test;
9
- };
10
- /**
11
- * Tests if input is a {@link SQLOpenFactory}
12
- *
13
- * @internal
14
- */
15
- export const isSQLOpenFactory = (test) => {
16
- return typeof test?.openDB == 'function';
17
- };
18
- /**
19
- * Tests if input is a {@link DBAdapter}
20
- *
21
- * @internal
22
- */
23
- export const isDBAdapter = (test) => {
24
- return typeof test?.writeTransaction == 'function';
25
- };
1
+ export {};
26
2
  //# sourceMappingURL=SQLOpenFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SQLOpenFactory.js","sourceRoot":"","sources":["../../src/client/SQLOpenFactory.ts"],"names":[],"mappings":"AAwCA;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAS,EAA0B,EAAE;IACpE,0EAA0E;IAC1E,OAAO,IAAI,IAAI,OAAO,IAAI,IAAI,QAAQ,IAAI,YAAY,IAAI,IAAI,CAAC;AACjE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAS,EAA0B,EAAE;IACpE,OAAO,OAAO,IAAI,EAAE,MAAM,IAAI,UAAU,CAAC;AAC3C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAS,EAAqB,EAAE;IAC1D,OAAO,OAAO,IAAI,EAAE,gBAAgB,IAAI,UAAU,CAAC;AACrD,CAAC,CAAC"}
1
+ {"version":3,"file":"SQLOpenFactory.js","sourceRoot":"","sources":["../../src/client/SQLOpenFactory.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { CompilableQuery } from './../types/types.js';
2
- import { AbstractPowerSyncDatabase, SQLWatchOptions } from './AbstractPowerSyncDatabase.js';
2
+ import { CommonPowerSyncDatabase, SQLWatchOptions } from './CommonPowerSyncDatabase.js';
3
3
  /**
4
4
  * @public
5
5
  */
@@ -10,4 +10,4 @@ export interface CompilableQueryWatchHandler<T> {
10
10
  /**
11
11
  * @public
12
12
  */
13
- export declare function compilableQueryWatch<T>(db: AbstractPowerSyncDatabase, query: CompilableQuery<T>, handler: CompilableQueryWatchHandler<T>, options?: SQLWatchOptions): void;
13
+ export declare function compilableQueryWatch<T>(db: CommonPowerSyncDatabase, query: CompilableQuery<T>, handler: CompilableQueryWatchHandler<T>, options?: SQLWatchOptions): void;
@@ -23,8 +23,7 @@ export function compilableQueryWatch(db, query, handler, options) {
23
23
  catch (error) {
24
24
  onError(error);
25
25
  }
26
- },
27
- onError
26
+ }
28
27
  }, {
29
28
  ...(options ?? {}),
30
29
  tables: resolvedTables,
@@ -1 +1 @@
1
- {"version":3,"file":"compilableQueryWatch.js","sourceRoot":"","sources":["../../src/client/compilableQueryWatch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAU3D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,EAA6B,EAC7B,KAAyB,EACzB,OAAuC,EACvC,OAAyB;IAEzB,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,CAAC,CAAQ,EAAE,EAAE,GAAE,CAAC,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAC/D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,EAAE,WAAwB,EAAE,EAAE;QACpD,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;YAC9B,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,UAAgB,EAAE,OAAO,CAAC,CAAC;YAE1F,qBAAqB;YACrB,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;YACrC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAEjB,EAAE,CAAC,oBAAoB,CACrB;gBACE,QAAQ,EAAE,KAAK,IAAI,EAAE;oBACnB,IAAI,CAAC;wBACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;wBACrC,QAAQ,CAAC,MAAM,CAAC,CAAC;oBACnB,CAAC;oBAAC,OAAO,KAAU,EAAE,CAAC;wBACpB,OAAO,CAAC,KAAK,CAAC,CAAC;oBACjB,CAAC;gBACH,CAAC;gBACD,OAAO;aACR,EACD;gBACE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;gBAClB,MAAM,EAAE,cAAc;gBACtB,kDAAkD;gBAClD,MAAM,EAAE,WAAW;aACpB,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;IAEF,iBAAiB,CAAC,UAAU,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC"}
1
+ {"version":3,"file":"compilableQueryWatch.js","sourceRoot":"","sources":["../../src/client/compilableQueryWatch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAU3D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,EAA2B,EAC3B,KAAyB,EACzB,OAAuC,EACvC,OAAyB;IAEzB,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,CAAC,CAAQ,EAAE,EAAE,GAAE,CAAC,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAC/D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,EAAE,WAAwB,EAAE,EAAE;QACpD,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;YAC9B,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,UAAgB,EAAE,OAAO,CAAC,CAAC;YAE1F,qBAAqB;YACrB,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;YACrC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAEjB,EAAE,CAAC,oBAAoB,CACrB;gBACE,QAAQ,EAAE,KAAK,IAAI,EAAE;oBACnB,IAAI,CAAC;wBACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;wBACrC,QAAQ,CAAC,MAAM,CAAC,CAAC;oBACnB,CAAC;oBAAC,OAAO,KAAU,EAAE,CAAC;wBACpB,OAAO,CAAC,KAAK,CAAC,CAAC;oBACjB,CAAC;gBACH,CAAC;aACF,EACD;gBACE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;gBAClB,MAAM,EAAE,cAAc;gBACtB,kDAAkD;gBAClD,MAAM,EAAE,WAAW;aACpB,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;IAEF,iBAAiB,CAAC,UAAU,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { PowerSyncCredentials } from './PowerSyncCredentials.js';
2
- import type { AbstractPowerSyncDatabase } from '../AbstractPowerSyncDatabase.js';
2
+ import { CommonPowerSyncDatabase } from '../CommonPowerSyncDatabase.js';
3
3
  /**
4
4
  * @public
5
5
  */
@@ -18,9 +18,9 @@ export interface PowerSyncBackendConnector {
18
18
  fetchCredentials: () => Promise<PowerSyncCredentials | null>;
19
19
  /** Upload local changes to the app backend.
20
20
  *
21
- * Use {@link AbstractPowerSyncDatabase.getCrudBatch} to get a batch of changes to upload.
21
+ * Use {@link CommonPowerSyncDatabase.getCrudBatch} to get a batch of changes to upload.
22
22
  *
23
23
  * Any thrown errors will result in a retry after the configured wait period (default: 5 seconds).
24
24
  */
25
- uploadData: (database: AbstractPowerSyncDatabase) => Promise<void>;
25
+ uploadData: (database: CommonPowerSyncDatabase) => Promise<void>;
26
26
  }
@@ -1,5 +1,5 @@
1
- import { AbstractPowerSyncDatabase, SQLWatchOptions } from './AbstractPowerSyncDatabase.js';
1
+ import { CommonPowerSyncDatabase, SQLWatchOptions } from './CommonPowerSyncDatabase.js';
2
2
  /**
3
3
  * @internal
4
4
  */
5
- export declare function runOnSchemaChange(callback: (signal: AbortSignal) => void, db: AbstractPowerSyncDatabase, options?: SQLWatchOptions): void;
5
+ export declare function runOnSchemaChange(callback: (signal: AbortSignal) => void, db: CommonPowerSyncDatabase, options?: SQLWatchOptions): void;
@@ -1 +1 @@
1
- {"version":3,"file":"runOnSchemaChange.js","sourceRoot":"","sources":["../../src/client/runOnSchemaChange.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAuC,EACvC,EAA6B,EAC7B,OAAyB;IAEzB,MAAM,mBAAmB,GAAG,GAAG,EAAE;QAC/B,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QAC9C,IAAI,qBAAqB,GAAwB,IAAI,CAAC;QACtD,MAAM,YAAY,GAAG,GAAG,EAAE;YACxB,eAAe,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YACzC,qBAAqB,EAAE,EAAE,CAAC;YAC1B,qBAAqB,GAAG,IAAI,CAAC;YAC7B,kDAAkD;YAClD,OAAO,EAAE,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAC9D,CAAC,CAAC;QAEF,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACzD,qBAAqB,GAAG,EAAE,CAAC,gBAAgB,CAAC;YAC1C,aAAa,EAAE,KAAK,IAAI,EAAE;gBACxB,YAAY,EAAE,CAAC;gBACf,yIAAyI;gBACzI,UAAU,CAAC,GAAG,EAAE,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,CAAC;YAC7C,CAAC;SACF,CAAC,CAAC;QACH,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC;IAEF,mBAAmB,EAAE,CAAC;AACxB,CAAC"}
1
+ {"version":3,"file":"runOnSchemaChange.js","sourceRoot":"","sources":["../../src/client/runOnSchemaChange.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAuC,EACvC,EAA2B,EAC3B,OAAyB;IAEzB,MAAM,mBAAmB,GAAG,GAAG,EAAE;QAC/B,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QAC9C,IAAI,qBAAqB,GAAwB,IAAI,CAAC;QACtD,MAAM,YAAY,GAAG,GAAG,EAAE;YACxB,eAAe,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YACzC,qBAAqB,EAAE,EAAE,CAAC;YAC1B,qBAAqB,GAAG,IAAI,CAAC;YAC7B,kDAAkD;YAClD,OAAO,EAAE,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAC9D,CAAC,CAAC;QAEF,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACzD,qBAAqB,GAAG,EAAE,CAAC,gBAAgB,CAAC;YAC1C,aAAa,EAAE,KAAK,IAAI,EAAE;gBACxB,YAAY,EAAE,CAAC;gBACf,yIAAyI;gBACzI,UAAU,CAAC,GAAG,EAAE,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,CAAC;YAC7C,CAAC;SACF,CAAC,CAAC;QACH,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC;IAEF,mBAAmB,EAAE,CAAC;AACxB,CAAC"}