@powersync/common 0.0.0-dev-20250520135616 → 0.0.0-dev-20250528152729

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.
@@ -5,6 +5,7 @@ import { SyncStatus } from '../db/crud/SyncStatus.js';
5
5
  import { UploadQueueStats } from '../db/crud/UploadQueueStatus.js';
6
6
  import { Schema } from '../db/schema/Schema.js';
7
7
  import { BaseObserver } from '../utils/BaseObserver.js';
8
+ import { ConnectionManager } from './ConnectionManager.js';
8
9
  import { SQLOpenFactory, SQLOpenOptions } from './SQLOpenFactory.js';
9
10
  import { PowerSyncBackendConnector } from './connection/PowerSyncBackendConnector.js';
10
11
  import { BucketStorageAdapter } from './sync/bucket/BucketStorageAdapter.js';
@@ -114,13 +115,14 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
114
115
  * Current connection status.
115
116
  */
116
117
  currentStatus: SyncStatus;
117
- syncStreamImplementation?: StreamingSyncImplementation;
118
118
  sdkVersion: string;
119
119
  protected bucketStorageAdapter: BucketStorageAdapter;
120
- private syncStatusListenerDisposer?;
121
120
  protected _isReadyPromise: Promise<void>;
121
+ protected connectionManager: ConnectionManager;
122
+ get syncStreamImplementation(): StreamingSyncImplementation | null;
122
123
  protected _schema: Schema;
123
124
  private _database;
125
+ protected connectionMutex: Mutex;
124
126
  constructor(options: PowerSyncDatabaseOptionsWithDBAdapter);
125
127
  constructor(options: PowerSyncDatabaseOptionsWithOpenFactory);
126
128
  constructor(options: PowerSyncDatabaseOptionsWithSettings);
@@ -190,6 +192,11 @@ export declare abstract class AbstractPowerSyncDatabase extends BaseObserver<Pow
190
192
  */
191
193
  init(): Promise<void>;
192
194
  resolvedConnectionOptions(options?: PowerSyncConnectionOptions): RequiredAdditionalConnectionOptions;
195
+ /**
196
+ * Locking mechanism for exclusively running critical portions of connect/disconnect operations.
197
+ * Locking here is mostly only important on web for multiple tab scenarios.
198
+ */
199
+ protected runExclusive<T>(callback: () => Promise<T>): Promise<T>;
193
200
  /**
194
201
  * Connects to stream of events from the PowerSync instance.
195
202
  */
@@ -2,12 +2,14 @@ import { Mutex } from 'async-mutex';
2
2
  import { EventIterator } from 'event-iterator';
3
3
  import Logger from 'js-logger';
4
4
  import { isBatchedUpdateNotification } from '../db/DBAdapter.js';
5
+ import { FULL_SYNC_PRIORITY } from '../db/crud/SyncProgress.js';
5
6
  import { SyncStatus } from '../db/crud/SyncStatus.js';
6
7
  import { UploadQueueStats } from '../db/crud/UploadQueueStatus.js';
7
8
  import { BaseObserver } from '../utils/BaseObserver.js';
8
9
  import { ControlledExecutor } from '../utils/ControlledExecutor.js';
9
- import { mutexRunExclusive } from '../utils/mutex.js';
10
10
  import { throttleTrailing } from '../utils/async.js';
11
+ import { mutexRunExclusive } from '../utils/mutex.js';
12
+ import { ConnectionManager } from './ConnectionManager.js';
11
13
  import { isDBAdapter, isSQLOpenFactory, isSQLOpenOptions } from './SQLOpenFactory.js';
12
14
  import { runOnSchemaChange } from './runOnSchemaChange.js';
13
15
  import { PSInternalTable } from './sync/bucket/BucketStorageAdapter.js';
@@ -15,7 +17,6 @@ import { CrudBatch } from './sync/bucket/CrudBatch.js';
15
17
  import { CrudEntry } from './sync/bucket/CrudEntry.js';
16
18
  import { CrudTransaction } from './sync/bucket/CrudTransaction.js';
17
19
  import { DEFAULT_CRUD_UPLOAD_THROTTLE_MS, DEFAULT_RETRY_DELAY_MS } from './sync/stream/AbstractStreamingSyncImplementation.js';
18
- import { FULL_SYNC_PRIORITY } from '../db/crud/SyncProgress.js';
19
20
  const POWERSYNC_TABLE_MATCH = /(^ps_data__|^ps_data_local__)/;
20
21
  const DEFAULT_DISCONNECT_CLEAR_OPTIONS = {
21
22
  clearLocal: true
@@ -59,13 +60,16 @@ export class AbstractPowerSyncDatabase extends BaseObserver {
59
60
  * Current connection status.
60
61
  */
61
62
  currentStatus;
62
- syncStreamImplementation;
63
63
  sdkVersion;
64
64
  bucketStorageAdapter;
65
- syncStatusListenerDisposer;
66
65
  _isReadyPromise;
66
+ connectionManager;
67
+ get syncStreamImplementation() {
68
+ return this.connectionManager.syncStreamImplementation;
69
+ }
67
70
  _schema;
68
71
  _database;
72
+ connectionMutex;
69
73
  constructor(options) {
70
74
  super();
71
75
  this.options = options;
@@ -92,7 +96,31 @@ export class AbstractPowerSyncDatabase extends BaseObserver {
92
96
  this._schema = schema;
93
97
  this.ready = false;
94
98
  this.sdkVersion = '';
99
+ this.connectionMutex = new Mutex();
95
100
  // Start async init
101
+ this.connectionManager = new ConnectionManager({
102
+ createSyncImplementation: async (connector, options) => {
103
+ await this.waitForReady();
104
+ return this.runExclusive(async () => {
105
+ const sync = this.generateSyncStreamImplementation(connector, this.resolvedConnectionOptions(options));
106
+ const onDispose = sync.registerListener({
107
+ statusChanged: (status) => {
108
+ this.currentStatus = new SyncStatus({
109
+ ...status.toJSON(),
110
+ hasSynced: this.currentStatus?.hasSynced || !!status.lastSyncedAt
111
+ });
112
+ this.iterateListeners((cb) => cb.statusChanged?.(this.currentStatus));
113
+ }
114
+ });
115
+ await sync.waitForReady();
116
+ return {
117
+ sync,
118
+ onDispose
119
+ };
120
+ });
121
+ },
122
+ logger: this.logger
123
+ });
96
124
  this._isReadyPromise = this.initialize();
97
125
  }
98
126
  /**
@@ -265,30 +293,18 @@ export class AbstractPowerSyncDatabase extends BaseObserver {
265
293
  crudUploadThrottleMs: options?.crudUploadThrottleMs ?? this.options.crudUploadThrottleMs ?? DEFAULT_CRUD_UPLOAD_THROTTLE_MS
266
294
  };
267
295
  }
296
+ /**
297
+ * Locking mechanism for exclusively running critical portions of connect/disconnect operations.
298
+ * Locking here is mostly only important on web for multiple tab scenarios.
299
+ */
300
+ runExclusive(callback) {
301
+ return this.connectionMutex.runExclusive(callback);
302
+ }
268
303
  /**
269
304
  * Connects to stream of events from the PowerSync instance.
270
305
  */
271
306
  async connect(connector, options) {
272
- await this.waitForReady();
273
- // close connection if one is open
274
- await this.disconnect();
275
- if (this.closed) {
276
- throw new Error('Cannot connect using a closed client');
277
- }
278
- const resolvedConnectOptions = this.resolvedConnectionOptions(options);
279
- this.syncStreamImplementation = this.generateSyncStreamImplementation(connector, resolvedConnectOptions);
280
- this.syncStatusListenerDisposer = this.syncStreamImplementation.registerListener({
281
- statusChanged: (status) => {
282
- this.currentStatus = new SyncStatus({
283
- ...status.toJSON(),
284
- hasSynced: this.currentStatus?.hasSynced || !!status.lastSyncedAt
285
- });
286
- this.iterateListeners((cb) => cb.statusChanged?.(this.currentStatus));
287
- }
288
- });
289
- await this.syncStreamImplementation.waitForReady();
290
- this.syncStreamImplementation.triggerCrudUpload();
291
- await this.syncStreamImplementation.connect(options);
307
+ return this.connectionManager.connect(connector, options);
292
308
  }
293
309
  /**
294
310
  * Close the sync connection.
@@ -296,11 +312,7 @@ export class AbstractPowerSyncDatabase extends BaseObserver {
296
312
  * Use {@link connect} to connect again.
297
313
  */
298
314
  async disconnect() {
299
- await this.waitForReady();
300
- await this.syncStreamImplementation?.disconnect();
301
- this.syncStatusListenerDisposer?.();
302
- await this.syncStreamImplementation?.dispose();
303
- this.syncStreamImplementation = undefined;
315
+ return this.connectionManager.disconnect();
304
316
  }
305
317
  /**
306
318
  * Disconnect and clear the database.
@@ -339,7 +351,7 @@ export class AbstractPowerSyncDatabase extends BaseObserver {
339
351
  if (disconnect) {
340
352
  await this.disconnect();
341
353
  }
342
- await this.syncStreamImplementation?.dispose();
354
+ await this.connectionManager.close();
343
355
  await this.database.close();
344
356
  this.closed = true;
345
357
  }
@@ -0,0 +1,72 @@
1
+ import { ILogger } from 'js-logger';
2
+ import { BaseListener, BaseObserver } from '../utils/BaseObserver.js';
3
+ import { PowerSyncBackendConnector } from './connection/PowerSyncBackendConnector.js';
4
+ import { PowerSyncConnectionOptions, StreamingSyncImplementation } from './sync/stream/AbstractStreamingSyncImplementation.js';
5
+ /**
6
+ * @internal
7
+ */
8
+ export interface ConnectionManagerSyncImplementationResult {
9
+ sync: StreamingSyncImplementation;
10
+ onDispose: () => Promise<void> | void;
11
+ }
12
+ /**
13
+ * @internal
14
+ */
15
+ export interface ConnectionManagerOptions {
16
+ createSyncImplementation(connector: PowerSyncBackendConnector, options: PowerSyncConnectionOptions): Promise<ConnectionManagerSyncImplementationResult>;
17
+ logger: ILogger;
18
+ }
19
+ type StoredConnectionOptions = {
20
+ connector: PowerSyncBackendConnector;
21
+ options: PowerSyncConnectionOptions;
22
+ };
23
+ /**
24
+ * @internal
25
+ */
26
+ export interface ConnectionManagerListener extends BaseListener {
27
+ syncStreamCreated: (sync: StreamingSyncImplementation) => void;
28
+ }
29
+ /**
30
+ * @internal
31
+ */
32
+ export declare class ConnectionManager extends BaseObserver<ConnectionManagerListener> {
33
+ protected options: ConnectionManagerOptions;
34
+ /**
35
+ * Tracks active connection attempts
36
+ */
37
+ protected connectingPromise: Promise<void> | null;
38
+ /**
39
+ * Tracks actively instantiating a streaming sync implementation.
40
+ */
41
+ protected syncStreamInitPromise: Promise<void> | null;
42
+ /**
43
+ * Active disconnect operation. Calling disconnect multiple times
44
+ * will resolve to the same operation.
45
+ */
46
+ protected disconnectingPromise: Promise<void> | null;
47
+ /**
48
+ * Tracks the last parameters supplied to `connect` calls.
49
+ * Calling `connect` multiple times in succession will result in:
50
+ * - 1 pending connection operation which will be aborted.
51
+ * - updating the last set of parameters while waiting for the pending
52
+ * attempt to be aborted
53
+ * - internally connecting with the last set of parameters
54
+ */
55
+ protected pendingConnectionOptions: StoredConnectionOptions | null;
56
+ syncStreamImplementation: StreamingSyncImplementation | null;
57
+ syncDisposer: (() => Promise<void> | void) | null;
58
+ constructor(options: ConnectionManagerOptions);
59
+ get logger(): ILogger;
60
+ close(): Promise<void>;
61
+ connect(connector: PowerSyncBackendConnector, options?: PowerSyncConnectionOptions): Promise<void>;
62
+ protected connectInternal(): Promise<void>;
63
+ /**
64
+ * Close the sync connection.
65
+ *
66
+ * Use {@link connect} to connect again.
67
+ */
68
+ disconnect(): Promise<void>;
69
+ protected disconnectInternal(): Promise<void>;
70
+ protected performDisconnect(): Promise<void>;
71
+ }
72
+ export {};
@@ -0,0 +1,161 @@
1
+ import { BaseObserver } from '../utils/BaseObserver.js';
2
+ /**
3
+ * @internal
4
+ */
5
+ export class ConnectionManager extends BaseObserver {
6
+ options;
7
+ /**
8
+ * Tracks active connection attempts
9
+ */
10
+ connectingPromise;
11
+ /**
12
+ * Tracks actively instantiating a streaming sync implementation.
13
+ */
14
+ syncStreamInitPromise;
15
+ /**
16
+ * Active disconnect operation. Calling disconnect multiple times
17
+ * will resolve to the same operation.
18
+ */
19
+ disconnectingPromise;
20
+ /**
21
+ * Tracks the last parameters supplied to `connect` calls.
22
+ * Calling `connect` multiple times in succession will result in:
23
+ * - 1 pending connection operation which will be aborted.
24
+ * - updating the last set of parameters while waiting for the pending
25
+ * attempt to be aborted
26
+ * - internally connecting with the last set of parameters
27
+ */
28
+ pendingConnectionOptions;
29
+ syncStreamImplementation;
30
+ syncDisposer;
31
+ constructor(options) {
32
+ super();
33
+ this.options = options;
34
+ this.connectingPromise = null;
35
+ this.syncStreamInitPromise = null;
36
+ this.disconnectingPromise = null;
37
+ this.pendingConnectionOptions = null;
38
+ this.syncStreamImplementation = null;
39
+ this.syncDisposer = null;
40
+ }
41
+ get logger() {
42
+ return this.options.logger;
43
+ }
44
+ async close() {
45
+ await this.syncDisposer?.();
46
+ }
47
+ async connect(connector, options) {
48
+ // Keep track if there were pending operations before this call
49
+ const hadPendingOptions = !!this.pendingConnectionOptions;
50
+ // Update pending options to the latest values
51
+ this.pendingConnectionOptions = {
52
+ connector,
53
+ options: options ?? {}
54
+ };
55
+ // Disconnecting here provides aborting in progress connection attempts.
56
+ // The connectInternal method will clear pending options once it starts connecting (with the options).
57
+ // We only need to trigger a disconnect here if we have already reached the point of connecting.
58
+ // If we do already have pending options, a disconnect has already been performed.
59
+ // The connectInternal method also does a sanity disconnect to prevent straggler connections.
60
+ // We should also disconnect if we have already completed a connection attempt.
61
+ if (!hadPendingOptions) {
62
+ await this.disconnectInternal();
63
+ }
64
+ // Triggers a connect which checks if pending options are available after the connect completes.
65
+ // The completion can be for a successful, unsuccessful or aborted connection attempt.
66
+ // If pending options are available another connection will be triggered.
67
+ const checkConnection = async () => {
68
+ if (this.pendingConnectionOptions) {
69
+ // Pending options have been placed while connecting.
70
+ // Need to reconnect.
71
+ this.connectingPromise = this.connectInternal().finally(checkConnection);
72
+ return this.connectingPromise;
73
+ }
74
+ else {
75
+ // Clear the connecting promise, done.
76
+ this.connectingPromise = null;
77
+ return;
78
+ }
79
+ };
80
+ this.connectingPromise ??= this.connectInternal().finally(checkConnection);
81
+ return this.connectingPromise;
82
+ }
83
+ async connectInternal() {
84
+ let appliedOptions = null;
85
+ // This method ensures a disconnect before any connection attempt
86
+ await this.disconnectInternal();
87
+ /**
88
+ * This portion creates a sync implementation which can be racy when disconnecting or
89
+ * if multiple tabs on web are in use.
90
+ * This is protected in an exclusive lock.
91
+ * The promise tracks the creation which is used to synchronize disconnect attempts.
92
+ */
93
+ this.syncStreamInitPromise = new Promise(async (resolve, reject) => {
94
+ try {
95
+ if (!this.pendingConnectionOptions) {
96
+ this.logger.debug('No pending connection options found, not creating sync stream implementation');
97
+ // A disconnect could have cleared this.
98
+ return;
99
+ }
100
+ const { connector, options } = this.pendingConnectionOptions;
101
+ appliedOptions = options;
102
+ this.pendingConnectionOptions = null;
103
+ const { sync, onDispose } = await this.options.createSyncImplementation(connector, options);
104
+ this.iterateListeners((l) => l.syncStreamCreated?.(sync));
105
+ this.syncStreamImplementation = sync;
106
+ this.syncDisposer = onDispose;
107
+ await this.syncStreamImplementation.waitForReady();
108
+ resolve();
109
+ }
110
+ catch (error) {
111
+ reject(error);
112
+ }
113
+ });
114
+ await this.syncStreamInitPromise;
115
+ this.syncStreamInitPromise = null;
116
+ if (!appliedOptions) {
117
+ // A disconnect could have cleared the options which did not create a syncStreamImplementation
118
+ return;
119
+ }
120
+ // It might be possible that a disconnect triggered between the last check
121
+ // and this point. Awaiting here allows the sync stream to be cleared if disconnected.
122
+ await this.disconnectingPromise;
123
+ this.logger.debug('Attempting to connect to PowerSync instance');
124
+ await this.syncStreamImplementation?.connect(appliedOptions);
125
+ this.syncStreamImplementation?.triggerCrudUpload();
126
+ }
127
+ /**
128
+ * Close the sync connection.
129
+ *
130
+ * Use {@link connect} to connect again.
131
+ */
132
+ async disconnect() {
133
+ // This will help abort pending connects
134
+ this.pendingConnectionOptions = null;
135
+ await this.disconnectInternal();
136
+ }
137
+ async disconnectInternal() {
138
+ if (this.disconnectingPromise) {
139
+ // A disconnect is already in progress
140
+ return this.disconnectingPromise;
141
+ }
142
+ // Wait if a sync stream implementation is being created before closing it
143
+ // (syncStreamImplementation must be assigned before we can properly dispose it)
144
+ await this.syncStreamInitPromise;
145
+ this.disconnectingPromise = this.performDisconnect();
146
+ await this.disconnectingPromise;
147
+ this.disconnectingPromise = null;
148
+ }
149
+ async performDisconnect() {
150
+ // Keep reference to the sync stream implementation and disposer
151
+ // The class members will be cleared before we trigger the disconnect
152
+ // to prevent any further calls to the sync stream implementation.
153
+ const sync = this.syncStreamImplementation;
154
+ this.syncStreamImplementation = null;
155
+ const disposer = this.syncDisposer;
156
+ this.syncDisposer = null;
157
+ await sync?.disconnect();
158
+ await sync?.dispose();
159
+ await disposer?.();
160
+ }
161
+ }
@@ -283,8 +283,16 @@ export class AbstractRemote {
283
283
  }, syncQueueRequestSize, // The initial N amount
284
284
  {
285
285
  onError: (e) => {
286
- if (e.message.includes('Authorization failed') || e.message.includes('PSYNC_S21')) {
287
- this.invalidateCredentials();
286
+ if (e.message.includes('PSYNC_')) {
287
+ if (e.message.includes('PSYNC_S21')) {
288
+ this.invalidateCredentials();
289
+ }
290
+ }
291
+ else {
292
+ // Possible that connection is with an older service, always invalidate to be safe
293
+ if (e.message !== 'Closed. ') {
294
+ this.invalidateCredentials();
295
+ }
288
296
  }
289
297
  // Don't log closed as an error
290
298
  if (e.message !== 'Closed. ') {
@@ -196,11 +196,12 @@ The next upload iteration will be delayed.`);
196
196
  if (this.abortController) {
197
197
  await this.disconnect();
198
198
  }
199
- this.abortController = new AbortController();
199
+ const controller = new AbortController();
200
+ this.abortController = controller;
200
201
  this.streamingSyncPromise = this.streamingSync(this.abortController.signal, options);
201
202
  // Return a promise that resolves when the connection status is updated
202
203
  return new Promise((resolve) => {
203
- const l = this.registerListener({
204
+ const disposer = this.registerListener({
204
205
  statusUpdated: (update) => {
205
206
  // This is triggered as soon as a connection is read from
206
207
  if (typeof update.connected == 'undefined') {
@@ -209,12 +210,14 @@ The next upload iteration will be delayed.`);
209
210
  }
210
211
  if (update.connected == false) {
211
212
  /**
212
- * This function does not reject if initial connect attempt failed
213
+ * This function does not reject if initial connect attempt failed.
214
+ * Connected can be false if the connection attempt was aborted or if the initial connection
215
+ * attempt failed.
213
216
  */
214
217
  this.logger.warn('Initial connect attempt did not successfully connect to server');
215
218
  }
219
+ disposer();
216
220
  resolve();
217
- l();
218
221
  }
219
222
  });
220
223
  });
@@ -356,6 +359,9 @@ The next upload iteration will be delayed.`);
356
359
  let validatedCheckpoint = null;
357
360
  let appliedCheckpoint = null;
358
361
  const clientId = await this.options.adapter.getClientId();
362
+ if (signal.aborted) {
363
+ return;
364
+ }
359
365
  this.logger.debug('Requesting stream from server');
360
366
  const syncOptions = {
361
367
  path: '/sync/stream',
package/lib/index.d.ts CHANGED
@@ -1,35 +1,34 @@
1
1
  export * from './client/AbstractPowerSyncDatabase.js';
2
2
  export * from './client/AbstractPowerSyncOpenFactory.js';
3
- export * from './client/SQLOpenFactory.js';
3
+ export { compilableQueryWatch, CompilableQueryWatchHandler } from './client/compilableQueryWatch.js';
4
4
  export * from './client/connection/PowerSyncBackendConnector.js';
5
5
  export * from './client/connection/PowerSyncCredentials.js';
6
- export * from './client/sync/bucket/BucketStorageAdapter.js';
6
+ export { MAX_OP_ID } from './client/constants.js';
7
7
  export { runOnSchemaChange } from './client/runOnSchemaChange.js';
8
- export { CompilableQueryWatchHandler, compilableQueryWatch } from './client/compilableQueryWatch.js';
9
- export { UpdateType, CrudEntry, OpId } from './client/sync/bucket/CrudEntry.js';
10
- export * from './client/sync/bucket/SqliteBucketStorage.js';
8
+ export * from './client/SQLOpenFactory.js';
9
+ export * from './client/sync/bucket/BucketStorageAdapter.js';
11
10
  export * from './client/sync/bucket/CrudBatch.js';
11
+ export { CrudEntry, OpId, UpdateType } from './client/sync/bucket/CrudEntry.js';
12
12
  export * from './client/sync/bucket/CrudTransaction.js';
13
+ export * from './client/sync/bucket/OplogEntry.js';
14
+ export * from './client/sync/bucket/OpType.js';
15
+ export * from './client/sync/bucket/SqliteBucketStorage.js';
13
16
  export * from './client/sync/bucket/SyncDataBatch.js';
14
17
  export * from './client/sync/bucket/SyncDataBucket.js';
15
- export * from './client/sync/bucket/OpType.js';
16
- export * from './client/sync/bucket/OplogEntry.js';
17
18
  export * from './client/sync/stream/AbstractRemote.js';
18
19
  export * from './client/sync/stream/AbstractStreamingSyncImplementation.js';
19
20
  export * from './client/sync/stream/streaming-sync-types.js';
20
- export { MAX_OP_ID } from './client/constants.js';
21
+ export * from './client/ConnectionManager.js';
21
22
  export { ProgressWithOperations, SyncProgress } from './db/crud/SyncProgress.js';
22
23
  export * from './db/crud/SyncStatus.js';
23
24
  export * from './db/crud/UploadQueueStatus.js';
24
- export * from './db/schema/Schema.js';
25
- export * from './db/schema/Table.js';
25
+ export * from './db/DBAdapter.js';
26
+ export * from './db/schema/Column.js';
26
27
  export * from './db/schema/Index.js';
27
28
  export * from './db/schema/IndexedColumn.js';
28
- export * from './db/schema/Column.js';
29
+ export * from './db/schema/Schema.js';
30
+ export * from './db/schema/Table.js';
29
31
  export * from './db/schema/TableV2.js';
30
- export * from './db/crud/SyncStatus.js';
31
- export * from './db/crud/UploadQueueStatus.js';
32
- export * from './db/DBAdapter.js';
33
32
  export * from './utils/AbortOperation.js';
34
33
  export * from './utils/BaseObserver.js';
35
34
  export * from './utils/DataStream.js';
package/lib/index.js CHANGED
@@ -1,35 +1,34 @@
1
1
  export * from './client/AbstractPowerSyncDatabase.js';
2
2
  export * from './client/AbstractPowerSyncOpenFactory.js';
3
- export * from './client/SQLOpenFactory.js';
3
+ export { compilableQueryWatch } from './client/compilableQueryWatch.js';
4
4
  export * from './client/connection/PowerSyncBackendConnector.js';
5
5
  export * from './client/connection/PowerSyncCredentials.js';
6
- export * from './client/sync/bucket/BucketStorageAdapter.js';
6
+ export { MAX_OP_ID } from './client/constants.js';
7
7
  export { runOnSchemaChange } from './client/runOnSchemaChange.js';
8
- export { compilableQueryWatch } from './client/compilableQueryWatch.js';
9
- export { UpdateType, CrudEntry } from './client/sync/bucket/CrudEntry.js';
10
- export * from './client/sync/bucket/SqliteBucketStorage.js';
8
+ export * from './client/SQLOpenFactory.js';
9
+ export * from './client/sync/bucket/BucketStorageAdapter.js';
11
10
  export * from './client/sync/bucket/CrudBatch.js';
11
+ export { CrudEntry, UpdateType } from './client/sync/bucket/CrudEntry.js';
12
12
  export * from './client/sync/bucket/CrudTransaction.js';
13
+ export * from './client/sync/bucket/OplogEntry.js';
14
+ export * from './client/sync/bucket/OpType.js';
15
+ export * from './client/sync/bucket/SqliteBucketStorage.js';
13
16
  export * from './client/sync/bucket/SyncDataBatch.js';
14
17
  export * from './client/sync/bucket/SyncDataBucket.js';
15
- export * from './client/sync/bucket/OpType.js';
16
- export * from './client/sync/bucket/OplogEntry.js';
17
18
  export * from './client/sync/stream/AbstractRemote.js';
18
19
  export * from './client/sync/stream/AbstractStreamingSyncImplementation.js';
19
20
  export * from './client/sync/stream/streaming-sync-types.js';
20
- export { MAX_OP_ID } from './client/constants.js';
21
+ export * from './client/ConnectionManager.js';
21
22
  export { SyncProgress } from './db/crud/SyncProgress.js';
22
23
  export * from './db/crud/SyncStatus.js';
23
24
  export * from './db/crud/UploadQueueStatus.js';
24
- export * from './db/schema/Schema.js';
25
- export * from './db/schema/Table.js';
25
+ export * from './db/DBAdapter.js';
26
+ export * from './db/schema/Column.js';
26
27
  export * from './db/schema/Index.js';
27
28
  export * from './db/schema/IndexedColumn.js';
28
- export * from './db/schema/Column.js';
29
+ export * from './db/schema/Schema.js';
30
+ export * from './db/schema/Table.js';
29
31
  export * from './db/schema/TableV2.js';
30
- export * from './db/crud/SyncStatus.js';
31
- export * from './db/crud/UploadQueueStatus.js';
32
- export * from './db/DBAdapter.js';
33
32
  export * from './utils/AbortOperation.js';
34
33
  export * from './utils/BaseObserver.js';
35
34
  export * from './utils/DataStream.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/common",
3
- "version": "0.0.0-dev-20250520135616",
3
+ "version": "0.0.0-dev-20250528152729",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"