@powersync/web 0.0.0-dev-20260202163643 → 0.0.0-dev-20260225163712
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/0b773f34701fc3938b2f.wasm +0 -0
- package/dist/687fe6480511183aa1de.wasm +0 -0
- package/dist/87c58d5d82e1759b558e.wasm +0 -0
- package/dist/90aaeb7a1019ddabcbd4.wasm +0 -0
- package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js +70 -70
- 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-2530150.index.umd.js → _journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-97ebe9.index.umd.js} +77 -77
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-97ebe9.index.umd.js.map +1 -0
- package/dist/index.umd.js +4072 -202
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +18283 -18255
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +16948 -16920
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/dist/worker/node_modules_pnpm_bson_6_10_4_node_modules_bson_lib_bson_mjs.umd.js.map +1 -1
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--2a0897.umd.js} +18 -18
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--2a0897.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--2cbf50.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--2cbf50.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--3f11fc.umd.js +3375 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--3f11fc.umd.js.map +1 -0
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--416f63.umd.js} +20 -20
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--416f63.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--8c697a.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--8c697a.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--dccfb9.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--dccfb9.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--f02f25.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--f02f25.umd.js.map +1 -0
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--f08dda.umd.js} +24 -24
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--f08dda.umd.js.map +1 -0
- package/lib/package.json +3 -3
- package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.js +4 -2
- package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.d.ts +10 -1
- package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js +36 -21
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -0
- package/lib/src/worker/db/open-worker-database.js +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.ts +4 -3
- package/src/db/adapters/wa-sqlite/WASQLiteConnection.ts +41 -19
- package/src/index.ts +1 -0
- package/src/worker/db/open-worker-database.ts +2 -2
- package/dist/0b19af1befc07ce338dd.wasm +0 -0
- package/dist/2632c3bda9473da74fd5.wasm +0 -0
- package/dist/64f5351ba3784bfe2f3e.wasm +0 -0
- package/dist/9318ca94aac4d0fe0135.wasm +0 -0
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js.map +0 -1
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js +0 -555
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf.umd.js +0 -44
- 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 +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779.umd.js +0 -44
- 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 +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js +0 -44
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +0 -44
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.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-20260225163712",
|
|
4
4
|
"description": "PowerSync Web SDK",
|
|
5
5
|
"main": "lib/src/index.js",
|
|
6
6
|
"module": "lib/src/index.js",
|
|
@@ -55,18 +55,18 @@
|
|
|
55
55
|
"author": "JOURNEYAPPS",
|
|
56
56
|
"license": "Apache-2.0",
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@journeyapps/wa-sqlite": "
|
|
59
|
-
"@powersync/common": "
|
|
58
|
+
"@journeyapps/wa-sqlite": "0.0.0-dev-20260225162137",
|
|
59
|
+
"@powersync/common": "^1.47.0"
|
|
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": "
|
|
66
|
+
"@powersync/common": "1.47.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@journeyapps/wa-sqlite": "
|
|
69
|
+
"@journeyapps/wa-sqlite": "0.0.0-dev-20260225162137",
|
|
70
70
|
"@types/uuid": "^9.0.6",
|
|
71
71
|
"crypto-browserify": "^3.12.0",
|
|
72
72
|
"glob": "^11.0.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LockedAsyncDatabaseAdapter } from '../LockedAsyncDatabaseAdapter.js';
|
|
2
2
|
import { WebDBAdapterConfiguration } from '../WebDBAdapter.js';
|
|
3
|
-
import { WASQLiteVFS } from './WASQLiteConnection.js';
|
|
3
|
+
import { needsDedicatedWorker, WASQLiteVFS } from './WASQLiteConnection.js';
|
|
4
4
|
import { ResolvedWASQLiteOpenFactoryOptions } from './WASQLiteOpenFactory.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -16,8 +16,9 @@ export class InternalWASQLiteDBAdapter extends LockedAsyncDatabaseAdapter {
|
|
|
16
16
|
const baseConfig = super.getConfiguration() as unknown as ResolvedWASQLiteOpenFactoryOptions;
|
|
17
17
|
return {
|
|
18
18
|
...super.getConfiguration(),
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// If the database is hosted in a dedicated worker, we can't expect in-memory triggers to be shared across tabs
|
|
20
|
+
// (since each tab has its own independent connection).
|
|
21
|
+
requiresPersistentTriggers: needsDedicatedWorker(baseConfig.vfs)
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
}
|
|
@@ -3,13 +3,31 @@ import { BaseObserver, BatchedUpdateNotification } from '@powersync/common';
|
|
|
3
3
|
import { Mutex } from 'async-mutex';
|
|
4
4
|
import { AsyncDatabaseConnection, OnTableChangeCallback, ProxiedQueryResult } from '../AsyncDatabaseConnection.js';
|
|
5
5
|
import { ResolvedWASQLiteOpenFactoryOptions } from './WASQLiteOpenFactory.js';
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* List of currently tested virtual filesystems
|
|
8
9
|
*/
|
|
9
10
|
export enum WASQLiteVFS {
|
|
10
11
|
IDBBatchAtomicVFS = 'IDBBatchAtomicVFS',
|
|
11
12
|
OPFSCoopSyncVFS = 'OPFSCoopSyncVFS',
|
|
12
|
-
AccessHandlePoolVFS = 'AccessHandlePoolVFS'
|
|
13
|
+
AccessHandlePoolVFS = 'AccessHandlePoolVFS',
|
|
14
|
+
OPFSWriteAheadVFS = 'OPFSWriteAheadVFS'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Whether the given `vfs` needs to be hosted by a dedicated worker.
|
|
19
|
+
*/
|
|
20
|
+
export function needsDedicatedWorker(vfs: WASQLiteVFS) {
|
|
21
|
+
vfs == WASQLiteVFS.AccessHandlePoolVFS || vfs == WASQLiteVFS.OPFSCoopSyncVFS;
|
|
22
|
+
|
|
23
|
+
switch (vfs) {
|
|
24
|
+
case WASQLiteVFS.OPFSCoopSyncVFS:
|
|
25
|
+
case WASQLiteVFS.AccessHandlePoolVFS:
|
|
26
|
+
case WASQLiteVFS.OPFSWriteAheadVFS:
|
|
27
|
+
return true;
|
|
28
|
+
default:
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
13
31
|
}
|
|
14
32
|
|
|
15
33
|
/**
|
|
@@ -89,12 +107,7 @@ export const MultiCipherSyncWASQLiteModuleFactory = async () => {
|
|
|
89
107
|
*/
|
|
90
108
|
export const DEFAULT_MODULE_FACTORIES = {
|
|
91
109
|
[WASQLiteVFS.IDBBatchAtomicVFS]: async (options: WASQLiteModuleFactoryOptions) => {
|
|
92
|
-
|
|
93
|
-
if (options.encryptionKey) {
|
|
94
|
-
module = await MultiCipherAsyncWASQLiteModuleFactory();
|
|
95
|
-
} else {
|
|
96
|
-
module = await AsyncWASQLiteModuleFactory();
|
|
97
|
-
}
|
|
110
|
+
const module = await loadModule(true, options);
|
|
98
111
|
const { IDBBatchAtomicVFS } = await import('@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js');
|
|
99
112
|
return {
|
|
100
113
|
module,
|
|
@@ -103,12 +116,7 @@ export const DEFAULT_MODULE_FACTORIES = {
|
|
|
103
116
|
};
|
|
104
117
|
},
|
|
105
118
|
[WASQLiteVFS.AccessHandlePoolVFS]: async (options: WASQLiteModuleFactoryOptions) => {
|
|
106
|
-
|
|
107
|
-
if (options.encryptionKey) {
|
|
108
|
-
module = await MultiCipherSyncWASQLiteModuleFactory();
|
|
109
|
-
} else {
|
|
110
|
-
module = await SyncWASQLiteModuleFactory();
|
|
111
|
-
}
|
|
119
|
+
const module = await loadModule(false, options);
|
|
112
120
|
// @ts-expect-error The types for this static method are missing upstream
|
|
113
121
|
const { AccessHandlePoolVFS } = await import('@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js');
|
|
114
122
|
return {
|
|
@@ -117,12 +125,7 @@ export const DEFAULT_MODULE_FACTORIES = {
|
|
|
117
125
|
};
|
|
118
126
|
},
|
|
119
127
|
[WASQLiteVFS.OPFSCoopSyncVFS]: async (options: WASQLiteModuleFactoryOptions) => {
|
|
120
|
-
|
|
121
|
-
if (options.encryptionKey) {
|
|
122
|
-
module = await MultiCipherSyncWASQLiteModuleFactory();
|
|
123
|
-
} else {
|
|
124
|
-
module = await SyncWASQLiteModuleFactory();
|
|
125
|
-
}
|
|
128
|
+
const module = await loadModule(false, options);
|
|
126
129
|
// @ts-expect-error The types for this static method are missing upstream
|
|
127
130
|
const { OPFSCoopSyncVFS } = await import('@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js');
|
|
128
131
|
const vfs = await OPFSCoopSyncVFS.create(options.dbFileName, module);
|
|
@@ -130,9 +133,28 @@ export const DEFAULT_MODULE_FACTORIES = {
|
|
|
130
133
|
module,
|
|
131
134
|
vfs
|
|
132
135
|
};
|
|
136
|
+
},
|
|
137
|
+
[WASQLiteVFS.OPFSWriteAheadVFS]: async (options: WASQLiteModuleFactoryOptions) => {
|
|
138
|
+
const module = await loadModule(false, options);
|
|
139
|
+
// @ts-expect-error The types for this static method are missing upstream
|
|
140
|
+
const { OPFSWriteAheadVFS } = await import('@journeyapps/wa-sqlite/src/examples/OPFSWriteAheadVFS.js');
|
|
141
|
+
const vfs = await OPFSWriteAheadVFS.create(options.dbFileName, module, {
|
|
142
|
+
// TODO: The asyncErrorHandler callback might be interesting to handle IDB failures, but it's not clear how we'd
|
|
143
|
+
// do that from here.
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
return { module, vfs };
|
|
133
147
|
}
|
|
134
148
|
};
|
|
135
149
|
|
|
150
|
+
async function loadModule(async: boolean, options: WASQLiteModuleFactoryOptions) {
|
|
151
|
+
if (async) {
|
|
152
|
+
return await (options.encryptionKey ? MultiCipherAsyncWASQLiteModuleFactory() : AsyncWASQLiteModuleFactory());
|
|
153
|
+
} else {
|
|
154
|
+
return await (options.encryptionKey ? MultiCipherSyncWASQLiteModuleFactory() : SyncWASQLiteModuleFactory());
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
136
158
|
/**
|
|
137
159
|
* @internal
|
|
138
160
|
* WA-SQLite connection which directly interfaces with WA-SQLite.
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Comlink from 'comlink';
|
|
2
2
|
import { OpenAsyncDatabaseConnection } from '../../db/adapters/AsyncDatabaseConnection.js';
|
|
3
|
-
import { WASQLiteVFS } from '../../db/adapters/wa-sqlite/WASQLiteConnection.js';
|
|
3
|
+
import { needsDedicatedWorker, WASQLiteVFS } from '../../db/adapters/wa-sqlite/WASQLiteConnection.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Opens a shared or dedicated worker which exposes opening of database connections
|
|
@@ -11,7 +11,7 @@ export function openWorkerDatabasePort(
|
|
|
11
11
|
worker: string | URL = '',
|
|
12
12
|
vfs?: WASQLiteVFS
|
|
13
13
|
) {
|
|
14
|
-
const needsDedicated = vfs
|
|
14
|
+
const needsDedicated = vfs && needsDedicatedWorker(vfs);
|
|
15
15
|
|
|
16
16
|
if (worker) {
|
|
17
17
|
return !needsDedicated && multipleTabs
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.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;;;;ACzCA;AACA;AACA;AACA;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;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/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\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\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};","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-2530150\": 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":""}
|