@powersync/web 0.0.0-dev-20260311103504 → 0.0.0-dev-20260503073249
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/dist/2075a31bb151adbb9767.wasm +0 -0
- package/dist/3322bc84de986b63c2cd.wasm +0 -0
- package/dist/8e97452e297be23b5e50.wasm +0 -0
- package/dist/fbc178b70d530e8ce02b.wasm +0 -0
- package/dist/index.umd.js +5341 -1279
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +1113 -3526
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +1397 -1332
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-9af0a7.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-9af0a7.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-bbf5a9.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-bbf5a9.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-c26e0f.umd.js +31 -0
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-cc5fcc.umd.js.map → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-c26e0f.umd.js.map} +1 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +31 -0
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map} +1 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-2fb422.umd.js +3562 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-2fb422.umd.js.map +1 -0
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-0df390.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-96fb23.umd.js} +16 -16
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-0df390.umd.js.map → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-96fb23.umd.js.map} +1 -1
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-151024.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-c89911.umd.js} +12 -12
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-151024.umd.js.map → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-c89911.umd.js.map} +1 -1
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-c01ef0.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-ec4eb1.umd.js} +14 -14
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-c01ef0.umd.js.map → node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-ec4eb1.umd.js.map} +1 -1
- package/lib/package.json +4 -5
- package/lib/src/db/PowerSyncDatabase.d.ts +2 -3
- package/lib/src/db/PowerSyncDatabase.js +3 -12
- package/lib/src/db/adapters/AsyncWebAdapter.d.ts +50 -0
- package/lib/src/db/adapters/AsyncWebAdapter.js +163 -0
- package/lib/src/db/adapters/SSRDBAdapter.d.ts +1 -2
- package/lib/src/db/adapters/SSRDBAdapter.js +5 -6
- package/lib/src/db/adapters/wa-sqlite/ConcurrentConnection.d.ts +56 -0
- package/lib/src/db/adapters/wa-sqlite/ConcurrentConnection.js +121 -0
- package/lib/src/db/adapters/wa-sqlite/DatabaseClient.d.ts +54 -0
- package/lib/src/db/adapters/wa-sqlite/DatabaseClient.js +227 -0
- package/lib/src/db/adapters/wa-sqlite/DatabaseServer.d.ts +47 -0
- package/lib/src/db/adapters/wa-sqlite/DatabaseServer.js +145 -0
- package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.d.ts +46 -0
- package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.js +147 -0
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.d.ts +28 -6
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +104 -55
- package/lib/src/db/adapters/wa-sqlite/vfs.d.ts +50 -0
- package/lib/src/db/adapters/wa-sqlite/vfs.js +76 -0
- package/lib/src/db/adapters/web-sql-flags.d.ts +5 -0
- package/lib/src/db/sync/SSRWebStreamingSyncImplementation.d.ts +5 -2
- package/lib/src/db/sync/SSRWebStreamingSyncImplementation.js +6 -3
- package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +4 -19
- package/lib/src/index.d.ts +1 -4
- package/lib/src/index.js +1 -4
- package/lib/src/shared/tab_close_signal.d.ts +11 -0
- package/lib/src/shared/tab_close_signal.js +26 -0
- package/lib/src/worker/db/MultiDatabaseServer.d.ts +17 -0
- package/lib/src/worker/db/MultiDatabaseServer.js +89 -0
- package/lib/src/worker/db/WASQLiteDB.worker.js +9 -48
- package/lib/src/worker/db/open-worker-database.d.ts +3 -3
- package/lib/src/worker/db/open-worker-database.js +2 -2
- package/lib/src/worker/sync/SharedSyncImplementation.d.ts +5 -6
- package/lib/src/worker/sync/SharedSyncImplementation.js +88 -54
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -6
- package/src/db/PowerSyncDatabase.ts +4 -12
- package/src/db/adapters/AsyncWebAdapter.ts +207 -0
- package/src/db/adapters/SSRDBAdapter.ts +7 -7
- package/src/db/adapters/wa-sqlite/ConcurrentConnection.ts +137 -0
- package/src/db/adapters/wa-sqlite/DatabaseClient.ts +325 -0
- package/src/db/adapters/wa-sqlite/DatabaseServer.ts +203 -0
- package/src/db/adapters/wa-sqlite/RawSqliteConnection.ts +194 -0
- package/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts +152 -63
- package/src/db/adapters/wa-sqlite/vfs.ts +96 -0
- package/src/db/adapters/web-sql-flags.ts +6 -0
- package/src/db/sync/SSRWebStreamingSyncImplementation.ts +7 -3
- package/src/db/sync/SharedWebStreamingSyncImplementation.ts +4 -20
- package/src/index.ts +1 -4
- package/src/shared/tab_close_signal.ts +28 -0
- package/src/worker/db/MultiDatabaseServer.ts +107 -0
- package/src/worker/db/WASQLiteDB.worker.ts +10 -57
- package/src/worker/db/open-worker-database.ts +4 -4
- package/src/worker/sync/SharedSyncImplementation.ts +114 -58
- package/dist/26d61ca9f5694d064635.wasm +0 -0
- package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js +0 -1878
- package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js.map +0 -1
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-97ebe9.index.umd.js +0 -555
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-97ebe9.index.umd.js.map +0 -1
- package/dist/b4c6283dc473b6b3fd24.wasm +0 -0
- package/dist/c78985091a0b22aaef03.wasm +0 -0
- package/dist/ca59e199e1138b553fad.wasm +0 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-b9c070.umd.js +0 -31
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-b9c070.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-c99c07.umd.js +0 -31
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-c99c07.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-cc5fcc.umd.js +0 -31
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +0 -31
- package/lib/src/db/adapters/AbstractWebSQLOpenFactory.d.ts +0 -17
- package/lib/src/db/adapters/AbstractWebSQLOpenFactory.js +0 -33
- package/lib/src/db/adapters/AsyncDatabaseConnection.d.ts +0 -49
- package/lib/src/db/adapters/AsyncDatabaseConnection.js +0 -1
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.d.ts +0 -109
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.js +0 -401
- package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.d.ts +0 -59
- package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js +0 -147
- package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.d.ts +0 -12
- package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.js +0 -19
- package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.d.ts +0 -155
- package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js +0 -401
- package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.d.ts +0 -32
- package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.js +0 -49
- package/lib/src/worker/db/SharedWASQLiteConnection.d.ts +0 -42
- package/lib/src/worker/db/SharedWASQLiteConnection.js +0 -90
- package/lib/src/worker/db/WorkerWASQLiteConnection.d.ts +0 -9
- package/lib/src/worker/db/WorkerWASQLiteConnection.js +0 -12
- package/src/db/adapters/AbstractWebSQLOpenFactory.ts +0 -48
- package/src/db/adapters/AsyncDatabaseConnection.ts +0 -55
- package/src/db/adapters/LockedAsyncDatabaseAdapter.ts +0 -490
- package/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.ts +0 -201
- package/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.ts +0 -23
- package/src/db/adapters/wa-sqlite/WASQLiteConnection.ts +0 -497
- package/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts +0 -86
- package/src/worker/db/SharedWASQLiteConnection.ts +0 -131
- package/src/worker/db/WorkerWASQLiteConnection.ts +0 -14
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
import { BaseObserver, ConnectionClosedError, createLogger } from '@powersync/common';
|
|
2
|
-
import { getNavigatorLocks } from '../../shared/navigator.js';
|
|
3
|
-
import { WorkerWrappedAsyncDatabaseConnection } from './WorkerWrappedAsyncDatabaseConnection.js';
|
|
4
|
-
import { WASQLiteVFS } from './wa-sqlite/WASQLiteConnection.js';
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
* Wraps a {@link AsyncDatabaseConnection} and provides exclusive locking functions in
|
|
8
|
-
* order to implement {@link DBAdapter}.
|
|
9
|
-
*/
|
|
10
|
-
export class LockedAsyncDatabaseAdapter extends BaseObserver {
|
|
11
|
-
options;
|
|
12
|
-
logger;
|
|
13
|
-
dbGetHelpers;
|
|
14
|
-
debugMode;
|
|
15
|
-
_dbIdentifier;
|
|
16
|
-
initPromise;
|
|
17
|
-
_db = null;
|
|
18
|
-
_disposeTableChangeListener = null;
|
|
19
|
-
_config = null;
|
|
20
|
-
pendingAbortControllers;
|
|
21
|
-
requiresHolds;
|
|
22
|
-
databaseOpenPromise = null;
|
|
23
|
-
closing;
|
|
24
|
-
closed;
|
|
25
|
-
constructor(options) {
|
|
26
|
-
super();
|
|
27
|
-
this.options = options;
|
|
28
|
-
this._dbIdentifier = options.name;
|
|
29
|
-
this.logger = options.logger ?? createLogger(`LockedAsyncDatabaseAdapter - ${this._dbIdentifier}`);
|
|
30
|
-
this.pendingAbortControllers = new Set();
|
|
31
|
-
this.closed = false;
|
|
32
|
-
this.closing = false;
|
|
33
|
-
this.requiresHolds = null;
|
|
34
|
-
// Set the name if provided. We can query for the name if not available yet
|
|
35
|
-
this.debugMode = options.debugMode ?? false;
|
|
36
|
-
if (this.debugMode) {
|
|
37
|
-
const originalExecute = this._execute.bind(this);
|
|
38
|
-
this._execute = async (sql, bindings) => {
|
|
39
|
-
const start = performance.now();
|
|
40
|
-
try {
|
|
41
|
-
const r = await originalExecute(sql, bindings);
|
|
42
|
-
performance.measure(`[SQL] ${sql}`, { start });
|
|
43
|
-
return r;
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
performance.measure(`[SQL] [ERROR: ${e.message}] ${sql}`, { start });
|
|
47
|
-
throw e;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
this.dbGetHelpers = this.generateDBHelpers({
|
|
52
|
-
execute: (query, params) => this.acquireLock(() => this._execute(query, params)),
|
|
53
|
-
executeRaw: (query, params) => this.acquireLock(() => this._executeRaw(query, params))
|
|
54
|
-
});
|
|
55
|
-
this.initPromise = this._init();
|
|
56
|
-
}
|
|
57
|
-
get baseDB() {
|
|
58
|
-
if (!this._db) {
|
|
59
|
-
throw new Error(`Initialization has not completed yet. Cannot access base db`);
|
|
60
|
-
}
|
|
61
|
-
return this._db;
|
|
62
|
-
}
|
|
63
|
-
get name() {
|
|
64
|
-
return this._dbIdentifier;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Init is automatic, this helps catch errors or explicitly await initialization
|
|
68
|
-
*/
|
|
69
|
-
async init() {
|
|
70
|
-
return this.initPromise;
|
|
71
|
-
}
|
|
72
|
-
async openInternalDB() {
|
|
73
|
-
/**
|
|
74
|
-
* Execute opening of the db in a lock in order not to interfere with other operations.
|
|
75
|
-
*/
|
|
76
|
-
return this._acquireLock(async () => {
|
|
77
|
-
// Dispose any previous table change listener.
|
|
78
|
-
this._disposeTableChangeListener?.();
|
|
79
|
-
this._disposeTableChangeListener = null;
|
|
80
|
-
this._db?.close().catch((ex) => this.logger.warn(`Error closing database before opening new instance`, ex));
|
|
81
|
-
const isReOpen = !!this._db;
|
|
82
|
-
this._db = null;
|
|
83
|
-
this._db = await this.options.openConnection();
|
|
84
|
-
await this._db.init();
|
|
85
|
-
this._config = await this._db.getConfig();
|
|
86
|
-
await this.registerOnChangeListener(this._db);
|
|
87
|
-
if (isReOpen) {
|
|
88
|
-
this.iterateListeners((cb) => cb.databaseReOpened?.());
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* This is only required for the long-lived shared IndexedDB connections.
|
|
92
|
-
*/
|
|
93
|
-
this.requiresHolds = this._config.vfs == WASQLiteVFS.IDBBatchAtomicVFS;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
_reOpen() {
|
|
97
|
-
this.databaseOpenPromise = this.openInternalDB().finally(() => {
|
|
98
|
-
this.databaseOpenPromise = null;
|
|
99
|
-
});
|
|
100
|
-
return this.databaseOpenPromise;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Re-opens the underlying database.
|
|
104
|
-
* Returns a pending operation if one is already in progress.
|
|
105
|
-
*/
|
|
106
|
-
async reOpenInternalDB() {
|
|
107
|
-
if (this.closing || !this.options.reOpenOnConnectionClosed) {
|
|
108
|
-
// No-op
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
else if (this.databaseOpenPromise) {
|
|
112
|
-
// Already busy opening
|
|
113
|
-
return this.databaseOpenPromise;
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
return this._reOpen();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
async _init() {
|
|
120
|
-
/**
|
|
121
|
-
* For OPFS, we can see this open call sometimes fail due to NoModificationAllowedError.
|
|
122
|
-
* We should be able to recover from this by re-opening the database.
|
|
123
|
-
*/
|
|
124
|
-
const maxAttempts = 3;
|
|
125
|
-
for (let count = 0; count < maxAttempts; count++) {
|
|
126
|
-
try {
|
|
127
|
-
await this.openInternalDB();
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
catch (ex) {
|
|
131
|
-
if (count == maxAttempts - 1) {
|
|
132
|
-
throw ex;
|
|
133
|
-
}
|
|
134
|
-
this.logger.warn(`Attempt ${count + 1} of ${maxAttempts} to open database failed, retrying in 1 second...`, ex);
|
|
135
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
this.iterateListeners((cb) => cb.initialized?.());
|
|
139
|
-
}
|
|
140
|
-
getConfiguration() {
|
|
141
|
-
if (!this._config) {
|
|
142
|
-
throw new Error(`Cannot get config before initialization is completed`);
|
|
143
|
-
}
|
|
144
|
-
return {
|
|
145
|
-
...this._config,
|
|
146
|
-
// This can be overridden by the adapter later
|
|
147
|
-
requiresPersistentTriggers: false
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
async waitForInitialized() {
|
|
151
|
-
// Awaiting this will expose errors on function calls like .execute etc
|
|
152
|
-
await this.initPromise;
|
|
153
|
-
}
|
|
154
|
-
async shareConnection() {
|
|
155
|
-
if (false == this._db instanceof WorkerWrappedAsyncDatabaseConnection) {
|
|
156
|
-
throw new Error(`Only worker connections can be shared`);
|
|
157
|
-
}
|
|
158
|
-
return this._db.shareConnection();
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Registers a table change notification callback with the base database.
|
|
162
|
-
* This can be extended by custom implementations in order to handle proxy events.
|
|
163
|
-
*/
|
|
164
|
-
async registerOnChangeListener(db) {
|
|
165
|
-
this._disposeTableChangeListener = await db.registerOnTableChange((event) => {
|
|
166
|
-
this.iterateListeners((cb) => cb.tablesUpdated?.(event));
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* This is currently a no-op on web
|
|
171
|
-
*/
|
|
172
|
-
async refreshSchema() { }
|
|
173
|
-
async execute(query, params) {
|
|
174
|
-
return this.writeLock((ctx) => ctx.execute(query, params));
|
|
175
|
-
}
|
|
176
|
-
async executeRaw(query, params) {
|
|
177
|
-
return this.writeLock((ctx) => ctx.executeRaw(query, params));
|
|
178
|
-
}
|
|
179
|
-
async executeBatch(query, params) {
|
|
180
|
-
return this.writeLock((ctx) => this._executeBatch(query, params));
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Attempts to close the connection.
|
|
184
|
-
* Shared workers might not actually close the connection if other
|
|
185
|
-
* tabs are still using it.
|
|
186
|
-
*/
|
|
187
|
-
async close() {
|
|
188
|
-
this.closing = true;
|
|
189
|
-
/**
|
|
190
|
-
* Note that we obtain a reference to the callback to avoid calling the callback with `this` as the context.
|
|
191
|
-
* This is to avoid Comlink attempting to clone `this` when calling the method.
|
|
192
|
-
*/
|
|
193
|
-
const dispose = this._disposeTableChangeListener;
|
|
194
|
-
if (dispose) {
|
|
195
|
-
dispose();
|
|
196
|
-
}
|
|
197
|
-
this.pendingAbortControllers.forEach((controller) => controller.abort('Closed'));
|
|
198
|
-
await this.baseDB?.close?.();
|
|
199
|
-
this.closed = true;
|
|
200
|
-
}
|
|
201
|
-
async getAll(sql, parameters) {
|
|
202
|
-
await this.waitForInitialized();
|
|
203
|
-
return this.dbGetHelpers.getAll(sql, parameters);
|
|
204
|
-
}
|
|
205
|
-
async getOptional(sql, parameters) {
|
|
206
|
-
await this.waitForInitialized();
|
|
207
|
-
return this.dbGetHelpers.getOptional(sql, parameters);
|
|
208
|
-
}
|
|
209
|
-
async get(sql, parameters) {
|
|
210
|
-
await this.waitForInitialized();
|
|
211
|
-
return this.dbGetHelpers.get(sql, parameters);
|
|
212
|
-
}
|
|
213
|
-
async readLock(fn, options) {
|
|
214
|
-
await this.waitForInitialized();
|
|
215
|
-
return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })), {
|
|
216
|
-
timeoutMs: options?.timeoutMs ?? this.options.defaultLockTimeoutMs
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
async writeLock(fn, options) {
|
|
220
|
-
await this.waitForInitialized();
|
|
221
|
-
return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })), {
|
|
222
|
-
timeoutMs: options?.timeoutMs ?? this.options.defaultLockTimeoutMs
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
async _acquireLock(callback, options) {
|
|
226
|
-
if (this.closing) {
|
|
227
|
-
throw new Error(`Cannot acquire lock, the database is closing`);
|
|
228
|
-
}
|
|
229
|
-
const abortController = new AbortController();
|
|
230
|
-
this.pendingAbortControllers.add(abortController);
|
|
231
|
-
const { timeoutMs } = options ?? {};
|
|
232
|
-
const timeoutId = timeoutMs
|
|
233
|
-
? setTimeout(() => {
|
|
234
|
-
abortController.abort(`Timeout after ${timeoutMs}ms`);
|
|
235
|
-
this.pendingAbortControllers.delete(abortController);
|
|
236
|
-
}, timeoutMs)
|
|
237
|
-
: null;
|
|
238
|
-
return getNavigatorLocks().request(`db-lock-${this._dbIdentifier}`, { signal: abortController.signal }, async () => {
|
|
239
|
-
this.pendingAbortControllers.delete(abortController);
|
|
240
|
-
if (timeoutId) {
|
|
241
|
-
clearTimeout(timeoutId);
|
|
242
|
-
}
|
|
243
|
-
return await callback();
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
async acquireLock(callback, options) {
|
|
247
|
-
await this.waitForInitialized();
|
|
248
|
-
// The database is being (re)opened in the background. Wait for it here.
|
|
249
|
-
if (this.databaseOpenPromise) {
|
|
250
|
-
await this.databaseOpenPromise;
|
|
251
|
-
}
|
|
252
|
-
else if (!this._db) {
|
|
253
|
-
/**
|
|
254
|
-
* The database is not open anymore, we might need to re-open it.
|
|
255
|
-
* Typically, _db, can be `null` if we tried to reOpen the database, but failed to succeed in re-opening.
|
|
256
|
-
* This can happen when disconnecting the client.
|
|
257
|
-
* Note: It is safe to re-enter this method multiple times.
|
|
258
|
-
*/
|
|
259
|
-
await this.reOpenInternalDB();
|
|
260
|
-
}
|
|
261
|
-
return this._acquireLock(async () => {
|
|
262
|
-
let holdId = null;
|
|
263
|
-
try {
|
|
264
|
-
/**
|
|
265
|
-
* We can't await this since it uses the same lock as we're in now.
|
|
266
|
-
* If there is a pending open, this call will throw.
|
|
267
|
-
* If there is no pending open, but there is also no database - the open
|
|
268
|
-
* might have failed. We need to re-open the database.
|
|
269
|
-
*/
|
|
270
|
-
if (this.databaseOpenPromise || !this._db) {
|
|
271
|
-
throw new ConnectionClosedError('Connection is busy re-opening');
|
|
272
|
-
}
|
|
273
|
-
holdId = this.requiresHolds ? await this.baseDB.markHold() : null;
|
|
274
|
-
return await callback();
|
|
275
|
-
}
|
|
276
|
-
catch (ex) {
|
|
277
|
-
if (ConnectionClosedError.MATCHES(ex)) {
|
|
278
|
-
// Immediately re-open the database. We need to miss as little table updates as possible.
|
|
279
|
-
// Note, don't await this since it uses the same lock as we're in now.
|
|
280
|
-
this.reOpenInternalDB();
|
|
281
|
-
}
|
|
282
|
-
throw ex;
|
|
283
|
-
}
|
|
284
|
-
finally {
|
|
285
|
-
if (holdId) {
|
|
286
|
-
await this.baseDB.releaseHold(holdId);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}, options);
|
|
290
|
-
}
|
|
291
|
-
async readTransaction(fn, options) {
|
|
292
|
-
return this.readLock(this.wrapTransaction(fn));
|
|
293
|
-
}
|
|
294
|
-
writeTransaction(fn, options) {
|
|
295
|
-
return this.writeLock(this.wrapTransaction(fn, true));
|
|
296
|
-
}
|
|
297
|
-
generateDBHelpers(tx) {
|
|
298
|
-
return {
|
|
299
|
-
...tx,
|
|
300
|
-
/**
|
|
301
|
-
* Execute a read-only query and return results
|
|
302
|
-
*/
|
|
303
|
-
async getAll(sql, parameters) {
|
|
304
|
-
const res = await tx.execute(sql, parameters);
|
|
305
|
-
return res.rows?._array ?? [];
|
|
306
|
-
},
|
|
307
|
-
/**
|
|
308
|
-
* Execute a read-only query and return the first result, or null if the ResultSet is empty.
|
|
309
|
-
*/
|
|
310
|
-
async getOptional(sql, parameters) {
|
|
311
|
-
const res = await tx.execute(sql, parameters);
|
|
312
|
-
return res.rows?.item(0) ?? null;
|
|
313
|
-
},
|
|
314
|
-
/**
|
|
315
|
-
* Execute a read-only query and return the first result, error if the ResultSet is empty.
|
|
316
|
-
*/
|
|
317
|
-
async get(sql, parameters) {
|
|
318
|
-
const res = await tx.execute(sql, parameters);
|
|
319
|
-
const first = res.rows?.item(0);
|
|
320
|
-
if (!first) {
|
|
321
|
-
throw new Error('Result set is empty');
|
|
322
|
-
}
|
|
323
|
-
return first;
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Wraps a lock context into a transaction context
|
|
329
|
-
*/
|
|
330
|
-
wrapTransaction(cb, write = false) {
|
|
331
|
-
return async (tx) => {
|
|
332
|
-
await this._execute(write ? 'BEGIN EXCLUSIVE' : 'BEGIN');
|
|
333
|
-
let finalized = false;
|
|
334
|
-
const commit = async () => {
|
|
335
|
-
if (finalized) {
|
|
336
|
-
return { rowsAffected: 0 };
|
|
337
|
-
}
|
|
338
|
-
finalized = true;
|
|
339
|
-
return this._execute('COMMIT');
|
|
340
|
-
};
|
|
341
|
-
const rollback = () => {
|
|
342
|
-
finalized = true;
|
|
343
|
-
return this._execute('ROLLBACK');
|
|
344
|
-
};
|
|
345
|
-
try {
|
|
346
|
-
const result = await cb({
|
|
347
|
-
...tx,
|
|
348
|
-
commit,
|
|
349
|
-
rollback
|
|
350
|
-
});
|
|
351
|
-
if (!finalized) {
|
|
352
|
-
await commit();
|
|
353
|
-
}
|
|
354
|
-
return result;
|
|
355
|
-
}
|
|
356
|
-
catch (ex) {
|
|
357
|
-
this.logger.debug('Caught ex in transaction', ex);
|
|
358
|
-
try {
|
|
359
|
-
await rollback();
|
|
360
|
-
}
|
|
361
|
-
catch (ex2) {
|
|
362
|
-
// In rare cases, a rollback may fail.
|
|
363
|
-
// Safe to ignore.
|
|
364
|
-
}
|
|
365
|
-
throw ex;
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Wraps the worker execute function, awaiting for it to be available
|
|
371
|
-
*/
|
|
372
|
-
_execute = async (sql, bindings) => {
|
|
373
|
-
await this.waitForInitialized();
|
|
374
|
-
const result = await this.baseDB.execute(sql, bindings);
|
|
375
|
-
return {
|
|
376
|
-
...result,
|
|
377
|
-
rows: {
|
|
378
|
-
...result.rows,
|
|
379
|
-
item: (idx) => result.rows._array[idx]
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
};
|
|
383
|
-
/**
|
|
384
|
-
* Wraps the worker executeRaw function, awaiting for it to be available
|
|
385
|
-
*/
|
|
386
|
-
_executeRaw = async (sql, bindings) => {
|
|
387
|
-
await this.waitForInitialized();
|
|
388
|
-
return await this.baseDB.executeRaw(sql, bindings);
|
|
389
|
-
};
|
|
390
|
-
/**
|
|
391
|
-
* Wraps the worker executeBatch function, awaiting for it to be available
|
|
392
|
-
*/
|
|
393
|
-
_executeBatch = async (query, params) => {
|
|
394
|
-
await this.waitForInitialized();
|
|
395
|
-
const result = await this.baseDB.executeBatch(query, params);
|
|
396
|
-
return {
|
|
397
|
-
...result,
|
|
398
|
-
rows: undefined
|
|
399
|
-
};
|
|
400
|
-
};
|
|
401
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { BaseObserver } from '@powersync/common';
|
|
2
|
-
import * as Comlink from 'comlink';
|
|
3
|
-
import { AsyncDatabaseConnection, OnTableChangeCallback, OpenAsyncDatabaseConnection, ProxiedQueryResult } from './AsyncDatabaseConnection.js';
|
|
4
|
-
import { ResolvedWebSQLOpenOptions } from './web-sql-flags.js';
|
|
5
|
-
export type SharedConnectionWorker = {
|
|
6
|
-
identifier: string;
|
|
7
|
-
port: MessagePort;
|
|
8
|
-
};
|
|
9
|
-
export type WrappedWorkerConnectionOptions<Config extends ResolvedWebSQLOpenOptions = ResolvedWebSQLOpenOptions> = {
|
|
10
|
-
baseConnection: AsyncDatabaseConnection;
|
|
11
|
-
identifier: string;
|
|
12
|
-
remoteCanCloseUnexpectedly: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Need a remote in order to keep a reference to the Proxied worker
|
|
15
|
-
*/
|
|
16
|
-
remote: Comlink.Remote<OpenAsyncDatabaseConnection<Config>>;
|
|
17
|
-
onClose?: () => void;
|
|
18
|
-
};
|
|
19
|
-
export type WorkerWrappedAsyncDatabaseConnectionListener = {
|
|
20
|
-
closing: () => void;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Wraps a provided instance of {@link AsyncDatabaseConnection}, providing necessary proxy
|
|
24
|
-
* functions for worker listeners.
|
|
25
|
-
*/
|
|
26
|
-
export declare class WorkerWrappedAsyncDatabaseConnection<Config extends ResolvedWebSQLOpenOptions = ResolvedWebSQLOpenOptions> extends BaseObserver<WorkerWrappedAsyncDatabaseConnectionListener> implements AsyncDatabaseConnection {
|
|
27
|
-
protected options: WrappedWorkerConnectionOptions<Config>;
|
|
28
|
-
protected lockAbortController: AbortController;
|
|
29
|
-
protected notifyRemoteClosed: AbortController | undefined;
|
|
30
|
-
constructor(options: WrappedWorkerConnectionOptions<Config>);
|
|
31
|
-
protected get baseConnection(): AsyncDatabaseConnection<ResolvedWebSQLOpenOptions>;
|
|
32
|
-
init(): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Marks the remote as closed.
|
|
35
|
-
*
|
|
36
|
-
* This can sometimes happen outside of our control, e.g. when a shared worker requests a connection from a tab. When
|
|
37
|
-
* it happens, all methods on the {@link baseConnection} would never resolve. To avoid livelocks in this scenario, we
|
|
38
|
-
* throw on all outstanding promises and forbid new calls.
|
|
39
|
-
*/
|
|
40
|
-
markRemoteClosed(): void;
|
|
41
|
-
markHold(): Promise<string>;
|
|
42
|
-
releaseHold(holdId: string): Promise<void>;
|
|
43
|
-
isAutoCommit(): Promise<boolean>;
|
|
44
|
-
private withRemote;
|
|
45
|
-
/**
|
|
46
|
-
* Get a MessagePort which can be used to share the internals of this connection.
|
|
47
|
-
*/
|
|
48
|
-
shareConnection(): Promise<SharedConnectionWorker>;
|
|
49
|
-
/**
|
|
50
|
-
* Registers a table change notification callback with the base database.
|
|
51
|
-
* This can be extended by custom implementations in order to handle proxy events.
|
|
52
|
-
*/
|
|
53
|
-
registerOnTableChange(callback: OnTableChangeCallback): Promise<() => void>;
|
|
54
|
-
close(): Promise<void>;
|
|
55
|
-
execute(sql: string, params?: any[]): Promise<ProxiedQueryResult>;
|
|
56
|
-
executeRaw(sql: string, params?: any[]): Promise<any[][]>;
|
|
57
|
-
executeBatch(sql: string, params?: any[]): Promise<ProxiedQueryResult>;
|
|
58
|
-
getConfig(): Promise<ResolvedWebSQLOpenOptions>;
|
|
59
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { BaseObserver, ConnectionClosedError } from '@powersync/common';
|
|
2
|
-
import * as Comlink from 'comlink';
|
|
3
|
-
/**
|
|
4
|
-
* Wraps a provided instance of {@link AsyncDatabaseConnection}, providing necessary proxy
|
|
5
|
-
* functions for worker listeners.
|
|
6
|
-
*/
|
|
7
|
-
export class WorkerWrappedAsyncDatabaseConnection extends BaseObserver {
|
|
8
|
-
options;
|
|
9
|
-
lockAbortController = new AbortController();
|
|
10
|
-
notifyRemoteClosed;
|
|
11
|
-
constructor(options) {
|
|
12
|
-
super();
|
|
13
|
-
this.options = options;
|
|
14
|
-
if (options.remoteCanCloseUnexpectedly) {
|
|
15
|
-
this.notifyRemoteClosed = new AbortController();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
get baseConnection() {
|
|
19
|
-
return this.options.baseConnection;
|
|
20
|
-
}
|
|
21
|
-
init() {
|
|
22
|
-
return this.baseConnection.init();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Marks the remote as closed.
|
|
26
|
-
*
|
|
27
|
-
* This can sometimes happen outside of our control, e.g. when a shared worker requests a connection from a tab. When
|
|
28
|
-
* it happens, all methods on the {@link baseConnection} would never resolve. To avoid livelocks in this scenario, we
|
|
29
|
-
* throw on all outstanding promises and forbid new calls.
|
|
30
|
-
*/
|
|
31
|
-
markRemoteClosed() {
|
|
32
|
-
// Can non-null assert here because this function is only supposed to be called when remoteCanCloseUnexpectedly was
|
|
33
|
-
// set.
|
|
34
|
-
this.notifyRemoteClosed.abort();
|
|
35
|
-
}
|
|
36
|
-
markHold() {
|
|
37
|
-
return this.withRemote(() => this.baseConnection.markHold());
|
|
38
|
-
}
|
|
39
|
-
releaseHold(holdId) {
|
|
40
|
-
return this.withRemote(() => this.baseConnection.releaseHold(holdId));
|
|
41
|
-
}
|
|
42
|
-
isAutoCommit() {
|
|
43
|
-
return this.withRemote(() => this.baseConnection.isAutoCommit());
|
|
44
|
-
}
|
|
45
|
-
withRemote(workerPromise, fireActionOnAbort = false) {
|
|
46
|
-
const controller = this.notifyRemoteClosed;
|
|
47
|
-
if (controller) {
|
|
48
|
-
return new Promise((resolve, reject) => {
|
|
49
|
-
if (controller.signal.aborted) {
|
|
50
|
-
reject(new ConnectionClosedError('Called operation on closed remote'));
|
|
51
|
-
if (!fireActionOnAbort) {
|
|
52
|
-
// Don't run the operation if we're going to reject
|
|
53
|
-
// We might want to fire-and-forget the operation in some cases (like a close operation)
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function handleAbort() {
|
|
58
|
-
reject(new ConnectionClosedError('Remote peer closed with request in flight'));
|
|
59
|
-
}
|
|
60
|
-
function completePromise(action) {
|
|
61
|
-
controller.signal.removeEventListener('abort', handleAbort);
|
|
62
|
-
action();
|
|
63
|
-
}
|
|
64
|
-
controller.signal.addEventListener('abort', handleAbort);
|
|
65
|
-
workerPromise()
|
|
66
|
-
.then((data) => completePromise(() => resolve(data)))
|
|
67
|
-
.catch((e) => completePromise(() => reject(e)));
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
// Can't close, so just return the inner worker promise unguarded.
|
|
72
|
-
return workerPromise();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Get a MessagePort which can be used to share the internals of this connection.
|
|
77
|
-
*/
|
|
78
|
-
async shareConnection() {
|
|
79
|
-
const { identifier, remote } = this.options;
|
|
80
|
-
/**
|
|
81
|
-
* Hold a navigator lock in order to avoid features such as Chrome's frozen tabs,
|
|
82
|
-
* or Edge's sleeping tabs from pausing the thread for this connection.
|
|
83
|
-
* This promise resolves once a lock is obtained.
|
|
84
|
-
* This lock will be held as long as this connection is open.
|
|
85
|
-
* The `shareConnection` method should not be called on multiple tabs concurrently.
|
|
86
|
-
*/
|
|
87
|
-
await new Promise((resolve, reject) => navigator.locks
|
|
88
|
-
.request(`shared-connection-${this.options.identifier}-${Date.now()}-${Math.round(Math.random() * 10000)}`, {
|
|
89
|
-
signal: this.lockAbortController.signal
|
|
90
|
-
}, async () => {
|
|
91
|
-
resolve();
|
|
92
|
-
// Free the lock when the connection is already closed.
|
|
93
|
-
if (this.lockAbortController.signal.aborted) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
// Hold the lock while the shared connection is in use.
|
|
97
|
-
await new Promise((releaseLock) => {
|
|
98
|
-
this.lockAbortController.signal.addEventListener('abort', () => {
|
|
99
|
-
releaseLock();
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
})
|
|
103
|
-
// We aren't concerned with abort errors here
|
|
104
|
-
.catch((ex) => {
|
|
105
|
-
if (ex.name == 'AbortError') {
|
|
106
|
-
resolve();
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
reject(ex);
|
|
110
|
-
}
|
|
111
|
-
}));
|
|
112
|
-
const newPort = await remote[Comlink.createEndpoint]();
|
|
113
|
-
return { port: newPort, identifier };
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Registers a table change notification callback with the base database.
|
|
117
|
-
* This can be extended by custom implementations in order to handle proxy events.
|
|
118
|
-
*/
|
|
119
|
-
async registerOnTableChange(callback) {
|
|
120
|
-
return this.baseConnection.registerOnTableChange(Comlink.proxy(callback));
|
|
121
|
-
}
|
|
122
|
-
async close() {
|
|
123
|
-
// Abort any pending lock requests.
|
|
124
|
-
this.lockAbortController.abort();
|
|
125
|
-
try {
|
|
126
|
-
// fire and forget the close operation
|
|
127
|
-
await this.withRemote(() => this.baseConnection.close(), true);
|
|
128
|
-
}
|
|
129
|
-
finally {
|
|
130
|
-
this.options.remote[Comlink.releaseProxy]();
|
|
131
|
-
this.options.onClose?.();
|
|
132
|
-
this.iterateListeners((l) => l.closing?.());
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
execute(sql, params) {
|
|
136
|
-
return this.withRemote(() => this.baseConnection.execute(sql, params));
|
|
137
|
-
}
|
|
138
|
-
executeRaw(sql, params) {
|
|
139
|
-
return this.withRemote(() => this.baseConnection.executeRaw(sql, params));
|
|
140
|
-
}
|
|
141
|
-
executeBatch(sql, params) {
|
|
142
|
-
return this.withRemote(() => this.baseConnection.executeBatch(sql, params));
|
|
143
|
-
}
|
|
144
|
-
getConfig() {
|
|
145
|
-
return this.withRemote(() => this.baseConnection.getConfig());
|
|
146
|
-
}
|
|
147
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LockedAsyncDatabaseAdapter } from '../LockedAsyncDatabaseAdapter.js';
|
|
2
|
-
import { WebDBAdapterConfiguration } from '../WebDBAdapter.js';
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
* An intermediary implementation of WASQLiteDBAdapter, which takes the same
|
|
6
|
-
* constructor arguments as {@link LockedAsyncDatabaseAdapter}, but provides some
|
|
7
|
-
* basic WA-SQLite specific functionality.
|
|
8
|
-
* This base class is used to avoid requiring overloading the constructor of {@link WASQLiteDBAdapter}
|
|
9
|
-
*/
|
|
10
|
-
export declare class InternalWASQLiteDBAdapter extends LockedAsyncDatabaseAdapter {
|
|
11
|
-
getConfiguration(): WebDBAdapterConfiguration;
|
|
12
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { LockedAsyncDatabaseAdapter } from '../LockedAsyncDatabaseAdapter.js';
|
|
2
|
-
import { WASQLiteVFS } from './WASQLiteConnection.js';
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
* An intermediary implementation of WASQLiteDBAdapter, which takes the same
|
|
6
|
-
* constructor arguments as {@link LockedAsyncDatabaseAdapter}, but provides some
|
|
7
|
-
* basic WA-SQLite specific functionality.
|
|
8
|
-
* This base class is used to avoid requiring overloading the constructor of {@link WASQLiteDBAdapter}
|
|
9
|
-
*/
|
|
10
|
-
export class InternalWASQLiteDBAdapter extends LockedAsyncDatabaseAdapter {
|
|
11
|
-
getConfiguration() {
|
|
12
|
-
// This is valid since we only handle WASQLite connections
|
|
13
|
-
const baseConfig = super.getConfiguration();
|
|
14
|
-
return {
|
|
15
|
-
...super.getConfiguration(),
|
|
16
|
-
requiresPersistentTriggers: baseConfig.vfs == WASQLiteVFS.OPFSCoopSyncVFS || baseConfig.vfs == WASQLiteVFS.AccessHandlePoolVFS
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
}
|