@powersync/web 0.0.0-dev-20250922104723 → 0.0.0-dev-20250922105207

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.
Files changed (49) hide show
  1. package/dist/2dcb8a60ed4b341d3046.wasm +0 -0
  2. package/dist/50eaffc7435d7a77ffb5.wasm +0 -0
  3. package/dist/88ca2d3820062df8ea26.wasm +0 -0
  4. package/dist/efe40e50208db1807722.wasm +0 -0
  5. package/dist/index.umd.js +103 -72
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/worker/SharedSyncImplementation.umd.js +112 -221
  8. package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
  9. package/dist/worker/WASQLiteDB.umd.js +232 -121
  10. package/dist/worker/WASQLiteDB.umd.js.map +1 -1
  11. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js +15 -3
  12. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js.map +1 -1
  13. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js +15 -3
  14. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js.map +1 -1
  15. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js +15 -3
  16. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js.map +1 -1
  17. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +15 -3
  18. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +1 -1
  19. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js +46 -218
  20. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js.map +1 -1
  21. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js +46 -218
  22. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js.map +1 -1
  23. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js +46 -218
  24. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js.map +1 -1
  25. package/lib/package.json +4 -4
  26. package/lib/src/db/PowerSyncDatabase.js +3 -1
  27. package/lib/src/db/adapters/AsyncDatabaseConnection.d.ts +13 -1
  28. package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.d.ts +3 -1
  29. package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js +28 -2
  30. package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.d.ts +1 -1
  31. package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +6 -2
  32. package/lib/src/db/sync/SSRWebStreamingSyncImplementation.d.ts +0 -4
  33. package/lib/src/db/sync/SSRWebStreamingSyncImplementation.js +0 -4
  34. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.d.ts +3 -8
  35. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +2 -22
  36. package/lib/src/worker/db/LogHandler.d.ts +12 -0
  37. package/lib/src/worker/db/LogHandler.js +6 -0
  38. package/lib/src/worker/db/WASQLiteDB.worker.js +80 -17
  39. package/lib/src/worker/sync/SharedSyncImplementation.d.ts +6 -14
  40. package/lib/src/worker/sync/SharedSyncImplementation.js +4 -28
  41. package/lib/src/worker/sync/SharedSyncImplementation.worker.js +19 -3
  42. package/lib/tsconfig.tsbuildinfo +1 -1
  43. package/package.json +5 -5
  44. package/dist/31ba59416bad61e8fb1f.wasm +0 -0
  45. package/dist/d0a1e43030b814ed322f.wasm +0 -0
  46. package/dist/f4ad8bfeb6e6e5326142.wasm +0 -0
  47. package/dist/fbde47713220d7baec73.wasm +0 -0
  48. package/lib/src/worker/sync/WorkerClient.d.ts +0 -32
  49. package/lib/src/worker/sync/WorkerClient.js +0 -84
@@ -1,84 +0,0 @@
1
- import * as Comlink from 'comlink';
2
- import { SharedSyncClientEvent } from './SharedSyncImplementation';
3
- import { getNavigatorLocks } from '../../shared/navigator';
4
- /**
5
- * A client to the shared sync worker.
6
- *
7
- * The shared sync implementation needs a per-client view of subscriptions so that subscriptions of closed tabs can
8
- * automatically be evicted later.
9
- */
10
- export class WorkerClient {
11
- sync;
12
- port;
13
- resolvedPort = null;
14
- constructor(sync, port) {
15
- this.sync = sync;
16
- this.port = port;
17
- }
18
- async initialize() {
19
- /**
20
- * Adds an extra listener which can remove this port
21
- * from the list of monitored ports.
22
- */
23
- this.port.addEventListener('message', async (event) => {
24
- const payload = event.data;
25
- if (payload?.event == SharedSyncClientEvent.CLOSE_CLIENT) {
26
- await this.removePort();
27
- }
28
- });
29
- this.resolvedPort = await this.sync.addPort(this.port);
30
- Comlink.expose(this, this.port);
31
- }
32
- async removePort() {
33
- if (this.resolvedPort) {
34
- const release = await this.sync.removePort(this.resolvedPort);
35
- this.resolvedPort = null;
36
- this.port.postMessage({
37
- event: SharedSyncClientEvent.CLOSE_ACK,
38
- data: {}
39
- });
40
- release?.();
41
- }
42
- }
43
- /**
44
- * Called by a client after obtaining a lock with a random name.
45
- *
46
- * When the client tab is closed, its lock will be returned. So when the shared worker attempts to acquire the lock,
47
- * it can consider the connection to be closed.
48
- */
49
- addLockBasedCloseSignal(name) {
50
- getNavigatorLocks().request(name, async () => {
51
- await this.removePort();
52
- });
53
- }
54
- setLogLevel(level) {
55
- this.sync.setLogLevel(level);
56
- }
57
- triggerCrudUpload() {
58
- return this.sync.triggerCrudUpload();
59
- }
60
- setParams(params, subscriptions) {
61
- this.resolvedPort.currentSubscriptions = subscriptions;
62
- return this.sync.setParams(params);
63
- }
64
- getWriteCheckpoint() {
65
- return this.sync.getWriteCheckpoint();
66
- }
67
- hasCompletedSync() {
68
- return this.sync.hasCompletedSync();
69
- }
70
- connect(options) {
71
- return this.sync.connect(options);
72
- }
73
- updateSubscriptions(subscriptions) {
74
- if (this.resolvedPort) {
75
- this.sync.updateSubscriptions(this.resolvedPort, subscriptions);
76
- }
77
- }
78
- disconnect() {
79
- return this.sync.disconnect();
80
- }
81
- async _testUpdateAllStatuses(status) {
82
- return this.sync._testUpdateAllStatuses(status);
83
- }
84
- }