@powersync/web 0.0.0-dev-20260128023420 → 0.0.0-dev-20260128170746
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/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js +9 -17
- package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js.map +1 -1
- package/dist/{_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c0.index.umd.js → _journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js} +5 -17
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js.map +1 -0
- package/dist/{_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c1.index.umd.js → _journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js} +5 -17
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js.map +1 -0
- package/dist/index.umd.js +4583 -43587
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +1629 -576
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +1622 -573
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/dist/worker/{node_modules_bson_lib_bson_mjs.umd.js → node_modules_pnpm_bson_6_10_4_node_modules_bson_lib_bson_mjs.umd.js} +6 -6
- package/dist/worker/node_modules_pnpm_bson_6_10_4_node_modules_bson_lib_bson_mjs.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf.umd.js +44 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779.umd.js +44 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js +44 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +44 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +1 -0
- package/dist/worker/{node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js} +24 -24
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js.map +1 -0
- package/dist/worker/{node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js} +18 -18
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js.map +1 -0
- package/dist/worker/{node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js} +18 -18
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js.map +1 -0
- package/lib/package.json +11 -12
- package/lib/src/attachments/IndexDBFileSystemAdapter.d.ts +25 -0
- package/lib/src/attachments/IndexDBFileSystemAdapter.js +104 -0
- package/lib/src/db/NavigatorTriggerClaimManager.d.ts +6 -0
- package/lib/src/db/NavigatorTriggerClaimManager.js +20 -0
- package/lib/src/db/PowerSyncDatabase.d.ts +2 -1
- package/lib/src/db/PowerSyncDatabase.js +27 -1
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.d.ts +2 -2
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.js +5 -1
- package/lib/src/db/adapters/WebDBAdapter.d.ts +4 -1
- package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.d.ts +12 -0
- package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.js +19 -0
- package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.d.ts +2 -2
- package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.js +2 -2
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +2 -2
- package/lib/src/db/sync/SharedWebStreamingSyncImplementation.d.ts +1 -1
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -7
- package/src/attachments/IndexDBFileSystemAdapter.ts +117 -0
- package/src/db/NavigatorTriggerClaimManager.ts +23 -0
- package/src/db/PowerSyncDatabase.ts +30 -1
- package/src/db/adapters/LockedAsyncDatabaseAdapter.ts +7 -3
- package/src/db/adapters/WebDBAdapter.ts +5 -1
- package/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.ts +23 -0
- package/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts +2 -2
- package/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts +2 -2
- package/src/index.ts +1 -1
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c0.index.umd.js.map +0 -1
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c1.index.umd.js.map +0 -1
- package/dist/worker/node_modules_bson_lib_bson_mjs.umd.js.map +0 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js +0 -44
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js.map +0 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js +0 -44
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js.map +0 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js +0 -44
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js.map +0 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +0 -44
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +0 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js.map +0 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js.map +0 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/web",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260128170746",
|
|
4
4
|
"description": "PowerSync Web SDK",
|
|
5
5
|
"main": "lib/src/index.js",
|
|
6
6
|
"module": "lib/src/index.js",
|
|
@@ -56,27 +56,26 @@
|
|
|
56
56
|
"license": "Apache-2.0",
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@journeyapps/wa-sqlite": "^1.4.1",
|
|
59
|
-
"@powersync/common": "0.0.0-dev-
|
|
59
|
+
"@powersync/common": "0.0.0-dev-20260128170746"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"async-mutex": "^0.5.0",
|
|
63
63
|
"bson": "^6.10.4",
|
|
64
64
|
"comlink": "^4.4.2",
|
|
65
65
|
"commander": "^12.1.0",
|
|
66
|
-
"@powersync/common": "0.0.0-dev-
|
|
66
|
+
"@powersync/common": "0.0.0-dev-20260128170746"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@journeyapps/wa-sqlite": "^1.4.1",
|
|
70
70
|
"@types/uuid": "^9.0.6",
|
|
71
71
|
"crypto-browserify": "^3.12.0",
|
|
72
|
+
"glob": "^11.0.0",
|
|
72
73
|
"p-defer": "^4.0.1",
|
|
73
74
|
"source-map-loader": "^5.0.0",
|
|
74
75
|
"stream-browserify": "^3.0.0",
|
|
75
76
|
"terser-webpack-plugin": "^5.3.9",
|
|
76
|
-
"uuid": "^
|
|
77
|
-
"vite": "^
|
|
78
|
-
"vite-plugin-top-level-await": "^1.4.4",
|
|
79
|
-
"vite-plugin-wasm": "^3.3.0",
|
|
77
|
+
"uuid": "^11.1.0",
|
|
78
|
+
"vite": "^7.3.1",
|
|
80
79
|
"vm-browserify": "^1.1.2",
|
|
81
80
|
"webpack": "^5.90.1",
|
|
82
81
|
"webpack-cli": "^5.1.4",
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { AttachmentData, EncodingType, LocalStorageAdapter } from '@powersync/common';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* IndexDBFileSystemStorageAdapter implements LocalStorageAdapter using IndexedDB.
|
|
5
|
+
* Suitable for web browsers and web-based environments.
|
|
6
|
+
*/
|
|
7
|
+
export class IndexDBFileSystemStorageAdapter implements LocalStorageAdapter {
|
|
8
|
+
private dbPromise!: Promise<IDBDatabase>;
|
|
9
|
+
|
|
10
|
+
constructor(private databaseName: string = 'PowerSyncFiles') {}
|
|
11
|
+
|
|
12
|
+
async initialize(): Promise<void> {
|
|
13
|
+
this.dbPromise = new Promise<IDBDatabase>((resolve, reject) => {
|
|
14
|
+
const request = indexedDB.open(this.databaseName, 1);
|
|
15
|
+
request.onupgradeneeded = () => {
|
|
16
|
+
request.result.createObjectStore('files');
|
|
17
|
+
};
|
|
18
|
+
request.onsuccess = () => resolve(request.result);
|
|
19
|
+
request.onerror = () => reject(request.error);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async clear(): Promise<void> {
|
|
24
|
+
const db = await this.dbPromise;
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const tx = db.transaction('files', 'readwrite');
|
|
27
|
+
const store = tx.objectStore('files');
|
|
28
|
+
const req = store.clear();
|
|
29
|
+
req.onsuccess = () => resolve();
|
|
30
|
+
req.onerror = () => reject(req.error);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
getLocalUri(filename: string): string {
|
|
35
|
+
return `indexeddb://${this.databaseName}/files/${filename}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private async getStore(mode: IDBTransactionMode = 'readonly'): Promise<IDBObjectStore> {
|
|
39
|
+
const db = await this.dbPromise;
|
|
40
|
+
const tx = db.transaction('files', mode);
|
|
41
|
+
return tx.objectStore('files');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async saveFile(filePath: string, data: AttachmentData): Promise<number> {
|
|
45
|
+
const store = await this.getStore('readwrite');
|
|
46
|
+
|
|
47
|
+
let dataToStore: ArrayBuffer;
|
|
48
|
+
let size: number;
|
|
49
|
+
|
|
50
|
+
if (typeof data === 'string') {
|
|
51
|
+
const binaryString = atob(data);
|
|
52
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
53
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
54
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
55
|
+
}
|
|
56
|
+
dataToStore = bytes.buffer;
|
|
57
|
+
size = bytes.byteLength;
|
|
58
|
+
} else {
|
|
59
|
+
dataToStore = data;
|
|
60
|
+
size = dataToStore.byteLength;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return await new Promise<number>((resolve, reject) => {
|
|
64
|
+
const req = store.put(dataToStore, filePath);
|
|
65
|
+
req.onsuccess = () => resolve(size);
|
|
66
|
+
req.onerror = () => reject(req.error);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async readFile(fileUri: string, options?: { encoding?: EncodingType; mediaType?: string }): Promise<ArrayBuffer> {
|
|
71
|
+
const store = await this.getStore();
|
|
72
|
+
return new Promise<ArrayBuffer>((resolve, reject) => {
|
|
73
|
+
const req = store.get(fileUri);
|
|
74
|
+
req.onsuccess = async () => {
|
|
75
|
+
if (!req.result) {
|
|
76
|
+
reject(new Error('File not found'));
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
resolve(req.result as ArrayBuffer);
|
|
81
|
+
};
|
|
82
|
+
req.onerror = () => reject(req.error);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async deleteFile(uri: string, options?: { filename?: string }): Promise<void> {
|
|
87
|
+
const store = await this.getStore('readwrite');
|
|
88
|
+
await new Promise<void>((resolve, reject) => {
|
|
89
|
+
const req = store.delete(uri);
|
|
90
|
+
req.onsuccess = () => resolve();
|
|
91
|
+
req.onerror = () => reject(req.error);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async fileExists(fileUri: string): Promise<boolean> {
|
|
96
|
+
const store = await this.getStore();
|
|
97
|
+
return new Promise<boolean>((resolve, reject) => {
|
|
98
|
+
const req = store.get(fileUri);
|
|
99
|
+
req.onsuccess = () => resolve(!!req.result);
|
|
100
|
+
req.onerror = () => reject(req.error);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async makeDir(path: string): Promise<void> {
|
|
105
|
+
// No-op for IndexedDB as it does not have a directory structure
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async rmDir(path: string): Promise<void> {
|
|
109
|
+
const store = await this.getStore('readwrite');
|
|
110
|
+
const range = IDBKeyRange.bound(path + '/', path + '/\uffff', false, false);
|
|
111
|
+
await new Promise<void>((resolve, reject) => {
|
|
112
|
+
const req = store.delete(range);
|
|
113
|
+
req.onsuccess = () => resolve();
|
|
114
|
+
req.onerror = () => reject(req.error);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TriggerClaimManager } from '@powersync/common';
|
|
2
|
+
import { getNavigatorLocks } from '../shared/navigator.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
export const NAVIGATOR_TRIGGER_CLAIM_MANAGER: TriggerClaimManager = {
|
|
9
|
+
async obtainClaim(identifier: string): Promise<() => Promise<void>> {
|
|
10
|
+
return new Promise((resolveReleaser) => {
|
|
11
|
+
getNavigatorLocks().request(identifier, async () => {
|
|
12
|
+
await new Promise<void>((releaseLock) => {
|
|
13
|
+
resolveReleaser(async () => releaseLock());
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
async checkClaim(identifier: string): Promise<boolean> {
|
|
20
|
+
const currentState = await getNavigatorLocks().query();
|
|
21
|
+
return currentState.held?.find((heldLock) => heldLock.name == identifier) != null;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
PowerSyncDatabaseOptionsWithSettings,
|
|
8
8
|
SqliteBucketStorage,
|
|
9
9
|
StreamingSyncImplementation,
|
|
10
|
+
TriggerManagerConfig,
|
|
10
11
|
isDBAdapter,
|
|
11
12
|
isSQLOpenFactory,
|
|
12
13
|
type BucketStorageAdapter,
|
|
@@ -16,6 +17,8 @@ import {
|
|
|
16
17
|
} from '@powersync/common';
|
|
17
18
|
import { Mutex } from 'async-mutex';
|
|
18
19
|
import { getNavigatorLocks } from '../shared/navigator.js';
|
|
20
|
+
import { NAVIGATOR_TRIGGER_CLAIM_MANAGER } from './NavigatorTriggerClaimManager.js';
|
|
21
|
+
import { LockedAsyncDatabaseAdapter } from './adapters/LockedAsyncDatabaseAdapter.js';
|
|
19
22
|
import { WebDBAdapter } from './adapters/WebDBAdapter.js';
|
|
20
23
|
import { WASQLiteOpenFactory } from './adapters/wa-sqlite/WASQLiteOpenFactory.js';
|
|
21
24
|
import {
|
|
@@ -144,7 +147,33 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
|
|
|
144
147
|
}
|
|
145
148
|
}
|
|
146
149
|
|
|
147
|
-
async _initialize(): Promise<void> {
|
|
150
|
+
async _initialize(): Promise<void> {
|
|
151
|
+
if (this.database instanceof LockedAsyncDatabaseAdapter) {
|
|
152
|
+
/**
|
|
153
|
+
* While init is done automatically,
|
|
154
|
+
* LockedAsyncDatabaseAdapter only exposes config after init.
|
|
155
|
+
* We can explicitly wait for init here in order to access config.
|
|
156
|
+
*/
|
|
157
|
+
await this.database.init();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// In some cases, like the SQLJs adapter, we don't pass a WebDBAdapter, so we need to check.
|
|
161
|
+
if (typeof (this.database as WebDBAdapter).getConfiguration == 'function') {
|
|
162
|
+
const config = (this.database as WebDBAdapter).getConfiguration();
|
|
163
|
+
if (config.requiresPersistentTriggers) {
|
|
164
|
+
this.triggersImpl.updateDefaults({
|
|
165
|
+
useStorageByDefault: true
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
protected generateTriggerManagerConfig(): TriggerManagerConfig {
|
|
172
|
+
return {
|
|
173
|
+
// We need to share hold information between tabs for web
|
|
174
|
+
claimManager: NAVIGATOR_TRIGGER_CLAIM_MANAGER
|
|
175
|
+
};
|
|
176
|
+
}
|
|
148
177
|
|
|
149
178
|
protected openDBAdapter(options: WebPowerSyncDatabaseOptionsWithSettings): DBAdapter {
|
|
150
179
|
const defaultFactory = new WASQLiteOpenFactory({
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from '@powersync/common';
|
|
14
14
|
import { getNavigatorLocks } from '../../shared/navigator.js';
|
|
15
15
|
import { AsyncDatabaseConnection } from './AsyncDatabaseConnection.js';
|
|
16
|
-
import { SharedConnectionWorker, WebDBAdapter } from './WebDBAdapter.js';
|
|
16
|
+
import { SharedConnectionWorker, WebDBAdapter, WebDBAdapterConfiguration } from './WebDBAdapter.js';
|
|
17
17
|
import { WorkerWrappedAsyncDatabaseConnection } from './WorkerWrappedAsyncDatabaseConnection.js';
|
|
18
18
|
import { WASQLiteVFS } from './wa-sqlite/WASQLiteConnection.js';
|
|
19
19
|
import { ResolvedWASQLiteOpenFactoryOptions } from './wa-sqlite/WASQLiteOpenFactory.js';
|
|
@@ -181,11 +181,15 @@ export class LockedAsyncDatabaseAdapter
|
|
|
181
181
|
this.iterateListeners((cb) => cb.initialized?.());
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
getConfiguration():
|
|
184
|
+
getConfiguration(): WebDBAdapterConfiguration {
|
|
185
185
|
if (!this._config) {
|
|
186
186
|
throw new Error(`Cannot get config before initialization is completed`);
|
|
187
187
|
}
|
|
188
|
-
return
|
|
188
|
+
return {
|
|
189
|
+
...this._config,
|
|
190
|
+
// This can be overridden by the adapter later
|
|
191
|
+
requiresPersistentTriggers: false
|
|
192
|
+
};
|
|
189
193
|
}
|
|
190
194
|
|
|
191
195
|
protected async waitForInitialized() {
|
|
@@ -6,6 +6,10 @@ export type SharedConnectionWorker = {
|
|
|
6
6
|
port: MessagePort;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
export type WebDBAdapterConfiguration = ResolvedWebSQLOpenOptions & {
|
|
10
|
+
requiresPersistentTriggers: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
9
13
|
export interface WebDBAdapter extends DBAdapter {
|
|
10
14
|
/**
|
|
11
15
|
* Get a MessagePort which can be used to share the internals of this connection.
|
|
@@ -16,5 +20,5 @@ export interface WebDBAdapter extends DBAdapter {
|
|
|
16
20
|
* Get the config options used to open this connection.
|
|
17
21
|
* This is useful for sharing connections.
|
|
18
22
|
*/
|
|
19
|
-
getConfiguration():
|
|
23
|
+
getConfiguration(): WebDBAdapterConfiguration;
|
|
20
24
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LockedAsyncDatabaseAdapter } from '../LockedAsyncDatabaseAdapter.js';
|
|
2
|
+
import { WebDBAdapterConfiguration } from '../WebDBAdapter.js';
|
|
3
|
+
import { WASQLiteVFS } from './WASQLiteConnection.js';
|
|
4
|
+
import { ResolvedWASQLiteOpenFactoryOptions } from './WASQLiteOpenFactory.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
* An intermediary implementation of WASQLiteDBAdapter, which takes the same
|
|
9
|
+
* constructor arguments as {@link LockedAsyncDatabaseAdapter}, but provides some
|
|
10
|
+
* basic WA-SQLite specific functionality.
|
|
11
|
+
* This base class is used to avoid requiring overloading the constructor of {@link WASQLiteDBAdapter}
|
|
12
|
+
*/
|
|
13
|
+
export class InternalWASQLiteDBAdapter extends LockedAsyncDatabaseAdapter {
|
|
14
|
+
getConfiguration(): WebDBAdapterConfiguration {
|
|
15
|
+
// This is valid since we only handle WASQLite connections
|
|
16
|
+
const baseConfig = super.getConfiguration() as unknown as ResolvedWASQLiteOpenFactoryOptions;
|
|
17
|
+
return {
|
|
18
|
+
...super.getConfiguration(),
|
|
19
|
+
requiresPersistentTriggers:
|
|
20
|
+
baseConfig.vfs == WASQLiteVFS.OPFSCoopSyncVFS || baseConfig.vfs == WASQLiteVFS.AccessHandlePoolVFS
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -2,7 +2,6 @@ import { type PowerSyncOpenFactoryOptions } from '@powersync/common';
|
|
|
2
2
|
import * as Comlink from 'comlink';
|
|
3
3
|
import { resolveWebPowerSyncFlags } from '../../PowerSyncDatabase.js';
|
|
4
4
|
import { OpenAsyncDatabaseConnection } from '../AsyncDatabaseConnection.js';
|
|
5
|
-
import { LockedAsyncDatabaseAdapter } from '../LockedAsyncDatabaseAdapter.js';
|
|
6
5
|
import {
|
|
7
6
|
DEFAULT_CACHE_SIZE_KB,
|
|
8
7
|
ResolvedWebSQLOpenOptions,
|
|
@@ -10,6 +9,7 @@ import {
|
|
|
10
9
|
WebSQLFlags
|
|
11
10
|
} from '../web-sql-flags.js';
|
|
12
11
|
import { WorkerWrappedAsyncDatabaseConnection } from '../WorkerWrappedAsyncDatabaseConnection.js';
|
|
12
|
+
import { InternalWASQLiteDBAdapter } from './InternalWASQLiteDBAdapter.js';
|
|
13
13
|
import { WASQLiteVFS } from './WASQLiteConnection.js';
|
|
14
14
|
import { WASQLiteOpenFactory } from './WASQLiteOpenFactory.js';
|
|
15
15
|
|
|
@@ -44,7 +44,7 @@ export interface WASQLiteDBAdapterOptions extends Omit<PowerSyncOpenFactoryOptio
|
|
|
44
44
|
/**
|
|
45
45
|
* Adapter for WA-SQLite SQLite connections.
|
|
46
46
|
*/
|
|
47
|
-
export class WASQLiteDBAdapter extends
|
|
47
|
+
export class WASQLiteDBAdapter extends InternalWASQLiteDBAdapter {
|
|
48
48
|
constructor(options: WASQLiteDBAdapterOptions) {
|
|
49
49
|
super({
|
|
50
50
|
name: options.dbFilename,
|
|
@@ -3,7 +3,6 @@ import * as Comlink from 'comlink';
|
|
|
3
3
|
import { openWorkerDatabasePort, resolveWorkerDatabasePortFactory } from '../../../worker/db/open-worker-database.js';
|
|
4
4
|
import { AbstractWebSQLOpenFactory } from '../AbstractWebSQLOpenFactory.js';
|
|
5
5
|
import { AsyncDatabaseConnection, OpenAsyncDatabaseConnection } from '../AsyncDatabaseConnection.js';
|
|
6
|
-
import { LockedAsyncDatabaseAdapter } from '../LockedAsyncDatabaseAdapter.js';
|
|
7
6
|
import { WorkerWrappedAsyncDatabaseConnection } from '../WorkerWrappedAsyncDatabaseConnection.js';
|
|
8
7
|
import {
|
|
9
8
|
DEFAULT_CACHE_SIZE_KB,
|
|
@@ -11,6 +10,7 @@ import {
|
|
|
11
10
|
TemporaryStorageOption,
|
|
12
11
|
WebSQLOpenFactoryOptions
|
|
13
12
|
} from '../web-sql-flags.js';
|
|
13
|
+
import { InternalWASQLiteDBAdapter } from './InternalWASQLiteDBAdapter.js';
|
|
14
14
|
import { WASQLiteVFS, WASqliteConnection } from './WASQLiteConnection.js';
|
|
15
15
|
|
|
16
16
|
export interface WASQLiteOpenFactoryOptions extends WebSQLOpenFactoryOptions {
|
|
@@ -41,7 +41,7 @@ export class WASQLiteOpenFactory extends AbstractWebSQLOpenFactory {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
protected openAdapter(): DBAdapter {
|
|
44
|
-
return new
|
|
44
|
+
return new InternalWASQLiteDBAdapter({
|
|
45
45
|
name: this.options.dbFilename,
|
|
46
46
|
openConnection: () => this.openConnection(),
|
|
47
47
|
debugMode: this.options.debugMode,
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from '@powersync/common';
|
|
2
|
+
export * from './attachments/IndexDBFileSystemAdapter.js';
|
|
2
3
|
export * from './db/adapters/AbstractWebPowerSyncDatabaseOpenFactory.js';
|
|
3
4
|
export * from './db/adapters/AbstractWebSQLOpenFactory.js';
|
|
4
5
|
export * from './db/adapters/AsyncDatabaseConnection.js';
|
|
@@ -11,4 +12,3 @@ export * from './db/PowerSyncDatabase.js';
|
|
|
11
12
|
export * from './db/sync/SharedWebStreamingSyncImplementation.js';
|
|
12
13
|
export * from './db/sync/WebRemote.js';
|
|
13
14
|
export * from './db/sync/WebStreamingSyncImplementation.js';
|
|
14
|
-
export * from './db/adapters/WebDBAdapter.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c0.index.umd.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACXA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACRA;AACA;AACA;AACA;AACA;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACNA;AACA;AACA;AACA;AACA;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;;;;;AELA;AACA","sources":["webpack://sdk_web/webpack/universalModuleDefinition","webpack://sdk_web/./lib/src/worker/db/SharedWASQLiteConnection.js","webpack://sdk_web/./lib/src/worker/db/WASQLiteDB.worker.js","webpack://sdk_web/./lib/src/worker/db/WorkerWASQLiteConnection.js","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite\"","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"","webpack://sdk_web/external umd \"@powersync/common\"","webpack://sdk_web/external umd \"async-mutex\"","webpack://sdk_web/external umd \"comlink\"","webpack://sdk_web/webpack/bootstrap","webpack://sdk_web/webpack/runtime/chunk loaded","webpack://sdk_web/webpack/runtime/create fake namespace object","webpack://sdk_web/webpack/runtime/define property getters","webpack://sdk_web/webpack/runtime/ensure chunk","webpack://sdk_web/webpack/runtime/get javascript chunk filename","webpack://sdk_web/webpack/runtime/global","webpack://sdk_web/webpack/runtime/hasOwnProperty shorthand","webpack://sdk_web/webpack/runtime/make namespace object","webpack://sdk_web/webpack/runtime/node module decorator","webpack://sdk_web/webpack/runtime/publicPath","webpack://sdk_web/webpack/runtime/importScripts chunk loading","webpack://sdk_web/webpack/runtime/startup chunk dependencies","webpack://sdk_web/webpack/before-startup","webpack://sdk_web/webpack/startup","webpack://sdk_web/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@journeyapps/wa-sqlite\"), require(\"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"), require(\"@powersync/common\"), require(\"async-mutex\"), require(\"comlink\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@journeyapps/wa-sqlite\", \"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\", \"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\", \"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\", \"@powersync/common\", \"async-mutex\", \"comlink\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"sdk_web\"] = factory(require(\"@journeyapps/wa-sqlite\"), require(\"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"), require(\"@powersync/common\"), require(\"async-mutex\"), require(\"comlink\"));\n\telse\n\t\troot[\"sdk_web\"] = factory(root[\"@journeyapps/wa-sqlite\"], root[\"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"], root[\"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"], root[\"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"], root[\"@powersync/common\"], root[\"async-mutex\"], root[\"comlink\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_AccessHandlePoolVFS_js__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_IDBBatchAtomicVFS_js__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_OPFSCoopSyncVFS_js__, __WEBPACK_EXTERNAL_MODULE__powersync_common__, __WEBPACK_EXTERNAL_MODULE_async_mutex__, __WEBPACK_EXTERNAL_MODULE_comlink__) => {\nreturn ","export class SharedWASQLiteConnection {\n options;\n isClosing;\n // Keeps track if this current hold if the shared connection has a hold\n activeHoldId;\n constructor(options) {\n this.options = options;\n // Add this client ID to the set of known clients\n this.clientIds.add(options.clientId);\n this.isClosing = false;\n this.activeHoldId = null;\n }\n get logger() {\n return this.options.logger;\n }\n get dbEntry() {\n return this.options.dbMap.get(this.options.dbFilename);\n }\n get connection() {\n return this.dbEntry.db;\n }\n get clientIds() {\n return this.dbEntry.clientIds;\n }\n async init() {\n // No-op since the connection is already initialized when it was created\n }\n async markHold() {\n this.activeHoldId = await this.connection.markHold();\n return this.activeHoldId;\n }\n async releaseHold(id) {\n try {\n await this.connection.releaseHold(id);\n }\n finally {\n this.activeHoldId = null;\n }\n }\n async isAutoCommit() {\n return this.connection.isAutoCommit();\n }\n /**\n * Handles closing of a shared connection.\n * The connection is only closed if there are no active clients using it.\n */\n async close() {\n // This prevents further statements on this connection from being executed\n this.isClosing = true;\n const { clientIds, logger } = this;\n const { clientId, dbFilename, dbMap } = this.options;\n logger.debug(`Close requested from client ${clientId} of ${[...clientIds]}`);\n clientIds.delete(clientId);\n if (this.activeHoldId) {\n // We can't cleanup here since we're not in a lock context.\n // The cleanup will occur once a new hold is acquired.\n this.logger.info(`Hold ${this.activeHoldId} was still active when the connection was closed. Cleanup will occur once a new hold is acquired.`);\n }\n if (clientIds.size == 0) {\n logger.debug(`Closing connection to ${this.options}.`);\n const connection = this.connection;\n dbMap.delete(dbFilename);\n await connection.close();\n return;\n }\n logger.debug(`Connection to ${dbFilename} not closed yet due to active clients.`);\n return;\n }\n async withClosing(action) {\n if (this.isClosing) {\n throw new Error('Connection is closing');\n }\n return action();\n }\n async execute(sql, params) {\n return this.withClosing(() => this.connection.execute(sql, params));\n }\n async executeRaw(sql, params) {\n return this.withClosing(() => this.connection.executeRaw(sql, params));\n }\n executeBatch(sql, params) {\n return this.withClosing(() => this.connection.executeBatch(sql, params));\n }\n registerOnTableChange(callback) {\n return this.connection.registerOnTableChange(callback);\n }\n getConfig() {\n return this.connection.getConfig();\n }\n}\n","/**\n * Supports both shared and dedicated workers, based on how the worker is constructed (new SharedWorker vs new Worker()).\n */\nimport '@journeyapps/wa-sqlite';\nimport { createBaseLogger, createLogger } from '@powersync/common';\nimport * as Comlink from 'comlink';\nimport { getNavigatorLocks } from '../../shared/navigator.js';\nimport { SharedWASQLiteConnection } from './SharedWASQLiteConnection.js';\nimport { WorkerWASQLiteConnection } from './WorkerWASQLiteConnection.js';\nconst baseLogger = createBaseLogger();\nbaseLogger.useDefaults();\nconst logger = createLogger('db-worker');\nconst DBMap = new Map();\nconst OPEN_DB_LOCK = 'open-wasqlite-db';\nlet nextClientId = 1;\nconst openDBShared = async (options) => {\n // Prevent multiple simultaneous opens from causing race conditions\n return getNavigatorLocks().request(OPEN_DB_LOCK, async () => {\n const clientId = nextClientId++;\n const { dbFilename, logLevel } = options;\n logger.setLevel(logLevel);\n if (!DBMap.has(dbFilename)) {\n const clientIds = new Set();\n // This format returns proxy objects for function callbacks\n const connection = new WorkerWASQLiteConnection(options);\n await connection.init();\n connection.registerListener({\n holdOverwritten: async () => {\n /**\n * The previous hold has been overwritten, without being released.\n * we need to cleanup any resources associated with it.\n * We can perform a rollback to release any potential transactions that were started.\n */\n await connection.execute('ROLLBACK').catch(() => { });\n }\n });\n DBMap.set(dbFilename, {\n clientIds,\n db: connection\n });\n }\n // Associates this clientId with the shared connection entry\n const sharedConnection = new SharedWASQLiteConnection({\n dbMap: DBMap,\n dbFilename,\n clientId,\n logger\n });\n return Comlink.proxy(sharedConnection);\n });\n};\n// Check if we're in a SharedWorker context\nif (typeof SharedWorkerGlobalScope !== 'undefined') {\n const _self = self;\n _self.onconnect = function (event) {\n const port = event.ports[0];\n Comlink.expose(openDBShared, port);\n };\n}\nelse {\n // A dedicated worker can be shared externally\n Comlink.expose(openDBShared);\n}\naddEventListener('unload', () => {\n Array.from(DBMap.values()).forEach(async (dbConnection) => {\n const { db } = dbConnection;\n db.close?.();\n });\n});\n","import * as Comlink from 'comlink';\nimport { WASqliteConnection } from '../../db/adapters/wa-sqlite/WASQLiteConnection.js';\n/**\n * A Small proxy wrapper around the WASqliteConnection.\n * This ensures that certain return types are properly proxied.\n */\nexport class WorkerWASQLiteConnection extends WASqliteConnection {\n async registerOnTableChange(callback) {\n // Proxy the callback remove function\n return Comlink.proxy(await super.registerOnTableChange(callback));\n }\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite__;","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_AccessHandlePoolVFS_js__;","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_IDBBatchAtomicVFS_js__;","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_OPFSCoopSyncVFS_js__;","module.exports = __WEBPACK_EXTERNAL_MODULE__powersync_common__;","module.exports = __WEBPACK_EXTERNAL_MODULE_async_mutex__;","module.exports = __WEBPACK_EXTERNAL_MODULE_comlink__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Check if module exists (development only)\n\tif (__webpack_modules__[moduleId] === undefined) {\n\t\tvar e = new Error(\"Cannot find module '\" + moduleId + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n// the startup function\n__webpack_require__.x = () => {\n\t// Load entry module and return exports\n\t// This entry module depends on other loaded chunks and execution need to be delayed\n\tvar __webpack_exports__ = __webpack_require__.O(undefined, [\"main\"], () => (__webpack_require__(\"./lib/src/worker/db/WASQLiteDB.worker.js\")))\n\t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n\treturn __webpack_exports__;\n};\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks and chunks that the entrypoint depends on\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/^blob:/, \"\").replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","__webpack_require__.b = self.location + \"\";\n\n// object to store loaded chunks\n// \"1\" means \"already loaded\"\nvar installedChunks = {\n\t\"_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c0\": 1\n};\n\n// importScripts chunk loading\nvar installChunk = (data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\tfor(var moduleId in moreModules) {\n\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\twhile(chunkIds.length)\n\t\tinstalledChunks[chunkIds.pop()] = 1;\n\tparentChunkLoadingFunction(data);\n};\n__webpack_require__.f.i = (chunkId, promises) => {\n\t// \"1\" is the signal for \"already loaded\"\n\tif(!installedChunks[chunkId]) {\n\t\tif(true) { // all chunks have JS\n\t\t\timportScripts(__webpack_require__.p + __webpack_require__.u(chunkId));\n\t\t}\n\t}\n};\n\nvar chunkLoadingGlobal = self[\"webpackChunksdk_web\"] = self[\"webpackChunksdk_web\"] || [];\nvar parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);\nchunkLoadingGlobal.push = installChunk;\n\n// no HMR\n\n// no HMR manifest","var next = __webpack_require__.x;\n__webpack_require__.x = () => {\n\treturn Promise.all([\n\n\t]).then(next);\n};","","// run startup\nvar __webpack_exports__ = __webpack_require__.x();\n",""],"names":[],"ignoreList":[],"sourceRoot":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c1.index.umd.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACXA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACRA;AACA;AACA;AACA;AACA;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACNA;AACA;AACA;AACA;AACA;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;;;;;AELA;AACA","sources":["webpack://sdk_web/webpack/universalModuleDefinition","webpack://sdk_web/./lib/src/worker/db/SharedWASQLiteConnection.js","webpack://sdk_web/./lib/src/worker/db/WASQLiteDB.worker.js","webpack://sdk_web/./lib/src/worker/db/WorkerWASQLiteConnection.js","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite\"","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"","webpack://sdk_web/external umd \"@powersync/common\"","webpack://sdk_web/external umd \"async-mutex\"","webpack://sdk_web/external umd \"comlink\"","webpack://sdk_web/webpack/bootstrap","webpack://sdk_web/webpack/runtime/chunk loaded","webpack://sdk_web/webpack/runtime/create fake namespace object","webpack://sdk_web/webpack/runtime/define property getters","webpack://sdk_web/webpack/runtime/ensure chunk","webpack://sdk_web/webpack/runtime/get javascript chunk filename","webpack://sdk_web/webpack/runtime/global","webpack://sdk_web/webpack/runtime/hasOwnProperty shorthand","webpack://sdk_web/webpack/runtime/make namespace object","webpack://sdk_web/webpack/runtime/node module decorator","webpack://sdk_web/webpack/runtime/publicPath","webpack://sdk_web/webpack/runtime/importScripts chunk loading","webpack://sdk_web/webpack/runtime/startup chunk dependencies","webpack://sdk_web/webpack/before-startup","webpack://sdk_web/webpack/startup","webpack://sdk_web/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@journeyapps/wa-sqlite\"), require(\"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"), require(\"@powersync/common\"), require(\"async-mutex\"), require(\"comlink\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@journeyapps/wa-sqlite\", \"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\", \"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\", \"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\", \"@powersync/common\", \"async-mutex\", \"comlink\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"sdk_web\"] = factory(require(\"@journeyapps/wa-sqlite\"), require(\"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"), require(\"@powersync/common\"), require(\"async-mutex\"), require(\"comlink\"));\n\telse\n\t\troot[\"sdk_web\"] = factory(root[\"@journeyapps/wa-sqlite\"], root[\"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"], root[\"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"], root[\"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"], root[\"@powersync/common\"], root[\"async-mutex\"], root[\"comlink\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_AccessHandlePoolVFS_js__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_IDBBatchAtomicVFS_js__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_OPFSCoopSyncVFS_js__, __WEBPACK_EXTERNAL_MODULE__powersync_common__, __WEBPACK_EXTERNAL_MODULE_async_mutex__, __WEBPACK_EXTERNAL_MODULE_comlink__) => {\nreturn ","export class SharedWASQLiteConnection {\n options;\n isClosing;\n // Keeps track if this current hold if the shared connection has a hold\n activeHoldId;\n constructor(options) {\n this.options = options;\n // Add this client ID to the set of known clients\n this.clientIds.add(options.clientId);\n this.isClosing = false;\n this.activeHoldId = null;\n }\n get logger() {\n return this.options.logger;\n }\n get dbEntry() {\n return this.options.dbMap.get(this.options.dbFilename);\n }\n get connection() {\n return this.dbEntry.db;\n }\n get clientIds() {\n return this.dbEntry.clientIds;\n }\n async init() {\n // No-op since the connection is already initialized when it was created\n }\n async markHold() {\n this.activeHoldId = await this.connection.markHold();\n return this.activeHoldId;\n }\n async releaseHold(id) {\n try {\n await this.connection.releaseHold(id);\n }\n finally {\n this.activeHoldId = null;\n }\n }\n async isAutoCommit() {\n return this.connection.isAutoCommit();\n }\n /**\n * Handles closing of a shared connection.\n * The connection is only closed if there are no active clients using it.\n */\n async close() {\n // This prevents further statements on this connection from being executed\n this.isClosing = true;\n const { clientIds, logger } = this;\n const { clientId, dbFilename, dbMap } = this.options;\n logger.debug(`Close requested from client ${clientId} of ${[...clientIds]}`);\n clientIds.delete(clientId);\n if (this.activeHoldId) {\n // We can't cleanup here since we're not in a lock context.\n // The cleanup will occur once a new hold is acquired.\n this.logger.info(`Hold ${this.activeHoldId} was still active when the connection was closed. Cleanup will occur once a new hold is acquired.`);\n }\n if (clientIds.size == 0) {\n logger.debug(`Closing connection to ${this.options}.`);\n const connection = this.connection;\n dbMap.delete(dbFilename);\n await connection.close();\n return;\n }\n logger.debug(`Connection to ${dbFilename} not closed yet due to active clients.`);\n return;\n }\n async withClosing(action) {\n if (this.isClosing) {\n throw new Error('Connection is closing');\n }\n return action();\n }\n async execute(sql, params) {\n return this.withClosing(() => this.connection.execute(sql, params));\n }\n async executeRaw(sql, params) {\n return this.withClosing(() => this.connection.executeRaw(sql, params));\n }\n executeBatch(sql, params) {\n return this.withClosing(() => this.connection.executeBatch(sql, params));\n }\n registerOnTableChange(callback) {\n return this.connection.registerOnTableChange(callback);\n }\n getConfig() {\n return this.connection.getConfig();\n }\n}\n","/**\n * Supports both shared and dedicated workers, based on how the worker is constructed (new SharedWorker vs new Worker()).\n */\nimport '@journeyapps/wa-sqlite';\nimport { createBaseLogger, createLogger } from '@powersync/common';\nimport * as Comlink from 'comlink';\nimport { getNavigatorLocks } from '../../shared/navigator.js';\nimport { SharedWASQLiteConnection } from './SharedWASQLiteConnection.js';\nimport { WorkerWASQLiteConnection } from './WorkerWASQLiteConnection.js';\nconst baseLogger = createBaseLogger();\nbaseLogger.useDefaults();\nconst logger = createLogger('db-worker');\nconst DBMap = new Map();\nconst OPEN_DB_LOCK = 'open-wasqlite-db';\nlet nextClientId = 1;\nconst openDBShared = async (options) => {\n // Prevent multiple simultaneous opens from causing race conditions\n return getNavigatorLocks().request(OPEN_DB_LOCK, async () => {\n const clientId = nextClientId++;\n const { dbFilename, logLevel } = options;\n logger.setLevel(logLevel);\n if (!DBMap.has(dbFilename)) {\n const clientIds = new Set();\n // This format returns proxy objects for function callbacks\n const connection = new WorkerWASQLiteConnection(options);\n await connection.init();\n connection.registerListener({\n holdOverwritten: async () => {\n /**\n * The previous hold has been overwritten, without being released.\n * we need to cleanup any resources associated with it.\n * We can perform a rollback to release any potential transactions that were started.\n */\n await connection.execute('ROLLBACK').catch(() => { });\n }\n });\n DBMap.set(dbFilename, {\n clientIds,\n db: connection\n });\n }\n // Associates this clientId with the shared connection entry\n const sharedConnection = new SharedWASQLiteConnection({\n dbMap: DBMap,\n dbFilename,\n clientId,\n logger\n });\n return Comlink.proxy(sharedConnection);\n });\n};\n// Check if we're in a SharedWorker context\nif (typeof SharedWorkerGlobalScope !== 'undefined') {\n const _self = self;\n _self.onconnect = function (event) {\n const port = event.ports[0];\n Comlink.expose(openDBShared, port);\n };\n}\nelse {\n // A dedicated worker can be shared externally\n Comlink.expose(openDBShared);\n}\naddEventListener('unload', () => {\n Array.from(DBMap.values()).forEach(async (dbConnection) => {\n const { db } = dbConnection;\n db.close?.();\n });\n});\n","import * as Comlink from 'comlink';\nimport { WASqliteConnection } from '../../db/adapters/wa-sqlite/WASQLiteConnection.js';\n/**\n * A Small proxy wrapper around the WASqliteConnection.\n * This ensures that certain return types are properly proxied.\n */\nexport class WorkerWASQLiteConnection extends WASqliteConnection {\n async registerOnTableChange(callback) {\n // Proxy the callback remove function\n return Comlink.proxy(await super.registerOnTableChange(callback));\n }\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite__;","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_AccessHandlePoolVFS_js__;","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_IDBBatchAtomicVFS_js__;","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_OPFSCoopSyncVFS_js__;","module.exports = __WEBPACK_EXTERNAL_MODULE__powersync_common__;","module.exports = __WEBPACK_EXTERNAL_MODULE_async_mutex__;","module.exports = __WEBPACK_EXTERNAL_MODULE_comlink__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Check if module exists (development only)\n\tif (__webpack_modules__[moduleId] === undefined) {\n\t\tvar e = new Error(\"Cannot find module '\" + moduleId + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n// the startup function\n__webpack_require__.x = () => {\n\t// Load entry module and return exports\n\t// This entry module depends on other loaded chunks and execution need to be delayed\n\tvar __webpack_exports__ = __webpack_require__.O(undefined, [\"main\"], () => (__webpack_require__(\"./lib/src/worker/db/WASQLiteDB.worker.js\")))\n\t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n\treturn __webpack_exports__;\n};\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks and chunks that the entrypoint depends on\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/^blob:/, \"\").replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","__webpack_require__.b = self.location + \"\";\n\n// object to store loaded chunks\n// \"1\" means \"already loaded\"\nvar installedChunks = {\n\t\"_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-685f6c1\": 1\n};\n\n// importScripts chunk loading\nvar installChunk = (data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\tfor(var moduleId in moreModules) {\n\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\twhile(chunkIds.length)\n\t\tinstalledChunks[chunkIds.pop()] = 1;\n\tparentChunkLoadingFunction(data);\n};\n__webpack_require__.f.i = (chunkId, promises) => {\n\t// \"1\" is the signal for \"already loaded\"\n\tif(!installedChunks[chunkId]) {\n\t\tif(true) { // all chunks have JS\n\t\t\timportScripts(__webpack_require__.p + __webpack_require__.u(chunkId));\n\t\t}\n\t}\n};\n\nvar chunkLoadingGlobal = self[\"webpackChunksdk_web\"] = self[\"webpackChunksdk_web\"] || [];\nvar parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);\nchunkLoadingGlobal.push = installChunk;\n\n// no HMR\n\n// no HMR manifest","var next = __webpack_require__.x;\n__webpack_require__.x = () => {\n\treturn Promise.all([\n\n\t]).then(next);\n};","","// run startup\nvar __webpack_exports__ = __webpack_require__.x();\n",""],"names":[],"ignoreList":[],"sourceRoot":""}
|