@powersync/web 2.6.0 → 2.7.0

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 (70) hide show
  1. package/dist/index.react_native_web.js +667 -140
  2. package/dist/index.react_native_web.js.map +1 -1
  3. package/dist/worker/{OPFSCoopSyncVFS-CDNBPKfy.js → OPFSCoopSyncVFS-Dujy2ZwX.js} +2 -2
  4. package/dist/worker/{OPFSCoopSyncVFS-CDNBPKfy.js.map → OPFSCoopSyncVFS-Dujy2ZwX.js.map} +1 -1
  5. package/dist/worker/SimpleOpfsFileSystem-6GYD1Xui.js +2 -0
  6. package/dist/worker/SimpleOpfsFileSystem-6GYD1Xui.js.map +1 -0
  7. package/dist/worker/worker.js +1 -1
  8. package/dist/worker/worker.js.map +1 -1
  9. package/lib/db/NavigatorTriggerClaimManager.js +1 -1
  10. package/lib/db/NavigatorTriggerClaimManager.js.map +1 -1
  11. package/lib/db/PowerSyncDatabase.js +1 -1
  12. package/lib/db/PowerSyncDatabase.js.map +1 -1
  13. package/lib/db/adapters/options.d.ts +25 -2
  14. package/lib/db/adapters/options.js.map +1 -1
  15. package/lib/db/adapters/wa-sqlite/ConcurrentConnection.d.ts +56 -7
  16. package/lib/db/adapters/wa-sqlite/ConcurrentConnection.js +130 -25
  17. package/lib/db/adapters/wa-sqlite/ConcurrentConnection.js.map +1 -1
  18. package/lib/db/adapters/wa-sqlite/DatabaseClient.d.ts +13 -0
  19. package/lib/db/adapters/wa-sqlite/DatabaseClient.js.map +1 -1
  20. package/lib/db/adapters/wa-sqlite/RawSqliteConnection.d.ts +2 -1
  21. package/lib/db/adapters/wa-sqlite/RawSqliteConnection.js +12 -6
  22. package/lib/db/adapters/wa-sqlite/RawSqliteConnection.js.map +1 -1
  23. package/lib/db/adapters/wa-sqlite/SimpleOpfsFileSystem.d.ts +30 -0
  24. package/lib/db/adapters/wa-sqlite/SimpleOpfsFileSystem.js +210 -0
  25. package/lib/db/adapters/wa-sqlite/SimpleOpfsFileSystem.js.map +1 -0
  26. package/lib/db/adapters/wa-sqlite/WASQLiteOpenFactory.d.ts +1 -0
  27. package/lib/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +178 -75
  28. package/lib/db/adapters/wa-sqlite/WASQLiteOpenFactory.js.map +1 -1
  29. package/lib/db/adapters/wa-sqlite/vfs.d.ts +30 -4
  30. package/lib/db/adapters/wa-sqlite/vfs.js +53 -2
  31. package/lib/db/adapters/wa-sqlite/vfs.js.map +1 -1
  32. package/lib/db/sync/SharedWebStreamingSyncImplementation.js +1 -1
  33. package/lib/db/sync/SharedWebStreamingSyncImplementation.js.map +1 -1
  34. package/lib/db/sync/WebStreamingSyncImplementation.js +1 -1
  35. package/lib/db/sync/WebStreamingSyncImplementation.js.map +1 -1
  36. package/lib/shared/{tab_close_signal.d.ts → locks.d.ts} +13 -0
  37. package/lib/shared/locks.js +56 -0
  38. package/lib/shared/locks.js.map +1 -0
  39. package/lib/worker/db/MultiDatabaseServer.js +37 -12
  40. package/lib/worker/db/MultiDatabaseServer.js.map +1 -1
  41. package/lib/worker/sync/SharedSyncImplementation.js +1 -1
  42. package/lib/worker/sync/SharedSyncImplementation.js.map +1 -1
  43. package/lib/worker/sync/WorkerClient.js +1 -1
  44. package/lib/worker/sync/WorkerClient.js.map +1 -1
  45. package/lib/worker/worker.js +67 -1
  46. package/lib/worker/worker.js.map +1 -1
  47. package/package.json +3 -3
  48. package/src/db/NavigatorTriggerClaimManager.ts +1 -1
  49. package/src/db/PowerSyncDatabase.ts +1 -1
  50. package/src/db/adapters/options.ts +27 -2
  51. package/src/db/adapters/wa-sqlite/ConcurrentConnection.ts +148 -34
  52. package/src/db/adapters/wa-sqlite/DatabaseClient.ts +16 -0
  53. package/src/db/adapters/wa-sqlite/RawSqliteConnection.ts +16 -7
  54. package/src/db/adapters/wa-sqlite/SimpleOpfsFileSystem.ts +249 -0
  55. package/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts +236 -97
  56. package/src/db/adapters/wa-sqlite/vfs.ts +61 -7
  57. package/src/db/sync/SharedWebStreamingSyncImplementation.ts +1 -1
  58. package/src/db/sync/WebStreamingSyncImplementation.ts +1 -1
  59. package/src/shared/locks.ts +66 -0
  60. package/src/worker/db/MultiDatabaseServer.ts +46 -12
  61. package/src/worker/sync/SharedSyncImplementation.ts +1 -1
  62. package/src/worker/sync/WorkerClient.ts +1 -1
  63. package/src/worker/worker.ts +82 -3
  64. package/lib/shared/navigator.d.ts +0 -1
  65. package/lib/shared/navigator.js +0 -7
  66. package/lib/shared/navigator.js.map +0 -1
  67. package/lib/shared/tab_close_signal.js +0 -27
  68. package/lib/shared/tab_close_signal.js.map +0 -1
  69. package/src/shared/navigator.ts +0 -9
  70. package/src/shared/tab_close_signal.ts +0 -28
@@ -1 +1 @@
1
- {"version":3,"file":"index.react_native_web.js","sources":["../lib/attachments/IndexDBFileSystemAdapter.js","../lib/db/adapters/wa-sqlite/vfs.js","../lib/db/adapters/SSRDBAdapter.js","../lib/db/adapters/wa-sqlite/DatabaseServer.js","../lib/shared/navigator.js","../lib/db/adapters/options.js","../lib/db/adapters/resolveAndValidateOptions.js","../lib/db/adapters/wa-sqlite/StatementCache.js","../lib/db/adapters/wa-sqlite/RawSqliteConnection.js","../lib/db/adapters/wa-sqlite/ConcurrentConnection.js","../lib/worker/db/MultiDatabaseServer.js","../lib/db/adapters/wa-sqlite/DatabaseClient.js","../lib/shared/tab_close_signal.js","../lib/db/adapters/acquireFromPool.js","../lib/db/adapters/AsyncWebAdapter.js","../lib/worker/client.js","../lib/db/adapters/wa-sqlite/WASQLiteOpenFactory.js","../lib/db/NavigatorTriggerClaimManager.js","../lib/db/sync/SSRWebStreamingSyncImplementation.js","../lib/worker/sync/AbstractSharedSyncClientProvider.js","../lib/db/sync/userAgent.js","../lib/db/sync/WebRemote.js","../lib/db/sync/WebStreamingSyncImplementation.js","../lib/worker/sync/SharedSyncImplementation.js","../lib/db/sync/SharedWebStreamingSyncImplementation.js","../lib/db/sync/TabLocalStreamingSyncImplementation.js","../lib/devtools/registry.js","../lib/db/PowerSyncDatabase.js"],"sourcesContent":["/**\n * IndexDBFileSystemStorageAdapter implements LocalStorageAdapter using IndexedDB.\n * Suitable for web browsers and web-based environments.\n */\nexport class IndexDBFileSystemStorageAdapter {\n databaseName;\n dbPromise;\n constructor(databaseName = 'PowerSyncFiles') {\n this.databaseName = databaseName;\n }\n async initialize() {\n this.dbPromise = new Promise((resolve, reject) => {\n const request = indexedDB.open(this.databaseName, 1);\n request.onupgradeneeded = () => {\n request.result.createObjectStore('files');\n };\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error);\n });\n }\n async clear() {\n const db = await this.dbPromise;\n return new Promise((resolve, reject) => {\n const tx = db.transaction('files', 'readwrite');\n const store = tx.objectStore('files');\n const req = store.clear();\n req.onsuccess = () => resolve();\n req.onerror = () => reject(req.error);\n });\n }\n getLocalUri(filename) {\n return `indexeddb://${this.databaseName}/files/${filename}`;\n }\n async getStore(mode = 'readonly') {\n const db = await this.dbPromise;\n const tx = db.transaction('files', mode);\n return tx.objectStore('files');\n }\n async saveFile(filePath, data) {\n const store = await this.getStore('readwrite');\n let dataToStore;\n let size;\n if (typeof data === 'string') {\n const binaryString = atob(data);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n dataToStore = bytes.buffer;\n size = bytes.byteLength;\n }\n else {\n dataToStore = data;\n size = dataToStore.byteLength;\n }\n return await new Promise((resolve, reject) => {\n const req = store.put(dataToStore, filePath);\n req.onsuccess = () => resolve(size);\n req.onerror = () => reject(req.error);\n });\n }\n async readFile(fileUri, options) {\n const store = await this.getStore();\n return new Promise((resolve, reject) => {\n const req = store.get(fileUri);\n req.onsuccess = async () => {\n if (!req.result) {\n reject(new Error('File not found'));\n return;\n }\n resolve(req.result);\n };\n req.onerror = () => reject(req.error);\n });\n }\n async deleteFile(uri, options) {\n const store = await this.getStore('readwrite');\n await new Promise((resolve, reject) => {\n const req = store.delete(uri);\n req.onsuccess = () => resolve();\n req.onerror = () => reject(req.error);\n });\n }\n async fileExists(fileUri) {\n const store = await this.getStore();\n return new Promise((resolve, reject) => {\n const req = store.get(fileUri);\n req.onsuccess = () => resolve(!!req.result);\n req.onerror = () => reject(req.error);\n });\n }\n async makeDir(path) {\n // No-op for IndexedDB as it does not have a directory structure\n }\n async rmDir(path) {\n const store = await this.getStore('readwrite');\n const range = IDBKeyRange.bound(path + '/', path + '/\\uffff', false, false);\n await new Promise((resolve, reject) => {\n const req = store.delete(range);\n req.onsuccess = () => resolve();\n req.onerror = () => reject(req.error);\n });\n }\n}\n//# sourceMappingURL=IndexDBFileSystemAdapter.js.map","/**\n * List of currently tested virtual filesystems\n */\nexport var WASQLiteVFS;\n(function (WASQLiteVFS) {\n WASQLiteVFS[\"IDBBatchAtomicVFS\"] = \"IDBBatchAtomicVFS\";\n WASQLiteVFS[\"OPFSCoopSyncVFS\"] = \"OPFSCoopSyncVFS\";\n WASQLiteVFS[\"AccessHandlePoolVFS\"] = \"AccessHandlePoolVFS\";\n WASQLiteVFS[\"OPFSWriteAheadVFS\"] = \"OPFSWriteAheadVFS\";\n /**\n * A virtual file system storing data in-memory only, without persistence.\n *\n * This file system can be used in three configurations:\n *\n * 1. In shared workers (the default when available): All tabs share the same in-memory database, which is cleared\n * once the last tab is closed.\n * 2. In dedicated workers (used when `enableMultiTabs` is disabled). Each tab has its own in-memory database cleared\n * when the tab is closed. Queries are offloaded to a dedicated worker.\n * 3. In the context of the tab itself (used when both `enableMultiTabs` and `useWebWorker` are disabled). The per-tab\n * database is hosted in the tab itself, and queries run synchronously. This is _a lot_ faster than any other\n * single-threadedVFS, but can block JavaScript for computationally-intensive queries.\n *\n * This VFS primarily intended for development, but it also useful for online-first deployments not syncing large\n * amounts of data, as it is quicker to start up.\n */\n WASQLiteVFS[\"InMemoryVfs\"] = \"InMemoryVFS\";\n})(WASQLiteVFS || (WASQLiteVFS = {}));\nexport function vfsRequiresDedicatedWorkers(vfs) {\n return vfs != WASQLiteVFS.IDBBatchAtomicVFS && vfs != WASQLiteVFS.InMemoryVfs;\n}\n/**\n * Whether the VFS can keep its files in a Storage Bucket, see {@link WebSpecificOpenOptions.storageBucket}.\n */\nexport function vfsSupportsStorageBuckets(vfs) {\n return (vfs == WASQLiteVFS.OPFSCoopSyncVFS || vfs == WASQLiteVFS.OPFSWriteAheadVFS || vfs == WASQLiteVFS.AccessHandlePoolVFS);\n}\n/**\n * Options for an OPFS-based VFS that keep its files in the named Storage Bucket, see\n * {@link WebSpecificOpenOptions.storageBucket}. Without a bucket name, no options: the VFS uses the root of the\n * origin private file system.\n *\n * @internal\n */\nexport function vfsOptionsForStorageBucket(storageBucket, storageBuckets = navigator.storageBuckets) {\n if (storageBucket == null) {\n return {};\n }\n if (storageBuckets == null) {\n throw new Error(`The 'storageBucket' option needs the Storage Buckets API (navigator.storageBuckets), which this browser does not have. Check for it before setting the option.`);\n }\n return {\n // Called by the VFS each time it needs its root directory. Opening the bucket again creates it when the\n // browser deleted it with the rest of the site's data.\n getRoot: () => storageBuckets.open(storageBucket).then((bucket) => bucket.getDirectory()),\n // Keeps the locks and channels of a file apart from those of a file of the same name in another bucket.\n // Bucket names cannot contain ':', so the names of two buckets never overlap.\n prefix: `${storageBucket}:`\n };\n}\nasync function asyncModuleFactory(encryptionKey) {\n if (encryptionKey) {\n const { default: factory } = await import('@journeyapps/wa-sqlite/dist/mc-wa-sqlite-async.mjs');\n return factory();\n }\n else {\n const { default: factory } = await import('@journeyapps/wa-sqlite/dist/wa-sqlite-async.mjs');\n return factory();\n }\n}\nasync function syncModuleFactory(encryptionKey) {\n if (encryptionKey) {\n const { default: factory } = await import('@journeyapps/wa-sqlite/dist/mc-wa-sqlite.mjs');\n return factory();\n }\n else {\n const { default: factory } = await import('@journeyapps/wa-sqlite/dist/wa-sqlite.mjs');\n return factory();\n }\n}\n/**\n * @internal\n */\nexport async function loadModuleAndVfs({ vfs, filename, encryptionKey, storageBucket }) {\n let moduleFactory = syncModuleFactory;\n let resolveVfs;\n switch (vfs) {\n case WASQLiteVFS.IDBBatchAtomicVFS: {\n moduleFactory = asyncModuleFactory;\n const { IDBBatchAtomicVFS } = await import('@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js');\n resolveVfs = (module) => {\n // @ts-expect-error The types for this static method are missing upstream\n return IDBBatchAtomicVFS.create(filename, module, { lockPolicy: 'exclusive' });\n };\n break;\n }\n case WASQLiteVFS.AccessHandlePoolVFS: {\n // @ts-expect-error The types for this import are missing upstream\n const { AccessHandlePoolVFS } = await import('@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js');\n resolveVfs = (module) => AccessHandlePoolVFS.create(filename, module, vfsOptionsForStorageBucket(storageBucket));\n break;\n }\n case WASQLiteVFS.OPFSCoopSyncVFS: {\n // @ts-expect-error The types for this import are missing upstream\n const { OPFSCoopSyncVFS } = await import('@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js');\n resolveVfs = (module) => OPFSCoopSyncVFS.create(filename, module, vfsOptionsForStorageBucket(storageBucket));\n break;\n }\n case WASQLiteVFS.OPFSWriteAheadVFS: {\n // @ts-expect-error The types for this import are missing upstream\n const { OPFSWriteAheadVFS } = await import('@journeyapps/wa-sqlite/src/examples/OPFSWriteAheadVFS.js');\n resolveVfs = (module) => OPFSWriteAheadVFS.create(filename, module, vfsOptionsForStorageBucket(storageBucket));\n break;\n }\n case WASQLiteVFS.InMemoryVfs: {\n const { MemoryVFS } = await import('@journeyapps/wa-sqlite/src/examples/MemoryVFS.js');\n // @ts-expect-error The types for this static method are missing upstream\n resolveVfs = (module) => MemoryVFS.create(filename, module);\n break;\n }\n }\n const module = await moduleFactory(encryptionKey);\n return { module, vfs: await resolveVfs(module) };\n}\n//# sourceMappingURL=vfs.js.map","import { DBAdapter, LockContext } from '@powersync/common';\nimport { Mutex } from '@powersync/shared-internals';\nconst MOCK_QUERY_RESPONSE = {\n rowsAffected: 0,\n columnNames: [],\n rawRows: []\n};\n/**\n * Implements a Mock DB adapter for use in Server Side Rendering (SSR).\n * This adapter will return empty results for queries, which will allow\n * server rendered views to initially generate scaffolding components\n */\nexport class SSRDBAdapter extends DBAdapter {\n name;\n readMutex;\n writeMutex;\n constructor() {\n super();\n this.name = 'SSR DB';\n this.readMutex = new Mutex();\n this.writeMutex = new Mutex();\n }\n close() { }\n async readLock(fn, options) {\n return fn(new StubLockContext());\n }\n async writeLock(fn, options) {\n return fn(new StubLockContext());\n }\n async refreshSchema() { }\n}\nclass StubLockContext extends LockContext {\n async executeRaw() {\n return MOCK_QUERY_RESPONSE;\n }\n}\n//# sourceMappingURL=SSRDBAdapter.js.map","import { LogLevels } from '@powersync/common';\n/**\n * Access to a WA-sqlite connection that can be shared with multiple clients sending queries over an RPC protocol built\n * with the Comlink package.\n */\nexport class DatabaseServer {\n #options;\n #nextClientId = 0;\n #activeClients = new Set();\n // TODO: Don't use a broadcast channel for connections managed by a shared worker.\n #updateBroadcastChannel;\n #clientTableListeners = new Set();\n constructor(options) {\n this.#options = options;\n const inner = options.inner;\n this.#updateBroadcastChannel = new BroadcastChannel(`${inner.options.filename}-table-updates`);\n this.#updateBroadcastChannel.onmessage = ({ data }) => {\n this.#pushTableUpdateToClients(data);\n };\n }\n #pushTableUpdateToClients(changedTables) {\n for (const listener of this.#clientTableListeners) {\n listener.postMessage(changedTables);\n }\n }\n get #inner() {\n return this.#options.inner;\n }\n get #logger() {\n return this.#options.logger;\n }\n /**\n * Called by clients when they wish to connect to this database.\n *\n * @param lockName A lock that is currently held by the client. When the lock is returned, we know the client is gone\n * and that we need to clean up resources.\n */\n async connect(lockName) {\n let isOpen = true;\n const clientId = this.#nextClientId++;\n this.#activeClients.add(clientId);\n let connectionLeases = new Map();\n let currentTableListener;\n function requireOpen() {\n if (!isOpen) {\n throw new Error('Client has already been closed');\n }\n }\n function requireOpenAndLease(lease) {\n requireOpen();\n const token = connectionLeases.get(lease);\n if (!token) {\n throw new Error('Attempted to use a connection lease that has already been returned.');\n }\n return token;\n }\n const close = async () => {\n if (isOpen) {\n isOpen = false;\n if (currentTableListener) {\n this.#clientTableListeners.delete(currentTableListener);\n }\n // If the client holds a connection lease it hasn't returned, return that now.\n for (const { lease } of connectionLeases.values()) {\n this.#logger.log({ level: LogLevels.debug, message: `Closing connection lease that hasn't been returned.` });\n await lease.returnLease();\n }\n this.#activeClients.delete(clientId);\n if (this.#activeClients.size == 0) {\n await this.forceClose();\n }\n else {\n this.#logger.log({\n level: LogLevels.debug,\n message: 'Keeping underlying connection active since its used by other clients.'\n });\n }\n }\n };\n if (lockName) {\n navigator.locks.request(lockName, {}, () => {\n close();\n });\n }\n return {\n close,\n debugIsAutoCommit: async () => {\n return this.#inner.unsafeUseInner().isAutoCommit();\n },\n requestAccess: async (write, timeoutMs) => {\n requireOpen();\n const lease = await this.#inner.acquireConnection(timeoutMs != null ? AbortSignal.timeout(timeoutMs) : undefined);\n if (!isOpen) {\n // Race between requestAccess and close(), the connection was closed while we tried to acquire a lease.\n await lease.returnLease();\n return requireOpen();\n }\n const token = crypto.randomUUID();\n connectionLeases.set(token, { lease, write });\n return token;\n },\n completeAccess: async (token) => {\n const lease = requireOpenAndLease(token);\n connectionLeases.delete(token);\n try {\n if (lease.write) {\n // Collect update hooks invoked while the client had the write connection.\n const { rawRows } = await lease.lease.use((conn) => conn.execute(`SELECT powersync_update_hooks('get')`));\n if (rawRows.length) {\n const updatedTables = JSON.parse(rawRows[0][0]);\n if (updatedTables.length) {\n this.#updateBroadcastChannel.postMessage(updatedTables);\n this.#pushTableUpdateToClients(updatedTables);\n }\n }\n }\n }\n finally {\n await lease.lease.returnLease();\n }\n },\n execute: async (token, sql, params) => {\n const { lease } = requireOpenAndLease(token);\n return await lease.use((db) => db.execute(sql, params));\n },\n executeBatch: async (token, sql, params) => {\n const { lease } = requireOpenAndLease(token);\n return await lease.use((db) => db.executeBatch(sql, params));\n },\n setUpdateListener: async (listener) => {\n requireOpen();\n if (currentTableListener) {\n this.#clientTableListeners.delete(currentTableListener);\n }\n currentTableListener = listener;\n if (listener) {\n this.#clientTableListeners.add(listener);\n }\n }\n };\n }\n async forceClose() {\n this.#logger.log({\n level: LogLevels.debug,\n message: `Closing connection to ${JSON.stringify(this.#inner.options)}.`\n });\n const connection = this.#inner;\n this.#options.onClose();\n this.#updateBroadcastChannel.close();\n await connection.close();\n }\n}\n//# sourceMappingURL=DatabaseServer.js.map","export const getNavigatorLocks = () => {\n if ('locks' in navigator && navigator.locks) {\n return navigator.locks;\n }\n throw new Error('Navigator locks are not available in an insecure context. Use a secure context such as HTTPS or http://localhost.');\n};\n//# sourceMappingURL=navigator.js.map","export var TemporaryStorageOption;\n(function (TemporaryStorageOption) {\n TemporaryStorageOption[\"MEMORY\"] = \"memory\";\n TemporaryStorageOption[\"FILESYSTEM\"] = \"file\";\n})(TemporaryStorageOption || (TemporaryStorageOption = {}));\n//# sourceMappingURL=options.js.map","import { LogLevels } from '@powersync/common';\nimport { TemporaryStorageOption } from './options.js';\nimport { vfsRequiresDedicatedWorkers, vfsSupportsStorageBuckets, WASQLiteVFS } from './wa-sqlite/vfs.js';\n/**\n * The maximum length of a db filename we support.\n *\n * We configure the same on WA-SQLite (which otherwise defaults to a maximum length of 64). We don't want to support\n * very long path names as Safari maps OPFS files directly to OS files, and APFS has a 255-byte filename limit. Since\n * some VFS append additional characters for pooled file access handles, we want to stay well below that.\n */\nexport const maxPathNameLength = 128;\n/**\n * @internal\n */\nexport function resolveAndValidateOptions(options) {\n const defaults = {\n disableSSRWarning: false,\n ssrMode: !('window' in globalThis),\n /**\n * Multiple tabs are by default not supported on Android, iOS and Safari.\n * Other platforms will have multiple tabs enabled by default.\n */\n enableMultiTabs: typeof globalThis.navigator !== 'undefined' && // For SSR purposes\n typeof SharedWorker !== 'undefined' &&\n !navigator.userAgent.match(/(Android|iPhone|iPod|iPad)/i) &&\n !window.safari,\n useWebWorker: true,\n databaseWorkerLogLevel: LogLevels.info,\n temporaryStorage: TemporaryStorageOption.MEMORY,\n cacheSizeKb: 50 * 1024,\n encryptionKey: undefined,\n vfs: WASQLiteVFS.IDBBatchAtomicVFS,\n additionalReaders: 1\n };\n const resolved = Object.assign(defaults, options);\n if (vfsRequiresDedicatedWorkers(resolved.vfs) && !resolved.useWebWorker) {\n throw new Error(`Invalid configuration: The 'useWebWorker' flag must be true when using an OPFS-based VFS (${resolved.vfs}).`);\n }\n if (resolved.storageBucket != null) {\n if (!vfsSupportsStorageBuckets(resolved.vfs)) {\n throw new Error(`Invalid configuration: The 'storageBucket' option needs an OPFS-based VFS, which ${resolved.vfs} is not.`);\n }\n }\n return resolved;\n}\n//# sourceMappingURL=resolveAndValidateOptions.js.map","export class PreparedStatementCache {\n #size;\n // Note that Map preserves insertion order, which allows using it as an LRU\n // cache (with the first element being the first element to evict).\n #statements = new Map();\n constructor(size) {\n this.#size = size;\n }\n /**\n * Attempts to look up the cached sql statement, if it's currently cached.\n */\n lookup(sql) {\n const foundStatement = this.#statements.get(sql);\n if (foundStatement != null) {\n // Delete and re-insert to move to the end (most-recently-used position).\n this.#statements.delete(sql);\n this.#statements.set(sql, foundStatement);\n return foundStatement;\n }\n return null;\n }\n /**\n * Adds a new statement into the cache.\n *\n * If that exceeds the target size of the statement cache, returns an old statement to evict.\n * The caller is responsible for freeing that statement.\n */\n addStatement(sql, statement) {\n this.#statements.set(sql, statement);\n if (this.#statements.size > this.#size) {\n for (const [k, v] of this.#statements.entries()) {\n this.#statements.delete(k);\n return v;\n }\n }\n return null;\n }\n drain() {\n const values = [...this.#statements.values()];\n this.#statements.clear();\n return values;\n }\n}\n//# sourceMappingURL=StatementCache.js.map","import { Factory as WaSqliteFactory, SQLITE_ROW } from '@journeyapps/wa-sqlite';\nimport { loadModuleAndVfs } from './vfs.js';\nimport { maxPathNameLength } from '../resolveAndValidateOptions.js';\nimport { PreparedStatementCache } from './StatementCache.js';\n/**\n * A small wrapper around WA-sqlite to help with opening databases and running statements by preparing them internally.\n *\n * This is an internal class, and it must never be used directly. Wrappers are required to ensure raw connections aren't\n * used concurrently across tabs.\n */\nexport class RawSqliteConnection {\n options;\n _sqliteAPI = null;\n sqlite3_stmt_isexplain;\n /**\n * The `sqlite3*` connection pointer.\n */\n db = 0;\n statementCache;\n constructor(options) {\n this.options = options;\n this.statementCache =\n options.preparedStatementsCache > 0 ? new PreparedStatementCache(options.preparedStatementsCache) : null;\n }\n get isOpen() {\n return this.db != 0;\n }\n async init() {\n const { module, vfs } = await loadModuleAndVfs(this.options);\n await this.initWithModule(module, vfs);\n }\n async initWithModule(module, vfs) {\n const api = (this._sqliteAPI = await this.openSQLiteAPI(module, vfs));\n this.db = await api.open_v2(this.options.filename, this.options.readonly ? 1 /* SQLITE_OPEN_READONLY */ : 6 /* SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE */);\n await this.executeRaw(`PRAGMA temp_store = ${this.options.temporaryStorage};`);\n if (this.options.encryptionKey) {\n const escapedKey = this.options.encryptionKey.replaceAll(\"'\", \"''\");\n await this.executeRaw(`PRAGMA key = '${escapedKey}';`);\n }\n await this.executeRaw(`PRAGMA cache_size = -${this.options.cacheSizeKb};`);\n await this.executeRaw(`SELECT powersync_update_hooks('install');`);\n }\n async openSQLiteAPI(module, vfs) {\n vfs.mxPathname = maxPathNameLength;\n this.sqlite3_stmt_isexplain = module.cwrap('sqlite3_stmt_isexplain', 'int', ['int']);\n const sqlite3 = WaSqliteFactory(module);\n sqlite3.vfs_register(vfs, true);\n /**\n * Register the PowerSync core and additional statically linked extensions\n */\n for (const name of ['powersync_init_static', ...(this.options.additionalInitializationFunctions ?? [])]) {\n const result = module.ccall(name, 'int', []);\n if (result !== 0) {\n throw new Error(`SQLite extension initializer ${name} failed with code ${result}`);\n }\n }\n /**\n * Create the multiple cipher vfs if an encryption key is provided\n */\n if (this.options.encryptionKey) {\n const createResult = module.ccall('sqlite3mc_vfs_create', 'int', ['string', 'int'], [this.options.filename, 1]);\n if (createResult !== 0) {\n throw new Error('Failed to create multiple cipher vfs, Database encryption will not work');\n }\n }\n return sqlite3;\n }\n requireSqlite() {\n if (!this._sqliteAPI) {\n throw new Error(`Initialization has not completed`);\n }\n return this._sqliteAPI;\n }\n /**\n * Checks if the database connection is in autocommit mode.\n * @returns true if in autocommit mode, false if in a transaction\n */\n isAutoCommit() {\n return this.requireSqlite().get_autocommit(this.db) != 0;\n }\n async execute(sql, bindings) {\n const resultSet = await this.executeSingleStatementRaw(sql, bindings);\n return this.wrapQueryResults(this.requireSqlite(), resultSet);\n }\n async executeBatch(sql, bindings) {\n const results = [];\n const api = this.requireSqlite();\n for await (const stmt of api.statements(this.db, sql)) {\n let columns;\n for (const parameterSet of bindings) {\n const rs = await this.stepThroughStatement(api, stmt, parameterSet, columns, false);\n results.push(this.wrapQueryResults(api, rs));\n }\n // executeBatch can only use a single statement\n break;\n }\n return results;\n }\n wrapQueryResults(api, { rawRows, columnNames }) {\n return {\n rowsAffected: api.changes(this.db),\n insertId: api.last_insert_id(this.db),\n autocommit: api.get_autocommit(this.db) != 0,\n rawRows,\n columnNames\n };\n }\n /**\n * This executes a single statement using SQLite3 and returns the results as a {@link RawResultSet}.\n */\n async executeSingleStatementRaw(sql, bindings) {\n const results = await this.executeRaw(sql, bindings);\n return results.length ? results[0] : { columnNames: [], rawRows: [] };\n }\n async executeRaw(sql, bindings) {\n const results = [];\n const api = this.requireSqlite();\n for await (const stmt of this.cachedStatements(api, sql)) {\n let columns;\n const rs = await this.stepThroughStatement(api, stmt, bindings ?? [], columns);\n columns = rs.columnNames;\n if (columns.length) {\n results.push(rs);\n }\n // When binding parameters, only a single statement is executed.\n if (bindings) {\n break;\n }\n }\n return results;\n }\n async stepThroughStatement(api, stmt, bindings, knownColumns, includeResults = true) {\n // TODO not sure why this is needed currently, but booleans break\n bindings.forEach((b, index, arr) => {\n if (typeof b == 'boolean') {\n arr[index] = b ? 1 : 0;\n }\n });\n api.reset(stmt);\n if (bindings) {\n api.bind_collection(stmt, bindings);\n }\n const rows = [];\n while ((await api.step(stmt)) === SQLITE_ROW) {\n if (includeResults) {\n const row = api.row(stmt);\n rows.push(row);\n }\n }\n knownColumns ??= api.column_names(stmt);\n return { columnNames: knownColumns, rawRows: rows };\n }\n async close() {\n if (this.isOpen) {\n const api = this.requireSqlite();\n if (this.statementCache) {\n for (const stmt of this.statementCache.drain()) {\n await api.finalize(stmt);\n }\n }\n await api.close(this.db);\n this.db = 0;\n }\n }\n async *cachedStatements(api, sql) {\n {\n const existing = this.statementCache?.lookup(sql);\n if (existing != null) {\n yield existing;\n return;\n }\n }\n const inner = api.statements(this.db, sql, { unscoped: true });\n const preparedStatements = [];\n try {\n for await (const stmt of inner) {\n preparedStatements.push(stmt);\n yield stmt;\n }\n }\n finally {\n // We can only cache statements if the sql text corresponds to a single statement, otherwise it's not clear what\n // portion of the original sql text to use as a key.\n if (preparedStatements.length === 1 && this.statementCache) {\n const stmt = preparedStatements[0];\n // Don't cache EXPLAIN statements, their result becomes invalid after schema changes.\n if (this.sqlite3_stmt_isexplain(stmt) == 0) {\n const evicted = this.statementCache.addStatement(sql, stmt);\n if (evicted != null) {\n await api.finalize(evicted);\n }\n return;\n }\n }\n // We're not caching statements, so finalize them.\n for (const stmt of preparedStatements) {\n await api.finalize(stmt);\n }\n }\n }\n}\n//# sourceMappingURL=RawSqliteConnection.js.map","import { Mutex } from '@powersync/shared-internals';\n/**\n * A wrapper around a {@link RawSqliteConnection} allowing multiple tabs to access it.\n *\n * To allow potentially concurrent accesses from different clients, this requires a local mutex implementation here.\n *\n * Note that instances of this class are not safe to proxy across context boundaries with comlink! We need to be able to\n * rely on mutexes being returned reliably, so additional checks to detect say a client tab closing are required to\n * avoid deadlocks.\n */\nexport class ConcurrentSqliteConnection {\n inner;\n /**\n * An outer mutex ensuring at most one {@link ConnectionLeaseToken} can exist for this connection at a time.\n *\n * If null, we'll use navigator locks instead.\n */\n leaseMutex;\n /**\n * @param needsNavigatorLocks Whether access to the database needs an additional navigator lock guard.\n *\n * While {@link ConcurrentSqliteConnection} prevents concurrent access to a database _connection_, it's possible we\n * might have multiple connections to the same physical database (e.g. if multiple tabs use dedicated workers).\n * In those setups, we use navigator locks instead of an internal mutex to guard access..\n */\n constructor(inner, needsNavigatorLocks) {\n this.inner = inner;\n this.leaseMutex = needsNavigatorLocks ? null : new Mutex();\n }\n get options() {\n return this.inner.options;\n }\n acquireMutex(abort) {\n if (this.leaseMutex) {\n return this.leaseMutex.acquire(abort);\n }\n return new Promise((resolve, reject) => {\n const options = { signal: abort };\n navigator.locks\n .request(`db-lock-${this.options.filename}`, options, (_) => {\n return new Promise((returnLock) => {\n return resolve(() => {\n returnLock();\n });\n });\n })\n .catch(reject);\n });\n }\n // Unsafe, unguarded access to the SQLite connection.\n unsafeUseInner() {\n return this.inner;\n }\n /**\n * @returns A {@link ConnectionLeaseToken}. Until that token is returned, no other client can use the database.\n */\n async acquireConnection(abort) {\n const returnMutex = await this.acquireMutex(abort);\n const token = new ConnectionLeaseToken(returnMutex, this.inner);\n try {\n // Assert that the inner connection is initialized at this point, fail early if it's not.\n this.inner.requireSqlite();\n // If a previous client was interrupted in the middle of a transaction AND this is a shared worker, it's possible\n // for the connection to still be in a transaction. To avoid inconsistent state, we roll back connection leases\n // that haven't been comitted.\n if (!this.inner.isAutoCommit()) {\n await this.inner.executeRaw('ROLLBACK');\n }\n }\n catch (e) {\n returnMutex();\n throw e;\n }\n return token;\n }\n async close() {\n const returnMutex = await this.acquireMutex();\n try {\n await this.inner.close();\n }\n finally {\n returnMutex();\n }\n }\n}\n/**\n * An instance representing temporary exclusive access to a {@link ConcurrentSqliteConnection}.\n */\nexport class ConnectionLeaseToken {\n returnMutex;\n connection;\n /** Ensures that the client with access to this token can't run statements concurrently. */\n useMutex = new Mutex();\n closed = false;\n constructor(returnMutex, connection) {\n this.returnMutex = returnMutex;\n this.connection = connection;\n }\n /**\n * Returns this lease, allowing another client to use the database connection.\n */\n async returnLease() {\n await this.useMutex.runExclusive(async () => {\n if (!this.closed) {\n this.closed = true;\n this.returnMutex();\n }\n });\n }\n /**\n * This should only be used internally, since the callback must not use the raw connection after resolving.\n */\n async use(callback) {\n return await this.useMutex.runExclusive(async () => {\n if (this.closed) {\n throw new Error('lease token has already been closed');\n }\n return await callback(this.connection);\n });\n }\n}\n//# sourceMappingURL=ConcurrentConnection.js.map","import { LogLevels } from '@powersync/common';\nimport * as Comlink from 'comlink';\nimport { DatabaseServer } from '../../db/adapters/wa-sqlite/DatabaseServer.js';\nimport { getNavigatorLocks } from '../../shared/navigator.js';\nimport { RawSqliteConnection } from '../../db/adapters/wa-sqlite/RawSqliteConnection.js';\nimport { ConcurrentSqliteConnection } from '../../db/adapters/wa-sqlite/ConcurrentConnection.js';\nimport { WASQLiteVFS } from '../../db/adapters/wa-sqlite/vfs.js';\nimport { Mutex } from '@powersync/shared-internals';\nconst OPEN_DB_LOCK = 'open-wasqlite-db';\n/**\n * Shared state to manage multiple database connections hosted by a worker.\n */\nexport class MultiDatabaseServer {\n logger;\n #activeDatabases = new Map();\n #localOpenLock = new Mutex();\n constructor(logger) {\n this.logger = logger;\n }\n async handleConnection({ logLevel, database, lockName }) {\n const logger = {\n log: (record) => {\n if (record.level >= logLevel)\n this.logger.log(record);\n }\n };\n return Comlink.proxy(await this.openConnectionLocally(logger, database, lockName));\n }\n async connectToExisting(name, lockName) {\n return getNavigatorLocks().request(OPEN_DB_LOCK, async () => {\n const server = this.#activeDatabases.get(name);\n if (server == null) {\n throw new Error(`connectToExisting(${name}) failed because the worker doesn't own a database with that name.`);\n }\n return Comlink.proxy(await server.connect(lockName));\n });\n }\n async openConnectionLocally(logger, options, lockName) {\n // Especially on Firefox, we're sometimes seeing \"NoModificationAllowedError\"s when opening OPFS databases we can\n // work around by retrying.\n const maxAttempts = 3;\n let server;\n for (let count = 0; count < maxAttempts - 1; count++) {\n try {\n server = await this.#databaseOpenAttempt(logger, options);\n }\n catch (error) {\n this.logger.log({\n level: LogLevels.warn,\n message: `Attempt ${count + 1} of ${maxAttempts} to open database failed, retrying in 1 second...`,\n error\n });\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n // Final attempt if we haven't been able to open the server - rethrow errors if we still can't open.\n server ??= await this.#databaseOpenAttempt(logger, options);\n return server.connect(lockName);\n }\n async #databaseOpenAttempt(logger, options) {\n const { filename, readonly, vfs } = options;\n // We don't need navigator locks for shared workers because all queries run in this shared worker exclusively.\n // For read-only connections, we use a VFS that supports concurrent reads (so a single lock on the connection is\n // fine). In-memory databases either run in a shared worker or aren't shared across tabs at all, so the internal\n // lock is enough.\n const needsNavigatorLocks = !(isSharedWorker || readonly || vfs == WASQLiteVFS.InMemoryVfs);\n const activeDatabases = this.#activeDatabases;\n async function openDatabase() {\n let server = activeDatabases.get(filename);\n if (server == null) {\n const connection = new RawSqliteConnection(options);\n const withSafeConcurrency = new ConcurrentSqliteConnection(connection, needsNavigatorLocks);\n // Initializing the RawSqliteConnection will run some pragmas that might write to the database file, so we want\n // to do that in an exclusive lock. Note that OPEN_DB_LOCK is not enough for that, as another tab might have\n // already created a connection (and is thus outside of OPEN_DB_LOCK) while currently writing to it.\n const returnLease = await withSafeConcurrency.acquireMutex();\n try {\n await connection.init();\n }\n catch (e) {\n returnLease();\n await connection.close();\n throw e;\n }\n returnLease();\n const onClose = () => activeDatabases.delete(filename);\n server = new DatabaseServer({\n inner: withSafeConcurrency,\n logger,\n onClose\n });\n activeDatabases.set(filename, server);\n }\n return server;\n }\n if (needsNavigatorLocks) {\n return getNavigatorLocks().request(OPEN_DB_LOCK, openDatabase);\n }\n else {\n // Even if we don't need navigator locks, this avoids a race between the activeDatabases.get() call, the async\n // open logic and the final activeDatabases.set() step.\n return this.#localOpenLock.runExclusive(openDatabase);\n }\n }\n closeAll() {\n const existingDatabases = [...this.#activeDatabases.values()];\n return Promise.all(existingDatabases.map((db) => {\n db.forceClose();\n }));\n }\n}\nexport const isSharedWorker = 'SharedWorkerGlobalScope' in globalThis;\n//# sourceMappingURL=MultiDatabaseServer.js.map","import { LockContext, DBAdapter, queryResultWithoutRows } from '@powersync/common';\nimport * as Comlink from 'comlink';\nimport { ConnectionClosedError } from '@powersync/shared-internals';\n/**\n * A single-connection {@link ConnectionPool} implementation based on a worker connection.\n */\nexport class DatabaseClient extends DBAdapter {\n options;\n config;\n #connection;\n #shareConnectionAbortController = new AbortController();\n #receiveTableUpdates;\n constructor(options, config) {\n super();\n this.options = options;\n this.config = config;\n this.#connection = {\n connection: options.connection,\n notifyRemoteClosed: options.remoteCanCloseUnexpectedly ? new AbortController() : undefined,\n traceQueries: config.debugMode === true\n };\n const { port1, port2 } = new MessageChannel();\n options.connection.setUpdateListener(Comlink.transfer(port1, [port1]));\n this.#receiveTableUpdates = port2;\n port2.onmessage = (event) => {\n const tables = event.data;\n const notification = {\n tables\n };\n this.iterateListeners((l) => {\n l.tablesUpdated && l.tablesUpdated(notification);\n });\n };\n }\n get name() {\n return this.config.dbFilename;\n }\n /**\n * Marks the remote as closed.\n *\n * This can sometimes happen outside of our control, e.g. when a shared worker requests a connection from a tab. When\n * it happens, all outstanding requests on this pool would never resolve. To avoid livelocks in this scenario, we\n * throw on all outstanding promises and forbid new calls.\n */\n markRemoteClosed() {\n // Can non-null assert here because this function is only supposed to be called when remoteCanCloseUnexpectedly was\n // set.\n this.#connection.notifyRemoteClosed.abort();\n }\n async close() {\n // This connection is no longer shared, so we can close locks held for shareConnection calls.\n this.#shareConnectionAbortController.abort();\n this.#receiveTableUpdates.close();\n await useConnectionState(this.#connection, (c) => c.close(), true);\n this.options.onClose?.();\n this.options.source?.[Comlink.releaseProxy]();\n }\n readLock(fn, options) {\n return this.#lock(false, fn, options);\n }\n writeLock(fn, options) {\n return this.#lock(true, fn, options);\n }\n async #lock(write, fn, options) {\n const token = await useConnectionState(this.#connection, (c) => c.requestAccess(write, options?.timeoutMs));\n try {\n return await fn(new ClientLockContext(this.#connection, token));\n }\n finally {\n await useConnectionState(this.#connection, (c) => c.completeAccess(token));\n }\n }\n async refreshSchema() {\n // Currently a no-op on the web.\n }\n async shareConnection() {\n /**\n * Hold a navigator lock in order to avoid features such as Chrome's frozen tabs,\n * or Edge's sleeping tabs from pausing the thread for this connection.\n * This promise resolves once a lock is obtained.\n * This lock will be held as long as this connection is open.\n * The `shareConnection` method should not be called on multiple tabs concurrently.\n */\n const abort = this.#shareConnectionAbortController;\n const source = this.options.source;\n if (source == null) {\n throw new Error(`shareConnection() is only available for connections based by workers.`);\n }\n await new Promise((resolve, reject) => navigator.locks\n .request(`shared-connection-${this.name}-${Date.now()}-${Math.round(Math.random() * 10000)}`, {\n signal: abort.signal\n }, async () => {\n resolve();\n // Free the lock when the connection is already closed.\n if (abort.signal.aborted) {\n return;\n }\n // Hold the lock while the shared connection is in use.\n await new Promise((releaseLock) => {\n abort.signal.addEventListener('abort', () => {\n releaseLock();\n });\n });\n })\n // We aren't concerned with abort errors here\n .catch((ex) => {\n if (ex.name == 'AbortError') {\n resolve();\n }\n else {\n reject(ex);\n }\n }));\n const newPort = await source[Comlink.createEndpoint]();\n return { port: newPort, identifier: this.name };\n }\n getConfiguration() {\n return this.config;\n }\n}\n/**\n * A {@link LockContext} implemented by sending commands to a worker.\n *\n * While an instance is active, it has exclusive access to the underlying database connection (as represented by its\n * token).\n */\nclass ClientLockContext extends LockContext {\n #connection;\n #token;\n constructor(connection, token) {\n super();\n this.#connection = connection;\n this.#token = token;\n }\n /**\n * Requests an operation from the worker, potentially tracing it if that option has been enabled.\n */\n async maybeTrace(fn, describeForTrace) {\n if (this.#connection.traceQueries) {\n const start = performance.now();\n const description = describeForTrace();\n try {\n const r = await useConnectionState(this.#connection, fn);\n performance.measure(`[SQL] ${description}`, { start });\n return r;\n }\n catch (e) {\n performance.measure(`[SQL] [ERROR: ${e.message}] ${description}`, { start });\n throw e;\n }\n }\n else {\n return useConnectionState(this.#connection, fn);\n }\n }\n async executeRaw(query, params) {\n return await this.#executeOnWorker(query, params);\n }\n async #executeOnWorker(query, params) {\n return this.maybeTrace((c) => c.execute(this.#token, query, params), () => query);\n }\n async executeBatch(query, params = []) {\n const results = await this.maybeTrace((c) => c.executeBatch(this.#token, query, params), () => `${query} (batch of ${params.length})`);\n const result = { insertId: undefined, rowsAffected: 0 };\n for (const source of results) {\n result.insertId = source.insertId;\n result.rowsAffected = (result.rowsAffected ?? 0) + source.rowsAffected;\n }\n return queryResultWithoutRows(result);\n }\n}\nasync function useConnectionState(state, workerPromise, fireActionOnAbort = false) {\n const controller = state.notifyRemoteClosed;\n if (controller) {\n return new Promise((resolve, reject) => {\n if (controller.signal.aborted) {\n reject(new ConnectionClosedError('Called operation on closed remote'));\n if (!fireActionOnAbort) {\n // Don't run the operation if we're going to reject\n // We might want to fire-and-forget the operation in some cases (like a close operation)\n return;\n }\n }\n function handleAbort() {\n reject(new ConnectionClosedError('Remote peer closed with request in flight'));\n }\n function completePromise(action) {\n controller.signal.removeEventListener('abort', handleAbort);\n action();\n }\n controller.signal.addEventListener('abort', handleAbort);\n workerPromise(state.connection)\n .then((data) => completePromise(() => resolve(data)))\n .catch((e) => completePromise(() => reject(e)));\n });\n }\n else {\n // Can't close, so just return the inner worker promise unguarded.\n return workerPromise(state.connection);\n }\n}\n//# sourceMappingURL=DatabaseClient.js.map","import { getNavigatorLocks } from './navigator.js';\n/**\n * Requests a random lock that will be released once the optional signal is aborted (or, if no signal is given, when the\n * tab is closed).\n *\n * This allows sending the name of the lock to another context (e.g. a shared worker), which will also attempt to\n * acquire it. Since the lock is returned when the tab is closed, this allows the shared worker to free resources\n * assocatiated with this tab.\n *\n * We take hold of this lock as soon-as-possible in order to cater for potentially closed tabs.\n */\nexport function generateTabCloseSignal(abort) {\n return new Promise((resolve, reject) => {\n const options = { signal: abort };\n getNavigatorLocks()\n .request(`tab-close-signal-${crypto.randomUUID()}`, options, (lock) => {\n resolve(lock.name);\n return new Promise((resolve) => {\n if (abort) {\n abort.addEventListener('abort', () => resolve());\n }\n });\n })\n .catch(reject);\n });\n}\n//# sourceMappingURL=tab_close_signal.js.map","/**\n * Internal helper function to acquire a connection from a pool that has a designated writer, additional readers, and\n * also allows dispatching reads to the writer.\n */\nexport async function acquireFromPool(writerMutex, writer, readers, callback, options, allowReadOnly) {\n const abortController = new AbortController();\n const abortSignal = abortController.signal;\n let timeout = null;\n let release;\n if (options?.timeoutMs) {\n timeout = setTimeout(() => abortController.abort('requesting database timed out'), options.timeoutMs);\n }\n try {\n if (allowReadOnly) {\n let connection;\n // Even if we have a pool of read connections, it's typically very small and we assume that most queries are\n // reads. So, we want to request any connection from the read pool and the dedicated write connection (which\n // can also serve reads). We race for the first connection we can obtain this way, and then abort the other\n // request.\n [connection, release] = await new Promise((resolve, reject) => {\n let didComplete = false;\n function complete() {\n didComplete = true;\n abortController.abort();\n }\n function completeSuccess(connection, returnFn) {\n if (didComplete) {\n // We're not going to use this connection, so return it immediately.\n returnFn();\n }\n else {\n complete();\n resolve([connection, returnFn]);\n }\n }\n function completeError(error) {\n // We either have a working connection already, or we've rejected the promise. Either way, we don't need\n // to do either thing again.\n if (didComplete)\n return;\n complete();\n reject(error);\n }\n writerMutex.acquire(abortSignal).then((unlock) => completeSuccess(writer, unlock), completeError);\n readers?.requestOne(abortSignal).then(({ item, release }) => completeSuccess(item, release), completeError);\n });\n return await callback(connection);\n }\n else {\n return await writerMutex.runExclusive(() => callback(writer), abortSignal);\n }\n }\n finally {\n if (timeout != null) {\n clearTimeout(timeout);\n }\n release?.();\n }\n}\n//# sourceMappingURL=acquireFromPool.js.map","import { DBAdapter } from '@powersync/common';\nimport { Mutex, Semaphore } from '@powersync/shared-internals';\nimport { acquireFromPool } from './acquireFromPool.js';\n/**\n * A connection pool implementation delegating to another pool opened asynchronnously.\n */\nexport class AsyncDbAdapter extends DBAdapter {\n name;\n state;\n resolvedWriter;\n pendingListeners = new Set();\n constructor(inner, name) {\n super();\n this.name = name;\n this.state = inner.then((client) => {\n for (const pending of this.pendingListeners) {\n pending.closeAfterRegisteredOnResolvedPool = client.writer.registerListener(pending.listener);\n }\n this.pendingListeners.clear();\n this.resolvedWriter = client.writer;\n if (client.additionalReaders.length) {\n return readWritePoolState(client.writer, client.additionalReaders);\n }\n return singleConnectionPoolState(client.writer);\n });\n }\n async init() {\n await this.state;\n }\n async close() {\n const state = await this.state;\n await state.close();\n }\n async readLock(fn, options) {\n const state = await this.state;\n return state.withConnection(true, fn, options);\n }\n async writeLock(fn, options) {\n const state = await this.state;\n return state.withConnection(false, fn, options);\n }\n async refreshSchema() {\n const state = await this.state;\n await state.refreshSchema();\n }\n registerListener(listener) {\n if (this.resolvedWriter) {\n return this.resolvedWriter.registerListener(listener);\n }\n else {\n const pending = { listener };\n this.pendingListeners.add(pending);\n return () => {\n if (pending.closeAfterRegisteredOnResolvedPool) {\n return pending.closeAfterRegisteredOnResolvedPool();\n }\n else {\n // Has not been registered yet, we can just remove the pending listener.\n this.pendingListeners.delete(pending);\n }\n };\n }\n }\n async shareConnection() {\n const state = await this.state;\n return state.writer.shareConnection();\n }\n getConfiguration() {\n if (this.resolvedWriter) {\n return this.resolvedWriter.getConfiguration();\n }\n throw new Error('AsyncDbAdapter.getConfiguration() can only be called after initializing it.');\n }\n}\nfunction singleConnectionPoolState(connection) {\n return {\n writer: connection,\n withConnection: (allowReadOnly, fn, options) => {\n if (allowReadOnly) {\n return connection.readLock(fn, options);\n }\n else {\n return connection.writeLock(fn, options);\n }\n },\n close: () => connection.close(),\n refreshSchema: () => connection.refreshSchema()\n };\n}\nfunction readWritePoolState(writer, readers) {\n // DatabaseClients have locks internally, so these aren't necessary for correctness. However, our mutex and semaphore\n // implementations are very cheap to cancel, which we use to dispatch reads to the first available connection (by\n // simply requesting all of them and sticking with the first connection we get).\n const writerMutex = new Mutex();\n const readerSemaphore = new Semaphore(readers);\n return {\n writer,\n async withConnection(allowReadOnly, fn, options) {\n return acquireFromPool(writerMutex, writer, readerSemaphore, (connection) => {\n return allowReadOnly ? connection.readLock(fn) : connection.writeLock(fn);\n }, options, allowReadOnly);\n },\n async close() {\n await writer.close();\n await Promise.all(readers.map((r) => r.close()));\n },\n async refreshSchema() {\n await writer.refreshSchema();\n await Promise.all(readers.map((r) => r.refreshSchema()));\n }\n };\n}\n//# sourceMappingURL=AsyncWebAdapter.js.map","import { LogLevels } from '@powersync/common';\nexport function connectToWorker({ service, databaseIdentifier, customWorker, shared, loggerForErrors }) {\n const name = `${shared ? 'shared-' : ''}powersync-${databaseIdentifier}`;\n let worker;\n if (customWorker) {\n worker = shared\n ? new SharedWorker(customWorker, {\n /* @vite-ignore */\n name,\n type: 'module'\n })\n : new Worker(customWorker, {\n /* @vite-ignore */\n name,\n type: 'module'\n });\n }\n else {\n worker = spawnDefaultPowerSyncWorker(shared, name);\n }\n return connectToExistingWorker(worker, loggerForErrors, service);\n}\n/**\n * Opens the default PowerSync worker.\n *\n * When users depend on the web SDK, we assume they use their own bundler (either vite or webpack). Both recognize the\n * syntax of worker constructors with a string literal and will rewrite the URL as part of their bundling processes.\n *\n * React Native / Metro users can't rely on this on the web, as their app is not a JavaScript module and import.meta.url\n * is not rewritten by Metro. For those users, we include a pre-bundled worker they can copy into a static assets\n * directory and load with a custom URI. This also means that defaultWorker cannot work with Metro for React Native Web.\n * We have a custom rollup plugin and conditional exports that replaces this function with a throwing stub for that\n * platform. This allows a helpful error message.\n */\n// Note: When changing this function, also update disableDefaultWorkers in rollup.config.ts.\nfunction spawnDefaultPowerSyncWorker(shared, name) {\n return shared\n ? new SharedWorker(new URL('./worker.js', import.meta.url), {\n /* @vite-ignore */\n name,\n type: 'module'\n })\n : new Worker(new URL('./worker.js', import.meta.url), {\n /* @vite-ignore */\n name,\n type: 'module'\n });\n}\nexport function connectToExistingWorker(worker, logger, service) {\n function logError(event) {\n // TODO: Ideally, we should be able to handle worker errors by forwarding them to async Comlink callers.\n // Currently, comlink calls on errored workers would just be stuck forever.\n logger.log({\n level: LogLevels.error,\n error: event.error,\n message: 'Error in database or sync worker, this likely disrupts PowerSync.'\n });\n }\n worker.addEventListener('error', logError);\n const isShared = isSharedWorker(worker);\n if (isShared) {\n const { port1, port2 } = new MessageChannel();\n const mainPort = worker.port;\n mainPort.start();\n mainPort.postMessage({ port: port1, service }, [port1]);\n port2.start();\n return {\n endpoint: port2,\n worker,\n close() {\n worker.removeEventListener('error', logError);\n port2.close();\n }\n };\n }\n else {\n return {\n endpoint: worker,\n worker,\n close() {\n worker.removeEventListener('error', logError);\n worker.terminate();\n }\n };\n }\n}\nexport function isSharedWorker(worker) {\n return 'port' in worker;\n}\n//# sourceMappingURL=client.js.map","import { LogLevels } from '@powersync/common';\nimport * as Comlink from 'comlink';\nimport { SSRDBAdapter } from '../SSRDBAdapter.js';\nimport { vfsRequiresDedicatedWorkers, WASQLiteVFS } from './vfs.js';\nimport { MultiDatabaseServer } from '../../../worker/db/MultiDatabaseServer.js';\nimport { DatabaseClient } from './DatabaseClient.js';\nimport { generateTabCloseSignal } from '../../../shared/tab_close_signal.js';\nimport { AsyncDbAdapter } from '../AsyncWebAdapter.js';\nimport { maxPathNameLength, resolveAndValidateOptions } from '../resolveAndValidateOptions.js';\nimport { connectToExistingWorker, connectToWorker } from '../../../worker/client.js';\n/**\n * Opens a SQLite connection using WA-SQLite.\n */\nexport class WASQLiteOpenFactory {\n options;\n logger;\n constructor(options) {\n this.options = resolveAndValidateOptions(options.open);\n // Account for the fact that SQLite might append -journal suffixes\n const maxLength = maxPathNameLength - 16;\n if (this.options.dbFilename.length > maxLength) {\n throw new Error(`dbFilename too long (max length is ${maxLength})`);\n }\n this.logger = options.logger;\n }\n openAdapter() {\n return new AsyncDbAdapter(this.openConnection(), this.options.dbFilename);\n }\n openDB() {\n const { disableSSRWarning, enableMultiTabs, ssrMode } = this.options;\n if (ssrMode) {\n if (!disableSSRWarning) {\n this.logger.log({\n level: LogLevels.warn,\n message: `\n Running PowerSync in SSR mode.\n Only empty query results will be returned.\n Disable this warning by setting 'disableSSRWarning: true' in options.`\n });\n }\n return new SSRDBAdapter();\n }\n if (!enableMultiTabs) {\n this.logger.log({\n level: LogLevels.warn,\n message: 'Multiple tab support is not enabled. Using this site across multiple tabs may not function correctly.'\n });\n }\n return this.openAdapter();\n }\n async openConnection() {\n const { enableMultiTabs, useWebWorker, vfs, dbFilename, encryptionKey, temporaryStorage, cacheSizeKb, preparedStatementsCache, additionalInitializationFunctions, storageBucket } = this.options;\n if (!enableMultiTabs) {\n this.logger.log({ level: LogLevels.warn, message: 'Multiple tabs are not enabled in this browser' });\n }\n let client;\n let additionalReaders = [];\n let requiresPersistentTriggers = vfsRequiresDedicatedWorkers(vfs);\n function resolveRawWaSqliteDatabaseOptions(readonly) {\n return {\n filename: dbFilename,\n readonly,\n vfs,\n encryptionKey,\n temporaryStorage,\n cacheSizeKb,\n // TODO: Enable prepared statement cache by default?\n preparedStatementsCache: preparedStatementsCache ?? 0,\n additionalInitializationFunctions,\n storageBucket\n };\n }\n if (useWebWorker) {\n const optionsDbWorker = this.options.worker;\n const openDatabaseWorker = async (readonly) => {\n let workerConnection;\n if (typeof optionsDbWorker == 'function') {\n const worker = optionsDbWorker(this.options);\n workerConnection = connectToExistingWorker(worker, this.logger, 'database');\n }\n else {\n const needsDedicated = vfsRequiresDedicatedWorkers(vfs);\n const useShared = !needsDedicated && enableMultiTabs;\n workerConnection = connectToWorker({\n service: 'database',\n databaseIdentifier: this.options.dbFilename,\n shared: useShared,\n customWorker: optionsDbWorker,\n loggerForErrors: this.logger\n });\n }\n const source = Comlink.wrap(workerConnection.endpoint);\n const closeSignal = new AbortController();\n const connection = await source.connect({\n database: resolveRawWaSqliteDatabaseOptions(readonly),\n logLevel: this.options.databaseWorkerLogLevel,\n lockName: await generateTabCloseSignal(closeSignal.signal)\n });\n const clientOptions = {\n connection,\n source,\n // This tab owns the worker, so we're guaranteed to outlive it.\n remoteCanCloseUnexpectedly: false,\n onClose: () => {\n closeSignal.abort();\n workerConnection.close();\n }\n };\n return new DatabaseClient(clientOptions, {\n ...this.options,\n requiresPersistentTriggers\n });\n };\n client = await openDatabaseWorker(false);\n if (vfs == WASQLiteVFS.OPFSWriteAheadVFS) {\n // This VFS supports concurrent reads, so we can open additional workers to host read-only connections for\n // concurrent reads / writes.\n const additionalReadersCount = this.options.additionalReaders ?? 1;\n const additionalReaderPromises = [];\n for (let i = 0; i < additionalReadersCount; i++) {\n additionalReaderPromises.push(openDatabaseWorker(true));\n }\n additionalReaders.push(...(await Promise.all(additionalReaderPromises)));\n }\n }\n else {\n // Don't use a web worker. Instead, open the MultiDatabaseServer a worker would use locally.\n const localServer = new MultiDatabaseServer(this.logger);\n requiresPersistentTriggers = true;\n const connection = await localServer.openConnectionLocally(this.logger, resolveRawWaSqliteDatabaseOptions(false));\n client = new DatabaseClient({ connection, source: null, remoteCanCloseUnexpectedly: false }, {\n ...this.options,\n requiresPersistentTriggers\n });\n }\n return {\n writer: client,\n additionalReaders\n };\n }\n}\n//# sourceMappingURL=WASQLiteOpenFactory.js.map","import { getNavigatorLocks } from '../shared/navigator.js';\n/**\n * @internal\n * @experimental\n */\nexport const NAVIGATOR_TRIGGER_CLAIM_MANAGER = {\n async obtainClaim(identifier) {\n return new Promise((resolveReleaser) => {\n getNavigatorLocks().request(identifier, async () => {\n await new Promise((releaseLock) => {\n resolveReleaser(async () => releaseLock());\n });\n });\n });\n },\n async checkClaim(identifier) {\n const currentState = await getNavigatorLocks().query();\n return currentState.held?.find((heldLock) => heldLock.name == identifier) != null;\n }\n};\n//# sourceMappingURL=NavigatorTriggerClaimManager.js.map","import { BaseObserver } from '@powersync/common';\nimport { Mutex, LockType } from '@powersync/shared-internals';\nexport class SSRStreamingSyncImplementation extends BaseObserver {\n syncMutex;\n crudMutex;\n isConnected;\n lastSyncedAt;\n constructor() {\n super();\n this.syncMutex = new Mutex();\n this.crudMutex = new Mutex();\n this.isConnected = false;\n }\n obtainLock(lockOptions) {\n const mutex = lockOptions.type == LockType.CRUD ? this.crudMutex : this.syncMutex;\n return mutex.runExclusive(lockOptions.callback, lockOptions.signal);\n }\n /**\n * This is a no-op in SSR mode\n */\n async connect() { }\n async dispose() { }\n /**\n * This is a no-op in SSR mode\n */\n async disconnect() { }\n /**\n * This SSR Mode implementation is immediately ready.\n */\n async waitForReady() { }\n /**\n * This will never resolve in SSR Mode.\n */\n waitUntilStatusMatches(_predicate) {\n return new Promise(() => { });\n }\n /**\n * This is a no-op in SSR mode.\n */\n triggerCrudUpload() { }\n /**\n * No-op in SSR mode.\n */\n updateSubscriptions() { }\n /**\n * No-op in SSR mode.\n */\n markConnectionMayHaveChanged() { }\n requestCheckpoint() {\n throw new Error('Sub sync implementation does not support request checkpoints');\n }\n}\n//# sourceMappingURL=SSRWebStreamingSyncImplementation.js.map","/**\n * The client side port should provide these methods.\n */\nexport class AbstractSharedSyncClientProvider {\n}\n//# sourceMappingURL=AbstractSharedSyncClientProvider.js.map","/**\n * Get a minimal representation of browser, version and operating system.\n *\n * The goal is to get enough environemnt info to reproduce issues, but no\n * more.\n */\nexport function getUserAgentInfo(nav) {\n nav ??= navigator;\n const browser = getBrowserInfo(nav);\n const os = getOsInfo(nav);\n // The cast below is to cater for TypeScript < 5.5.0\n return [browser, os].filter((v) => v != null);\n}\nfunction getBrowserInfo(nav) {\n const brands = nav.userAgentData?.brands;\n if (brands != null) {\n const tests = [\n { name: 'Google Chrome', value: 'Chrome' },\n { name: 'Opera', value: 'Opera' },\n { name: 'Edge', value: 'Edge' },\n { name: 'Chromium', value: 'Chromium' }\n ];\n for (let { name, value } of tests) {\n const brand = brands.find((b) => b.brand == name);\n if (brand != null) {\n return `${value}/${brand.version}`;\n }\n }\n }\n const ua = nav.userAgent;\n const regexps = [\n { re: /(?:firefox|fxios)\\/(\\d+)/i, value: 'Firefox' },\n { re: /(?:edg|edge|edga|edgios)\\/(\\d+)/i, value: 'Edge' },\n { re: /opr\\/(\\d+)/i, value: 'Opera' },\n { re: /(?:chrome|chromium|crios)\\/(\\d+)/i, value: 'Chrome' },\n { re: /version\\/(\\d+).*safari/i, value: 'Safari' }\n ];\n for (let { re, value } of regexps) {\n const match = re.exec(ua);\n if (match != null) {\n return `${value}/${match[1]}`;\n }\n }\n return null;\n}\nfunction getOsInfo(nav) {\n if (nav.userAgentData?.platform != null) {\n return nav.userAgentData.platform.toLowerCase();\n }\n const ua = nav.userAgent;\n const regexps = [\n { re: /windows/i, value: 'windows' },\n { re: /android/i, value: 'android' },\n { re: /linux/i, value: 'linux' },\n { re: /iphone|ipad|ipod/i, value: 'ios' },\n { re: /macintosh|mac os x/i, value: 'macos' }\n ];\n for (let { re, value } of regexps) {\n if (re.test(ua)) {\n return value;\n }\n }\n return null;\n}\n//# sourceMappingURL=userAgent.js.map","import { LogLevels } from '@powersync/common';\nimport { AbstractRemote } from '@powersync/shared-internals';\nimport { getUserAgentInfo } from './userAgent.js';\nexport class WebRemote extends AbstractRemote {\n constructor(connector, logger) {\n super(connector, logger);\n }\n fetch({ resource, request }) {\n return fetch(resource, request);\n }\n async loadWebSocketSupport(platform) {\n if (!websockets) {\n // loadWebSocketSupport being called concurrently is safe, the import resolves to the same module in that case.\n const module = await import('@powersync/shared-internals/websockets');\n websockets = new module.WebSocketSupport(platform);\n }\n return websockets;\n }\n getUserAgent() {\n let ua = [super.getUserAgent(), `powersync-web`];\n try {\n ua.push(...getUserAgentInfo());\n }\n catch (error) {\n this.logger.log({ level: LogLevels.warn, message: 'Failed to get user agent info', error });\n }\n return ua.join(' ');\n }\n}\nlet websockets;\n//# sourceMappingURL=WebRemote.js.map","import { LogLevels } from '@powersync/common';\nimport { AbstractStreamingSyncImplementation, LockType } from '@powersync/shared-internals';\nimport { getNavigatorLocks } from '../../shared/navigator.js';\nexport class WebStreamingSyncImplementation extends AbstractStreamingSyncImplementation {\n diagnosticsChannel;\n constructor(options) {\n // Super will store and provide default values for options\n super(options);\n }\n /**\n * Broadcasts a core diagnostics event on a same-origin channel for diagnostics tooling to consume.\n * The channel reaches the page even when sync runs in a shared worker.\n */\n emitDiagnostics(event) {\n this.diagnosticsChannel ??= new BroadcastChannel('powersync-diagnostics-events');\n this.diagnosticsChannel.postMessage(event);\n }\n async dispose() {\n await super.dispose();\n this.diagnosticsChannel?.close();\n this.diagnosticsChannel = undefined;\n }\n get webOptions() {\n return this.options;\n }\n async obtainLock(lockOptions) {\n const identifier = `streaming-sync-${lockOptions.type}-${this.webOptions.identifier}`;\n if (lockOptions.type == LockType.SYNC) {\n this.logger.log({ level: LogLevels.debug, message: `requesting lock for ${identifier}` });\n }\n return getNavigatorLocks().request(identifier, { signal: lockOptions.signal }, lockOptions.callback);\n }\n}\n//# sourceMappingURL=WebStreamingSyncImplementation.js.map","import { BaseObserver, DBAdapter, LogLevels, SyncStreamConnectionMethod } from '@powersync/common';\nimport { AbortOperation, ConnectionManager, SqliteBucketStorage, Mutex, SyncStatusSnapshot } from '@powersync/shared-internals';\nimport * as Comlink from 'comlink';\nimport { WebRemote } from '../../db/sync/WebRemote.js';\nimport { WebStreamingSyncImplementation } from '../../db/sync/WebStreamingSyncImplementation.js';\nimport { BroadcastLogger } from './BroadcastLogger.js';\nimport { DatabaseClient } from '../../db/adapters/wa-sqlite/DatabaseClient.js';\nimport { generateTabCloseSignal } from '../../shared/tab_close_signal.js';\n/**\n * @internal\n * Manual message events for shared sync clients\n */\nexport var SharedSyncClientEvent;\n(function (SharedSyncClientEvent) {\n /**\n * This client requests the shared sync manager should\n * close it's connection to the client.\n */\n SharedSyncClientEvent[\"CLOSE_CLIENT\"] = \"close-client\";\n SharedSyncClientEvent[\"CLOSE_ACK\"] = \"close-ack\";\n})(SharedSyncClientEvent || (SharedSyncClientEvent = {}));\n/**\n * HACK: The shared implementation wraps and provides its own\n * PowerSyncBackendConnector when generating the streaming sync implementation.\n * We provide this unused placeholder when connecting with the ConnectionManager.\n */\nconst CONNECTOR_PLACEHOLDER = {};\n/**\n * @internal\n * Shared sync implementation which runs inside a shared webworker\n */\nexport class SharedSyncImplementation extends BaseObserver {\n ports;\n isInitialized;\n statusListener;\n syncParams;\n lastConnectOptions;\n portMutex;\n subscriptions = [];\n connectionManager;\n syncStatus;\n logger;\n database = this.generateReconnectableDatabase();\n sharedCloseSignal = generateTabCloseSignal();\n constructor() {\n super();\n this.ports = [];\n this.syncParams = null;\n this.lastConnectOptions = undefined;\n this.portMutex = new Mutex();\n this.isInitialized = new Promise((resolve) => {\n const callback = this.registerListener({\n initialized: () => {\n resolve();\n callback?.();\n }\n });\n });\n this.logger = new BroadcastLogger('shared-sync', this.ports);\n this.connectionManager = new ConnectionManager({\n createSyncImplementation: async () => {\n await this.waitForReady();\n const sync = await this.generateStreamingImplementation();\n const removeStatusListener = sync.registerListener({\n statusChanged: (snapshot) => {\n this.syncStatus = snapshot;\n const json = snapshot.toJSON();\n this.ports.forEach((p) => p.clientProvider.statusChanged(json));\n }\n });\n return {\n sync,\n onDispose: () => {\n removeStatusListener();\n // Clear transient state so new tabs don't inherit stale errors.\n // Preserve core status, including hasSynced and lastSyncedAt.\n this.syncStatus &&= new SyncStatusSnapshot(this.syncStatus.core, {});\n }\n };\n },\n logger: this.logger,\n defaultConnectionMethod: SyncStreamConnectionMethod.HTTP\n });\n }\n get isConnected() {\n return this.connectionManager.syncStreamImplementation?.isConnected ?? false;\n }\n /**\n * Gets the last client port which we know is safe from unexpected closes.\n */\n async getLastWrappedPort() {\n // Find the last port which is not closing\n return await this.portMutex.runExclusive(() => {\n for (let i = this.ports.length - 1; i >= 0; i--) {\n if (!this.ports[i].isClosing) {\n return this.ports[i];\n }\n }\n return;\n });\n }\n /**\n * In some very rare cases a specific tab might not respond to requests.\n * This returns a random port which is not closing.\n */\n async getRandomWrappedPort() {\n return await this.portMutex.runExclusive(() => {\n const nonClosingPorts = this.ports.filter((p) => !p.isClosing);\n return nonClosingPorts[Math.floor(Math.random() * nonClosingPorts.length)];\n });\n }\n async waitUntilStatusMatches(predicate) {\n return this.withSyncImplementation(async (sync) => {\n return sync.waitUntilStatusMatches(predicate);\n });\n }\n async waitForReady() {\n return this.isInitialized;\n }\n collectActiveSubscriptions() {\n this.logger.log({ level: LogLevels.debug, message: 'Collecting active stream subscriptions across tabs' });\n const active = new Map();\n for (const port of this.ports) {\n for (const stream of port.currentSubscriptions) {\n const serializedKey = JSON.stringify(stream);\n active.set(serializedKey, stream);\n }\n }\n this.subscriptions = [...active.values()];\n this.logger.log({\n level: LogLevels.debug,\n message: `Collected stream subscriptions, ${JSON.stringify(this.subscriptions)}`\n });\n this.connectionManager.syncStreamImplementation?.updateSubscriptions(this.subscriptions);\n }\n updateSubscriptions(port, subscriptions) {\n port.currentSubscriptions = subscriptions;\n this.collectActiveSubscriptions();\n }\n setLogLevel(level) {\n this.logger.setLevel(level);\n }\n /**\n * Configures the DBAdapter connection and a streaming sync client.\n */\n async setParams(params) {\n await this.portMutex.runExclusive(async () => {\n this.collectActiveSubscriptions();\n });\n if (this.syncParams) {\n // Cannot modify already existing sync implementation params\n return;\n }\n // First time setting params\n this.syncParams = params;\n this.logger.sendBroadcasts = params.enableBroadcastLogs;\n // Ensure we have a usable database connection, the reconnectable database will connect lazily on first use.\n await this.database.readLock(async () => { });\n self.onerror = (event) => {\n // Share any uncaught events on the broadcast logger\n this.logger.log({\n level: LogLevels.error,\n message: 'Uncaught exception in PowerSync shared sync worker',\n error: event\n });\n };\n this.iterateListeners((l) => l.initialized?.());\n }\n async dispose() {\n await this.waitForReady();\n this.statusListener?.();\n return this.connectionManager.close();\n }\n /**\n * Connects to the PowerSync backend instance.\n * Multiple tabs can safely call this in their initialization.\n * The connection will simply be reconnected whenever a new tab\n * connects.\n */\n async connect(options, serializedSchema) {\n this.lastConnectOptions = options;\n return this.connectionManager.connect(CONNECTOR_PLACEHOLDER, options ?? {}, serializedSchema);\n }\n async disconnect() {\n return this.connectionManager.disconnect();\n }\n /**\n * Adds a new client tab's message port to the list of connected ports\n */\n addPort(port, capabilities) {\n return this.portMutex.runExclusive(() => {\n if (this.ports.length) {\n // If we're already tracking a port, the added port must connect in the same mode (download or upload only, or\n // both).\n const anyPort = this.ports[0];\n checkCapabilitiesCompatible(anyPort.clientCapabilities, capabilities);\n }\n const portProvider = {\n port,\n clientProvider: Comlink.wrap(port),\n currentSubscriptions: [],\n closeListeners: [],\n isClosing: false,\n clientCapabilities: capabilities\n };\n this.ports.push(portProvider);\n // Give the newly connected client the latest status\n const status = this.syncStatus;\n if (status) {\n portProvider.clientProvider.statusChanged(status.toJSON());\n }\n return portProvider;\n });\n }\n /**\n * Removes a message port client from this manager's managed\n * clients.\n */\n async removePort(port) {\n // Ports might be removed faster than we can process them.\n port.isClosing = true;\n // Remove the port within a mutex context.\n // Warns if the port is not found. This should not happen in practice.\n // We return early if the port is not found.\n return await this.portMutex.runExclusive(async () => {\n const index = this.ports.findIndex((p) => p == port);\n if (index < 0) {\n this.logger.log({\n level: LogLevels.warn,\n message: `Could not remove port ${port} since it is not present in active ports.`\n });\n return () => { };\n }\n const trackedPort = this.ports[index];\n // Remove from the list of active ports\n this.ports.splice(index, 1);\n // Close the worker wrapped database connection, we can't accurately rely on this connection\n for (const closeListener of trackedPort.closeListeners) {\n await closeListener();\n }\n this.collectActiveSubscriptions();\n return () => trackedPort.clientProvider[Comlink.releaseProxy]();\n });\n }\n triggerCrudUpload() {\n this.withSyncImplementation(async (sync) => {\n sync.triggerCrudUpload();\n });\n }\n requestCheckpoint() {\n return this.withSyncImplementation((sync) => sync.requestCheckpoint());\n }\n async withSyncImplementation(callback) {\n await this.waitForReady();\n if (this.connectionManager.syncStreamImplementation) {\n return callback(this.connectionManager.syncStreamImplementation);\n }\n const sync = await new Promise((resolve) => {\n const dispose = this.connectionManager.registerListener({\n syncStreamCreated: (sync) => {\n resolve(sync);\n dispose?.();\n }\n });\n });\n return callback(sync);\n }\n generateStreamingImplementation() {\n // This should only be called after initialization has completed\n const syncParams = this.syncParams;\n const capabilities = this.ports[0]?.clientCapabilities;\n if (!capabilities) {\n throw new Error('Cannot create a sync implementation without connected clients');\n }\n const connector = {};\n if (capabilities.hasFetchCredentials) {\n // Always forward invalidations to the tab, since it has its own credentials cache (and potentially a\n // connector-level invalidateCredentials callback).\n connector.invalidateCredentials = async () => {\n const lastPort = await this.getLastWrappedPort();\n if (!lastPort) {\n throw new Error('No client port found to invalidate credentials');\n }\n try {\n this.logger.log({\n level: LogLevels.info,\n message: 'calling the last port client provider to invalidate credentials'\n });\n lastPort.clientProvider.invalidateCredentials();\n }\n catch (error) {\n this.logger.log({ level: LogLevels.error, message: 'error invalidating credentials', error });\n }\n };\n }\n if (capabilities.hasFetchCredentials) {\n connector.fetchCredentials = (signal) => {\n return this.#useConnector((port) => {\n this.logger.log({\n level: LogLevels.info,\n message: 'calling the last port client provider for credentials'\n });\n return port.clientProvider.fetchCredentials();\n }, 'fetchCredentials', signal);\n };\n }\n if (capabilities.hasUploadCrud) {\n connector.uploadCrud = (signal) => {\n return this.#useConnector((port) => port.clientProvider.uploadCrud(), 'uploadCrud', signal);\n };\n }\n if (capabilities.hasPostCheckpointRequest) {\n connector.postCheckpointRequest = (clientId, requestId, signal) => {\n return this.#useConnector((port) => port.clientProvider.postCheckpointRequest(clientId, requestId), 'postCheckpointRequest', signal);\n };\n }\n // Create a new StreamingSyncImplementation for each connect call. This is usually done is all SDKs.\n return new WebStreamingSyncImplementation({\n adapter: new SqliteBucketStorage(this.database, this.logger),\n connector,\n remote: new WebRemote(connector, this.logger),\n ...syncParams.streamOptions,\n subscriptions: this.subscriptions,\n // Logger cannot be transferred just yet\n logger: this.logger\n });\n }\n /**\n * Calls into a client tab, stopping the wait on disconnect when a signal is supplied.\n */\n async #useConnector(inner, debugContext, signal) {\n const action = async () => {\n const lastPort = await this.getLastWrappedPort();\n if (!lastPort) {\n throw new Error(`No client port found for ${debugContext}`);\n }\n return await new Promise((resolve, reject) => {\n const portClosed = () => {\n reject(new Error(`Tab closed while handling ${debugContext}`));\n };\n lastPort.closeListeners.push(portClosed);\n inner(lastPort)\n .then(resolve, reject)\n .finally(() => {\n const index = lastPort.closeListeners.indexOf(portClosed);\n if (index >= 0) {\n lastPort.closeListeners.splice(index, 1);\n }\n });\n });\n };\n // Include port lookup in the guard: port removal can hold portMutex.\n return signal ? withAbort({ signal, action }) : action();\n }\n /**\n * Requests a random client to share its database connection with us.\n */\n async openInternalDB(handleClosed) {\n const client = await this.getRandomWrappedPort();\n if (!client) {\n // Should not really happen in practice\n throw new Error(`Could not open DB connection since no client is connected.`);\n }\n // Fail-safe timeout for opening a database connection.\n const timeout = setTimeout(() => {\n abortController.abort();\n }, 10_000);\n /**\n * Handle cases where the client might close while opening a connection.\n */\n const abortController = new AbortController();\n const closeListener = () => {\n abortController.abort();\n };\n const removeCloseListener = () => {\n const index = client.closeListeners.indexOf(closeListener);\n if (index >= 0) {\n client.closeListeners.splice(index, 1);\n }\n };\n client.closeListeners.push(closeListener);\n const workerPort = await withAbort({\n action: () => client.clientProvider.getDBWorkerPort(),\n signal: abortController.signal,\n cleanupOnAbort: (port) => {\n port.close();\n }\n }).catch((ex) => {\n removeCloseListener();\n throw ex;\n });\n const remote = Comlink.wrap(workerPort);\n const identifier = this.syncParams.dbParams.dbFilename;\n const clientLockName = await this.sharedCloseSignal;\n /**\n * The open could fail if the tab is closed while we're busy opening the database.\n * This operation is typically executed inside an exclusive portMutex lock.\n * We typically execute the closeListeners using the portMutex in a different context.\n * We can't rely on the closeListeners to abort the operation if the tab is closed.\n */\n const db = await withAbort({\n action: async () => {\n const clientView = await remote.connectToExisting({ identifier, lockName: clientLockName });\n return new DatabaseClient({\n connection: clientView,\n source: remote,\n // It's possible for this worker to outlive the client hosting the database for us. We need to be prepared for\n // that and ensure pending requests are aborted when the tab is closed.\n remoteCanCloseUnexpectedly: true\n }, this.syncParams.dbParams);\n },\n signal: abortController.signal,\n cleanupOnAbort: (db) => {\n db.close();\n }\n }).finally(() => {\n // We can remove the close listener here since we no longer need it past this point.\n removeCloseListener();\n });\n clearTimeout(timeout);\n client.closeListeners.push(async () => {\n this.logger.log({ level: LogLevels.info, message: 'Aborting open connection because associated tab closed.' });\n handleClosed(db);\n /**\n * Don't await this close operation. It might never resolve if the tab is closed.\n * We mark the remote as closed first, this will reject any pending requests.\n * We then call close. The close operation is configured to fire-and-forget, the main promise will reject immediately.\n */\n db.markRemoteClosed();\n db.close().catch((error) => this.logger.log({ level: LogLevels.warn, message: 'error closing database connection', error }));\n });\n return db;\n }\n generateReconnectableDatabase() {\n const syncParams = this.syncParams;\n const sharedSync = this;\n return new (class extends DBAdapter {\n connectionState = null;\n get name() {\n return syncParams?.dbParams.dbFilename;\n }\n async connect() {\n if (this.connectionState == null) {\n const handleClosed = this.handleClientClosed.bind(this);\n this.connectionState = (async () => {\n try {\n const db = await sharedSync.openInternalDB(handleClosed);\n db.registerListener({\n tablesUpdated: (notification) => {\n this.iterateListeners((l) => l.tablesUpdated?.(notification));\n }\n });\n this.connectionState = db;\n return db;\n }\n catch (e) {\n // Allow reconnecting when the database is used again.\n this.connectionState = null;\n throw e;\n }\n })();\n }\n return await this.connectionState;\n }\n async close() {\n if (this.connectionState != null) {\n await (await this.connectionState).close();\n }\n }\n handleClientClosed(client) {\n if (client === this.connectionState) {\n this.connectionState = null;\n // We may have missed some table updates while the database was closed.\n // We can poke the crud in case we missed any updates.\n const impl = sharedSync.connectionManager.syncStreamImplementation;\n impl?.triggerCrudUpload();\n // The Rust client implementation stores sync state on the connection level. Reopening the database causes a\n // disruption of the connection state and forces us to reconnect. We want to do that as soon as possible to\n // minimize downtime.\n impl?.markConnectionMayHaveChanged();\n }\n }\n async readLock(fn, options) {\n const db = await this.connect();\n return db.readLock(fn, options);\n }\n async writeLock(fn, options) {\n const db = await this.connect();\n return db.writeLock(fn, options);\n }\n async refreshSchema() {\n // Not used by sync client.\n }\n })();\n }\n}\n/**\n * Runs the action with an abort controller.\n */\nfunction withAbort(options) {\n const { action, signal, cleanupOnAbort } = options;\n const abortError = () => signal.reason instanceof Error ? signal.reason : new AbortOperation('Operation aborted by abort controller');\n return new Promise((resolve, reject) => {\n if (signal.aborted) {\n reject(abortError());\n return;\n }\n function handleAbort() {\n signal.removeEventListener('abort', handleAbort);\n reject(abortError());\n }\n signal.addEventListener('abort', handleAbort, { once: true });\n function completePromise(action) {\n signal.removeEventListener('abort', handleAbort);\n action();\n }\n action()\n .then((data) => {\n // We already rejected due to the abort, allow for cleanup\n if (signal.aborted) {\n return completePromise(() => cleanupOnAbort?.(data));\n }\n completePromise(() => resolve(data));\n })\n .catch((e) => completePromise(() => reject(e)));\n });\n}\nfunction checkCapabilitiesCompatible(a, b) {\n if (a.hasFetchCredentials != b.hasFetchCredentials ||\n a.hasUploadCrud != b.hasUploadCrud ||\n a.hasPostCheckpointRequest != b.hasPostCheckpointRequest) {\n throw new Error('Different tabs connecting in different modes (download-only / upload-only / full, or with and without custom checkpoint requests) is not supported');\n }\n}\n//# sourceMappingURL=SharedSyncImplementation.js.map","import * as Comlink from 'comlink';\nimport { AbstractSharedSyncClientProvider } from '../../worker/sync/AbstractSharedSyncClientProvider.js';\nimport { SharedSyncClientEvent } from '../../worker/sync/SharedSyncImplementation.js';\nimport { WebStreamingSyncImplementation } from './WebStreamingSyncImplementation.js';\nimport { generateTabCloseSignal } from '../../shared/tab_close_signal.js';\nimport { serializeErrorForRelay } from '@powersync/shared-internals';\nimport { connectToExistingWorker, connectToWorker } from '../../worker/client.js';\n/**\n * The shared worker will trigger methods on this side of the message port\n * via this client provider.\n */\nclass SharedSyncClientProvider extends AbstractSharedSyncClientProvider {\n options;\n statusChanged;\n webDB;\n constructor(options, statusChanged, webDB) {\n super();\n this.options = options;\n this.statusChanged = statusChanged;\n this.webDB = webDB;\n }\n async getDBWorkerPort() {\n const { port } = await this.webDB.shareConnection();\n return Comlink.transfer(port, [port]);\n }\n async #relay(action) {\n try {\n return await action();\n }\n catch (ex) {\n /**\n * Connector callbacks run in this tab and their rejection crosses the\n * MessagePort to the sync worker, so serialize it here, where the error\n * originates, before Comlink's error transfer can drop custom fields.\n */\n throw serializeErrorForRelay(ex);\n }\n }\n invalidateCredentials() {\n this.options.remote.invalidateCredentials();\n }\n async fetchCredentials() {\n const credentials = await this.#relay(() => this.options.remote.getCredentials());\n if (credentials == null) {\n return null;\n }\n /**\n * The credentials need to be serializable.\n * Users might extend [PowerSyncCredentials] to contain\n * items which are not serializable.\n * This returns only the essential fields.\n */\n return {\n endpoint: credentials.endpoint,\n token: credentials.token\n };\n }\n async uploadCrud() {\n /**\n * Don't return anything here, just incase something which is not\n * serializable is returned from the `uploadCrud` function.\n */\n await this.#relay(() => this.options.connector.uploadCrud());\n }\n async postCheckpointRequest(clientId, requestId) {\n return await this.#relay(async () => (await this.options.connector.postCheckpointRequest(clientId, requestId)) ?? null);\n }\n get logger() {\n return this.options.logger;\n }\n log(record) {\n this.logger.log(record);\n }\n}\n/**\n * The local part of the sync implementation on the web, which talks to a sync implementation hosted in a shared worker.\n */\nexport class SharedWebStreamingSyncImplementation extends WebStreamingSyncImplementation {\n syncManager;\n clientProvider;\n worker;\n isInitialized;\n dbAdapter;\n abortOnClose = new AbortController();\n logLevel;\n enableBroadcastLogs;\n constructor(options) {\n super(options);\n this.dbAdapter = options.db;\n this.logLevel = options.logLevel;\n this.enableBroadcastLogs = options.enableBroadcastLogs;\n const syncWorker = options.sync?.worker;\n if (typeof syncWorker === 'function') {\n this.worker = connectToExistingWorker(syncWorker(), options.logger, 'sync');\n }\n else {\n this.worker = connectToWorker({\n service: 'sync',\n databaseIdentifier: this.webOptions.identifier,\n shared: true,\n customWorker: syncWorker,\n loggerForErrors: options.logger\n });\n }\n /**\n * Pass along any sync status updates to this listener\n */\n this.clientProvider = new SharedSyncClientProvider(this.webOptions, ({ core, dataFlow }) => {\n this.updateSyncStatus(core, dataFlow);\n }, options.db);\n this.syncManager = Comlink.wrap(this.worker.endpoint);\n /**\n * The sync worker will call this client provider when it needs\n * to fetch credentials or upload data.\n * This performs bi-directional method calling.\n */\n Comlink.expose(this.clientProvider, this.worker.endpoint);\n this.syncManager.setLogLevel(this.logLevel);\n this.triggerCrudUpload = this.syncManager.triggerCrudUpload;\n /**\n * Opens MessagePort to the existing shared DB worker.\n * The sync worker cannot initiate connections directly to the\n * DB worker, but a port to the DB worker can be transferred to the\n * sync worker.\n */\n this.isInitialized = this._init();\n }\n async _init() {\n /**\n * The general flow of initialization is:\n * - The client requests a unique navigator lock.\n * - Once the lock is acquired, we register the lock with the shared worker.\n * - The shared worker can then request the same lock. The client has been closed if the shared worker can acquire the lock.\n * - Once the shared worker knows the client's lock, we can guarentee that the shared worker will detect if the client has been closed.\n * - This makes the client safe for the shared worker to use.\n * - The client is only added to the SharedSyncImplementation once the lock has been registered.\n * This ensures we don't ever keep track of dead clients (tabs that closed before the lock was registered).\n * - The client side lock is held until the client is disposed.\n * - We resolve the top-level promise after the lock has been registered with the shared worker.\n * - The client sends the params to the shared worker after locks have been registered.\n */\n const closeSignal = await generateTabCloseSignal(this.abortOnClose.signal);\n const { identifier, connector } = this.options;\n // Awaiting here ensures the worker is waiting for the lock\n await this.syncManager.initialize(closeSignal, {\n hasFetchCredentials: !!connector.fetchCredentials,\n hasPostCheckpointRequest: !!connector.postCheckpointRequest,\n hasUploadCrud: !!connector.uploadCrud\n });\n await this.syncManager.setParams({\n dbParams: this.dbAdapter.getConfiguration(),\n streamOptions: {\n identifier,\n serializedSchema: this.options.serializedSchema\n },\n enableBroadcastLogs: this.enableBroadcastLogs\n }, this.options.subscriptions);\n }\n /**\n * Starts the sync process, this effectively acts as a call to\n * `connect` if not yet connected.\n */\n async connect(options) {\n await this.waitForReady();\n return this.syncManager.connect(options, this.options.serializedSchema);\n }\n async disconnect() {\n await this.waitForReady();\n return this.syncManager.disconnect();\n }\n async dispose() {\n let registeredWithWorker = true;\n try {\n await this.waitForReady();\n }\n catch {\n // The worker rejected this client (e.g. because it connects in a mode incompatible with other tabs), so it won't\n // acknowledge a close request either.\n registeredWithWorker = false;\n }\n if (registeredWithWorker) {\n await this.#closeWorkerClient();\n }\n await super.dispose();\n this.abortOnClose.abort();\n // Release the proxy\n this.syncManager[Comlink.releaseProxy]();\n this.worker.close();\n }\n #closeWorkerClient() {\n return new Promise((resolve) => {\n // This will always be a message port since we use shared workers.\n const messagePort = this.worker.endpoint;\n // Listen for the close acknowledgment from the worker\n messagePort.addEventListener('message', (event) => {\n const payload = event.data;\n if (payload?.event === SharedSyncClientEvent.CLOSE_ACK) {\n resolve();\n }\n });\n // Signal the shared worker that this client is closing its connection to the worker\n const closeMessagePayload = {\n event: SharedSyncClientEvent.CLOSE_CLIENT,\n data: {}\n };\n messagePort.postMessage(closeMessagePayload);\n });\n }\n async waitForReady() {\n return this.isInitialized;\n }\n requestCheckpoint() {\n return this.syncManager.requestCheckpoint();\n }\n updateSubscriptions(subscriptions) {\n this.syncManager.updateSubscriptions(subscriptions);\n }\n}\n//# sourceMappingURL=SharedWebStreamingSyncImplementation.js.map","import { LockType } from '@powersync/shared-internals';\nimport { WebStreamingSyncImplementation } from './WebStreamingSyncImplementation.js';\n/**\n * When multi-tab support is disabled and we don't use a shared worker for sync, only a single tab will be able to\n * acquire the sync navigator lock and start a sync iteration.\n *\n * To be able to provide _some_ multi-tab support in that configuration, this utility:\n *\n * 1. Sends sync status updates from the syncing tab to others.\n * 2. Allows other tabs to send notifications when their active sync stream subscriptions update, allowing the active\n * tab to take those subscriptions into account.\n */\nexport class TabLocalStreamingSyncImplementation extends WebStreamingSyncImplementation {\n #statusUpdated;\n #subscriptionsChanged;\n #hasSyncLock = false;\n constructor(options) {\n super(options);\n const identifier = options.identifier;\n this.#statusUpdated = new BroadcastChannel(`sync-status-${identifier}`);\n this.#subscriptionsChanged = new BroadcastChannel(`subscription-change-${identifier}`);\n this.#statusUpdated.onmessage = (event) => {\n if (event.data == 'ping') {\n this.#sendStatus(this.syncStatus);\n return;\n }\n const { core, dataFlow } = event.data;\n this.updateSyncStatus(core, dataFlow);\n };\n // Request other tabs to share their sync status.\n this.#statusUpdated.postMessage('ping');\n this.#subscriptionsChanged.onmessage = () => {\n // We can't update activeStreams since we don't know when another tab referencing them is closed. However,\n // clients will update an internal table listing streams after subscribing, and updateSubscriptions() will\n // scan that table.\n super.updateSubscriptions(this.activeStreams);\n };\n this.registerListener({\n statusChanged: (status) => this.#sendStatus(status)\n });\n }\n #sendStatus(status) {\n // Don't share sync status if this is not the tab currently syncing.\n if (this.#hasSyncLock) {\n this.#statusUpdated.postMessage(status.toJSON());\n }\n }\n updateSubscriptions(subscriptions) {\n super.updateSubscriptions(subscriptions);\n this.#subscriptionsChanged.postMessage('');\n }\n obtainLock({ callback, type, signal }) {\n const wrappedCallback = async () => {\n this.#hasSyncLock = true;\n try {\n return await callback();\n }\n finally {\n this.#hasSyncLock = false;\n }\n };\n return super.obtainLock({ callback: type == LockType.SYNC ? wrappedCallback : callback, type, signal });\n }\n async dispose() {\n this.#statusUpdated.close();\n this.#subscriptionsChanged.close();\n await super.dispose();\n }\n}\n//# sourceMappingURL=TabLocalStreamingSyncImplementation.js.map","import { BaseObserver } from '@powersync/common';\n/**\n * Live database instances in this page, for development tooling.\n *\n * Every {@link WebPowerSyncDatabase} registers itself when constructed and leaves when closed, so a\n * tool that runs in the same page (for example the diagnostics Vite plugin's injected agent) can find\n * the app's databases without the app wiring anything up. The set holds only instances that already\n * exist, so it adds nothing to a production bundle beyond the references themselves.\n */\nclass DatabaseRegistry extends BaseObserver {\n databases = new Set();\n notify() {\n const snapshot = [...this.databases];\n this.iterateListeners((listener) => listener.databasesChanged?.(snapshot));\n }\n}\nconst registry = new DatabaseRegistry();\n/** @internal Called by the database constructor. */\nexport function registerDatabase(db) {\n registry.databases.add(db);\n registry.notify();\n}\n/** @internal Called when the database closes. */\nexport function unregisterDatabase(db) {\n if (registry.databases.delete(db)) {\n registry.notify();\n }\n}\n/** The databases currently open in this page. */\nexport function getRegisteredDatabases() {\n return [...registry.databases];\n}\n/**\n * Calls `listener` with the current databases now, and again whenever one is opened or closed.\n * Returns a function that stops listening.\n */\nexport function observeRegisteredDatabases(listener) {\n const stop = registry.registerListener({ databasesChanged: listener });\n listener([...registry.databases]);\n return stop;\n}\n//# sourceMappingURL=registry.js.map","import { LogLevels } from '@powersync/common';\nimport { BasePowerSyncDatabase, Mutex, openDatabase } from '@powersync/shared-internals';\nimport { getNavigatorLocks } from '../shared/navigator.js';\nimport { NAVIGATOR_TRIGGER_CLAIM_MANAGER } from './NavigatorTriggerClaimManager.js';\nimport { WASQLiteOpenFactory } from './adapters/wa-sqlite/WASQLiteOpenFactory.js';\nimport { SSRStreamingSyncImplementation } from './sync/SSRWebStreamingSyncImplementation.js';\nimport { SharedWebStreamingSyncImplementation } from './sync/SharedWebStreamingSyncImplementation.js';\nimport { WebRemote } from './sync/WebRemote.js';\nimport { AsyncDbAdapter } from './adapters/AsyncWebAdapter.js';\nimport { resolveAndValidateOptions } from './adapters/resolveAndValidateOptions.js';\nimport { TabLocalStreamingSyncImplementation } from './sync/TabLocalStreamingSyncImplementation.js';\nimport { registerDatabase, unregisterDatabase } from '../devtools/registry.js';\n/**\n * @internal Use {@link PowerSyncDatabase} instead, this class is only used by other SDKs also needing web support.\n */\nexport class WebPowerSyncDatabase extends BasePowerSyncDatabase {\n static SHARED_MUTEX = new Mutex();\n resolvedOpenOptions;\n enableBroadcastLogs;\n constructor(options) {\n const resolvedOpenOptions = resolveAndValidateOptions('database' in options ? options.database : {});\n super(options);\n this.resolvedOpenOptions = resolvedOpenOptions;\n this.enableBroadcastLogs = options.broadcastLogs ?? true;\n // Lets development tooling in this page find the live databases.\n registerDatabase(this);\n }\n get sdkName() {\n return '@powersync/web';\n }\n async _initialize() {\n if (this.database instanceof AsyncDbAdapter) {\n /**\n * While init is done automatically,\n * LockedAsyncDatabaseAdapter only exposes config after init.\n * We can explicitly wait for init here in order to access config.\n */\n await this.database.init();\n }\n // In some cases, like the SQLJs adapter, we don't pass a WebDBAdapter, so we need to check.\n if (typeof this.database.getConfiguration == 'function') {\n const config = this.database.getConfiguration();\n if (config.requiresPersistentTriggers) {\n this.triggersImpl.updateDefaults({\n useStorageByDefault: true\n });\n }\n }\n }\n generateTriggerManagerConfig() {\n return {\n // We need to share hold information between tabs for web\n claimManager: NAVIGATOR_TRIGGER_CLAIM_MANAGER\n };\n }\n openDBAdapter() {\n return openDatabase(this.options, (options) => {\n const defaultFactory = new WASQLiteOpenFactory({\n logger: this.logger,\n open: options\n });\n return defaultFactory.openDB();\n });\n }\n /**\n * Closes the database connection.\n * By default the sync stream client is only disconnected if\n * multiple tabs are not enabled.\n */\n async close(options) {\n await super.close({\n // Don't disconnect by default if multiple tabs are enabled\n disconnect: options?.disconnect ?? !this.resolvedOpenOptions.enableMultiTabs\n });\n unregisterDatabase(this);\n }\n async loadVersion() {\n if (this.resolvedOpenOptions.ssrMode) {\n return;\n }\n return super.loadVersion();\n }\n async resolveOfflineSyncStatus() {\n if (this.resolvedOpenOptions.ssrMode) {\n return;\n }\n return super.resolveOfflineSyncStatus();\n }\n async runExclusive(cb) {\n if (this.resolvedOpenOptions.ssrMode) {\n return WebPowerSyncDatabase.SHARED_MUTEX.runExclusive(cb);\n }\n return getNavigatorLocks().request(`lock-${this.database.name}`, cb);\n }\n generateSyncStreamImplementation(connector, options) {\n const remote = new WebRemote(connector, this.logger);\n const syncOptions = {\n ...this.options,\n ...this.commonSyncOptions(connector, options),\n remote\n };\n if (this.resolvedOpenOptions.ssrMode) {\n return new SSRStreamingSyncImplementation();\n }\n else if (this.resolvedOpenOptions.enableMultiTabs) {\n if (!this.enableBroadcastLogs) {\n const warning = `\n Multiple tabs are enabled, but broadcasting of logs is disabled.\n Logs for shared sync worker will only be available in the shared worker context\n `;\n const logger = this.options.logger;\n logger ? logger.log({ level: LogLevels.warn, message: warning }) : console.warn(warning);\n }\n if ('shareConnection' in this.database) {\n return new SharedWebStreamingSyncImplementation({\n ...syncOptions,\n db: this.database, // This should always be the case\n logLevel: this.options.sync?.logLevel ?? LogLevels.info,\n enableBroadcastLogs: this.enableBroadcastLogs\n });\n }\n this.logger.log({\n level: LogLevels.warn,\n message: \"Not using a shared sync worker because the database adapter doesn't support it.\"\n });\n }\n return new TabLocalStreamingSyncImplementation(syncOptions);\n }\n}\n/**\n * A PowerSync database which provides SQLite functionality\n * which is automatically synced.\n *\n * @example\n * ```typescript\n * export const db = new PowerSyncDatabase({\n * schema: AppSchema,\n * database: {\n * dbFilename: 'example.db'\n * }\n * });\n * ```\n */\n// Typed constructor to avoid leaking AbstractPowerSyncDatabase into the public interface\nexport const PowerSyncDatabase = WebPowerSyncDatabase;\n//# sourceMappingURL=PowerSyncDatabase.js.map"],"names":["WaSqliteFactory","isSharedWorker"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAM,+BAA+B,CAAC;AAC7C,IAAI,YAAY;AAChB,IAAI,SAAS;AACb,IAAI,WAAW,CAAC,YAAY,GAAG,gBAAgB,EAAE;AACjD,QAAQ,IAAI,CAAC,YAAY,GAAG,YAAY;AACxC,IAAI;AACJ,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAC1D,YAAY,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;AAChE,YAAY,OAAO,CAAC,eAAe,GAAG,MAAM;AAC5C,gBAAgB,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC;AACzD,YAAY,CAAC;AACb,YAAY,OAAO,CAAC,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;AAC7D,YAAY,OAAO,CAAC,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;AACzD,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,SAAS;AACvC,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAChD,YAAY,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC;AAC3D,YAAY,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;AACj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gBAAgB,OAAO,IAAI,oCAAoC,CAAC;AAChE,oBAAoB,GAAG,WAAW;AAClC,oBAAoB,EAAE,EAAE,IAAI,CAAC,QAAQ;AACrC,oBAAoB,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,IAAI,SAAS,CAAC,IAAI;AAC3E,oBAAoB,mBAAmB,EAAE,IAAI,CAAC;AAC9C,iBAAiB,CAAC;AAClB,YAAY;AACZ,YAAY,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;AAC5B,gBAAgB,KAAK,EAAE,SAAS,CAAC,IAAI;AACrC,gBAAgB,OAAO,EAAE;AACzB,aAAa,CAAC;AACd,QAAQ;AACR,QAAQ,OAAO,IAAI,mCAAmC,CAAC,WAAW,CAAC;AACnE,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG;;;;"}
1
+ {"version":3,"file":"index.react_native_web.js","sources":["../lib/attachments/IndexDBFileSystemAdapter.js","../lib/db/adapters/wa-sqlite/vfs.js","../lib/db/adapters/SSRDBAdapter.js","../lib/db/adapters/wa-sqlite/DatabaseServer.js","../lib/shared/locks.js","../lib/db/adapters/options.js","../lib/db/adapters/resolveAndValidateOptions.js","../lib/db/adapters/wa-sqlite/StatementCache.js","../lib/db/adapters/wa-sqlite/RawSqliteConnection.js","../lib/db/adapters/wa-sqlite/ConcurrentConnection.js","../lib/worker/db/MultiDatabaseServer.js","../lib/db/adapters/wa-sqlite/DatabaseClient.js","../lib/db/adapters/acquireFromPool.js","../lib/db/adapters/AsyncWebAdapter.js","../lib/worker/client.js","../lib/db/adapters/wa-sqlite/WASQLiteOpenFactory.js","../lib/db/NavigatorTriggerClaimManager.js","../lib/db/sync/SSRWebStreamingSyncImplementation.js","../lib/worker/sync/AbstractSharedSyncClientProvider.js","../lib/db/sync/userAgent.js","../lib/db/sync/WebRemote.js","../lib/db/sync/WebStreamingSyncImplementation.js","../lib/worker/sync/SharedSyncImplementation.js","../lib/db/sync/SharedWebStreamingSyncImplementation.js","../lib/db/sync/TabLocalStreamingSyncImplementation.js","../lib/devtools/registry.js","../lib/db/PowerSyncDatabase.js","../lib/db/adapters/wa-sqlite/SimpleOpfsFileSystem.js"],"sourcesContent":["/**\n * IndexDBFileSystemStorageAdapter implements LocalStorageAdapter using IndexedDB.\n * Suitable for web browsers and web-based environments.\n */\nexport class IndexDBFileSystemStorageAdapter {\n databaseName;\n dbPromise;\n constructor(databaseName = 'PowerSyncFiles') {\n this.databaseName = databaseName;\n }\n async initialize() {\n this.dbPromise = new Promise((resolve, reject) => {\n const request = indexedDB.open(this.databaseName, 1);\n request.onupgradeneeded = () => {\n request.result.createObjectStore('files');\n };\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error);\n });\n }\n async clear() {\n const db = await this.dbPromise;\n return new Promise((resolve, reject) => {\n const tx = db.transaction('files', 'readwrite');\n const store = tx.objectStore('files');\n const req = store.clear();\n req.onsuccess = () => resolve();\n req.onerror = () => reject(req.error);\n });\n }\n getLocalUri(filename) {\n return `indexeddb://${this.databaseName}/files/${filename}`;\n }\n async getStore(mode = 'readonly') {\n const db = await this.dbPromise;\n const tx = db.transaction('files', mode);\n return tx.objectStore('files');\n }\n async saveFile(filePath, data) {\n const store = await this.getStore('readwrite');\n let dataToStore;\n let size;\n if (typeof data === 'string') {\n const binaryString = atob(data);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n dataToStore = bytes.buffer;\n size = bytes.byteLength;\n }\n else {\n dataToStore = data;\n size = dataToStore.byteLength;\n }\n return await new Promise((resolve, reject) => {\n const req = store.put(dataToStore, filePath);\n req.onsuccess = () => resolve(size);\n req.onerror = () => reject(req.error);\n });\n }\n async readFile(fileUri, options) {\n const store = await this.getStore();\n return new Promise((resolve, reject) => {\n const req = store.get(fileUri);\n req.onsuccess = async () => {\n if (!req.result) {\n reject(new Error('File not found'));\n return;\n }\n resolve(req.result);\n };\n req.onerror = () => reject(req.error);\n });\n }\n async deleteFile(uri, options) {\n const store = await this.getStore('readwrite');\n await new Promise((resolve, reject) => {\n const req = store.delete(uri);\n req.onsuccess = () => resolve();\n req.onerror = () => reject(req.error);\n });\n }\n async fileExists(fileUri) {\n const store = await this.getStore();\n return new Promise((resolve, reject) => {\n const req = store.get(fileUri);\n req.onsuccess = () => resolve(!!req.result);\n req.onerror = () => reject(req.error);\n });\n }\n async makeDir(path) {\n // No-op for IndexedDB as it does not have a directory structure\n }\n async rmDir(path) {\n const store = await this.getStore('readwrite');\n const range = IDBKeyRange.bound(path + '/', path + '/\\uffff', false, false);\n await new Promise((resolve, reject) => {\n const req = store.delete(range);\n req.onsuccess = () => resolve();\n req.onerror = () => reject(req.error);\n });\n }\n}\n//# sourceMappingURL=IndexDBFileSystemAdapter.js.map","/**\n * List of currently tested virtual filesystems\n */\nexport var WASQLiteVFS;\n(function (WASQLiteVFS) {\n WASQLiteVFS[\"IDBBatchAtomicVFS\"] = \"IDBBatchAtomicVFS\";\n WASQLiteVFS[\"OPFSCoopSyncVFS\"] = \"OPFSCoopSyncVFS\";\n WASQLiteVFS[\"AccessHandlePoolVFS\"] = \"AccessHandlePoolVFS\";\n WASQLiteVFS[\"OPFSWriteAheadVFS\"] = \"OPFSWriteAheadVFS\";\n /**\n * A virtual file system storing data in-memory only, without persistence.\n *\n * This file system can be used in three configurations:\n *\n * 1. In shared workers (the default when available): All tabs share the same in-memory database, which is cleared\n * once the last tab is closed.\n * 2. In dedicated workers (used when `enableMultiTabs` is disabled). Each tab has its own in-memory database cleared\n * when the tab is closed. Queries are offloaded to a dedicated worker.\n * 3. In the context of the tab itself (used when both `enableMultiTabs` and `useWebWorker` are disabled). The per-tab\n * database is hosted in the tab itself, and queries run synchronously. This is _a lot_ faster than any other\n * single-threadedVFS, but can block JavaScript for computationally-intensive queries.\n *\n * This VFS primarily intended for development, but it also useful for online-first deployments not syncing large\n * amounts of data, as it is quicker to start up.\n */\n WASQLiteVFS[\"InMemoryVfs\"] = \"InMemoryVFS\";\n /**\n * A simple OPFS-based virtual file system.\n *\n * This VFS uses a very simple internal design: Instead of opening files on demand (or with a prior pool), it uses the\n * fact that that a SQLite database only consists of two files: The main database and a journal for recovery. These\n * two file handles are pre-opened before the database is used, allowing all IO to be synchronous and to go directly\n * to those files.\n *\n * It is worth noting that this design has fundamental drawbacks: It doesn't support `ATTACH`ing additional databases,\n * and temporary data (e.g. for materialized CTEs) is always stored in memory. This is not relevant for most setups\n * though, and not supporting this is what enables the simple design.\n *\n * Synchronous file handles in OPFS are only available in dedicated workers, and two tabs can't open the same file\n * at the same time. To enable multi-tab support, this VFS comes in three possible configurations, the PowerSync SDK\n * selects the best one based on browser features:\n *\n * 1. __Shared workers__: While we need dedicated workers to access files synchronously, the web standard allows\n * shared workers to spawn their own dedicated workers. This is not supported by all browsers, but highly efficient\n * option when available as we don't need to rely on navigator locks.\n * 2. `readwrite-unsafe`: On Chromium browsers, this flag allows multiple tabs to access the same files (the PowerSync\n * SDK additionally uses navigator locks to avoid corruption from concurrent writes).\n * 3. Close and open fallback: On other browsers, file handles are kept open until another tab signals that it needs\n * access to them. At that point, queued local transactions are awaited before closing the file handles. At the\n * next database query, the same signal is sent to the other tab before re-opening files locally.\n */\n WASQLiteVFS[\"SimpleOpfsVFS\"] = \"SimpleOpfsVFS\";\n})(WASQLiteVFS || (WASQLiteVFS = {}));\nexport function vfsRequiresDedicatedWorkers(vfs) {\n if (vfs === 'auto') {\n // Falls back to an in-memory database when workers aren't available.\n return false;\n }\n return vfs != WASQLiteVFS.IDBBatchAtomicVFS && vfs != WASQLiteVFS.InMemoryVfs;\n}\n/**\n * Whether the VFS can keep its files in a Storage Bucket, see {@link WebSpecificOpenOptions.storageBucket}.\n */\nexport function vfsSupportsStorageBuckets(vfs) {\n switch (vfs) {\n case WASQLiteVFS.OPFSCoopSyncVFS:\n case WASQLiteVFS.OPFSWriteAheadVFS:\n case WASQLiteVFS.AccessHandlePoolVFS:\n case WASQLiteVFS.SimpleOpfsVFS:\n case 'auto': // auto mode can resolve to opfs, in which case it supports storage buckets\n return true;\n default:\n return false;\n }\n}\n/**\n * Options for an OPFS-based VFS that keep its files in the named Storage Bucket, see\n * {@link WebSpecificOpenOptions.storageBucket}. Without a bucket name, no options: the VFS uses the root of the\n * origin private file system.\n *\n * @internal\n */\nexport function vfsOptionsForStorageBucket(storageBucket, storageBuckets = navigator.storageBuckets) {\n if (storageBucket == null) {\n return {};\n }\n if (storageBuckets == null) {\n throw new Error(`The 'storageBucket' option needs the Storage Buckets API (navigator.storageBuckets), which this browser does not have. Check for it before setting the option.`);\n }\n return {\n // Called by the VFS each time it needs its root directory. Opening the bucket again creates it when the\n // browser deleted it with the rest of the site's data.\n getRoot: () => storageBuckets.open(storageBucket).then((bucket) => bucket.getDirectory()),\n // Keeps the locks and channels of a file apart from those of a file of the same name in another bucket.\n // Bucket names cannot contain ':', so the names of two buckets never overlap.\n prefix: `${storageBucket}:`\n };\n}\nasync function asyncModuleFactory(encryptionKey) {\n if (encryptionKey) {\n const { default: factory } = await import('@journeyapps/wa-sqlite/dist/mc-wa-sqlite-async.mjs');\n return factory();\n }\n else {\n const { default: factory } = await import('@journeyapps/wa-sqlite/dist/wa-sqlite-async.mjs');\n return factory();\n }\n}\nasync function syncModuleFactory(encryptionKey) {\n if (encryptionKey) {\n const { default: factory } = await import('@journeyapps/wa-sqlite/dist/mc-wa-sqlite.mjs');\n return factory();\n }\n else {\n const { default: factory } = await import('@journeyapps/wa-sqlite/dist/wa-sqlite.mjs');\n return factory();\n }\n}\n/**\n * @internal\n */\nexport async function loadModuleAndVfs({ vfs, filename, encryptionKey, storageBucket, simpleMode }) {\n let moduleFactory = syncModuleFactory;\n let resolveVfs;\n switch (vfs) {\n case WASQLiteVFS.IDBBatchAtomicVFS: {\n moduleFactory = asyncModuleFactory;\n const { IDBBatchAtomicVFS } = await import('@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js');\n resolveVfs = (module) => {\n // @ts-expect-error The types for this static method are missing upstream\n return IDBBatchAtomicVFS.create(filename, module, { lockPolicy: 'exclusive' });\n };\n break;\n }\n case WASQLiteVFS.AccessHandlePoolVFS: {\n // @ts-expect-error The types for this import are missing upstream\n const { AccessHandlePoolVFS } = await import('@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js');\n resolveVfs = (module) => AccessHandlePoolVFS.create(filename, module, vfsOptionsForStorageBucket(storageBucket));\n break;\n }\n case WASQLiteVFS.OPFSCoopSyncVFS: {\n // @ts-expect-error The types for this import are missing upstream\n const { OPFSCoopSyncVFS } = await import('@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js');\n resolveVfs = (module) => OPFSCoopSyncVFS.create(filename, module, vfsOptionsForStorageBucket(storageBucket));\n break;\n }\n case WASQLiteVFS.OPFSWriteAheadVFS: {\n // @ts-expect-error The types for this import are missing upstream\n const { OPFSWriteAheadVFS } = await import('@journeyapps/wa-sqlite/src/examples/OPFSWriteAheadVFS.js');\n resolveVfs = (module) => OPFSWriteAheadVFS.create(filename, module, vfsOptionsForStorageBucket(storageBucket));\n break;\n }\n case WASQLiteVFS.SimpleOpfsVFS: {\n const { SimpleOpfsFileSystem } = await import('./SimpleOpfsFileSystem.js');\n const getRoot = vfsOptionsForStorageBucket(storageBucket).getRoot;\n const resolver = SimpleOpfsFileSystem.directoryResolver(filename, simpleMode === 'rw-unsafe', getRoot);\n // @ts-expect-error It conforms to SQLiteVFS, but an intermediate type is missing so tsc can't know\n resolveVfs = async (module) => {\n const vfs = new SimpleOpfsFileSystem(filename, module, resolver);\n await vfs.open();\n return vfs;\n };\n break;\n }\n case WASQLiteVFS.InMemoryVfs: {\n const { MemoryVFS } = await import('@journeyapps/wa-sqlite/src/examples/MemoryVFS.js');\n // @ts-expect-error The types for this static method are missing upstream\n resolveVfs = (module) => MemoryVFS.create(filename, module);\n break;\n }\n }\n const module = await moduleFactory(encryptionKey);\n return { module, vfs: await resolveVfs(module) };\n}\n//# sourceMappingURL=vfs.js.map","import { DBAdapter, LockContext } from '@powersync/common';\nimport { Mutex } from '@powersync/shared-internals';\nconst MOCK_QUERY_RESPONSE = {\n rowsAffected: 0,\n columnNames: [],\n rawRows: []\n};\n/**\n * Implements a Mock DB adapter for use in Server Side Rendering (SSR).\n * This adapter will return empty results for queries, which will allow\n * server rendered views to initially generate scaffolding components\n */\nexport class SSRDBAdapter extends DBAdapter {\n name;\n readMutex;\n writeMutex;\n constructor() {\n super();\n this.name = 'SSR DB';\n this.readMutex = new Mutex();\n this.writeMutex = new Mutex();\n }\n close() { }\n async readLock(fn, options) {\n return fn(new StubLockContext());\n }\n async writeLock(fn, options) {\n return fn(new StubLockContext());\n }\n async refreshSchema() { }\n}\nclass StubLockContext extends LockContext {\n async executeRaw() {\n return MOCK_QUERY_RESPONSE;\n }\n}\n//# sourceMappingURL=SSRDBAdapter.js.map","import { LogLevels } from '@powersync/common';\n/**\n * Access to a WA-sqlite connection that can be shared with multiple clients sending queries over an RPC protocol built\n * with the Comlink package.\n */\nexport class DatabaseServer {\n #options;\n #nextClientId = 0;\n #activeClients = new Set();\n // TODO: Don't use a broadcast channel for connections managed by a shared worker.\n #updateBroadcastChannel;\n #clientTableListeners = new Set();\n constructor(options) {\n this.#options = options;\n const inner = options.inner;\n this.#updateBroadcastChannel = new BroadcastChannel(`${inner.options.filename}-table-updates`);\n this.#updateBroadcastChannel.onmessage = ({ data }) => {\n this.#pushTableUpdateToClients(data);\n };\n }\n #pushTableUpdateToClients(changedTables) {\n for (const listener of this.#clientTableListeners) {\n listener.postMessage(changedTables);\n }\n }\n get #inner() {\n return this.#options.inner;\n }\n get #logger() {\n return this.#options.logger;\n }\n /**\n * Called by clients when they wish to connect to this database.\n *\n * @param lockName A lock that is currently held by the client. When the lock is returned, we know the client is gone\n * and that we need to clean up resources.\n */\n async connect(lockName) {\n let isOpen = true;\n const clientId = this.#nextClientId++;\n this.#activeClients.add(clientId);\n let connectionLeases = new Map();\n let currentTableListener;\n function requireOpen() {\n if (!isOpen) {\n throw new Error('Client has already been closed');\n }\n }\n function requireOpenAndLease(lease) {\n requireOpen();\n const token = connectionLeases.get(lease);\n if (!token) {\n throw new Error('Attempted to use a connection lease that has already been returned.');\n }\n return token;\n }\n const close = async () => {\n if (isOpen) {\n isOpen = false;\n if (currentTableListener) {\n this.#clientTableListeners.delete(currentTableListener);\n }\n // If the client holds a connection lease it hasn't returned, return that now.\n for (const { lease } of connectionLeases.values()) {\n this.#logger.log({ level: LogLevels.debug, message: `Closing connection lease that hasn't been returned.` });\n await lease.returnLease();\n }\n this.#activeClients.delete(clientId);\n if (this.#activeClients.size == 0) {\n await this.forceClose();\n }\n else {\n this.#logger.log({\n level: LogLevels.debug,\n message: 'Keeping underlying connection active since its used by other clients.'\n });\n }\n }\n };\n if (lockName) {\n navigator.locks.request(lockName, {}, () => {\n close();\n });\n }\n return {\n close,\n debugIsAutoCommit: async () => {\n return this.#inner.unsafeUseInner().isAutoCommit();\n },\n requestAccess: async (write, timeoutMs) => {\n requireOpen();\n const lease = await this.#inner.acquireConnection(timeoutMs != null ? AbortSignal.timeout(timeoutMs) : undefined);\n if (!isOpen) {\n // Race between requestAccess and close(), the connection was closed while we tried to acquire a lease.\n await lease.returnLease();\n return requireOpen();\n }\n const token = crypto.randomUUID();\n connectionLeases.set(token, { lease, write });\n return token;\n },\n completeAccess: async (token) => {\n const lease = requireOpenAndLease(token);\n connectionLeases.delete(token);\n try {\n if (lease.write) {\n // Collect update hooks invoked while the client had the write connection.\n const { rawRows } = await lease.lease.use((conn) => conn.execute(`SELECT powersync_update_hooks('get')`));\n if (rawRows.length) {\n const updatedTables = JSON.parse(rawRows[0][0]);\n if (updatedTables.length) {\n this.#updateBroadcastChannel.postMessage(updatedTables);\n this.#pushTableUpdateToClients(updatedTables);\n }\n }\n }\n }\n finally {\n await lease.lease.returnLease();\n }\n },\n execute: async (token, sql, params) => {\n const { lease } = requireOpenAndLease(token);\n return await lease.use((db) => db.execute(sql, params));\n },\n executeBatch: async (token, sql, params) => {\n const { lease } = requireOpenAndLease(token);\n return await lease.use((db) => db.executeBatch(sql, params));\n },\n setUpdateListener: async (listener) => {\n requireOpen();\n if (currentTableListener) {\n this.#clientTableListeners.delete(currentTableListener);\n }\n currentTableListener = listener;\n if (listener) {\n this.#clientTableListeners.add(listener);\n }\n }\n };\n }\n async forceClose() {\n this.#logger.log({\n level: LogLevels.debug,\n message: `Closing connection to ${JSON.stringify(this.#inner.options)}.`\n });\n const connection = this.#inner;\n this.#options.onClose();\n this.#updateBroadcastChannel.close();\n await connection.close();\n }\n}\n//# sourceMappingURL=DatabaseServer.js.map","export const getNavigatorLocks = () => {\n if ('locks' in navigator && navigator.locks) {\n return navigator.locks;\n }\n throw new Error('Navigator locks are not available in an insecure context. Use a secure context such as HTTPS or http://localhost.');\n};\n/**\n * Requests a random lock that will be released once the optional signal is aborted (or, if no signal is given, when the\n * tab is closed).\n *\n * This allows sending the name of the lock to another context (e.g. a shared worker), which will also attempt to\n * acquire it. Since the lock is returned when the tab is closed, this allows the shared worker to free resources\n * assocatiated with this tab.\n *\n * We take hold of this lock as soon-as-possible in order to cater for potentially closed tabs.\n */\nexport async function generateTabCloseSignal(abort) {\n const name = `tab-close-signal-${crypto.randomUUID()}`;\n const releaseLock = await requestNavigatorLock(name, { signal: abort });\n abort?.addEventListener('abort', releaseLock);\n return name;\n}\n/**\n * Requests a navigator lock, resolving once it has been granted.\n *\n * The lock is held until the returned function is called, or until another context steals it (in which case `onStolen`\n * is invoked).\n */\nexport function requestNavigatorLock(name, { signal, steal, onStolen } = {}) {\n return new Promise((resolve, reject) => {\n let granted = null;\n getNavigatorLocks()\n .request(name, { signal, steal }, (_) => {\n return new Promise((returnLock) => {\n const state = { released: false };\n granted = state;\n resolve(() => {\n state.released = true;\n returnLock();\n });\n });\n })\n .catch((e) => {\n if (granted == null) {\n // Failed to obtain the lock (e.g. because the request was aborted).\n reject(e);\n }\n else if (!granted.released) {\n // The callback was invoked, but the lock hasn't been released yet. That can only mean that the lock has been\n // stolen from another context.\n onStolen?.();\n }\n });\n });\n}\n//# sourceMappingURL=locks.js.map","export var TemporaryStorageOption;\n(function (TemporaryStorageOption) {\n TemporaryStorageOption[\"MEMORY\"] = \"memory\";\n TemporaryStorageOption[\"FILESYSTEM\"] = \"file\";\n})(TemporaryStorageOption || (TemporaryStorageOption = {}));\n//# sourceMappingURL=options.js.map","import { LogLevels } from '@powersync/common';\nimport { TemporaryStorageOption } from './options.js';\nimport { vfsRequiresDedicatedWorkers, vfsSupportsStorageBuckets, WASQLiteVFS } from './wa-sqlite/vfs.js';\n/**\n * The maximum length of a db filename we support.\n *\n * We configure the same on WA-SQLite (which otherwise defaults to a maximum length of 64). We don't want to support\n * very long path names as Safari maps OPFS files directly to OS files, and APFS has a 255-byte filename limit. Since\n * some VFS append additional characters for pooled file access handles, we want to stay well below that.\n */\nexport const maxPathNameLength = 128;\n/**\n * @internal\n */\nexport function resolveAndValidateOptions(options) {\n const defaults = {\n disableSSRWarning: false,\n ssrMode: !('window' in globalThis),\n /**\n * Multiple tabs are by default not supported on Android, iOS and Safari.\n * Other platforms will have multiple tabs enabled by default.\n */\n enableMultiTabs: typeof globalThis.navigator !== 'undefined' && // For SSR purposes\n typeof SharedWorker !== 'undefined' &&\n !navigator.userAgent.match(/(Android|iPhone|iPod|iPad)/i) &&\n !window.safari,\n useWebWorker: true,\n databaseWorkerLogLevel: LogLevels.info,\n temporaryStorage: TemporaryStorageOption.MEMORY,\n cacheSizeKb: 50 * 1024,\n encryptionKey: undefined,\n vfs: WASQLiteVFS.IDBBatchAtomicVFS,\n additionalReaders: 1\n };\n const resolved = Object.assign(defaults, options);\n if (vfsRequiresDedicatedWorkers(resolved.vfs) && !resolved.useWebWorker) {\n throw new Error(`Invalid configuration: The 'useWebWorker' flag must be true when using an OPFS-based VFS (${resolved.vfs}).`);\n }\n if (resolved.storageBucket != null) {\n if (!vfsSupportsStorageBuckets(resolved.vfs)) {\n throw new Error(`Invalid configuration: The 'storageBucket' option needs an OPFS-based VFS, which ${resolved.vfs} is not.`);\n }\n }\n return resolved;\n}\n//# sourceMappingURL=resolveAndValidateOptions.js.map","export class PreparedStatementCache {\n #size;\n // Note that Map preserves insertion order, which allows using it as an LRU\n // cache (with the first element being the first element to evict).\n #statements = new Map();\n constructor(size) {\n this.#size = size;\n }\n /**\n * Attempts to look up the cached sql statement, if it's currently cached.\n */\n lookup(sql) {\n const foundStatement = this.#statements.get(sql);\n if (foundStatement != null) {\n // Delete and re-insert to move to the end (most-recently-used position).\n this.#statements.delete(sql);\n this.#statements.set(sql, foundStatement);\n return foundStatement;\n }\n return null;\n }\n /**\n * Adds a new statement into the cache.\n *\n * If that exceeds the target size of the statement cache, returns an old statement to evict.\n * The caller is responsible for freeing that statement.\n */\n addStatement(sql, statement) {\n this.#statements.set(sql, statement);\n if (this.#statements.size > this.#size) {\n for (const [k, v] of this.#statements.entries()) {\n this.#statements.delete(k);\n return v;\n }\n }\n return null;\n }\n drain() {\n const values = [...this.#statements.values()];\n this.#statements.clear();\n return values;\n }\n}\n//# sourceMappingURL=StatementCache.js.map","import { Factory as WaSqliteFactory, SQLITE_ROW } from '@journeyapps/wa-sqlite';\nimport { WASQLiteVFS } from './vfs.js';\nimport { maxPathNameLength } from '../resolveAndValidateOptions.js';\nimport { PreparedStatementCache } from './StatementCache.js';\n/**\n * A small wrapper around WA-sqlite to help with opening databases and running statements by preparing them internally.\n *\n * This is an internal class, and it must never be used directly. Wrappers are required to ensure raw connections aren't\n * used concurrently across tabs.\n */\nexport class RawSqliteConnection {\n options;\n _sqliteAPI = null;\n sqlite3_stmt_isexplain;\n /**\n * The `sqlite3*` connection pointer.\n */\n db = 0;\n statementCache;\n constructor(options) {\n this.options = options;\n this.statementCache =\n options.preparedStatementsCache > 0 ? new PreparedStatementCache(options.preparedStatementsCache) : null;\n }\n get isOpen() {\n return this.db != 0;\n }\n async initWithModule(module, vfs) {\n const api = (this._sqliteAPI = await this.openSQLiteAPI(module, vfs));\n let fileName = this.options.filename;\n const isSimpleOpfsVfs = this.options.vfs == WASQLiteVFS.SimpleOpfsVFS;\n if (isSimpleOpfsVfs) {\n // The simple VFS doesn't support flexible file names, we use a nested OPFS directory instead.\n fileName = '/database';\n }\n this.db = await api.open_v2(fileName, this.options.readonly ? 1 /* SQLITE_OPEN_READONLY */ : 6 /* SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE */);\n await this.executeRaw(`PRAGMA temp_store = ${this.options.temporaryStorage};`);\n if (this.options.encryptionKey) {\n const escapedKey = this.options.encryptionKey.replaceAll(\"'\", \"''\");\n await this.executeRaw(`PRAGMA key = '${escapedKey}';`);\n }\n await this.executeRaw(`PRAGMA cache_size = -${this.options.cacheSizeKb};`);\n if (isSimpleOpfsVfs) {\n // This VFS does not support deleting files, so we use the TRUNCATE journaling mode instead.\n await this.executeRaw(`PRAGMA journal_mode = TRUNCATE`);\n }\n await this.executeRaw(`SELECT powersync_update_hooks('install');`);\n }\n async openSQLiteAPI(module, vfs) {\n vfs.mxPathname = maxPathNameLength;\n this.sqlite3_stmt_isexplain = module.cwrap('sqlite3_stmt_isexplain', 'int', ['int']);\n const sqlite3 = WaSqliteFactory(module);\n sqlite3.vfs_register(vfs, true);\n /**\n * Register the PowerSync core and additional statically linked extensions\n */\n for (const name of ['powersync_init_static', ...(this.options.additionalInitializationFunctions ?? [])]) {\n const result = module.ccall(name, 'int', []);\n if (result !== 0) {\n throw new Error(`SQLite extension initializer ${name} failed with code ${result}`);\n }\n }\n /**\n * Create the multiple cipher vfs if an encryption key is provided\n */\n if (this.options.encryptionKey) {\n const createResult = module.ccall('sqlite3mc_vfs_create', 'int', ['string', 'int'], [this.options.filename, 1]);\n if (createResult !== 0) {\n throw new Error('Failed to create multiple cipher vfs, Database encryption will not work');\n }\n }\n return sqlite3;\n }\n requireSqlite() {\n if (!this._sqliteAPI) {\n throw new Error(`Initialization has not completed`);\n }\n return this._sqliteAPI;\n }\n /**\n * Checks if the database connection is in autocommit mode.\n * @returns true if in autocommit mode, false if in a transaction\n */\n isAutoCommit() {\n return this.requireSqlite().get_autocommit(this.db) != 0;\n }\n async execute(sql, bindings) {\n const resultSet = await this.executeSingleStatementRaw(sql, bindings);\n return this.wrapQueryResults(this.requireSqlite(), resultSet);\n }\n async executeBatch(sql, bindings) {\n const results = [];\n const api = this.requireSqlite();\n for await (const stmt of api.statements(this.db, sql)) {\n let columns;\n for (const parameterSet of bindings) {\n const rs = await this.stepThroughStatement(api, stmt, parameterSet, columns, false);\n results.push(this.wrapQueryResults(api, rs));\n }\n // executeBatch can only use a single statement\n break;\n }\n return results;\n }\n wrapQueryResults(api, { rawRows, columnNames }) {\n return {\n rowsAffected: api.changes(this.db),\n insertId: api.last_insert_id(this.db),\n autocommit: api.get_autocommit(this.db) != 0,\n rawRows,\n columnNames\n };\n }\n /**\n * This executes a single statement using SQLite3 and returns the results as a {@link RawResultSet}.\n */\n async executeSingleStatementRaw(sql, bindings) {\n const results = await this.executeRaw(sql, bindings);\n return results.length ? results[0] : { columnNames: [], rawRows: [] };\n }\n async executeRaw(sql, bindings) {\n const results = [];\n const api = this.requireSqlite();\n for await (const stmt of this.cachedStatements(api, sql)) {\n let columns;\n const rs = await this.stepThroughStatement(api, stmt, bindings ?? [], columns);\n columns = rs.columnNames;\n if (columns.length) {\n results.push(rs);\n }\n // When binding parameters, only a single statement is executed.\n if (bindings) {\n break;\n }\n }\n return results;\n }\n async stepThroughStatement(api, stmt, bindings, knownColumns, includeResults = true) {\n // TODO not sure why this is needed currently, but booleans break\n bindings.forEach((b, index, arr) => {\n if (typeof b == 'boolean') {\n arr[index] = b ? 1 : 0;\n }\n });\n api.reset(stmt);\n if (bindings) {\n api.bind_collection(stmt, bindings);\n }\n const rows = [];\n while ((await api.step(stmt)) === SQLITE_ROW) {\n if (includeResults) {\n const row = api.row(stmt);\n rows.push(row);\n }\n }\n knownColumns ??= api.column_names(stmt);\n return { columnNames: knownColumns, rawRows: rows };\n }\n async close() {\n if (this.isOpen) {\n const api = this.requireSqlite();\n if (this.statementCache) {\n for (const stmt of this.statementCache.drain()) {\n await api.finalize(stmt);\n }\n }\n await api.close(this.db);\n this.db = 0;\n }\n }\n async *cachedStatements(api, sql) {\n {\n const existing = this.statementCache?.lookup(sql);\n if (existing != null) {\n yield existing;\n return;\n }\n }\n const inner = api.statements(this.db, sql, { unscoped: true });\n const preparedStatements = [];\n try {\n for await (const stmt of inner) {\n preparedStatements.push(stmt);\n yield stmt;\n }\n }\n finally {\n // We can only cache statements if the sql text corresponds to a single statement, otherwise it's not clear what\n // portion of the original sql text to use as a key.\n if (preparedStatements.length === 1 && this.statementCache) {\n const stmt = preparedStatements[0];\n // Don't cache EXPLAIN statements, their result becomes invalid after schema changes.\n if (this.sqlite3_stmt_isexplain(stmt) == 0) {\n const evicted = this.statementCache.addStatement(sql, stmt);\n if (evicted != null) {\n await api.finalize(evicted);\n }\n return;\n }\n }\n // We're not caching statements, so finalize them.\n for (const stmt of preparedStatements) {\n await api.finalize(stmt);\n }\n }\n }\n}\n//# sourceMappingURL=RawSqliteConnection.js.map","import { Mutex } from '@powersync/shared-internals';\nimport { requestNavigatorLock } from '../../../shared/locks.js';\n/**\n * A wrapper around a {@link RawSqliteConnection} allowing multiple tabs to access it.\n *\n * To allow potentially concurrent accesses from different clients, this requires a local mutex implementation here.\n *\n * Note that instances of this class are not safe to proxy across context boundaries with comlink! We need to be able to\n * rely on mutexes being returned reliably, so additional checks to detect say a client tab closing are required to\n * avoid deadlocks.\n */\nexport class ConcurrentSqliteConnection {\n inner;\n mutex;\n /**\n * The {@link SimpleOpfsFileSystem} used by the inner connection, if any. SQLite closing its files doesn't close the\n * sync access handles of that file system, so we do that after closing the connection.\n */\n simpleOpfsVfs = null;\n constructor(inner, \n /**\n * A mutex ensuring at most one {@link ConnectionLeaseToken} can exist for this connection at a time.\n *\n * While {@link ConcurrentSqliteConnection} prevents concurrent access to a database _connection_, it's possible we\n * might have multiple connections to the same physical database (e.g. if multiple tabs use dedicated workers).\n * In those setups, we use navigator locks instead of an internal mutex to guard access.\n */\n mutex) {\n this.inner = inner;\n this.mutex = mutex;\n }\n get options() {\n return this.inner.options;\n }\n acquireMutex(abort) {\n return this.mutex.acquire(abort);\n }\n // Unsafe, unguarded access to the SQLite connection.\n unsafeUseInner() {\n return this.inner;\n }\n /**\n * @returns A {@link ConnectionLeaseToken}. Until that token is returned, no other client can use the database.\n */\n async acquireConnection(abort) {\n const returnMutex = await this.acquireMutex(abort);\n const token = new ConnectionLeaseToken(returnMutex, this.inner);\n try {\n // Assert that the inner connection is initialized at this point, fail early if it's not.\n this.inner.requireSqlite();\n // If a previous client was interrupted in the middle of a transaction AND this is a shared worker, it's possible\n // for the connection to still be in a transaction. To avoid inconsistent state, we roll back connection leases\n // that haven't been comitted.\n if (!this.inner.isAutoCommit()) {\n await this.inner.executeRaw('ROLLBACK');\n }\n }\n catch (e) {\n returnMutex();\n throw e;\n }\n return token;\n }\n /**\n * @param returnMutex If the caller already holds the mutex (from {@link acquireMutex}), the function returning it.\n */\n async close(returnMutex) {\n returnMutex ??= await this.acquireMutex();\n try {\n await this.inner.close();\n }\n finally {\n this.simpleOpfsVfs?.close();\n returnMutex();\n }\n if (this.mutex instanceof LazyNavigatorMutex) {\n // We won't use this connection again, so don't wait for another tab to steal the navigator locks.\n await this.mutex.releaseNavigatorLocks();\n }\n }\n}\n/**\n * An instance representing temporary exclusive access to a {@link ConcurrentSqliteConnection}.\n */\nexport class ConnectionLeaseToken {\n returnMutex;\n connection;\n /** Ensures that the client with access to this token can't run statements concurrently. */\n useMutex = new Mutex();\n closed = false;\n constructor(returnMutex, connection) {\n this.returnMutex = returnMutex;\n this.connection = connection;\n }\n /**\n * Returns this lease, allowing another client to use the database connection.\n */\n async returnLease() {\n await this.useMutex.runExclusive(async () => {\n if (!this.closed) {\n this.closed = true;\n this.returnMutex();\n }\n });\n }\n /**\n * This should only be used internally, since the callback must not use the raw connection after resolving.\n */\n async use(callback) {\n return await this.useMutex.runExclusive(async () => {\n if (this.closed) {\n throw new Error('lease token has already been closed');\n }\n return await callback(this.connection);\n });\n }\n}\nexport class NavigatorMutex {\n name;\n constructor(name) {\n this.name = name;\n }\n acquire(signal) {\n return requestNavigatorLock(this.name, { signal });\n }\n}\n/**\n * A protocol that only gives up navigator locks when another tab requests them.\n *\n * This is mainly relevant for a {@link SimpleOpfsFileSystem} used without shared workers and without\n * `readwrite-unsafe`, as we have to close sync access handles when another tab wants to use the database. The protocol\n * here works like this:\n *\n * 1. Acquire a temporary lock (to avoid contention, not needed for correctness).\n * 2. Obtain an outer lock, stealing it if necessary.\n * 3. Obtain the inner lock.\n * 4. Release the temporary lock.\n * 5. Run the exclusive operation.\n * 6. Wait for another tab to steal the outer lock from us (as its second step).\n * 7. Close the VFS once we're done with it, and return the inner lock.\n */\nexport class LazyNavigatorMutex {\n name;\n /**\n * A file system to open after acquiring navigator locks and to close before returning them.\n */\n linkedVfs = null;\n #outerLockName;\n #temporaryLockName;\n /**\n * A local mutex guarding access within this context. Requesting it first is cheap, and allows the navigator lock\n * logic to assume exclusive access to {@link LazyNavigatorMutex.#heldNavigatorLocks}.\n */\n #localMutex = new Mutex();\n #heldNavigatorLocks = null;\n constructor(name) {\n this.name = name;\n this.#outerLockName = `${name}-outer`;\n this.#temporaryLockName = `${name}-tmp`;\n }\n async #acquireNavigatorLocks(signal) {\n console.assert(this.#heldNavigatorLocks == null);\n let temporary;\n let outer;\n let inner;\n try {\n // 1. Acquire the temporary lock, so that we don't have multiple tabs stealing the outer lock from each other.\n temporary = await requestNavigatorLock(this.#temporaryLockName, { signal });\n // 2. Request the outer lock, stealing it from another tab if necessary. Abort signals can't be combined with\n // steal, so we don't pass one here.\n outer = await requestNavigatorLock(this.#outerLockName, {\n steal: true,\n onStolen: () => this.#handleOuterLockStolen()\n });\n // 3. Obtain the inner lock. The tab we've stolen the outer lock from will return it once it's done.\n inner = await requestNavigatorLock(this.name, { signal });\n await this.linkedVfs?.open();\n this.#heldNavigatorLocks = { outer, inner };\n }\n catch (e) {\n // Failed to acquire some locks, ensure they're all released.\n outer?.();\n inner?.();\n throw e;\n }\n finally {\n // 4. Release the temporary lock.\n temporary?.();\n }\n }\n #handleOuterLockStolen() {\n // Steps 6 and 7.\n this.releaseNavigatorLocks();\n }\n async acquire(signal) {\n const returnLocalMutex = await this.#localMutex.acquire(signal);\n if (this.#heldNavigatorLocks != null) {\n // We already hold the navigator locks, so we can use the database directly.\n return returnLocalMutex;\n }\n try {\n await this.#acquireNavigatorLocks(signal);\n }\n catch (e) {\n returnLocalMutex();\n throw e;\n }\n // Step 5: Run the exclusive operation. Steps 6 and 7 run when the outer lock gets stolen from us, a callback\n // reacting to that has been installed at this point.\n return returnLocalMutex;\n }\n /**\n * Closes the linked VFS (if any) and returns navigator locks, if they're currently held.\n */\n async releaseNavigatorLocks() {\n await this.#localMutex.runExclusive(() => {\n const held = this.#heldNavigatorLocks;\n if (held != null) {\n this.linkedVfs?.close();\n held.outer();\n held.inner();\n this.#heldNavigatorLocks = null;\n }\n });\n }\n}\n//# sourceMappingURL=ConcurrentConnection.js.map","import { LogLevels } from '@powersync/common';\nimport * as Comlink from 'comlink';\nimport { DatabaseServer } from '../../db/adapters/wa-sqlite/DatabaseServer.js';\nimport { getNavigatorLocks } from '../../shared/locks.js';\nimport { RawSqliteConnection } from '../../db/adapters/wa-sqlite/RawSqliteConnection.js';\nimport { ConcurrentSqliteConnection, LazyNavigatorMutex, NavigatorMutex } from '../../db/adapters/wa-sqlite/ConcurrentConnection.js';\nimport { loadModuleAndVfs, WASQLiteVFS } from '../../db/adapters/wa-sqlite/vfs.js';\nimport { Mutex } from '@powersync/shared-internals';\nconst OPEN_DB_LOCK = 'open-wasqlite-db';\n/**\n * Shared state to manage multiple database connections hosted by a worker.\n */\nexport class MultiDatabaseServer {\n logger;\n #activeDatabases = new Map();\n #localOpenLock = new Mutex();\n constructor(logger) {\n this.logger = logger;\n }\n async handleConnection({ logLevel, database, lockName }) {\n const logger = {\n log: (record) => {\n if (record.level >= logLevel)\n this.logger.log(record);\n }\n };\n return Comlink.proxy(await this.openConnectionLocally(logger, database, lockName));\n }\n async connectToExisting(name, lockName) {\n return getNavigatorLocks().request(OPEN_DB_LOCK, async () => {\n const server = this.#activeDatabases.get(name);\n if (server == null) {\n throw new Error(`connectToExisting(${name}) failed because the worker doesn't own a database with that name.`);\n }\n return Comlink.proxy(await server.connect(lockName));\n });\n }\n async openConnectionLocally(logger, options, lockName) {\n // Especially on Firefox, we're sometimes seeing \"NoModificationAllowedError\"s when opening OPFS databases we can\n // work around by retrying.\n const maxAttempts = 3;\n let server;\n for (let count = 0; count < maxAttempts - 1; count++) {\n try {\n server = await this.#databaseOpenAttempt(logger, options);\n }\n catch (error) {\n this.logger.log({\n level: LogLevels.warn,\n message: `Attempt ${count + 1} of ${maxAttempts} to open database failed, retrying in 1 second...`,\n error\n });\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n // Final attempt if we haven't been able to open the server - rethrow errors if we still can't open.\n server ??= await this.#databaseOpenAttempt(logger, options);\n return server.connect(lockName);\n }\n async #databaseOpenAttempt(logger, options) {\n const { filename, readonly, vfs } = options;\n let locks;\n let needsNavigatorLocks;\n if (isSharedWorker ||\n readonly ||\n vfs == WASQLiteVFS.InMemoryVfs ||\n (vfs == WASQLiteVFS.SimpleOpfsVFS && options.simpleMode == 'shared')) {\n // We don't need navigator locks for shared workers because all queries run in this shared worker exclusively.\n // For read-only connections, we use a VFS that supports concurrent reads (so a single lock on the connection is\n // fine). In-memory databases either run in a shared worker or aren't shared across tabs at all, so the internal\n // lock is enough.\n locks = new Mutex();\n needsNavigatorLocks = false;\n }\n else if (vfs == WASQLiteVFS.SimpleOpfsVFS && options.simpleMode != 'rw-unsafe') {\n // Use navigator locks that also release sync access handles when there's contention.\n locks = new LazyNavigatorMutex(`db-lock-${options.filename}`);\n needsNavigatorLocks = true;\n }\n else {\n // We need navigator locks, but these don't need to coordinate with the file system.\n locks = new NavigatorMutex(`db-lock-${options.filename}`);\n needsNavigatorLocks = true;\n }\n const activeDatabases = this.#activeDatabases;\n async function openDatabase() {\n let server = activeDatabases.get(filename);\n if (server == null) {\n const connection = new RawSqliteConnection(options);\n const withSafeConcurrency = new ConcurrentSqliteConnection(connection, locks);\n // Initializing the RawSqliteConnection will run some pragmas that might write to the database file, so we want\n // to do that in an exclusive lock. Note that OPEN_DB_LOCK is not enough for that, as another tab might have\n // already created a connection (and is thus outside of OPEN_DB_LOCK) while currently writing to it.\n const returnLease = await withSafeConcurrency.acquireMutex();\n try {\n const { module, vfs } = await loadModuleAndVfs(options);\n if (options.vfs == WASQLiteVFS.SimpleOpfsVFS) {\n withSafeConcurrency.simpleOpfsVfs = vfs;\n if (locks instanceof LazyNavigatorMutex) {\n locks.linkedVfs = withSafeConcurrency.simpleOpfsVfs;\n }\n }\n await connection.initWithModule(module, vfs);\n }\n catch (e) {\n // Close the connection and its file handles while we still have exclusive access.\n await withSafeConcurrency.close(returnLease);\n throw e;\n }\n returnLease();\n const onClose = () => activeDatabases.delete(filename);\n server = new DatabaseServer({\n inner: withSafeConcurrency,\n logger,\n onClose\n });\n activeDatabases.set(filename, server);\n }\n return server;\n }\n if (needsNavigatorLocks) {\n return getNavigatorLocks().request(OPEN_DB_LOCK, openDatabase);\n }\n else {\n // Even if we don't need navigator locks, this avoids a race between the activeDatabases.get() call, the async\n // open logic and the final activeDatabases.set() step.\n return this.#localOpenLock.runExclusive(openDatabase);\n }\n }\n closeAll() {\n const existingDatabases = [...this.#activeDatabases.values()];\n return Promise.all(existingDatabases.map((db) => {\n db.forceClose();\n }));\n }\n}\nexport const isSharedWorker = 'SharedWorkerGlobalScope' in globalThis;\n//# sourceMappingURL=MultiDatabaseServer.js.map","import { LockContext, DBAdapter, queryResultWithoutRows } from '@powersync/common';\nimport * as Comlink from 'comlink';\nimport { ConnectionClosedError } from '@powersync/shared-internals';\n/**\n * A single-connection {@link ConnectionPool} implementation based on a worker connection.\n */\nexport class DatabaseClient extends DBAdapter {\n options;\n config;\n #connection;\n #shareConnectionAbortController = new AbortController();\n #receiveTableUpdates;\n constructor(options, config) {\n super();\n this.options = options;\n this.config = config;\n this.#connection = {\n connection: options.connection,\n notifyRemoteClosed: options.remoteCanCloseUnexpectedly ? new AbortController() : undefined,\n traceQueries: config.debugMode === true\n };\n const { port1, port2 } = new MessageChannel();\n options.connection.setUpdateListener(Comlink.transfer(port1, [port1]));\n this.#receiveTableUpdates = port2;\n port2.onmessage = (event) => {\n const tables = event.data;\n const notification = {\n tables\n };\n this.iterateListeners((l) => {\n l.tablesUpdated && l.tablesUpdated(notification);\n });\n };\n }\n get name() {\n return this.config.dbFilename;\n }\n /**\n * Marks the remote as closed.\n *\n * This can sometimes happen outside of our control, e.g. when a shared worker requests a connection from a tab. When\n * it happens, all outstanding requests on this pool would never resolve. To avoid livelocks in this scenario, we\n * throw on all outstanding promises and forbid new calls.\n */\n markRemoteClosed() {\n // Can non-null assert here because this function is only supposed to be called when remoteCanCloseUnexpectedly was\n // set.\n this.#connection.notifyRemoteClosed.abort();\n }\n async close() {\n // This connection is no longer shared, so we can close locks held for shareConnection calls.\n this.#shareConnectionAbortController.abort();\n this.#receiveTableUpdates.close();\n await useConnectionState(this.#connection, (c) => c.close(), true);\n this.options.onClose?.();\n this.options.source?.[Comlink.releaseProxy]();\n }\n readLock(fn, options) {\n return this.#lock(false, fn, options);\n }\n writeLock(fn, options) {\n return this.#lock(true, fn, options);\n }\n async #lock(write, fn, options) {\n const token = await useConnectionState(this.#connection, (c) => c.requestAccess(write, options?.timeoutMs));\n try {\n return await fn(new ClientLockContext(this.#connection, token));\n }\n finally {\n await useConnectionState(this.#connection, (c) => c.completeAccess(token));\n }\n }\n async refreshSchema() {\n // Currently a no-op on the web.\n }\n async shareConnection() {\n /**\n * Hold a navigator lock in order to avoid features such as Chrome's frozen tabs,\n * or Edge's sleeping tabs from pausing the thread for this connection.\n * This promise resolves once a lock is obtained.\n * This lock will be held as long as this connection is open.\n * The `shareConnection` method should not be called on multiple tabs concurrently.\n */\n const abort = this.#shareConnectionAbortController;\n const source = this.options.source;\n if (source == null) {\n throw new Error(`shareConnection() is only available for connections based by workers.`);\n }\n await new Promise((resolve, reject) => navigator.locks\n .request(`shared-connection-${this.name}-${Date.now()}-${Math.round(Math.random() * 10000)}`, {\n signal: abort.signal\n }, async () => {\n resolve();\n // Free the lock when the connection is already closed.\n if (abort.signal.aborted) {\n return;\n }\n // Hold the lock while the shared connection is in use.\n await new Promise((releaseLock) => {\n abort.signal.addEventListener('abort', () => {\n releaseLock();\n });\n });\n })\n // We aren't concerned with abort errors here\n .catch((ex) => {\n if (ex.name == 'AbortError') {\n resolve();\n }\n else {\n reject(ex);\n }\n }));\n const newPort = await source[Comlink.createEndpoint]();\n return { port: newPort, identifier: this.name };\n }\n getConfiguration() {\n return this.config;\n }\n}\n/**\n * A {@link LockContext} implemented by sending commands to a worker.\n *\n * While an instance is active, it has exclusive access to the underlying database connection (as represented by its\n * token).\n */\nclass ClientLockContext extends LockContext {\n #connection;\n #token;\n constructor(connection, token) {\n super();\n this.#connection = connection;\n this.#token = token;\n }\n /**\n * Requests an operation from the worker, potentially tracing it if that option has been enabled.\n */\n async maybeTrace(fn, describeForTrace) {\n if (this.#connection.traceQueries) {\n const start = performance.now();\n const description = describeForTrace();\n try {\n const r = await useConnectionState(this.#connection, fn);\n performance.measure(`[SQL] ${description}`, { start });\n return r;\n }\n catch (e) {\n performance.measure(`[SQL] [ERROR: ${e.message}] ${description}`, { start });\n throw e;\n }\n }\n else {\n return useConnectionState(this.#connection, fn);\n }\n }\n async executeRaw(query, params) {\n return await this.#executeOnWorker(query, params);\n }\n async #executeOnWorker(query, params) {\n return this.maybeTrace((c) => c.execute(this.#token, query, params), () => query);\n }\n async executeBatch(query, params = []) {\n const results = await this.maybeTrace((c) => c.executeBatch(this.#token, query, params), () => `${query} (batch of ${params.length})`);\n const result = { insertId: undefined, rowsAffected: 0 };\n for (const source of results) {\n result.insertId = source.insertId;\n result.rowsAffected = (result.rowsAffected ?? 0) + source.rowsAffected;\n }\n return queryResultWithoutRows(result);\n }\n}\nasync function useConnectionState(state, workerPromise, fireActionOnAbort = false) {\n const controller = state.notifyRemoteClosed;\n if (controller) {\n return new Promise((resolve, reject) => {\n if (controller.signal.aborted) {\n reject(new ConnectionClosedError('Called operation on closed remote'));\n if (!fireActionOnAbort) {\n // Don't run the operation if we're going to reject\n // We might want to fire-and-forget the operation in some cases (like a close operation)\n return;\n }\n }\n function handleAbort() {\n reject(new ConnectionClosedError('Remote peer closed with request in flight'));\n }\n function completePromise(action) {\n controller.signal.removeEventListener('abort', handleAbort);\n action();\n }\n controller.signal.addEventListener('abort', handleAbort);\n workerPromise(state.connection)\n .then((data) => completePromise(() => resolve(data)))\n .catch((e) => completePromise(() => reject(e)));\n });\n }\n else {\n // Can't close, so just return the inner worker promise unguarded.\n return workerPromise(state.connection);\n }\n}\n//# sourceMappingURL=DatabaseClient.js.map","/**\n * Internal helper function to acquire a connection from a pool that has a designated writer, additional readers, and\n * also allows dispatching reads to the writer.\n */\nexport async function acquireFromPool(writerMutex, writer, readers, callback, options, allowReadOnly) {\n const abortController = new AbortController();\n const abortSignal = abortController.signal;\n let timeout = null;\n let release;\n if (options?.timeoutMs) {\n timeout = setTimeout(() => abortController.abort('requesting database timed out'), options.timeoutMs);\n }\n try {\n if (allowReadOnly) {\n let connection;\n // Even if we have a pool of read connections, it's typically very small and we assume that most queries are\n // reads. So, we want to request any connection from the read pool and the dedicated write connection (which\n // can also serve reads). We race for the first connection we can obtain this way, and then abort the other\n // request.\n [connection, release] = await new Promise((resolve, reject) => {\n let didComplete = false;\n function complete() {\n didComplete = true;\n abortController.abort();\n }\n function completeSuccess(connection, returnFn) {\n if (didComplete) {\n // We're not going to use this connection, so return it immediately.\n returnFn();\n }\n else {\n complete();\n resolve([connection, returnFn]);\n }\n }\n function completeError(error) {\n // We either have a working connection already, or we've rejected the promise. Either way, we don't need\n // to do either thing again.\n if (didComplete)\n return;\n complete();\n reject(error);\n }\n writerMutex.acquire(abortSignal).then((unlock) => completeSuccess(writer, unlock), completeError);\n readers?.requestOne(abortSignal).then(({ item, release }) => completeSuccess(item, release), completeError);\n });\n return await callback(connection);\n }\n else {\n return await writerMutex.runExclusive(() => callback(writer), abortSignal);\n }\n }\n finally {\n if (timeout != null) {\n clearTimeout(timeout);\n }\n release?.();\n }\n}\n//# sourceMappingURL=acquireFromPool.js.map","import { DBAdapter } from '@powersync/common';\nimport { Mutex, Semaphore } from '@powersync/shared-internals';\nimport { acquireFromPool } from './acquireFromPool.js';\n/**\n * A connection pool implementation delegating to another pool opened asynchronnously.\n */\nexport class AsyncDbAdapter extends DBAdapter {\n name;\n state;\n resolvedWriter;\n pendingListeners = new Set();\n constructor(inner, name) {\n super();\n this.name = name;\n this.state = inner.then((client) => {\n for (const pending of this.pendingListeners) {\n pending.closeAfterRegisteredOnResolvedPool = client.writer.registerListener(pending.listener);\n }\n this.pendingListeners.clear();\n this.resolvedWriter = client.writer;\n if (client.additionalReaders.length) {\n return readWritePoolState(client.writer, client.additionalReaders);\n }\n return singleConnectionPoolState(client.writer);\n });\n }\n async init() {\n await this.state;\n }\n async close() {\n const state = await this.state;\n await state.close();\n }\n async readLock(fn, options) {\n const state = await this.state;\n return state.withConnection(true, fn, options);\n }\n async writeLock(fn, options) {\n const state = await this.state;\n return state.withConnection(false, fn, options);\n }\n async refreshSchema() {\n const state = await this.state;\n await state.refreshSchema();\n }\n registerListener(listener) {\n if (this.resolvedWriter) {\n return this.resolvedWriter.registerListener(listener);\n }\n else {\n const pending = { listener };\n this.pendingListeners.add(pending);\n return () => {\n if (pending.closeAfterRegisteredOnResolvedPool) {\n return pending.closeAfterRegisteredOnResolvedPool();\n }\n else {\n // Has not been registered yet, we can just remove the pending listener.\n this.pendingListeners.delete(pending);\n }\n };\n }\n }\n async shareConnection() {\n const state = await this.state;\n return state.writer.shareConnection();\n }\n getConfiguration() {\n if (this.resolvedWriter) {\n return this.resolvedWriter.getConfiguration();\n }\n throw new Error('AsyncDbAdapter.getConfiguration() can only be called after initializing it.');\n }\n}\nfunction singleConnectionPoolState(connection) {\n return {\n writer: connection,\n withConnection: (allowReadOnly, fn, options) => {\n if (allowReadOnly) {\n return connection.readLock(fn, options);\n }\n else {\n return connection.writeLock(fn, options);\n }\n },\n close: () => connection.close(),\n refreshSchema: () => connection.refreshSchema()\n };\n}\nfunction readWritePoolState(writer, readers) {\n // DatabaseClients have locks internally, so these aren't necessary for correctness. However, our mutex and semaphore\n // implementations are very cheap to cancel, which we use to dispatch reads to the first available connection (by\n // simply requesting all of them and sticking with the first connection we get).\n const writerMutex = new Mutex();\n const readerSemaphore = new Semaphore(readers);\n return {\n writer,\n async withConnection(allowReadOnly, fn, options) {\n return acquireFromPool(writerMutex, writer, readerSemaphore, (connection) => {\n return allowReadOnly ? connection.readLock(fn) : connection.writeLock(fn);\n }, options, allowReadOnly);\n },\n async close() {\n await writer.close();\n await Promise.all(readers.map((r) => r.close()));\n },\n async refreshSchema() {\n await writer.refreshSchema();\n await Promise.all(readers.map((r) => r.refreshSchema()));\n }\n };\n}\n//# sourceMappingURL=AsyncWebAdapter.js.map","import { LogLevels } from '@powersync/common';\nexport function connectToWorker({ service, databaseIdentifier, customWorker, shared, loggerForErrors }) {\n const name = `${shared ? 'shared-' : ''}powersync-${databaseIdentifier}`;\n let worker;\n if (customWorker) {\n worker = shared\n ? new SharedWorker(customWorker, {\n /* @vite-ignore */\n name,\n type: 'module'\n })\n : new Worker(customWorker, {\n /* @vite-ignore */\n name,\n type: 'module'\n });\n }\n else {\n worker = spawnDefaultPowerSyncWorker(shared, name);\n }\n return connectToExistingWorker(worker, loggerForErrors, service);\n}\n/**\n * Opens the default PowerSync worker.\n *\n * When users depend on the web SDK, we assume they use their own bundler (either vite or webpack). Both recognize the\n * syntax of worker constructors with a string literal and will rewrite the URL as part of their bundling processes.\n *\n * React Native / Metro users can't rely on this on the web, as their app is not a JavaScript module and import.meta.url\n * is not rewritten by Metro. For those users, we include a pre-bundled worker they can copy into a static assets\n * directory and load with a custom URI. This also means that defaultWorker cannot work with Metro for React Native Web.\n * We have a custom rollup plugin and conditional exports that replaces this function with a throwing stub for that\n * platform. This allows a helpful error message.\n */\n// Note: When changing this function, also update disableDefaultWorkers in rollup.config.ts.\nfunction spawnDefaultPowerSyncWorker(shared, name) {\n return shared\n ? new SharedWorker(new URL('./worker.js', import.meta.url), {\n /* @vite-ignore */\n name,\n type: 'module'\n })\n : new Worker(new URL('./worker.js', import.meta.url), {\n /* @vite-ignore */\n name,\n type: 'module'\n });\n}\nexport function connectToExistingWorker(worker, logger, service) {\n function logError(event) {\n // TODO: Ideally, we should be able to handle worker errors by forwarding them to async Comlink callers.\n // Currently, comlink calls on errored workers would just be stuck forever.\n logger.log({\n level: LogLevels.error,\n error: event.error,\n message: 'Error in database or sync worker, this likely disrupts PowerSync.'\n });\n }\n worker.addEventListener('error', logError);\n const isShared = isSharedWorker(worker);\n if (isShared) {\n const { port1, port2 } = new MessageChannel();\n const mainPort = worker.port;\n mainPort.start();\n mainPort.postMessage({ port: port1, service }, [port1]);\n port2.start();\n return {\n endpoint: port2,\n worker,\n close() {\n worker.removeEventListener('error', logError);\n port2.close();\n }\n };\n }\n else {\n return {\n endpoint: worker,\n worker,\n close() {\n worker.removeEventListener('error', logError);\n worker.terminate();\n }\n };\n }\n}\nexport function isSharedWorker(worker) {\n return 'port' in worker;\n}\n//# sourceMappingURL=client.js.map","import { LogLevels } from '@powersync/common';\nimport * as Comlink from 'comlink';\nimport { SSRDBAdapter } from '../SSRDBAdapter.js';\nimport { vfsRequiresDedicatedWorkers, WASQLiteVFS } from './vfs.js';\nimport { MultiDatabaseServer } from '../../../worker/db/MultiDatabaseServer.js';\nimport { DatabaseClient } from './DatabaseClient.js';\nimport { generateTabCloseSignal } from '../../../shared/locks.js';\nimport { AsyncDbAdapter } from '../AsyncWebAdapter.js';\nimport { maxPathNameLength, resolveAndValidateOptions } from '../resolveAndValidateOptions.js';\nimport { connectToExistingWorker, connectToWorker, isSharedWorker } from '../../../worker/client.js';\n/**\n * Opens a SQLite connection using WA-SQLite.\n */\nexport class WASQLiteOpenFactory {\n options;\n logger;\n constructor(options) {\n this.options = resolveAndValidateOptions(options.open);\n // Account for the fact that SQLite might append -journal suffixes\n const maxLength = maxPathNameLength - 16;\n if (this.options.dbFilename.length > maxLength) {\n throw new Error(`dbFilename too long (max length is ${maxLength})`);\n }\n this.logger = options.logger;\n }\n openAdapter() {\n return new AsyncDbAdapter(this.openConnection(), this.options.dbFilename);\n }\n openDB() {\n const { disableSSRWarning, enableMultiTabs, ssrMode } = this.options;\n if (ssrMode) {\n if (!disableSSRWarning) {\n this.logger.log({\n level: LogLevels.warn,\n message: `\n Running PowerSync in SSR mode.\n Only empty query results will be returned.\n Disable this warning by setting 'disableSSRWarning: true' in options.`\n });\n }\n return new SSRDBAdapter();\n }\n if (!enableMultiTabs) {\n this.logger.log({\n level: LogLevels.warn,\n message: 'Multiple tab support is not enabled. Using this site across multiple tabs may not function correctly.'\n });\n }\n return this.openAdapter();\n }\n async openConnection() {\n const { enableMultiTabs, useWebWorker, vfs } = this.options;\n if (!enableMultiTabs) {\n this.logger.log({ level: LogLevels.warn, message: 'Multiple tabs are not enabled in this browser' });\n }\n if (!useWebWorker) {\n return { writer: await this.#openInCurrentContext(), additionalReaders: [] };\n }\n switch (vfs) {\n case 'auto':\n return { writer: await this.#openSimpleOpfs(true), additionalReaders: [] };\n case WASQLiteVFS.SimpleOpfsVFS:\n return { writer: await this.#openSimpleOpfs(false), additionalReaders: [] };\n case WASQLiteVFS.OPFSWriteAheadVFS: {\n // This VFS supports concurrent reads, so we can open additional workers to host read-only connections for\n // concurrent reads / writes.\n const writer = await this.#openInWorker({ vfs, readonly: false });\n const additionalReadersCount = this.options.additionalReaders ?? 1;\n const additionalReaders = await Promise.all(Array.from({ length: additionalReadersCount }, () => this.#openInWorker({ vfs, readonly: true })));\n return { writer, additionalReaders };\n }\n default:\n return { writer: await this.#openInWorker({ vfs, readonly: false }), additionalReaders: [] };\n }\n }\n /**\n * Opens a {@link WASQLiteVFS.SimpleOpfsVFS} database, or picks the best available storage for the `'auto'` VFS\n * option if `fallbackToMemory` is set.\n *\n * This VFS has three different modes (shared workers, readwrite-unsafe, re-open fallback), see the doc comment on it.\n * We start a feature detection to check what the current browser supports. In order of preference, we use:\n *\n * 1. {@link WASQLiteVFS.SimpleOpfsVFS} through a shared worker spawning a nested dedicated worker.\n * 2. {@link WASQLiteVFS.SimpleOpfsVFS} in a dedicated worker.\n * 3. {@link WASQLiteVFS.InMemoryVfs} in a shared worker (only with `fallbackToMemory`).\n * 4. {@link WASQLiteVFS.InMemoryVfs} in a dedicated worker (only with `fallbackToMemory`).\n */\n async #openSimpleOpfs(fallbackToMemory) {\n const shared = this.options.enableMultiTabs ? await this.#openSharedWorker() : null;\n let nested = null;\n let dedicated = null;\n // The worker hosting the opened database, which is then owned by the returned client. We close all other workers.\n let used = null;\n const connect = async (worker, options) => {\n const client = await this.#connect(worker, options);\n used = worker;\n return client;\n };\n const connectInMemory = (worker) => {\n this.logger.log({ level: LogLevels.warn, message: 'Falling back to in-memory because OPFS is unavailable.' });\n return connect(worker, { vfs: WASQLiteVFS.InMemoryVfs, readonly: false });\n };\n try {\n if (shared) {\n const features = await this.#detectNestedFeatures(shared);\n if (features?.worker) {\n if (features.worker.opfs) {\n // Shared workers can open dedicated workers. Perfect, we'll have the shared worker spawn a nested worker\n // and connect to that.\n nested = Comlink.wrap(await shared.source.spawnNested());\n return await connect({ source: nested, connection: shared.connection }, { vfs: WASQLiteVFS.SimpleOpfsVFS, readonly: false, simpleMode: 'shared' });\n }\n else if (fallbackToMemory) {\n // The nested worker doesn't have OPFS access, so a dedicated worker started by us won't have that either.\n return await connectInMemory(shared);\n }\n }\n }\n // We'll have to use a dedicated worker directly.\n dedicated = this.#openWorker(false);\n const features = await dedicated.source.dedicatedFeatureDetection();\n if (features.opfs || !fallbackToMemory) {\n // See if we can at least use readwrite-unsafe, as that is more efficient than the fallback of closing and\n // re-opening files on contention.\n const simpleMode = this.options.simpleMode ?? (features.openWithMode ? 'rw-unsafe' : 'fallback');\n return await connect(dedicated, { vfs: WASQLiteVFS.SimpleOpfsVFS, readonly: false, simpleMode });\n }\n return await connectInMemory(shared ?? dedicated);\n }\n finally {\n const usedWorker = used;\n if (nested && usedWorker?.source !== nested)\n nested[Comlink.releaseProxy]();\n if (shared && usedWorker?.connection !== shared.connection)\n closeWorker(shared);\n if (dedicated && usedWorker !== dedicated)\n closeWorker(dedicated);\n }\n }\n /** Asks a shared worker whether it can spawn nested workers with OPFS access, or returns null if that fails. */\n async #detectNestedFeatures(shared) {\n try {\n return await shared.source.sharedFeatureDetection();\n }\n catch (error) {\n this.logger.log({ level: LogLevels.error, error, message: 'Could not detect features of shared worker' });\n return null;\n }\n }\n /**\n * Opens a database with a VFS that doesn't need feature detection, using a shared worker when the VFS and options\n * allow that.\n */\n async #openInWorker(options) {\n const useShared = !vfsRequiresDedicatedWorkers(options.vfs) && this.options.enableMultiTabs;\n return this.#connect(this.#openWorker(useShared), options);\n }\n /**\n * Don't use a web worker. Instead, open the MultiDatabaseServer a worker would use locally.\n *\n * Without workers, the only storage the `'auto'` option can pick is an in-memory database.\n */\n async #openInCurrentContext() {\n let vfs = this.options.vfs;\n if (vfs == 'auto') {\n this.logger.log({ level: LogLevels.warn, message: 'Using in-memory database because web workers are disabled.' });\n vfs = WASQLiteVFS.InMemoryVfs;\n }\n const localServer = new MultiDatabaseServer(this.logger);\n const connection = await localServer.openConnectionLocally(this.logger, this.#resolveRawWaSqliteDatabaseOptions({ vfs, readonly: false }));\n return new DatabaseClient({ connection, source: null, remoteCanCloseUnexpectedly: false }, { ...this.options, vfs, requiresPersistentTriggers: true });\n }\n async #connect(worker, options) {\n const { source, connection: workerConnection } = worker;\n const closeSignal = new AbortController();\n const connection = await source.connect({\n database: this.#resolveRawWaSqliteDatabaseOptions(options),\n logLevel: this.options.databaseWorkerLogLevel,\n lockName: await generateTabCloseSignal(closeSignal.signal)\n });\n return new DatabaseClient({\n connection,\n source,\n // This tab owns the worker, so we're guaranteed to outlive it.\n remoteCanCloseUnexpectedly: false,\n onClose: () => {\n closeSignal.abort();\n workerConnection.close();\n }\n }, {\n ...this.options,\n vfs: options.vfs,\n requiresPersistentTriggers: vfsRequiresDedicatedWorkers(options.vfs)\n });\n }\n async #openSharedWorker() {\n const shared = this.#openWorker(true);\n if (!isSharedWorker(shared.connection.worker)) {\n // A custom worker factory might not respect the `shared` option, and dedicated workers can't share the\n // database across tabs. Fall back to the modes relying on navigator locks.\n closeWorker(shared);\n return null;\n }\n return shared;\n }\n #openWorker(shared) {\n const optionsDbWorker = this.options.worker;\n let connection;\n if (typeof optionsDbWorker == 'function') {\n const worker = optionsDbWorker({ ...this.options, shared });\n connection = connectToExistingWorker(worker, this.logger, 'database');\n }\n else {\n connection = connectToWorker({\n service: 'database',\n databaseIdentifier: this.options.dbFilename,\n shared: shared,\n customWorker: optionsDbWorker,\n loggerForErrors: this.logger\n });\n }\n return { connection, source: Comlink.wrap(connection.endpoint) };\n }\n #resolveRawWaSqliteDatabaseOptions({ vfs, readonly, simpleMode }) {\n const { dbFilename, encryptionKey, temporaryStorage, cacheSizeKb, preparedStatementsCache, additionalInitializationFunctions, storageBucket } = this.options;\n return {\n filename: dbFilename,\n readonly,\n vfs,\n encryptionKey,\n temporaryStorage,\n cacheSizeKb,\n // TODO: Enable prepared statement cache by default?\n preparedStatementsCache: preparedStatementsCache ?? 0,\n additionalInitializationFunctions,\n storageBucket,\n simpleMode\n };\n }\n}\nfunction closeWorker(worker) {\n worker.source[Comlink.releaseProxy]();\n worker.connection.close();\n}\n//# sourceMappingURL=WASQLiteOpenFactory.js.map","import { getNavigatorLocks } from '../shared/locks.js';\n/**\n * @internal\n * @experimental\n */\nexport const NAVIGATOR_TRIGGER_CLAIM_MANAGER = {\n async obtainClaim(identifier) {\n return new Promise((resolveReleaser) => {\n getNavigatorLocks().request(identifier, async () => {\n await new Promise((releaseLock) => {\n resolveReleaser(async () => releaseLock());\n });\n });\n });\n },\n async checkClaim(identifier) {\n const currentState = await getNavigatorLocks().query();\n return currentState.held?.find((heldLock) => heldLock.name == identifier) != null;\n }\n};\n//# sourceMappingURL=NavigatorTriggerClaimManager.js.map","import { BaseObserver } from '@powersync/common';\nimport { Mutex, LockType } from '@powersync/shared-internals';\nexport class SSRStreamingSyncImplementation extends BaseObserver {\n syncMutex;\n crudMutex;\n isConnected;\n lastSyncedAt;\n constructor() {\n super();\n this.syncMutex = new Mutex();\n this.crudMutex = new Mutex();\n this.isConnected = false;\n }\n obtainLock(lockOptions) {\n const mutex = lockOptions.type == LockType.CRUD ? this.crudMutex : this.syncMutex;\n return mutex.runExclusive(lockOptions.callback, lockOptions.signal);\n }\n /**\n * This is a no-op in SSR mode\n */\n async connect() { }\n async dispose() { }\n /**\n * This is a no-op in SSR mode\n */\n async disconnect() { }\n /**\n * This SSR Mode implementation is immediately ready.\n */\n async waitForReady() { }\n /**\n * This will never resolve in SSR Mode.\n */\n waitUntilStatusMatches(_predicate) {\n return new Promise(() => { });\n }\n /**\n * This is a no-op in SSR mode.\n */\n triggerCrudUpload() { }\n /**\n * No-op in SSR mode.\n */\n updateSubscriptions() { }\n /**\n * No-op in SSR mode.\n */\n markConnectionMayHaveChanged() { }\n requestCheckpoint() {\n throw new Error('Sub sync implementation does not support request checkpoints');\n }\n}\n//# sourceMappingURL=SSRWebStreamingSyncImplementation.js.map","/**\n * The client side port should provide these methods.\n */\nexport class AbstractSharedSyncClientProvider {\n}\n//# sourceMappingURL=AbstractSharedSyncClientProvider.js.map","/**\n * Get a minimal representation of browser, version and operating system.\n *\n * The goal is to get enough environemnt info to reproduce issues, but no\n * more.\n */\nexport function getUserAgentInfo(nav) {\n nav ??= navigator;\n const browser = getBrowserInfo(nav);\n const os = getOsInfo(nav);\n // The cast below is to cater for TypeScript < 5.5.0\n return [browser, os].filter((v) => v != null);\n}\nfunction getBrowserInfo(nav) {\n const brands = nav.userAgentData?.brands;\n if (brands != null) {\n const tests = [\n { name: 'Google Chrome', value: 'Chrome' },\n { name: 'Opera', value: 'Opera' },\n { name: 'Edge', value: 'Edge' },\n { name: 'Chromium', value: 'Chromium' }\n ];\n for (let { name, value } of tests) {\n const brand = brands.find((b) => b.brand == name);\n if (brand != null) {\n return `${value}/${brand.version}`;\n }\n }\n }\n const ua = nav.userAgent;\n const regexps = [\n { re: /(?:firefox|fxios)\\/(\\d+)/i, value: 'Firefox' },\n { re: /(?:edg|edge|edga|edgios)\\/(\\d+)/i, value: 'Edge' },\n { re: /opr\\/(\\d+)/i, value: 'Opera' },\n { re: /(?:chrome|chromium|crios)\\/(\\d+)/i, value: 'Chrome' },\n { re: /version\\/(\\d+).*safari/i, value: 'Safari' }\n ];\n for (let { re, value } of regexps) {\n const match = re.exec(ua);\n if (match != null) {\n return `${value}/${match[1]}`;\n }\n }\n return null;\n}\nfunction getOsInfo(nav) {\n if (nav.userAgentData?.platform != null) {\n return nav.userAgentData.platform.toLowerCase();\n }\n const ua = nav.userAgent;\n const regexps = [\n { re: /windows/i, value: 'windows' },\n { re: /android/i, value: 'android' },\n { re: /linux/i, value: 'linux' },\n { re: /iphone|ipad|ipod/i, value: 'ios' },\n { re: /macintosh|mac os x/i, value: 'macos' }\n ];\n for (let { re, value } of regexps) {\n if (re.test(ua)) {\n return value;\n }\n }\n return null;\n}\n//# sourceMappingURL=userAgent.js.map","import { LogLevels } from '@powersync/common';\nimport { AbstractRemote } from '@powersync/shared-internals';\nimport { getUserAgentInfo } from './userAgent.js';\nexport class WebRemote extends AbstractRemote {\n constructor(connector, logger) {\n super(connector, logger);\n }\n fetch({ resource, request }) {\n return fetch(resource, request);\n }\n async loadWebSocketSupport(platform) {\n if (!websockets) {\n // loadWebSocketSupport being called concurrently is safe, the import resolves to the same module in that case.\n const module = await import('@powersync/shared-internals/websockets');\n websockets = new module.WebSocketSupport(platform);\n }\n return websockets;\n }\n getUserAgent() {\n let ua = [super.getUserAgent(), `powersync-web`];\n try {\n ua.push(...getUserAgentInfo());\n }\n catch (error) {\n this.logger.log({ level: LogLevels.warn, message: 'Failed to get user agent info', error });\n }\n return ua.join(' ');\n }\n}\nlet websockets;\n//# sourceMappingURL=WebRemote.js.map","import { LogLevels } from '@powersync/common';\nimport { AbstractStreamingSyncImplementation, LockType } from '@powersync/shared-internals';\nimport { getNavigatorLocks } from '../../shared/locks.js';\nexport class WebStreamingSyncImplementation extends AbstractStreamingSyncImplementation {\n diagnosticsChannel;\n constructor(options) {\n // Super will store and provide default values for options\n super(options);\n }\n /**\n * Broadcasts a core diagnostics event on a same-origin channel for diagnostics tooling to consume.\n * The channel reaches the page even when sync runs in a shared worker.\n */\n emitDiagnostics(event) {\n this.diagnosticsChannel ??= new BroadcastChannel('powersync-diagnostics-events');\n this.diagnosticsChannel.postMessage(event);\n }\n async dispose() {\n await super.dispose();\n this.diagnosticsChannel?.close();\n this.diagnosticsChannel = undefined;\n }\n get webOptions() {\n return this.options;\n }\n async obtainLock(lockOptions) {\n const identifier = `streaming-sync-${lockOptions.type}-${this.webOptions.identifier}`;\n if (lockOptions.type == LockType.SYNC) {\n this.logger.log({ level: LogLevels.debug, message: `requesting lock for ${identifier}` });\n }\n return getNavigatorLocks().request(identifier, { signal: lockOptions.signal }, lockOptions.callback);\n }\n}\n//# sourceMappingURL=WebStreamingSyncImplementation.js.map","import { BaseObserver, DBAdapter, LogLevels, SyncStreamConnectionMethod } from '@powersync/common';\nimport { AbortOperation, ConnectionManager, SqliteBucketStorage, Mutex, SyncStatusSnapshot } from '@powersync/shared-internals';\nimport * as Comlink from 'comlink';\nimport { WebRemote } from '../../db/sync/WebRemote.js';\nimport { WebStreamingSyncImplementation } from '../../db/sync/WebStreamingSyncImplementation.js';\nimport { BroadcastLogger } from './BroadcastLogger.js';\nimport { DatabaseClient } from '../../db/adapters/wa-sqlite/DatabaseClient.js';\nimport { generateTabCloseSignal } from '../../shared/locks.js';\n/**\n * @internal\n * Manual message events for shared sync clients\n */\nexport var SharedSyncClientEvent;\n(function (SharedSyncClientEvent) {\n /**\n * This client requests the shared sync manager should\n * close it's connection to the client.\n */\n SharedSyncClientEvent[\"CLOSE_CLIENT\"] = \"close-client\";\n SharedSyncClientEvent[\"CLOSE_ACK\"] = \"close-ack\";\n})(SharedSyncClientEvent || (SharedSyncClientEvent = {}));\n/**\n * HACK: The shared implementation wraps and provides its own\n * PowerSyncBackendConnector when generating the streaming sync implementation.\n * We provide this unused placeholder when connecting with the ConnectionManager.\n */\nconst CONNECTOR_PLACEHOLDER = {};\n/**\n * @internal\n * Shared sync implementation which runs inside a shared webworker\n */\nexport class SharedSyncImplementation extends BaseObserver {\n ports;\n isInitialized;\n statusListener;\n syncParams;\n lastConnectOptions;\n portMutex;\n subscriptions = [];\n connectionManager;\n syncStatus;\n logger;\n database = this.generateReconnectableDatabase();\n sharedCloseSignal = generateTabCloseSignal();\n constructor() {\n super();\n this.ports = [];\n this.syncParams = null;\n this.lastConnectOptions = undefined;\n this.portMutex = new Mutex();\n this.isInitialized = new Promise((resolve) => {\n const callback = this.registerListener({\n initialized: () => {\n resolve();\n callback?.();\n }\n });\n });\n this.logger = new BroadcastLogger('shared-sync', this.ports);\n this.connectionManager = new ConnectionManager({\n createSyncImplementation: async () => {\n await this.waitForReady();\n const sync = await this.generateStreamingImplementation();\n const removeStatusListener = sync.registerListener({\n statusChanged: (snapshot) => {\n this.syncStatus = snapshot;\n const json = snapshot.toJSON();\n this.ports.forEach((p) => p.clientProvider.statusChanged(json));\n }\n });\n return {\n sync,\n onDispose: () => {\n removeStatusListener();\n // Clear transient state so new tabs don't inherit stale errors.\n // Preserve core status, including hasSynced and lastSyncedAt.\n this.syncStatus &&= new SyncStatusSnapshot(this.syncStatus.core, {});\n }\n };\n },\n logger: this.logger,\n defaultConnectionMethod: SyncStreamConnectionMethod.HTTP\n });\n }\n get isConnected() {\n return this.connectionManager.syncStreamImplementation?.isConnected ?? false;\n }\n /**\n * Gets the last client port which we know is safe from unexpected closes.\n */\n async getLastWrappedPort() {\n // Find the last port which is not closing\n return await this.portMutex.runExclusive(() => {\n for (let i = this.ports.length - 1; i >= 0; i--) {\n if (!this.ports[i].isClosing) {\n return this.ports[i];\n }\n }\n return;\n });\n }\n /**\n * In some very rare cases a specific tab might not respond to requests.\n * This returns a random port which is not closing.\n */\n async getRandomWrappedPort() {\n return await this.portMutex.runExclusive(() => {\n const nonClosingPorts = this.ports.filter((p) => !p.isClosing);\n return nonClosingPorts[Math.floor(Math.random() * nonClosingPorts.length)];\n });\n }\n async waitUntilStatusMatches(predicate) {\n return this.withSyncImplementation(async (sync) => {\n return sync.waitUntilStatusMatches(predicate);\n });\n }\n async waitForReady() {\n return this.isInitialized;\n }\n collectActiveSubscriptions() {\n this.logger.log({ level: LogLevels.debug, message: 'Collecting active stream subscriptions across tabs' });\n const active = new Map();\n for (const port of this.ports) {\n for (const stream of port.currentSubscriptions) {\n const serializedKey = JSON.stringify(stream);\n active.set(serializedKey, stream);\n }\n }\n this.subscriptions = [...active.values()];\n this.logger.log({\n level: LogLevels.debug,\n message: `Collected stream subscriptions, ${JSON.stringify(this.subscriptions)}`\n });\n this.connectionManager.syncStreamImplementation?.updateSubscriptions(this.subscriptions);\n }\n updateSubscriptions(port, subscriptions) {\n port.currentSubscriptions = subscriptions;\n this.collectActiveSubscriptions();\n }\n setLogLevel(level) {\n this.logger.setLevel(level);\n }\n /**\n * Configures the DBAdapter connection and a streaming sync client.\n */\n async setParams(params) {\n await this.portMutex.runExclusive(async () => {\n this.collectActiveSubscriptions();\n });\n if (this.syncParams) {\n // Cannot modify already existing sync implementation params\n return;\n }\n // First time setting params\n this.syncParams = params;\n this.logger.sendBroadcasts = params.enableBroadcastLogs;\n // Ensure we have a usable database connection, the reconnectable database will connect lazily on first use.\n await this.database.readLock(async () => { });\n self.onerror = (event) => {\n // Share any uncaught events on the broadcast logger\n this.logger.log({\n level: LogLevels.error,\n message: 'Uncaught exception in PowerSync shared sync worker',\n error: event\n });\n };\n this.iterateListeners((l) => l.initialized?.());\n }\n async dispose() {\n await this.waitForReady();\n this.statusListener?.();\n return this.connectionManager.close();\n }\n /**\n * Connects to the PowerSync backend instance.\n * Multiple tabs can safely call this in their initialization.\n * The connection will simply be reconnected whenever a new tab\n * connects.\n */\n async connect(options, serializedSchema) {\n this.lastConnectOptions = options;\n return this.connectionManager.connect(CONNECTOR_PLACEHOLDER, options ?? {}, serializedSchema);\n }\n async disconnect() {\n return this.connectionManager.disconnect();\n }\n /**\n * Adds a new client tab's message port to the list of connected ports\n */\n addPort(port, capabilities) {\n return this.portMutex.runExclusive(() => {\n if (this.ports.length) {\n // If we're already tracking a port, the added port must connect in the same mode (download or upload only, or\n // both).\n const anyPort = this.ports[0];\n checkCapabilitiesCompatible(anyPort.clientCapabilities, capabilities);\n }\n const portProvider = {\n port,\n clientProvider: Comlink.wrap(port),\n currentSubscriptions: [],\n closeListeners: [],\n isClosing: false,\n clientCapabilities: capabilities\n };\n this.ports.push(portProvider);\n // Give the newly connected client the latest status\n const status = this.syncStatus;\n if (status) {\n portProvider.clientProvider.statusChanged(status.toJSON());\n }\n return portProvider;\n });\n }\n /**\n * Removes a message port client from this manager's managed\n * clients.\n */\n async removePort(port) {\n // Ports might be removed faster than we can process them.\n port.isClosing = true;\n // Remove the port within a mutex context.\n // Warns if the port is not found. This should not happen in practice.\n // We return early if the port is not found.\n return await this.portMutex.runExclusive(async () => {\n const index = this.ports.findIndex((p) => p == port);\n if (index < 0) {\n this.logger.log({\n level: LogLevels.warn,\n message: `Could not remove port ${port} since it is not present in active ports.`\n });\n return () => { };\n }\n const trackedPort = this.ports[index];\n // Remove from the list of active ports\n this.ports.splice(index, 1);\n // Close the worker wrapped database connection, we can't accurately rely on this connection\n for (const closeListener of trackedPort.closeListeners) {\n await closeListener();\n }\n this.collectActiveSubscriptions();\n return () => trackedPort.clientProvider[Comlink.releaseProxy]();\n });\n }\n triggerCrudUpload() {\n this.withSyncImplementation(async (sync) => {\n sync.triggerCrudUpload();\n });\n }\n requestCheckpoint() {\n return this.withSyncImplementation((sync) => sync.requestCheckpoint());\n }\n async withSyncImplementation(callback) {\n await this.waitForReady();\n if (this.connectionManager.syncStreamImplementation) {\n return callback(this.connectionManager.syncStreamImplementation);\n }\n const sync = await new Promise((resolve) => {\n const dispose = this.connectionManager.registerListener({\n syncStreamCreated: (sync) => {\n resolve(sync);\n dispose?.();\n }\n });\n });\n return callback(sync);\n }\n generateStreamingImplementation() {\n // This should only be called after initialization has completed\n const syncParams = this.syncParams;\n const capabilities = this.ports[0]?.clientCapabilities;\n if (!capabilities) {\n throw new Error('Cannot create a sync implementation without connected clients');\n }\n const connector = {};\n if (capabilities.hasFetchCredentials) {\n // Always forward invalidations to the tab, since it has its own credentials cache (and potentially a\n // connector-level invalidateCredentials callback).\n connector.invalidateCredentials = async () => {\n const lastPort = await this.getLastWrappedPort();\n if (!lastPort) {\n throw new Error('No client port found to invalidate credentials');\n }\n try {\n this.logger.log({\n level: LogLevels.info,\n message: 'calling the last port client provider to invalidate credentials'\n });\n lastPort.clientProvider.invalidateCredentials();\n }\n catch (error) {\n this.logger.log({ level: LogLevels.error, message: 'error invalidating credentials', error });\n }\n };\n }\n if (capabilities.hasFetchCredentials) {\n connector.fetchCredentials = (signal) => {\n return this.#useConnector((port) => {\n this.logger.log({\n level: LogLevels.info,\n message: 'calling the last port client provider for credentials'\n });\n return port.clientProvider.fetchCredentials();\n }, 'fetchCredentials', signal);\n };\n }\n if (capabilities.hasUploadCrud) {\n connector.uploadCrud = (signal) => {\n return this.#useConnector((port) => port.clientProvider.uploadCrud(), 'uploadCrud', signal);\n };\n }\n if (capabilities.hasPostCheckpointRequest) {\n connector.postCheckpointRequest = (clientId, requestId, signal) => {\n return this.#useConnector((port) => port.clientProvider.postCheckpointRequest(clientId, requestId), 'postCheckpointRequest', signal);\n };\n }\n // Create a new StreamingSyncImplementation for each connect call. This is usually done is all SDKs.\n return new WebStreamingSyncImplementation({\n adapter: new SqliteBucketStorage(this.database, this.logger),\n connector,\n remote: new WebRemote(connector, this.logger),\n ...syncParams.streamOptions,\n subscriptions: this.subscriptions,\n // Logger cannot be transferred just yet\n logger: this.logger\n });\n }\n /**\n * Calls into a client tab, stopping the wait on disconnect when a signal is supplied.\n */\n async #useConnector(inner, debugContext, signal) {\n const action = async () => {\n const lastPort = await this.getLastWrappedPort();\n if (!lastPort) {\n throw new Error(`No client port found for ${debugContext}`);\n }\n return await new Promise((resolve, reject) => {\n const portClosed = () => {\n reject(new Error(`Tab closed while handling ${debugContext}`));\n };\n lastPort.closeListeners.push(portClosed);\n inner(lastPort)\n .then(resolve, reject)\n .finally(() => {\n const index = lastPort.closeListeners.indexOf(portClosed);\n if (index >= 0) {\n lastPort.closeListeners.splice(index, 1);\n }\n });\n });\n };\n // Include port lookup in the guard: port removal can hold portMutex.\n return signal ? withAbort({ signal, action }) : action();\n }\n /**\n * Requests a random client to share its database connection with us.\n */\n async openInternalDB(handleClosed) {\n const client = await this.getRandomWrappedPort();\n if (!client) {\n // Should not really happen in practice\n throw new Error(`Could not open DB connection since no client is connected.`);\n }\n // Fail-safe timeout for opening a database connection.\n const timeout = setTimeout(() => {\n abortController.abort();\n }, 10_000);\n /**\n * Handle cases where the client might close while opening a connection.\n */\n const abortController = new AbortController();\n const closeListener = () => {\n abortController.abort();\n };\n const removeCloseListener = () => {\n const index = client.closeListeners.indexOf(closeListener);\n if (index >= 0) {\n client.closeListeners.splice(index, 1);\n }\n };\n client.closeListeners.push(closeListener);\n const workerPort = await withAbort({\n action: () => client.clientProvider.getDBWorkerPort(),\n signal: abortController.signal,\n cleanupOnAbort: (port) => {\n port.close();\n }\n }).catch((ex) => {\n removeCloseListener();\n throw ex;\n });\n const remote = Comlink.wrap(workerPort);\n const identifier = this.syncParams.dbParams.dbFilename;\n const clientLockName = await this.sharedCloseSignal;\n /**\n * The open could fail if the tab is closed while we're busy opening the database.\n * This operation is typically executed inside an exclusive portMutex lock.\n * We typically execute the closeListeners using the portMutex in a different context.\n * We can't rely on the closeListeners to abort the operation if the tab is closed.\n */\n const db = await withAbort({\n action: async () => {\n const clientView = await remote.connectToExisting({ identifier, lockName: clientLockName });\n return new DatabaseClient({\n connection: clientView,\n source: remote,\n // It's possible for this worker to outlive the client hosting the database for us. We need to be prepared for\n // that and ensure pending requests are aborted when the tab is closed.\n remoteCanCloseUnexpectedly: true\n }, this.syncParams.dbParams);\n },\n signal: abortController.signal,\n cleanupOnAbort: (db) => {\n db.close();\n }\n }).finally(() => {\n // We can remove the close listener here since we no longer need it past this point.\n removeCloseListener();\n });\n clearTimeout(timeout);\n client.closeListeners.push(async () => {\n this.logger.log({ level: LogLevels.info, message: 'Aborting open connection because associated tab closed.' });\n handleClosed(db);\n /**\n * Don't await this close operation. It might never resolve if the tab is closed.\n * We mark the remote as closed first, this will reject any pending requests.\n * We then call close. The close operation is configured to fire-and-forget, the main promise will reject immediately.\n */\n db.markRemoteClosed();\n db.close().catch((error) => this.logger.log({ level: LogLevels.warn, message: 'error closing database connection', error }));\n });\n return db;\n }\n generateReconnectableDatabase() {\n const syncParams = this.syncParams;\n const sharedSync = this;\n return new (class extends DBAdapter {\n connectionState = null;\n get name() {\n return syncParams?.dbParams.dbFilename;\n }\n async connect() {\n if (this.connectionState == null) {\n const handleClosed = this.handleClientClosed.bind(this);\n this.connectionState = (async () => {\n try {\n const db = await sharedSync.openInternalDB(handleClosed);\n db.registerListener({\n tablesUpdated: (notification) => {\n this.iterateListeners((l) => l.tablesUpdated?.(notification));\n }\n });\n this.connectionState = db;\n return db;\n }\n catch (e) {\n // Allow reconnecting when the database is used again.\n this.connectionState = null;\n throw e;\n }\n })();\n }\n return await this.connectionState;\n }\n async close() {\n if (this.connectionState != null) {\n await (await this.connectionState).close();\n }\n }\n handleClientClosed(client) {\n if (client === this.connectionState) {\n this.connectionState = null;\n // We may have missed some table updates while the database was closed.\n // We can poke the crud in case we missed any updates.\n const impl = sharedSync.connectionManager.syncStreamImplementation;\n impl?.triggerCrudUpload();\n // The Rust client implementation stores sync state on the connection level. Reopening the database causes a\n // disruption of the connection state and forces us to reconnect. We want to do that as soon as possible to\n // minimize downtime.\n impl?.markConnectionMayHaveChanged();\n }\n }\n async readLock(fn, options) {\n const db = await this.connect();\n return db.readLock(fn, options);\n }\n async writeLock(fn, options) {\n const db = await this.connect();\n return db.writeLock(fn, options);\n }\n async refreshSchema() {\n // Not used by sync client.\n }\n })();\n }\n}\n/**\n * Runs the action with an abort controller.\n */\nfunction withAbort(options) {\n const { action, signal, cleanupOnAbort } = options;\n const abortError = () => signal.reason instanceof Error ? signal.reason : new AbortOperation('Operation aborted by abort controller');\n return new Promise((resolve, reject) => {\n if (signal.aborted) {\n reject(abortError());\n return;\n }\n function handleAbort() {\n signal.removeEventListener('abort', handleAbort);\n reject(abortError());\n }\n signal.addEventListener('abort', handleAbort, { once: true });\n function completePromise(action) {\n signal.removeEventListener('abort', handleAbort);\n action();\n }\n action()\n .then((data) => {\n // We already rejected due to the abort, allow for cleanup\n if (signal.aborted) {\n return completePromise(() => cleanupOnAbort?.(data));\n }\n completePromise(() => resolve(data));\n })\n .catch((e) => completePromise(() => reject(e)));\n });\n}\nfunction checkCapabilitiesCompatible(a, b) {\n if (a.hasFetchCredentials != b.hasFetchCredentials ||\n a.hasUploadCrud != b.hasUploadCrud ||\n a.hasPostCheckpointRequest != b.hasPostCheckpointRequest) {\n throw new Error('Different tabs connecting in different modes (download-only / upload-only / full, or with and without custom checkpoint requests) is not supported');\n }\n}\n//# sourceMappingURL=SharedSyncImplementation.js.map","import * as Comlink from 'comlink';\nimport { AbstractSharedSyncClientProvider } from '../../worker/sync/AbstractSharedSyncClientProvider.js';\nimport { SharedSyncClientEvent } from '../../worker/sync/SharedSyncImplementation.js';\nimport { WebStreamingSyncImplementation } from './WebStreamingSyncImplementation.js';\nimport { generateTabCloseSignal } from '../../shared/locks.js';\nimport { serializeErrorForRelay } from '@powersync/shared-internals';\nimport { connectToExistingWorker, connectToWorker } from '../../worker/client.js';\n/**\n * The shared worker will trigger methods on this side of the message port\n * via this client provider.\n */\nclass SharedSyncClientProvider extends AbstractSharedSyncClientProvider {\n options;\n statusChanged;\n webDB;\n constructor(options, statusChanged, webDB) {\n super();\n this.options = options;\n this.statusChanged = statusChanged;\n this.webDB = webDB;\n }\n async getDBWorkerPort() {\n const { port } = await this.webDB.shareConnection();\n return Comlink.transfer(port, [port]);\n }\n async #relay(action) {\n try {\n return await action();\n }\n catch (ex) {\n /**\n * Connector callbacks run in this tab and their rejection crosses the\n * MessagePort to the sync worker, so serialize it here, where the error\n * originates, before Comlink's error transfer can drop custom fields.\n */\n throw serializeErrorForRelay(ex);\n }\n }\n invalidateCredentials() {\n this.options.remote.invalidateCredentials();\n }\n async fetchCredentials() {\n const credentials = await this.#relay(() => this.options.remote.getCredentials());\n if (credentials == null) {\n return null;\n }\n /**\n * The credentials need to be serializable.\n * Users might extend [PowerSyncCredentials] to contain\n * items which are not serializable.\n * This returns only the essential fields.\n */\n return {\n endpoint: credentials.endpoint,\n token: credentials.token\n };\n }\n async uploadCrud() {\n /**\n * Don't return anything here, just incase something which is not\n * serializable is returned from the `uploadCrud` function.\n */\n await this.#relay(() => this.options.connector.uploadCrud());\n }\n async postCheckpointRequest(clientId, requestId) {\n return await this.#relay(async () => (await this.options.connector.postCheckpointRequest(clientId, requestId)) ?? null);\n }\n get logger() {\n return this.options.logger;\n }\n log(record) {\n this.logger.log(record);\n }\n}\n/**\n * The local part of the sync implementation on the web, which talks to a sync implementation hosted in a shared worker.\n */\nexport class SharedWebStreamingSyncImplementation extends WebStreamingSyncImplementation {\n syncManager;\n clientProvider;\n worker;\n isInitialized;\n dbAdapter;\n abortOnClose = new AbortController();\n logLevel;\n enableBroadcastLogs;\n constructor(options) {\n super(options);\n this.dbAdapter = options.db;\n this.logLevel = options.logLevel;\n this.enableBroadcastLogs = options.enableBroadcastLogs;\n const syncWorker = options.sync?.worker;\n if (typeof syncWorker === 'function') {\n this.worker = connectToExistingWorker(syncWorker(), options.logger, 'sync');\n }\n else {\n this.worker = connectToWorker({\n service: 'sync',\n databaseIdentifier: this.webOptions.identifier,\n shared: true,\n customWorker: syncWorker,\n loggerForErrors: options.logger\n });\n }\n /**\n * Pass along any sync status updates to this listener\n */\n this.clientProvider = new SharedSyncClientProvider(this.webOptions, ({ core, dataFlow }) => {\n this.updateSyncStatus(core, dataFlow);\n }, options.db);\n this.syncManager = Comlink.wrap(this.worker.endpoint);\n /**\n * The sync worker will call this client provider when it needs\n * to fetch credentials or upload data.\n * This performs bi-directional method calling.\n */\n Comlink.expose(this.clientProvider, this.worker.endpoint);\n this.syncManager.setLogLevel(this.logLevel);\n this.triggerCrudUpload = this.syncManager.triggerCrudUpload;\n /**\n * Opens MessagePort to the existing shared DB worker.\n * The sync worker cannot initiate connections directly to the\n * DB worker, but a port to the DB worker can be transferred to the\n * sync worker.\n */\n this.isInitialized = this._init();\n }\n async _init() {\n /**\n * The general flow of initialization is:\n * - The client requests a unique navigator lock.\n * - Once the lock is acquired, we register the lock with the shared worker.\n * - The shared worker can then request the same lock. The client has been closed if the shared worker can acquire the lock.\n * - Once the shared worker knows the client's lock, we can guarentee that the shared worker will detect if the client has been closed.\n * - This makes the client safe for the shared worker to use.\n * - The client is only added to the SharedSyncImplementation once the lock has been registered.\n * This ensures we don't ever keep track of dead clients (tabs that closed before the lock was registered).\n * - The client side lock is held until the client is disposed.\n * - We resolve the top-level promise after the lock has been registered with the shared worker.\n * - The client sends the params to the shared worker after locks have been registered.\n */\n const closeSignal = await generateTabCloseSignal(this.abortOnClose.signal);\n const { identifier, connector } = this.options;\n // Awaiting here ensures the worker is waiting for the lock\n await this.syncManager.initialize(closeSignal, {\n hasFetchCredentials: !!connector.fetchCredentials,\n hasPostCheckpointRequest: !!connector.postCheckpointRequest,\n hasUploadCrud: !!connector.uploadCrud\n });\n await this.syncManager.setParams({\n dbParams: this.dbAdapter.getConfiguration(),\n streamOptions: {\n identifier,\n serializedSchema: this.options.serializedSchema\n },\n enableBroadcastLogs: this.enableBroadcastLogs\n }, this.options.subscriptions);\n }\n /**\n * Starts the sync process, this effectively acts as a call to\n * `connect` if not yet connected.\n */\n async connect(options) {\n await this.waitForReady();\n return this.syncManager.connect(options, this.options.serializedSchema);\n }\n async disconnect() {\n await this.waitForReady();\n return this.syncManager.disconnect();\n }\n async dispose() {\n let registeredWithWorker = true;\n try {\n await this.waitForReady();\n }\n catch {\n // The worker rejected this client (e.g. because it connects in a mode incompatible with other tabs), so it won't\n // acknowledge a close request either.\n registeredWithWorker = false;\n }\n if (registeredWithWorker) {\n await this.#closeWorkerClient();\n }\n await super.dispose();\n this.abortOnClose.abort();\n // Release the proxy\n this.syncManager[Comlink.releaseProxy]();\n this.worker.close();\n }\n #closeWorkerClient() {\n return new Promise((resolve) => {\n // This will always be a message port since we use shared workers.\n const messagePort = this.worker.endpoint;\n // Listen for the close acknowledgment from the worker\n messagePort.addEventListener('message', (event) => {\n const payload = event.data;\n if (payload?.event === SharedSyncClientEvent.CLOSE_ACK) {\n resolve();\n }\n });\n // Signal the shared worker that this client is closing its connection to the worker\n const closeMessagePayload = {\n event: SharedSyncClientEvent.CLOSE_CLIENT,\n data: {}\n };\n messagePort.postMessage(closeMessagePayload);\n });\n }\n async waitForReady() {\n return this.isInitialized;\n }\n requestCheckpoint() {\n return this.syncManager.requestCheckpoint();\n }\n updateSubscriptions(subscriptions) {\n this.syncManager.updateSubscriptions(subscriptions);\n }\n}\n//# sourceMappingURL=SharedWebStreamingSyncImplementation.js.map","import { LockType } from '@powersync/shared-internals';\nimport { WebStreamingSyncImplementation } from './WebStreamingSyncImplementation.js';\n/**\n * When multi-tab support is disabled and we don't use a shared worker for sync, only a single tab will be able to\n * acquire the sync navigator lock and start a sync iteration.\n *\n * To be able to provide _some_ multi-tab support in that configuration, this utility:\n *\n * 1. Sends sync status updates from the syncing tab to others.\n * 2. Allows other tabs to send notifications when their active sync stream subscriptions update, allowing the active\n * tab to take those subscriptions into account.\n */\nexport class TabLocalStreamingSyncImplementation extends WebStreamingSyncImplementation {\n #statusUpdated;\n #subscriptionsChanged;\n #hasSyncLock = false;\n constructor(options) {\n super(options);\n const identifier = options.identifier;\n this.#statusUpdated = new BroadcastChannel(`sync-status-${identifier}`);\n this.#subscriptionsChanged = new BroadcastChannel(`subscription-change-${identifier}`);\n this.#statusUpdated.onmessage = (event) => {\n if (event.data == 'ping') {\n this.#sendStatus(this.syncStatus);\n return;\n }\n const { core, dataFlow } = event.data;\n this.updateSyncStatus(core, dataFlow);\n };\n // Request other tabs to share their sync status.\n this.#statusUpdated.postMessage('ping');\n this.#subscriptionsChanged.onmessage = () => {\n // We can't update activeStreams since we don't know when another tab referencing them is closed. However,\n // clients will update an internal table listing streams after subscribing, and updateSubscriptions() will\n // scan that table.\n super.updateSubscriptions(this.activeStreams);\n };\n this.registerListener({\n statusChanged: (status) => this.#sendStatus(status)\n });\n }\n #sendStatus(status) {\n // Don't share sync status if this is not the tab currently syncing.\n if (this.#hasSyncLock) {\n this.#statusUpdated.postMessage(status.toJSON());\n }\n }\n updateSubscriptions(subscriptions) {\n super.updateSubscriptions(subscriptions);\n this.#subscriptionsChanged.postMessage('');\n }\n obtainLock({ callback, type, signal }) {\n const wrappedCallback = async () => {\n this.#hasSyncLock = true;\n try {\n return await callback();\n }\n finally {\n this.#hasSyncLock = false;\n }\n };\n return super.obtainLock({ callback: type == LockType.SYNC ? wrappedCallback : callback, type, signal });\n }\n async dispose() {\n this.#statusUpdated.close();\n this.#subscriptionsChanged.close();\n await super.dispose();\n }\n}\n//# sourceMappingURL=TabLocalStreamingSyncImplementation.js.map","import { BaseObserver } from '@powersync/common';\n/**\n * Live database instances in this page, for development tooling.\n *\n * Every {@link WebPowerSyncDatabase} registers itself when constructed and leaves when closed, so a\n * tool that runs in the same page (for example the diagnostics Vite plugin's injected agent) can find\n * the app's databases without the app wiring anything up. The set holds only instances that already\n * exist, so it adds nothing to a production bundle beyond the references themselves.\n */\nclass DatabaseRegistry extends BaseObserver {\n databases = new Set();\n notify() {\n const snapshot = [...this.databases];\n this.iterateListeners((listener) => listener.databasesChanged?.(snapshot));\n }\n}\nconst registry = new DatabaseRegistry();\n/** @internal Called by the database constructor. */\nexport function registerDatabase(db) {\n registry.databases.add(db);\n registry.notify();\n}\n/** @internal Called when the database closes. */\nexport function unregisterDatabase(db) {\n if (registry.databases.delete(db)) {\n registry.notify();\n }\n}\n/** The databases currently open in this page. */\nexport function getRegisteredDatabases() {\n return [...registry.databases];\n}\n/**\n * Calls `listener` with the current databases now, and again whenever one is opened or closed.\n * Returns a function that stops listening.\n */\nexport function observeRegisteredDatabases(listener) {\n const stop = registry.registerListener({ databasesChanged: listener });\n listener([...registry.databases]);\n return stop;\n}\n//# sourceMappingURL=registry.js.map","import { LogLevels } from '@powersync/common';\nimport { BasePowerSyncDatabase, Mutex, openDatabase } from '@powersync/shared-internals';\nimport { getNavigatorLocks } from '../shared/locks.js';\nimport { NAVIGATOR_TRIGGER_CLAIM_MANAGER } from './NavigatorTriggerClaimManager.js';\nimport { WASQLiteOpenFactory } from './adapters/wa-sqlite/WASQLiteOpenFactory.js';\nimport { SSRStreamingSyncImplementation } from './sync/SSRWebStreamingSyncImplementation.js';\nimport { SharedWebStreamingSyncImplementation } from './sync/SharedWebStreamingSyncImplementation.js';\nimport { WebRemote } from './sync/WebRemote.js';\nimport { AsyncDbAdapter } from './adapters/AsyncWebAdapter.js';\nimport { resolveAndValidateOptions } from './adapters/resolveAndValidateOptions.js';\nimport { TabLocalStreamingSyncImplementation } from './sync/TabLocalStreamingSyncImplementation.js';\nimport { registerDatabase, unregisterDatabase } from '../devtools/registry.js';\n/**\n * @internal Use {@link PowerSyncDatabase} instead, this class is only used by other SDKs also needing web support.\n */\nexport class WebPowerSyncDatabase extends BasePowerSyncDatabase {\n static SHARED_MUTEX = new Mutex();\n resolvedOpenOptions;\n enableBroadcastLogs;\n constructor(options) {\n const resolvedOpenOptions = resolveAndValidateOptions('database' in options ? options.database : {});\n super(options);\n this.resolvedOpenOptions = resolvedOpenOptions;\n this.enableBroadcastLogs = options.broadcastLogs ?? true;\n // Lets development tooling in this page find the live databases.\n registerDatabase(this);\n }\n get sdkName() {\n return '@powersync/web';\n }\n async _initialize() {\n if (this.database instanceof AsyncDbAdapter) {\n /**\n * While init is done automatically,\n * LockedAsyncDatabaseAdapter only exposes config after init.\n * We can explicitly wait for init here in order to access config.\n */\n await this.database.init();\n }\n // In some cases, like the SQLJs adapter, we don't pass a WebDBAdapter, so we need to check.\n if (typeof this.database.getConfiguration == 'function') {\n const config = this.database.getConfiguration();\n if (config.requiresPersistentTriggers) {\n this.triggersImpl.updateDefaults({\n useStorageByDefault: true\n });\n }\n }\n }\n generateTriggerManagerConfig() {\n return {\n // We need to share hold information between tabs for web\n claimManager: NAVIGATOR_TRIGGER_CLAIM_MANAGER\n };\n }\n openDBAdapter() {\n return openDatabase(this.options, (options) => {\n const defaultFactory = new WASQLiteOpenFactory({\n logger: this.logger,\n open: options\n });\n return defaultFactory.openDB();\n });\n }\n /**\n * Closes the database connection.\n * By default the sync stream client is only disconnected if\n * multiple tabs are not enabled.\n */\n async close(options) {\n await super.close({\n // Don't disconnect by default if multiple tabs are enabled\n disconnect: options?.disconnect ?? !this.resolvedOpenOptions.enableMultiTabs\n });\n unregisterDatabase(this);\n }\n async loadVersion() {\n if (this.resolvedOpenOptions.ssrMode) {\n return;\n }\n return super.loadVersion();\n }\n async resolveOfflineSyncStatus() {\n if (this.resolvedOpenOptions.ssrMode) {\n return;\n }\n return super.resolveOfflineSyncStatus();\n }\n async runExclusive(cb) {\n if (this.resolvedOpenOptions.ssrMode) {\n return WebPowerSyncDatabase.SHARED_MUTEX.runExclusive(cb);\n }\n return getNavigatorLocks().request(`lock-${this.database.name}`, cb);\n }\n generateSyncStreamImplementation(connector, options) {\n const remote = new WebRemote(connector, this.logger);\n const syncOptions = {\n ...this.options,\n ...this.commonSyncOptions(connector, options),\n remote\n };\n if (this.resolvedOpenOptions.ssrMode) {\n return new SSRStreamingSyncImplementation();\n }\n else if (this.resolvedOpenOptions.enableMultiTabs) {\n if (!this.enableBroadcastLogs) {\n const warning = `\n Multiple tabs are enabled, but broadcasting of logs is disabled.\n Logs for shared sync worker will only be available in the shared worker context\n `;\n const logger = this.options.logger;\n logger ? logger.log({ level: LogLevels.warn, message: warning }) : console.warn(warning);\n }\n if ('shareConnection' in this.database) {\n return new SharedWebStreamingSyncImplementation({\n ...syncOptions,\n db: this.database, // This should always be the case\n logLevel: this.options.sync?.logLevel ?? LogLevels.info,\n enableBroadcastLogs: this.enableBroadcastLogs\n });\n }\n this.logger.log({\n level: LogLevels.warn,\n message: \"Not using a shared sync worker because the database adapter doesn't support it.\"\n });\n }\n return new TabLocalStreamingSyncImplementation(syncOptions);\n }\n}\n/**\n * A PowerSync database which provides SQLite functionality\n * which is automatically synced.\n *\n * @example\n * ```typescript\n * export const db = new PowerSyncDatabase({\n * schema: AppSchema,\n * database: {\n * dbFilename: 'example.db'\n * }\n * });\n * ```\n */\n// Typed constructor to avoid leaking AbstractPowerSyncDatabase into the public interface\nexport const PowerSyncDatabase = WebPowerSyncDatabase;\n//# sourceMappingURL=PowerSyncDatabase.js.map","// @ts-expect-error\nimport { FacadeVFS } from '@journeyapps/wa-sqlite/src/FacadeVFS.js';\nimport { MemoryVFS } from '@journeyapps/wa-sqlite/src/examples/MemoryVFS.js';\nimport * as VFS from '@journeyapps/wa-sqlite/src/VFS.js';\nexport class SimpleOpfsFileSystem extends FacadeVFS {\n #files = null;\n #memory;\n #openedFiles = new Map();\n #openRoot;\n constructor(name, module, openRoot) {\n super(name, module);\n this.#memory = new MemoryVFS(`${name}-memory`, module);\n this.#openRoot = openRoot;\n }\n #requireFiles() {\n if (this.#files == null) {\n throw new Error(`Called OPFS method while closed.`);\n }\n return this.#files;\n }\n #requireFile(file) {\n return this.#requireFiles().files[file.index];\n }\n #useFile(options) {\n const opened = this.#openedFiles.get(options.fileId);\n if (opened != null) {\n try {\n return options.opfs(this.#requireFile(opened));\n }\n catch (e) {\n console.error('OPFS VFS error', e);\n return VFS.SQLITE_IOERR;\n }\n }\n else {\n return options.memory(this.#memory);\n }\n }\n jOpen(zName, fileId, flags, pOutFlags) {\n if (flags & VFS.SQLITE_OPEN_MAIN_DB) {\n if (zName != '/database') {\n return VFS.SQLITE_CANTOPEN;\n }\n this.#openedFiles.set(fileId, database);\n return VFS.SQLITE_OK;\n }\n else if (flags & VFS.SQLITE_OPEN_MAIN_JOURNAL) {\n if (zName != '/database-journal') {\n return VFS.SQLITE_CANTOPEN;\n }\n this.#openedFiles.set(fileId, databaseJournal);\n return VFS.SQLITE_OK;\n }\n else {\n // We don't care about other files (like those for materialized views). Back them by the in-memory VFS.\n return this.#memory.jOpen(zName, fileId, flags, pOutFlags);\n }\n }\n jDelete(name, syncDir) {\n switch (name) {\n case '/database':\n case '/database-journal':\n // We don't support deleting files in this VFS, and use a journal mode where that is not necessary.\n return VFS.SQLITE_IOERR_DELETE;\n default:\n return this.#memory.jDelete(name, syncDir);\n }\n }\n jAccess(zName, flags, pResOut) {\n switch (zName) {\n case '/database':\n case '/database-journal':\n // These always exist\n pResOut.setInt32(0, 1, true);\n return VFS.SQLITE_OK;\n default:\n return this.#memory.jAccess(zName, flags, pResOut);\n }\n }\n jClose(fileId) {\n return this.#useFile({\n fileId,\n opfs: () => {\n this.#openedFiles.delete(fileId);\n return VFS.SQLITE_OK;\n },\n memory: (m) => m.jClose(fileId)\n });\n }\n jRead(fileId, data, iOffset) {\n return this.#useFile({\n fileId,\n opfs: (file) => {\n const bytesRead = file.read(data.subarray(), { at: iOffset });\n if (bytesRead < data.byteLength) {\n data.fill(0, bytesRead);\n return VFS.SQLITE_IOERR_SHORT_READ;\n }\n return VFS.SQLITE_OK;\n },\n memory: (m) => m.jRead(fileId, data, iOffset)\n });\n }\n jWrite(fileId, data, iOffset) {\n return this.#useFile({\n fileId,\n opfs: (file) => {\n const nBytes = file.write(data.subarray(), { at: iOffset });\n if (nBytes !== data.byteLength)\n throw new Error('short write');\n return VFS.SQLITE_OK;\n },\n memory: (m) => m.jWrite(fileId, data, iOffset)\n });\n }\n jTruncate(fileId, iSize) {\n return this.#useFile({\n fileId,\n opfs: (file) => {\n file.truncate(iSize);\n return VFS.SQLITE_OK;\n },\n memory: (m) => m.jTruncate(fileId, iSize)\n });\n }\n jSync(fileId, flags) {\n return this.#useFile({\n fileId,\n opfs: (file) => {\n file.flush();\n return VFS.SQLITE_OK;\n },\n memory: (m) => m.jSync(fileId, flags)\n });\n }\n jFileSize(fileId, pSize64) {\n return this.#useFile({\n fileId,\n opfs: (file) => {\n pSize64.setBigInt64(0, BigInt(file.getSize()), true);\n return VFS.SQLITE_OK;\n },\n memory: (m) => m.jFileSize(fileId, pSize64)\n });\n }\n /**\n * Re-opens a file system previously closed with {@link SimpleOpfsFileSystem.close}.\n */\n async open() {\n console.assert(this.#files == null);\n const { dir, readWriteUnsafe } = await this.#openRoot();\n this.#files = await OpfsFiles.open(dir, readWriteUnsafe);\n }\n /**\n * Closes the synchronous access handles kept open while this file system is active.\n *\n * This file system can be re-opened afterwards with {@link SimpleOpfsFileSystem.open}.\n */\n close() {\n this.#files?.close();\n this.#files = null;\n }\n static directoryResolver(name, readWriteUnsafe, getRoot) {\n const url = new URL(name, 'file://');\n return async () => {\n let dir = await (getRoot ? getRoot() : navigator.storage.getDirectory());\n for (const segment of ['powersync', ...url.pathname.split('/')]) {\n if (!segment.length)\n continue; // Skip initial / and empty directory names\n dir = await dir.getDirectoryHandle(segment, { create: true });\n }\n return { dir, readWriteUnsafe };\n };\n }\n}\nclass OpfsFiles {\n files;\n constructor(database, journal) {\n this.files = [database, journal];\n }\n close() {\n for (const file of this.files) {\n file.close();\n }\n }\n static async open(root, readWriteUnsafe) {\n async function open(name) {\n const handle = await root.getFileHandle(name, { create: true });\n return await (readWriteUnsafe\n ? // @ts-expect-error\n handle.createSyncAccessHandle({ mode: 'readwrite-unsafe' })\n : handle.createSyncAccessHandle());\n }\n const [database, journal] = await Promise.allSettled([open('database'), open('journal')]);\n if (database.status === 'fulfilled' && journal.status === 'fulfilled') {\n return new OpfsFiles(database.value, journal.value);\n }\n if (database.status === 'fulfilled') {\n database.value.close();\n throw journal.reason;\n }\n else if (journal.status === 'fulfilled') {\n journal.value.close();\n }\n throw database.reason;\n }\n}\nconst database = Object.freeze({ index: 0, name: '/database' });\nconst databaseJournal = Object.freeze({ index: 1, name: '/database-journal' });\n//# sourceMappingURL=SimpleOpfsFileSystem.js.map"],"names":["WaSqliteFactory","isSharedWorker"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACO,MAAM,+BAA+B,CAAC;AAC7C,IAAI,YAAY;AAChB,IAAI,SAAS;AACb,IAAI,WAAW,CAAC,YAAY,GAAG,gBAAgB,EAAE;AACjD,QAAQ,IAAI,CAAC,YAAY,GAAG,YAAY;AACxC,IAAI;AACJ,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAC1D,YAAY,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;AAChE,YAAY,OAAO,CAAC,eAAe,GAAG,MAAM;AAC5C,gBAAgB,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC;AACzD,YAAY,CAAC;AACb,YAAY,OAAO,CAAC,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;AAC7D,YAAY,OAAO,CAAC,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;AACzD,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,SAAS;AACvC,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAChD,YA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