@powersync/web 0.0.0-dev-20251209082930 → 0.0.0-dev-20260112083235
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.
- package/README.md +1 -1
- package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js +1875 -0
- package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js.map +1 -0
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c0.index.umd.js +567 -0
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c0.index.umd.js.map +1 -0
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c1.index.umd.js +567 -0
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c1.index.umd.js.map +1 -0
- package/dist/index.umd.js +6938 -1827
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +222 -196
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +159 -119
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/dist/worker/node_modules_bson_lib_bson_mjs.umd.js +3 -3
- package/dist/worker/node_modules_bson_lib_bson_mjs.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js +6 -6
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js +6 -6
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js +6 -6
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +6 -6
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js +9 -9
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js +12 -12
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js +9 -9
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js.map +1 -1
- package/lib/package.json +18 -13
- package/lib/src/db/PowerSyncDatabase.d.ts +3 -1
- package/lib/src/db/PowerSyncDatabase.js +19 -7
- package/lib/src/db/adapters/AbstractWebPowerSyncDatabaseOpenFactory.d.ts +1 -1
- package/lib/src/db/adapters/AbstractWebPowerSyncDatabaseOpenFactory.js +1 -1
- package/lib/src/db/adapters/AbstractWebSQLOpenFactory.d.ts +2 -2
- package/lib/src/db/adapters/AbstractWebSQLOpenFactory.js +2 -2
- package/lib/src/db/adapters/AsyncDatabaseConnection.d.ts +1 -9
- package/lib/src/db/adapters/AsyncDatabaseConnection.js +1 -11
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.d.ts +3 -3
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.js +13 -7
- package/lib/src/db/adapters/WebDBAdapter.d.ts +1 -1
- package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.d.ts +2 -2
- package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js +1 -2
- package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.d.ts +2 -2
- package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.d.ts +3 -3
- package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.js +5 -5
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.d.ts +4 -4
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +6 -6
- package/lib/src/db/adapters/wa-sqlite/WASQLitePowerSyncDatabaseOpenFactory.d.ts +1 -1
- package/lib/src/db/adapters/wa-sqlite/WASQLitePowerSyncDatabaseOpenFactory.js +3 -3
- package/lib/src/db/sync/SharedWebStreamingSyncImplementation.d.ts +4 -4
- package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +5 -5
- package/lib/src/db/sync/WebRemote.js +1 -1
- package/lib/src/db/sync/WebStreamingSyncImplementation.d.ts +1 -1
- package/lib/src/db/sync/WebStreamingSyncImplementation.js +1 -1
- package/lib/src/index.d.ts +12 -12
- package/lib/src/index.js +12 -12
- package/lib/src/worker/db/SharedWASQLiteConnection.d.ts +2 -2
- package/lib/src/worker/db/WASQLiteDB.worker.js +3 -3
- package/lib/src/worker/db/WorkerWASQLiteConnection.d.ts +2 -2
- package/lib/src/worker/db/WorkerWASQLiteConnection.js +1 -1
- package/lib/src/worker/db/open-worker-database.d.ts +2 -2
- package/lib/src/worker/db/open-worker-database.js +1 -1
- package/lib/src/worker/sync/BroadcastLogger.d.ts +1 -1
- package/lib/src/worker/sync/SharedSyncImplementation.d.ts +4 -4
- package/lib/src/worker/sync/SharedSyncImplementation.js +13 -5
- package/lib/src/worker/sync/SharedSyncImplementation.worker.js +2 -2
- package/lib/src/worker/sync/WorkerClient.d.ts +1 -1
- package/lib/src/worker/sync/WorkerClient.js +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -14
- package/src/db/PowerSyncDatabase.ts +23 -8
- package/src/db/adapters/AbstractWebPowerSyncDatabaseOpenFactory.ts +1 -1
- package/src/db/adapters/AbstractWebSQLOpenFactory.ts +3 -3
- package/src/db/adapters/AsyncDatabaseConnection.ts +1 -13
- package/src/db/adapters/LockedAsyncDatabaseAdapter.ts +17 -9
- package/src/db/adapters/WebDBAdapter.ts +1 -1
- package/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.ts +3 -4
- package/src/db/adapters/wa-sqlite/WASQLiteConnection.ts +2 -2
- package/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts +7 -7
- package/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts +7 -7
- package/src/db/adapters/wa-sqlite/WASQLitePowerSyncDatabaseOpenFactory.ts +3 -3
- package/src/db/sync/SharedWebStreamingSyncImplementation.ts +7 -7
- package/src/db/sync/WebRemote.ts +1 -1
- package/src/db/sync/WebStreamingSyncImplementation.ts +2 -2
- package/src/index.ts +12 -12
- package/src/worker/db/SharedWASQLiteConnection.ts +2 -2
- package/src/worker/db/WASQLiteDB.worker.ts +5 -5
- package/src/worker/db/WorkerWASQLiteConnection.ts +2 -2
- package/src/worker/db/open-worker-database.ts +2 -2
- package/src/worker/sync/BroadcastLogger.ts +1 -1
- package/src/worker/sync/SharedSyncImplementation.ts +17 -8
- package/src/worker/sync/SharedSyncImplementation.worker.ts +2 -2
- package/src/worker/sync/WorkerClient.ts +2 -2
- /package/bin/{powersync.js → powersync.cjs} +0 -0
|
@@ -15,22 +15,23 @@ import {
|
|
|
15
15
|
type RequiredAdditionalConnectionOptions
|
|
16
16
|
} from '@powersync/common';
|
|
17
17
|
import { Mutex } from 'async-mutex';
|
|
18
|
-
import { getNavigatorLocks } from '../shared/navigator';
|
|
19
|
-
import { WebDBAdapter } from './adapters/WebDBAdapter';
|
|
20
|
-
import { WASQLiteOpenFactory } from './adapters/wa-sqlite/WASQLiteOpenFactory';
|
|
18
|
+
import { getNavigatorLocks } from '../shared/navigator.js';
|
|
19
|
+
import { WebDBAdapter } from './adapters/WebDBAdapter.js';
|
|
20
|
+
import { WASQLiteOpenFactory } from './adapters/wa-sqlite/WASQLiteOpenFactory.js';
|
|
21
21
|
import {
|
|
22
22
|
DEFAULT_WEB_SQL_FLAGS,
|
|
23
23
|
ResolvedWebSQLOpenOptions,
|
|
24
24
|
WebSQLFlags,
|
|
25
|
+
isServerSide,
|
|
25
26
|
resolveWebSQLFlags
|
|
26
|
-
} from './adapters/web-sql-flags';
|
|
27
|
-
import { SSRStreamingSyncImplementation } from './sync/SSRWebStreamingSyncImplementation';
|
|
28
|
-
import { SharedWebStreamingSyncImplementation } from './sync/SharedWebStreamingSyncImplementation';
|
|
29
|
-
import { WebRemote } from './sync/WebRemote';
|
|
27
|
+
} from './adapters/web-sql-flags.js';
|
|
28
|
+
import { SSRStreamingSyncImplementation } from './sync/SSRWebStreamingSyncImplementation.js';
|
|
29
|
+
import { SharedWebStreamingSyncImplementation } from './sync/SharedWebStreamingSyncImplementation.js';
|
|
30
|
+
import { WebRemote } from './sync/WebRemote.js';
|
|
30
31
|
import {
|
|
31
32
|
WebStreamingSyncImplementation,
|
|
32
33
|
WebStreamingSyncImplementationOptions
|
|
33
|
-
} from './sync/WebStreamingSyncImplementation';
|
|
34
|
+
} from './sync/WebStreamingSyncImplementation.js';
|
|
34
35
|
|
|
35
36
|
export interface WebPowerSyncFlags extends WebSQLFlags {
|
|
36
37
|
/**
|
|
@@ -169,6 +170,20 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
|
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
172
|
|
|
173
|
+
protected async loadVersion(): Promise<void> {
|
|
174
|
+
if (isServerSide()) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
return super.loadVersion();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
protected async resolveOfflineSyncStatus() {
|
|
181
|
+
if (isServerSide()) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
return super.resolveOfflineSyncStatus();
|
|
185
|
+
}
|
|
186
|
+
|
|
172
187
|
protected generateBucketStorageAdapter(): BucketStorageAdapter {
|
|
173
188
|
return new SqliteBucketStorage(this.database);
|
|
174
189
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ILogger,
|
|
2
|
-
import { SSRDBAdapter } from './SSRDBAdapter';
|
|
3
|
-
import { ResolvedWebSQLFlags, WebSQLOpenFactoryOptions, isServerSide, resolveWebSQLFlags } from './web-sql-flags';
|
|
1
|
+
import { DBAdapter, type ILogger, SQLOpenFactory, createLogger } from '@powersync/common';
|
|
2
|
+
import { SSRDBAdapter } from './SSRDBAdapter.js';
|
|
3
|
+
import { ResolvedWebSQLFlags, WebSQLOpenFactoryOptions, isServerSide, resolveWebSQLFlags } from './web-sql-flags.js';
|
|
4
4
|
|
|
5
5
|
export abstract class AbstractWebSQLOpenFactory implements SQLOpenFactory {
|
|
6
6
|
protected resolvedFlags: ResolvedWebSQLFlags;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BatchedUpdateNotification, QueryResult } from '@powersync/common';
|
|
2
|
-
import { ResolvedWebSQLOpenOptions } from './web-sql-flags';
|
|
2
|
+
import { ResolvedWebSQLOpenOptions } from './web-sql-flags.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
@@ -17,18 +17,6 @@ export type ProxiedQueryResult = Omit<QueryResult, 'rows'> & {
|
|
|
17
17
|
*/
|
|
18
18
|
export type OnTableChangeCallback = (event: BatchedUpdateNotification) => void;
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* Thrown when an underlying database connection is closed.
|
|
22
|
-
* This is particularly relevant when worker connections are marked as closed while
|
|
23
|
-
* operations are still in progress.
|
|
24
|
-
*/
|
|
25
|
-
export class ConnectionClosedError extends Error {
|
|
26
|
-
constructor(message: string) {
|
|
27
|
-
super(message);
|
|
28
|
-
this.name = 'ConnectionClosedError';
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
20
|
/**
|
|
33
21
|
* @internal
|
|
34
22
|
* An async Database connection which provides basic async SQL methods.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseObserver,
|
|
3
|
+
ConnectionClosedError,
|
|
3
4
|
DBAdapter,
|
|
4
5
|
DBAdapterListener,
|
|
5
6
|
DBGetUtils,
|
|
@@ -10,13 +11,13 @@ import {
|
|
|
10
11
|
createLogger,
|
|
11
12
|
type ILogger
|
|
12
13
|
} from '@powersync/common';
|
|
13
|
-
import { getNavigatorLocks } from '../../shared/navigator';
|
|
14
|
-
import { AsyncDatabaseConnection
|
|
15
|
-
import { SharedConnectionWorker, WebDBAdapter } from './WebDBAdapter';
|
|
16
|
-
import { WorkerWrappedAsyncDatabaseConnection } from './WorkerWrappedAsyncDatabaseConnection';
|
|
17
|
-
import { WASQLiteVFS } from './wa-sqlite/WASQLiteConnection';
|
|
18
|
-
import { ResolvedWASQLiteOpenFactoryOptions } from './wa-sqlite/WASQLiteOpenFactory';
|
|
19
|
-
import { ResolvedWebSQLOpenOptions } from './web-sql-flags';
|
|
14
|
+
import { getNavigatorLocks } from '../../shared/navigator.js';
|
|
15
|
+
import { AsyncDatabaseConnection } from './AsyncDatabaseConnection.js';
|
|
16
|
+
import { SharedConnectionWorker, WebDBAdapter } from './WebDBAdapter.js';
|
|
17
|
+
import { WorkerWrappedAsyncDatabaseConnection } from './WorkerWrappedAsyncDatabaseConnection.js';
|
|
18
|
+
import { WASQLiteVFS } from './wa-sqlite/WASQLiteConnection.js';
|
|
19
|
+
import { ResolvedWASQLiteOpenFactoryOptions } from './wa-sqlite/WASQLiteOpenFactory.js';
|
|
20
|
+
import { ResolvedWebSQLOpenOptions } from './web-sql-flags.js';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* @internal
|
|
@@ -233,7 +234,14 @@ export class LockedAsyncDatabaseAdapter
|
|
|
233
234
|
*/
|
|
234
235
|
async close() {
|
|
235
236
|
this.closing = true;
|
|
236
|
-
|
|
237
|
+
/**
|
|
238
|
+
* Note that we obtain a reference to the callback to avoid calling the callback with `this` as the context.
|
|
239
|
+
* This is to avoid Comlink attempting to clone `this` when calling the method.
|
|
240
|
+
*/
|
|
241
|
+
const dispose = this._disposeTableChangeListener;
|
|
242
|
+
if (dispose) {
|
|
243
|
+
dispose();
|
|
244
|
+
}
|
|
237
245
|
this.pendingAbortControllers.forEach((controller) => controller.abort('Closed'));
|
|
238
246
|
await this.baseDB?.close?.();
|
|
239
247
|
this.closed = true;
|
|
@@ -326,7 +334,7 @@ export class LockedAsyncDatabaseAdapter
|
|
|
326
334
|
holdId = this.requiresHolds ? await this.baseDB.markHold() : null;
|
|
327
335
|
return await callback();
|
|
328
336
|
} catch (ex) {
|
|
329
|
-
if (ex
|
|
337
|
+
if (ConnectionClosedError.MATCHES(ex)) {
|
|
330
338
|
if (this.options.reOpenOnConnectionClosed && !this.databaseOpenPromise && !this.closing) {
|
|
331
339
|
// Immediately re-open the database. We need to miss as little table updates as possible.
|
|
332
340
|
// Note, don't await this since it uses the same lock as we're in now.
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { BaseObserver } from '@powersync/common';
|
|
1
|
+
import { BaseObserver, ConnectionClosedError } from '@powersync/common';
|
|
2
2
|
import * as Comlink from 'comlink';
|
|
3
3
|
import {
|
|
4
4
|
AsyncDatabaseConnection,
|
|
5
|
-
ConnectionClosedError,
|
|
6
5
|
OnTableChangeCallback,
|
|
7
6
|
OpenAsyncDatabaseConnection,
|
|
8
7
|
ProxiedQueryResult
|
|
9
|
-
} from './AsyncDatabaseConnection';
|
|
10
|
-
import { ResolvedWebSQLOpenOptions } from './web-sql-flags';
|
|
8
|
+
} from './AsyncDatabaseConnection.js';
|
|
9
|
+
import { ResolvedWebSQLOpenOptions } from './web-sql-flags.js';
|
|
11
10
|
|
|
12
11
|
export type SharedConnectionWorker = {
|
|
13
12
|
identifier: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as SQLite from '@journeyapps/wa-sqlite';
|
|
2
2
|
import { BaseObserver, BatchedUpdateNotification } from '@powersync/common';
|
|
3
3
|
import { Mutex } from 'async-mutex';
|
|
4
|
-
import { AsyncDatabaseConnection, OnTableChangeCallback, ProxiedQueryResult } from '../AsyncDatabaseConnection';
|
|
5
|
-
import { ResolvedWASQLiteOpenFactoryOptions } from './WASQLiteOpenFactory';
|
|
4
|
+
import { AsyncDatabaseConnection, OnTableChangeCallback, ProxiedQueryResult } from '../AsyncDatabaseConnection.js';
|
|
5
|
+
import { ResolvedWASQLiteOpenFactoryOptions } from './WASQLiteOpenFactory.js';
|
|
6
6
|
/**
|
|
7
7
|
* List of currently tested virtual filesystems
|
|
8
8
|
*/
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { type PowerSyncOpenFactoryOptions } from '@powersync/common';
|
|
2
2
|
import * as Comlink from 'comlink';
|
|
3
|
-
import { resolveWebPowerSyncFlags } from '../../PowerSyncDatabase';
|
|
4
|
-
import { OpenAsyncDatabaseConnection } from '../AsyncDatabaseConnection';
|
|
5
|
-
import { LockedAsyncDatabaseAdapter } from '../LockedAsyncDatabaseAdapter';
|
|
3
|
+
import { resolveWebPowerSyncFlags } from '../../PowerSyncDatabase.js';
|
|
4
|
+
import { OpenAsyncDatabaseConnection } from '../AsyncDatabaseConnection.js';
|
|
5
|
+
import { LockedAsyncDatabaseAdapter } from '../LockedAsyncDatabaseAdapter.js';
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_CACHE_SIZE_KB,
|
|
8
8
|
ResolvedWebSQLOpenOptions,
|
|
9
9
|
TemporaryStorageOption,
|
|
10
10
|
WebSQLFlags
|
|
11
|
-
} from '../web-sql-flags';
|
|
12
|
-
import { WorkerWrappedAsyncDatabaseConnection } from '../WorkerWrappedAsyncDatabaseConnection';
|
|
13
|
-
import { WASQLiteVFS } from './WASQLiteConnection';
|
|
14
|
-
import { WASQLiteOpenFactory } from './WASQLiteOpenFactory';
|
|
11
|
+
} from '../web-sql-flags.js';
|
|
12
|
+
import { WorkerWrappedAsyncDatabaseConnection } from '../WorkerWrappedAsyncDatabaseConnection.js';
|
|
13
|
+
import { WASQLiteVFS } from './WASQLiteConnection.js';
|
|
14
|
+
import { WASQLiteOpenFactory } from './WASQLiteOpenFactory.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* These flags are the same as {@link WebSQLFlags}.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { DBAdapter, type ILogLevel } from '@powersync/common';
|
|
2
2
|
import * as Comlink from 'comlink';
|
|
3
|
-
import { openWorkerDatabasePort, resolveWorkerDatabasePortFactory } from '../../../worker/db/open-worker-database';
|
|
4
|
-
import { AbstractWebSQLOpenFactory } from '../AbstractWebSQLOpenFactory';
|
|
5
|
-
import { AsyncDatabaseConnection, OpenAsyncDatabaseConnection } from '../AsyncDatabaseConnection';
|
|
6
|
-
import { LockedAsyncDatabaseAdapter } from '../LockedAsyncDatabaseAdapter';
|
|
7
|
-
import { WorkerWrappedAsyncDatabaseConnection } from '../WorkerWrappedAsyncDatabaseConnection';
|
|
3
|
+
import { openWorkerDatabasePort, resolveWorkerDatabasePortFactory } from '../../../worker/db/open-worker-database.js';
|
|
4
|
+
import { AbstractWebSQLOpenFactory } from '../AbstractWebSQLOpenFactory.js';
|
|
5
|
+
import { AsyncDatabaseConnection, OpenAsyncDatabaseConnection } from '../AsyncDatabaseConnection.js';
|
|
6
|
+
import { LockedAsyncDatabaseAdapter } from '../LockedAsyncDatabaseAdapter.js';
|
|
7
|
+
import { WorkerWrappedAsyncDatabaseConnection } from '../WorkerWrappedAsyncDatabaseConnection.js';
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_CACHE_SIZE_KB,
|
|
10
10
|
ResolvedWebSQLOpenOptions,
|
|
11
11
|
TemporaryStorageOption,
|
|
12
12
|
WebSQLOpenFactoryOptions
|
|
13
|
-
} from '../web-sql-flags';
|
|
14
|
-
import { WASQLiteVFS, WASqliteConnection } from './WASQLiteConnection';
|
|
13
|
+
} from '../web-sql-flags.js';
|
|
14
|
+
import { WASQLiteVFS, WASqliteConnection } from './WASQLiteConnection.js';
|
|
15
15
|
|
|
16
16
|
export interface WASQLiteOpenFactoryOptions extends WebSQLOpenFactoryOptions {
|
|
17
17
|
vfs?: WASQLiteVFS;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractPowerSyncDatabase, DBAdapter, PowerSyncDatabaseOptions } from '@powersync/common';
|
|
2
|
-
import { PowerSyncDatabase } from '../../../db/PowerSyncDatabase';
|
|
3
|
-
import { AbstractWebPowerSyncDatabaseOpenFactory } from '../AbstractWebPowerSyncDatabaseOpenFactory';
|
|
4
|
-
import { WASQLiteOpenFactory } from './WASQLiteOpenFactory';
|
|
2
|
+
import { PowerSyncDatabase } from '../../../db/PowerSyncDatabase.js';
|
|
3
|
+
import { AbstractWebPowerSyncDatabaseOpenFactory } from '../AbstractWebPowerSyncDatabaseOpenFactory.js';
|
|
4
|
+
import { WASQLiteOpenFactory } from './WASQLiteOpenFactory.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated {@link PowerSyncDatabase} can now be constructed directly
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
SyncStatusOptions
|
|
6
6
|
} from '@powersync/common';
|
|
7
7
|
import * as Comlink from 'comlink';
|
|
8
|
-
import { getNavigatorLocks } from '../../shared/navigator';
|
|
9
|
-
import { AbstractSharedSyncClientProvider } from '../../worker/sync/AbstractSharedSyncClientProvider';
|
|
10
|
-
import { ManualSharedSyncPayload, SharedSyncClientEvent } from '../../worker/sync/SharedSyncImplementation';
|
|
11
|
-
import { WorkerClient } from '../../worker/sync/WorkerClient';
|
|
12
|
-
import { WebDBAdapter } from '../adapters/WebDBAdapter';
|
|
13
|
-
import { DEFAULT_CACHE_SIZE_KB, TemporaryStorageOption, resolveWebSQLFlags } from '../adapters/web-sql-flags';
|
|
8
|
+
import { getNavigatorLocks } from '../../shared/navigator.js';
|
|
9
|
+
import { AbstractSharedSyncClientProvider } from '../../worker/sync/AbstractSharedSyncClientProvider.js';
|
|
10
|
+
import { ManualSharedSyncPayload, SharedSyncClientEvent } from '../../worker/sync/SharedSyncImplementation.js';
|
|
11
|
+
import { WorkerClient } from '../../worker/sync/WorkerClient.js';
|
|
12
|
+
import { WebDBAdapter } from '../adapters/WebDBAdapter.js';
|
|
13
|
+
import { DEFAULT_CACHE_SIZE_KB, TemporaryStorageOption, resolveWebSQLFlags } from '../adapters/web-sql-flags.js';
|
|
14
14
|
import {
|
|
15
15
|
WebStreamingSyncImplementation,
|
|
16
16
|
WebStreamingSyncImplementationOptions
|
|
17
|
-
} from './WebStreamingSyncImplementation';
|
|
17
|
+
} from './WebStreamingSyncImplementation.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* The shared worker will trigger methods on this side of the message port
|
package/src/db/sync/WebRemote.ts
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
LockOptions,
|
|
5
5
|
LockType
|
|
6
6
|
} from '@powersync/common';
|
|
7
|
-
import { getNavigatorLocks } from '../../shared/navigator';
|
|
8
|
-
import { ResolvedWebSQLOpenOptions, WebSQLFlags } from '../adapters/web-sql-flags';
|
|
7
|
+
import { getNavigatorLocks } from '../../shared/navigator.js';
|
|
8
|
+
import { ResolvedWebSQLOpenOptions, WebSQLFlags } from '../adapters/web-sql-flags.js';
|
|
9
9
|
|
|
10
10
|
export interface WebStreamingSyncImplementationOptions extends AbstractStreamingSyncImplementationOptions {
|
|
11
11
|
flags?: WebSQLFlags;
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export * from '@powersync/common';
|
|
2
|
-
export * from './db/adapters/
|
|
3
|
-
export * from './db/adapters/
|
|
4
|
-
export * from './db/adapters/
|
|
5
|
-
export * from './db/adapters/wa-sqlite/WASQLiteConnection';
|
|
6
|
-
export * from './db/adapters/wa-sqlite/WASQLiteDBAdapter';
|
|
7
|
-
export * from './db/adapters/wa-sqlite/WASQLiteOpenFactory';
|
|
8
|
-
export * from './db/adapters/wa-sqlite/WASQLitePowerSyncDatabaseOpenFactory';
|
|
9
|
-
export * from './db/adapters/web-sql-flags';
|
|
10
|
-
export * from './db/PowerSyncDatabase';
|
|
11
|
-
export * from './db/sync/SharedWebStreamingSyncImplementation';
|
|
12
|
-
export * from './db/sync/WebRemote';
|
|
13
|
-
export * from './db/sync/WebStreamingSyncImplementation';
|
|
2
|
+
export * from './db/adapters/AbstractWebPowerSyncDatabaseOpenFactory.js';
|
|
3
|
+
export * from './db/adapters/AbstractWebSQLOpenFactory.js';
|
|
4
|
+
export * from './db/adapters/AsyncDatabaseConnection.js';
|
|
5
|
+
export * from './db/adapters/wa-sqlite/WASQLiteConnection.js';
|
|
6
|
+
export * from './db/adapters/wa-sqlite/WASQLiteDBAdapter.js';
|
|
7
|
+
export * from './db/adapters/wa-sqlite/WASQLiteOpenFactory.js';
|
|
8
|
+
export * from './db/adapters/wa-sqlite/WASQLitePowerSyncDatabaseOpenFactory.js';
|
|
9
|
+
export * from './db/adapters/web-sql-flags.js';
|
|
10
|
+
export * from './db/PowerSyncDatabase.js';
|
|
11
|
+
export * from './db/sync/SharedWebStreamingSyncImplementation.js';
|
|
12
|
+
export * from './db/sync/WebRemote.js';
|
|
13
|
+
export * from './db/sync/WebStreamingSyncImplementation.js';
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
AsyncDatabaseConnection,
|
|
4
4
|
OnTableChangeCallback,
|
|
5
5
|
ProxiedQueryResult
|
|
6
|
-
} from '../../db/adapters/AsyncDatabaseConnection';
|
|
7
|
-
import { ResolvedWebSQLOpenOptions } from '../../db/adapters/web-sql-flags';
|
|
6
|
+
} from '../../db/adapters/AsyncDatabaseConnection.js';
|
|
7
|
+
import { ResolvedWebSQLOpenOptions } from '../../db/adapters/web-sql-flags.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Keeps track of open DB connections and the clients which
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import '@journeyapps/wa-sqlite';
|
|
6
6
|
import { createBaseLogger, createLogger } from '@powersync/common';
|
|
7
7
|
import * as Comlink from 'comlink';
|
|
8
|
-
import { AsyncDatabaseConnection } from '../../db/adapters/AsyncDatabaseConnection';
|
|
9
|
-
import { WorkerDBOpenerOptions } from '../../db/adapters/wa-sqlite/WASQLiteOpenFactory';
|
|
10
|
-
import { getNavigatorLocks } from '../../shared/navigator';
|
|
11
|
-
import { SharedDBWorkerConnection, SharedWASQLiteConnection } from './SharedWASQLiteConnection';
|
|
12
|
-
import { WorkerWASQLiteConnection } from './WorkerWASQLiteConnection';
|
|
8
|
+
import { AsyncDatabaseConnection } from '../../db/adapters/AsyncDatabaseConnection.js';
|
|
9
|
+
import { WorkerDBOpenerOptions } from '../../db/adapters/wa-sqlite/WASQLiteOpenFactory.js';
|
|
10
|
+
import { getNavigatorLocks } from '../../shared/navigator.js';
|
|
11
|
+
import { SharedDBWorkerConnection, SharedWASQLiteConnection } from './SharedWASQLiteConnection.js';
|
|
12
|
+
import { WorkerWASQLiteConnection } from './WorkerWASQLiteConnection.js';
|
|
13
13
|
|
|
14
14
|
const baseLogger = createBaseLogger();
|
|
15
15
|
baseLogger.useDefaults();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Comlink from 'comlink';
|
|
2
|
-
import { OnTableChangeCallback } from '../../db/adapters/AsyncDatabaseConnection';
|
|
3
|
-
import { WASqliteConnection } from '../../db/adapters/wa-sqlite/WASQLiteConnection';
|
|
2
|
+
import { OnTableChangeCallback } from '../../db/adapters/AsyncDatabaseConnection.js';
|
|
3
|
+
import { WASqliteConnection } from '../../db/adapters/wa-sqlite/WASQLiteConnection.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A Small proxy wrapper around the WASqliteConnection.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Comlink from 'comlink';
|
|
2
|
-
import { OpenAsyncDatabaseConnection } from '
|
|
3
|
-
import { WASQLiteVFS } from '../../db/adapters/wa-sqlite/WASQLiteConnection';
|
|
2
|
+
import { OpenAsyncDatabaseConnection } from '../../db/adapters/AsyncDatabaseConnection.js';
|
|
3
|
+
import { WASQLiteVFS } from '../../db/adapters/wa-sqlite/WASQLiteConnection.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Opens a shared or dedicated worker which exposes opening of database connections
|
|
@@ -17,18 +17,18 @@ import {
|
|
|
17
17
|
} from '@powersync/common';
|
|
18
18
|
import { Mutex } from 'async-mutex';
|
|
19
19
|
import * as Comlink from 'comlink';
|
|
20
|
-
import { WebRemote } from '../../db/sync/WebRemote';
|
|
20
|
+
import { WebRemote } from '../../db/sync/WebRemote.js';
|
|
21
21
|
import {
|
|
22
22
|
WebStreamingSyncImplementation,
|
|
23
23
|
WebStreamingSyncImplementationOptions
|
|
24
|
-
} from '../../db/sync/WebStreamingSyncImplementation';
|
|
24
|
+
} from '../../db/sync/WebStreamingSyncImplementation.js';
|
|
25
25
|
|
|
26
|
-
import { OpenAsyncDatabaseConnection } from '../../db/adapters/AsyncDatabaseConnection';
|
|
27
|
-
import { LockedAsyncDatabaseAdapter } from '../../db/adapters/LockedAsyncDatabaseAdapter';
|
|
28
|
-
import { WorkerWrappedAsyncDatabaseConnection } from '../../db/adapters/WorkerWrappedAsyncDatabaseConnection';
|
|
29
|
-
import { ResolvedWebSQLOpenOptions } from '../../db/adapters/web-sql-flags';
|
|
30
|
-
import { AbstractSharedSyncClientProvider } from './AbstractSharedSyncClientProvider';
|
|
31
|
-
import { BroadcastLogger } from './BroadcastLogger';
|
|
26
|
+
import { OpenAsyncDatabaseConnection } from '../../db/adapters/AsyncDatabaseConnection.js';
|
|
27
|
+
import { LockedAsyncDatabaseAdapter } from '../../db/adapters/LockedAsyncDatabaseAdapter.js';
|
|
28
|
+
import { WorkerWrappedAsyncDatabaseConnection } from '../../db/adapters/WorkerWrappedAsyncDatabaseConnection.js';
|
|
29
|
+
import { ResolvedWebSQLOpenOptions } from '../../db/adapters/web-sql-flags.js';
|
|
30
|
+
import { AbstractSharedSyncClientProvider } from './AbstractSharedSyncClientProvider.js';
|
|
31
|
+
import { BroadcastLogger } from './BroadcastLogger.js';
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* @internal
|
|
@@ -277,6 +277,15 @@ export class SharedSyncImplementation extends BaseObserver<SharedSyncImplementat
|
|
|
277
277
|
// We may have missed some table updates while the database was closed.
|
|
278
278
|
// We can poke the crud in case we missed any updates.
|
|
279
279
|
this.connectionManager.syncStreamImplementation?.triggerCrudUpload();
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* FIXME or IMPROVE ME
|
|
283
|
+
* The Rust client implementation stores sync state on the connection level.
|
|
284
|
+
* Reopening the database causes a state machine error which should cause the
|
|
285
|
+
* StreamingSyncImplementation to reconnect. It would be nicer if we could trigger
|
|
286
|
+
* this reconnect earlier.
|
|
287
|
+
* This reconnect is not required for IndexedDB.
|
|
288
|
+
*/
|
|
280
289
|
}
|
|
281
290
|
});
|
|
282
291
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createBaseLogger } from '@powersync/common';
|
|
2
|
-
import { SharedSyncImplementation } from './SharedSyncImplementation';
|
|
3
|
-
import { WorkerClient } from './WorkerClient';
|
|
2
|
+
import { SharedSyncImplementation } from './SharedSyncImplementation.js';
|
|
3
|
+
import { WorkerClient } from './WorkerClient.js';
|
|
4
4
|
|
|
5
5
|
const _self: SharedWorkerGlobalScope = self as any;
|
|
6
6
|
const logger = createBaseLogger();
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ILogLevel, PowerSyncConnectionOptions, SubscribedStream } from '@powersync/common';
|
|
2
2
|
import * as Comlink from 'comlink';
|
|
3
|
-
import { getNavigatorLocks } from '../../shared/navigator';
|
|
3
|
+
import { getNavigatorLocks } from '../../shared/navigator.js';
|
|
4
4
|
import {
|
|
5
5
|
ManualSharedSyncPayload,
|
|
6
6
|
SharedSyncClientEvent,
|
|
7
7
|
SharedSyncImplementation,
|
|
8
8
|
SharedSyncInitOptions,
|
|
9
9
|
WrappedSyncPort
|
|
10
|
-
} from './SharedSyncImplementation';
|
|
10
|
+
} from './SharedSyncImplementation.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* A client to the shared sync worker.
|
|
File without changes
|